diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1997-12-10 19:44:50 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1997-12-10 19:44:50 +0000 |
commit | fc8b8f8bd65d70a0bf423da35a49ebc01e70df84 (patch) | |
tree | b8fe05c28ebf90babb27c47e96eb180f5012383a | |
parent | 2c8a06f4bae9f853e6267f1d4f244be1ee6643e1 (diff) | |
download | ATCD-fc8b8f8bd65d70a0bf423da35a49ebc01e70df84.tar.gz |
*** empty log message ***
41 files changed, 745 insertions, 351 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 3ae4d7118d7..f7384828a29 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,52 @@ +Wed Dec 10 13:15:11 1997 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu> + + * TAO_IDL/be_include/{be_array, be_decl, be_field, be_module, + be_operation, be_predefined_type, be_structure, be_typedef}.h: + Added a protected function called "compute_size_type" which is + invoked if the size type of a data structure is not known in + advance. This happens for structs, unions, arrays, and typedefs + whose size type depends on their base types. + + * TAO_IDL/be/{be_array, be_decl, be_field, be_module, + be_operation, be_predefined_type, be_structure, be_typedef}.cpp: + Implementation of the "compute_size_type". + + * TAO_IDL/be/be_decl.cpp: Changed code that sets "size_type" so + that we first see if we are unknown in which case we set our size + type. However, once we are VARIABLE, no body can reset us to + fixed. Similarly, the overloaded size_type method that return the + size type first checks if our size is still unknown in which case + it calls for "compute_size_type". This is very essential for data + types defined in an imported (included) *.idl file. Thanks to Tom + Richards (tomr@mcmenterprise.com) for reporting the bug with + included file which resulted in this change. + + * TAO_IDL/be/be_state_attribute.cpp: Included a case for + IN_PARAM_TYPE_CH for strings (had previously forgotten to do so). + + * TAO_IDL/be/{be_state_structure, be_structure, be_field}.cpp: + Revamped so that we use the same switch based technique in + be_state_structure.cpp to generate code. For fields that are + sequences or structures or unions, we also generate their code. + + * TAO_IDL/be/be_state_argument.cpp: Thanks to Tom Richards and + Carlos O'Ryan for noticing a bug when we use out sequences. There + used to be a seg fault in deep_free.cpp because a NUL pointer was + being owned by an Any and getting freed. In the server skeleton, + for out params we now generate code after the upcall is made so + that for out parameter value is inserted in the NVList that is + marshaled by the server. + + * TAO_IDL/be/be_interface.cpp: In the generated call to _is_a, we + were calling CORBA::Object::_is_a if a remote call is + necessary. However, MSVC++ cannot handle a call of the form + CORBA::Object::_is_a. So we have to generate code that uses + ACE_CORBA_3 so as to be portable. Thanks to Nanbor Wang + (nw1@cs.wustl.edu). + + * TAO/test/Cubit/TAO/IDL_Cubit/clnt.cpp: Changed the type of the + variable that was passed as the out parameter to cube_sequence. + Wed Dec 10 01:02:36 1997 Chris Cleeland <cleeland@tango.cs.wustl.edu> * tao/iiopobj.cpp (set): Added a special case to IIOP Profile::set @@ -7,7 +56,7 @@ Wed Dec 10 01:02:36 1997 Chris Cleeland <cleeland@tango.cs.wustl.edu> Tue Dec 9 21:48:52 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu> - * tests/Cubit/TAO/IDL_Cubit/clnt.cpp: + * tests/Cubit/TAO/IDL_Cubit/clnt.cpp: The sequence test is not running right now, I'm commenting it out until we can make it work properly. @@ -48,83 +97,83 @@ Tue Dec 9 11:55:50 1997 Chris Cleeland <cleeland@tango.cs.wustl.edu> Mon Dec 8 13:11:46 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu> - * docs/releasenotes/index.html: + * docs/releasenotes/index.html: Added more information on how the Event Channel and friends are going. - * orbsvcs/bin/Naming_Service/svc.conf: + * orbsvcs/bin/Naming_Service/svc.conf: Removed some foreign ^M from the file. - * tao/Makefile: - * tao/connect.cpp: - * tao/giop.cpp: - * tao/orbobj.cpp: - * tao/Timeprobe.i: - * tao/Timeprobe.h: - * tao/Timeprobe.cpp: + * tao/Makefile: + * tao/connect.cpp: + * tao/giop.cpp: + * tao/orbobj.cpp: + * tao/Timeprobe.i: + * tao/Timeprobe.h: + * tao/Timeprobe.cpp: Added a instrumentation class to measure time interval, also instrumented some code, as part of the ongoing effort to optimize the EC, unfortunately the problems are not in TAO ;-) The code is only instrumented if compiled using probe=1, no overhead is introduced in normal compiles. - * tests/Cubit/TAO/IDL_Cubit/cubit.idl: - * tests/Cubit/TAO/IDL_Cubit/clnt.cpp: - * tests/Cubit/TAO/IDL_Cubit/clnt.h: - * tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp: - * tests/Cubit/TAO/IDL_Cubit/cubit_i.h: + * tests/Cubit/TAO/IDL_Cubit/cubit.idl: + * tests/Cubit/TAO/IDL_Cubit/clnt.cpp: + * tests/Cubit/TAO/IDL_Cubit/clnt.h: + * tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp: + * tests/Cubit/TAO/IDL_Cubit/cubit_i.h: Addded code to test sequences (as input and output parameters) they don't work (yet). - * orbsvcs/lib/Makefile: - * orbsvcs/lib/Timeprobe.h: - * orbsvcs/lib/Timeprobe.i: - * orbsvcs/lib/Timeprobe.cpp: + * orbsvcs/lib/Makefile: + * orbsvcs/lib/Timeprobe.h: + * orbsvcs/lib/Timeprobe.i: + * orbsvcs/lib/Timeprobe.cpp: The file was moved to $TAO_ROOT/tao. - * orbsvcs/lib/Scheduler_Factory.cpp: + * orbsvcs/lib/Scheduler_Factory.cpp: Fixed default dump file, it was using stdout! Sat Dec 06 15:42:25 1997 <nw1@DINGO> * tests/Cubit/TAO/IDL_Cubit/{server,client}.dsp: Updated link time library names. - - * tao/any.cpp: - * tao/any.h: - * tao/corba.h: + + * tao/any.cpp: + * tao/any.h: + * tao/corba.h: * tao/corbacom.h: - * tao/decode.cpp: - * tao/encode.cpp: - * tao/except.cpp: - * tao/except.h: - * tao/giop.cpp: - * tao/iiopobj.cpp: - * tao/iiopobj.h: - * tao/iioporb.cpp: - * tao/iioporb.h: - * tao/nvlist.cpp: - * tao/nvlist.h: - * tao/object.cpp: - * tao/object.h: - * tao/object.i: - * tao/orbobj.cpp: - * tao/orbobj.h: - * tao/orbobj.i: - * tao/poa.cpp: - * tao/poa.h: - * tao/principa.cpp: - * tao/principa.h: - * tao/request.cpp: - * tao/request.h: - * tao/stub.h: - * tao/svrrqst.cpp: - * tao/svrrqst.h: - * tao/typecode.cpp: - * tao/typecode.h: - * tao/compat/initguid.h: + * tao/decode.cpp: + * tao/encode.cpp: + * tao/except.cpp: + * tao/except.h: + * tao/giop.cpp: + * tao/iiopobj.cpp: + * tao/iiopobj.h: + * tao/iioporb.cpp: + * tao/iioporb.h: + * tao/nvlist.cpp: + * tao/nvlist.h: + * tao/object.cpp: + * tao/object.h: + * tao/object.i: + * tao/orbobj.cpp: + * tao/orbobj.h: + * tao/orbobj.i: + * tao/poa.cpp: + * tao/poa.h: + * tao/principa.cpp: + * tao/principa.h: + * tao/request.cpp: + * tao/request.h: + * tao/stub.h: + * tao/svrrqst.cpp: + * tao/svrrqst.h: + * tao/typecode.cpp: + * tao/typecode.h: + * tao/compat/initguid.h: * tao/compat/objbase.h: Removed dependencies on Microsoft's DCOM - files. Below is a list of names that got changed. + files. Below is a list of names that got changed. HRESULT -> TAO_HRESULT IID -> TAO_IID @@ -147,7 +196,7 @@ Fri Dec 5 11:42:25 1997 Chris Cleeland <cleeland@cs.wustl.edu> the following situation: machine has 3 interfaces (not including loopback), and it is desired that clients and servers communicate across only one interface. - + When our IDL_Cubit example's factory created new Cubit instances, the set() method would set the host name for that IIOP::Profile to whatever ACE_INET_Addr::get_host_name() returned. In this case, @@ -167,9 +216,9 @@ Fri Dec 5 11:42:25 1997 Chris Cleeland <cleeland@cs.wustl.edu> Thu Dec 4 18:20:55 1997 Chris Gill <cdgill@cs.wustl.edu> - * TAO_IDL/tao_idl.dsp: Changed hard coded path for cl.exe to CPP_PATH + * TAO_IDL/tao_idl.dsp: Changed hard coded path for cl.exe to CPP_PATH environment variable - + Thu Dec 4 11:23:55 1997 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu> * TAO_IDL/include/{idl,ast,utl_idlist, utl_identifier}.h: removed diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp index 6a8a7639efe..53399719aa4 100644 --- a/TAO/TAO_IDL/be/be_array.cpp +++ b/TAO/TAO_IDL/be/be_array.cpp @@ -79,8 +79,6 @@ be_array::gen_client_header (void) cg->push (TAO_CodeGen::TAO_ARRAY_DEFN_CH); // set current code gen state ch = cg->client_header (); // retrieve client hdr stream - cg->outstream (ch); // set client hdr as the current stream - cg->node (this); // pass ourselves for type gen s = cg->make_state (); // get the state-based code generation object @@ -207,9 +205,7 @@ be_array::gen_client_stubs (void) cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CS); // set current code gen state cs = cg->client_stubs (); - // pass info - cg->outstream (cs); - cg->node (this); + // generate the typecode information here cs->indent (); // start from current indentation level *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" << @@ -270,8 +266,6 @@ be_array::gen_client_inline (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); - cg->node (this); cg->push (TAO_CodeGen::TAO_ARRAY_DEFN_CI); s = cg->make_state (); @@ -538,7 +532,6 @@ be_array::gen_var_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file @@ -795,7 +788,6 @@ be_array::gen_out_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the out implementation in the inline file @@ -1006,7 +998,6 @@ be_array::gen_forany_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the forany implementation in the inline file // Depending upon the data type, there are some differences which we account @@ -1257,6 +1248,23 @@ be_array::tc_encap_len (void) return this->encap_len_; } +// compute the size type of the node in question +int +be_array::compute_size_type (void) +{ + be_type *type = be_type::narrow_from_decl (this->base_type ()); + if (!type) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_array::compute_size_type - " + "bad base type\n"), -1); + } + + // our size type is the same as our type + this->size_type (type->size_type ()); + return 0; +} + // Narrowing IMPL_NARROW_METHODS2 (be_array, AST_Array, be_type) IMPL_NARROW_FROM_DECL (be_array) diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp index f3f0e89ce48..ddd4e089afd 100644 --- a/TAO/TAO_IDL/be/be_attribute.cpp +++ b/TAO/TAO_IDL/be/be_attribute.cpp @@ -211,7 +211,7 @@ be_attribute::gen_client_stubs (void) *cs << "STUB_Object *istub;\n\n"; cs->indent (); *cs << "if (this->QueryInterface (IID_STUB_Object, " << - "(void **)&istub) != NOERROR)" << nl; + "(void **)&istub) != TAO_NOERROR)" << nl; *cs << "{\n"; cs->incr_indent (); *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" << @@ -311,7 +311,7 @@ be_attribute::gen_client_stubs (void) *cs << "STUB_Object *istub;\n\n"; cs->indent (); *cs << "if (this->QueryInterface (IID_STUB_Object, " << - "(void **)&istub) != NOERROR)" << nl; + "(void **)&istub) != TAO_NOERROR)" << nl; *cs << "{\n"; cs->incr_indent (); *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" << diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 72468faa7bf..979ead331ef 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -58,7 +58,9 @@ TAO_CodeGen::make_state (void) switch (this->state ()) { case TAO_STRUCT_CH: - return TAO_BE_STATE_STRUCT_CH::instance (); + case TAO_STRUCT_CS: + case TAO_STRUCT_CI: + return TAO_BE_STATE_STRUCT::instance (); case TAO_UNION_DISCTYPEDEFN_CH: return TAO_BE_STATE_UNION_DISCTYPEDEFN_CH::instance (); case TAO_UNION_DISCTYPEDEFN_CI: diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp index efe50f9f355..10dc22066c8 100644 --- a/TAO/TAO_IDL/be/be_constant.cpp +++ b/TAO/TAO_IDL/be/be_constant.cpp @@ -26,6 +26,7 @@ */ be_constant::be_constant (void) { + this->size_type (be_decl::FIXED); } be_constant::be_constant (AST_Expression::ExprType et, @@ -35,6 +36,7 @@ be_constant::be_constant (AST_Expression::ExprType et, : AST_Constant (et, v, n, p), AST_Decl (AST_Decl::NT_const, n, p) { + this->size_type (be_decl::FIXED); } // ---------------------------------------- diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index e242c719b0a..d7c7448bb89 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -32,7 +32,7 @@ be_decl::be_decl (void) fullname_ (0), flatname_ (0), repoID_ (0), - size_type_ (be_decl::FIXED), // everybody is fixed size to start with + size_type_ (be_decl::SIZE_UNKNOWN), encap_len_ (-1) { } @@ -48,7 +48,7 @@ be_decl::be_decl (AST_Decl::NodeType type, UTL_ScopedName *n, UTL_StrList srv_skel_gen_ (I_FALSE), srv_inline_gen_ (I_FALSE), fullname_ (0), - size_type_ (be_decl::FIXED), // everybody is fixed size to start with + size_type_ (be_decl::SIZE_UNKNOWN), encap_len_ (-1) { } @@ -73,8 +73,10 @@ be_decl::tc_encap_len (void) // return our size type be_decl::SIZE_TYPE -be_decl::size_type (void) const +be_decl::size_type (void) { + if (this->size_type_ == be_decl::SIZE_UNKNOWN) + (void) this->compute_size_type (); return this->size_type_; } @@ -82,25 +84,27 @@ be_decl::size_type (void) const void be_decl::size_type (be_decl::SIZE_TYPE st) { - if (st == be_decl::FIXED) // does not affect ancestors - return; - - if (this->size_type_ == st) // already of that type. - return; // nothing to do + // precondition - you cannot set somebody's sizetype to unknown + ACE_ASSERT (st != be_decl::SIZE_UNKNOWN); - // precondition - ACE_ASSERT (st == be_decl::VARIABLE); + // st can be VARIABLE or FIXED + if (this->size_type_ == be_decl::SIZE_UNKNOWN) // not set yet + this->size_type_ = st; // set it + else if ((this->size_type_ == be_decl::FIXED) && + (st == be_decl::VARIABLE)) + // once we are VARIABLE, we cannot be FIXED. But if we were FIXED and then + // get overwritten to VARIABLE, it is fine. Such a situation occurs only + // when setting the sizes of structures and unions + this->size_type_ = st; - this->size_type_ = st; +#if 0 // if we are just a typedef, nothing else to do if (this->node_type () == AST_Decl::NT_typedef) return; // update our parent if it is of a specific type - if (!this->defined_in ()) // we are outermost - return; // nothing to do - else + if (this->is_nested ()) { // get the scope we are defined in be_decl *d = be_decl::narrow_from_decl (ScopeAsDecl (this->defined_in @@ -111,12 +115,13 @@ be_decl::size_type (be_decl::SIZE_TYPE st) // as ours. case AST_Decl::NT_struct: case AST_Decl::NT_union: - d->size_type (st); // call recursively to set the size type of - // our ancestors + d->size_type (st); // call recursively to set the size type of our + // ancestors default: return; // we are done } } // end else +#endif } // compute stringified fully scoped name @@ -412,6 +417,13 @@ be_decl::name_encap_len (void) return 4 + 4 * (slen/4 + (slen%4 ? 1:0)); } +// compute the size type of the node in question +int +be_decl::compute_size_type (void) +{ + return 0; +} + // narrowing methods IMPL_NARROW_METHODS1 (be_decl, AST_Decl) IMPL_NARROW_FROM_DECL (be_decl) diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp index ae430917c03..6493760fc40 100644 --- a/TAO/TAO_IDL/be/be_enum.cpp +++ b/TAO/TAO_IDL/be/be_enum.cpp @@ -26,6 +26,7 @@ */ be_enum::be_enum (void) { + this->size_type (be_decl::FIXED); } be_enum::be_enum (UTL_ScopedName *n, UTL_StrList *p) @@ -34,6 +35,7 @@ be_enum::be_enum (UTL_ScopedName *n, UTL_StrList *p) UTL_Scope (AST_Decl::NT_enum), member_count_ (-1) { + this->size_type (be_decl::FIXED); } // compute total number of members @@ -159,7 +161,6 @@ be_enum::gen_client_stubs (void) cg->push (TAO_CodeGen::TAO_ENUM_CS); // set current code gen state cs = cg->client_stubs (); - cg->outstream (cs); // generate the typecode information here cs->indent (); // start from current indentation level @@ -250,7 +251,7 @@ be_enum::gen_encapsulation (void) long *arr; // an array holding string names converted to array of longs - cs = cg->outstream (); + cs = cg->client_stubs (); cs->indent (); // start from whatever indentation level we were at *cs << "TAO_ENCAP_BYTE_ORDER, // byte order" << nl; diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp index e122e3a3cf7..76fa116ae68 100644 --- a/TAO/TAO_IDL/be/be_enum_val.cpp +++ b/TAO/TAO_IDL/be/be_enum_val.cpp @@ -107,18 +107,11 @@ int be_enum_val::gen_encapsulation (void) { TAO_OutStream *cs; // output stream - TAO_NL nl; // end line TAO_CodeGen *cg = TAO_CODEGEN::instance (); - be_type *bt; // our type node long i, arrlen; long *arr; // an array holding string names converted to array of longs - // Macro to avoid "warning: unused parameter" type warning. - ACE_UNUSED_ARG (bt); - ACE_UNUSED_ARG (nl); - cs = cg->client_stubs (); - cg->node (this); // pass ourselves in case we are needed cs->indent (); // start from whatever indentation level we were at // generate name diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp index 8ce0580afc1..91ca6a94b9c 100644 --- a/TAO/TAO_IDL/be/be_exception.cpp +++ b/TAO/TAO_IDL/be/be_exception.cpp @@ -30,6 +30,7 @@ */ be_exception::be_exception (void) { + this->size_type (be_decl::VARIABLE); // always the case } be_exception::be_exception (UTL_ScopedName *n, UTL_StrList *p) @@ -38,6 +39,7 @@ be_exception::be_exception (UTL_ScopedName *n, UTL_StrList *p) UTL_Scope (AST_Decl::NT_except), member_count_ (-1) { + this->size_type (be_decl::VARIABLE); // always the case } // compute total number of members @@ -75,7 +77,6 @@ be_exception::member_count (void) return this->member_count_; } - int be_exception::gen_client_header (void) { @@ -87,7 +88,6 @@ be_exception::gen_client_header (void) TAO_NL nl; // end line - cg->outstream (ch); ch->indent (); // start from whatever indentation level we were at ch->gen_ifdef_macro (this->flatname (), "_ptr"); @@ -167,9 +167,6 @@ be_exception::gen_client_stubs (void) cg->push (TAO_CodeGen::TAO_STRUCT_CS); // set current code gen state cs = cg->client_stubs (); - // pass info - cg->outstream (cs); - cg->node (this); // generate the typecode information here cs->indent (); // start from current indentation level diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp index 804e84ef057..b535f2dbb56 100644 --- a/TAO/TAO_IDL/be/be_field.cpp +++ b/TAO/TAO_IDL/be/be_field.cpp @@ -47,22 +47,68 @@ be_field::gen_client_header (void) // retrieve a singleton instance of the code generator TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->node (this); // pass info thru singleton - cg->outstream (cg->client_header ()); - + // retrieve field type bt = be_type::narrow_from_decl (this->field_type ()); + // make the state based object. The state has been set by the enclosing + // parent structure s = cg->make_state (); - if (s && bt) - return s->gen_code (bt, this); // no third parameter here - else - return -1; + if (!s || !bt || (s->gen_code (bt, this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_field::gen_client_header -" + "codegen failed\n"), -1); + } + return 0; } // Generates the client-side stubs for the field int be_field::gen_client_stubs (void) { + be_type *bt; // the field type + be_state *s; // code generation state + + // retrieve a singleton instance of the code generator + TAO_CodeGen *cg = TAO_CODEGEN::instance (); + + // retrieve field type + bt = be_type::narrow_from_decl (this->field_type ()); + + // make the state based object. The state has been set by the enclosing + // parent structure + s = cg->make_state (); + if (!s || !bt || (s->gen_code (bt, this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_field::gen_client_stubs -" + "codegen failed\n"), -1); + } + return 0; +} + +// Generates the client-side inline information +int +be_field::gen_client_inline (void) +{ + be_type *bt; // the field type + be_state *s; // code generation state + + // retrieve a singleton instance of the code generator + TAO_CodeGen *cg = TAO_CODEGEN::instance (); + + // retrieve field type + bt = be_type::narrow_from_decl (this->field_type ()); + + // make the state based object. The state has been set by the enclosing + // parent structure + s = cg->make_state (); + if (!s || !bt || (s->gen_code (bt, this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_field::gen_client_inline -" + "codegen failed\n"), -1); + } return 0; } @@ -82,26 +128,6 @@ be_field::gen_server_skeletons (void) return 0; } -// Generates the client-side inline information -int -be_field::gen_client_inline (void) -{ - // The field type may need inline definitions, example: - // struct A { - // sequence<long> x; - // }; - be_type *bt = be_type::narrow_from_decl (this->field_type ()); - - // The type may be imported, then we cannot generate the inline - // info. Note: this does not fall in the general protection against - // multiple definition. - if (bt->imported ()) - { - return 0; - } - return bt->gen_client_inline (); -} - // Generates the server-side inline int be_field::gen_server_inline (void) @@ -114,17 +140,12 @@ int be_field::gen_encapsulation (void) { TAO_OutStream *cs; // output stream - TAO_NL nl; // end line TAO_CodeGen *cg = TAO_CODEGEN::instance (); be_type *bt; // our type node long i, arrlen; long *arr; // an array holding string names converted to array of longs - // Macro to avoid "warning: unused parameter" type warning. - ACE_UNUSED_ARG (nl); - cs = cg->client_stubs (); - cg->node (this); // pass ourselves in case we are needed cs->indent (); // start from whatever indentation level we were at // generate name @@ -160,6 +181,24 @@ be_field::tc_encap_len (void) return this->encap_len_; } +// compute the size type of the node in question +int +be_field::compute_size_type (void) +{ + be_type *type = be_type::narrow_from_decl (this->field_type ()); + if (!type) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_field::compute_size_type - " + "bad field type\n"), -1); + } + + // our size type is the same as our type + this->size_type (type->size_type ()); // as a side effect will also update + // the size type of parent + return 0; +} + // Narrowing IMPL_NARROW_METHODS2 (be_field, AST_Field, be_decl) IMPL_NARROW_FROM_DECL (be_field) diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 7862bdfc465..eb624dd7356 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -143,10 +143,6 @@ int be_interface::gen_client_header (void) ch = cg->client_header (); - // pass info - cg->outstream (ch); - cg->node (this); - // == STEP 1: generate the class name and class names we inherit == ch->indent (); // start with whatever indentation level we are at @@ -309,9 +305,6 @@ int be_interface::gen_client_stubs (void) // state cs = cg->client_stubs (); - //pass info - cg->node (this); - cg->outstream (cs); cs->indent (); // start with whatever indentation level we are at @@ -348,7 +341,7 @@ int be_interface::gen_client_stubs (void) " // need this since _is_a grabbed an obj reference " << nl; #endif *cs << "if (obj->QueryInterface (IID_STUB_Object, (void **)&istub) " << - "!= NOERROR)\n"; + "!= TAO_NOERROR)\n"; cs->incr_indent (); *cs << "return " << this->name () << "::_nil ();\n"; cs->decr_indent (); @@ -384,7 +377,7 @@ int be_interface::gen_client_stubs (void) *cs << "if (!data) return " << this->name () << "::_nil ();" << nl; *cs << "// get the object_ptr using Query Interface" << nl; *cs << - "if (data->QueryInterface (IID_CORBA_Object, (void **)&objref) != NOERROR)" + "if (data->QueryInterface (IID_CORBA_Object, (void **)&objref) != TAO_NOERROR)" << nl; *cs << "{" << nl; *cs << "\tenv.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" @@ -426,7 +419,7 @@ int be_interface::gen_client_stubs (void) *cs << "\treturn 1; // success using local knowledge\n"; cs->decr_indent (); *cs << "else" << nl; - *cs << "\treturn CORBA::Object::_is_a (value, env); // remote call\n"; + *cs << "\treturn ACE_CORBA_3 (Object, _is_a) (value, env); // remote call\n"; cs->decr_indent (); *cs << "}\n\n"; @@ -472,9 +465,6 @@ int be_interface::gen_server_header (void) // state sh = cg->server_header (); - // pass info - cg->node (this); - cg->outstream (sh); // generate the skeleton class name @@ -566,9 +556,6 @@ int be_interface::gen_server_skeletons (void) // state ss = cg->server_skeletons (); - // pass info - cg->node (this); - cg->outstream (ss); // generate the skeleton class name @@ -902,7 +889,6 @@ be_interface::gen_var_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file // Depending upon the data type, there are some differences which we account @@ -1141,7 +1127,6 @@ be_interface::gen_out_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file // Depending upon the data type, there are some differences which we account diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp index b23b934a1f7..68910b7b6de 100644 --- a/TAO/TAO_IDL/be/be_interface_fwd.cpp +++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp @@ -28,6 +28,7 @@ be_interface_fwd::be_interface_fwd (void) { + this->size_type (be_decl::VARIABLE); // always the case } be_interface_fwd::be_interface_fwd (UTL_ScopedName *n, UTL_StrList *p) @@ -258,7 +259,6 @@ be_interface_fwd::gen_var_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file // Depending upon the data type, there are some differences which we account @@ -498,7 +498,6 @@ be_interface_fwd::gen_out_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file // Depending upon the data type, there are some differences which we account diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp index e9cddfab94a..d66a7ace2bb 100644 --- a/TAO/TAO_IDL/be/be_module.cpp +++ b/TAO/TAO_IDL/be/be_module.cpp @@ -197,6 +197,14 @@ be_module::gen_server_inline (void) return 0; } +// compute the size type of the node in question +int +be_module::compute_size_type (void) +{ + // our size does not matter + return 0; +} + // Narrowing IMPL_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl) IMPL_NARROW_FROM_DECL (be_module) diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index c669fb6952f..7246c27031d 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -46,7 +46,6 @@ be_operation::gen_client_header (void) // retrieve a singleton instance of the code generator TAO_CodeGen *cg = TAO_CODEGEN::instance (); ch = cg->client_header (); - cg->outstream (ch); // important to set the current stream ch->indent (); // start with the current indentation level @@ -270,7 +269,7 @@ be_operation::gen_client_stubs (void) *cs << "STUB_Object *istub;\n\n"; cs->indent (); *cs << "if (this->QueryInterface (IID_STUB_Object, " << - "(void **)&istub) != NOERROR)" << nl; + "(void **)&istub) != TAO_NOERROR)" << nl; *cs << "{\n"; cs->incr_indent (); *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" << @@ -369,7 +368,6 @@ be_operation::gen_server_header (void) // operation definition sh = cg->server_header (); - cg->outstream (sh); // set current stream sh->indent (); // start with the current indentation level // every operation is declared virtual @@ -437,7 +435,6 @@ be_operation::gen_server_skeletons (void) // retrieve a singleton instance of the code generator TAO_CodeGen *cg = TAO_CODEGEN::instance (); ss = cg->server_skeletons (); - cg->outstream (ss); // set current stream ss->indent (); // start with the current indentation level @@ -641,6 +638,47 @@ be_operation::gen_server_inline (void) return 0; } +// compute the size type of the node in question +int +be_operation::compute_size_type (void) +{ + UTL_ScopeActiveIterator *si; + AST_Decl *d; + be_decl *bd; + + if (this->nmembers () > 0) + { + // if there are elements in this scope + + si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); + // instantiate a scope iterator. + + while (!(si->is_done ())) + { + // get the next AST decl node + d = si->item (); + bd = be_decl::narrow_from_decl (d); + if (bd != 0) + { + // our sizetype depends on the sizetype of our members. Although + // previous value of sizetype may get overwritten, we are + // guaranteed by the "size_type" call that once the value reached + // be_decl::VARIABLE, nothing else can overwrite it. + this->size_type (bd->size_type ()); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "WARNING (%N:%l) be_operation::compute_size_type - " + "narrow_from_decl returned 0\n")); + } + si->next (); + } // end of while + delete si; // free the iterator object + } + return 0; +} + // Narrowing IMPL_NARROW_METHODS3 (be_operation, AST_Operation, be_scope, be_decl) IMPL_NARROW_FROM_DECL (be_operation) diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index e869f9889db..8029132e871 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -107,8 +107,14 @@ be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t, { new_name->nconc (new UTL_ScopedName (new Identifier ("Any", 1, 0, I_FALSE), NULL)); - // we are variable length type - this->size_type (be_decl::VARIABLE); + } + break; + case AST_PredefinedType::PT_pseudo: + { + new_name->nconc (new UTL_ScopedName (new Identifier + (n->last_component + ()->get_string (), 1, 0, + I_FALSE), NULL)); } break; default: @@ -233,6 +239,7 @@ be_predefined_type::compute_tc_name (void) } break; case AST_PredefinedType::PT_pseudo: + // @@@ XXXASG // TODO: This is a kind of hack, there are other things that are // pseudo objects, not only objref (aka CORBA::Object). { @@ -408,6 +415,23 @@ be_predefined_type::gen_encapsulation (void) return 0; // nothing to be done } +// compute the size type of the node in question +int +be_predefined_type::compute_size_type (void) +{ + switch (this->pt ()) + { + case AST_PredefinedType::PT_any: + case AST_PredefinedType::PT_pseudo: + // we are variable length type + this->size_type (be_decl::VARIABLE); + break; + default: + this->size_type (be_decl::FIXED); + } + return 0; +} + // Narrowing IMPL_NARROW_METHODS2 (be_predefined_type, AST_PredefinedType, be_type) IMPL_NARROW_FROM_DECL (be_predefined_type) diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index 96dc38d0182..a6516185c13 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -51,6 +51,7 @@ be_sequence::be_sequence (AST_Expression *v, AST_Type *t) // VARIABLE } +// create a name for ourselves int be_sequence::create_name (void) { @@ -62,7 +63,7 @@ be_sequence::create_name (void) d = cg->node (); // retrieve the node that was passed in via the CodeGen - // object + // object if (!d) return -1; // error, we cannot be free standing. diff --git a/TAO/TAO_IDL/be/be_state.cpp b/TAO/TAO_IDL/be/be_state.cpp index 5d762a189c5..d54f8dd9427 100644 --- a/TAO/TAO_IDL/be/be_state.cpp +++ b/TAO/TAO_IDL/be/be_state.cpp @@ -29,7 +29,7 @@ be_state::~be_state (void) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton<be_state_struct_ch, ACE_SYNCH_RECURSIVE_MUTEX>; +template class ACE_Singleton<be_state_struct, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<be_state_union_disctypedefn_ch, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<be_state_union_disctypedefn_ci, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<be_state_union_public_ch, ACE_SYNCH_RECURSIVE_MUTEX>; @@ -44,7 +44,7 @@ template class ACE_Singleton<be_state_attribute, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<be_state_struct_ch, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Singleton<be_state_struct, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate ACE_Singleton<be_state_union_disctypedefn_ch, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate ACE_Singleton<be_state_union_disctypedefn_ci, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate ACE_Singleton<be_state_union_public_ch, ACE_SYNCH_RECURSIVE_MUTEX> diff --git a/TAO/TAO_IDL/be/be_state_argument.cpp b/TAO/TAO_IDL/be/be_state_argument.cpp index c42831e448b..0bb60136e42 100644 --- a/TAO/TAO_IDL/be/be_state_argument.cpp +++ b/TAO/TAO_IDL/be/be_state_argument.cpp @@ -531,7 +531,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type) break; case TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS: { - // nothing + // TODO } break; case TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS: @@ -726,7 +726,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type) // declare an Any *os << "CORBA::Any \t any_" << arg->local_name () << " (" << bt->tc_name () << ", &" << arg->local_name () << - ", 1); // ORB owns" << nl; + ", 0); // ORB doesn't own" << nl; } break; case TAO_CodeGen::TAO_ARGUMENT_PRE_DOCALL_CS: @@ -760,7 +760,10 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type) break; case TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS: { - // nothing + *os << "nv_" << arg->local_name () << + "->value ()->replace (" << bt->tc_name () << ", " << + arg->local_name () << + "_out.ptr (), 1, _tao_environment);\n"; } break; case TAO_CodeGen::TAO_ARGUMENT_CH: @@ -1645,7 +1648,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type) // declare an Any *os << "CORBA::Any \t any_" << arg->local_name () << " (" << bt->tc_name () << ", " << arg->local_name () << - ", 1); // ORB owns" << nl; + ", 0); // ORB does not own" << nl; } else { @@ -1658,7 +1661,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type) // declare an Any *os << "CORBA::Any \t any_" << arg->local_name () << " (" << bt->tc_name () << ", &" << arg->local_name () << - ", 1); // ORB owns" << nl; + ", 0); // ORB does not own" << nl; } // end else } break; @@ -1711,7 +1714,13 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type) break; case TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS: { - // nothing + if (bt->size_type () == be_decl::VARIABLE) + { + *os << "nv_" << arg->local_name () << + "->value ()->replace (" << bt->tc_name () << ", " + << arg->local_name () << + "_out.ptr (), 1, _tao_environment);\n"; + } } break; case TAO_CodeGen::TAO_ARGUMENT_CH: diff --git a/TAO/TAO_IDL/be/be_state_attribute.cpp b/TAO/TAO_IDL/be/be_state_attribute.cpp index 73fb5819be5..555bb3222e6 100644 --- a/TAO/TAO_IDL/be/be_state_attribute.cpp +++ b/TAO/TAO_IDL/be/be_state_attribute.cpp @@ -627,20 +627,6 @@ be_state_attribute::gen_code (be_type *bt, be_decl *d, be_type *type) ", retval, 1); // ORB owns" << nl; } break; - case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS: - { - // declare a variable - *os << "char *" << attr->local_name () << ";" << - nl; - // now define a NamedValue_ptr - *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () << - ";" << nl; - // declare an Any - *os << "CORBA::Any \t any_" << attr->local_name () << " (" << - bt->tc_name () << ", &" << attr->local_name () << - "); // ORB does not own" << nl; - } - break; case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS: { // nothing @@ -697,8 +683,23 @@ be_state_attribute::gen_code (be_type *bt, be_decl *d, be_type *type) } } break; + case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS: + { + // declare a variable + *os << "char *" << attr->local_name () << ";" << + nl; + // now define a NamedValue_ptr + *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () << + ";" << nl; + // declare an Any + *os << "CORBA::Any \t any_" << attr->local_name () << " (" << + bt->tc_name () << ", &" << attr->local_name () << + "); // ORB does not own" << nl; + } + break; case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH: case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS: + case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH: { *os << "const char *" << attr->local_name (); } diff --git a/TAO/TAO_IDL/be/be_state_structure.cpp b/TAO/TAO_IDL/be/be_state_structure.cpp index 2226d3b131f..11d78439888 100644 --- a/TAO/TAO_IDL/be/be_state_structure.cpp +++ b/TAO/TAO_IDL/be/be_state_structure.cpp @@ -18,33 +18,52 @@ #include "idl_extern.h" #include "be.h" -be_state_struct_ch::be_state_struct_ch (void) +be_state_struct::be_state_struct (void) { } // generate code for structure member int -be_state_struct_ch::gen_code (be_type *bt, be_decl *d, be_type *type) +be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type) { TAO_OutStream *os; // output stream - TAO_NL nl; // end line TAO_CodeGen *cg = TAO_CODEGEN::instance (); be_field *f; // field node be_structure *bs; // enclosing structure node - // Macro to avoid "warning: unused parameter" type warning. - ACE_UNUSED_ARG (nl); + switch (cg->state ()) + { + case TAO_CodeGen::TAO_STRUCT_CH: + os = cg->client_header (); + break; + case TAO_CodeGen::TAO_STRUCT_CS: + os = cg->client_stubs (); + break; + case TAO_CodeGen::TAO_STRUCT_CI: + os = cg->client_inline (); + break; + } - os = cg->client_header (); // get client header stream f = be_field::narrow_from_decl (d); // downcast to field node if (!f) - return -1; + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_structure.cpp - " + "Bad field\n"), + -1); + } bs = be_structure::narrow_from_scope (f->defined_in ()); - if (bs == NULL) - return -1; + if (!bs) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct.cpp - " + "Bad structure\n"), + -1); + } - // pass the field node just incase it is needed + // pass the field node just incase it is needed to generate definition for + // sequence cg->node (f); if (!type) // not a recursive call @@ -53,36 +72,116 @@ be_state_struct_ch::gen_code (be_type *bt, be_decl *d, be_type *type) // base class of the typedef ACE_ASSERT (bt->node_type () == AST_Decl::NT_typedef); - // generate code based on type. For every case, first downcast to the - // appropriate type. If the downcast fails, return error, else proceed. In - // some cases, the type itself may need code generation, e.g., anonymous - // struct types. + // generate code based on type. switch (type->node_type ()) { case AST_Decl::NT_interface: // type is an obj reference { - os->indent (); // start from current indentation - *os << bt->nested_type_name (bs, "_var") << " " << f->local_name () << - ";\n\n"; - } + switch (cg->state ()) + { + case TAO_CodeGen::TAO_STRUCT_CH: + { + os->indent (); // start from current indentation + *os << bt->nested_type_name (bs, "_var") << " " << f->local_name + () << ";\n"; + } + break; + case TAO_CodeGen::TAO_STRUCT_CI: + { + // nothing + } + break; + case TAO_CodeGen::TAO_STRUCT_CS: + { + // nothing + } + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - unknown state\n"), -1); + } + } // end switch state + } // end case interface break; case AST_Decl::NT_pre_defined: // type is predefined type { - os->indent (); // start from current indentation - *os << bt->nested_type_name (bs) << " " << f->local_name () << ";\n\n"; + switch (cg->state ()) + { + case TAO_CodeGen::TAO_STRUCT_CH: + { + be_predefined_type *bpd = be_predefined_type::narrow_from_decl + (bt); + if (!bpd) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - " + "bad predefined type\n"), -1); + } + os->indent (); // start from current indentation + switch (bpd->pt ()) + { + case AST_PredefinedType::PT_any: + case AST_PredefinedType::PT_pseudo: + *os << bt->nested_type_name (bs) << "_var " << f->local_name + () << ";\n"; + break; + default: + *os << bt->nested_type_name (bs) << " " << f->local_name () + << ";\n"; + } + } + break; + case TAO_CodeGen::TAO_STRUCT_CI: + { + // nothing + } + break; + case TAO_CodeGen::TAO_STRUCT_CS: + { + // nothing + } + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - unknown state\n"), -1); + } + } // end switch state } break; case AST_Decl::NT_string: // type is a string { - os->indent (); // start from current indentation - if (bt->node_type () == AST_Decl::NT_typedef) + switch (cg->state ()) { - *os << bt->nested_type_name (bs, "_var") << " " << f->local_name () << ";\n\n"; - } - else - { - *os << "CORBA::String_var " << f->local_name () << ";\n\n"; - } + case TAO_CodeGen::TAO_STRUCT_CH: + { + os->indent (); // start from current indentation + if (bt->node_type () == AST_Decl::NT_typedef) + { + *os << bt->nested_type_name (bs, "_var") << " " << + f->local_name () << ";\n"; + } + else + { + *os << "CORBA::String_var " << f->local_name () << ";\n"; + } + } + break; + case TAO_CodeGen::TAO_STRUCT_CI: + { + } + break; + case TAO_CodeGen::TAO_STRUCT_CS: + { + } + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - unknown state\n"), -1); + } + } // end switch state } break; // these are all anonymous types @@ -92,14 +191,59 @@ be_state_struct_ch::gen_code (be_type *bt, be_decl *d, be_type *type) case AST_Decl::NT_struct: // type is a struct case AST_Decl::NT_union: // type is a union { - // We first need to generate code for this aggregate type. Check if we - // are not called recursively thru a typedef - if (bt->node_type () != AST_Decl::NT_typedef) - if (bt->gen_client_header () == -1) - return -1; - - os->indent (); - *os << bt->nested_type_name (bs) << " " << f->local_name () << ";\n\n"; + switch (cg->state ()) + { + case TAO_CodeGen::TAO_STRUCT_CH: + { + // We first need to generate code for this aggregate type. Check + // if we are not called recursively thru a typedef + if (bt->node_type () != AST_Decl::NT_typedef) + if (bt->gen_client_header () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - " + "error generating code for type\n"), + -1); + } + os->indent (); + *os << bt->nested_type_name (bs) << " " << f->local_name () << + ";\n"; + } + break; + case TAO_CodeGen::TAO_STRUCT_CI: + { + // We first need to generate code for this aggregate type. Check + // if we are not called recursively thru a typedef + if (bt->node_type () != AST_Decl::NT_typedef) + if (bt->gen_client_inline () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - " + "error generating code for type\n"), + -1); + } + } + break; + case TAO_CodeGen::TAO_STRUCT_CS: + { + // We first need to generate code for this aggregate type. Check + // if we are not called recursively thru a typedef + if (bt->node_type () != AST_Decl::NT_typedef) + if (bt->gen_client_stubs () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - " + "error generating code for type\n"), + -1); + } + } + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_state_struct - unknown state\n"), -1); + } + } // end switch state } break; case AST_Decl::NT_except: // type is an exception @@ -121,8 +265,8 @@ be_state_struct_ch::gen_code (be_type *bt, be_decl *d, be_type *type) } // end of switch //break; unreachable statement! } - // the enclosing structure will be variable length the field is variable - // length + // the enclosing structure will be variable length if the field's type is + // variable length bs->size_type (type->size_type ()); return 0; } diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp index 3ea2d4f3997..228da5a5a43 100644 --- a/TAO/TAO_IDL/be/be_string.cpp +++ b/TAO/TAO_IDL/be/be_string.cpp @@ -26,6 +26,7 @@ */ be_string::be_string (void) { + this->size_type (be_decl::VARIABLE); // always the case } be_string::be_string (AST_Expression *v) @@ -35,19 +36,7 @@ be_string::be_string (AST_Expression *v) NULL), NULL) { - this->size_type (be_decl::VARIABLE); // we are always variable length -} - -// overriden method -void -be_string::compute_tc_name (void) -{ - // start with the head as the CORBA namespace - this->tc_name_ = new UTL_ScopedName (new Identifier ("CORBA", 1, 0, I_FALSE), - NULL); - - this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_string", 1, 0, - I_FALSE), NULL)); + this->size_type (be_decl::VARIABLE); // always the case } be_string::be_string (AST_Expression *v, long wide) @@ -66,6 +55,18 @@ be_string::be_string (AST_Expression *v, long wide) this->size_type (be_decl::VARIABLE); // always the case } +// overriden method +void +be_string::compute_tc_name (void) +{ + // start with the head as the CORBA namespace + this->tc_name_ = new UTL_ScopedName (new Identifier ("CORBA", 1, 0, I_FALSE), + NULL); + + this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_string", 1, 0, + I_FALSE), NULL)); +} + // Code generation int diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp index 4dfe3446dff..6fc79b6d36a 100644 --- a/TAO/TAO_IDL/be/be_structure.cpp +++ b/TAO/TAO_IDL/be/be_structure.cpp @@ -91,9 +91,6 @@ be_structure::gen_client_header (void) cg->push (TAO_CodeGen::TAO_STRUCT_CH); // set current code gen state ch = cg->client_header (); - // pass info - cg->node (this); - cg->outstream (ch); ch->indent (); // start from whatever indentation level we were at *ch << "struct " << local_name () << nl; @@ -103,9 +100,9 @@ be_structure::gen_client_header (void) // generate code for field members if (be_scope::gen_client_header () == -1) { - ACE_ERROR ((LM_ERROR, "be_structure::gen_client_header\n")); - ACE_ERROR ((LM_ERROR, "code generation for fields failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_structure::gen_client_header -" + "codegen for scope failed\n"), -1); } ch->decr_indent (); @@ -163,7 +160,6 @@ be_structure::gen_client_stubs (void) cs = cg->client_stubs (); // pass info - cg->outstream (cs); cg->node (this); // generate the typecode information here @@ -176,8 +172,9 @@ be_structure::gen_client_stubs (void) // encapsulation for the parameters if (this->gen_encapsulation () == -1) { - ACE_ERROR ((LM_ERROR, "Error generating encapsulation\n\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_structure::gen_client_stubs -" + "codegen for scope failed\n"), -1); } cs->decr_indent (); *cs << "};" << nl; @@ -195,48 +192,56 @@ be_structure::gen_client_stubs (void) return 0; } -// Generates the server-side header information for the structure -int -be_structure::gen_server_header (void) -{ - // nothing to be done - return 0; -} - -// Generates the server-side skeletons for the structure -int -be_structure::gen_server_skeletons (void) -{ - // nothing to be done - return 0; -} - // Generates the client-side inline information int be_structure::gen_client_inline (void) { if (!this->cli_inline_gen_) { + // retrieve a singleton instance of the code generator + TAO_CodeGen *cg = TAO_CODEGEN::instance (); + cg->push (TAO_CodeGen::TAO_STRUCT_CI); // set current code gen state + if (this->gen_var_impl () == -1) { - ACE_ERROR ((LM_ERROR, "be_structure: _var impl code gen failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_structure::gen_client_inline -" + "_var codegen failed\n"), -1); } if (this->size_type () == be_decl::VARIABLE && this->gen_out_impl () == -1) { - ACE_ERROR ((LM_ERROR, "be_structure: _out impl code gen failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_structure::gen_client_inline -" + "_out codegen failed\n"), -1); } if (be_scope::gen_client_inline () == -1) { - ACE_ERROR ((LM_ERROR, "be_structure: code gen failed for scope\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_structure::gen_client_inline -" + "codegen for scope failed\n"), -1); } this->cli_inline_gen_ = I_TRUE; + cg->pop (); } return 0; } +// Generates the server-side header information for the structure +int +be_structure::gen_server_header (void) +{ + // nothing to be done + return 0; +} + +// Generates the server-side skeletons for the structure +int +be_structure::gen_server_skeletons (void) +{ + // nothing to be done + return 0; +} + // Generates the server-side inline int be_structure::gen_server_inline (void) @@ -348,7 +353,6 @@ be_structure::gen_var_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); ci->indent (); // start with whatever was our current indent level @@ -631,7 +635,6 @@ be_structure::gen_out_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file @@ -838,6 +841,47 @@ be_structure::tc_encap_len (void) return this->encap_len_; } +// compute the size type of the node in question +int +be_structure::compute_size_type (void) +{ + UTL_ScopeActiveIterator *si; + AST_Decl *d; + be_decl *bd; + + if (this->nmembers () > 0) + { + // if there are elements in this scope + + si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); + // instantiate a scope iterator. + + while (!(si->is_done ())) + { + // get the next AST decl node + d = si->item (); + bd = be_decl::narrow_from_decl (d); + if (bd != 0) + { + // our sizetype depends on the sizetype of our members. Although + // previous value of sizetype may get overwritten, we are + // guaranteed by the "size_type" call that once the value reached + // be_decl::VARIABLE, nothing else can overwrite it. + this->size_type (bd->size_type ()); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "WARNING (%N:%l) be_structure::compute_size_type - " + "narrow_from_decl returned 0\n")); + } + si->next (); + } // end of while + delete si; // free the iterator object + } + return 0; +} + // Narrowing IMPL_NARROW_METHODS3 (be_structure, AST_Structure, be_scope, be_type) IMPL_NARROW_FROM_DECL (be_structure) diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp index e02ecaf0bbc..43640de7ce3 100644 --- a/TAO/TAO_IDL/be/be_typedef.cpp +++ b/TAO/TAO_IDL/be/be_typedef.cpp @@ -62,10 +62,6 @@ be_typedef::gen_client_header (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ch = cg->client_header (); cg->push (TAO_CodeGen::TAO_TYPEDEF_CH); - cg->node (this); // pass ourselves. For typedefs, this is very important, - // because other nodes's code generation may depend on - // whether they were typedefed or not. - cg->outstream (cg->client_header ()); s = cg->make_state (); bt = be_type::narrow_from_decl (this->base_type ()); @@ -115,10 +111,6 @@ be_typedef::gen_client_stubs (void) cs = cg->client_stubs (); - cg->node (this); // pass ourselves. For typedefs, this is very important, - // because other nodes's code generation may depend on - // whether they were typedefed or not. - s = cg->make_state (); bt = be_type::narrow_from_decl (this->base_type ()); @@ -171,8 +163,6 @@ be_typedef::gen_client_inline (void) // retrieve a singleton instance of the code generator TAO_CodeGen *cg = TAO_CODEGEN::instance (); cg->push (TAO_CodeGen::TAO_TYPEDEF_CI); - cg->node (this); // pass ourselves - cg->outstream (cg->client_inline ()); s = cg->make_state (); bt = be_type::narrow_from_decl (this->base_type ()); @@ -311,6 +301,23 @@ be_typedef::tc_encap_len (void) return this->encap_len_; } +// compute the size type of the node in question +int +be_typedef::compute_size_type (void) +{ + be_type *type = be_type::narrow_from_decl (this->base_type ()); + if (!type) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_typedef::compute_size_type - " + "bad base type\n"), -1); + } + + // our size type is the same as our type + this->size_type (type->size_type ()); + return 0; +} + // Narrowing IMPL_NARROW_METHODS2 (be_typedef, AST_Typedef, be_type) IMPL_NARROW_FROM_DECL (be_typedef) diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp index e8f0fbe83c1..4d232b5ec5a 100644 --- a/TAO/TAO_IDL/be/be_union.cpp +++ b/TAO/TAO_IDL/be/be_union.cpp @@ -142,7 +142,6 @@ be_union::gen_client_header (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ch = cg->client_header (); - cg->node (this); // pass ourselves ch->indent (); // start with the current indentation level *ch << "class " << local_name () << nl; @@ -546,7 +545,6 @@ be_union::gen_var_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); ci->indent (); // start with whatever was our current indent level @@ -829,7 +827,6 @@ be_union::gen_out_impl (void) TAO_CodeGen *cg = TAO_CODEGEN::instance (); ci = cg->client_inline (); - cg->outstream (ci); // generate the var implementation in the inline file diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp index dc5477e00cf..8e33f363382 100644 --- a/TAO/TAO_IDL/be/be_union_branch.cpp +++ b/TAO/TAO_IDL/be/be_union_branch.cpp @@ -159,7 +159,6 @@ be_union_branch::gen_encapsulation (void) long *arr; // an array holding string names converted to array of longs cs = cg->client_stubs (); - cg->node (this); // pass ourselves in case we are needed cs->indent (); // start from whatever indentation level we were at // emit the case label value diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h index d03d20e03fe..a99cc2feb3c 100644 --- a/TAO/TAO_IDL/be_include/be_array.h +++ b/TAO/TAO_IDL/be_include/be_array.h @@ -86,6 +86,11 @@ public: // Narrowing DEF_NARROW_METHODS2 (be_array, AST_Array, be_type); DEF_NARROW_FROM_DECL (be_array); + +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown + }; #endif diff --git a/TAO/TAO_IDL/be_include/be_constant.h b/TAO/TAO_IDL/be_include/be_constant.h index e59426cfc5e..0bbc21f1f9f 100644 --- a/TAO/TAO_IDL/be_include/be_constant.h +++ b/TAO/TAO_IDL/be_include/be_constant.h @@ -3,7 +3,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_constant.h // @@ -13,9 +13,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (BE_CONSTANT_H) @@ -31,7 +31,7 @@ public: be_constant (void); // constructor - + be_constant (AST_Expression::ExprType et, AST_Expression *v, UTL_ScopedName *n, @@ -39,13 +39,13 @@ public: // constructor virtual int gen_client_header (void); - // Generates the client-side header information for the constant + // Generates the client-side header information for the constant virtual int gen_client_stubs (void); // Generates the client-side stubs for the constant virtual int gen_server_header (void); - // Generates the server-side header information for the constant + // Generates the server-side header information for the constant virtual int gen_server_skeletons (void); // Generates the server-side skeletons for the constant diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index b351042b521..1e96770c8f7 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -34,6 +34,7 @@ class be_decl : public virtual AST_Decl public: enum SIZE_TYPE { + SIZE_UNKNOWN, FIXED, VARIABLE }; @@ -72,7 +73,7 @@ public: virtual void size_type (SIZE_TYPE); // set the size type - virtual SIZE_TYPE size_type (void) const; + virtual SIZE_TYPE size_type (void); // return our size type const char *repoID (void); @@ -100,6 +101,9 @@ public: protected: // =helper + virtual int compute_size_type (void); + // determine our size type and set it if it is unknown + virtual void compute_repoID (void); // computes the repoID diff --git a/TAO/TAO_IDL/be_include/be_enum.h b/TAO/TAO_IDL/be_include/be_enum.h index 9ae63caba05..8929819a793 100644 --- a/TAO/TAO_IDL/be_include/be_enum.h +++ b/TAO/TAO_IDL/be_include/be_enum.h @@ -3,7 +3,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_enum.h // @@ -13,9 +13,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (BE_ENUM_H) @@ -38,13 +38,13 @@ public: // constructor virtual int gen_client_header (void); - // Generates the client-side header information for the enum + // Generates the client-side header information for the enum virtual int gen_client_stubs (void); // Generates the client-side stubs for the enum virtual int gen_server_header (void); - // Generates the server-side header information for the enum + // Generates the server-side header information for the enum virtual int gen_server_skeletons (void); // Generates the server-side skeletons for the enum diff --git a/TAO/TAO_IDL/be_include/be_exception.h b/TAO/TAO_IDL/be_include/be_exception.h index d28a35f7389..55391e0bfde 100644 --- a/TAO/TAO_IDL/be_include/be_exception.h +++ b/TAO/TAO_IDL/be_include/be_exception.h @@ -7,7 +7,7 @@ class be_exception : public virtual AST_Exception, public virtual be_scope, public virtual be_type - + { public: // Operations diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h index 1da3a2a23a8..d8af5c0ba61 100644 --- a/TAO/TAO_IDL/be_include/be_field.h +++ b/TAO/TAO_IDL/be_include/be_field.h @@ -2,7 +2,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_field.h // @@ -12,9 +12,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (BE_FIELD_H) @@ -36,13 +36,13 @@ public: // constructor virtual int gen_client_header (void); - // Generates the client-side header information for the field + // Generates the client-side header information for the field virtual int gen_client_stubs (void); // Generates the client-side stubs for the field virtual int gen_server_header (void); - // Generates the server-side header information for the field + // Generates the server-side header information for the field virtual int gen_server_skeletons (void); // Generates the server-side skeletons for the field @@ -63,6 +63,9 @@ public: DEF_NARROW_METHODS2 (be_field, AST_Field, be_decl); DEF_NARROW_FROM_DECL (be_field); +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown }; #endif diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h index 1453bfeb95d..4bec2a61528 100644 --- a/TAO/TAO_IDL/be_include/be_interface_fwd.h +++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h @@ -79,6 +79,7 @@ public: // Narrowing DEF_NARROW_METHODS2 (be_interface_fwd, AST_InterfaceFwd, be_type); DEF_NARROW_FROM_DECL (be_interface_fwd); + }; #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_module.h b/TAO/TAO_IDL/be_include/be_module.h index b4089e066e5..da1d76aeea2 100644 --- a/TAO/TAO_IDL/be_include/be_module.h +++ b/TAO/TAO_IDL/be_include/be_module.h @@ -3,7 +3,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_module.h // @@ -13,9 +13,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (_BE_MODULE_H) @@ -25,7 +25,7 @@ * BE_Module */ -class be_module : public virtual AST_Module, +class be_module : public virtual AST_Module, public virtual be_scope, public virtual be_decl { @@ -39,13 +39,13 @@ public: // constructor virtual int gen_client_header (void); - // Generates the client-side header information for the module + // Generates the client-side header information for the module virtual int gen_client_stubs (void); // Generates the client-side stubs for the module virtual int gen_server_header (void); - // Generates the server-side header information for the module + // Generates the server-side header information for the module virtual int gen_server_skeletons (void); // Generates the server-side skeletons for the module @@ -60,6 +60,10 @@ public: DEF_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl); DEF_NARROW_FROM_DECL (be_module); DEF_NARROW_FROM_SCOPE (be_module); + +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown }; #endif diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h index 64b449ea758..749f9d7545d 100644 --- a/TAO/TAO_IDL/be_include/be_operation.h +++ b/TAO/TAO_IDL/be_include/be_operation.h @@ -2,7 +2,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_operation.h // @@ -12,9 +12,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (BE_OPERATION_H) @@ -59,6 +59,10 @@ public: DEF_NARROW_METHODS3 (be_operation, AST_Operation, be_scope, be_decl); DEF_NARROW_FROM_DECL (be_operation); DEF_NARROW_FROM_SCOPE (be_operation); + +protected: + int compute_size_type (void); + // compute the size type if it is unknown }; #endif diff --git a/TAO/TAO_IDL/be_include/be_predefined_type.h b/TAO/TAO_IDL/be_include/be_predefined_type.h index b5235968184..7f94b4e3940 100644 --- a/TAO/TAO_IDL/be_include/be_predefined_type.h +++ b/TAO/TAO_IDL/be_include/be_predefined_type.h @@ -76,6 +76,9 @@ public: DEF_NARROW_FROM_DECL (be_predefined_type); protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown + virtual void compute_tc_name (void); // overridden method }; diff --git a/TAO/TAO_IDL/be_include/be_scope.h b/TAO/TAO_IDL/be_include/be_scope.h index d515264c238..45c591db168 100644 --- a/TAO/TAO_IDL/be_include/be_scope.h +++ b/TAO/TAO_IDL/be_include/be_scope.h @@ -3,7 +3,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_scope.h // @@ -12,9 +12,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (TAO_BE_SCOPE_H) @@ -43,13 +43,13 @@ public: // destructor virtual int gen_client_header (void); - // Generates the client-side header information for the scope + // Generates the client-side header information for the scope virtual int gen_client_stubs (void); // Generates the client-side stubs for the scope virtual int gen_server_header (void); - // Generates the server-side header information for the scope + // Generates the server-side header information for the scope virtual int gen_server_skeletons (void); // Generates the server-side skeletons for the scope @@ -69,6 +69,7 @@ public: // Narrowing DEF_NARROW_METHODS1 (be_scope, UTL_Scope); DEF_NARROW_FROM_SCOPE (be_scope); + }; #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_state.h b/TAO/TAO_IDL/be_include/be_state.h index 0a368967ae0..896d97d9dce 100644 --- a/TAO/TAO_IDL/be_include/be_state.h +++ b/TAO/TAO_IDL/be_include/be_state.h @@ -3,7 +3,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_state.h // @@ -12,7 +12,7 @@ // // = AUTHOR // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (TAO_BE_STATE_H) @@ -40,22 +40,22 @@ protected: // ============== subclasses ==================== -class be_state_struct_ch: public be_state +class be_state_struct : public be_state { // =TITLE - // be_state_struct_ch + // be_state_struct // =DESCRIPTION - // struct generation in client header + // struct generation public: - - be_state_struct_ch (void); + + be_state_struct (void); // constructor virtual int gen_code (be_type *bt, be_decl *d, be_type *type=0); // code generation for node "d" whose type is "bt". The third parameter is // used for recursive invocation involving a typedef }; -typedef ACE_Singleton<be_state_struct_ch, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_STATE_STRUCT_CH; +typedef ACE_Singleton<be_state_struct, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_STATE_STRUCT; class be_state_union_disctypedefn_ch: public be_state { @@ -64,7 +64,7 @@ class be_state_union_disctypedefn_ch: public be_state // =DESCRIPTION // union discriminant defn generation in client header public: - + be_state_union_disctypedefn_ch (void); // constructor @@ -73,7 +73,7 @@ public: // used for recursive invocation involving a typedef }; typedef ACE_Singleton<be_state_union_disctypedefn_ch, ACE_SYNCH_RECURSIVE_MUTEX> - TAO_BE_STATE_UNION_DISCTYPEDEFN_CH; + TAO_BE_STATE_UNION_DISCTYPEDEFN_CH; class be_state_union_disctypedefn_ci: public be_state { @@ -82,7 +82,7 @@ class be_state_union_disctypedefn_ci: public be_state // =DESCRIPTION // union discriminant defn generation in client inline file public: - + be_state_union_disctypedefn_ci (void); // constructor @@ -91,7 +91,7 @@ public: // used for recursive invocation involving a typedef }; typedef ACE_Singleton<be_state_union_disctypedefn_ci, ACE_SYNCH_RECURSIVE_MUTEX> - TAO_BE_STATE_UNION_DISCTYPEDEFN_CI; + TAO_BE_STATE_UNION_DISCTYPEDEFN_CI; class be_state_union_public_ch: public be_state { @@ -100,7 +100,7 @@ class be_state_union_public_ch: public be_state // =DESCRIPTION // union discriminant defn generation in client header file public: - + be_state_union_public_ch (void); // constructor @@ -109,7 +109,7 @@ public: // used for recursive invocation involving a typedef }; typedef ACE_Singleton<be_state_union_public_ch, ACE_SYNCH_RECURSIVE_MUTEX> - TAO_BE_STATE_UNION_PUBLIC_CH; + TAO_BE_STATE_UNION_PUBLIC_CH; class be_state_union_public_ci: public be_state { @@ -118,7 +118,7 @@ class be_state_union_public_ci: public be_state // =DESCRIPTION // union discriminant defn generation in client inline file public: - + be_state_union_public_ci (void); // constructor @@ -127,7 +127,7 @@ public: // used for recursive invocation involving a typedef }; typedef ACE_Singleton<be_state_union_public_ci, ACE_SYNCH_RECURSIVE_MUTEX> - TAO_BE_STATE_UNION_PUBLIC_CI; + TAO_BE_STATE_UNION_PUBLIC_CI; class be_state_union_private_ch: public be_state { @@ -136,7 +136,7 @@ class be_state_union_private_ch: public be_state // =DESCRIPTION // union discriminant defn generation in client header file public: - + be_state_union_private_ch (void); // constructor @@ -145,7 +145,7 @@ public: // used for recursive invocation involving a typedef }; typedef ACE_Singleton<be_state_union_private_ch, ACE_SYNCH_RECURSIVE_MUTEX> - TAO_BE_STATE_UNION_PRIVATE_CH; + TAO_BE_STATE_UNION_PRIVATE_CH; class be_state_operation: public be_state { @@ -154,7 +154,7 @@ class be_state_operation: public be_state // =DESCRIPTION // operation return type public: - + be_state_operation (void); // constructor @@ -172,7 +172,7 @@ class be_state_argument: public be_state // =DESCRIPTION // argument return type public: - + be_state_argument (void); // constructor @@ -190,7 +190,7 @@ class be_state_typedef: public be_state // =DESCRIPTION // typedef code generation public: - + be_state_typedef (void); // constructor @@ -208,7 +208,7 @@ class be_state_array: public be_state // =DESCRIPTION // array code generation public: - + be_state_array (void); // constructor @@ -226,7 +226,7 @@ class be_state_sequence: public be_state // =DESCRIPTION // sequence code generation public: - + be_state_sequence (void); // constructor @@ -256,4 +256,3 @@ typedef ACE_Singleton<be_state_attribute, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_STATE_ATTRIBUTE; #endif /* end of be_state */ - diff --git a/TAO/TAO_IDL/be_include/be_string.h b/TAO/TAO_IDL/be_include/be_string.h index dfde950b1e3..ac89639779b 100644 --- a/TAO/TAO_IDL/be_include/be_string.h +++ b/TAO/TAO_IDL/be_include/be_string.h @@ -74,7 +74,7 @@ public: protected: virtual void compute_tc_name (void); - // overridden method + // overridden method to compute typecode name }; #endif diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h index 295cb69a660..c0e131bffac 100644 --- a/TAO/TAO_IDL/be_include/be_structure.h +++ b/TAO/TAO_IDL/be_include/be_structure.h @@ -87,6 +87,10 @@ public: DEF_NARROW_FROM_DECL (be_structure); DEF_NARROW_FROM_SCOPE (be_structure); +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown + private: //=helper diff --git a/TAO/TAO_IDL/be_include/be_typedef.h b/TAO/TAO_IDL/be_include/be_typedef.h index 2d446a81eac..7d0e7270914 100644 --- a/TAO/TAO_IDL/be_include/be_typedef.h +++ b/TAO/TAO_IDL/be_include/be_typedef.h @@ -2,7 +2,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_typedef.h // @@ -12,9 +12,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (BE_TYPEDEF_H) @@ -40,13 +40,13 @@ public: // base types virtual int gen_client_header (void); - // Generates the client-side header information for the typedef + // Generates the client-side header information for the typedef virtual int gen_client_stubs (void); // Generates the client-side stubs for the typedef virtual int gen_server_header (void); - // Generates the server-side header information for the typedef + // Generates the server-side header information for the typedef virtual int gen_server_skeletons (void); // Generates the server-side skeletons for the typedef @@ -73,6 +73,10 @@ public: DEF_NARROW_METHODS2 (be_typedef, AST_Typedef, be_type); DEF_NARROW_FROM_DECL (be_typedef); +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown + }; #endif diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/clnt.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/clnt.cpp index 9f92dbb1bd4..8aababe5bad 100644 --- a/TAO/tests/Cubit/TAO/IDL_Cubit/clnt.cpp +++ b/TAO/tests/Cubit/TAO/IDL_Cubit/clnt.cpp @@ -395,10 +395,12 @@ Cubit_Client::cube_sequence (int i) } Cubit::vector* output_ptr; + Cubit::vector_out vout (output_ptr); + // Cube the sequence - this->cubit_->cube_sequence (input, output_ptr, this->env_); + this->cubit_->cube_sequence (input, vout, this->env_); - Cubit::vector& output = *output_ptr; + Cubit::vector& output = *vout.ptr (); if (this->env_.exception () != 0) { @@ -506,7 +508,7 @@ Cubit_Client::print_stats (const char *call_name, ACE_Profile_Timer::ACE_Elapsed ACE_DEBUG ((LM_DEBUG, "%s:\n", call_name)); - + if (this->call_count_ > 0 && this->error_count_ == 0) { tmp = 1000 / elapsed_time.real_time; @@ -564,15 +566,15 @@ Cubit_Client::run (void) this->cube_octet (i); this->cube_long (i); this->cube_struct (i); -#if defined (TAO_ALSO_TEST_SEQUENCES) + //#if defined (TAO_ALSO_TEST_SEQUENCES) this->cube_sequence (i); -#endif /* defined (TAO_ALSO_TEST_SEQUENCES) */ + //#endif /* defined (TAO_ALSO_TEST_SEQUENCES) */ } // stop the timer. timer.stop (); - timer.elapsed_time (elapsed_time); + timer.elapsed_time (elapsed_time); // compute call average call time. this->print_stats ("cube average call", elapsed_time); @@ -632,7 +634,7 @@ Cubit_Client::run (void) // compute call average call time. this->print_stats ("cube_union_dii call", elapsed_time); -#if defined (TAO_ALSO_TEST_SEQUENCES) + //#if defined (TAO_ALSO_TEST_SEQUENCES) // Sequences timer.start (); this->call_count_ = 0; @@ -648,9 +650,9 @@ Cubit_Client::run (void) timer.elapsed_time (elapsed_time); // compute call average call time. this->print_stats ("cube_sequence", elapsed_time); -#endif /* defined (TAO_ALSO_TEST_SEQUENCES) */ + //#endif /* defined (TAO_ALSO_TEST_SEQUENCES) */ + - if (this->exit_later_) { @@ -733,7 +735,7 @@ Cubit_Client::init (int argc, char **argv) -1); // Now retrieve the Cubit obj ref corresponding to the key. - this->cubit_ = + this->cubit_ = this->factory_->make_cubit (this->cubit_key_, this->env_); if (this->env_.exception () != 0) |