From c1abc69c2018a7363186b6f36b22d90771784013 Mon Sep 17 00:00:00 2001 From: parsons Date: Thu, 26 Sep 2002 18:22:41 +0000 Subject: ChangeLogTag: Thu Sep 26 13:11:03 2002 Jeff Parsons --- TAO/ChangeLog | 33 ++++ TAO/TAO_IDL/ast/ast_decl.cpp | 212 +++++++++++---------- TAO/TAO_IDL/be/be_codegen.cpp | 2 + TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp | 2 + .../be/be_visitor_interface_fwd/cdr_op_ch.cpp | 7 +- TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp | 2 +- TAO/TAO_IDL/be/be_visitor_root/root.cpp | 8 +- .../gen_unbounded_sequence_ci.cpp | 1 + .../be/be_visitor_typecode/typecode_defn.cpp | 4 +- TAO/orbsvcs/IFR_Service/ifr_visitor.cpp | 12 ++ TAO/orbsvcs/IFR_Service/ifr_visitor.h | 6 + 11 files changed, 182 insertions(+), 107 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 0a0324c5009..cd281ecf2c1 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,36 @@ +Thu Sep 26 13:11:03 2002 Jeff Parsons + + * TAO_IDL/ast/ast_decl.cpp: + + Fixed a bug where a repository ID prefix set by 'typeprefix' was + getting ignored in the repo IDs of scope members. Thanks to Ossama + for pointing our the bug. + + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_visitor_field/field_ch.cpp: + * TAO_IDL/be/be_visitor_root/root.cpp: + * TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp: + + Added missing generated newlines. + + * TAO_IDL/be/be_visitor_module/module_sh.cpp: + + Fixed indentation of generated code. + + * TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp: + + Replace a generated 'const' that had somehow gone missing. + + * TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp: + + Cosmetic changes. + + * orbsvcs/IFR_Service/ifr_visitor.cpp: + * orbsvcs/IFR_Service/ifr_visitor.h: + + Added empty methods visit_eventtype() and visit_eventtype_fwd() so + the tao_ifr visitor classes can be instantiated. + Thu Sep 26 09:30:02 2002 Ossama Othman * orbsvcs/orbsvcs/CosLoadBalancing.idl: diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp index 4ead555e25c..92b646381bf 100644 --- a/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/TAO/TAO_IDL/ast/ast_decl.cpp @@ -383,141 +383,153 @@ AST_Decl::compute_repoID (void) { return; } + + long namelen = 4; // for the prefix "IDL:" + long first = I_TRUE; + long second = I_FALSE; + char *name = 0; + const char *prefix = this->prefix_; + + // If our prefix is empty, we use the parent's, if any, which may also + // be empty. + if (ACE_OS::strcmp (prefix, "") == 0) + { + UTL_Scope *parent_scope = this->defined_in (); + + if (parent_scope != 0) + { + AST_Decl *parent = ScopeAsDecl (parent_scope); + + prefix = parent->prefix (); + } + } + + // in the first loop compute the total length + namelen += ACE_OS::strlen (prefix) + 1; + + if (this->version_ != 0) + { + // Version member string + ':' + namelen += ACE_OS::strlen (this->version_) + 1; + } else { - long namelen = 4; // for the prefix "IDL:" - long first = I_TRUE; - long second = I_FALSE; - char *name = 0; + // For ":1.0" + namelen += 4; + } + + for (UTL_IdListActiveIterator i (this->name ()); + !i.is_done (); + i.next ()) + { + if (!first) + { + namelen += 1; // for "/" + } + else if (second) + { + first = second = I_FALSE; + } - // in the first loop compute the total length - namelen += ACE_OS::strlen (this->prefix_) + 1; + // Print the identifier. + name = i.item ()->get_string (); + size_t item_len = ACE_OS::strlen (name); - if (this->version_ != 0) + if (ACE_OS::strstr (name, "_cxx_") == name) { - // Version member string + ':' - namelen += ACE_OS::strlen (this->version_) + 1; + namelen += (item_len - ACE_OS::strlen ("_cxx_")); } else { - // For ":1.0" - namelen += 4; + namelen += item_len; } - for (UTL_IdListActiveIterator i (this->name ()); - !i.is_done (); - i.next ()) + if (first) { - if (!first) + if (ACE_OS::strcmp (name, "") != 0) { - namelen += 1; // for "/" - } - else if (second) - { - first = second = I_FALSE; - } - - // Print the identifier. - name = i.item ()->get_string (); - size_t item_len = ACE_OS::strlen (name); - - if (ACE_OS::strstr (name, "_cxx_") == name) - { - namelen += (item_len - ACE_OS::strlen ("_cxx_")); + // Does not start with a "". + first = I_FALSE; } else { - namelen += item_len; - } - - if (first) - { - if (ACE_OS::strcmp (name, "") != 0) - { - // Does not start with a "". - first = I_FALSE; - } - else - { - second = I_TRUE; - } + second = I_TRUE; } } + } - ACE_NEW (this->repoID_, - char[namelen + 1]); + ACE_NEW (this->repoID_, + char[namelen + 1]); - this->repoID_[0] = '\0'; + this->repoID_[0] = '\0'; - ACE_OS::sprintf (this->repoID_, - "%s", - "IDL:"); + ACE_OS::sprintf (this->repoID_, + "%s", + "IDL:"); + if (ACE_OS::strcmp (prefix, "") != 0) + { ACE_OS::strcat (this->repoID_, - this->prefix_); + prefix); - // Add the "/" only if there is a prefix. - if (ACE_OS::strcmp (this->prefix_, "") != 0) + ACE_OS::strcat (this->repoID_, "/"); + } + + first = I_TRUE; + second = I_FALSE; + + for (UTL_IdListActiveIterator j (this->name ()); + !j.is_done (); + j.next ()) + { + if (!first) { ACE_OS::strcat (this->repoID_, "/"); } + else if (second) + { + first = second = I_FALSE; + } - first = I_TRUE; - second = I_FALSE; + // Print the identifier. + name = j.item ()->get_string (); - for (UTL_IdListActiveIterator j (this->name ()); - !j.is_done (); - j.next ()) + if (ACE_OS::strstr (name, "_cxx_") == name) { - if (!first) - { - ACE_OS::strcat (this->repoID_, "/"); - } - else if (second) - { - first = second = I_FALSE; - } - - // Print the identifier. - name = j.item ()->get_string (); + ACE_OS::strcat (this->repoID_, + name + ACE_OS::strlen ("_cxx_")); + } + else + { + ACE_OS::strcat (this->repoID_, + name); + } - if (ACE_OS::strstr (name, "_cxx_") == name) + if (first) + { + if (ACE_OS::strcmp (name, "") != 0) { - ACE_OS::strcat (this->repoID_, - name + ACE_OS::strlen ("_cxx_")); + // Does not start with a "". + first = I_FALSE; } else { - ACE_OS::strcat (this->repoID_, - name); - } - - if (first) - { - if (ACE_OS::strcmp (name, "") != 0) - { - // Does not start with a "". - first = I_FALSE; - } - else - { - second = I_TRUE; - } + second = I_TRUE; } } + } - if (this->version_ != 0) - { - ACE_OS::strcat (this->repoID_, - ":"); - ACE_OS::strcat (this->repoID_, - this->version_); - } - else - { - ACE_OS::strcat (this->repoID_, - ":1.0"); - } + if (this->version_ != 0) + { + ACE_OS::strcat (this->repoID_, + ":"); + ACE_OS::strcat (this->repoID_, + this->version_); + } + else + { + ACE_OS::strcat (this->repoID_, + ":1.0"); } } @@ -914,7 +926,11 @@ AST_Decl::set_prefix_with_typeprefix (char *value) { case AST_Decl::NT_module: case AST_Decl::NT_interface: + case AST_Decl::NT_valuetype: case AST_Decl::NT_eventtype: + case AST_Decl::NT_struct: + case AST_Decl::NT_union: + case AST_Decl::NT_except: break; default: idl_global->err ()->error1 (UTL_Error::EIDL_INVALID_TYPEPREFIX, diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index cb975a06926..5f67e5ec968 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -1186,6 +1186,8 @@ TAO_CodeGen::end_server_template_header (void) int TAO_CodeGen::end_server_template_inline (void) { + *this->server_template_inline_ << "\n\n"; + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp index 203da19c4f4..8be61b129cf 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp @@ -603,6 +603,8 @@ be_visitor_field_ch::visit_union (be_union *node) } } + *os << be_nl << be_nl; + // This was a typedefed array. // ACE_NESTED_CLASS macro generated by nested_type_name // is necessary if the struct, union, or valuetype containing this diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp index be788d61101..ac208f83648 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp @@ -55,16 +55,15 @@ be_visitor_interface_fwd_cdr_op_ch::visit_interface_fwd (be_interface_fwd *node) // No CDR operations for locality constraint interfaces. if (node->cli_hdr_cdr_op_gen () - || node->imported () - || node->is_local ()) + || node->imported ()) { return 0; } TAO_OutStream *os = this->ctx_->stream (); - // Generate the CDR << and >> operator declarations. - os->indent (); + *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; *os << be_global->stub_export_macro () << " CORBA::Boolean " << "operator<< (TAO_OutputCDR &, const " << node->full_name () diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp index f235917d488..fc5e6743c73 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp @@ -76,7 +76,7 @@ be_visitor_module_sh::visit_module (be_module *node) -1); } - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl + *os << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; *os << "}" << be_nl << "TAO_NAMESPACE_CLOSE // module " diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 71c23453f66..a8ae905ee86 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -59,12 +59,13 @@ int be_visitor_root::visit_root (be_root *node) -1); } + TAO_OutStream *os = this->ctx_->stream (); + // If we are generating the client header file, this is the place to // generate the proxy broker factory function pointer declarations // and the extern declarations for non-defined interfaces. if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CH) { - TAO_OutStream *os = this->ctx_->stream (); be_interface *i = 0; be_interface_fwd *ifwd = 0; size_t index = 0; @@ -395,9 +396,14 @@ int be_visitor_root::visit_root (be_root *node) case TAO_CodeGen::TAO_ROOT_CH: (void) tao_cg->end_client_header (); break; + case TAO_CodeGen::TAO_ROOT_CI: + case TAO_CodeGen::TAO_ROOT_CS: + *os << "\n\n"; + break; default: break; } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp index 2188643ffe8..97ca768ed1b 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp @@ -408,6 +408,7 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node) // get_buffer *os << "ACE_INLINE" << be_nl; + *os << "const "; bt->accept (&visitor); diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp index c45d601a4a8..d5c24bdc4e0 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -283,8 +283,6 @@ be_visitor_typecode_defn::visit_type (be_type *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - os->indent (); // start from current indentation level - // Generate the typecode information here *os << "static const CORBA::Long _oc_"; @@ -292,7 +290,7 @@ be_visitor_typecode_defn::visit_type (be_type *node) *os << node->flat_name (); *os << "[] =" << be_nl; - *os << "{" << be_idt << "\n"; + *os << "{" << be_idt_nl; // Add the sizeof the enum tk_* and the encap length that we do not put into // this array but which will exist in the CDR buffer. diff --git a/TAO/orbsvcs/IFR_Service/ifr_visitor.cpp b/TAO/orbsvcs/IFR_Service/ifr_visitor.cpp index a424a9c5e84..926e0ab7587 100644 --- a/TAO/orbsvcs/IFR_Service/ifr_visitor.cpp +++ b/TAO/orbsvcs/IFR_Service/ifr_visitor.cpp @@ -97,6 +97,18 @@ ifr_visitor::visit_component_fwd (AST_ComponentFwd *) return 0; } +int +ifr_visitor::visit_eventtype (AST_EventType *) +{ + return 0; +} + +int +ifr_visitor::visit_eventtype_fwd (AST_EventTypeFwd *) +{ + return 0; +} + int ifr_visitor::visit_home (AST_Home *) { diff --git a/TAO/orbsvcs/IFR_Service/ifr_visitor.h b/TAO/orbsvcs/IFR_Service/ifr_visitor.h index 08bfdc9f7a1..ed223a529d3 100644 --- a/TAO/orbsvcs/IFR_Service/ifr_visitor.h +++ b/TAO/orbsvcs/IFR_Service/ifr_visitor.h @@ -79,6 +79,12 @@ public: virtual int visit_component_fwd (AST_ComponentFwd *node); // Visit component_fwd + virtual int visit_eventtype (AST_EventType *node); + // Visit valuetype. + + virtual int visit_eventtype_fwd (AST_EventTypeFwd *node); + // Visit valuetype_fwd + virtual int visit_home (AST_Home *node); // Visit component home. -- cgit v1.2.1