diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-15 23:23:46 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-15 23:23:46 +0000 |
commit | d8bacd2b55203a7a5c789359448c2001af1c0efe (patch) | |
tree | 973d7336083603c0be8e8c94c8f94539e4e99fac /TAO | |
parent | 33393611d425f63541d7fdbf1e906c39f51bc08a (diff) | |
download | ATCD-d8bacd2b55203a7a5c789359448c2001af1c0efe.tar.gz |
ChangeLogTag: Sun Aug 15 18:16:00 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 30 | ||||
-rw-r--r-- | TAO/TAO_IDL/ast/ast_decl.cpp | 11 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_global.cpp | 37 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_produce.cpp | 25 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp | 157 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_global.h | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 14 | ||||
-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 | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 90 |
12 files changed, 284 insertions, 126 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 6be739a999b..7ef61ac8ade 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,33 @@ +Sun Aug 15 18:16:00 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/ast/ast_decl.cpp: + + Fixed minor bug in setting the default version to 1.0. + + * TAO_IDL/be/be_global.cpp: + * TAO_IDL/be/be_produce.cpp: + * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp: + * TAO_IDL/be_include/be_global.h: + * TAO_IDL/be_include/be_visitor_ccm_pre_proc.h: + * TAO_IDL/driver/drv_preproc.cpp: + * TAO_IDL/fe/idl.yy: + * TAO_IDL/fe/y.tab.cpp: + * TAO_IDL/include/idl_global.h: + * TAO_IDL/util/utl_global.cpp: + + - Moved code to create AST nodes for a struct and sequence + implied IDL for 'uses multiple' declarations from the + parser back to its original location in the CCM preprocessing + visitor. + + - Added a command line option (-Sm) to suppress the CCM + preprocessing visitor, for use on IDL files that have + already had their CCM-related implied IDL converted explicitly. + + - Added a flag to change the way the includes orb.idl, + Components.idl and *.pidl are handled. This flag can be set + to modify the default behavior by a plugin back end. + Sun Aug 15 18:07:04 2004 Jeff Parsons <j.parsons@vanderbilt.edu> * docs/compiler.html: diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp index dcc36e6cc99..c387235b548 100644 --- a/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/TAO/TAO_IDL/ast/ast_decl.cpp @@ -916,9 +916,16 @@ AST_Decl::version (void) ':'); } - if (! this->typeid_set_ && tail2 != 0) + if (! this->typeid_set_) { - this->version_ = ACE::strnew (tail2 + 1); + if (tail2 != 0) + { + this->version_ = ACE::strnew (tail2 + 1); + } + else + { + this->version_ = ACE::strnew ("1.0"); + } } } diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index c4644d48969..9074e65ef93 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -83,7 +83,8 @@ BE_GlobalData::BE_GlobalData (void) lookup_strategy_ (TAO_PERFECT_HASH), void_type_ (0), ccmobject_ (0), - gen_anyop_files_ (I_FALSE) + gen_anyop_files_ (I_FALSE), + do_ccm_preproc_ (I_TRUE) { } @@ -992,6 +993,18 @@ BE_GlobalData::gen_anyop_files (idl_bool val) this->gen_anyop_files_ = val; } +idl_bool +BE_GlobalData::do_ccm_preproc (void) const +{ + return this->do_ccm_preproc_; +} + +void +BE_GlobalData::do_ccm_preproc (idl_bool val) +{ + this->do_ccm_preproc_ = val; +} + ACE_CString BE_GlobalData::spawn_options (void) { @@ -1443,24 +1456,24 @@ BE_GlobalData::parse_args (long &i, char **av) if (av[i][2] == 'a') { // suppress Any support - be_global->any_support (0); + be_global->any_support (I_FALSE); } else if (av[i][2] == 't') { // suppress typecode support // Anys must be suppressed as well - be_global->tc_support (0); - be_global->any_support (0); + be_global->tc_support (I_FALSE); + be_global->any_support (I_FALSE); } else if (av[i][2] == 'p') { // suppress generating Thru_POA collocated stubs - be_global->gen_thru_poa_collocation (0); + be_global->gen_thru_poa_collocation (I_FALSE); } else if (av[i][2] == 'd') { // suppress generating Direct collocated stubs - be_global->gen_direct_collocation (0); + be_global->gen_direct_collocation (I_FALSE); } else if (av[i][2] == 'c') { @@ -1470,7 +1483,12 @@ BE_GlobalData::parse_args (long &i, char **av) else if (av[i][2] == 'v') { // disable OBV (Valuetype) support - idl_global->obv_support (0); + idl_global->obv_support (I_FALSE); + } + else if (av[i][2] == 'm') + { + // disable IDL3 to IDL2 preprocessing. + be_global->do_ccm_preproc (I_FALSE); } else { @@ -1839,6 +1857,11 @@ BE_GlobalData::usage (void) const ACE_TEXT (" -Sv\t\t\tdisable OBV (Valuetype) support") ACE_TEXT (" (enabled by default)\n") )); + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT (" -Sm\t\t\tdisable IDL3 equivalent IDL preprocessing") + ACE_TEXT (" (enabled by default)\n") + )); } AST_Generator * diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp index 4f1527cfcd8..9936f760de0 100644 --- a/TAO/TAO_IDL/be/be_produce.cpp +++ b/TAO/TAO_IDL/be/be_produce.cpp @@ -121,19 +121,22 @@ BE_produce (void) BE_abort (); } - // Make a pass over the AST and introduce - // CCM specific nodes. - be_visitor_ccm_pre_proc ccm_preproc_visitor (&ctx); - - if (root->accept (&ccm_preproc_visitor) == -1) + if (be_global->do_ccm_preproc ()) { - ACE_ERROR ((LM_ERROR, - "(%N:%l) be_produce - " - "CCM preprocessing for Root failed\n")); - BE_abort (); + // Make a pass over the AST and introduce + // CCM specific nodes. + be_visitor_ccm_pre_proc ccm_preproc_visitor (&ctx); + + if (root->accept (&ccm_preproc_visitor) == -1) + { + ACE_ERROR ((LM_ERROR, + "(%N:%l) be_produce - " + "CCM preprocessing for Root failed\n")); + BE_abort (); + } } - if (be_global->ami_call_back () == I_TRUE) + if (be_global->ami_call_back ()) { // Make a pass over the AST and introduce // AMI specific interfaces, methods and valuetypes. @@ -148,7 +151,7 @@ BE_produce (void) } } - if (be_global->gen_amh_classes () == I_TRUE) + if (be_global->gen_amh_classes ()) { // Make a pass over the AST and introduce // AMH specific code 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 666e3e0b896..10f0e332bbc 100644 --- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp @@ -59,6 +59,8 @@ be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (be_visitor_context *ctx) : be_visitor_scope (ctx), module_id_ ("Components"), cookie_ (0), + connection_ (0), + connections_ (0), already_connected_ (0), invalid_connection_ (0), no_connection_ (0), @@ -356,6 +358,15 @@ 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, @@ -1455,6 +1466,152 @@ 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_global.h b/TAO/TAO_IDL/be_include/be_global.h index f104767418e..532b0eea9e8 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -428,6 +428,10 @@ public: void gen_anyop_files (idl_bool val); // Accessors for the member. + idl_bool do_ccm_preproc (void) const; + void do_ccm_preproc (idl_bool val); + // Accessors for the member do_ccm_preproc_. + ACE_CString spawn_options (void); // Command line passed to ACE_Process::spawn. Different // implementations in IDL and IFR backends. @@ -582,7 +586,10 @@ private: // Reference holder for component skeleton visitors. idl_bool gen_anyop_files_; - // @@@ (TAO TEAM ONLY) Separate files for generated Any operators? + // Separate files for generated Any operators? + + idl_bool do_ccm_preproc_; + // Do the IDL3 to IDL2 preprocessing? }; #endif /* _BE_GLOBAL_H */ 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 a1e5f0c6af8..f62257fcf3b 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,6 +126,13 @@ 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); @@ -142,6 +149,8 @@ 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/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 9c231e8997c..ba4450b0564 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -424,13 +424,17 @@ DRV_check_for_include (const char* buf) // Terminate this string. file_name [i] = '\0'; - // Store in the idl_global, unless it's "orb.idl" - - // we don't want to generate header includes for that. + // Some backends pass this file through, others don't. if (ACE_OS::strcmp (file_name, "orb.idl") == 0) { - // However, we do want to generate includes for the - // .pidl files that it contains. - DRV_get_orb_idl_includes (); + if (idl_global->pass_orb_idl ()) + { + idl_global->add_to_included_idl_files (file_name); + } + else + { + DRV_get_orb_idl_includes (); + } } else { diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index 92e542619b2..c4a400ffbfa 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -4516,14 +4516,6 @@ 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 11575f7573d..493280ecb2b 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -6769,14 +6769,6 @@ 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 39ac2a0cb32..e55b25bae9e 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -535,12 +535,11 @@ public: ACE_Hash_Map_Manager<ACE_CString, char *, ACE_Null_Mutex> & file_prefixes (void); - // Accessor for the IDL keyword container. + // Accessor for the IDL file prefix container. - 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. + idl_bool pass_orb_idl (void) const; + void pass_orb_idl (idl_bool val); + // Accessor for the pass_orb_idl_ member. int check_gperf (void); // Currently called only from IDL backend, but could be useful elsewhere. @@ -630,6 +629,9 @@ private: ACE_Hash_Map_Manager<ACE_CString, char *, ACE_Null_Mutex> file_prefixes_; // Associates a prefix with a file. + + idl_bool pass_orb_idl_; + // Treat orb.idl like any other included IDL file. }; diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 2059501580e..4a437d214a6 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -183,7 +183,8 @@ IDL_GlobalData::IDL_GlobalData (void) case_diff_error_ (I_TRUE), nest_orb_ (I_FALSE), idl_flags_ (""), - preserve_cpp_keywords_ (I_TRUE) + preserve_cpp_keywords_ (I_TRUE), + pass_orb_idl_ (I_FALSE) { // Path for the perfect hash generator(gperf) program. // Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined. @@ -191,6 +192,7 @@ IDL_GlobalData::IDL_GlobalData (void) // in the environment. // Form the absolute pathname. char* ace_root = ACE_OS::getenv ("ACE_ROOT"); + if (ace_root == 0) // This may not cause any problem if -g option is used to specify // the correct path for the gperf program. Let us ignore this @@ -1319,86 +1321,16 @@ IDL_GlobalData::file_prefixes (void) return this->file_prefixes_; } -void -IDL_GlobalData::create_uses_multiple_stuff ( - AST_Component *c, - AST_Component::port_description &pd - ) +idl_bool +IDL_GlobalData::pass_orb_idl (void) const { - 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); + return this->pass_orb_idl_; +} - 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); +void +IDL_GlobalData::pass_orb_idl (idl_bool val) +{ + this->pass_orb_idl_ = val; } // Return 0 on success, -1 failure. The <errno> corresponding to the |