diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-11-17 23:40:46 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-11-17 23:40:46 +0000 |
commit | 5d4c0b85ae07f0ad554df258e828283f6201a5bf (patch) | |
tree | ec127713fe8170629b16e0cea888d41a8eed6d20 | |
parent | ceb6e0cb2dd94d46869a338519868c3de680e080 (diff) | |
download | ATCD-5d4c0b85ae07f0ad554df258e828283f6201a5bf.tar.gz |
ChangeLogTag: Wed Nov 17 17:33:23 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 20 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp | 157 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/idl.yy | 8 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/y.tab.cpp | 8 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/idl_global.h | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 82 |
7 files changed, 123 insertions, 166 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index df7c4e30234..cd604e7221c 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,23 @@ +Wed Nov 17 17:33:23 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp: + * TAO_IDL/be_include/be_visitor_ccm_pre_proc.h: + * TAO_IDL/fe/idl.yy: + * TAO_IDL/fe/y.tab.cpp + * TAO_IDL/include/idl_global.h: + * TAO_IDL/util/utl_global.cpp: + + Reinstated changes of + + Tue May 11 22:28:45 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + that were reverted in + + Sun Aug 15 18:16:00 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + due to a misunderstanding about the appearance of IDL3 + "equivalent IDL" in spec-defined executor IDL. + Wed Nov 17 12:54:01 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> * docs/index.html: diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp index cea592c5ac0..ac33845f315 100644 --- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp @@ -58,8 +58,6 @@ be_exception *EXCEPS[N_EXCEPS]; be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (be_visitor_context *ctx) : be_visitor_scope (ctx), module_id_ ("Components"), - connection_ (0), - connections_ (0), cookie_ (0), already_connected_ (0), invalid_connection_ (0), @@ -358,15 +356,6 @@ be_visitor_ccm_pre_proc::gen_uses (be_component *node) } else { - if (this->create_uses_multiple_stuff (node, pd) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "gen_uses - " - "create_uses_multiple_stuff failed\n"), - -1); - } - if (this->gen_connect_multiple (node, pd) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -1466,152 +1455,6 @@ be_visitor_ccm_pre_proc::lookup_one_exception (be_component *node, } int -be_visitor_ccm_pre_proc::create_uses_multiple_stuff ( - be_component *node, - AST_Component::port_description *pd - ) -{ - if (this->create_uses_multiple_struct (node, pd) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_stuff - " - "create_uses_multiple_struct failed\n"), - -1); - } - - if (this->create_uses_multiple_sequence (node, pd) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_stuff - " - "create_uses_multiple_sequence failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_ccm_pre_proc::create_uses_multiple_struct ( - be_component *node, - AST_Component::port_description *pd - ) -{ - UTL_ScopedName *full_name = - this->create_scoped_name (0, - pd->id->get_string (), - "Connection", - node); - ACE_NEW_RETURN (this->connection_, - be_structure (0, - 0, - 0), - -1); - this->connection_->set_defined_in (node); - this->connection_->set_imported (node->imported ()); - this->connection_->set_name (full_name); - - Identifier o_id ("objref"); - UTL_ScopedName o_sn (&o_id, - 0); - AST_Field *m_objref = 0; - ACE_NEW_RETURN (m_objref, - be_field (pd->impl, - &o_sn), - -1); - o_id.destroy (); - - if (this->connection_->be_add_field (m_objref) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_struct - " - "be_add_field failed\n"), - -1); - } - - Identifier v_id ("ck"); - UTL_ScopedName v_sn (&v_id, - 0); - AST_Field *m_ck = 0; - ACE_NEW_RETURN (m_ck, - be_field (this->cookie_, - &v_sn), - -1); - - if (this->connection_->be_add_field (m_ck) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_struct - " - "be_add_field failed\n"), - -1); - } - - if (node->be_add_structure (this->connection_) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_struct - " - "be_add_structure failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_ccm_pre_proc::create_uses_multiple_sequence ( - be_component *node, - AST_Component::port_description *pd - ) -{ - ACE_UINT64 bound = 0; - ACE_NEW_RETURN ( - this->connections_, - be_sequence ( - idl_global->gen ()->create_expr ( - bound, - AST_Expression::EV_ulong - ), - this->connection_, - 0, - 0, - 0 - ), - -1 - ); - - UTL_ScopedName *sn = - this->create_scoped_name (0, - pd->id->get_string (), - "Connections", - node); - AST_Typedef *td = 0; - ACE_NEW_RETURN (td, - be_typedef (this->connections_, - 0, - 0, - 0), - -1); - td->set_defined_in (node); - td->set_imported (node->imported ()); - td->set_name (sn); - - if (node->be_add_typedef (td) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_sequence - " - "be_add_typedef failed\n"), - -1); - } - - return 0; -} - -int be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node) { AST_Interface *event_consumer = 0; diff --git a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h index f62257fcf3b..a1e5f0c6af8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h +++ b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h @@ -126,13 +126,6 @@ private: const char *name, be_exception *&result); - int create_uses_multiple_stuff (be_component *node, - AST_Component::port_description *pd); - int create_uses_multiple_struct (be_component *node, - AST_Component::port_description *pd); - int create_uses_multiple_sequence (be_component *node, - AST_Component::port_description *pd); - int create_event_consumer (be_eventtype *node); AST_Interface *lookup_consumer (AST_Component::port_description *pd); AST_Interface *create_explicit (be_home *node); @@ -149,8 +142,6 @@ private: private: // These are created for operations implied by 'uses multiple' declarations. Identifier module_id_; - be_structure *connection_; - be_sequence *connections_; be_valuetype *cookie_; // Exceptions thrown by implied CCM operations. diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index accf6905e76..3ed6f111daa 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -4517,6 +4517,14 @@ uses_decl : ud.impl = interface_type; ud.is_multiple = $2; c->uses ().enqueue_tail (ud); + + if (ud.is_multiple == I_TRUE) + { + // These datatypes must be created in the + // front end so they can be looked up + // when compiling the generated executor IDL. + idl_global->create_uses_multiple_stuff (c, ud); + } } } } diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp index 0b2c21644ce..1180d883048 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -6770,6 +6770,14 @@ tao_yyreduce: ud.impl = interface_type; ud.is_multiple = tao_yyvsp[-2].bval; c->uses ().enqueue_tail (ud); + + if (ud.is_multiple == I_TRUE) + { + // These datatypes must be created in the + // front end so they can be looked up + // when compiling the generated executor IDL. + idl_global->create_uses_multiple_stuff (c, ud); + } } } break; diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index e0cb760293e..f9af6d1a838 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -541,6 +541,11 @@ public: void fini (void); // Do final cleanup just before process exits. + void create_uses_multiple_stuff (AST_Component *c, + AST_Component::port_description &pd); + // We must do this in the front end since the executor + // mapping IDL will have these data types. + private: // Data UTL_ScopeStack pd_scopes; // Store scopes stack diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index d482508451e..1f17a9fb3af 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -1452,3 +1452,85 @@ IDL_GlobalData::fini (void) delete [] this->ident_string_; this->ident_string_ = 0; } + +void +IDL_GlobalData::create_uses_multiple_stuff ( + AST_Component *c, + AST_Component::port_description &pd + ) +{ + ACE_CString struct_name (pd.id->get_string ()); + struct_name += "Connection"; + Identifier struct_id (struct_name.c_str ()); + UTL_ScopedName sn (&struct_id, 0); + AST_Structure *connection = + idl_global->gen ()->create_structure (&sn, 0, 0); + struct_id.destroy (); + + Identifier object_id ("objref"); + UTL_ScopedName object_name (&object_id, + 0); + AST_Field *object_field = + idl_global->gen ()->create_field (pd.impl, + &object_name, + AST_Field::vis_NA); + (void) DeclAsScope (connection)->fe_add_field (object_field); + object_id.destroy (); + + Identifier local_id ("Cookie"); + UTL_ScopedName local_name (&local_id, + 0); + Identifier module_id ("Components"); + UTL_ScopedName scoped_name (&module_id, + &local_name); + AST_Decl *d = c->lookup_by_name (&scoped_name, + I_TRUE); + local_id.destroy (); + module_id.destroy (); + + if (d == 0) + { + // This would happen if we haven't included Componennts.idl. + idl_global->err ()->lookup_error (&scoped_name); + return; + } + + AST_ValueType *cookie = AST_ValueType::narrow_from_decl (d); + + Identifier cookie_id ("ck"); + UTL_ScopedName cookie_name (&cookie_id, + 0); + AST_Field *cookie_field = + idl_global->gen ()->create_field (cookie, + &cookie_name, + AST_Field::vis_NA); + (void) DeclAsScope (connection)->fe_add_field (cookie_field); + cookie_id.destroy (); + + (void) c->fe_add_structure (connection); + + ACE_UINT64 bound = 0; + AST_Expression *bound_expr = + idl_global->gen ()->create_expr (bound, + AST_Expression::EV_ulong); + AST_Sequence *sequence = + idl_global->gen ()->create_sequence (bound_expr, + connection, + 0, + 0, + 0); + + ACE_CString seq_string (pd.id->get_string ()); + seq_string += "Connections"; + Identifier seq_id (seq_string.c_str ()); + UTL_ScopedName seq_name (&seq_id, + 0); + AST_Typedef *connections = + idl_global->gen ()->create_typedef (sequence, + &seq_name, + 0, + 0); + seq_id.destroy (); + + (void) c->fe_add_typedef (connections); +} |