summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be')
-rw-r--r--TAO/TAO_IDL/be/be_args.cpp161
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp51
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp757
-rw-r--r--TAO/TAO_IDL/be/be_constant.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp543
-rw-r--r--TAO/TAO_IDL/be/be_enum.cpp65
-rw-r--r--TAO/TAO_IDL/be/be_enum_val.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp56
-rw-r--r--TAO/TAO_IDL/be/be_expression.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_generator.cpp707
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp821
-rw-r--r--TAO/TAO_IDL/be/be_helper.cpp184
-rw-r--r--TAO/TAO_IDL/be/be_init.cpp105
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp974
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp180
-rw-r--r--TAO/TAO_IDL/be/be_interface_strategy.cpp344
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_native.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp132
-rw-r--r--TAO/TAO_IDL/be/be_operation_strategy.cpp158
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp392
-rw-r--r--TAO/TAO_IDL/be/be_produce.cpp158
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp37
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp307
-rw-r--r--TAO/TAO_IDL/be/be_stream_factory.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp277
-rw-r--r--TAO/TAO_IDL/be/be_sunsoft.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp531
-rw-r--r--TAO/TAO_IDL/be/be_typedef.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp564
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp65
-rw-r--r--TAO/TAO_IDL/be/be_union_label.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp314
-rw-r--r--TAO/TAO_IDL/be/be_valuetype_fwd.cpp245
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_factory.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_collocated_sh.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp45
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/thru_poa_collocated_sh.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_is.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_si.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp38
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp2
104 files changed, 5558 insertions, 3447 deletions
diff --git a/TAO/TAO_IDL/be/be_args.cpp b/TAO/TAO_IDL/be/be_args.cpp
deleted file mode 100644
index c8a5ab49d0f..00000000000
--- a/TAO/TAO_IDL/be/be_args.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-// be_args.cc - Collect command line arguments for the BE
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_args, "$Id$")
-
-/*
- * Prepare an argument for a BE
- *
- * Since this is the dummy BE, it doesn't do anything with the passed string
- */
-void
-BE_prep_arg(char *s, idl_bool)
-{
- const char arg_macro[]="export_macro=";
- const char arg_include[]="export_include=";
- const char skel_arg_macro[]="skel_export_macro=";
- const char skel_arg_include[]="skel_export_include=";
- const char stub_arg_macro[]="stub_export_macro=";
- const char stub_arg_include[]="stub_export_include=";
- const char arg_pch_include[]="pch_include=";
- const char arg_pre_include[]="pre_include=";
- const char arg_post_include[]="post_include=";
-#ifdef IDL_HAS_VALUETYPE
- const char obv_opt_accessor[]="obv_opt_accessor";
-#endif /* IDL_HAS_VALUETYPE */
-
- char* last = 0;
- for (char* arg = ACE_OS::strtok_r (s, ",", &last);
- arg != 0;
- arg = ACE_OS::strtok_r (0, ",", &last))
- {
- if (ACE_OS::strstr (arg, arg_macro) == arg)
- {
- char* val = arg + sizeof (arg_macro) - 1;
- idl_global->skel_export_macro (val);
- idl_global->stub_export_macro (val);
- }
- else if (ACE_OS::strstr (arg, arg_include) == arg)
- {
- char* val = arg + sizeof (arg_include) - 1;
- idl_global->stub_export_include (val);
- }
- else if (ACE_OS::strstr (arg, skel_arg_macro) == arg)
- {
- char* val = arg + sizeof (skel_arg_macro) - 1;
- idl_global->skel_export_macro (val);
- }
- else if (ACE_OS::strstr (arg, skel_arg_include) == arg)
- {
- char* val = arg + sizeof (skel_arg_include) - 1;
- idl_global->skel_export_include (val);
- }
- else if (ACE_OS::strstr (arg, stub_arg_macro) == arg)
- {
- char* val = arg + sizeof (stub_arg_macro) - 1;
- idl_global->stub_export_macro (val);
- }
- else if (ACE_OS::strstr (arg, stub_arg_include) == arg)
- {
- char* val = arg + sizeof (stub_arg_include) - 1;
- idl_global->stub_export_include (val);
- }
- else if (ACE_OS::strstr (arg, arg_pch_include) == arg)
- {
- char* val = arg + sizeof (arg_pch_include) - 1;
- idl_global->pch_include (val);
- }
- else if (ACE_OS::strstr (arg, arg_pre_include) == arg)
- {
- char* val = arg + sizeof (arg_pre_include) - 1;
- idl_global->pre_include (val);
- }
- else if (ACE_OS::strstr (arg, arg_post_include) == arg)
- {
- char* val = arg + sizeof (arg_post_include) - 1;
- idl_global->post_include (val);
- }
-# ifdef IDL_HAS_VALUETYPE
- else if (ACE_OS::strstr (arg, obv_opt_accessor) == arg)
- {
- idl_global->obv_opt_accessor (1);
- }
-# endif /* IDL_HAS_VALUETYPE */
- else
- {
- cerr << idl_global->prog_name ()
- << ": invalid or unknown argument <"
- << arg
- << "> to back end\n";
- }
- }
-}
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
index f6ae7a8f713..c7645038263 100644
--- a/TAO/TAO_IDL/be/be_argument.cpp
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -25,19 +25,25 @@
ACE_RCSID(be, be_argument, "$Id$")
-/*
- * BE_Argument
- */
-
be_argument::be_argument (void)
{
}
-be_argument::be_argument (AST_Argument::Direction d, AST_Type *ft,
- UTL_ScopedName *n, UTL_StrList *p)
- : AST_Argument (d, ft, n, p),
- AST_Field (AST_Decl::NT_argument, ft, n, p),
- AST_Decl (AST_Decl::NT_argument, n, p)
+be_argument::be_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Argument (d,
+ ft,
+ n,
+ p),
+ AST_Field (AST_Decl::NT_argument,
+ ft,
+ n,
+ p),
+ AST_Decl (AST_Decl::NT_argument,
+ n,
+ p)
{
}
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index 7eb49d2fe58..52bb2da39ea 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -25,9 +25,6 @@
ACE_RCSID(be, be_array, "$Id$")
-/*
- * BE_Array
- */
be_array::be_array (void)
: tao_name_ (0)
{
@@ -38,9 +35,16 @@ be_array::be_array (UTL_ScopedName *n,
UTL_ExprList *dims,
idl_bool local,
idl_bool abstract)
- : AST_Array (n, ndims, dims, local, abstract),
- AST_Decl (AST_Decl::NT_array, n, NULL),
- COMMON_Base (local, abstract),
+ : AST_Array (n,
+ ndims,
+ dims,
+ local,
+ abstract),
+ AST_Decl (AST_Decl::NT_array,
+ n,
+ 0),
+ COMMON_Base (local,
+ abstract),
tao_name_ (0)
{
}
@@ -189,7 +193,8 @@ be_array::create_name (void)
// Code generation
int
-be_array::gen_dimensions (TAO_OutStream *os, unsigned short slice)
+be_array::gen_dimensions (TAO_OutStream *os,
+ unsigned short slice)
{
unsigned long i; // loop index
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index c14b4a2d366..7aa6986a4c8 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -25,13 +25,17 @@
ACE_RCSID(be, be_attribute, "$Id$")
-/*
- * BE_Attribute
- */
be_attribute::be_attribute (void)
-: get_strategy_ (new be_operation_default_strategy (0)),
- set_strategy_ (new be_operation_default_strategy (0))
{
+ be_operation_default_strategy *bods = 0;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->get_strategy_ = bods;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->set_strategy_ = bods;
}
be_attribute::be_attribute (idl_bool ro,
@@ -40,14 +44,31 @@ be_attribute::be_attribute (idl_bool ro,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Attribute (ro, ft, n, p, local, abstract),
- AST_Field (AST_Decl::NT_attr, ft, n, p),
- AST_Decl (AST_Decl::NT_attr, n, p),
- COMMON_Base (local, abstract),
- get_strategy_ (new be_operation_default_strategy (0)),
- set_strategy_ (new be_operation_default_strategy (0))
+ : AST_Attribute (ro,
+ ft,
+ n,
+ p,
+ local,
+ abstract),
+ AST_Field (AST_Decl::NT_attr,
+ ft,
+ n,
+ p),
+ AST_Decl (AST_Decl::NT_attr,
+ n,
+ p),
+ COMMON_Base (local,
+ abstract)
{
+ be_operation_default_strategy *bods = 0;
+
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->get_strategy_ = bods;
+ ACE_NEW (bods,
+ be_operation_default_strategy (0));
+ this->set_strategy_ = bods;
}
@@ -65,7 +86,9 @@ be_attribute::set_set_strategy (be_operation_strategy *new_strategy)
be_operation_strategy *old = this->set_strategy_;
if (new_strategy != 0)
- this->set_strategy_ = new_strategy;
+ {
+ this->set_strategy_ = new_strategy;
+ }
return old;
}
@@ -76,7 +99,9 @@ be_attribute::set_get_strategy (be_operation_strategy *new_strategy)
be_operation_strategy *old = this->get_strategy_;
if (new_strategy != 0)
- this->get_strategy_ = new_strategy;
+ {
+ this->get_strategy_ = new_strategy;
+ }
return old;
}
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index c7d7edd6b00..9088b76b4c6 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -22,9 +22,8 @@
ACE_RCSID(be, be_codegen, "$Id$")
-TAO_CodeGen *tao_cg = 0;
+TAO_IDL_BE_Export TAO_CodeGen *tao_cg = 0;
-/* BE global Data */
TAO_CodeGen::TAO_CodeGen (void)
: client_header_ (0),
client_stubs_ (0),
@@ -40,8 +39,7 @@ TAO_CodeGen::TAO_CodeGen (void)
gperf_input_stream_ (0),
gperf_input_filename_ (0),
curr_os_ (0),
- visitor_factory_ (0),
- strategy_ (TAO_PERFECT_HASH)
+ visitor_factory_ (0)
{
}
@@ -68,7 +66,7 @@ be_visitor *
TAO_CodeGen::make_visitor (be_visitor_context *ctx)
{
- if (!this->visitor_factory_)
+ if (this->visitor_factory_ == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"TAO_CodeGen::make_visitor - "
@@ -79,14 +77,14 @@ TAO_CodeGen::make_visitor (be_visitor_context *ctx)
return this->visitor_factory_->make_visitor (ctx);
}
-// change the string to all upcase
+// Change the string to all upper case.
const char *
TAO_CodeGen::upcase (const char *str)
{
static char upcase_str [NAMEBUFSIZE];
ACE_OS::memset (upcase_str, '\0', NAMEBUFSIZE);
- // convert letters in str to upcase
+ // Convert letters in str to upper case.
for (unsigned int i=0; i < ACE_OS::strlen (str); i++)
{
if (isalpha (str [i]))
@@ -95,14 +93,14 @@ TAO_CodeGen::upcase (const char *str)
}
else
{
- // copy it as it is
+ // Copy it as it is.
upcase_str[i] = str[i];
}
}
return upcase_str;
}
-// set the client header stream
+// Set the client header stream.
int
TAO_CodeGen::start_client_header (const char *fname)
{
@@ -110,21 +108,24 @@ TAO_CodeGen::start_client_header (const char *fname)
// idl_global. We need to make sure the validity of those files.
idl_global->validate_included_idl_files ();
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->client_header_ = factory->make_outstream ();
+
if (!this->client_header_)
{
return -1;
}
if (this->client_header_->open (fname, TAO_OutStream::TAO_CLI_HDR) == -1)
- return -1;
+ {
+ return -1;
+ }
else
{
- // now generate the #if !defined clause
+ // Now generate the #if !defined clause.
static char macro_name [NAMEBUFSIZE];
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
@@ -141,7 +142,7 @@ TAO_CodeGen::start_client_header (const char *fname)
}
ACE_OS::sprintf (macro_name, "_TAO_IDL_");
- // convert letters in fname to upcase
+ // Convert letters in fname to upper case.
for (int i=0; i < (suffix - fname); i++)
{
if (isalpha (fname [i]))
@@ -154,35 +155,44 @@ TAO_CodeGen::start_client_header (const char *fname)
ACE_OS::strcat (macro_name, "_H_");
- // generate the #ifndef ... #define statements
+ // Generate the #ifndef ... #define statements.
this->client_header_->print ("#ifndef %s\n", macro_name);
this->client_header_->print ("#define %s\n\n", macro_name);
- if (idl_global->pre_include () != 0)
+
+ if (be_global->pre_include () != 0)
{
*this->client_header_ << "#include \""
- << idl_global->pre_include ()
+ << be_global->pre_include ()
<< "\"\n";
}
// Including standard files
- // switch between changing or non-changing standard include files
+ // Switch between changing or non-changing standard include files
// include files, so that #include statements can be
// generated with ""s or <>s respectively, for the standard include
- // files (e.g. tao/corba.h)
+ // files (e.g. tao/corba.h).
*this->client_header_ << "#include ";
- if (idl_global->changing_standard_include_files () == 1)
- *this->client_header_ << "\"";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_header_ << "\"";
+ }
else
- *this->client_header_ << "<";
+ {
+ *this->client_header_ << "<";
+ }
*this->client_header_ << "tao/corba.h";
- if (idl_global->changing_standard_include_files () == 1)
- *this->client_header_ << "\"\n";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_header_ << "\"\n";
+ }
else
- *this->client_header_ << ">\n";
+ {
+ *this->client_header_ << ">\n";
+ }
// Some compilers don't optimize the #ifndef header include
// protection, but do optimize based on #pragma once.
@@ -192,45 +202,61 @@ TAO_CodeGen::start_client_header (const char *fname)
// Other include files.
- if (idl_global->stub_export_include () != 0)
+ if (be_global->stub_export_include () != 0)
{
*this->client_header_ << "#include \""
- << idl_global->stub_export_include ()
+ << be_global->stub_export_include ()
<< "\"\n";
}
// Include the Messaging files if AMI is enabled.
- if (idl_global->ami_call_back () == I_TRUE)
+ if (be_global->ami_call_back () == I_TRUE)
{
// Include Messaging skeleton file.
*this->client_header_ << "#include ";
- if (idl_global->changing_standard_include_files () == 1)
- *this->client_header_ << "\"";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_header_ << "\"";
+ }
else
- *this->client_header_ << "<";
+ {
+ *this->client_header_ << "<";
+ }
*this->client_header_ << "tao/MessagingS.h";
- if (idl_global->changing_standard_include_files () == 1)
- *this->client_header_ << "\"\n";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_header_ << "\"\n";
+ }
else
- *this->client_header_ << ">\n";
+ {
+ *this->client_header_ << ">\n";
+ }
// Including Asynch Invocation file.
*this->client_header_ << "#include ";
- if (idl_global->changing_standard_include_files () == 1)
- *this->client_header_ << "\"";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_header_ << "\"";
+ }
else
- *this->client_header_ << "<";
+ {
+ *this->client_header_ << "<";
+ }
*this->client_header_ << "tao/Asynch_Invocation.h";
- if (idl_global->changing_standard_include_files () == 1)
- *this->client_header_ << "\"\n";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_header_ << "\"\n";
+ }
else
- *this->client_header_ << ">\n";
+ {
+ *this->client_header_ << ">\n";
+ }
}
// We must include all the skeleton headers corresponding to
@@ -254,7 +280,7 @@ TAO_CodeGen::start_client_header (const char *fname)
// Get the clnt header from the IDL file name.
const char* client_hdr =
- IDL_GlobalData::be_get_client_hdr (&idl_name_str, 1);
+ BE_GlobalData::be_get_client_hdr (&idl_name_str, 1);
// Sanity check and then print.
if (client_hdr != 0)
@@ -271,22 +297,22 @@ TAO_CodeGen::start_client_header (const char *fname)
}
*this->client_header_ << "\n";
- // generate the TAO_EXPORT_MACRO macro
+ // Generate the TAO_EXPORT_MACRO macro.
*this->client_header_ << "#if defined (TAO_EXPORT_MACRO)\n";
*this->client_header_ << "#undef TAO_EXPORT_MACRO\n";
*this->client_header_ << "#endif\n";
*this->client_header_ << "#define TAO_EXPORT_MACRO "
- << idl_global->stub_export_macro ()
+ << be_global->stub_export_macro ()
<< be_nl << be_nl;
- // Generate export macro for nested classes
+ // Generate export macro for nested classes.
*this->client_header_
<< "#if defined (TAO_EXPORT_NESTED_CLASSES)\n"
<< "# if defined (TAO_EXPORT_NESTED_MACRO)\n"
<< "# undef TAO_EXPORT_NESTED_MACRO\n"
<< "# endif /* defined (TAO_EXPORT_NESTED_MACRO) */\n"
<< "# define TAO_EXPORT_NESTED_MACRO "
- << idl_global->stub_export_macro ()
+ << be_global->stub_export_macro ()
<< be_nl
<< "#endif /* TAO_EXPORT_NESTED_CLASSES */\n\n";
@@ -295,30 +321,34 @@ TAO_CodeGen::start_client_header (const char *fname)
<< "#pragma warning(push)\n"
<< "#endif /* _MSC_VER >= 1200 */\n"
<< "#pragma warning(disable:4250)\n";
- if (idl_global->use_raw_throw ())
- *this->client_header_ << "#pragma warning(disable:4290)\n";
+ if (be_global->use_raw_throw ())
+ {
+ *this->client_header_ << "#pragma warning(disable:4290)\n";
+ }
+
*this->client_header_ << "#endif /* _MSC_VER */\n\n";
return 0;
}
}
-// get the client header stream
+// Get the client header stream.
TAO_OutStream *
TAO_CodeGen::client_header (void)
{
return this->client_header_;
}
-// set the client stub stream
+// Set the client stub stream.
int
TAO_CodeGen::start_client_stubs (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->client_stubs_ = factory->make_outstream ();
+
if (!this->client_stubs_)
{
return -1;
@@ -329,42 +359,48 @@ TAO_CodeGen::start_client_stubs (const char *fname)
return -1;
}
- // generate the include statement for the precompiled header file.
- if (idl_global->pch_include ())
- *this->client_stubs_ << "#include \""
- << idl_global->pch_include () << "\"\n\n";
+ // Generate the include statement for the precompiled header file.
+ if (be_global->pch_include ())
+ {
+ *this->client_stubs_ << "#include \""
+ << be_global->pch_include ()
+ << "\"\n\n";
+ }
- // generate the include statement for the client header. We just
+ // Generate the include statement for the client header. We just
// need to put only the base names. Path info is not required.
- *this->client_stubs_ << "#include \"" <<
- idl_global->be_get_client_hdr_fname (1) << "\"\n\n";
+ *this->client_stubs_ << "#include \""
+ << be_global->be_get_client_hdr_fname (1)
+ << "\"\n\n";
- // generate the code that includes the inline file if not included in the
- // header file
+ // Generate the code that includes the inline file if not included in the
+ // header file.
*this->client_stubs_ << "#if !defined (__ACE_INLINE__)\n";
- *this->client_stubs_ << "#include \"" <<
- idl_global->be_get_client_inline_fname (1) << "\"\n";
+ *this->client_stubs_ << "#include \""
+ << be_global->be_get_client_inline_fname (1)
+ << "\"\n";
*this->client_stubs_ << "#endif /* !defined INLINE */\n\n";
return 0;
}
-// get the client stubs stream
+// Get the client stubs stream.
TAO_OutStream *
TAO_CodeGen::client_stubs (void)
{
return this->client_stubs_;
}
-// set the client inline stream
+// Set the client inline stream.
int
TAO_CodeGen::start_client_inline (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->client_inline_ = factory->make_outstream ();
+
if (!this->client_inline_)
{
return -1;
@@ -373,14 +409,14 @@ TAO_CodeGen::start_client_inline (const char *fname)
return this->client_inline_->open (fname, TAO_OutStream::TAO_CLI_INL);
}
-// get the client inline stream
+// Get the client inline stream.
TAO_OutStream *
TAO_CodeGen::client_inline (void)
{
return this->client_inline_;
}
-// set the server header stream.
+// Set the server header stream.
int
TAO_CodeGen::start_server_header (const char *fname)
{
@@ -388,89 +424,122 @@ TAO_CodeGen::start_server_header (const char *fname)
// idl_global. We need to make sure the validity of those files.
idl_global->validate_included_idl_files ();
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->server_header_ = factory->make_outstream ();
+
if (!this->server_header_)
{
return -1;
}
if (this->server_header_->open (fname, TAO_OutStream::TAO_SVR_HDR) == -1)
- return -1;
+ {
+ return -1;
+ }
else
{
- // now generate the #if !defined clause
+ // Now generate the #if !defined clause.
static char macro_name [NAMEBUFSIZE];
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
const char *suffix = ACE_OS::strrchr (fname, '.');
+
if (suffix == 0)
{
// File seems to have no extension, so let us take the name
// as it is.
if (fname == 0)
- // bad file name
- return -1;
+ {
+ // Bad file name.
+ return -1;
+ }
else
- suffix = fname;
+ {
+ suffix = fname;
+ }
}
ACE_OS::sprintf (macro_name, "_TAO_IDL_");
- // convert letters in fname to upcase
+ // Convert letters in fname to upper case.
for (int i=0; i < (suffix - fname); i++)
- if (isalpha (fname [i]))
- macro_name[i+9] = (char) toupper (fname [i]);
- else if (isdigit (fname [i]))
- macro_name[i+9] = fname[i];
- else
- macro_name[i+9] = '_';
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i+9] = (char) toupper (fname [i]);
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i+9] = fname[i];
+ }
+ else
+ {
+ macro_name[i+9] = '_';
+ }
+ }
ACE_OS::strcat (macro_name, "_H_");
this->server_header_->print ("#ifndef %s\n", macro_name);
this->server_header_->print ("#define %s\n\n", macro_name);
- if (idl_global->pre_include () != 0)
+
+ if (be_global->pre_include () != 0)
{
*this->server_header_ << "#include \""
- << idl_global->pre_include ()
+ << be_global->pre_include ()
<< "\"\n";
}
// Include the Messaging files if AMI is enabled.
- if (idl_global->ami_call_back () == I_TRUE)
+ if (be_global->ami_call_back () == I_TRUE)
{
// Include Messaging skeleton file.
*this->server_header_ << "#include ";
- if (idl_global->changing_standard_include_files () == 1)
- *this->server_header_ << "\"";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->server_header_ << "\"";
+ }
else
- *this->server_header_ << "<";
+ {
+ *this->server_header_ << "<";
+ }
*this->server_header_ << "tao/MessagingS.h";
- if (idl_global->changing_standard_include_files () == 1)
- *this->server_header_ << "\"\n";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->server_header_ << "\"\n";
+ }
else
- *this->server_header_ << ">\n";
+ {
+ *this->server_header_ << ">\n";
+ }
// Including Asynch Invocation file.
*this->server_header_ << "#include ";
- if (idl_global->changing_standard_include_files () == 1)
- *this->server_header_ << "\"";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->server_header_ << "\"";
+ }
else
- *this->server_header_ << "<";
+ {
+ *this->server_header_ << "<";
+ }
*this->server_header_ << "tao/Asynch_Invocation.h";
- if (idl_global->changing_standard_include_files () == 1)
- *this->server_header_ << "\"\n";
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->server_header_ << "\"\n";
+ }
else
- *this->server_header_ << ">\n";
+ {
+ *this->server_header_ << ">\n";
+ }
}
// We must include all the skeleton headers corresponding to
@@ -481,22 +550,24 @@ TAO_CodeGen::start_server_header (const char *fname)
for (size_t j = 0;
j < idl_global->n_included_idl_files ();
++j)
- {
- char* idl_name =
- idl_global->included_idl_files ()[j];
+ {
+ char* idl_name =
+ idl_global->included_idl_files ()[j];
- // String'ifying the name.
- UTL_String idl_name_str (idl_name);
+ // String'ifying the name.
+ UTL_String idl_name_str (idl_name);
- const char* server_hdr =
- IDL_GlobalData::be_get_server_hdr (&idl_name_str, 1);
+ const char* server_hdr =
+ BE_GlobalData::be_get_server_hdr (&idl_name_str, 1);
- this->server_header_->print ("#include \"%s\"\n",
- server_hdr);
- }
- // the server header should include the client header
- *this->server_header_ << "#include \"" <<
- idl_global->be_get_client_hdr_fname (1) << "\"\n\n";
+ this->server_header_->print ("#include \"%s\"\n",
+ server_hdr);
+ }
+
+ // The server header should include the client header.
+ *this->server_header_ << "#include \""
+ << be_global->be_get_client_hdr_fname (1)
+ << "\"\n\n";
// Some compilers don't optimize the #ifndef header include
// protection, but do optimize based on #pragma once.
@@ -509,32 +580,35 @@ TAO_CodeGen::start_server_header (const char *fname)
<< "#pragma warning(push)\n"
<< "#endif /* _MSC_VER >= 1200 */\n"
<< "#pragma warning(disable:4250)\n";
- if (idl_global->use_raw_throw ())
- *this->server_header_ << "#pragma warning(disable:4290)\n";
+ if (be_global->use_raw_throw ())
+ {
+ *this->server_header_ << "#pragma warning(disable:4290)\n";
+ }
+
*this->server_header_ << "#endif /* _MSC_VER */\n\n";
- if (idl_global->skel_export_include () != 0)
+ if (be_global->skel_export_include () != 0)
{
*this->server_header_ << "#include \""
- << idl_global->skel_export_include ()
+ << be_global->skel_export_include ()
<< "\"\n";
- // generate the TAO_EXPORT_MACRO macro
+ // Generate the TAO_EXPORT_MACRO macro.
*this->server_header_ << "#if defined (TAO_EXPORT_MACRO)\n";
*this->server_header_ << "#undef TAO_EXPORT_MACRO\n";
*this->server_header_ << "#endif\n";
*this->server_header_ << "#define TAO_EXPORT_MACRO "
- << idl_global->skel_export_macro ()
+ << be_global->skel_export_macro ()
<< be_nl;
- // Generate export macro for nested classes
+ // Generate export macro for nested classes.
*this->server_header_
<< "#if defined (TAO_EXPORT_NESTED_CLASSES)\n"
<< "# if defined (TAO_EXPORT_NESTED_MACRO)\n"
<< "# undef TAO_EXPORT_NESTED_MACRO\n"
<< "# endif /* defined (TAO_EXPORT_NESTED_MACRO) */\n"
<< "# define TAO_EXPORT_NESTED_MACRO "
- << idl_global->skel_export_macro ()
+ << be_global->skel_export_macro ()
<< be_nl
<< "#endif /* TAO_EXPORT_NESTED_CLASSES */\n";
}
@@ -543,64 +617,84 @@ TAO_CodeGen::start_server_header (const char *fname)
}
}
-// get the server header stream
+// Get the server header stream.
TAO_OutStream *
TAO_CodeGen::server_header (void)
{
return this->server_header_;
}
-// set the server header stream
+// Set the server header stream.
int
TAO_CodeGen::start_server_template_header (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->server_template_header_ = factory->make_outstream ();
+
if (!this->server_template_header_)
- return -1;
+ {
+ return -1;
+ }
if (this->server_template_header_->open (fname,
TAO_OutStream::TAO_SVR_TMPL_HDR)
- == -1)
- return -1;
+ == -1)
+ {
+ return -1;
+ }
else
{
- // now generate the #if !defined clause
+ // Now generate the #if !defined clause.
static char macro_name [NAMEBUFSIZE];
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
const char *suffix = ACE_OS::strrchr (fname, '.');
+
if (suffix == 0)
{
// File seems to have no extension, so let us take the name
// as it is.
if (fname == 0)
- // bad file name
- return -1;
+ {
+ // Bad file name.
+ return -1;
+ }
else
- suffix = fname;
+ {
+ suffix = fname;
+ }
}
ACE_OS::sprintf (macro_name, "_TAO_IDL_");
- // convert letters in fname to upcase
+
+ // Convert letters in fname to upper case.
for (int i=0; i < (suffix - fname); i++)
- if (isalpha (fname [i]))
+ {
+ if (isalpha (fname [i]))
+ {
macro_name[i+9] = (char) toupper (fname [i]);
- else if (isdigit (fname [i]))
- macro_name[i+9] = fname[i];
- else
- macro_name[i+9] = '_';
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i+9] = fname[i];
+ }
+ else
+ {
+ macro_name[i+9] = '_';
+ }
+ }
ACE_OS::strcat (macro_name, "_H_");
this->server_template_header_->print ("#ifndef %s\n", macro_name);
this->server_template_header_->print ("#define %s\n\n", macro_name);
- if (idl_global->pre_include () != 0)
+
+ if (be_global->pre_include () != 0)
{
*this->server_template_header_ << "#include \""
- << idl_global->pre_include ()
+ << be_global->pre_include ()
<< "\"\n";
}
@@ -609,30 +703,35 @@ TAO_CodeGen::start_server_template_header (const char *fname)
<< "#pragma warning(push)\n"
<< "#endif /* _MSC_VER >= 1200 */\n"
<< "#pragma warning(disable:4250)\n";
- if (idl_global->use_raw_throw ())
- *this->server_template_header_ << "#pragma warning(disable:4290)\n";
+
+ if (be_global->use_raw_throw ())
+ {
+ *this->server_template_header_ << "#pragma warning(disable:4290)\n";
+ }
+
*this->server_template_header_ << "#endif /* _MSC_VER */\n\n";
return 0;
}
}
-// get the server header stream
+// Get the server header stream.
TAO_OutStream *
TAO_CodeGen::server_template_header (void)
{
return this->server_template_header_;
}
-// set the server skeletons stream
+// Set the server skeletons stream.
int
TAO_CodeGen::start_server_skeletons (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->server_skeletons_ = factory->make_outstream ();
+
if (!this->server_skeletons_)
{
return -1;
@@ -643,20 +742,25 @@ TAO_CodeGen::start_server_skeletons (const char *fname)
return -1;
}
- // generate the include statement for the precompiled header file.
- if (idl_global->pch_include ())
- *this->server_skeletons_ << "#include \""
- << idl_global->pch_include () << "\"\n\n";
+ // Generate the include statement for the precompiled header file.
+ if (be_global->pch_include ())
+ {
+ *this->server_skeletons_ << "#include \""
+ << be_global->pch_include ()
+ << "\"\n\n";
+ }
- // generate the include statement for the server header
- *this->server_skeletons_ << "#include \"" <<
- idl_global->be_get_server_hdr_fname (1) << "\"\n\n";
+ // Generate the include statement for the server header.
+ *this->server_skeletons_ << "#include \""
+ << be_global->be_get_server_hdr_fname (1)
+ << "\"\n\n";
- // generate the code that includes the inline file if not included in the
- // header file
+ // Generate the code that includes the inline file if not included in the
+ // header file.
*this->server_skeletons_ << "#if !defined (__ACE_INLINE__)\n";
- *this->server_skeletons_ << "#include \"" <<
- idl_global->be_get_server_inline_fname (1) << "\"\n";
+ *this->server_skeletons_ << "#include \""
+ << be_global->be_get_server_inline_fname (1)
+ << "\"\n";
*this->server_skeletons_ << "#endif /* !defined INLINE */\n\n";
return 0;
@@ -673,11 +777,12 @@ TAO_CodeGen::server_skeletons (void)
int
TAO_CodeGen::start_server_template_skeletons (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->server_template_skeletons_ = factory->make_outstream ();
+
if (!this->server_template_skeletons_)
{
return -1;
@@ -685,72 +790,93 @@ TAO_CodeGen::start_server_template_skeletons (const char *fname)
if (this->server_template_skeletons_->open (fname,
TAO_OutStream::TAO_SVR_TMPL_IMPL)
- == -1)
- return -1;
+ == -1)
+ {
+ return -1;
+ }
else
{
- // now generate the #if !defined clause
+ // Now generate the #if !defined clause.
static char macro_name [NAMEBUFSIZE];
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
const char *suffix = ACE_OS::strrchr (fname, '.');
+
if (suffix == 0)
{
// File seems to have no extension, so let us take the name
// as it is.
if (fname == 0)
- // bad file name
- return -1;
+ {
+ // Bad file name.
+ return -1;
+ }
else
- suffix = fname;
+ {
+ suffix = fname;
+ }
}
ACE_OS::sprintf (macro_name, "_TAO_IDL_");
- // convert letters in fname to upcase
+
+ // Convert letters in fname to upper case.
for (int i=0; i < (suffix - fname); i++)
- if (isalpha (fname [i]))
- macro_name[i+9] = (char) toupper (fname [i]);
- else if (isdigit (fname [i]))
- macro_name[i+9] = fname[i];
- else
- macro_name[i+9] = '_';
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i+9] = (char) toupper (fname [i]);
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i+9] = fname[i];
+ }
+ else
+ {
+ macro_name[i+9] = '_';
+ }
+ }
ACE_OS::strcat (macro_name, "_CPP_");
this->server_template_skeletons_->print ("#ifndef %s\n", macro_name);
this->server_template_skeletons_->print ("#define %s\n\n", macro_name);
- // generate the include statement for the server header
- *this->server_template_skeletons_ << "#include \"" <<
- idl_global->be_get_server_template_hdr_fname (1) << "\"\n\n";
+ // Generate the include statement for the server header.
+ *this->server_template_skeletons_
+ << "#include \""
+ << be_global->be_get_server_template_hdr_fname (1)
+ << "\"\n\n";
- // generate the code that includes the inline file if not included in the
- // header file
+ // Generate the code that includes the inline file if not included in the
+ // header file.
*this->server_template_skeletons_ << "#if !defined (__ACE_INLINE__)\n";
- *this->server_template_skeletons_ << "#include \"" <<
- idl_global->be_get_server_template_inline_fname (1) << "\"\n";
+ *this->server_template_skeletons_
+ << "#include \""
+ << be_global->be_get_server_template_inline_fname (1)
+ << "\"\n";
*this->server_template_skeletons_ << "#endif /* !defined INLINE */\n\n";
return 0;
}
}
-// get the server template skeletons stream
+// Get the server template skeletons stream.
TAO_OutStream *
TAO_CodeGen::server_template_skeletons (void)
{
return this->server_template_skeletons_;
}
-// set the server inline stream
+// Set the server inline stream.
int
TAO_CodeGen::start_server_inline (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->server_inline_ = factory->make_outstream ();
+
if (!this->server_inline_)
{
return -1;
@@ -759,22 +885,23 @@ TAO_CodeGen::start_server_inline (const char *fname)
return this->server_inline_->open (fname, TAO_OutStream::TAO_SVR_INL);
}
-// get the server inline stream
+// Get the server inline stream.
TAO_OutStream *
TAO_CodeGen::server_inline (void)
{
return this->server_inline_;
}
-// set the server template inline stream
+// Set the server template inline stream.
int
TAO_CodeGen::start_server_template_inline (const char *fname)
{
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->server_template_inline_ = factory->make_outstream ();
+
if (!this->server_template_inline_)
{
return -1;
@@ -783,7 +910,7 @@ TAO_CodeGen::start_server_template_inline (const char *fname)
return this->server_template_inline_->open (fname, TAO_OutStream::TAO_SVR_INL);
}
-// get the server template inline stream
+// Get the server template inline stream.
TAO_OutStream *
TAO_CodeGen::server_template_inline (void)
{
@@ -791,7 +918,7 @@ TAO_CodeGen::server_template_inline (void)
}
-// set the server header stream.
+// Set the server header stream.
int
TAO_CodeGen::start_implementation_header (const char *fname)
{
@@ -801,80 +928,71 @@ TAO_CodeGen::start_implementation_header (const char *fname)
idl_global->validate_included_idl_files ();
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->implementation_header_ = factory->make_outstream ();
+
if (!this->implementation_header_)
{
return -1;
}
- if (this->implementation_header_->open (fname, TAO_OutStream::TAO_IMPL_HDR) == -1)
- return -1;
+ if (this->implementation_header_->open (fname,
+ TAO_OutStream::TAO_IMPL_HDR)
+ == -1)
+ {
+ return -1;
+ }
else
{
- // now generate the #ifndef clause
+ // Now generate the #ifndef clause.
static char macro_name [NAMEBUFSIZE];
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
const char *suffix = ACE_OS::strrchr (fname, '.');
+
if (suffix == 0)
{
// File seems to have no extension, so let us take the name
// as it is.
if (fname == 0)
- // bad file name
- return -1;
+ {
+ // Bad file name.
+ return -1;
+ }
else
- suffix = fname;
+ {
+ suffix = fname;
+ }
}
for (int i=0; i < (suffix - fname); i++)
- if (isalpha (fname [i]))
- macro_name[i] = (char) toupper (fname [i]);
- else if (isdigit (fname [i]))
- macro_name[i] = fname[i];
- else
- macro_name[i] = '_';
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i] = (char) toupper (fname [i]);
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i] = fname[i];
+ }
+ else
+ {
+ macro_name[i] = '_';
+ }
+ }
ACE_OS::strcat (macro_name, "_H_");
this->implementation_header_->print ("#ifndef %s\n", macro_name);
this->implementation_header_->print ("#define %s\n\n", macro_name);
- // @@ (JP) I think the code below can be safely left out. It has
- // been modified but not checked, so I'll leave it here for a
- // while to make sure it's really safe to leave out. 2000/01/22
-#if 0
- // We must include all the client headers corresponding to
- // IDL files included by the current IDL file.
- // We will use the included IDL file names as they appeared
- // in the original main IDL file, not the ones which went
- // thru CC preprocessor.
- for (size_t j = 0;
- j < idl_global->n_included_idl_files ();
- ++j)
- {
- char* idl_name =
- idl_global->included_idl_files ()[j];
-
- // Stringifying the name.
- UTL_String idl_name_str (idl_name);
-
- const char* implementation_hdr =
- IDL_GlobalData::be_get_client_hdr (&idl_name_str, 1);
-
- this->implementation_header_->print ("#include \"%s\"\n",
- implementation_hdr);
- }
-#endif
-
const char* server_hdr =
- IDL_GlobalData::be_get_server_hdr_fname (1);
+ BE_GlobalData::be_get_server_hdr_fname (1);
- *this->implementation_header_<< "#include \""<<server_hdr<<"\"\n\n";
+ *this->implementation_header_<< "#include \"" << server_hdr <<"\"\n\n";
*this->implementation_header_
<< "#if !defined (ACE_LACKS_PRAGMA_ONCE)\n"
@@ -886,7 +1004,7 @@ TAO_CodeGen::start_implementation_header (const char *fname)
}
-// get the implementation header stream
+// Get the implementation header stream.
TAO_OutStream *
TAO_CodeGen::implementation_header (void)
{
@@ -894,7 +1012,7 @@ TAO_CodeGen::implementation_header (void)
}
-// set the implementation skeleton stream.
+// Set the implementation skeleton stream.
int
TAO_CodeGen::start_implementation_skeleton (const char *fname)
{
@@ -902,23 +1020,25 @@ TAO_CodeGen::start_implementation_skeleton (const char *fname)
// idl_global. We need to make sure the validity of those files.
idl_global->validate_included_idl_files ();
- // retrieve the singleton instance to the outstream factory
+ // Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // retrieve a specialized instance
+ // Retrieve a specialized instance.
this->implementation_skeleton_ = factory->make_outstream ();
+
if (!this->implementation_skeleton_)
{
return -1;
}
- if (this->implementation_skeleton_->open (fname, TAO_OutStream::TAO_IMPL_SKEL) == -1)
- return -1;
+ if (this->implementation_skeleton_->open (fname,
+ TAO_OutStream::TAO_IMPL_SKEL)
+ == -1)
+ {
+ return -1;
+ }
else
{
-
-
-
static char macro_name [NAMEBUFSIZE];
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
@@ -930,22 +1050,31 @@ TAO_CodeGen::start_implementation_skeleton (const char *fname)
// File seems to have no extension, so let us take the name
// as it is.
if (fname == 0)
- // bad file name
- return -1;
+ {
+ // Bad file name.
+ return -1;
+ }
else
- suffix = fname;
+ {
+ suffix = fname;
+ }
}
- // convert letters in fname to upcase
+ // Convert letters in fname to upper case.
for (int i=0; i < (suffix - fname); i++)
- if (isalpha (fname [i]))
- macro_name[i] = fname [i];
- else
- macro_name[i] = fname[i];
-
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i] = fname [i];
+ }
+ else
+ {
+ macro_name[i] = fname[i];
+ }
+ }
const char* impl_hdr =
- IDL_GlobalData::be_get_implementation_hdr_fname ();
+ BE_GlobalData::be_get_implementation_hdr_fname ();
this->implementation_skeleton_->print ("#include \"%s\"\n\n", impl_hdr);
@@ -954,37 +1083,40 @@ TAO_CodeGen::start_implementation_skeleton (const char *fname)
}
-// get the implementation header stream
+// Get the implementation header stream.
TAO_OutStream *
TAO_CodeGen::implementation_skeleton (void)
{
return this->implementation_skeleton_;
}
-// put the last #endif in the client and server headers
+// Put the last #endif in the client and server headers.
int
TAO_CodeGen::end_client_header (void)
{
- // generate the <<= and >>= operators here
+ // Generate the <<= and >>= operators here.
- // insert the code to include the inline file
+ // Insert the code to include the inline file.
*this->client_header_ << "\n#if defined (__ACE_INLINE__)\n";
- *this->client_header_ << "#include \"" <<
- idl_global->be_get_client_inline_fname (1) << "\"\n";
+ *this->client_header_ << "#include \""
+ << be_global->be_get_client_inline_fname (1)
+ << "\"\n";
*this->client_header_ << "#endif /* defined INLINE */\n\n";
*this->client_header_ << "#if defined(_MSC_VER) && (_MSC_VER >= 1200)\n"
<< "#pragma warning(pop)\n"
<< "#endif /* _MSC_VER */\n";
- // code to put the last #endif
+ // Code to put the last #endif.
*this->client_header_ << "\n";
- if (idl_global->post_include () != 0)
+
+ if (be_global->post_include () != 0)
{
*this->client_header_ << "#include \""
- << idl_global->post_include ()
+ << be_global->post_include ()
<< "\"\n";
}
+
*this->client_header_ << "#endif /* ifndef */\n";
return 0;
}
@@ -992,32 +1124,35 @@ TAO_CodeGen::end_client_header (void)
int
TAO_CodeGen::end_server_header (void)
{
- // insert the template header
- if (idl_global->gen_tie_classes ())
+ // Insert the template header.
+ if (be_global->gen_tie_classes ())
{
*this->server_header_ << "#include \""
- << idl_global->be_get_server_template_hdr_fname (1)
+ << be_global->be_get_server_template_hdr_fname (1)
<< "\"\n";
}
- // insert the code to include the inline file
+ // Insert the code to include the inline file.
*this->server_header_ << "\n#if defined (__ACE_INLINE__)\n";
- *this->server_header_ << "#include \"" <<
- idl_global->be_get_server_inline_fname (1) << "\"\n";
+ *this->server_header_ << "#include \""
+ << be_global->be_get_server_inline_fname (1)
+ << "\"\n";
*this->server_header_ << "#endif /* defined INLINE */\n\n";
*this->server_header_ << "#if defined(_MSC_VER) && (_MSC_VER >= 1200)\n"
<< "#pragma warning(pop)\n"
<< "#endif /* _MSC_VER */\n";
- // code to put the last #endif
+ // Code to put the last #endif.
*this->server_header_ << "\n";
- if (idl_global->post_include () != 0)
+
+ if (be_global->post_include () != 0)
{
*this->server_header_ << "#include \""
- << idl_global->post_include ()
+ << be_global->post_include ()
<< "\"\n";
}
+
*this->server_header_ << "#endif /* ifndef */\n";
return 0;
}
@@ -1029,32 +1164,42 @@ TAO_CodeGen::end_implementation_header (const char *fname)
ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
const char *suffix = ACE_OS::strrchr (fname, '.');
+
if (suffix == 0)
{
// File seems to have no extension, so let us take the name
// as it is.
if (fname == 0)
- // bad file name
- return -1;
+ {
+ // Bad file name.
+ return -1;
+ }
else
- suffix = fname;
+ {
+ suffix = fname;
+ }
}
-
- // convert letters in fname to upcase
+ // Convert letters in fname to upper case.
for (int i=0; i < (suffix - fname); i++)
- if (isalpha (fname [i]))
- macro_name[i] = (char) toupper (fname [i]);
- else if (isdigit (fname [i]))
- macro_name[i] = fname[i];
- else
- macro_name[i] = '_';
+ {
+ if (isalpha (fname [i]))
+ {
+ macro_name[i] = (char) toupper (fname [i]);
+ }
+ else if (isdigit (fname [i]))
+ {
+ macro_name[i] = fname[i];
+ }
+ else
+ {
+ macro_name[i] = '_';
+ }
+ }
ACE_OS::strcat (macro_name, "_H_");
-
- // code to put the last #endif
- //*this->implementation_header_ << "\n#endif /* %s */\n";
+ // Code to put the last #endif.
this->implementation_header_->print ("\n#endif /* %s */\n", macro_name);
return 0;
}
@@ -1062,38 +1207,46 @@ TAO_CodeGen::end_implementation_header (const char *fname)
int
TAO_CodeGen::end_server_template_header (void)
{
- // insert the code to include the inline file
+ // Insert the code to include the inline file.
*this->server_template_header_ << "\n#if defined (__ACE_INLINE__)\n";
- *this->server_template_header_ << "#include \"" <<
- idl_global->be_get_server_template_inline_fname (1) << "\"\n";
+ *this->server_template_header_
+ << "#include \""
+ << be_global->be_get_server_template_inline_fname (1)
+ << "\"\n";
*this->server_template_header_ << "#endif /* defined INLINE */\n\n";
- // insert the code to include the template source file
+ // Insert the code to include the template source file.
*this->server_template_header_
- << "\n#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)\n";
- *this->server_template_header_ << "#include \"" <<
- idl_global->be_get_server_template_skeleton_fname (1) << "\"\n";
+ << "\n#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)\n";
+ *this->server_template_header_
+ << "#include \""
+ << be_global->be_get_server_template_skeleton_fname (1)
+ << "\"\n";
*this->server_template_header_ << "#endif /* defined REQUIRED SOURCE */\n\n";
- // insert the code to include the template pragma
+ // Insert the code to include the template pragma.
*this->server_template_header_
- << "\n#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)\n";
- *this->server_template_header_ << "#pragma implementation (\"" <<
- idl_global->be_get_server_template_skeleton_fname (1) << "\")\n";
+ << "\n#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)\n";
+ *this->server_template_header_
+ << "#pragma implementation (\""
+ << be_global->be_get_server_template_skeleton_fname (1)
+ << "\")\n";
*this->server_template_header_ << "#endif /* defined REQUIRED PRAGMA */\n\n";
*this->server_template_header_ << "#if defined(_MSC_VER) && (_MSC_VER >= 1200)\n"
<< "#pragma warning(pop)\n"
<< "#endif /* _MSC_VER */\n";
- // code to put the last #endif
+ // Code to put the last #endif.
*this->server_template_header_ << "\n";
- if (idl_global->post_include () != 0)
+
+ if (be_global->post_include () != 0)
{
*this->server_template_header_ << "#include \""
- << idl_global->post_include ()
+ << be_global->post_include ()
<< "\"\n";
}
+
*this->server_template_header_ << "#endif /* ifndef */\n";
return 0;
}
@@ -1101,7 +1254,7 @@ TAO_CodeGen::end_server_template_header (void)
int
TAO_CodeGen::end_server_template_skeletons (void)
{
- // code to put the last #endif
+ // Code to put the last #endif.
*this->server_template_skeletons_ << "\n#endif /* ifndef */\n";
return 0;
}
@@ -1130,7 +1283,7 @@ TAO_CodeGen::gperf_input_stream (void)
void
TAO_CodeGen::gperf_input_filename (char *filename)
{
- delete[] this->gperf_input_filename_;
+ delete [] this->gperf_input_filename_;
this->gperf_input_filename_ = ACE::strnew (filename);
}
@@ -1172,18 +1325,6 @@ TAO_CodeGen::config_visitor_factory (void)
this->visitor_factory_ = TAO_COMPILED_VISITOR_FACTORY::instance ();
}
-void
-TAO_CodeGen::lookup_strategy (LOOKUP_STRATEGY s)
-{
- this->strategy_ = s;
-}
-
-TAO_CodeGen::LOOKUP_STRATEGY
-TAO_CodeGen::lookup_strategy (void) const
-{
- return this->strategy_;
-}
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp
index 84325a1bcb4..1e0efe50552 100644
--- a/TAO/TAO_IDL/be/be_constant.cpp
+++ b/TAO/TAO_IDL/be/be_constant.cpp
@@ -25,20 +25,22 @@
ACE_RCSID(be, be_constant, "$Id$")
-/*
- * BE_Constant
- */
be_constant::be_constant (void)
{
this->size_type (be_decl::FIXED);
}
be_constant::be_constant (AST_Expression::ExprType et,
- AST_Expression *v,
+ AST_Expression *v,
UTL_ScopedName *n,
UTL_StrList *p)
- : AST_Constant (et, v, n, p),
- AST_Decl (AST_Decl::NT_const, n, p)
+ : 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 4e90c3acbe8..28383927530 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -53,7 +53,9 @@ be_decl::be_decl (void)
be_decl::be_decl (AST_Decl::NodeType type,
UTL_ScopedName *n,
UTL_StrList *pragmas)
- : AST_Decl (type, n, pragmas),
+ : AST_Decl (type,
+ n,
+ pragmas),
cli_hdr_gen_ (I_FALSE),
cli_stub_gen_ (I_FALSE),
cli_inline_gen_ (I_FALSE),
@@ -75,56 +77,43 @@ be_decl::be_decl (AST_Decl::NodeType type,
{
}
-//destructor
+// Destructor
be_decl::~be_decl (void)
{
- if (this->full_name_ != 0)
- {
- delete[] this->full_name_;
- this->full_name_ = 0;
- }
- if (this->flat_name_ != 0)
- {
- delete[] this->flat_name_;
- this->flat_name_ = 0;
- }
- if (this->repoID_ != 0)
- {
- delete[] this->repoID_;
- this->repoID_ = 0;
- }
- if (this->prefix_ != 0)
- {
- delete[] this->prefix_;
- this->prefix_ = 0;
- }
}
-// return our size type
+// Return our size type.
be_decl::SIZE_TYPE
be_decl::size_type (void)
{
if (this->size_type_ == be_decl::SIZE_UNKNOWN)
- (void) this->compute_size_type ();
+ {
+ (void) this->compute_size_type ();
+ }
+
return this->size_type_;
}
-// set our size type and that of all our ancestors
+// Set our size type and that of all our ancestors.
void
be_decl::size_type (be_decl::SIZE_TYPE st)
{
- // precondition - you cannot set somebody's sizetype to unknown
+ // p\Precondition - you cannot set somebody's sizetype to unknown.
ACE_ASSERT (st != be_decl::SIZE_UNKNOWN);
- // st can be VARIABLE or FIXED
+ // Size type 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; // 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;
+ }
}
const char*
@@ -136,74 +125,106 @@ be_decl::full_name (void)
return this->full_name_;
}
-// compute stringified fully scoped name
+// Compute stringified fully scoped name
void
be_decl::compute_full_name (void)
{
- if (full_name_)
- return;
+ if (this->full_name_ != 0)
+ {
+ return;
+ }
else
{
- long namelen;
- UTL_IdListActiveIterator *i;
+ long namelen = 0;
+ UTL_IdListActiveIterator *i = 0;
long first = I_TRUE;
long second = I_FALSE;
- // in the first loop compute the total length
- namelen = 0;
- i = new UTL_IdListActiveIterator (this->name ());
+ // In the first loop, compute the total length.
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
while (!(i->is_done ()))
{
if (!first)
- namelen += 2; // for "::"
+ {
+ namelen += 2; // for "::"
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
namelen += ACE_OS::strlen (i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
- this->full_name_ = new char [namelen+1];
+ ACE_NEW (this->full_name_,
+ char[namelen + 1]);
this->full_name_[0] = '\0';
first = I_TRUE;
second = I_FALSE;
- i = new UTL_IdListActiveIterator (this->name ());
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
while (!(i->is_done ()))
{
if (!first)
- ACE_OS::strcat (this->full_name_, "::");
+ {
+ ACE_OS::strcat (this->full_name_, "::");
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
ACE_OS::strcat (this->full_name_, i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
}
+
return;
}
void
be_decl::compute_full_name (const char *prefix,
- const char *suffix,
- char *&name)
+ const char *suffix,
+ char *&name)
{
if (prefix == 0 || suffix == 0)
return;
@@ -264,74 +285,107 @@ const char*
be_decl::flat_name (void)
{
if (!this->flat_name_)
- this->compute_flat_name ();
+ {
+ this->compute_flat_name ();
+ }
return this->flat_name_;
}
-// compute stringified flattened fully scoped name
+// Compute stringified flattened fully scoped name.
void
be_decl::compute_flat_name (void)
{
- if (flat_name_)
- return;
+ if (this->flat_name_ != 0)
+ {
+ return;
+ }
else
{
- long namelen;
- UTL_IdListActiveIterator *i;
+ long namelen = 0;
+ UTL_IdListActiveIterator *i = 0;
long first = I_TRUE;
long second = I_FALSE;
- // in the first loop compute the total length
- namelen = 0;
- i = new UTL_IdListActiveIterator (this->name ());
+ // In the first loop, compute the total length.
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
while (!(i->is_done ()))
{
if (!first)
- namelen += 1; // for "_"
+ {
+ namelen += 1; // for "_"
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
namelen += ACE_OS::strlen (i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
- this->flat_name_ = new char [namelen+1];
+ ACE_NEW (this->flat_name_,
+ char[namelen + 1]);
+
this->flat_name_[0] = '\0';
first = I_TRUE;
second = I_FALSE;
- i = new UTL_IdListActiveIterator (this->name ());
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
while (!(i->is_done ()))
{
if (!first)
- ACE_OS::strcat (this->flat_name_, "_");
+ {
+ ACE_OS::strcat (this->flat_name_, "_");
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
ACE_OS::strcat (this->flat_name_, i->item ()->get_string ());
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
}
+
return;
}
@@ -339,11 +393,13 @@ be_decl::compute_flat_name (void)
void
be_decl::compute_flat_name (const char *prefix,
- const char *suffix,
- char *&name)
+ const char *suffix,
+ char *&name)
{
if (prefix == 0 || suffix == 0)
- return;
+ {
+ return;
+ }
ACE_CString prefix_str (prefix);
ACE_CString suffix_str (suffix);
@@ -399,8 +455,10 @@ be_decl::compute_flat_name (const char *prefix,
const char *
be_decl::repoID (void)
{
- if (!this->repoID_)
- this->compute_repoID ();
+ if (this->repoID_ == 0)
+ {
+ this->compute_repoID ();
+ }
return this->repoID_;
}
@@ -410,72 +468,107 @@ be_decl::repoID (void)
void
be_decl::compute_repoID (void)
{
- if (repoID_)
- return;
+ if (this->repoID_ != 0)
+ {
+ return;
+ }
else
{
- long namelen;
- UTL_IdListActiveIterator *i;
+ long namelen = 8; // for the prefix "IDL:" and suffix ":1.0"
+ UTL_IdListActiveIterator *i = 0;
long first = I_TRUE;
long second = I_FALSE;
// in the first loop compute the total length
- namelen = 8; // for the prefix "IDL:" and suffix ":1.0"
namelen += ACE_OS::strlen (this->prefix ()) + 1;
- i = new UTL_IdListActiveIterator (this->name ());
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
while (!(i->is_done ()))
{
if (!first)
- namelen += 1; // for "/"
+ {
+ namelen += 1; // for "/"
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
namelen += ACE_OS::strlen (i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
- this->repoID_ = new char [namelen+1];
+ ACE_NEW (this->repoID_,
+ char[namelen + 1]);
this->repoID_[0] = '\0';
ACE_OS::sprintf (this->repoID_, "%s", "IDL:");
ACE_OS::strcat (this->repoID_, this->prefix ());
- // Add the "/" only if there is a prefix
+ // Add the "/" only if there is a prefix.
if (ACE_OS::strcmp (this->prefix (), "") != 0)
- ACE_OS::strcat (this->repoID_, "/");
+ {
+ ACE_OS::strcat (this->repoID_, "/");
+ }
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
- i = new UTL_IdListActiveIterator (this->name ());
first = I_TRUE;
second = I_FALSE;
+
while (!(i->is_done ()))
{
if (!first)
- ACE_OS::strcat (this->repoID_, "/");
+ {
+ ACE_OS::strcat (this->repoID_, "/");
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
ACE_OS::strcat (this->repoID_, i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
ACE_OS::strcat (this->repoID_, ":1.0");
}
+
return;
}
@@ -488,45 +581,61 @@ be_decl::compute_repoID (const char *prefix,
{
// Prefix and suffix should be valid.
if (prefix == 0 || suffix == 0)
- return;
+ {
+ return;
+ }
// First prepare the result without IDL: and :1.0 strings.
// repoID without IDL: and :1.0 strings.
char *result = 0;
- long namelen;
- UTL_IdListActiveIterator *i;
+ long namelen = 8; // for the prefix "IDL:" and suffix ":1.0"
+ UTL_IdListActiveIterator *i = 0;
long first = I_TRUE;
long second = I_FALSE;
// In the first loop compute the total length.
- namelen = 8; // for the prefix "IDL:" and suffix ":1.0"
namelen += ACE_OS::strlen (this->prefix ()) + 1;
- i = new UTL_IdListActiveIterator (this->name ());
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
while (!(i->is_done ()))
{
if (!first)
- namelen += 1; // for "/"
+ {
+ namelen += 1; // for "/"
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
namelen += ACE_OS::strlen (i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
// Get the result.
-
- result = new char [namelen+1];
+ ACE_NEW (result,
+ char[namelen + 1]);
result[0] = '\0';
// Start the result with prefix.
@@ -534,29 +643,46 @@ be_decl::compute_repoID (const char *prefix,
// Add the "/" only if there is a prefix
if (ACE_OS::strcmp (this->prefix (), "") != 0)
- ACE_OS::strcat (result, "/");
+ {
+ ACE_OS::strcat (result, "/");
+ }
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
- i = new UTL_IdListActiveIterator (this->name ());
first = I_TRUE;
second = I_FALSE;
+
while (!(i->is_done ()))
{
if (!first)
- ACE_OS::strcat (result, "/");
+ {
+ ACE_OS::strcat (result, "/");
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier
ACE_OS::strcat (result, i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a ""
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
// Add prefix and suffix.
@@ -624,7 +750,7 @@ be_decl::compute_repoID (const char *prefix,
void
-be_decl::compute_prefix ()
+be_decl::compute_prefix (void)
{
const char* pragma = 0;
if (this->pragmas () != 0)
@@ -650,13 +776,16 @@ be_decl::compute_prefix ()
if (end == 0)
{
- idl_global->err ()->syntax_error
- (IDL_GlobalData::PS_PragmaPrefixSyntax);
+ idl_global->err ()->syntax_error (
+ IDL_GlobalData::PS_PragmaPrefixSyntax
+ );
this->prefix_ = ACE::strnew ("");
return;
}
+
int l = end - tmp;
- this->prefix_ = new char[l+1];
+ ACE_NEW (this->prefix_,
+ char[l + 1]);
ACE_OS::strncpy (this->prefix_, tmp, end - tmp);
this->prefix_[l] = 0;
return;
@@ -665,23 +794,61 @@ be_decl::compute_prefix ()
// Could not find it in the local scope, try to recurse to the top
// scope...
if (this->defined_in () == 0)
- this->prefix_ = ACE::strnew ("");
+ {
+ this->prefix_ = ACE::strnew ("");
+ }
else
{
be_scope* scope =
be_scope::narrow_from_scope (this->defined_in ());
+
if (scope == 0)
- this->prefix_ = ACE::strnew ("");
+ {
+ this->prefix_ = ACE::strnew ("");
+ }
else
- this->prefix_ = ACE::strnew (scope->decl()->prefix ());
+ {
+ this->prefix_ = ACE::strnew (scope->decl()->prefix ());
+ }
+ }
+}
+
+void
+be_decl::destroy (void)
+{
+ if (this->full_name_ != 0)
+ {
+ delete this->full_name_;
+ this->full_name_ = 0;
+ }
+
+ if (this->flat_name_ != 0)
+ {
+ delete this->flat_name_;
+ this->flat_name_ = 0;
+ }
+
+ if (this->repoID_ != 0)
+ {
+ ACE_OS::free (this->repoID_);
+ this->repoID_ = 0;
+ }
+
+ if (this->prefix_ != 0)
+ {
+ delete this->prefix_;
+ this->prefix_ = 0;
}
}
const char*
be_decl::prefix (void)
{
- if (!this->prefix_)
- compute_prefix ();
+ if (this->prefix_ == 0)
+ {
+ this->compute_prefix ();
+ }
+
return this->prefix_;
}
@@ -691,62 +858,64 @@ be_decl::is_nested (void)
be_decl *d;
d = be_scope::narrow_from_scope (this->defined_in ())->decl ();
- // if we have an outermost scope and if that scope is not that of the Root,
- // then we are defined at some nesting level
- if (d && d->node_type () != AST_Decl::NT_root)
- return I_TRUE;
+
+ // If we have an outermost scope and if that scope is not that of the Root,
+ // then we are defined at some nesting level.
+ if (d != 0 && d->node_type () != AST_Decl::NT_root)
+ {
+ return I_TRUE;
+ }
return I_FALSE;
}
-// compute the size type of the node in question
+// Compute the size type of the node in question
int
be_decl::compute_size_type (void)
{
return 0;
}
-// return the scope created by this node (if one exists, else NULL)
+// Return the scope created by this node (if one exists, else NULL).
be_scope *
be_decl::scope (void)
{
be_decl *d = this;
- switch (this->node_type()) {
- case AST_Decl::NT_interface_fwd:
- /*
- * Resolve forward declared interface by looking at full_definition()
- * field and iterating
- */
- d = be_interface::narrow_from_decl ((be_interface_fwd::narrow_from_decl
- (this))->full_definition ());
- /*
- * Fall through
- */
- case AST_Decl::NT_interface:
- return be_interface::narrow_from_decl (d);
- case AST_Decl::NT_module:
- return be_module::narrow_from_decl (d);
- case AST_Decl::NT_root:
- return be_root::narrow_from_decl (d);
- case AST_Decl::NT_except:
- return be_exception::narrow_from_decl (d);
- case AST_Decl::NT_union:
- return be_union::narrow_from_decl (d);
- case AST_Decl::NT_struct:
- return be_structure::narrow_from_decl (d);
- case AST_Decl::NT_enum:
- return be_enum::narrow_from_decl (d);
- case AST_Decl::NT_op:
- return be_operation::narrow_from_decl (d);
- case AST_Decl::NT_sequence:
- return be_sequence::narrow_from_decl (d);
- default:
- return (be_scope *)0;
+ switch (this->node_type ())
+ {
+ case AST_Decl::NT_interface_fwd:
+ // Resolve forward declared interface by looking at full_definition()
+ // field and iterating.
+ d =
+ be_interface::narrow_from_decl (
+ (be_interface_fwd::narrow_from_decl (this))->full_definition ()
+ );
+ // Fall through
+ case AST_Decl::NT_interface:
+ return be_interface::narrow_from_decl (d);
+ case AST_Decl::NT_module:
+ return be_module::narrow_from_decl (d);
+ case AST_Decl::NT_root:
+ return be_root::narrow_from_decl (d);
+ case AST_Decl::NT_except:
+ return be_exception::narrow_from_decl (d);
+ case AST_Decl::NT_union:
+ return be_union::narrow_from_decl (d);
+ case AST_Decl::NT_struct:
+ return be_structure::narrow_from_decl (d);
+ case AST_Decl::NT_enum:
+ return be_enum::narrow_from_decl (d);
+ case AST_Decl::NT_op:
+ return be_operation::narrow_from_decl (d);
+ case AST_Decl::NT_sequence:
+ return be_sequence::narrow_from_decl (d);
+ default:
+ return (be_scope *)0;
}
}
-// boolean methods to test if code was already generated
+// Boolean methods to test if code was already generated.
idl_bool
be_decl::cli_hdr_gen (void)
{
@@ -825,7 +994,7 @@ be_decl::srv_inline_gen (void)
return this->srv_inline_gen_;
}
-// set the flag indicating that code generation is done
+// Set the flag indicating that code generation is done.
void
be_decl::cli_hdr_gen (idl_bool val)
{
@@ -910,16 +1079,22 @@ be_decl::is_child (be_decl *node)
{
if (this->defined_in ())
{
- be_decl *bd;
+ be_decl *bd = 0;
bd = be_scope::narrow_from_scope (this->defined_in ())->decl ();
- if (!bd)
- return 0;
+
+ if (bd == 0)
+ {
+ return 0;
+ }
if (!ACE_OS::strcmp (bd->full_name (), node->full_name ()))
- return 1; // true
+ {
+ return 1;
+ }
}
- return 0; // not a child
+
+ return 0; // Not a child.
}
idl_bool
@@ -934,12 +1109,12 @@ be_decl::has_constructor (idl_bool value)
// Similarly to be_decl::size_type_, once this
// gets set to I_TRUE, we don't want it to
// change back.
- if (!this->has_constructor_)
+ if (this->has_constructor_ == 0)
{
this->has_constructor_ = value;
}
}
-// narrowing methods
+// 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 917725dbe07..474fa8b9838 100644
--- a/TAO/TAO_IDL/be/be_enum.cpp
+++ b/TAO/TAO_IDL/be/be_enum.cpp
@@ -25,9 +25,6 @@
ACE_RCSID(be, be_enum, "$Id$")
-/*
- * BE_Enum
- */
be_enum::be_enum (void)
{
this->size_type (be_decl::FIXED);
@@ -37,37 +34,48 @@ be_enum::be_enum (UTL_ScopedName *n,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Enum (n, p, local, abstract),
- AST_Decl (AST_Decl::NT_enum, n, p),
+ : AST_Enum (n,
+ p,
+ local,
+ abstract),
+ AST_Decl (AST_Decl::NT_enum,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_enum),
- COMMON_Base (local, abstract),
+ COMMON_Base (local,
+ abstract),
member_count_ (-1)
{
this->size_type (be_decl::FIXED);
}
-// compute total number of members
+// Compute total number of members.
int
be_enum::compute_member_count (void)
{
- UTL_ScopeActiveIterator *si; // iterator
+ UTL_ScopeActiveIterator *si = 0;
this->member_count_ = 0;
// if there are elements in this scope
if (this->nmembers () > 0)
{
- // instantiate a scope iterator.
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ // Instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
while (!(si->is_done ()))
{
- // get the next AST decl node
+ // Get the next AST decl node.
this->member_count_++;
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
+
return 0;
}
@@ -76,7 +84,9 @@ int
be_enum::member_count (void)
{
if (this->member_count_ == -1)
- this->compute_member_count ();
+ {
+ this->compute_member_count ();
+ }
return this->member_count_;
}
@@ -85,26 +95,39 @@ be_enum::member_count (void)
UTL_ScopedName *
be_enum::value_to_name (const unsigned long v)
{
- UTL_ScopeActiveIterator *iter;
- AST_EnumVal *item;
- AST_Decl *i;
+ UTL_ScopeActiveIterator *iter = 0;
+ AST_EnumVal *item = 0;
+ AST_Decl *i = 0;
- iter = new UTL_ScopeActiveIterator (this,
- IK_decls);
+ ACE_NEW_RETURN (iter,
+ UTL_ScopeActiveIterator (this,
+ IK_decls),
+ 0);
while (!iter->is_done ())
{
i = iter->item ();
item = AST_EnumVal::narrow_from_decl (i);
- if (item->constant_value ()->ev ()->u.ulval == v)
+
+ if (item->constant_value ()->ev ()->u.ulval == v)
{
delete iter;
return item->name ();
}
+
iter->next ();
}
+
delete iter;
- return NULL;
+ return 0;
+}
+
+void
+be_enum::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+// be_type::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp
index 83404d97343..34bdaab781d 100644
--- a/TAO/TAO_IDL/be/be_enum_val.cpp
+++ b/TAO/TAO_IDL/be/be_enum_val.cpp
@@ -29,13 +29,17 @@ be_enum_val::be_enum_val (void)
{
}
-be_enum_val::be_enum_val (unsigned long v, UTL_ScopedName *n, UTL_StrList *p)
+be_enum_val::be_enum_val (unsigned long v,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
: AST_Constant (AST_Expression::EV_ulong,
AST_Decl::NT_enum_val,
new AST_Expression(v),
n,
p),
- AST_Decl (AST_Decl::NT_enum_val, n, p)
+ AST_Decl (AST_Decl::NT_enum_val,
+ n,
+ p)
{
}
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
index c8f59253a37..5d35ad7320f 100644
--- a/TAO/TAO_IDL/be/be_exception.cpp
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -26,9 +26,6 @@
ACE_RCSID(be, be_exception, "$Id$")
-/*
- * BE_Exception
- */
be_exception::be_exception (void)
{
this->size_type (be_decl::VARIABLE); // always the case
@@ -38,70 +35,93 @@ be_exception::be_exception (UTL_ScopedName *n,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Decl (AST_Decl::NT_except, n, p),
- AST_Structure (AST_Decl::NT_except, n, p, local, abstract),
+ : AST_Decl (AST_Decl::NT_except,
+ n,
+ p),
+ AST_Structure (AST_Decl::NT_except,
+ n,
+ p,
+ local,
+ abstract),
UTL_Scope (AST_Decl::NT_except),
- COMMON_Base (local, abstract)
+ COMMON_Base (local,
+ abstract)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ this->size_type (be_decl::VARIABLE); // Always the case.
}
// Are we or the parameter node involved in any recursion
idl_bool
be_exception::in_recursion (be_type *node)
{
- if (!node)
+ if (node == 0)
{
- // we are determining the recursive status for ourselves
+ // We are determining the recursive status for ourselves.
node = this;
}
- // proceed if the number of members in our scope is greater than 0
+ // Proceed if the number of members in our scope is greater than 0.
if (this->nmembers () > 0)
{
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
+ // Initialize an iterator to iterate thru our scope.
+ UTL_ScopeActiveIterator *si = 0;
ACE_NEW_RETURN (si,
UTL_ScopeActiveIterator (this,
UTL_Scope::IK_decls),
-1);
- // continue until each element is visited
+ // Continue until each element is visited.
while (!si->is_done ())
{
be_field *field = be_field::narrow_from_decl (si->item ());
- if (!field)
+
+ if (field == 0)
{
delete si;
+
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_exception::")
ACE_TEXT ("in_recursion - ")
ACE_TEXT ("bad field node\n")),
0);
}
+
be_type *type = be_type::narrow_from_decl (field->field_type ());
- if (!type)
+
+ if (type == 0)
{
delete si;
+
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_exception::")
ACE_TEXT ("in_recursion - ")
ACE_TEXT ("bad field type\n")),
0);
}
+
if (type->in_recursion (node))
{
delete si;
return 1;
}
+
si->next ();
- } // end of while loop
+ }
+
delete si;
- } // end of if
+ }
- // not in recursion
+ // Not in recursion
return 0;
}
+void
+be_exception::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_type::destroy ();
+}
+
int
be_exception::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_expression.cpp b/TAO/TAO_IDL/be/be_expression.cpp
index 33442dd63c5..51039a7490a 100644
--- a/TAO/TAO_IDL/be/be_expression.cpp
+++ b/TAO/TAO_IDL/be/be_expression.cpp
@@ -25,25 +25,23 @@
ACE_RCSID(be, be_expression, "$Id$")
-/*
- * BE_Expression
- */
-
-// the constructors
be_expression::be_expression (UTL_ScopedName *n)
: AST_Expression (n)
{
}
be_expression::be_expression (AST_Expression *b, AST_Expression::ExprType t)
- : AST_Expression (b, t)
+ : AST_Expression (b,
+ t)
{
}
be_expression::be_expression (AST_Expression::ExprComb c,
AST_Expression *v1,
AST_Expression *v2)
- : AST_Expression (c, v1, v2)
+ : AST_Expression (c,
+ v1,
+ v2)
{
}
@@ -52,8 +50,10 @@ be_expression::be_expression (long l)
{
}
-be_expression::be_expression (long l, AST_Expression::ExprType t)
- : AST_Expression (l, t)
+be_expression::be_expression (long l,
+ AST_Expression::ExprType t)
+ : AST_Expression (l,
+ t)
{
}
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
index 379bf29f363..c0ab867c8bc 100644
--- a/TAO/TAO_IDL/be/be_field.cpp
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -25,37 +25,44 @@
ACE_RCSID(be, be_field, "$Id$")
-/*
- * BE_Field
- */
be_field::be_field (void)
{
}
-be_field::be_field (AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p, Visibility vis)
- : AST_Field (ft, n, p, vis),
- AST_Decl (AST_Decl::NT_field, n, p),
- COMMON_Base (ft->is_local (), ft->is_abstract ())
+be_field::be_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p,
+ Visibility vis)
+ : AST_Field (ft,
+ n,
+ p,
+ vis),
+ AST_Decl (AST_Decl::NT_field,
+ n,
+ p),
+ COMMON_Base (ft->is_local (),
+ ft->is_abstract ())
{
}
-// compute the size type of the node in question
+// 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)
+
+ if (type == 0)
{
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
+ // 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.
- // and while we're here, take care of has_constructor
+ // While we're here, take care of has_constructor.
this->has_constructor (type->has_constructor ());
return 0;
diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp
index 6eadddf6cac..dabbc590199 100644
--- a/TAO/TAO_IDL/be/be_generator.cpp
+++ b/TAO/TAO_IDL/be/be_generator.cpp
@@ -62,7 +62,7 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
// be_generator.cc
//
@@ -71,54 +71,41 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// This implements the same protocol as AST_Generator but creates instances
// of the BE-subclassed classes instead of of AST classes
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
#include "ace/config-all.h"
ACE_RCSID(be, be_generator, "$Id$")
-/*
- * Constructor
- */
-
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-/*
- * Inherited operations redefined here
- */
-
-/*
- * Construct a be_root node (a node representing the root of an AST of BE nodes)
- */
AST_Root *
-be_generator::create_root(UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_root (UTL_ScopedName *n,
+ UTL_StrList *p)
{
- return new be_root(n, p);
+ be_root *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_root (n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_PredefinedType node
- */
AST_PredefinedType *
be_generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
UTL_ScopedName *n,
UTL_StrList *p)
{
- return (AST_PredefinedType *) new be_predefined_type(t, n, p);
+ be_predefined_type *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_predefined_type (t,
+ n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Module node
- */
AST_Module *
be_generator::create_module (UTL_Scope *s,
UTL_ScopedName *n,
@@ -126,14 +113,21 @@ be_generator::create_module (UTL_Scope *s,
{
AST_Decl *d = 0;
AST_Module *m = 0;
- UTL_ScopeActiveIterator *iter =
- new UTL_ScopeActiveIterator (s,
- UTL_Scope::IK_decls);
+
+ UTL_ScopeActiveIterator *iter = 0;
+ ACE_NEW_RETURN (iter,
+ UTL_ScopeActiveIterator (s,
+ UTL_Scope::IK_decls),
+ 0);
// We create this first so if we find a module with the
// same name from an included file, we can add its
// members to the new module's scope.
- AST_Module *retval = (AST_Module *) new be_module (n, p);
+ AST_Module *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_module (n,
+ p),
+ 0);
// Check for another module of the same name in this scope.
@@ -197,9 +191,6 @@ be_generator::create_module (UTL_Scope *s,
return retval;
}
-/*
- * Create a BE_Interface node
- */
AST_Interface *
be_generator::create_interface (UTL_ScopedName *n,
AST_Interface **ih,
@@ -210,407 +201,513 @@ be_generator::create_interface (UTL_ScopedName *n,
idl_bool l,
idl_bool a)
{
- return (AST_Interface *) new be_interface (n,
- ih,
- nih,
- ih_flat,
- nih_flat,
- p,
- l,
- a);
+ be_interface *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_interface (n,
+ ih,
+ nih,
+ ih_flat,
+ nih_flat,
+ p,
+ l,
+ a),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_InterfaceFwd node
- */
AST_InterfaceFwd *
be_generator::create_interface_fwd (UTL_ScopedName *n,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
- return
- (AST_InterfaceFwd *) new be_interface_fwd (this->create_interface (n,
- 0,
- -1,
- 0,
- 0,
- p,
- local,
- abstract),
- n,
- p);
+ be_interface_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_interface_fwd (this->create_interface (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ p,
+ local,
+ abstract),
+ n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a be_valuetype node
- */
AST_Interface *
-be_generator::create_valuetype(UTL_ScopedName *n,
- AST_Interface **ih,
- long nih,
- UTL_StrList *p)
+be_generator::create_valuetype (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ UTL_StrList *p)
{
#ifdef IDL_HAS_VALUETYPE
- return (AST_Interface *) new be_valuetype(n, ih, nih, p);
+ be_valuetype *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_valuetype (n,
+ ih,
+ nih,
+ p),
+ 0);
+
+ return retval;
#else
- ACE_ASSERT (0);
- return 0;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Valuetype support not enabled\n"),
+ 0);
#endif /* IDL_HAS_VALUETYPE */
}
-/*
- * Create a be_valuetype_fwd node
- */
AST_InterfaceFwd *
be_generator::create_valuetype_fwd(UTL_ScopedName *n, UTL_StrList *p)
{
#ifdef IDL_HAS_VALUETYPE
- return (AST_InterfaceFwd *) new be_valuetype_fwd(this->create_valuetype (n, 0, -1, p),
- n, p);
+ be_valuetype_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_valuetype_fwd (this->create_valuetype (n,
+ 0,
+ -1,
+ p),
+ n,
+ p),
+ 0);
+
+ return retval;
#else
- ACE_ASSERT (0);
- return 0;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Valuetype support not enabled\n"),
+ 0);
#endif /* IDL_HAS_VALUETYPE */
}
-/*
- * Create a BE_Exception node
- */
AST_Exception *
-be_generator::create_exception(UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
+be_generator::create_exception (UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
{
- return (AST_Exception *) new be_exception(n,
- p,
- local,
- abstract);
+ be_exception *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_exception (n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Structure node
- */
AST_Structure *
-be_generator::create_structure(UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
+be_generator::create_structure (UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
{
- return (AST_Structure *) new be_structure(n,
- p,
- local,
- abstract);
+ be_structure *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_structure (n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Enum node
- */
AST_Enum *
-be_generator::create_enum(UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
+be_generator::create_enum (UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
{
- return (AST_Enum *) new be_enum(n, p, local, abstract);
+ be_enum *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_enum (n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Operation node
- */
AST_Operation *
-be_generator::create_operation(AST_Type *rt,
- AST_Operation::Flags fl,
- UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
-{
- return (AST_Operation *) new be_operation(rt,
- fl,
- n,
- p,
- local,
- abstract);
+be_generator::create_operation (AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
+{
+ be_operation *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation (rt,
+ fl,
+ n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Field node
- */
AST_Field *
-be_generator::create_field(AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p,
- AST_Field::Visibility vis)
-{
- return (AST_Field *) new be_field(ft, n, p, vis);
+be_generator::create_field (AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p,
+ AST_Field::Visibility vis)
+{
+ be_field *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_field (ft,
+ n,
+ p,
+ vis),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Argument node
- */
AST_Argument *
-be_generator::create_argument(AST_Argument::Direction d,
- AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_argument (AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
{
- return (AST_Argument *) new be_argument(d, ft, n, p);
+ be_argument *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_argument (d,
+ ft,
+ n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Attribute node
- */
AST_Attribute *
-be_generator::create_attribute(idl_bool ro,
- AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
-{
- return (AST_Attribute *) new be_attribute(ro,
- ft,
- n,
- p,
- local,
- abstract);
+be_generator::create_attribute (idl_bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
+{
+ be_attribute *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_attribute (ro,
+ ft,
+ n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Union node
- */
AST_Union *
-be_generator::create_union(AST_ConcreteType *dt,
- UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
-{
- return (AST_Union *) new be_union(dt,
- n,
- p,
- local,
- abstract);
+be_generator::create_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
+{
+ be_union *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union (dt,
+ n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_UnionBranch node
- */
AST_UnionBranch *
-be_generator::create_union_branch(UTL_LabelList *ll,
- AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p)
-{
- return (AST_UnionBranch *) new be_union_branch(ll, ft, n, p);
+be_generator::create_union_branch (UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+{
+ be_union_branch *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union_branch (ll,
+ ft,
+ n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_UnionLabel node
- */
AST_UnionLabel *
-be_generator::create_union_label(AST_UnionLabel::UnionLabel ul,
- AST_Expression *lv)
+be_generator::create_union_label (AST_UnionLabel::UnionLabel ul,
+ AST_Expression *lv)
{
- return (AST_UnionLabel *) new be_union_label(ul, lv);
+ be_union_label *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union_label (ul,
+ lv),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Constant node
- */
AST_Constant *
-be_generator::create_constant(AST_Expression::ExprType et,
- AST_Expression *ev,
- UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_constant (AST_Expression::ExprType et,
+ AST_Expression *ev,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
{
- return (AST_Constant *) new be_constant (et, ev, n, p);
+ be_constant *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_constant (et,
+ ev,
+ n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a symbolic BE_Expression node
- */
AST_Expression *
-be_generator::create_expr(UTL_ScopedName *n)
+be_generator::create_expr (UTL_ScopedName *n)
{
- return (AST_Expression *) new be_expression (n);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (n),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a coercion
- */
AST_Expression *
-be_generator::create_expr(AST_Expression *b, AST_Expression::ExprType t)
+be_generator::create_expr (AST_Expression *b,
+ AST_Expression::ExprType t)
{
- return (AST_Expression *) new be_expression (b, t);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (b,
+ t),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node combining two other AST_Expression nodes
- */
AST_Expression *
-be_generator::create_expr(AST_Expression::ExprComb c,
- AST_Expression *v1,
- AST_Expression *v2)
+be_generator::create_expr (AST_Expression::ExprComb c,
+ AST_Expression *v1,
+ AST_Expression *v2)
{
- return (AST_Expression *) new be_expression (c, v1, v2);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (c,
+ v1,
+ v2),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a long integer
- */
AST_Expression *
-be_generator::create_expr(long l)
+be_generator::create_expr (long l)
{
- return (AST_Expression *) new be_expression (l);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (l),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a long integer being used as a boolean
- */
AST_Expression *
-be_generator::create_expr(long l, AST_Expression::ExprType t)
+be_generator::create_expr (long l,
+ AST_Expression::ExprType t)
{
- return (AST_Expression *) new be_expression (l, t);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (l,
+ t),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting an unsigned long integer
- */
AST_Expression *
-be_generator::create_expr(unsigned long l)
+be_generator::create_expr (unsigned long l)
{
- return (AST_Expression *) new be_expression(l);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (l),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a char * (encapsulated as a String)
- */
AST_Expression *
be_generator::create_expr (UTL_String *s)
{
- return (AST_Expression *) new be_expression (s);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (s),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a character
- */
AST_Expression *
be_generator::create_expr(char c)
{
- return (AST_Expression *) new be_expression (c);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (c),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a wide character
- */
AST_Expression *
-be_generator::create_expr(ACE_OutputCDR::from_wchar wc)
+be_generator::create_expr (ACE_OutputCDR::from_wchar wc)
{
- return (AST_Expression *) new be_expression (wc);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (wc),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a wide string
- */
AST_Expression *
be_generator::create_expr (char *s)
{
- return (AST_Expression *) new be_expression (s);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (s),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Expression node denoting a 64-bit floating point number
- */
AST_Expression *
be_generator::create_expr (double d)
{
- return (AST_Expression *) new be_expression (d);
+ be_expression *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_expression (d),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_EnumVal node
- */
AST_EnumVal *
-be_generator::create_enum_val(unsigned long v,
- UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_enum_val (unsigned long v,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
{
- return (AST_EnumVal *) new be_enum_val(v, n, p);
+ be_enum_val *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_enum_val (v,
+ n,
+ p),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Array node
- */
AST_Array *
-be_generator::create_array(UTL_ScopedName *n,
- unsigned long ndims,
- UTL_ExprList *dims,
- idl_bool local,
- idl_bool abstract)
-{
- return (AST_Array *) new be_array(n,
- ndims,
- dims,
- local,
- abstract);
+be_generator::create_array (UTL_ScopedName *n,
+ unsigned long ndims,
+ UTL_ExprList *dims,
+ idl_bool local,
+ idl_bool abstract)
+{
+ be_array *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_array (n,
+ ndims,
+ dims,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Sequence node
- */
AST_Sequence *
-be_generator::create_sequence(AST_Expression *v,
- AST_Type *bt,
- idl_bool local,
- idl_bool abstract)
+be_generator::create_sequence (AST_Expression *v,
+ AST_Type *bt,
+ idl_bool local,
+ idl_bool abstract)
{
- return (AST_Sequence *) new be_sequence(v,
- bt,
- local,
- abstract);
+ be_sequence *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_sequence (v,
+ bt,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_String node
- */
AST_String *
-be_generator::create_string(AST_Expression *v)
+be_generator::create_string (AST_Expression *v)
{
- return (AST_String *) new be_string (v);
+ be_string *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_string (v),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_string node for a wide string
- */
AST_String *
-be_generator::create_wstring(AST_Expression *v)
+be_generator::create_wstring (AST_Expression *v)
{
- return (AST_String *) new be_string (v,
- sizeof (ACE_CDR::WChar));
+ be_string *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_string (v,
+ sizeof (ACE_CDR::WChar)),
+ 0);
+
+ return retval;
}
-/*
- * Create a BE_Typedef node
- */
AST_Typedef *
-be_generator::create_typedef(AST_Type *bt,
- UTL_ScopedName *n,
- UTL_StrList *p,
- idl_bool local,
- idl_bool abstract)
+be_generator::create_typedef (AST_Type *bt,
+ UTL_ScopedName *n,
+ UTL_StrList *p,
+ idl_bool local,
+ idl_bool abstract)
{
- return (AST_Typedef *) new be_typedef(bt, n, p, local, abstract);
+ be_typedef *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_typedef (bt,
+ n,
+ p,
+ local,
+ abstract),
+ 0);
+
+ return retval;
}
-/*
- * Construct an AST_Native node
- */
AST_Native *
be_generator::create_native (UTL_ScopedName *n,
UTL_StrList *p)
{
- return (AST_Native *) new be_native (n, p);
+ be_native *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_native (n,
+ p),
+ 0);
+
+ return retval;
}
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
new file mode 100644
index 00000000000..769f07a7c78
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -0,0 +1,821 @@
+// $Id$
+
+// ============================================================================
+//
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_global.cpp
+//
+// = DESCRIPTION
+// Stores global data specific to the compiler back end.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+ACE_RCSID(be, be_global, "$Id$")
+
+TAO_IDL_BE_Export BE_GlobalData *be_global = 0;
+
+BE_GlobalData::BE_GlobalData (void)
+ : changing_standard_include_files_ (1),
+ skel_export_macro_ (0),
+ skel_export_include_ (0),
+ stub_export_macro_ (0),
+ stub_export_include_ (0),
+ pch_include_ (0),
+ pre_include_ (0),
+ post_include_ (0),
+ client_hdr_ending_ (ACE::strnew ("C.h")),
+ client_stub_ending_ (ACE::strnew ("C.cpp")),
+ client_inline_ending_ (ACE::strnew ("C.i")),
+ server_hdr_ending_ (ACE::strnew ("S.h")),
+ implementation_hdr_ending_ (ACE::strnew ("I.h")),
+ implementation_skel_ending_ (ACE::strnew ("I.cpp")),
+ impl_class_prefix_ (ACE::strnew ("")),
+ impl_class_suffix_ (ACE::strnew ("_i")),
+ server_template_hdr_ending_ (ACE::strnew ("S_T.h")),
+ server_skeleton_ending_ (ACE::strnew ("S.cpp")),
+ server_template_skeleton_ending_ (ACE::strnew ("S_T.cpp")),
+ server_inline_ending_ (ACE::strnew ("S.i")),
+ server_template_inline_ending_ (ACE::strnew ("S_T.i")),
+ output_dir_ (0),
+ any_support_ (I_TRUE),
+ tc_support_ (I_TRUE),
+#ifdef IDL_HAS_VALUETYPE
+ obv_opt_accessor_ (0),
+#endif /* IDL_HAS_VALUETYPE */
+ gen_impl_files_ (I_FALSE),
+ gen_copy_ctor_ (I_FALSE),
+ gen_assign_op_ (I_FALSE),
+ gen_thru_poa_collocation_ (I_TRUE), // Default is thru_poa.
+ gen_direct_collocation_ (I_FALSE),
+#ifdef ACE_HAS_EXCEPTIONS
+ exception_support_ (I_TRUE),
+#else
+ exception_support_ (I_FALSE),
+#endif /* ACE_HAS_EXCEPTIONS */
+ use_raw_throw_ (I_FALSE),
+ opt_tc_ (I_FALSE),
+ ami_call_back_ (I_FALSE),
+ gen_tie_classes_ (I_TRUE),
+#if (TAO_HAS_SMART_PROXIES == 1)
+ gen_smart_proxies_ (I_TRUE)
+#else
+ gen_smart_proxies_ (I_FALSE),
+#endif /* TAO_HAS_SMART_PROXIES == 1 */
+ lookup_strategy_ (TAO_PERFECT_HASH)
+{
+}
+
+BE_GlobalData::~BE_GlobalData (void)
+{
+}
+
+// To switch between changing or non-changing standard include files
+// include files, so that #include statements can be
+// generated with ""s or <>s respectively, for the standard include
+// files (e.g. tao/corba.h)
+void
+BE_GlobalData::changing_standard_include_files (size_t changing)
+{
+ this->changing_standard_include_files_ = changing;
+}
+
+size_t
+BE_GlobalData::changing_standard_include_files (void)
+{
+ return this->changing_standard_include_files_;
+}
+
+/************ Helper functions **************/
+static const char*
+be_change_idl_file_extension (UTL_String* idl_file,
+ const char *new_extension,
+ int base_name_only = 0)
+{
+ // @@ This shouldn't happen anyway; but a better error handling
+ // mechanism is needed.
+ if (idl_file == 0 || new_extension == 0)
+ return 0;
+
+ static char fname[MAXPATHLEN];
+ ACE_OS::memset (fname, 0, MAXPATHLEN);
+
+ // Get the char* from the UTL_String.
+ const char* string = idl_file->get_string ();
+
+ // Get the base part of the filename, we try several extensions
+ // before giving up.
+ const char *base = 0;
+
+ static const char* extensions[] = {
+ ".idl",
+ ".pidl",
+ ".IDL",
+ ".PIDL"
+ };
+ static int nextensions = sizeof(extensions)/sizeof(extensions[0]);
+
+ for (int k = 0; k < nextensions; ++k)
+ {
+ base = ACE_OS::strstr (string, extensions[k]);
+ if (base != 0)
+ break;
+ }
+ if (base == 0)
+ return 0;
+
+ if ((!base_name_only) && (be_global->output_dir () != 0))
+ {
+ // Path info should also be added to fname.
+
+ // Add path and "/".
+ ACE_OS::sprintf (fname, "%s/", be_global->output_dir ());
+
+ // Append the base part to fname.
+ ACE_OS::strncpy (fname + strlen (fname), string, base - string);
+ }
+ else
+ // Base_name_only or no putput_dir specified by user. JUST put the
+ // base part to fname.
+ ACE_OS::strncpy (fname, string, base - string);
+
+ // Turn '\' and '\\' into '/'.
+ char* i = fname;
+ for (char* j = fname; *j != 0; ++i, ++j)
+ {
+ if (*j == '\\')
+ {
+ *i = '/';
+ if (*(j+1) == '\\')
+ ++j;
+ }
+ else
+ *i = *j;
+ }
+ *i = 0;
+
+ // Append the newextension.
+ ACE_OS::strcat (fname, new_extension);
+
+ return fname;
+}
+
+const char *
+BE_GlobalData::be_get_client_hdr (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->client_hdr_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_client_stub (UTL_String *idl_file_name)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->client_stub_ending ());
+}
+
+const char *
+BE_GlobalData::be_get_client_inline (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->client_inline_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_hdr (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_hdr_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_hdr (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->implementation_hdr_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_skel (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->implementation_skel_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_hdr (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_template_hdr_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_skeleton (UTL_String *idl_file_name)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_skeleton_ending ());
+}
+
+const char *
+BE_GlobalData::be_get_server_template_skeleton (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_template_skeleton_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_inline (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_inline_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_inline (UTL_String *idl_file_name,
+ int base_name_only)
+{
+ return be_change_idl_file_extension (idl_file_name,
+ be_global->server_template_inline_ending (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_client_hdr_fname (int base_name_only)
+{
+ return be_get_client_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_client_stub_fname ()
+{
+ return be_get_client_stub (idl_global->stripped_filename ());
+}
+
+const char *
+BE_GlobalData::be_get_client_inline_fname (int base_name_only)
+{
+ return be_get_client_inline (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_hdr_fname (int base_name_only)
+{
+ return be_get_server_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_hdr_fname (int base_name_only)
+{
+ return be_get_implementation_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_implementation_skel_fname (int base_name_only)
+{
+ return be_get_implementation_skel (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+
+const char *
+BE_GlobalData::be_get_server_template_hdr_fname (int base_name_only)
+{
+ return be_get_server_template_hdr (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_skeleton_fname ()
+{
+ return be_get_server_skeleton (idl_global->stripped_filename ());
+}
+
+/*
+const char *
+BE_GlobalData::be_get_implementation_hdr_fname ()
+{
+ return be_get_implementation_hdr (idl_global->stripped_filename ());
+}
+*/
+
+const char *
+BE_GlobalData::be_get_implementation_skeleton_fname ()
+{
+ return be_get_implementation_skel (idl_global->stripped_filename ());
+}
+
+
+const char *
+BE_GlobalData::be_get_server_template_skeleton_fname (int base_name_only)
+{
+ return be_get_server_template_skeleton (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_inline_fname (int base_name_only)
+{
+ return be_get_server_inline (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char *
+BE_GlobalData::be_get_server_template_inline_fname (int base_name_only)
+{
+ return be_get_server_template_inline (idl_global->stripped_filename (),
+ base_name_only);
+}
+
+const char*
+BE_GlobalData::skel_export_macro (void) const
+{
+ if (this->skel_export_macro_ == 0)
+ return "";
+ return this->skel_export_macro_;
+}
+
+void
+BE_GlobalData::skel_export_macro (const char *s)
+{
+ this->skel_export_macro_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::skel_export_include (void) const
+{
+ return this->skel_export_include_;
+}
+
+void
+BE_GlobalData::skel_export_include (const char *s)
+{
+ this->skel_export_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::stub_export_macro (void) const
+{
+ if (this->stub_export_macro_ == 0)
+ return "";
+ return this->stub_export_macro_;
+}
+
+void
+BE_GlobalData::stub_export_macro (const char *s)
+{
+ this->stub_export_macro_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::stub_export_include (void) const
+{
+ return this->stub_export_include_;
+}
+
+void
+BE_GlobalData::stub_export_include (const char *s)
+{
+ this->stub_export_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::pch_include (void) const
+{
+ return this->pch_include_;
+}
+
+void
+BE_GlobalData::pch_include (const char *s)
+{
+ this->pch_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::pre_include (void) const
+{
+ return this->pre_include_;
+}
+
+void
+BE_GlobalData::pre_include (const char *s)
+{
+ this->pre_include_ = ACE_OS::strdup (s);
+}
+
+const char*
+BE_GlobalData::post_include (void) const
+{
+ return this->post_include_;
+}
+
+void
+BE_GlobalData::post_include (const char *s)
+{
+ this->post_include_ = ACE_OS::strdup (s);
+}
+
+// Set the client_hdr_ending.
+void
+BE_GlobalData::client_hdr_ending (const char* s)
+{
+ delete [] this->client_hdr_ending_;
+ this->client_hdr_ending_ = ACE::strnew (s);
+}
+
+// Get the client_hdr_ending.
+const char*
+BE_GlobalData::client_hdr_ending (void) const
+{
+ return this->client_hdr_ending_;
+}
+
+void
+BE_GlobalData::client_inline_ending (const char* s)
+{
+ delete [] this->client_inline_ending_;
+ this->client_inline_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::client_inline_ending (void) const
+{
+ return this->client_inline_ending_;
+}
+
+// Set the client_stub_ending.
+void
+BE_GlobalData::client_stub_ending (const char* s)
+{
+ delete [] this->client_stub_ending_;
+ this->client_stub_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::client_stub_ending (void) const
+{
+ return this->client_stub_ending_;
+}
+
+void
+BE_GlobalData::server_hdr_ending (const char* s)
+{
+ delete [] this->server_hdr_ending_;
+ this->server_hdr_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_hdr_ending (void) const
+{
+ return this->server_hdr_ending_;
+}
+
+void
+BE_GlobalData::implementation_hdr_ending (const char* s)
+{
+ delete [] this->implementation_hdr_ending_;
+ this->implementation_hdr_ending_ = ACE::strnew (s);
+}
+
+void
+BE_GlobalData::implementation_skel_ending (const char* s)
+{
+ delete [] this->implementation_skel_ending_;
+ this->implementation_skel_ending_ = ACE::strnew (s);
+}
+
+
+void
+BE_GlobalData::impl_class_prefix (const char* s)
+{
+ delete [] this->impl_class_prefix_;
+ this->impl_class_prefix_ = ACE::strnew (s);
+}
+
+void
+BE_GlobalData::impl_class_suffix (const char* s)
+{
+ delete [] this->impl_class_suffix_;
+ this->impl_class_suffix_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::impl_class_prefix (void) const
+{
+ return this->impl_class_prefix_;
+}
+
+const char*
+BE_GlobalData::implementation_hdr_ending (void) const
+{
+ return this->implementation_hdr_ending_;
+}
+
+
+const char*
+BE_GlobalData::impl_class_suffix (void) const
+{
+ return this->impl_class_suffix_;
+}
+
+const char*
+BE_GlobalData::implementation_skel_ending (void) const
+{
+ return this->implementation_skel_ending_;
+}
+
+
+
+void
+BE_GlobalData::server_template_hdr_ending (const char* s)
+{
+ delete [] this->server_template_hdr_ending_;
+ this->server_template_hdr_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_template_hdr_ending (void) const
+{
+ return this->server_template_hdr_ending_;
+}
+
+void
+BE_GlobalData::server_skeleton_ending (const char* s)
+{
+ delete [] this->server_skeleton_ending_;
+ this->server_skeleton_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_skeleton_ending (void) const
+{
+ return this->server_skeleton_ending_;
+}
+
+void
+BE_GlobalData::server_template_skeleton_ending (const char* s)
+{
+ delete [] this->server_template_skeleton_ending_;
+ this->server_template_skeleton_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_template_skeleton_ending (void) const
+{
+ return this->server_template_skeleton_ending_;
+}
+
+void
+BE_GlobalData::server_inline_ending (const char* s)
+{
+ delete [] this->server_inline_ending_;
+ this->server_inline_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_inline_ending (void) const
+{
+ return this->server_inline_ending_;
+}
+
+void
+BE_GlobalData::server_template_inline_ending (const char* s)
+{
+ delete [] this->server_template_inline_ending_;
+ this->server_template_inline_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::server_template_inline_ending (void) const
+{
+ return this->server_template_inline_ending_;
+}
+
+void
+BE_GlobalData::output_dir (const char* s)
+{
+ delete [] this->output_dir_;
+ this->output_dir_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::output_dir (void) const
+{
+ return this->output_dir_;
+}
+
+void
+BE_GlobalData::any_support (idl_bool val)
+{
+ this->any_support_ = val;
+}
+
+idl_bool
+BE_GlobalData::any_support (void)
+{
+ return this->any_support_;
+}
+
+void
+BE_GlobalData::tc_support (idl_bool val)
+{
+ this->tc_support_ = val;
+}
+
+idl_bool
+BE_GlobalData::tc_support (void)
+{
+ return this->tc_support_;
+}
+
+#ifdef IDL_HAS_VALUETYPE
+void
+BE_GlobalData::obv_opt_accessor (idl_bool val)
+{
+ this->obv_opt_accessor_ = val;
+}
+
+idl_bool
+BE_GlobalData::obv_opt_accessor (void)
+{
+ return this->obv_opt_accessor_;
+}
+#endif /* IDL_HAS_VALUETYPE */
+
+void
+BE_GlobalData::gen_impl_files (idl_bool val)
+{
+ this->gen_impl_files_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_impl_files (void)
+{
+ return this->gen_impl_files_;
+}
+
+void
+BE_GlobalData::gen_copy_ctor (idl_bool val)
+{
+ this->gen_copy_ctor_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_copy_ctor (void)
+{
+ return this->gen_copy_ctor_;
+}
+
+void
+BE_GlobalData::gen_assign_op (idl_bool val)
+{
+ this->gen_assign_op_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_assign_op (void)
+{
+ return this->gen_assign_op_;
+}
+
+void
+BE_GlobalData::gen_thru_poa_collocation (idl_bool val)
+{
+ this->gen_thru_poa_collocation_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_thru_poa_collocation (void)
+{
+ return this->gen_thru_poa_collocation_;
+}
+
+void
+BE_GlobalData::gen_direct_collocation (idl_bool val)
+{
+ this->gen_direct_collocation_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_direct_collocation (void)
+{
+ return this->gen_direct_collocation_;
+}
+
+void
+BE_GlobalData::exception_support (idl_bool val)
+{
+ this->exception_support_ = val;
+}
+
+idl_bool
+BE_GlobalData::exception_support (void)
+{
+ return this->exception_support_;
+}
+
+void
+BE_GlobalData::use_raw_throw (idl_bool val)
+{
+ this->use_raw_throw_ = val;
+}
+
+idl_bool
+BE_GlobalData::use_raw_throw (void)
+{
+ return this->use_raw_throw_;
+}
+
+void
+BE_GlobalData::opt_tc (idl_bool val)
+{
+ this->opt_tc_ = val;
+}
+
+idl_bool
+BE_GlobalData::opt_tc (void)
+{
+ return this->opt_tc_;
+}
+
+void
+BE_GlobalData::ami_call_back (idl_bool val)
+{
+ this->ami_call_back_ = val;
+}
+
+idl_bool
+BE_GlobalData::ami_call_back (void)
+{
+ return this->ami_call_back_;
+}
+
+void
+BE_GlobalData::gen_tie_classes (idl_bool val)
+{
+ this->gen_tie_classes_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_tie_classes (void)
+{
+ return this->gen_tie_classes_;
+}
+
+void
+BE_GlobalData::gen_smart_proxies (idl_bool val)
+{
+ this->gen_smart_proxies_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_smart_proxies (void)
+{
+ return this->gen_smart_proxies_;
+}
+
+void
+BE_GlobalData::lookup_strategy (LOOKUP_STRATEGY s)
+{
+ this->lookup_strategy_ = s;
+}
+
+BE_GlobalData::LOOKUP_STRATEGY
+BE_GlobalData::lookup_strategy (void) const
+{
+ return this->lookup_strategy_;
+}
+
+void
+BE_GlobalData::destroy (void)
+{
+}
diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp
index e2e4aac9609..ccc9f4f6a13 100644
--- a/TAO/TAO_IDL/be/be_helper.cpp
+++ b/TAO/TAO_IDL/be/be_helper.cpp
@@ -54,7 +54,7 @@ const TAO_INDENT be_idt_nl (1);
const TAO_UNINDENT be_uidt;
const TAO_UNINDENT be_uidt_nl (1);
-// methods of the TAO_OutStream class
+// Methods of the TAO_OutStream class.
TAO_OutStream::TAO_OutStream (void)
: fp_ (NULL),
@@ -64,12 +64,13 @@ TAO_OutStream::TAO_OutStream (void)
TAO_OutStream::~TAO_OutStream (void)
{
- // close the underlying I/O handle only if it exists
- if (fp_)
+ // Close the underlying I/O handle only if it exists.
+ if (this->fp_ != 0)
{
- ACE_OS::fclose (fp_);
- fp_ = NULL;
+ ACE_OS::fclose (this->fp_);
+ this->fp_ = 0;
}
+
indent_level_ = 0;
}
@@ -77,24 +78,31 @@ int
TAO_OutStream::open (const char *fname,
TAO_OutStream::STREAM_TYPE st)
{
- if (fname)
+ if (fname != 0)
{
- // file name exists, open an I/O file handle
- fp_ = ACE_OS::fopen (fname, "w");
- if (fp_)
+ // File name exists, open an I/O file handle.
+ this->fp_ = ACE_OS::fopen (fname, "w");
+
+ if (this->fp_ != 0)
{
this->st_ = st;
- // put the copyright notice. Not for the gperf's temp input
+ // Put the copyright notice. Not for the gperf's temp input
// file.
if (st != TAO_OutStream::TAO_GPERF_INPUT)
{
- ACE_OS::fprintf (fp_, "%s\n", copyright);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%s\n",
+ copyright);
+
+ ACE_OS::fflush (this->fp_);
}
+
return 0;
}
else
- return -1;
+ {
+ return -1;
+ }
}
else
{
@@ -127,51 +135,62 @@ int
TAO_OutStream::incr_indent (unsigned short flag)
{
indent_level_++;
- if (flag)
- return this->indent ();
+
+ if (flag != 0)
+ {
+ return this->indent ();
+ }
else
- return 0; // do not indent output
+ {
+ // Do not indent output.
+ return 0;
+ }
}
-// indentation
+// Indentation
int
TAO_OutStream::decr_indent (unsigned short flag)
{
- indent_level_--;
+ this->indent_level_--;
// Just in case somebody gets "unindent happy".
if (this->indent_level_ < 0)
{
// ACE_DEBUG ((LM_DEBUG, "negative indentation?\n"));
this->indent_level_ = 0;
}
- if (flag)
- return this->indent ();
+ if (flag != 0)
+ {
+ return this->indent ();
+ }
else
- return 0; // do not indent output
+ {
+ // Do not indent output.
+ return 0;
+ }
}
int
TAO_OutStream::reset (void)
{
- indent_level_ = 0;
+ this->indent_level_ = 0;
return 0;
}
-// indented print
+// Indented print.
int
TAO_OutStream::indent (void)
{
- int i;
- // based on the current indentation level, leave appropriate number of blank
- // spaces in the output
+ // Based on the current indentation level, leave appropriate number of blank
+ // spaces in the output.
if (this->indent_level_ > 0)
{
- for (i = 0; i < this->indent_level_; i++)
+ for (int i = 0; i < this->indent_level_; i++)
{
ACE_OS::fprintf (this->fp_, " ");
ACE_OS::fflush (this->fp_);
}
}
+
return 0;
}
@@ -183,16 +202,21 @@ TAO_OutStream::nl (void)
return 0;
}
-// macro generation
+// Macro generation.
int
-TAO_OutStream::gen_ifdef_macro (const char *flat_name, const char *suffix)
+TAO_OutStream::gen_ifdef_macro (const char *flat_name,
+ const char *suffix)
{
static char macro [NAMEBUFSIZE];
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ACE_OS::memset (macro, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (macro, "_%s_", cg->upcase (flat_name));
- if (suffix)
+ ACE_OS::memset (macro,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (macro,
+ "_%s_",
+ tao_cg->upcase (flat_name));
+ if (suffix != 0)
{
//ACE_OS::sprintf (macro, "%s_%s_", macro, cg->upcase (suffix));
// Can't have macro on both sides of sprintf
@@ -200,13 +224,13 @@ TAO_OutStream::gen_ifdef_macro (const char *flat_name, const char *suffix)
// not, but having it gives the same functionality as the old
// sprintf call...
ACE_OS::strcat (macro, "_");
- ACE_OS::strcat (macro, cg->upcase (suffix));
+ ACE_OS::strcat (macro, tao_cg->upcase (suffix));
ACE_OS::strcat (macro, "_");
}
- // append a suffix representing the stream type
+ // Append a suffix representing the stream type.
switch (this->st_)
- {
+ {
case TAO_OutStream::TAO_CLI_HDR:
ACE_OS::strcat (macro, "CH_");
break;
@@ -233,9 +257,10 @@ TAO_OutStream::gen_ifdef_macro (const char *flat_name, const char *suffix)
break;
default:
return -1;
- }
+ }
*this << "\n#if !defined (" << macro << ")\n";
*this << "#define " << macro << "\n\n";
+
return 0;
}
@@ -243,17 +268,19 @@ int
TAO_OutStream::gen_endif (void)
{
*this << "\n#endif /* end #if !defined */\n\n";
+
return 0;
}
-// ifdef generation
+// ifdef generation.
int
TAO_OutStream::gen_ifdef_AHETI (void)
{
*this << "\n"
<< "#if !defined (TAO_USE_SEQUENCE_TEMPLATES)"
<< be_idt_nl;
+
return 0;
}
@@ -262,6 +289,7 @@ TAO_OutStream::gen_else_AHETI (void)
{
*this << "\n#else /* TAO_USE_SEQUENCE_TEMPLATES */"
<< be_nl;
+
return 0;
}
@@ -271,20 +299,28 @@ TAO_OutStream::gen_endif_AHETI (void)
*this << be_uidt
<< "\n#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ "
<< be_nl;
+
return 0;
}
-// printf style variable argument print
+// Printf style variable argument print.
int
TAO_OutStream::print (const char *format, ...)
{
int result = 0;
va_list ap;
va_start (ap, format);
- ACE_OSCALL (::vfprintf (this->fp_, format, ap), int, -1, result);
- ACE_OS::fflush (fp_);
+ ACE_OSCALL (::vfprintf (this->fp_,
+ format,
+ ap),
+ int,
+ -1,
+ result);
+
+ ACE_OS::fflush (this->fp_);
va_end (ap);
+
return result;
}
@@ -292,63 +328,89 @@ TAO_OutStream &
TAO_OutStream::operator<< (const char *str)
{
ACE_OS::fprintf (this->fp_, "%s", str);
- ACE_OS::fflush (fp_);
+ ACE_OS::fflush (this->fp_);
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const ACE_CDR::UShort num)
{
- ACE_OS::fprintf (this->fp_, "%hu", num);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%hu",
+ num);
+
+ ACE_OS::fflush (this->fp_);
+
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const ACE_CDR::Short num)
{
- ACE_OS::fprintf (this->fp_, "%hd", num);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%hd",
+ num);
+
+ ACE_OS::fflush (this->fp_);
+
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const ACE_CDR::ULong num)
{
- ACE_OS::fprintf (this->fp_, "%lu", (unsigned long) num);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%lu",
+ (unsigned long) num);
+
+ ACE_OS::fflush (this->fp_);
+
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const ACE_CDR::Long num)
{
- ACE_OS::fprintf (this->fp_, "%ld", (long) num);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%ld",
+ (long) num);
+
+ ACE_OS::fflush (this->fp_);
+
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const unsigned long num)
{
- ACE_OS::fprintf (this->fp_, "%lu", num);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%lu",
+ num);
+
+ ACE_OS::fflush (this->fp_);
+
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const long num)
{
- ACE_OS::fprintf (this->fp_, "%ld", num);
- ACE_OS::fflush (fp_);
+ ACE_OS::fprintf (this->fp_,
+ "%ld",
+ num);
+
+ ACE_OS::fflush (this->fp_);
+
return *this;
}
TAO_OutStream &
TAO_OutStream::operator<< (const TAO_NL&)
{
- ACE_OS::fprintf (this->fp_ , "\n");
+ ACE_OS::fprintf (this->fp_ ,
+ "\n");
this->indent ();
+
return *this;
}
@@ -356,8 +418,12 @@ TAO_OutStream &
TAO_OutStream::operator<< (const TAO_INDENT& i)
{
this->incr_indent (0);
+
if (i.do_now_)
- this->nl ();
+ {
+ this->nl ();
+ }
+
return *this;
}
@@ -365,8 +431,12 @@ TAO_OutStream &
TAO_OutStream::operator<< (const TAO_UNINDENT& i)
{
this->decr_indent (0);
+
if (i.do_now_)
- this->nl ();
+ {
+ this->nl ();
+ }
+
return *this;
}
diff --git a/TAO/TAO_IDL/be/be_init.cpp b/TAO/TAO_IDL/be/be_init.cpp
deleted file mode 100644
index 1c81b64f288..00000000000
--- a/TAO/TAO_IDL/be/be_init.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-// BE_init.cc - Initialization for dummy BE
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "../../tao/Version.h"
-
-ACE_RCSID(be, be_init, "$Id$")
-
-/*
- * Initialize the BE. The protocol requires only that this routine
- * return an instance of AST_Generator (or a subclass thereof).
- *
- * Remember that none of the FE initialization has been done, when you
- * add stuff here.
- */
-AST_Generator *
-BE_init()
-{
- tao_cg = TAO_CODEGEN::instance ();
- AST_Generator *g = new be_generator();
-
- if (g == NULL) {
- cerr << GTDEVEL("IDL: BE init failed to create generator, exiting\n");
- ACE_OS::exit (99);
- }
- return g;
-}
-
-/*
- * Print out a version string for the BE
- */
-void
-BE_version()
-{
- cerr << GTDEVEL("TAO C++ BE, version ")
- << GTDEVEL(TAO_VERSION)
- << endl;
-}
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 5d66101d689..3741c62a52c 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -28,22 +28,20 @@
ACE_RCSID(be, be_interface, "$Id$")
-/*
- * BE_Interface
- */
-// default constructor
+// Default constructor.
be_interface::be_interface (void)
: skel_count_ (0),
in_mult_inheritance_ (-1),
- strategy_ (new be_interface_default_strategy (this)),
original_interface_ (0)
{
+ ACE_NEW (this->strategy_,
+ be_interface_default_strategy (this));
this->size_type (be_decl::VARIABLE); // always the case
this->has_constructor (I_TRUE); // always the case
}
-// constructor used to build the AST
+// Constructor used to build the AST.
be_interface::be_interface (UTL_ScopedName *n,
AST_Interface **ih,
long nih,
@@ -52,15 +50,26 @@ be_interface::be_interface (UTL_ScopedName *n,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Interface (n, ih, nih, ih_flat, nih_flat, p, local, abstract),
- AST_Decl (AST_Decl::NT_interface, n, p),
+ : AST_Interface (n,
+ ih,
+ nih,
+ ih_flat,
+ nih_flat,
+ p,
+ local,
+ abstract),
+ AST_Decl (AST_Decl::NT_interface,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_interface),
- COMMON_Base (local, abstract),
+ COMMON_Base (local,
+ abstract),
skel_count_ (0),
in_mult_inheritance_ (-1),
- strategy_ (new be_interface_default_strategy (this)),
original_interface_ (0)
{
+ ACE_NEW (this->strategy_,
+ be_interface_default_strategy (this));
this->size_type (be_decl::VARIABLE); // always the case
this->has_constructor (I_TRUE); // always the case
}
@@ -68,8 +77,11 @@ be_interface::be_interface (UTL_ScopedName *n,
be_interface::~be_interface (void)
{
// We know that it cannot be 0, but..
- if (!this->strategy_)
- delete this->strategy_;
+ if (this->strategy_ != 0)
+ {
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
}
be_interface_strategy *
@@ -78,7 +90,9 @@ be_interface::set_strategy (be_interface_strategy *new_strategy)
be_interface_strategy *old = this->strategy_;
if (new_strategy != 0)
- this->strategy_ = new_strategy;
+ {
+ this->strategy_ = new_strategy;
+ }
return old;
}
@@ -87,56 +101,56 @@ be_interface::set_strategy (be_interface_strategy *new_strategy)
const char *
be_interface::local_name (void) const
{
- // return the local name
+ // Return the local name.
return this->strategy_->local_name ();
}
const char *
be_interface::full_name (void) const
{
- // return the stringified full name
+ // Return the stringified full name.
return this->strategy_->full_name ();
}
const char *
be_interface::flat_name (void) const
{
- // return the flattened full scoped name.
+ // Return the flattened full scoped name.
return this->strategy_->flat_name ();
}
const char *
be_interface::repoID (void) const
{
- // retrieve the repository ID.
+ // Retrieve the repository ID.
return this->strategy_->repoID ();
}
const char *
be_interface::full_skel_name (void) const
{
- // retrieve the fully scoped skel class name.
+ // Retrieve the fully scoped skel class name.
return this->strategy_->full_skel_name ();
}
const char *
be_interface::full_coll_name (int type) const
{
- // retrieve the fully qualified collocated class name
+ // Retrieve the fully qualified collocated class name
return this->strategy_->full_coll_name (type);
}
const char *
be_interface::local_coll_name (int type) const
{
- // retrieve the fully qualified collocated class name.
+ // Retrieve the fully qualified collocated class name.
return this->strategy_->local_coll_name (type);
}
const char *
be_interface::relative_skel_name (const char *skel_name)
{
- // relative skeleton name
+ // Relative skeleton name.
return this->strategy_->relative_skel_name (skel_name);
}
@@ -145,164 +159,217 @@ void
be_interface::compute_full_skel_name (const char *prefix,
char *&skelname)
{
- if (skelname)
- return;
+ if (skelname != 0)
+ {
+ return;
+ }
else
{
- long namelen;
- UTL_IdListActiveIterator *i;
+ long namelen = ACE_OS::strlen (prefix);
+ UTL_IdListActiveIterator *i = 0;
long first = I_TRUE;
long second = I_FALSE;
- // in the first loop compute the total length
- namelen = ACE_OS::strlen (prefix);
- i = new UTL_IdListActiveIterator (this->name ());
- while (!(i->is_done ()))
+ // In the first loop compute the total length.
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
+ while (!i->is_done ())
{
if (!first)
- namelen += 2; // for "::"
+ {
+ namelen += 2; // for "::"
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
- namelen += ACE_OS::strlen (i->item ()->get_string ()); //
- // additional 4 for the POA_ characters
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
+ namelen += ACE_OS::strlen (i->item ()->get_string ());
+
+ // Additional 4 for the POA_ characters.
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
- ACE_NEW (skelname, char [namelen+1]);
+ ACE_NEW (skelname,
+ char [namelen+1]);
skelname[0] = '\0';
first = I_TRUE;
second = I_FALSE;
ACE_OS::strcat (skelname, prefix);
- i = new UTL_IdListActiveIterator (this->name ());
- while (!(i->is_done ()))
+
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (this->name ()));
+
+ while (!i->is_done ())
{
if (!first)
- ACE_OS::strcat (skelname, "::");
+ {
+ ACE_OS::strcat (skelname, "::");
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
ACE_OS::strcat (skelname, i->item ()->get_string ());
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
delete i;
}
- return;
}
const char*
be_interface::relative_name (const char *localname,
const char *othername)
{
- // some compilers do not like generating a fully scoped name for a
+ // Some compilers do not like generating a fully scoped name for a
// type that was defined in the same enclosing scope in which it was
// defined. We have to emit just the partial name, relative to our
- // "localname"
+ // "localname".
// The tricky part here is that it is not enough to check if the
// typename we are using was defined in the current scope. But we
// need to ensure that it was not defined in any of our ancestor
// scopes as well. If that is the case, then we can generate a fully
- // scoped name for that type, else we use the ACE_NESTED_CLASS macro
+ // scoped name for that type, else we use the ACE_NESTED_CLASS macro.
- // thus we need some sort of relative name to be generated
+ // Thus we need some sort of relative name to be generated.
static char macro [NAMEBUFSIZE];
- // UNUSED: be_decl *def_scope = 0; // our defining scope
- char // hold the fully scoped name
- def_name [NAMEBUFSIZE],
- use_name [NAMEBUFSIZE];
- char // these point to the curr and next component in the scope
- *def_curr = def_name,
- *def_next,
- *use_curr = use_name,
- *use_next;
-
- ACE_OS::memset (macro, '\0', NAMEBUFSIZE);
- ACE_OS::memset (def_name, '\0', NAMEBUFSIZE);
- ACE_OS::memset (use_name, '\0', NAMEBUFSIZE);
-
- // traverse every component of the def_scope and use_scope beginning at the
+
+ // Hold the fully scoped name.
+ char def_name [NAMEBUFSIZE];
+ char use_name [NAMEBUFSIZE];
+
+ // These point to the curr and next component in the scope.
+ char *def_curr = def_name;
+ char *def_next;
+ char *use_curr = use_name;
+ char *use_next;
+
+ ACE_OS::memset (macro,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (def_name,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (use_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ // Traverse every component of the def_scope and use_scope beginning at the
// root and proceeding towards the leaf trying to see if the components
// match. Continue until there is a match and keep accumulating the path
// traversed. This forms the first argument to the ACE_NESTED_CLASS
// macro. Whenever there is no match, the remaining components of the
- // def_scope form the second argument
+ // def_scope form the second argument.
- ACE_OS::strcpy (def_name, localname);
- ACE_OS::strcpy (use_name, othername);
+ ACE_OS::strcpy (def_name,
+ localname);
+ ACE_OS::strcpy (use_name,
+ othername);
while (def_curr && use_curr)
{
- // find the first occurrence of a :: and advance the next pointers accordingly
+ // Find the first occurrence of a ::
+ // and advance the next pointers accordingly.
def_next = ACE_OS::strstr (def_curr, "::");
use_next = ACE_OS::strstr (use_curr, "::");
if (def_next)
- *def_next = 0;
+ {
+ *def_next = 0;
+ }
if (use_next)
- *use_next = 0;
+ {
+ *use_next = 0;
+ }
if (!ACE_OS::strcmp (def_curr, use_curr))
{
- // they have same prefix, append to arg1
- def_curr = (def_next ? (def_next+2) : 0); // skip the ::
- use_curr = (use_next ? (use_next+2) : 0); // skip the ::
+ // They have same prefix, append to arg1.
+ def_curr = (def_next ? (def_next+2) : 0); // Skip the ::
+ use_curr = (use_next ? (use_next+2) : 0); // Skip the ::
}
else
{
- // we had overwritten a ':' by a '\0' for string comparison. We
+ // We had overwritten a ':' by a '\0' for string comparison. We
// revert back because we want the rest of the relative name to be
- // used
+ // used.
if (def_next)
- *def_next = ':';
+ {
+ *def_next = ':';
+ }
if (use_next)
- *use_next = ':';
+ {
+ *use_next = ':';
+ }
- // no match. This is the end of the first argument. Get out
- // of the loop as no more comparisons are necessary
+ // No match. This is the end of the first argument. Get out
+ // of the loop as no more comparisons are necessary.
break;
}
}
- // start the 2nd argument of the macro
+ // Start the 2nd argument of the macro.
- // copy the remaining def_name (if any left)
+ // Copy the remaining def_name (if any left)
if (def_curr)
- ACE_OS::strcat (macro, def_curr);
+ {
+ ACE_OS::strcat (macro,
+ def_curr);
+ }
return macro;
}
-// Am I in some kind of a multiple inheritance
+// Am I in some kind of a multiple inheritance?
int be_interface::in_mult_inheritance (void)
{
if (this->in_mult_inheritance_ == -1)
{
- // compute once for all
- // determine if we are in some form of a multiple inheritance
- if (this->traverse_inheritance_graph
- (be_interface::in_mult_inheritance_helper, 0) == -1)
+ // Compute once for all.
+ // Determine if we are in some form of a multiple inheritance.
+ if (this->traverse_inheritance_graph (
+ be_interface::in_mult_inheritance_helper,
+ 0
+ ) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_interface::in_mult_inheritance "
@@ -317,36 +384,45 @@ int be_interface::in_mult_inheritance (void)
void be_interface::in_mult_inheritance (int mi)
{
if (this->in_mult_inheritance_ == -1)
- this->in_mult_inheritance_ = mi;
+ {
+ this->in_mult_inheritance_ = mi;
+ }
}
-//gen copy constructors
+// Gen copy constructors,
void
-be_interface::gen_copy_ctors (TAO_OutStream* os)
+be_interface::gen_copy_ctors (TAO_OutStream *os)
{
- this->traverse_inheritance_graph(be_interface::gen_copy_ctors_helper,os);
+ this->traverse_inheritance_graph (
+ be_interface::gen_copy_ctors_helper,
+ os
+ );
+
return;
}
int
-be_interface::gen_copy_ctors_helper (be_interface* node, be_interface* base, TAO_OutStream *os)
+be_interface::gen_copy_ctors_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
{
static int first = 0;
- if(node != base)
+
+ if (node != base)
{
- if(first)
+ if (first)
{
- *os << idl_global->impl_class_prefix () << base->flat_name ()
- << idl_global->impl_class_suffix () << " (t)"
+ *os << be_global->impl_class_prefix () << base->flat_name ()
+ << be_global->impl_class_suffix () << " (t)"
<< ", " << base->full_skel_name () << " (t)";
+
first = 0;
}
else
{
- *os << ", " << idl_global->impl_class_prefix () << base->flat_name ()
- << idl_global->impl_class_suffix () << " (t)"
+ *os << ", " << be_global->impl_class_prefix () << base->flat_name ()
+ << be_global->impl_class_suffix () << " (t)"
<< ", " << base->full_skel_name () << " (t)"; ;
-
}
}
else
@@ -356,36 +432,42 @@ be_interface::gen_copy_ctors_helper (be_interface* node, be_interface* base, TAO
}
return 1;
-
}
-//generate default constructors
+// Generate default constructors.
void
-be_interface::gen_def_ctors (TAO_OutStream* os)
+be_interface::gen_def_ctors (TAO_OutStream *os)
{
- this->traverse_inheritance_graph(be_interface::gen_def_ctors_helper,os);
+ this->traverse_inheritance_graph (
+ be_interface::gen_def_ctors_helper,
+ os
+ );
+
return;
}
int
-be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_OutStream *os)
+be_interface::gen_def_ctors_helper (be_interface* node,
+ be_interface* base,
+ TAO_OutStream *os)
{
static int first = 0;
+
if(node != base)
{
if(first)
{
- *os << idl_global->impl_class_prefix () << base->flat_name ()
- << idl_global->impl_class_suffix () << " ()";
+ *os << be_global->impl_class_prefix () << base->flat_name ()
+ << be_global->impl_class_suffix () << " ()";
+
first = 0;
}
else
{
- *os << ", " << idl_global->impl_class_prefix () << base->flat_name ()
- << idl_global->impl_class_suffix () << " ()";
-
+ *os << ", " << be_global->impl_class_prefix () << base->flat_name ()
+ << be_global->impl_class_suffix () << " ()";
}
}
else
@@ -395,15 +477,14 @@ be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_
}
return 1;
-
}
-// generate the var definition. If <interface_name> is not 0, generate
+// Generate the var definition. If <interface_name> is not 0, generate
// the var defn for that name. Otherwise, do it for the interface you
// are visiting (this).
int
-be_interface::gen_var_defn (char* interface_name)
+be_interface::gen_var_defn (char *interface_name)
{
TAO_OutStream *ch; // output stream
TAO_NL nl; // end line
@@ -411,7 +492,9 @@ be_interface::gen_var_defn (char* interface_name)
// Decide which name to use.
if (interface_name == 0)
- interface_name = (char *) this->local_name ();
+ {
+ interface_name = (char *) this->local_name ();
+ }
// Buffer with name of the var class.
ACE_OS::memset (namebuf,
@@ -422,66 +505,62 @@ be_interface::gen_var_defn (char* interface_name)
"%s_var",
interface_name);
- // Retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
-
- // generate the var definition (always in the client header).
+ // Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << " : public TAO_Base_var" << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // default constr
+ // Default constructor.
*ch << namebuf << " (void); // default constructor" << nl;
*ch << namebuf << " (" << interface_name << "_ptr p)"
<< " : ptr_ (p) {} " << nl;
- // copy constructor
- *ch << namebuf << " (const " << namebuf <<
- " &); // copy constructor" << nl;
+ // Copy constructor.
+ *ch << namebuf << " (const " << namebuf
+ << " &); // copy constructor" << nl;
- // destructor
+ // Destructor.
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
+ // Assignment operator from a pointer.
*ch << namebuf << " &operator= (" << interface_name << "_ptr);" << nl;
- // assignment from _var
+ // Assignment from _var.
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
- // arrow operator
+ // Arrow operator
*ch << interface_name << "_ptr operator-> (void) const;" << nl;
-
*ch << nl;
- // other extra types (cast operators, [] operator, and others)
+ // Other extra types (cast operators, [] operator, and others).
*ch << "operator const " << interface_name << "_ptr &() const;" << nl;
*ch << "operator " << interface_name << "_ptr &();" << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
+ // The return types of in, out, inout, and _retn are based on the parameter
+ // passing rules and the base type.
*ch << interface_name << "_ptr in (void) const;" << nl;
*ch << interface_name << "_ptr &inout (void);" << nl;
*ch << interface_name << "_ptr &out (void);" << nl;
*ch << interface_name << "_ptr _retn (void);" << nl;
- // generate an additional member function that returns the underlying pointer
+ // Generate an additional member function that returns
+ // the underlying pointer.
*ch << interface_name << "_ptr ptr (void) const;\n";
-
*ch << "\n";
ch->decr_indent ();
- // private
+ // Private.
*ch << "private:\n";
ch->incr_indent ();
*ch << interface_name << "_ptr ptr_;" << nl;
@@ -495,7 +574,7 @@ be_interface::gen_var_defn (char* interface_name)
return 0;
}
-// implementation of the _var class. All of these get generated in the
+// Implementation of the _var class. All of these get generated in the
// inline file.
// If the argument is 0, then use the name in <this>, otherwise use
// the name given. Just making the class more useful.
@@ -533,12 +612,9 @@ be_interface::gen_var_impl (char *interface_local_name,
"%s_var",
interface_local_name);
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ci = tao_cg->client_inline ();
- ci = cg->client_inline ();
-
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we
// account for over here.
@@ -549,7 +625,7 @@ be_interface::gen_var_impl (char *interface_local_name,
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // default constr
+ // Default constructor.
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname
<< " (void) // default constructor" << nl;
@@ -557,7 +633,7 @@ be_interface::gen_var_impl (char *interface_local_name,
<< "::_nil ())" << nl;
*ci << "{}\n\n";
- // the additional ptr () member function. This member function must be
+ // The additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
@@ -570,7 +646,7 @@ be_interface::gen_var_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << "::" << interface_full_name
@@ -579,7 +655,7 @@ be_interface::gen_var_impl (char *interface_local_name,
*ci << " ptr_ (" << interface_local_name << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
- // destructor
+ // Destructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -589,7 +665,7 @@ be_interface::gen_var_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator
+ // Assignment operator.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << interface_local_name
@@ -602,7 +678,7 @@ be_interface::gen_var_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const "
@@ -621,7 +697,7 @@ be_interface::gen_var_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator const " << "::" << interface_full_name
@@ -719,39 +795,44 @@ be_interface::gen_out_defn (char *interface_name)
"%s_out",
interface_name);
- // Retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
+ ch = tao_cg->client_header ();
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
+ // Generate the out definition (always in the client header)
+ // start with whatever was our current indent level.
+ ch->indent ();
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // No default constructor
+ // No default constructor.
- // constructor from a pointer
+ // Constructor from a pointer.
*ch << namebuf << " (" << interface_name << "_ptr &);" << nl;
- // constructor from a _var &
+
+ // Constructor from a _var &.
*ch << namebuf << " (" << interface_name << "_var &);" << nl;
- // constructor from a _out &
+
+ // Constructor from a _out &.
*ch << namebuf << " (const " << namebuf << " &);" << nl;
- // assignment operator from a _out &
+
+ // Assignment operator from a _out &
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // only interface allows assignment from var &
+
+ // Assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators.
+ // Only interface allows assignment from var &.
*ch << namebuf << " &operator= (const " << interface_name << "_var &);" << nl;
*ch << namebuf << " &operator= (" << interface_name << "_ptr);" << nl;
- // cast
+
+ // Cast.
*ch << "operator " << interface_name << "_ptr &();" << nl;
+
// ptr fn
*ch << interface_name << "_ptr &ptr (void);" << nl;
+
// operator ->
*ch << interface_name << "_ptr operator-> (void);" << nl;
@@ -763,6 +844,7 @@ be_interface::gen_out_defn (char *interface_name)
ch->decr_indent ();
*ch << "};\n\n";
+
return 0;
}
@@ -793,23 +875,21 @@ be_interface::gen_out_impl (char *interface_local_name,
ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
ACE_OS::sprintf (lname, "%s_out", interface_local_name);
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // constr from a _ptr
+ // Constructor from a _ptr.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << interface_local_name
@@ -822,7 +902,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // constructor from _var &
+ // Constructor from _var &.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << interface_local_name
@@ -836,7 +916,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << "::" << interface_full_name
@@ -845,7 +925,7 @@ be_interface::gen_out_impl (char *interface_local_name,
<< "_out &, p).ptr_)" << nl;
*ci << "{}\n\n";
- // assignment operator from _out &
+ // Assignment operator from _out &.
ci->indent ();
*ci << "ACE_INLINE ::" << fname << " &" << nl;
*ci << fname << "::operator= (const " << "::" << interface_full_name
@@ -858,7 +938,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << "::" << interface_full_name
@@ -871,7 +951,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _ptr
+ // Assignment operator from _ptr.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << interface_local_name
@@ -883,7 +963,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator " << "::" << interface_full_name
@@ -894,7 +974,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // ptr function
+ // ptr function.
ci->indent ();
*ci << "ACE_INLINE " << "::" << interface_full_name << "_ptr &" << nl;
*ci << fname << "::ptr (void) // ptr" << nl;
@@ -904,7 +984,7 @@ be_interface::gen_out_impl (char *interface_local_name,
ci->decr_indent ();
*ci << "}\n\n";
- // operator->
+ // operator->
ci->indent ();
*ci << "ACE_INLINE " << "::" << interface_full_name << "_ptr" << nl;
*ci << fname << "::operator-> (void)" << nl;
@@ -917,27 +997,23 @@ be_interface::gen_out_impl (char *interface_local_name,
return 0;
}
-// helper.
+// Helper.
int
-be_interface::gen_operation_table ()
+be_interface::gen_operation_table (void)
{
TAO_OutStream *os; // output stream.
TAO_NL nl; // end line.
- // Retrieve the singleton instance of the CodeGen.
- TAO_CodeGen *cg = 0;
- cg = TAO_CODEGEN::instance ();
-
// Check out the op_lookup_strategy.
- switch (cg->lookup_strategy ())
- {
- case TAO_CodeGen::TAO_DYNAMIC_HASH:
+ switch (be_global->lookup_strategy ())
+ {
+ case BE_GlobalData::TAO_DYNAMIC_HASH:
// Init the outstream appropriately.
os = this->strategy_->get_out_stream ();
- // start from current indentation level.
+ // Start from current indentation level.
os->indent ();
// Start the table generation.
@@ -953,7 +1029,7 @@ be_interface::gen_operation_table ()
"inheritance graph traversal failed\n"), -1);
}
- // generate the skeleton for the is_a method.
+ // Generate the skeleton for the is_a method.
os->indent ();
*os << "{\"_is_a\", &" << this->full_skel_name () << "::_is_a_skel},\n";
this->skel_count_++;
@@ -986,13 +1062,13 @@ be_interface::gen_operation_table ()
break;
- case TAO_CodeGen::TAO_LINEAR_SEARCH:
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
// For generating linear search also, we are calling GPERF
// only.
- case TAO_CodeGen::TAO_BINARY_SEARCH:
+ case BE_GlobalData::TAO_BINARY_SEARCH:
// For generating binary search also, we are calling GPERF
// only.
- case TAO_CodeGen::TAO_PERFECT_HASH:
+ case BE_GlobalData::TAO_PERFECT_HASH:
// For each interface in the IDL, have a new temp file to
// collect the input for the gperf program.
{
@@ -1003,13 +1079,14 @@ be_interface::gen_operation_table ()
ACE_OS::strlen (this->flat_name ()) +
ACE_OS::strlen (".gperf") + 1],
-1);
+
ACE_OS::sprintf (temp_file,
"%s%s.gperf",
idl_global->temp_dir (),
this->flat_name ());
// Save this file name with the codegen singleton.
- cg->gperf_input_filename (temp_file);
+ tao_cg->gperf_input_filename (temp_file);
// Make a new outstream to hold the gperf_temp_file for this
// interface.
@@ -1020,36 +1097,47 @@ be_interface::gen_operation_table ()
// Get a new instance for the temp file.
os = factory->make_outstream ();
+
if (os == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ss",
- "::",
- "visit_interface-",
- "make_outstream failed\n"),
- -1);
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss",
+ "::",
+ "visit_interface-",
+ "make_outstream failed\n"),
+ -1);
+ }
// Store the outstream with the codegen singleton.
- cg->gperf_input_stream (os);
+ tao_cg->gperf_input_stream (os);
// Open the temp file.
if (os->open (temp_file,
- TAO_OutStream::TAO_GPERF_INPUT) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ss",
- "::",
- "visit_interface-",
- "gperf_input.tmp file open failed\n"),
- -1);
+ TAO_OutStream::TAO_GPERF_INPUT)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss",
+ "::",
+ "visit_interface-",
+ "gperf_input.tmp file open failed\n"),
+ -1);
+ }
// Add the gperf input header.
this->gen_gperf_input_header (os);
// Traverse the graph.
- if (this->traverse_inheritance_graph (be_interface::gen_optable_helper, os) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_operation_table - "
- "inheritance graph traversal failed\n"),
- -1);
+ if (this->traverse_inheritance_graph (
+ be_interface::gen_optable_helper,
+ os
+ ) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
// Generate the skeleton for the is_a method.
os->indent ();
@@ -1069,6 +1157,7 @@ be_interface::gen_operation_table ()
// for the gperf.
this->gen_gperf_things ();
}
+
break;
default:
@@ -1078,7 +1167,8 @@ be_interface::gen_operation_table ()
"gen_operation_table",
"unknown op_lookup_strategy\n"),
-1);
- }
+ }
+
return 0;
}
@@ -1106,16 +1196,13 @@ be_interface::gen_gperf_input_header (TAO_OutStream *os)
int
be_interface::gen_optable_entries (be_interface *derived)
{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- TAO_OutStream *os; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ UTL_ScopeActiveIterator *si = 0;
+ AST_Decl *d = 0;
+ TAO_OutStream *os = 0;
- switch (cg->lookup_strategy ())
- {
- case TAO_CodeGen::TAO_DYNAMIC_HASH:
+ switch (be_global->lookup_strategy ())
+ {
+ case BE_GlobalData::TAO_DYNAMIC_HASH:
// Init the outstream.
os = this->strategy_->get_out_stream ();
@@ -1127,27 +1214,32 @@ be_interface::gen_optable_entries (be_interface *derived)
// attributes defined by "this" which happens to be the same as "derived"
// or one of its ancestors.
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
+ // Instantiate a scope iterator.
- while (!(si->is_done ()))
+ while (!si->is_done ())
{
// get the next AST decl node
d = si->item ();
+
if (d->node_type () == AST_Decl::NT_op)
{
- // Start from current indentation level
+ // Start from current indentation level.
os->indent ();
- // we are an operation node
+ // We are an operation node.
*os << "{\"" << d->original_local_name () << "\", &"
<< derived->full_skel_name () << "::"
<< d->local_name () << "_skel},\n";
+
derived->skel_count_++;
}
else if (d->node_type () == AST_Decl::NT_attr)
{
- AST_Attribute *attr;
+ AST_Attribute *attr = 0;
// Start from current indentation level.
os->indent ();
@@ -1161,31 +1253,38 @@ be_interface::gen_optable_entries (be_interface *derived)
derived->skel_count_++;
attr = AST_Attribute::narrow_from_decl (d);
- if (!attr)
- return -1;
+
+ if (attr == 0)
+ {
+ return -1;
+ }
if (!attr->readonly ())
{
- // the set method
- os->indent (); // start from current indentation level
+ // The set method
+ os->indent (); // Start from current indentation level.
*os << "{\"_set_" << d->original_local_name ()
<< "\", &" << derived->full_skel_name ()
<< "::_set_" << d->local_name () << "_skel},\n";
+
derived->skel_count_++;
}
}
+
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
+
break;
- case TAO_CodeGen::TAO_LINEAR_SEARCH:
- case TAO_CodeGen::TAO_BINARY_SEARCH:
- case TAO_CodeGen::TAO_PERFECT_HASH:
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
+ case BE_GlobalData::TAO_BINARY_SEARCH:
+ case BE_GlobalData::TAO_PERFECT_HASH:
// We call GPERF for all these three strategies.
// Init the outstream.
- os = cg->gperf_input_stream ();
+ os = tao_cg->gperf_input_stream ();
if (this->nmembers () > 0)
{
@@ -1193,19 +1292,20 @@ be_interface::gen_optable_entries (be_interface *derived)
// attributes defined by "this" which happens to be the same as "derived"
// or one of its ancestors.
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
+ // Instantiate a scope iterator.
- while (!(si->is_done ()))
+ while (!si->is_done ())
{
// Get the next AST decl node.
d = si->item ();
if (d->node_type () == AST_Decl::NT_op)
{
- //
// Generate operation name.
- //
// Start from current indentation level
os->indent ();
@@ -1215,39 +1315,48 @@ be_interface::gen_optable_entries (be_interface *derived)
*os << d->original_local_name () << ",\t&"
<< derived->full_skel_name () << "::"
<< d->local_name () << "_skel" << "\n";
+
derived->skel_count_++;
}
else if (d->node_type () == AST_Decl::NT_attr)
{
- AST_Attribute *attr;
+ AST_Attribute *attr = 0;
- // Start from current indentation level
+ // Start from current indentation level.
os->indent ();
- // Generate only the "get" entry if we are readonly
+ // Generate only the "get" entry if we are readonly.
*os << "_get_" << d->original_local_name () << ",\t&"
<< derived->full_skel_name () << "::_get_"
<< d->local_name () << "_skel\n";
+
derived->skel_count_++;
attr = AST_Attribute::narrow_from_decl (d);
- if (!attr)
- return -1;
+
+ if (attr == 0)
+ {
+ return -1;
+ }
if (!attr->readonly ())
{
- // the set method
- os->indent (); // start from current indentation level
+ // The set method
+ os->indent (); // Start from current indentation level.
*os << "_set_" << d->original_local_name () << ",\t&"
<< derived->full_skel_name () << "::_set_"
<< d->local_name () << "_skel\n";
+
derived->skel_count_++;
}
}
+
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
+
break;
default:
@@ -1257,164 +1366,193 @@ be_interface::gen_optable_entries (be_interface *derived)
"gen_optable_entries",
"unknown op_lookup_strategy\n"),
-1);
- }
+ }
+
return 0;
}
-// template method that traverses the inheritance graph in a breadth-first
+// Template method that traverses the inheritance graph in a breadth-first
// style. The actual work on each element in the inheritance graph is carried
-// out by the function passed as argument
+// out by the function passed as argument.
int
be_interface::traverse_inheritance_graph (be_interface::tao_code_emitter gen,
TAO_OutStream *os)
{
- long i; // loop index
- ACE_Unbounded_Queue <be_interface*> queue; // Queue data structure needed for
- // breadth-first traversal of
- // inheritance tree
+ // Loop index.
+ long i;
+
+ // Queue data structure needed for breadth-first traversal of
+ // inheritance tree.
+ ACE_Unbounded_Queue <be_interface*> queue;
// For a special case of a deeply nested inheritance graph and one specific
- // way of inheritance in which a node that was already visited, but is not present in
+ // way of inheritance in which a node that was already visited,
+ // but is not present in
// the queue, gets inserted at the tail. This situation arises when a node
// multiply inherits from two or more interfaces in which the first parent is
// higher up in the tree than the second parent. In addition, if the second
// parent turns out to be a child of the first .
- ACE_Unbounded_Queue <be_interface*> del_queue; // queue of dequeued nodes to
- // be searched for the above case
+ // Queue of dequeued nodes to be searched for the above case.
+ ACE_Unbounded_Queue <be_interface*> del_queue;
- // insert ourselves in the Queue
+ // Insert ourselves in the queue.
if (queue.enqueue_tail (this) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_interface::traverse_inheritance_graph - "
- "error generating entries\n"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::traverse_inheritance_graph - "
+ "error generating entries\n"),
+ -1);
}
- // do until queue is empty
+ // Do until queue is empty.
while (!queue.is_empty ())
{
be_interface *bi; // element inside the queue
- // use breadth-first strategy i.e., first generate entries for ourselves,
+ // Use breadth-first strategy i.e., first generate entries for ourselves,
// followed by nodes that we immediately inherit from, and so on. In the
// process make sure that we do not generate code for the same node more
// than once. Such a case may arise due to multiple inheritance forming a
// diamond like inheritance graph.
- // dequeue the element at the head of the queue
+ // Dequeue the element at the head of the queue.
if (queue.dequeue_head (bi))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::traverse_graph - "
- "dequeue_head failed\n"), -1);
+ "dequeue_head failed\n"),
+ -1);
}
- // insert the dequeued element in the del_queue
+ // Insert the dequeued element in the del_queue.
if (del_queue.enqueue_tail (bi) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::traverse_graph - "
- "enqueue_head failed\n"), -1);
+ "enqueue_head failed\n"),
+ -1);
}
- // use the helper method to generate code for ourself using the
+ // Use the helper method to generate code for ourself using the
// properties of the element dequeued. For the first iteration, the
- // element dequeued and "this" will be the same i.e., ourselves
+ // element dequeued and "this" will be the same i.e., ourselves.
if (gen (this, bi, os) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::traverse_graph - "
- "helper code gen failed\n"), -1);
+ "helper code gen failed\n"),
+ -1);
}
- // now check if the dequeued element has any ancestors. If yes, insert
- // them inside the queue making sure that there are no duplicates
+ // Now check if the dequeued element has any ancestors. If yes, insert
+ // them inside the queue making sure that there are no duplicates.
for (i=0; i < bi->n_inherits (); i++)
{
- be_interface *parent; // parent of the dequeued element
+ // Parent of the dequeued element.
+ be_interface *parent;
- // initialize an iterator to search the queue for duplicates
+ // Initialize an iterator to search the queue for duplicates.
ACE_Unbounded_Queue_Iterator<be_interface*> q_iter (queue);
- // retrieve the next parent from which the dequeued element inherits
+ // Retrieve the next parent from which the dequeued element inherits.
parent = be_interface::narrow_from_decl (bi->inherits ()[i]);
- if (!parent)
+
+ if (parent == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_server_skeletons - "
- "bad inherited interface\n"), -1);
+ "(%N:%l) be_interface::gen_server_skeletons -"
+ " bad inherited interface\n"),
+ -1);
}
- // now insert this node at the tail of the queue, but make sure that
- // it doesn't already exist in the queue
+ // Now insert this node at the tail of the queue, but make sure that
+ // it doesn't already exist in the queue.
int found = 0;
+
while (!q_iter.done ())
{
- be_interface **temp; // queue element
+ // Queue element.
+ be_interface **temp;
(void) q_iter.next (temp);
- if (!ACE_OS::strcmp (parent->full_name (), (*temp)->full_name ()))
+ if (!ACE_OS::strcmp (parent->full_name (),
+ (*temp)->full_name ()))
{
- // we exist in this queue and cannot be inserted
+ // We exist in this queue and cannot be inserted.
found = 1;
}
if (found)
- break;
+ {
+ break;
+ }
+
(void) q_iter.advance ();
- } // end of while
+ }
- // initialize an iterator to search the del_queue for duplicates
+ // Initialize an iterator to search the del_queue for duplicates.
ACE_Unbounded_Queue_Iterator<be_interface*> del_q_iter (del_queue);
while (!found && !del_q_iter.done ())
{
- be_interface **temp; // queue element
+ // Queue element.
+ be_interface **temp;
(void) del_q_iter.next (temp);
- if (!ACE_OS::strcmp (parent->full_name (), (*temp)->full_name ()))
+
+ if (!ACE_OS::strcmp (parent->full_name (),
+ (*temp)->full_name ()))
{
- // we exist in this del_queue and cannot be inserted
+ // We exist in this del_queue and cannot be inserted.
found = 1;
}
+
if (found)
- break;
+ {
+ break;
+ }
+
(void) del_q_iter.advance ();
- } // end of while
+ }
if (!found)
{
- // insert the parent in the queue
+ // Insert the parent in the queue.
if (queue.enqueue_tail (parent) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::gen_server_skeletons - "
- "enqueue op failed\n"), -1);
+ "enqueue op failed\n"),
+ -1);
}
}
} // end of for loop
} // end of while queue not empty
+
return 0;
}
-// helpers passed to the template method
+// Helpers passed to the template method
int
be_interface::gen_optable_helper (be_interface *derived,
be_interface *ancestor,
- TAO_OutStream * /*os*/)
+ TAO_OutStream *)
{
- // generate entries for the derived class using the properties of its
- // ancestors
+ // Generate entries for the derived class using the properties of its
+ // ancestors.
if (ancestor->gen_optable_entries (derived) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::gen_operation_table - "
"error generating entries for inherited"
- "interfaces\n"), -1);
+ "interfaces\n"),
+ -1);
}
+
return 0;
}
@@ -1429,23 +1567,22 @@ be_interface::gen_gperf_things (void)
// GPERF can give Binary search, Linear search and Perfect Hash
// methods. Generate the class defintion according to that.
- // Codegen singleton.
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
// Generate the correct class definition for the operation lookup
// strategy. Then, get the lookup method from GPERF. And then,
// instantiate the correct class for the operation lookup strategy
// we are following.
- switch (cg->lookup_strategy ())
- {
- case TAO_CodeGen::TAO_PERFECT_HASH:
+ switch (be_global->lookup_strategy ())
+ {
+ case BE_GlobalData::TAO_PERFECT_HASH:
// Output a class definition deriving from
// TAO_Perfect_Hash_OpTable.
gen_perfect_hash_class_definition ();
// Call GPERF and get the methods defined.
if (gen_gperf_lookup_methods () == -1)
- return -1;
+ {
+ return -1;
+ }
// Create an instance of the correct class corresponding the
// operation lookup strategy we are following.
@@ -1453,14 +1590,16 @@ be_interface::gen_gperf_things (void)
break;
- case TAO_CodeGen::TAO_BINARY_SEARCH:
+ case BE_GlobalData::TAO_BINARY_SEARCH:
// Output a class definition deriving from
// TAO_Binary_Search_OpTable.
this->gen_binary_search_class_definition ();
// Call GPERF and get the methods defined.
if (gen_gperf_lookup_methods () == -1)
- return -1;
+ {
+ return -1;
+ }
// Create an instance of the correct class corresponding the
// operation lookup strategy we are following.
@@ -1468,14 +1607,16 @@ be_interface::gen_gperf_things (void)
break;
- case TAO_CodeGen::TAO_LINEAR_SEARCH:
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
// Output a class definition deriving from
// TAO_Linear_Search_OpTable.
gen_linear_search_class_definition ();
// Call GPERF and get the methods defined.
if (gen_gperf_lookup_methods () == -1)
- return -1;
+ {
+ return -1;
+ }
// Create an instance of the correct class corresponding the
// operation lookup strategy we are following.
@@ -1484,10 +1625,13 @@ be_interface::gen_gperf_things (void)
break;
default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"
+ ),
+ -1
+ );
+ }
return 0;
}
@@ -1572,11 +1716,8 @@ be_interface::gen_gperf_lookup_methods (void)
ACE_Process process;
ACE_Process_Options process_options;
- // Codegen's singleton.
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
// Adjust the offset of the underlying file pointer.
- ACE_OS::rewind (cg->gperf_input_stream ()->file ());
+ ACE_OS::rewind (tao_cg->gperf_input_stream ()->file ());
// Set the stdin and stdout appropriately for the gperf program.
@@ -1585,21 +1726,25 @@ be_interface::gen_gperf_lookup_methods (void)
// deleted once when we close the file.
// Close the file.
- if (ACE_OS::fclose (cg->gperf_input_stream ()->file ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p:File close failed on temp gperf's input file\n",
- "fclose"),
- -1);
+ if (ACE_OS::fclose (tao_cg->gperf_input_stream ()->file ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File close failed on temp gperf's input file\n",
+ "fclose"),
+ -1);
+ }
// Open the temp file.
- ACE_HANDLE input = ACE::open_temp_file (cg->gperf_input_filename (),
+ ACE_HANDLE input = ACE::open_temp_file (tao_cg->gperf_input_filename (),
O_RDONLY);
if (input == ACE_INVALID_HANDLE)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p:File open failed on gperf's temp input file\n",
- "open_temp_file"),
- -1);
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File open failed on gperf's temp input file\n",
+ "open_temp_file"),
+ -1);
+ }
// Stdout is server skeleton. Do *not* close the file, just open
// again with <ACE_OS::open> with WRITE + APPEND option.. After
@@ -1627,10 +1772,10 @@ be_interface::gen_gperf_lookup_methods (void)
// Set the command line for the gperf program. Give the right
// arguments for the operation lookup strategy that we are using.
- switch (cg->lookup_strategy ())
- {
+ switch (be_global->lookup_strategy ())
+ {
// Perfect Hashing.
- case TAO_CodeGen::TAO_PERFECT_HASH:
+ case BE_GlobalData::TAO_PERFECT_HASH:
process_options.command_line ("%s"
" "
"-m -M -J -c -C"
@@ -1651,7 +1796,7 @@ be_interface::gen_gperf_lookup_methods (void)
break;
// Binary search methods from GPERF. Everythis and the -B flag.
- case TAO_CodeGen::TAO_BINARY_SEARCH:
+ case BE_GlobalData::TAO_BINARY_SEARCH:
process_options.command_line ("%s"
" "
"-B"
@@ -1674,7 +1819,7 @@ be_interface::gen_gperf_lookup_methods (void)
break;
// Linear search methods from GPERF. Everything and the -z flag.
- case TAO_CodeGen::TAO_LINEAR_SEARCH:
+ case BE_GlobalData::TAO_LINEAR_SEARCH:
process_options.command_line ("%s"
" "
"-b"
@@ -1699,8 +1844,9 @@ be_interface::gen_gperf_lookup_methods (void)
default:
ACE_ERROR ((LM_ERROR,
"tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"));
+
result = -1;
- }
+ }
if (result != -1)
{
@@ -1710,14 +1856,17 @@ be_interface::gen_gperf_lookup_methods (void)
ACE_ERROR ((LM_ERROR,
"Error:%p:Couldnt spawn a process for gperf program\n",
"process.spawn"));
+
result = -1;
}
+
// Wait for gperf to complete.
else if (process.wait () == -1)
{
ACE_ERROR ((LM_ERROR,
"Error:%p:Error on waiting for completion of gperf program.\n",
"process.wait"));
+
result = -1;
}
@@ -1780,7 +1929,7 @@ be_interface::is_a_helper (be_interface * /*derived*/,
be_interface *bi,
TAO_OutStream *os)
{
- // emit the comparison code
+ // Emit the comparison code.
os->indent ();
*os << "(!ACE_OS::strcmp ((char *)value, \"" << bi->repoID () <<
"\")) ||\n";
@@ -1793,7 +1942,7 @@ be_interface::queryinterface_helper (be_interface *derived,
be_interface *ancestor,
TAO_OutStream *os)
{
- // emit the comparison code
+ // Emit the comparison code.
*os << "(type == ACE_reinterpret_cast" << be_idt_nl
<< "(ptr_arith_t," << be_idt_nl;
@@ -1825,17 +1974,21 @@ be_interface::queryinterface_helper (be_interface *derived,
}
if (derived == ancestor)
- *os << "retv = ACE_reinterpret_cast (void*, this);" << be_uidt_nl;
+ {
+ *os << "retv = ACE_reinterpret_cast (void*, this);" << be_uidt_nl;
+ }
else
- *os << "retv = ACE_reinterpret_cast" << be_idt_nl
- << "(" << be_idt_nl
- << "void *," << be_nl
- << "ACE_static_cast" << be_idt_nl
- << "(" << be_idt_nl
- << ancestor->full_name () << "_ptr," << be_nl
- << "this" << be_uidt_nl
- << ")" << be_uidt << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
+ {
+ *os << "retv = ACE_reinterpret_cast" << be_idt_nl
+ << "(" << be_idt_nl
+ << "void *," << be_nl
+ << "ACE_static_cast" << be_idt_nl
+ << "(" << be_idt_nl
+ << ancestor->full_name () << "_ptr," << be_nl
+ << "this" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
*os << "else if ";
@@ -1853,6 +2006,7 @@ be_interface::downcast_helper (be_interface * /* derived */,
<< base->repoID () << "\") == 0)" << be_idt_nl
<< "return ACE_static_cast ("
<< base->full_skel_name () << "_ptr, this);" << be_uidt_nl;
+
return 0;
}
@@ -1862,36 +2016,43 @@ be_interface::gen_skel_helper (be_interface *derived,
be_interface *ancestor,
TAO_OutStream *os)
{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- TAO_NL nl; // end line
+ UTL_ScopeActiveIterator *si = 0;;
+ AST_Decl *d = 0;
+ TAO_NL nl;
- // if derived and ancestor are same, skip it
+ // If derived and ancestor are same, skip it.
if (derived == ancestor)
- return 0;
+ {
+ return 0;
+ }
- // else generate code that does the cast to the appropriate type
+ // Else generate code that does the cast to the appropriate type.
if (ancestor->nmembers () > 0)
{
- // if there are elements in ancestor scope i.e., any operations and
+ // If there are elements in ancestor scope i.e., any operations and
// attributes defined by "ancestor", become methods on the derived class
// which call the corresponding method of the base class by doing the
- // proper casting
+ // proper casting.
- si = new UTL_ScopeActiveIterator (ancestor, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (ancestor,
+ UTL_Scope::IK_decls),
+ -1);
+ // Instantiate a scope iterator.
- while (!(si->is_done ()))
+ while (!si->is_done ())
{
- // get the next AST decl node
+ // Get the next AST decl node
d = si->item ();
if (d->node_type () == AST_Decl::NT_op)
{
- os->indent (); // start from current indentation level
+ // Start from current indentation level.
+ os->indent ();
+
if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
{
- // generate the static method corresponding to this method
+ // Generate the static method corresponding to this method.
*os << "static void " << d->local_name ()
<< "_skel (" << be_idt << be_idt_nl
<< "CORBA::ServerRequest &req, " << be_nl
@@ -1903,8 +2064,8 @@ be_interface::gen_skel_helper (be_interface *derived,
<< ");" << be_uidt << "\n\n";
}
else
- { // generate code in the inline file
- // generate the static method corresponding to this method
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
*os << "ACE_INLINE void "
<< derived->full_skel_name () << "::"
<< d->local_name ()
@@ -1933,16 +2094,18 @@ be_interface::gen_skel_helper (be_interface *derived,
}
else if (d->node_type () == AST_Decl::NT_attr)
{
- AST_Attribute *attr;
+ AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
- attr = AST_Attribute::narrow_from_decl (d);
- if (!attr)
- return -1;
+ if (attr == 0)
+ {
+ return -1;
+ }
- os->indent (); // start from current indentation level
+ // Start from current indentation level.
+ os->indent ();
if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
{
- // generate the static method corresponding to this method
+ // Generate the static method corresponding to this method.
*os << "static void _get_" << d->local_name ()
<< "_skel (" << be_idt << be_idt_nl
<< "CORBA::ServerRequest &req," << be_nl
@@ -1954,8 +2117,8 @@ be_interface::gen_skel_helper (be_interface *derived,
<< ");" << be_uidt << "\n\n";
}
else
- { // generate code in the inline file
- // generate the static method corresponding to this method
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
*os << "ACE_INLINE void "
<< derived->full_skel_name () << "::_get_"
<< d->local_name ()
@@ -1984,12 +2147,14 @@ be_interface::gen_skel_helper (be_interface *derived,
if (!attr->readonly ())
{
- // the set method
- os->indent (); // start from current indentation level
+ // The set method.
+ // start from current indentation level
+ os->indent ();
+
if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
{
- // generate the static method corresponding to
- // this method
+ // Generate the static method corresponding to
+ // this method.
*os << "static void _set_" << d->local_name ()
<< "_skel (" << be_idt << be_idt_nl
<< "CORBA::ServerRequest &req," << be_nl
@@ -2001,9 +2166,9 @@ be_interface::gen_skel_helper (be_interface *derived,
<< ");" << be_uidt << "\n\n";
}
else
- { // generate code in the inline file
- // generate the static method corresponding to
- // this method
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to
+ // this method.
*os << "ACE_INLINE void "
<< derived->full_skel_name ()
<< "::_set_" << d->local_name ()
@@ -2029,13 +2194,15 @@ be_interface::gen_skel_helper (be_interface *derived,
<< ");" << be_uidt << be_uidt_nl
<< "}\n";
}
-
}
}
+
si->next ();
- } // end of while
- delete si; // free the iterator object
+ } // End of while.
+
+ delete si;
}
+
return 0;
}
@@ -2045,14 +2212,15 @@ be_interface::copy_ctor_helper (be_interface *derived,
TAO_OutStream *os)
{
if (derived == base)
- // we are the same. Don't do anything, otherwise we will end up calling
- // ourself
+ // We are the same. Don't do anything, otherwise we will end up calling
+ // ourself.
return 0;
if (base->is_nested ())
{
be_decl *scope;
scope = be_scope::narrow_from_scope (base->defined_in ())->decl ();
+
*os << " ACE_NESTED_CLASS (POA_" << scope->name () << ","
<< base->local_name () << ") (rhs)," << be_nl;
}
@@ -2070,26 +2238,39 @@ be_interface::in_mult_inheritance_helper (be_interface *derived,
TAO_OutStream *)
{
switch (derived->n_inherits ())
- {
+ {
case 0:
- // no parent
+ // No parent.
derived->in_mult_inheritance (0);
break;
case 1:
if (derived == base)
- // prevent indefinite recursion
- derived->in_mult_inheritance (-1);
+ {
+ // Prevent indefinite recursion.
+ derived->in_mult_inheritance (-1);
+ }
else
- // one parent. We have the same characteristics as our base
- derived->in_mult_inheritance (base->in_mult_inheritance ());
+ {
+ // One parent. We have the same characteristics as our base.
+ derived->in_mult_inheritance (base->in_mult_inheritance ());
+ }
+
break;
default:
- // direct multiple inheritance
+ // Direct multiple inheritance.
derived->in_mult_inheritance (1);
- }
+ }
+
return 0;
}
+void
+be_interface::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_type::destroy ();
+}
int
be_interface::accept (be_visitor *visitor)
@@ -2102,7 +2283,8 @@ TAO_CodeGen::CG_STATE
be_interface::next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state)
{
- return this->strategy_->next_state (current_state, is_extra_state);
+ return this->strategy_->next_state (current_state,
+ is_extra_state);
}
int
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 0a090029e62..4a1489c2859 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -25,34 +25,37 @@
ACE_RCSID(be, be_interface_fwd, "$Id$")
-/*
- * BE_InterfaceFwd
- */
-
be_interface_fwd::be_interface_fwd (void)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
}
be_interface_fwd::be_interface_fwd (AST_Interface *dummy,
- UTL_ScopedName *n, UTL_StrList *p)
- : AST_InterfaceFwd (dummy, n, p),
- AST_Decl (AST_Decl::NT_interface_fwd, n, p)
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_InterfaceFwd (dummy,
+ n,
+ p),
+ AST_Decl (AST_Decl::NT_interface_fwd,
+ n,
+ p)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
}
be_interface_fwd::~be_interface_fwd (void)
{
}
-// generate the var definition
+// Generate the var definition.
int
be_interface_fwd::gen_var_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -62,68 +65,67 @@ be_interface_fwd::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
+ ch = tao_cg->client_header ();
- // generate the var definition (always in the client header).
+ // Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->stub_export_macro ()
+ // Start with whatever was our current indent level.
+ ch->indent ();
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << " : public TAO_Base_var" << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // default constr
+ // Default constructor.
*ch << namebuf << " (void); // default constructor" << nl;
*ch << namebuf << " (" << this->local_name () << "_ptr p)"
<< " : ptr_ (p) {} " << nl;
- // copy constructor
+ // Copy constructor.
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
- // destructor
+ // Destructor.
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
+ // Assignment operator from a pointer.
*ch << namebuf << " &operator= (" << this->local_name ()
<< "_ptr);" << nl;
- // assignment from _var
+ // Assignment from _var.
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
- // arrow operator
+ // Arrow operator.
*ch << this->local_name () << "_ptr operator-> (void) const;" << nl;
*ch << nl;
- // other extra types (cast operators, [] operator, and others)
+ // Other extra types (cast operators, [] operator, and others).
*ch << "operator const " << this->local_name ()
<< "_ptr &() const;" << nl;
*ch << "operator " << this->local_name () << "_ptr &();" << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
+ // The return types of in, out, inout, and _retn are based on the parameter
+ // passing rules and the base type.
*ch << this->local_name () << "_ptr in (void) const;" << nl;
*ch << this->local_name () << "_ptr &inout (void);" << nl;
*ch << this->local_name () << "_ptr &out (void);" << nl;
*ch << this->local_name () << "_ptr _retn (void);" << nl;
- // generate an additional member function that returns the underlying pointer
+ // Generate an additional member function that returns the
+ // underlying pointer.
*ch << this->local_name () << "_ptr ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
- // private
+ // Private.
*ch << "private:\n";
ch->incr_indent ();
*ch << this->local_name () << "_ptr ptr_;" << nl;
@@ -137,16 +139,16 @@ be_interface_fwd::gen_var_defn (char *)
return 0;
}
-// implementation of the _var class. All of these get generated in the inline
-// file
+// Implementation of the _var class. All of these get generated in the inline
+// file.
int
be_interface_fwd::gen_var_impl (char *,
char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _var names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+ char fname [NAMEBUFSIZE]; // To hold the full and
+ char lname [NAMEBUFSIZE]; // local _var names.
ACE_OS::memset (fname,
'\0',
@@ -164,30 +166,28 @@ be_interface_fwd::gen_var_impl (char *,
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // default constr
+ // Default constructor.
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
*ci << " " << ": ptr_ (" << this->name () << "::_nil ())" << nl;
*ci << "{}\n\n";
- // the additional ptr () member function. This member function must be
+ // The additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
@@ -200,7 +200,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
@@ -209,7 +209,7 @@ be_interface_fwd::gen_var_impl (char *,
*ci << " ptr_ (" << this->local_name () << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
- // destructor
+ // Destructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -219,7 +219,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator
+ // Assignment operator.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->name () <<
@@ -232,7 +232,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << fname <<
@@ -251,7 +251,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator const " << this->name () <<
@@ -327,13 +327,13 @@ be_interface_fwd::gen_var_impl (char *,
return 0;
}
-// generate the _out definition
+// Generate the _out definition.
int
be_interface_fwd::gen_out_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
+ TAO_OutStream *ch;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -343,15 +343,12 @@ be_interface_fwd::gen_out_defn (char *)
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
+ ch = tao_cg->client_header ();
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
+ // Generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level.
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
@@ -359,25 +356,32 @@ be_interface_fwd::gen_out_defn (char *)
// No default constructor
- // constructor from a pointer
+ // Constructor from a pointer.
*ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl;
- // constructor from a _var &
+
+ // Constructor from a _var &.
*ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
- // constructor from a _out &
+
+ // Constructor from a _out &.
*ch << namebuf << " (const " << namebuf << " &);" << nl;
- // assignment operator from a _out &
+
+ // Assignment operator from a _out &.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // only interface allows assignment from var &
+
+ // Assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators.
+ // Only interface allows assignment from var &.
*ch << namebuf << " &operator= (const "
<< this->local_name () << "_var &);" << nl;
*ch << namebuf << " &operator= ("
<< this->local_name () << "_ptr);" << nl;
+
// cast
*ch << "operator " << this->local_name () << "_ptr &();" << nl;
+
// ptr fn
*ch << this->local_name () << "_ptr &ptr (void);" << nl;
+
// operator ->
*ch << this->local_name () << "_ptr operator-> (void);" << nl;
@@ -396,10 +400,10 @@ be_interface_fwd::gen_out_defn (char *)
int
be_interface_fwd::gen_out_impl (char *, char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _out names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+ char fname [NAMEBUFSIZE]; // To hold the full and
+ char lname [NAMEBUFSIZE]; // local _out names.
ACE_OS::memset (fname,
'\0',
@@ -417,23 +421,21 @@ be_interface_fwd::gen_out_impl (char *, char *)
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ci = tao_cg->client_inline ();
- ci = cg->client_inline ();
-
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // constr from a _ptr
+ // Constructor from a _ptr.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " ("
@@ -445,7 +447,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // constructor from _var &
+ // Constructor from _var &.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->name () <<
@@ -458,7 +460,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
@@ -467,7 +469,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
<< "&,p).ptr_)" << nl;
*ci << "{}\n\n";
- // assignment operator from _out &
+ // Assignment operator from _out &.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << fname <<
@@ -479,7 +481,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << this->name () <<
@@ -492,7 +494,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _ptr
+ // Assignment operator from _ptr.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->name () <<
@@ -504,7 +506,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator " << this->name () <<
@@ -525,7 +527,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // operator->
+ // operator->
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::operator-> (void)" << nl;
@@ -538,6 +540,12 @@ be_interface_fwd::gen_out_impl (char *, char *)
return 0;
}
+void
+be_interface_fwd::destroy (void)
+{
+ // Do nothing.
+}
+
int
be_interface_fwd::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_interface_strategy.cpp b/TAO/TAO_IDL/be/be_interface_strategy.cpp
index 6070e09780b..6f8cc94f0e8 100644
--- a/TAO/TAO_IDL/be/be_interface_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_interface_strategy.cpp
@@ -25,7 +25,7 @@ ACE_RCSID(be, be_interface_strategy, "$Id$")
be_interface_strategy::be_interface_strategy (be_interface *node,
- Strategy_Kind strategy_type)
+ Strategy_Kind strategy_type)
: local_name_(0),
full_name_(0),
flat_name_(0),
@@ -62,24 +62,26 @@ be_interface_strategy::~be_interface_strategy ()
// Interface Type Strategy Base Class
+// Relative skeleton name.
const char *
be_interface_strategy::relative_skel_name (const char *skel_name)
-// relative skeleton name
{
return be_interface::relative_name (this->full_skel_name (),
- skel_name);
+ skel_name);
}
-// compute stringified fully qualified collocated class name.
+// Compute stringified fully qualified collocated class name.
void
be_interface_strategy::compute_coll_names (int type,
- const char *prefix,
- const char *suffix)
+ const char *prefix,
+ const char *suffix)
{
if (type == this->cached_type_ && this->full_coll_name_ != 0)
- return;
+ {
+ return;
+ }
else
{
this->cached_type_ = type;
@@ -94,41 +96,49 @@ be_interface_strategy::compute_coll_names (int type,
// prefix and the local name and the (optional) "::"
const char *collocated = collocated_names[type];
- int name_len = ACE_OS::strlen (collocated) +
- sizeof (poa) +
- 1;
+ int name_len = ACE_OS::strlen (collocated)
+ + sizeof (poa)
+ + 1;
if (prefix)
- name_len += ACE_OS::strlen (prefix);
+ {
+ name_len += ACE_OS::strlen (prefix);
+ }
if (suffix)
- name_len += ACE_OS::strlen (suffix);
+ {
+ name_len += ACE_OS::strlen (suffix);
+ }
- {
- UTL_IdListActiveIterator *i;
- ACE_NEW (i, UTL_IdListActiveIterator (node_->name ()));
- while (!i->is_done ())
- {
- // reserve 2 characters for "::".
- name_len += ACE_OS::strlen (i->item ()->get_string ()) + 2;
- i->next ();
- }
- delete i;
- }
+ UTL_IdListActiveIterator *i = 0;
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (node_->name ()));
+
+ while (!i->is_done ())
+ {
+ // Reserve 2 characters for "::".
+ name_len += ACE_OS::strlen (i->item ()->get_string ()) + 2;
+ i->next ();
+ }
+
+ delete i;
ACE_NEW (this->full_coll_name_,
- char[name_len+1]);
- this->full_coll_name_[0] = 0; // null terminate the string...
+ char[name_len + 1]);
+
+ // Null terminate the string.
+ this->full_coll_name_[0] = 0;
- // Iterate again....
- UTL_IdListActiveIterator *i;
- ACE_NEW (i, UTL_IdListActiveIterator (node_->name ()));
+ // Iterate again.
+ ACE_NEW (i,
+ UTL_IdListActiveIterator (node_->name ()));
// Only the first component get the "POA_" preffix.
int poa_added = 0;
+
while (!i->is_done ())
{
- const char* item = i->item ()->get_string ();
+ const char *item = i->item ()->get_string ();
// Increase right away, so we can test for the final component
// in the loop.
@@ -156,50 +166,68 @@ be_interface_strategy::compute_coll_names (int type,
ACE_OS::strcat (this->full_coll_name_, collocated);
if (prefix)
- ACE_OS::strcat (this->full_coll_name_, prefix);
+ {
+ ACE_OS::strcat (this->full_coll_name_, prefix);
+ }
ACE_OS::strcat (this->full_coll_name_, item);
if (suffix)
- ACE_OS::strcat (this->full_coll_name_, suffix);
+ {
+ ACE_OS::strcat (this->full_coll_name_, suffix);
+ }
}
}
}
+
delete i;
// Compute the local name for the collocated class.
- int local_len = ACE_OS::strlen (collocated) +
- ACE_OS::strlen (node_->AST_Interface::local_name ()->get_string ()) +
- 1;
+ int local_len = ACE_OS::strlen (collocated)
+ + ACE_OS::strlen (node_->AST_Interface::local_name ()->get_string ())
+ + 1;
if (prefix)
- local_len += ACE_OS::strlen (prefix);
+ {
+ local_len += ACE_OS::strlen (prefix);
+ }
if (suffix)
- local_len += ACE_OS::strlen (suffix);
+ {
+ local_len += ACE_OS::strlen (suffix);
+ }
- ACE_NEW (this->local_coll_name_, char[local_len]);
+ ACE_NEW (this->local_coll_name_,
+ char[local_len]);
- ACE_OS::strcpy(this->local_coll_name_, collocated);
+ ACE_OS::strcpy (this->local_coll_name_,
+ collocated);
if (prefix)
- ACE_OS::strcat (this->local_coll_name_, prefix);
+ {
+ ACE_OS::strcat (this->local_coll_name_,
+ prefix);
+ }
- ACE_OS::strcat(this->local_coll_name_,
- node_->AST_Interface::local_name ()->get_string ());
+ ACE_OS::strcat (this->local_coll_name_,
+ node_->AST_Interface::local_name ()->get_string ());
if (suffix)
- ACE_OS::strcat (this->local_coll_name_, suffix);
+ {
+ ACE_OS::strcat (this->local_coll_name_, suffix);
+ }
}
void
be_interface_strategy::compute_names (const char *name,
- const char *prefix,
- const char *suffix,
- char *&new_name)
+ const char *prefix,
+ const char *suffix,
+ char *&new_name)
{
if (!prefix || !suffix)
- return;
+ {
+ return;
+ }
int name_length = ACE_OS::strlen (name) +
ACE_OS::strlen (prefix) +
@@ -208,11 +236,12 @@ be_interface_strategy::compute_names (const char *name,
ACE_NEW (new_name,
char[name_length + 1]);
- // copy it in
+ // Copy it in.
ACE_OS::strcpy (new_name, name);
const char *interface_name = 0;
int i = ACE_OS::strlen (name);
+
for (;i >= 1; i--)
{
if (name[i-1] == ':' && name[i] == ':')
@@ -221,69 +250,71 @@ be_interface_strategy::compute_names (const char *name,
break;
}
else if (i >= 3)
- if (name[i-3] == 'P' &&
- name[i-2] == 'O' &&
- name[i-1] == 'A' &&
- name[i] == '_')
- {
- interface_name = &name[i+1];
- break;
- }
+ {
+ if (name[i-3] == 'P' &&
+ name[i-2] == 'O' &&
+ name[i-1] == 'A' &&
+ name[i] == '_')
+ {
+ interface_name = &name[i+1];
+ break;
+ }
+ }
}
if (interface_name == 0)
- interface_name = name;
+ {
+ interface_name = name;
+ }
- ACE_OS::strcpy(&new_name[name_length -
- ACE_OS::strlen(prefix) -
- ACE_OS::strlen(interface_name) -
- ACE_OS::strlen(suffix)],prefix);
+ ACE_OS::strcpy (&new_name[name_length
+ - ACE_OS::strlen (prefix)
+ - ACE_OS::strlen (interface_name)
+ - ACE_OS::strlen (suffix)],
+ prefix);
- ACE_OS::strcpy(&new_name[name_length -
- ACE_OS::strlen(interface_name) -
- ACE_OS::strlen(suffix)],interface_name);
+ ACE_OS::strcpy (&new_name[name_length
+ - ACE_OS::strlen (interface_name)
+ - ACE_OS::strlen (suffix)],
+ interface_name);
- ACE_OS::strcpy(&new_name[name_length -
- ACE_OS::strlen(suffix)],suffix);
+ ACE_OS::strcpy (&new_name[name_length
+ - ACE_OS::strlen(suffix)],
+ suffix);
}
TAO_OutStream *
-be_interface_strategy::get_out_stream ()
+be_interface_strategy::get_out_stream (void)
{
- // Codegen singleton.
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
// Outstream.
- return cg->server_skeletons ();
+ return tao_cg->server_skeletons ();
}
const char *
-be_interface_strategy::get_out_stream_fname ()
+be_interface_strategy::get_out_stream_fname (void)
{
- return idl_global->be_get_server_skeleton_fname ();
+ return be_global->be_get_server_skeleton_fname ();
}
int
-be_interface_strategy::strategy_type ()
+be_interface_strategy::strategy_type (void)
{
return strategy_type_;
}
TAO_CodeGen::CG_STATE
be_interface_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+ int /* is_extra_state */)
{
- ACE_UNUSED_ARG (is_extra_state);
return current_state;
}
-
-
int
-be_interface_strategy::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+be_interface_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE /* current_state */
+ )
{
- ACE_UNUSED_ARG (current_state);
return 0;
}
@@ -297,22 +328,25 @@ be_interface_strategy::replacement (void)
// ****************************************************************
// AMI Hander Strategy
-be_interface_ami_handler_strategy::be_interface_ami_handler_strategy (be_interface *node)
+be_interface_ami_handler_strategy::be_interface_ami_handler_strategy (
+ be_interface *node
+ )
: be_interface_default_strategy (node,
AMI_HANDLER)
{
}
-be_interface_ami_handler_strategy::~be_interface_ami_handler_strategy ()
+be_interface_ami_handler_strategy::~be_interface_ami_handler_strategy (void)
{
}
TAO_CodeGen::CG_STATE
-be_interface_ami_handler_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+be_interface_ami_handler_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int /*is_extra_state */
+ )
{
- ACE_UNUSED_ARG (is_extra_state);
return current_state;
}
@@ -320,47 +354,59 @@ be_interface_ami_handler_strategy::next_state (TAO_CodeGen::CG_STATE current_sta
// ****************************************************************
// AMI Exception Holder Strategy
-be_interface_ami_exception_holder_strategy::be_interface_ami_exception_holder_strategy (be_interface *node)
+be_interface_ami_exception_holder_strategy
+::be_interface_ami_exception_holder_strategy (be_interface *node)
: be_interface_default_strategy (node,
AMI_EXCEPTION_HOLDER)
{
}
-be_interface_ami_exception_holder_strategy::~be_interface_ami_exception_holder_strategy ()
+be_interface_ami_exception_holder_strategy
+::~be_interface_ami_exception_holder_strategy (void)
{
}
TAO_CodeGen::CG_STATE
-be_interface_ami_exception_holder_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+be_interface_ami_exception_holder_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
{
if (is_extra_state)
{
switch (current_state)
- {
- case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
- return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH;
- case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
- return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS;
- default:
- return current_state;
- }
+ {
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH;
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS;
+ default:
+ return current_state;
+ }
}
else
- return current_state;
+ {
+ return current_state;
+ }
}
int
-be_interface_ami_exception_holder_strategy::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+be_interface_ami_exception_holder_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
{
if (current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CH
- || current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CS)
- return 1;
+ || current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CS)
+ {
+ return 1;
+ }
else
- return 0;
+ {
+ return 0;
+ }
}
@@ -375,7 +421,7 @@ be_interface_ami_strategy::be_interface_ami_strategy (be_interface *node,
{
}
-be_interface_ami_strategy::~be_interface_ami_strategy ()
+be_interface_ami_strategy::~be_interface_ami_strategy (void)
{
}
@@ -387,33 +433,39 @@ be_interface_ami_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
if (is_extra_state)
{
switch (current_state)
- {
- case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
- return TAO_CodeGen::TAO_INTERFACE_CH;
- default:
- return current_state;
- }
+ {
+ case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
+ return TAO_CodeGen::TAO_INTERFACE_CH;
+ default:
+ return current_state;
+ }
}
else
{
switch (current_state)
- {
- case TAO_CodeGen::TAO_INTERFACE_CH:
- return TAO_CodeGen::TAO_AMI_INTERFACE_CH;
- default:
- return current_state;
- }
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ return TAO_CodeGen::TAO_AMI_INTERFACE_CH;
+ default:
+ return current_state;
+ }
}
}
int
-be_interface_ami_strategy::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+be_interface_ami_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
{
if (current_state == TAO_CodeGen::TAO_AMI_INTERFACE_CH)
- return 1;
+ {
+ return 1;
+ }
else
- return 0;
+ {
+ return 0;
+ }
}
be_interface *
@@ -425,30 +477,33 @@ be_interface_ami_strategy::replacement (void)
// ****************************************************************
// Default Strategy
-be_interface_default_strategy::be_interface_default_strategy (be_interface *node,
- Strategy_Kind strategy_kind)
- : be_interface_strategy (node, strategy_kind)
+be_interface_default_strategy::be_interface_default_strategy (
+ be_interface *node,
+ Strategy_Kind strategy_kind
+ )
+ : be_interface_strategy (node,
+ strategy_kind)
{
}
-be_interface_default_strategy::~be_interface_default_strategy ()
+be_interface_default_strategy::~be_interface_default_strategy (void)
{
}
const char *
be_interface_default_strategy::full_name (void)
{
- if (!this->full_name_)
- {
- int len = ACE_OS::strlen (node_->be_decl::full_name ());
+ if (this->full_name_ == 0)
+ {
+ int len = ACE_OS::strlen (node_->be_decl::full_name ());
- ACE_NEW_RETURN (this->full_name_,
- char[len + 1],
- 0);
+ ACE_NEW_RETURN (this->full_name_,
+ char[len + 1],
+ 0);
- ACE_OS::strcpy (this->full_name_,
- node_->be_decl::full_name ());
- }
+ ACE_OS::strcpy (this->full_name_,
+ node_->be_decl::full_name ());
+ }
return this->full_name_;
}
@@ -457,15 +512,17 @@ const char *
be_interface_default_strategy::local_name (void)
{
if (!this->local_name_)
- {
- int len = ACE_OS::strlen (node_->AST_Interface::local_name()->get_string ());
+ {
+ int len = ACE_OS::strlen (
+ node_->AST_Interface::local_name ()->get_string ()
+ );
- ACE_NEW_RETURN (this->local_name_,
- char[len + 1],
- 0);
+ ACE_NEW_RETURN (this->local_name_,
+ char[len + 1],
+ 0);
- ACE_OS::strcpy (this->local_name_,
- node_->AST_Interface::local_name()->get_string ());
+ ACE_OS::strcpy (this->local_name_,
+ node_->AST_Interface::local_name ()->get_string ());
}
return this->local_name_;
@@ -486,14 +543,13 @@ be_interface_default_strategy::flat_name (void)
node_->be_decl::flat_name ());
}
-
return this->flat_name_;
}
const char *
be_interface_default_strategy::repoID (void)
{
- if (!this->repoID_)
+ if (this->repoID_ == 0)
{
int len = ACE_OS::strlen (node_->be_decl::repoID ());
@@ -512,11 +568,11 @@ const char *
be_interface_default_strategy::full_skel_name (void)
{
if (this->full_skel_name_ == 0)
- {
- // the following method is inherited from the base class
- node_->compute_full_skel_name ("POA_",
- this->full_skel_name_);
- }
+ {
+ // the following method is inherited from the base class
+ node_->compute_full_skel_name ("POA_",
+ this->full_skel_name_);
+ }
return this->full_skel_name_;
}
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
index 058134399fe..32c7d3bf60c 100644
--- a/TAO/TAO_IDL/be/be_module.cpp
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -25,28 +25,37 @@
ACE_RCSID(be, be_module, "$Id$")
-/*
- * BE_Module
- */
be_module::be_module (void)
{
}
-be_module::be_module (UTL_ScopedName *n, UTL_StrList *p)
- : AST_Module (n, p),
- AST_Decl (AST_Decl::NT_module, n, p),
+be_module::be_module (UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Module (n,
+ p),
+ AST_Decl (AST_Decl::NT_module,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_module)
{
}
-// compute the size type of the node in question
+// Compute the size type of the node in question.
int
be_module::compute_size_type (void)
{
- // our size does not matter
+ // Our size does not matter.
return 0;
}
+void
+be_module::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_decl::destroy ();
+}
+
int
be_module::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp
index 149d5956dee..dc82c776c8f 100644
--- a/TAO/TAO_IDL/be/be_native.cpp
+++ b/TAO/TAO_IDL/be/be_native.cpp
@@ -23,18 +23,17 @@
ACE_RCSID(be, be_native, "$Id$")
-// be_native: New IDL type added by the POA spec
-/*
- * Constructor(s)
- */
be_native::be_native (void)
{
}
be_native::be_native (UTL_ScopedName *n,
UTL_StrList *p)
- : AST_Native (n, p),
- AST_Decl (AST_Decl::NT_native, n, p)
+ : AST_Native (n,
+ p),
+ AST_Decl (AST_Decl::NT_native,
+ n,
+ p)
{
}
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index 9e1e3fef24f..5572d74edae 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -25,14 +25,12 @@
ACE_RCSID(be, be_operation, "$Id$")
-/*
- * BE_Operation
- */
be_operation::be_operation (void)
: argument_count_ (-1),
- has_native_ (0),
- strategy_ (new be_operation_default_strategy (this))
+ has_native_ (0)
{
+ ACE_NEW (this->strategy_,
+ be_operation_default_strategy (this));
}
be_operation::be_operation (AST_Type *rt,
@@ -41,14 +39,23 @@ be_operation::be_operation (AST_Type *rt,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Operation (rt, fl, n, p, local, abstract),
- AST_Decl (AST_Decl::NT_op, n, p),
+ : AST_Operation (rt,
+ fl,
+ n,
+ p,
+ local,
+ abstract),
+ AST_Decl (AST_Decl::NT_op,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_op),
- COMMON_Base (local, abstract),
+ COMMON_Base (local,
+ abstract),
argument_count_ (-1),
- has_native_ (0),
- strategy_ (new be_operation_default_strategy (this))
+ has_native_ (0)
{
+ ACE_NEW (this->strategy_,
+ be_operation_default_strategy (this));
}
@@ -56,30 +63,37 @@ be_operation::~be_operation (void)
{
// We know that it cannot be 0, but..
if (!this->strategy_)
- delete this->strategy_;
+ {
+ delete this->strategy_;
+ }
}
-// compute total number of members
+// Compute total number of members.
int
be_operation::compute_argument_attr (void)
{
if (this->argument_count_ != -1)
- return 0;
+ {
+ return 0;
+ }
this->argument_count_ = 0;
- // if there are elements in this scope
+ // If there are elements in this scope.
if (this->nmembers () > 0)
{
// instantiate a scope iterator.
- UTL_ScopeActiveIterator *si =
- new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ UTL_ScopeActiveIterator *si = 0;
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
- while (!(si->is_done ()))
+ while (!si->is_done ())
{
- // get the next AST decl node
- AST_Decl *d = si->item ();
+ // Get the next AST decl node.
+ AST_Decl *d = si->item ();
if (d->node_type () == AST_Decl::NT_argument)
{
@@ -89,33 +103,45 @@ be_operation::compute_argument_attr (void)
be_type::narrow_from_decl (arg->field_type ());
if (type->base_node_type () == AST_Decl::NT_native)
- this->has_native_ = 1;
+ {
+ this->has_native_ = 1;
+ }
}
+
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
be_type* type = be_type::narrow_from_decl (this->return_type ());
+
if (type->base_node_type () == AST_Decl::NT_native)
- this->has_native_ = 1;
+ {
+ this->has_native_ = 1;
+ }
return 0;
}
int
-be_operation::void_return_type ()
+be_operation::void_return_type (void)
{
be_type* type = be_type::narrow_from_decl (this->return_type ());
+
if (type->node_type () == AST_Decl::NT_pre_defined
&& (be_predefined_type::narrow_from_decl (type)->pt ()
- == AST_PredefinedType::PT_void))
- return 1;
+ == AST_PredefinedType::PT_void))
+ {
+ return 1;
+ }
else
- return 0;
+ {
+ return 0;
+ }
}
-// return the member count
+// Return the member count.
int
be_operation::argument_count (void)
{
@@ -124,7 +150,7 @@ be_operation::argument_count (void)
return this->argument_count_;
}
-// return if any argument or the return type is a <native> type.
+// Return if any argument or the return type is a <native> type.
int
be_operation::has_native (void)
{
@@ -137,33 +163,37 @@ be_argument *
be_operation::add_argument_to_scope (be_argument *arg)
{
this->add_to_scope (arg);
- this->add_to_referenced (arg, 0, 0);
+ this->add_to_referenced (arg,
+ 0,
+ 0);
return arg;
}
-// compute the size type of the node in question
+// 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;
+ UTL_ScopeActiveIterator *si = 0;
+ AST_Decl *d = 0;
+ be_decl *bd = 0;
if (this->nmembers () > 0)
{
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ // If there are elements in this scope,
// instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
- while (!(si->is_done ()))
+ while (!si->is_done ())
{
- // get the next AST decl node
+ // 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
+ // 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.
@@ -175,13 +205,23 @@ be_operation::compute_size_type (void)
"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
+ }
+ delete si;
}
+
return 0;
}
+void
+be_operation::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_decl::destroy ();
+}
+
int
be_operation::accept (be_visitor *visitor)
{
@@ -194,7 +234,9 @@ be_operation::set_strategy (be_operation_strategy *new_strategy)
be_operation_strategy *old = this->strategy_;
if (new_strategy != 0)
- this->strategy_ = new_strategy;
+ {
+ this->strategy_ = new_strategy;
+ }
return old;
}
@@ -214,13 +256,13 @@ be_operation::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
}
be_operation*
-be_operation::marshaling ()
+be_operation::marshaling (void)
{
return this->strategy_->marshaling ();
}
be_operation*
-be_operation::arguments ()
+be_operation::arguments (void)
{
return this->strategy_->arguments ();
}
diff --git a/TAO/TAO_IDL/be/be_operation_strategy.cpp b/TAO/TAO_IDL/be/be_operation_strategy.cpp
index a50793338b6..a62a342eab4 100644
--- a/TAO/TAO_IDL/be/be_operation_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_operation_strategy.cpp
@@ -31,32 +31,33 @@ be_operation_strategy::be_operation_strategy (be_operation *node,
{
}
-be_operation_strategy::~be_operation_strategy ()
+be_operation_strategy::~be_operation_strategy (void)
{
}
int
-be_operation_strategy::strategy_type ()
+be_operation_strategy::strategy_type (void)
{
return strategy_type_;
}
int
-be_operation_strategy::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+be_operation_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE /* current_state */
+ )
{
- ACE_UNUSED_ARG (current_state);
return 0;
}
be_operation *
-be_operation_strategy::marshaling ()
+be_operation_strategy::marshaling (void)
{
return 0;
}
be_operation *
-be_operation_strategy::arguments ()
+be_operation_strategy::arguments (void)
{
return 0;
}
@@ -64,22 +65,25 @@ be_operation_strategy::arguments ()
// ****************************************************************
// AMI sendc_ operation strategy
-be_operation_default_strategy::be_operation_default_strategy (be_operation *node)
+be_operation_default_strategy::be_operation_default_strategy (
+ be_operation *node
+ )
: be_operation_strategy (node,
DEFAULT)
{
}
-be_operation_default_strategy::~be_operation_default_strategy ()
+be_operation_default_strategy::~be_operation_default_strategy (void)
{
}
TAO_CodeGen::CG_STATE
-be_operation_default_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+be_operation_default_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int /* is_extra_state */
+ )
{
- ACE_UNUSED_ARG (is_extra_state);
return current_state;
}
@@ -88,9 +92,11 @@ be_operation_default_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
// ****************************************************************
// AMI sendc_ operation strategy
-be_operation_ami_sendc_strategy::be_operation_ami_sendc_strategy (be_operation *node,
- be_operation *marshaling,
- be_operation *arguments)
+be_operation_ami_sendc_strategy::be_operation_ami_sendc_strategy (
+ be_operation *node,
+ be_operation *marshaling,
+ be_operation *arguments
+ )
: be_operation_strategy (node,
AMI_SENDC),
marshaling_ (marshaling),
@@ -98,53 +104,61 @@ be_operation_ami_sendc_strategy::be_operation_ami_sendc_strategy (be_operation *
{
}
-be_operation_ami_sendc_strategy::~be_operation_ami_sendc_strategy ()
+be_operation_ami_sendc_strategy::~be_operation_ami_sendc_strategy (void)
{
}
TAO_CodeGen::CG_STATE
-be_operation_ami_sendc_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+be_operation_ami_sendc_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
{
if (is_extra_state)
{
switch (current_state)
- {
- case TAO_CodeGen::TAO_OPERATION_CH:
- return TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CH;
- case TAO_CodeGen::TAO_OPERATION_CS:
- return TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CS;
- default:
- return current_state;
- }
+ {
+ case TAO_CodeGen::TAO_OPERATION_CH:
+ return TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CH;
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ return TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CS;
+ default:
+ return current_state;
+ }
}
- else // !is_extra_state
+ else
{
return current_state;
}
}
int
-be_operation_ami_sendc_strategy::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+be_operation_ami_sendc_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
{
- if (current_state == TAO_CodeGen::TAO_OPERATION_CH
- || current_state == TAO_CodeGen::TAO_OPERATION_CS)
- return 1;
- else
- return 0;
+ if (current_state == TAO_CodeGen::TAO_OPERATION_CH
+ || current_state == TAO_CodeGen::TAO_OPERATION_CS)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
}
be_operation*
-be_operation_ami_sendc_strategy::marshaling ()
+be_operation_ami_sendc_strategy::marshaling (void)
{
return marshaling_;
}
be_operation*
-be_operation_ami_sendc_strategy::arguments ()
+be_operation_ami_sendc_strategy::arguments (void)
{
return arguments_;
}
@@ -152,69 +166,79 @@ be_operation_ami_sendc_strategy::arguments ()
// ****************************************************************
// AMI ExceptionHolder raise_ operation strategy
-be_operation_ami_exception_holder_raise_strategy::be_operation_ami_exception_holder_raise_strategy (be_operation *node)
+be_operation_ami_exception_holder_raise_strategy
+::be_operation_ami_exception_holder_raise_strategy (be_operation *node)
: be_operation_strategy (node,
AMI_EXCEPTION_HOLDER_RAISE)
{
}
-be_operation_ami_exception_holder_raise_strategy::~be_operation_ami_exception_holder_raise_strategy ()
+be_operation_ami_exception_holder_raise_strategy
+::~be_operation_ami_exception_holder_raise_strategy (void)
{
}
TAO_CodeGen::CG_STATE
-be_operation_ami_exception_holder_raise_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+be_operation_ami_exception_holder_raise_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
{
if (!is_extra_state)
{
switch (current_state)
- {
- case TAO_CodeGen::TAO_OPERATION_CS:
- return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS;
- default:
- return current_state;
- }
+ {
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS;
+ default:
+ return current_state;
+ }
}
else
- return current_state;
+ {
+ return current_state;
+ }
}
// ****************************************************************
// AMI Reply Handler reply stub operation strategy
-be_operation_ami_handler_reply_stub_strategy::be_operation_ami_handler_reply_stub_strategy (be_operation *node)
+be_operation_ami_handler_reply_stub_strategy
+::be_operation_ami_handler_reply_stub_strategy (be_operation *node)
: be_operation_strategy (node,
AMI_EXCEPTION_HOLDER_RAISE)
{
}
-be_operation_ami_handler_reply_stub_strategy::~be_operation_ami_handler_reply_stub_strategy ()
+be_operation_ami_handler_reply_stub_strategy
+::~be_operation_ami_handler_reply_stub_strategy (void)
{
}
TAO_CodeGen::CG_STATE
-be_operation_ami_handler_reply_stub_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
+be_operation_ami_handler_reply_stub_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
{
if (is_extra_state)
{
switch (current_state)
- {
- case TAO_CodeGen::TAO_OPERATION_CH:
- return TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH;
+ {
+ case TAO_CodeGen::TAO_OPERATION_CH:
+ return TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH;
- case TAO_CodeGen::TAO_OPERATION_CS:
- return TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS;
+ case TAO_CodeGen::TAO_OPERATION_CS:
+ return TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS;
- default:
- return current_state;
- }
+ default:
+ return current_state;
+ }
}
- else // !is_extra_state
+ else
{
return current_state;
}
@@ -222,12 +246,18 @@ be_operation_ami_handler_reply_stub_strategy::next_state (TAO_CodeGen::CG_STATE
int
-be_operation_ami_handler_reply_stub_strategy::has_extra_code_generation (TAO_CodeGen::CG_STATE current_state)
+be_operation_ami_handler_reply_stub_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
{
- if (current_state == TAO_CodeGen::TAO_OPERATION_CH
- || current_state == TAO_CodeGen::TAO_OPERATION_CS)
- return 1;
- else
- return 0;
+ if (current_state == TAO_CodeGen::TAO_OPERATION_CH
+ || current_state == TAO_CodeGen::TAO_OPERATION_CS)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
}
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp
index c61743561aa..565a4bf13e6 100644
--- a/TAO/TAO_IDL/be/be_predefined_type.cpp
+++ b/TAO/TAO_IDL/be/be_predefined_type.cpp
@@ -25,270 +25,336 @@
ACE_RCSID(be, be_predefined_type, "$Id$")
-/*
- * BE_PredefinedType
- */
be_predefined_type::be_predefined_type (void)
{
}
be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t,
- UTL_ScopedName *n, UTL_StrList *p)
- : AST_PredefinedType (t, n, p),
- AST_Decl (AST_Decl::NT_pre_defined, n, p)
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_PredefinedType (t,
+ n,
+ p),
+ AST_Decl (AST_Decl::NT_pre_defined,
+ n,
+ p)
{
- // generate a new Scoped Name for us such that we belong to the CORBA
- // namespace
+ // Generate a new Scoped Name for us such that we belong to the CORBA
+ // namespace.
if (this->pt () != AST_PredefinedType::PT_void)
{
+ Identifier *corba_id = 0;
+ ACE_NEW (corba_id,
+ Identifier ("CORBA",
+ 1,
+ 0,
+ I_FALSE));
+
+ UTL_ScopedName *new_name = 0;
+ ACE_NEW (new_name,
+ UTL_ScopedName (corba_id,
+ 0));
+
+ Identifier *id = 0;
+ UTL_ScopedName *conc_name = 0;
- UTL_ScopedName *new_name = new UTL_ScopedName (new Identifier ("CORBA", 1, 0,
- I_FALSE),
- NULL);
switch (this->pt ())
{
case AST_PredefinedType::PT_long:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Long", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Long",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_ulong:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("ULong", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("ULong",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_short:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Short", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Short",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_ushort:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("UShort", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("UShort",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_float:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Float", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Float",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_double:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Double", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Double",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_char:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Char", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Char",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_octet:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Octet", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Octet",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_wchar:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("WChar", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("WChar",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_boolean:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Boolean", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Boolean",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_longlong:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("LongLong", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("LongLong",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_ulonglong:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("ULongLong", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("ULongLong",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_longdouble:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("LongDouble", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("LongDouble",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_any:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier ("Any", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("Any",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_pseudo:
- {
- new_name->nconc (new UTL_ScopedName (new Identifier
- (n->last_component
- ()->get_string (), 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier (n->last_component ()->get_string (),
+ 1,
+ 0,
+ I_FALSE));
break;
default:
- {
- new_name->nconc (new UTL_ScopedName (this->local_name (), NULL));
- }
+ ACE_NEW (id,
+ Identifier (this->local_name ()->get_string (),
+ 1,
+ 0,
+ I_FALSE));
}
+
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ new_name->nconc (conc_name);
this->set_name (new_name);
}
- // computes the repoID
+ // Computes the repoID.
compute_repoID ();
- // computes the fully scoped name
+ // Computes the fully scoped name.
compute_full_name ();
- // computes the fully scoped typecode name
+ // Computes the fully scoped typecode name.
compute_tc_name ();
- // compute the flattened fully scoped name
+ // Compute the flattened fully scoped name.
compute_flat_name ();
-
-
}
-// overriden method
+// Overriden method.
void
be_predefined_type::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);
+ // Start with the head as the CORBA namespace.
+ Identifier *corba_id = 0;
+ ACE_NEW (corba_id,
+ Identifier ("CORBA",
+ 1,
+ 0,
+ I_FALSE));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (corba_id,
+ 0));
+
+ Identifier *id = 0;
+ UTL_ScopedName *conc_name = 0;
switch (this->pt ())
{
case AST_PredefinedType::PT_void:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_void", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_void",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_long:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_long", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_long",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_longlong:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_longlong", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_longlong",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_ulong:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_ulong", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_ulong",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_ulonglong:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_ulonglong", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_ulonglong",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_short:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_short", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_short",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_ushort:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_ushort", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_ushort",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_float:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_float", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_float",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_double:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_double", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_double",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_longdouble:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_longdouble", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_longdouble",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_char:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_char", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_char",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_wchar:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_wchar", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_wchar",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_octet:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_octet", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_octet",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_boolean:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_boolean", 1, 0,
- I_FALSE), NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_boolean",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_any:
- {
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier
- ("_tc_any",
- 1, 0,
- I_FALSE),
- NULL));
- }
+ ACE_NEW (id,
+ Identifier ("_tc_any",
+ 1,
+ 0,
+ I_FALSE));
break;
case AST_PredefinedType::PT_pseudo:
{
char tcname [100];
- ACE_OS::sprintf (tcname, "_tc_%s",
+ ACE_OS::sprintf (tcname,
+ "_tc_%s",
this->name ()->last_component ()->get_string ());
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier
- (ACE_OS::strdup (tcname),
- 1, 0,
- I_FALSE), NULL));
+
+ ACE_NEW (id,
+ Identifier (tcname,
+ 1,
+ 0,
+ I_FALSE));
+ break;
}
- break;
default:
ACE_ERROR ((LM_WARNING, "Unknown or invalid predefined type"));
break;
}
+
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ this->tc_name_->nconc (conc_name);
}
UTL_ScopedName *
-be_predefined_type::compute_tc_name (const char *prefix, const char *suffix)
+be_predefined_type::compute_tc_name (const char *prefix,
+ const char *suffix)
{
- return be_type::compute_tc_name (prefix, suffix);
+ return be_type::compute_tc_name (prefix,
+ suffix);
}
-// compute the size type of the node in question
+// Compute the size type of the node in question.
int
be_predefined_type::compute_size_type (void)
{
@@ -301,6 +367,7 @@ be_predefined_type::compute_size_type (void)
{
this->size_type (be_decl::FIXED);
}
+
return 0;
}
@@ -311,9 +378,14 @@ be_predefined_type::compute_repoID (void)
{
case AST_PredefinedType::PT_pseudo:
if (!ACE_OS::strcmp (this->local_name ()->get_string (), "Object"))
- this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0");
+ {
+ this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0");
+ }
else
- be_decl::compute_repoID ();
+ {
+ be_decl::compute_repoID ();
+ }
+
break;
default:
be_decl::compute_repoID ();
diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp
index 2a0dedeef32..bf75a77def5 100644
--- a/TAO/TAO_IDL/be/be_produce.cpp
+++ b/TAO/TAO_IDL/be/be_produce.cpp
@@ -70,28 +70,42 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "idl.h"
#include "idl_extern.h"
#include "be.h"
+#include "TAO_IDL_BE_Export.h"
ACE_RCSID(be, be_produce, "$Id$")
-/*
- * Do the work of this BE. This is the starting point for code generation.
- */
+// Abort this run of the BE.
+TAO_IDL_BE_Export void
+BE_abort (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "Fatal Error - Aborting\n"));
-void
+ ACE_OS::exit (1);
+}
+
+// Do the work of this BE. This is the starting point for code generation.
+TAO_IDL_BE_Export void
BE_produce (void)
{
- be_root *root; // root of the AST made up of BE nodes
- be_visitor *visitor; // visitor for root
- be_visitor_context ctx; // context information for the visitor root
+ // Root of the AST made up of BE nodes.
+ be_root *root = 0;
+
+ // Visitor for root.
+ be_visitor *visitor = 0;
- // configure the CodeGen object with the strategy to generate the visitors
- // that can produce interpretive or compiled marshaling stubs and skeletons
+ // Context information for the visitor root.
+ be_visitor_context ctx;
+
+ // Configure the CodeGen object with the strategy to generate the visitors
+ // that can produce interpretive or compiled marshaling stubs and skeletons.
tao_cg->config_visitor_factory ();
- // get the root node and narrow it down to be the back-end root node
+ // Get the root node and narrow it down to be the back-end root node.
AST_Decl *d = idl_global->root ();
root = be_root::narrow_from_decl (d);
- if (!root)
+
+ if (root == 0)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
@@ -99,13 +113,16 @@ BE_produce (void)
BE_abort ();
}
- if (idl_global->ami_call_back () == I_TRUE)
+ if (be_global->ami_call_back () == I_TRUE)
{
// Make a first pass over the AST and introduce
// AMI specific interfaces, methods and valuetypes.
- be_visitor_context *local_ctx = new be_visitor_context (ctx);
+ be_visitor_context *local_ctx = 0;
+ ACE_NEW (local_ctx,
+ be_visitor_context (ctx));
- visitor = new be_visitor_ami_pre_proc (local_ctx);
+ ACE_NEW (visitor,
+ be_visitor_ami_pre_proc (local_ctx));
if (root->accept (visitor) == -1)
{
@@ -114,19 +131,21 @@ BE_produce (void)
"client header for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
}
// Code generation involves six steps because of the six files that we
// generate.
- // (1) generate client header
- // instantiate a visitor context
- ctx.state (TAO_CodeGen::TAO_ROOT_CH); // set the codegen state
- // get a root visitor
+ // (1) Generate client header,
+ // instantiate a visitor context, and set the codegen state
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+
+ // Get a root visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the client header
+
+ // Generate code for the client header
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -134,16 +153,18 @@ BE_produce (void)
"client header for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
- // (2) generate client inline
- // set the context information
+ // (2) Generate client inline and
+ // set the context information.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_CI);
- // create a visitor
+
+ // Create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the client inline file
+
+ // Generate code for the client inline file.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -151,16 +172,18 @@ BE_produce (void)
"client inline for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
- // (3) generate client stubs
+ // (3) Generate client stubs.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_CS);
- // create a visitor
+
+ // Create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the client stubs
+
+ // Generate code for the client stubs.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -168,15 +191,17 @@ BE_produce (void)
"client stubs for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
- // (4) generate server header
+ // (4) Generate server header.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SH);
- // create a visitor
+
+ // Create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the server header file
+
+ // Generate code for the server header file.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -184,15 +209,17 @@ BE_produce (void)
"server header for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
- // (5) generate server inline
+ // (5) Generate server inline.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SI);
- // create a visitor
+
+ // Create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the server inline file
+
+ // Generate code for the server inline file.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -200,15 +227,17 @@ BE_produce (void)
"server inline for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
- // (6) generate server skeletons
+ // (6) Generate server skeletons
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SS);
- // create a visitor
+
+ // create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the server skeletons
+
+ // Generate code for the server skeletons.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -216,20 +245,21 @@ BE_produce (void)
"server skeletons for Root failed\n"));
BE_abort ();
}
- // it is our responsibility to free up the visitor
+
delete visitor;
- //check if the flags are set for generating the
- //the implementation header and skeleton files
- if(idl_global->gen_impl_files())
+ // Check if the flags are set for generating the
+ // the implementation header and skeleton files.
+ if (be_global->gen_impl_files ())
{
- // (7) generate implementation skeleton header
-
+ // (7) generate implementation skeleton header.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_IH);
- // create a visitor
+
+ // Create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the implementation skeleton header
+
+ // Generate code for the implementation skeleton header.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -238,17 +268,16 @@ BE_produce (void)
BE_abort ();
}
- // it is our responsibility to free up the visitor
delete visitor;
- // (8) generate implementation skeleton header
-
+ // (8) Generate implementation skeleton header.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_IS);
- // create a visitor
+
+ // Create a visitor.
visitor = tao_cg->make_visitor (&ctx);
- // generate code for the implementation skeleton header
+ // Generate code for the implementation skeleton header.
if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -257,18 +286,17 @@ BE_produce (void)
BE_abort ();
}
- // it is our responsibility to free up the visitor
delete visitor;
}
-}
-/*
- * Abort this run of the BE
- */
-void
-BE_abort (void)
-{
- ACE_ERROR ((LM_ERROR,
- "Fatal Error - Aborting\n"));
- ACE_OS::exit (1);
+ // Start the cleanup process.
+ root->destroy ();
+ delete root;
+ root = 0;
+
+ // Some miscellaneous cleanup.
+ idl_global->destroy ();
+ delete idl_global;
+ idl_global = 0;
}
+
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
index 43aa5ffa9ca..626f13ebdf3 100644
--- a/TAO/TAO_IDL/be/be_root.cpp
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -25,73 +25,81 @@
ACE_RCSID(be, be_root, "$Id$")
-// Default Constructor
+// Default Constructor.
be_root::be_root (void)
{
}
-// Constructor used to build the root of the abstract syntax tree (AST)
-be_root::be_root (UTL_ScopedName *n, UTL_StrList *p)
- : AST_Root (n, p),
- AST_Decl (AST_Decl::NT_root, n, p),
+// Constructor used to build the root of the abstract syntax tree (AST).
+be_root::be_root (UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Root (n,
+ p),
+ AST_Decl (AST_Decl::NT_root,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_root)
{
}
// We had to provide these since the AST_Root::fe_* method was setting the
-// names of these three to "local type"
+// names of these three to "local type".
-/*
- * Add this AST_Sequence to the locally defined types in this scope
- */
+// Add this AST_Sequence to the locally defined types in this scope.
AST_Sequence *
be_root::fe_add_sequence (AST_Sequence *t)
{
- if (t == NULL)
- return NULL;
+ if (t == 0)
+ {
+ return 0;
+ }
add_to_local_types(t);
return t;
}
-/*
- * Add this AST_String to the locally defined types in this scope
- */
+// Add this AST_String to the locally defined types in this scope
AST_String *
be_root::fe_add_string (AST_String *t)
{
- if (t == NULL)
- return NULL;
+ if (t == 0)
+ {
+ return 0;
+ }
add_to_local_types (t);
-
return t;
}
-/*
- * Add this AST_Array to the locally defined types in this scope
- */
+// Add this AST_Array to the locally defined types in this scope
AST_Array *
be_root::fe_add_array (AST_Array *t)
{
- if (t == NULL)
- return NULL;
+ if (t == 0)
+ {
+ return 0;
+ }
add_to_local_types (t);
-
return t;
}
+void
+be_root::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_decl::destroy ();
+}
+
int
be_root::accept (be_visitor *visitor)
{
return visitor->visit_root (this);
}
-/*
- * Narrowing methods
- */
+// Narrowing methods
IMPL_NARROW_METHODS3 (be_root, AST_Root, be_scope, be_decl)
IMPL_NARROW_FROM_DECL (be_root)
IMPL_NARROW_FROM_SCOPE (be_root)
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
index 16dfb2defe9..3f26593323e 100644
--- a/TAO/TAO_IDL/be/be_scope.cpp
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -8,13 +8,13 @@
ACE_RCSID(be, be_scope, "$Id$")
-// Default Constructor
+// Default Constructor.
be_scope::be_scope (void)
: comma_ (0)
{
}
-// Constructor
+// Constructor.
be_scope::be_scope (AST_Decl::NodeType type)
: UTL_Scope (type),
comma_ (0)
@@ -25,7 +25,8 @@ be_scope::~be_scope (void)
{
}
-// Code generation methods
+// Code generation methods.
+
void
be_scope::comma (unsigned short comma)
{
@@ -38,7 +39,7 @@ be_scope::comma (void) const
return this->comma_;
}
-// return the scope created by this node (if one exists, else NULL)
+// Return the scope created by this node (if one exists, else NULL).
be_decl *
be_scope::decl (void)
{
@@ -65,12 +66,38 @@ be_scope::decl (void)
}
}
+void
+be_scope::destroy (void)
+{
+ AST_Decl *i = 0;
+ UTL_ScopeActiveIterator *iter = 0;
+
+ ACE_NEW (iter,
+ UTL_ScopeActiveIterator (this,
+ IK_decls));
+
+ while (!iter->is_done ())
+ {
+ i = iter->item ();
+ i->destroy ();
+ delete i;
+ i = 0;
+ iter->next ();
+ }
+
+ delete iter;
+
+// Still some glitches, but the call should eventually
+// be made here.
+// UTL_Scope::destroy ();
+}
+
int
be_scope::accept (be_visitor *visitor)
{
return visitor->visit_scope (this);
}
-// narrowing methods
+// Narrowing methods.
IMPL_NARROW_METHODS1 (be_scope, UTL_Scope)
IMPL_NARROW_FROM_SCOPE (be_scope)
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 9386e890a1a..36fcbe36852 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -27,29 +27,31 @@
ACE_RCSID(be, be_sequence, "$Id$")
-/*
- * BE_Sequence
- */
be_sequence::be_sequence (void)
: mt_ (be_sequence::MNG_UNKNOWN)
{
- this->size_type (be_decl::VARIABLE); // always the case
- this->has_constructor (I_TRUE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
+ this->has_constructor (I_TRUE);
}
be_sequence::be_sequence (AST_Expression *v,
AST_Type *t,
idl_bool local,
idl_bool abstract)
- : AST_Sequence (v, t, t->is_local () || local, abstract),
+ : AST_Sequence (v,
+ t,
+ t->is_local () || local,
+ abstract),
AST_Decl (AST_Decl::NT_sequence,
- NULL,
- NULL),
- COMMON_Base (t->is_local () || local, abstract),
+ 0,
+ 0),
+ COMMON_Base (t->is_local () || local,
+ abstract),
mt_ (be_sequence::MNG_UNKNOWN)
{
- // check if we are bounded or unbounded. An expression value of 0 means
- // unbounded
+ // Check if we are bounded or unbounded. An expression value of 0 means
+ // unbounded.
if (v->ev ()->u.ulval == 0)
{
this->unbounded_ = I_TRUE;
@@ -59,9 +61,11 @@ be_sequence::be_sequence (AST_Expression *v,
this->unbounded_ = I_FALSE;
}
- this->size_type (be_decl::VARIABLE); // a sequence data type is always
- // VARIABLE
- this->has_constructor (I_TRUE); // always the case
+ // A sequence data type is always VARIABLE.
+ this->size_type (be_decl::VARIABLE);
+
+ // Always the case.
+ this->has_constructor (I_TRUE);
}
idl_bool
@@ -70,17 +74,22 @@ be_sequence::unbounded (void) const
return this->unbounded_;
}
-// helper to create_name
+// Helper to create_name.
char *
be_sequence::gen_name (void)
{
char namebuf [NAMEBUFSIZE];
- be_type *bt; // base type;
+ be_type *bt = 0; // Base type.
+
+ // Reset the buffer.
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer
- // retrieve the base type
+ // Retrieve the base type.
bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
+
+ if (bt == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
@@ -88,13 +97,13 @@ be_sequence::gen_name (void)
"bad base type\n"),
0);
}
+
if (bt->node_type () == AST_Decl::NT_sequence)
{
- // our base type is an anonymous sequence
- be_sequence *seq;
- seq = be_sequence::narrow_from_decl (bt);
+ // Our base type is an anonymous sequence.
+ be_sequence *seq = be_sequence::narrow_from_decl (bt);
- if (!seq)
+ if (seq == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
@@ -115,64 +124,84 @@ be_sequence::gen_name (void)
UTL_Scope *parent = this->defined_in ();
seq->set_defined_in (parent);
parent->add_sequence (seq);
- ACE_OS::sprintf (namebuf, "_tao_seq_%s", seq->gen_name ());
+ ACE_OS::sprintf (namebuf,
+ "_tao_seq_%s",
+ seq->gen_name ());
}
else
{
- ACE_OS::sprintf (namebuf, "_tao_seq_%s", bt->local_name ()->get_string ());
+ ACE_OS::sprintf (namebuf,
+ "_tao_seq_%s",
+ bt->local_name ()->get_string ());
}
- // append the size (if any)
- if (!this->unbounded_)
+
+ // Append the size (if any).
+ if (this->unbounded_ == 0)
{
ACE_OS::sprintf (namebuf,
"%s_%lu",
namebuf,
this->max_size ()->ev ()->u.ulval);
}
+
return ACE_OS::strdup (namebuf);
}
-// create a name for ourselves
+// Create a name for ourselves.
int
be_sequence::create_name (be_typedef *node)
{
static char namebuf [NAMEBUFSIZE];
- UTL_ScopedName *n = NULL;
- be_decl *scope; // scope in which we are defined
+ UTL_ScopedName *n = 0;
- // if there is a typedef node, we use its name as our name
+ // Scope in which we are defined.
+ be_decl *scope = 0;
+
+ // If there is a typedef node, we use its name as our name.
if (node)
{
n = (UTL_ScopedName *)node->name ()->copy ();
- this->set_name (n); // set our name
+ this->set_name (n);
}
else
{
+ // Reset the buffer.
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer
- ACE_OS::strcpy (namebuf, this->gen_name ()); // generate a local name
+ // Generate a local name.
+ ACE_OS::strcpy (namebuf,
+ this->gen_name ());
- // now see if we have a fully scoped name and if so, generate one
+ // Now see if we have a fully scoped name and if so, generate one.
UTL_Scope *us = this->defined_in ();
scope = be_scope::narrow_from_scope (us)->decl ();
- if (scope)
+ if (scope != 0)
{
- // make a copy of the enclosing scope's name
- n = (UTL_ScopedName *)scope->name ()->copy () ;
-
- // add our local name as the last component
- n->nconc (
- new UTL_ScopedName (
- new Identifier (ACE_OS::strdup (namebuf),
- 1,
- 0,
- I_FALSE),
- NULL
- )
- );
- // set the fully scoped name
+ // Make a copy of the enclosing scope's name.
+ n = (UTL_ScopedName *) scope->name ()->copy ();
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (ACE_OS::strdup (namebuf),
+ 1,
+ 0,
+ I_FALSE),
+ -1);
+
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_ScopedName (id,
+ 0),
+ -1);
+
+ // Add our local name as the last component.
+ n->nconc (conc_name);
+
+ // Set the fully scoped name.
this->set_name (n);
}
else
@@ -182,6 +211,7 @@ be_sequence::create_name (be_typedef *node)
return -1;
}
}
+
return 0;
}
@@ -189,22 +219,26 @@ be_sequence::create_name (be_typedef *node)
be_sequence::MANAGED_TYPE
be_sequence::managed_type (void)
{
- if (this->mt_ == be_sequence::MNG_UNKNOWN) // not calculated yet
+ if (this->mt_ == be_sequence::MNG_UNKNOWN) // Not calculated yet.
{
- be_type *bt, *prim_type; // base types
+ // Base types.
+ be_type *bt = 0;
+ be_type *prim_type = 0;
bt = be_type::narrow_from_decl (this->base_type ());
if (bt->node_type () == AST_Decl::NT_typedef)
{
- // get the primitive base type of this typedef node
+ // Get the primitive base type of this typedef node.
be_typedef *t = be_typedef::narrow_from_decl (bt);
prim_type = t->primitive_base_type ();
}
else
- prim_type = bt;
+ {
+ prim_type = bt;
+ }
- // determine if we need a managed type and which one
+ // Determine if we need a managed type and which one.
switch (prim_type->node_type ())
{
case AST_Decl::NT_interface:
@@ -219,17 +253,22 @@ be_sequence::managed_type (void)
break;
case AST_Decl::NT_pre_defined:
{
- be_predefined_type *bpd = be_predefined_type::narrow_from_decl
- (prim_type);
+ be_predefined_type *bpd =
+ be_predefined_type::narrow_from_decl (prim_type);
+
if (bpd->pt () == AST_PredefinedType::PT_pseudo)
{
- // if this pseudo is a CORBA::Object, then the managed type is
- // an objref
+ // If this pseudo is a CORBA::Object, then the managed type is
+ // an objref.
if (!ACE_OS::strcmp (bpd->local_name ()->get_string (),
"Object"))
- this->mt_ = be_sequence::MNG_OBJREF;
+ {
+ this->mt_ = be_sequence::MNG_OBJREF;
+ }
else
- this->mt_ = be_sequence::MNG_PSEUDO;
+ {
+ this->mt_ = be_sequence::MNG_PSEUDO;
+ }
}
else
{
@@ -239,25 +278,26 @@ be_sequence::managed_type (void)
break;
default:
this->mt_ = be_sequence::MNG_NONE;
- } // end of switch
+ }
}
+
return this->mt_;
}
-/*
- * Add this be_sequence to the locally defined types in this scope
- */
+// Add this be_sequence to the locally defined types in this scope
AST_Sequence *
be_sequence::fe_add_sequence (AST_Sequence *t)
{
- if (t == NULL)
- return NULL;
+ if (t == 0)
+ {
+ return 0;
+ }
this->add_to_local_types(t);
return t;
}
-// overridden method
+// Overridden method
be_decl *
be_sequence::decl (void)
{
@@ -275,87 +315,108 @@ const char *
be_sequence::instance_name ()
{
static char namebuf[NAMEBUFSIZE];
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
- be_type *bt;
+ be_type *bt = 0;
bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
+
+ if (bt == 0)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"gen_instantiate_name - "
"Bad element type\n"));
+
return namebuf;
}
- // generate the class name
+ // Generate the class name.
- // the base type after removing all the aliases
+ // The base type after removing all the aliases.
be_type *prim_type = bt;
+
if (bt->node_type () == AST_Decl::NT_typedef)
{
- // get the primitive base type of this typedef node
+ // Get the primitive base type of this typedef node.
be_typedef *t = be_typedef::narrow_from_decl (bt);
prim_type = t->primitive_base_type ();
}
- // generate the appropriate sequence type
+ // Generate the appropriate sequence type.
switch (this->managed_type ())
{
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
if (this->unbounded ())
- ACE_OS::sprintf (namebuf,
- "_TAO_Unbounded_Object_Sequence_%s",
- this->flat_name());
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Unbounded_Object_Sequence_%s",
+ this->flat_name ());
+ }
else
- ACE_OS::sprintf (namebuf,
- "_TAO_Bounded_Object_Sequence_%s_%lu",
- this->flat_name(),
- this->max_size ()->ev()->u.ulval);
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_Object_Sequence_%s_%lu",
+ this->flat_name (),
+ this->max_size ()->ev ()->u.ulval);
+ }
break;
- case be_sequence::MNG_STRING: // sequence of strings
+ case be_sequence::MNG_STRING:
if (this->unbounded ())
- ACE_OS::sprintf (namebuf,
- "TAO_Unbounded_String_Sequence");
+ {
+ ACE_OS::sprintf (namebuf,
+ "TAO_Unbounded_String_Sequence");
+ }
else
- ACE_OS::sprintf (namebuf,
- "_TAO_Bounded_String_Sequence_%s",
- this->flat_name());
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_String_Sequence_%s",
+ this->flat_name ());
+ }
break;
- case be_sequence::MNG_WSTRING: // sequence of wstrings
+ case be_sequence::MNG_WSTRING:
if (this->unbounded ())
- ACE_OS::sprintf (namebuf,
- "TAO_Unbounded_WString_Sequence");
+ {
+ ACE_OS::sprintf (namebuf,
+ "TAO_Unbounded_WString_Sequence");
+ }
else
- ACE_OS::sprintf (namebuf,
- "_TAO_Bounded_WString_Sequence_%s",
- this->flat_name());
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_WString_Sequence_%s",
+ this->flat_name ());
+ }
break;
- default: // not a managed type
+ default: // Not a managed type.
if (this->unbounded ())
{
// TAO provides extensions for octet sequences, first find out
// if the base type is an octet (or an alias for octet)
be_predefined_type *predef =
be_predefined_type::narrow_from_decl (prim_type);
- if (predef != 0 &&
- predef->pt() == AST_PredefinedType::PT_octet)
- ACE_OS::sprintf (namebuf,
- "TAO_Unbounded_Sequence<CORBA::Octet>");
+
+ if (predef != 0
+ && predef->pt() == AST_PredefinedType::PT_octet)
+ {
+ ACE_OS::sprintf (namebuf,
+ "TAO_Unbounded_Sequence<CORBA::Octet>");
+ }
else
- ACE_OS::sprintf (namebuf,
- "_TAO_Unbounded_Sequence_%s",
- this->flat_name());
- // or prim_type->flat_name ());
- // ACE_DEBUG ((LM_DEBUG, "testing.... %d, %d = <%s>\n",
- // predef, predef->pt (), namebuf));
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Unbounded_Sequence_%s",
+ this->flat_name ());
+ }
}
else
- ACE_OS::sprintf (namebuf,
- "_TAO_Bounded_Sequence_%s_%lu",
- this->flat_name(),
- this->max_size()->ev()->u.ulval);
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_Sequence_%s_%lu",
+ this->flat_name (),
+ this->max_size ()->ev ()->u.ulval);
+ }
break;
}
@@ -365,9 +426,9 @@ be_sequence::instance_name ()
idl_bool
be_sequence::in_recursion (be_type *node)
{
- if (!node)
+ if (node == 0)
{
- // there has to be a parameter
+ // There has to be a parameter
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_sequence::")
ACE_TEXT ("in_recursion - ")
@@ -376,6 +437,7 @@ be_sequence::in_recursion (be_type *node)
}
be_type *type = be_type::narrow_from_decl (this->base_type ());
+
if (!type)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -385,12 +447,25 @@ be_sequence::in_recursion (be_type *node)
0);
}
- if (!ACE_OS::strcmp (node->full_name (), type->full_name ()))
- // they match
- return 1;
+ if (!ACE_OS::strcmp (node->full_name (),
+ type->full_name ()))
+ {
+ // They match.
+ return 1;
+ }
else
- // not in recursion
- return 0;
+ {
+ // Not in recursion.
+ return 0;
+ }
+}
+
+void
+be_sequence::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_type::destroy ();
}
// Narrowing
diff --git a/TAO/TAO_IDL/be/be_stream_factory.cpp b/TAO/TAO_IDL/be/be_stream_factory.cpp
index bb662d03c5b..9a4c6e2317d 100644
--- a/TAO/TAO_IDL/be/be_stream_factory.cpp
+++ b/TAO/TAO_IDL/be/be_stream_factory.cpp
@@ -1,25 +1,24 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_sunsoft.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+#include "be_sunsoft.h"
ACE_RCSID(be, be_factory, "$Id$")
-// constructor
+// Constructor.
TAO_OutStream_Factory::TAO_OutStream_Factory (void)
: strm_type_ (TAO_OutStream_Factory::TAO_SUNSOFT)
{
}
-// destructor
+// Destructor.
TAO_OutStream_Factory::~TAO_OutStream_Factory (void)
{
}
-// set the type of specialized o/p stream we want
+// Set the type of specialized output stream we want.
int
TAO_OutStream_Factory::set_stream_type
(TAO_OutStream_Factory::TAO_OutStream_Type t)
@@ -28,7 +27,7 @@ TAO_OutStream_Factory::set_stream_type
return 0;
}
-// factory method
+// Factory method.
TAO_OutStream *
TAO_OutStream_Factory::make_outstream (void)
{
@@ -37,7 +36,7 @@ TAO_OutStream_Factory::make_outstream (void)
case TAO_OutStream_Factory::TAO_SUNSOFT:
return new TAO_SunSoft_OutStream ();
case TAO_OutStream_Factory::TAO_FLICK:
- return (TAO_OutStream *)0; // not implemented as yet
+ return (TAO_OutStream *)0; // Not implemented as yet.
default:
return (TAO_OutStream *)0;
}
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index d4757faec88..2a47aac6607 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -19,19 +19,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
ACE_RCSID(be, be_string, "$Id$")
-
-/*
- * BE_String
- */
be_string::be_string (void)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
}
be_string::be_string (AST_Expression *v)
@@ -44,7 +41,8 @@ be_string::be_string (AST_Expression *v)
NULL),
NULL)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
}
be_string::be_string (AST_Expression *v,
@@ -66,25 +64,47 @@ be_string::be_string (AST_Expression *v,
NULL),
NULL)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
}
-// overriden method
+// 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);
+ // Start with the head as the CORBA namespace.
+ Identifier *corba_id = 0;
+ ACE_NEW (corba_id,
+ Identifier ("CORBA",
+ 1,
+ 0,
+ I_FALSE));
+
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (corba_id,
+ 0));
+
+ Identifier *id = 0;
+ ACE_NEW (id,
+ Identifier ("_tc_string",
+ 1,
+ 0,
+ I_FALSE));
+
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_string", 1, 0,
- I_FALSE), NULL));
+ this->tc_name_->nconc (conc_name);
}
UTL_ScopedName *
-be_string::compute_tc_name (const char *prefix, const char *suffix)
+be_string::compute_tc_name (const char *prefix,
+ const char *suffix)
{
- return be_type::compute_tc_name (prefix, suffix);
+ return be_type::compute_tc_name (prefix,
+ suffix);
}
int
@@ -93,6 +113,6 @@ be_string::accept (be_visitor *visitor)
return visitor->visit_string (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS2 (be_string, AST_String, be_type)
IMPL_NARROW_FROM_DECL (be_string)
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index 4a21b786284..d5de6f70aa2 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -19,16 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
ACE_RCSID(be, be_structure, "$Id$")
-
-/*
- * BE_Structure
- */
be_structure::be_structure (void)
{
}
@@ -37,19 +33,22 @@ be_structure::be_structure (UTL_ScopedName *n,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Decl (AST_Decl::NT_struct, n, p),
+ : AST_Decl (AST_Decl::NT_struct,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_struct),
- COMMON_Base (local, abstract)
+ COMMON_Base (local,
+ abstract)
{
}
-// generate the _var definition for ourself
+// Generate the _var definition for ourself.
int
be_structure::gen_var_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -59,58 +58,61 @@ be_structure::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
+ ch = tao_cg->client_header ();
- // generate the var definition (always in the client header).
+ // Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which
// we account for here.
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->stub_export_macro ()
+ // Start with whatever was our current indent level.
+ ch->indent ();
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // default constr
+
+ // Default constructor.
*ch << namebuf << " (void); // default constructor" << nl;
- // constr
+
+ // Constructor.
*ch << namebuf << " (" << this->local_name () << " *);" << nl;
- // copy constructor
+
+ // Copy constructor.
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
*ch << namebuf << " (const " << this->local_name ()
<< " &); // fixed-size types only" << nl;
}
- // destructor
+ // Destructor.
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
+
+ // Assignment operator from a pointer.
*ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
- // assignment from _var
+
+ // Assignment from _var.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
*ch << namebuf << " &operator= (const " << this->local_name ()
<< " &); // fixed-size types only" << nl;
}
- // arrow operator
+ // Arrow operator.
*ch << local_name () << " *operator-> (void);" << nl;
*ch << "const " << this->local_name ()
<< " *operator-> (void) const;" << nl;
*ch << nl;
- // other extra types (cast operators, [] operator, and others)
+ // Other extra types (cast operators, [] operator, and others).
*ch << "operator const " << this->local_name () << " &() const;" << nl;
*ch << "operator " << this->local_name () << " &();" << nl;
*ch << "operator " << this->local_name () << " &() const;" << nl;
@@ -123,8 +125,9 @@ be_structure::gen_var_defn (char *)
*ch << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the
- // parameter passing rules and the base type
+
+ // The return types of in, out, inout, and _retn are based on the
+ // parameter passing rules and the base type.
if (this->size_type () == be_decl::FIXED)
{
*ch << "const " << this->local_name () << " &in (void) const;" << nl;
@@ -140,14 +143,14 @@ be_structure::gen_var_defn (char *)
*ch << local_name () << " *_retn (void);" << nl;
}
- // generate an additional member function
- // that returns the underlying pointer
+ // Generate an additional member function
+ // that returns the underlying pointer.
*ch << this->local_name () << " *ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
- // generate the private section
+ // Generate the private section.
*ch << "private:\n";
ch->incr_indent ();
*ch << this->local_name () << " *ptr_;\n";
@@ -162,37 +165,45 @@ int
be_structure::gen_var_impl (char *,
char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _var names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl; // end line
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_var", this->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", this->local_name ()->get_string ());
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ this->full_name ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- ci = cg->client_inline ();
+ ACE_OS::sprintf (lname,
+ "%s_var",
+ this->local_name ()->get_string ());
+
+ ci = tao_cg->client_inline ();
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // default constr
+ // Default constructor.
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname
<< " (void) // default constructor" << nl;
*ci << " " << ": ptr_ (0)" << nl;
*ci << "{}\n\n";
- // constr from a pointer
+ // Constructor from a pointer.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->local_name ()
@@ -200,7 +211,7 @@ be_structure::gen_var_impl (char *,
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const ::" << fname
@@ -215,7 +226,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
*ci << "// fixed-size types only" << nl;
@@ -230,7 +241,7 @@ be_structure::gen_var_impl (char *,
*ci << "}\n\n";
}
- // destructor
+ // Destructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -240,7 +251,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from a pointer
+ // Assignment operator from a pointer.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->local_name ()
@@ -253,7 +264,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE ::" << fname << " &" << nl;
*ci << fname << "::operator= (const ::" << fname
@@ -272,7 +283,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
ci->indent ();
@@ -295,7 +306,7 @@ be_structure::gen_var_impl (char *,
*ci << "}\n\n";
}
- // two arrow operators
+ // Two arrow operators.
ci->indent ();
*ci << "ACE_INLINE const " << "::" << this->name () << " *" << nl;
*ci << fname << "::operator-> (void) const" << nl;
@@ -314,7 +325,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - 3 cast operator ()
+ // Other extra methods - 3 cast operator ().
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::operator const " << "::" << this->name ()
@@ -345,7 +356,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // variable-size types only
+ // Variable-size types only.
if (this->size_type () == be_decl::VARIABLE)
{
ci->indent ();
@@ -379,7 +390,7 @@ be_structure::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // the out is handled differently based on our size type
+ // The out is handled differently based on our size type.
ci->indent ();
if (this->size_type () == be_decl::VARIABLE)
{
@@ -428,7 +439,7 @@ be_structure::gen_var_impl (char *,
}
- // the additional ptr () member function
+ // The additional ptr () member function.
ci->indent ();
*ci << "ACE_INLINE " << "::" << this->name () << " *" << nl;
*ci << fname << "::ptr (void) const" << nl;
@@ -441,13 +452,13 @@ be_structure::gen_var_impl (char *,
return 0;
}
-// generate the _out definition
+// Generate the _out definition.
int
be_structure::gen_out_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -457,15 +468,14 @@ be_structure::gen_out_defn (char *)
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
+ // Generate the out definition (always in the client header).
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ch->indent ();
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
@@ -473,23 +483,31 @@ be_structure::gen_out_defn (char *)
// No default constructor
- // constructor from a pointer
+ // Constructor from a pointer.
*ch << namebuf << " (" << this->local_name () << " *&);" << nl;
- // constructor from a _var &
+
+ // Constructor from a _var &.
*ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
- // constructor from a _out &
+
+ // Constructor from a _out &.
*ch << namebuf << " (const " << namebuf << " &);" << nl;
- // assignment operator from a _out &
+
+ // Assignment operator from a _out &.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // assignment
+
+ // Assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators.
+
+ // Assignment.
*ch << namebuf << " &operator= ("
<< this->local_name () << " *);" << nl;
- // operator ()
+
+ // Operator ().
*ch << "operator " << this->local_name () << " *&();" << nl;
+
// ptr fn
*ch << this->local_name () << " *&ptr (void);" << nl;
+
// operator ->
*ch << this->local_name () << " *operator-> (void);" << nl;
@@ -510,10 +528,10 @@ int
be_structure::gen_out_impl (char *,
char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _out names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -531,21 +549,19 @@ be_structure::gen_out_impl (char *,
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // constr from a pointer
+ // Constructor from a pointer.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << "::"
@@ -557,7 +573,7 @@ be_structure::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // constructor from _var &
+ // Constructor from _var &.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->local_name ()
@@ -570,7 +586,7 @@ be_structure::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const ::" << fname
@@ -578,7 +594,7 @@ be_structure::gen_out_impl (char *,
*ci << " : ptr_ (ACE_const_cast (" << lname << "&, p).ptr_)" << nl;
*ci << "{}\n\n";
- // assignment operator from _out &
+ // assignment operator from _out &.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const ::" << fname <<
@@ -590,9 +606,9 @@ be_structure::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment from _var is not allowed by a private declaration
+ // Assignment from _var is not allowed by a private declaration.
- // assignment operator from pointer
+ // Assignment operator from pointer.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->local_name () << " *p)" << nl;
@@ -603,7 +619,7 @@ be_structure::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator " << "::" << this->name ()
@@ -638,30 +654,31 @@ be_structure::gen_out_impl (char *,
return 0;
}
-// compute the size type of the node in question
+// 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;
+ UTL_ScopeActiveIterator *si = 0;
+ AST_Decl *d = 0;
+ be_decl *bd = 0;
if (this->nmembers () > 0)
{
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this,
- UTL_Scope::IK_decls);
+ // If there are elements in this scope,
// instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
while (!(si->is_done ()))
{
- // get the next AST decl node
+ // 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
+ // 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.
@@ -677,44 +694,49 @@ be_structure::compute_size_type (void)
"narrow_from_decl returned 0\n"));
}
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
+
return 0;
}
-// Are we or the parameter node involved in any recursion
+// Are we or the parameter node involved in any recursion?
idl_bool
be_structure::in_recursion (be_type *node)
{
- if (!node)
+ if (node == 0)
{
- // we are determining the recursive status for ourselves
+ // We are determining the recursive status for ourselves.
node = this;
}
- // proceed if the number of members in our scope is greater than 0
+ // Proceed if the number of members in our scope is greater than 0.
if (this->nmembers () > 0)
{
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
+ // Initialize an iterator to iterate over our scope.
+ UTL_ScopeActiveIterator *si = 0;
ACE_NEW_RETURN (si,
UTL_ScopeActiveIterator (this,
UTL_Scope::IK_decls),
-1);
- // continue until each element is visited
+ // Continue until each element is visited.
while (!si->is_done ())
{
be_field *field = be_field::narrow_from_decl (si->item ());
- if (!field)
- // This will be an enum value or other legitimate non-field
- // member - in any case, no recursion.
+
+ if (field == 0)
+ // This will be an enum value or other legitimate non-field
+ // member - in any case, no recursion.
{
si->next ();
continue;
}
+
be_type *type = be_type::narrow_from_decl (field->field_type ());
- if (!type)
+
+ if (type == 0)
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
@@ -723,27 +745,38 @@ be_structure::in_recursion (be_type *node)
ACE_TEXT ("bad field type\n")),
0);
}
+
if (type->in_recursion (node))
{
delete si;
return 1;
}
si->next ();
- } // end of while loop
+ }
+
delete si;
- } // end of if
+ }
- // not in recursion
+ // Not in recursion.
return 0;
}
+void
+be_structure::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_type::destroy ();
+ AST_Decl::destroy ();
+}
+
int
be_structure::accept (be_visitor *visitor)
{
return visitor->visit_structure (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS3 (be_structure, AST_Structure, be_scope, be_type)
IMPL_NARROW_FROM_DECL (be_structure)
IMPL_NARROW_FROM_SCOPE (be_structure)
diff --git a/TAO/TAO_IDL/be/be_sunsoft.cpp b/TAO/TAO_IDL/be/be_sunsoft.cpp
index 7e2214415be..b9b46f1c7ad 100644
--- a/TAO/TAO_IDL/be/be_sunsoft.cpp
+++ b/TAO/TAO_IDL/be/be_sunsoft.cpp
@@ -1,13 +1,12 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_sunsoft.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+#include "be_sunsoft.h"
ACE_RCSID(be, be_sunsoft, "$Id$")
-
TAO_SunSoft_OutStream::TAO_SunSoft_OutStream (void)
: TAO_OutStream ()
{
@@ -20,35 +19,53 @@ TAO_SunSoft_OutStream::~TAO_SunSoft_OutStream (void)
TAO_OutStream &
TAO_SunSoft_OutStream::print (Identifier *id)
{
- ACE_OS::fprintf (this->fp_, id->get_string ());
+ ACE_OS::fprintf (this->fp_,
+ id->get_string ());
+
return *this;
}
TAO_OutStream &
TAO_SunSoft_OutStream::print (UTL_IdList *idl)
{
- UTL_IdListActiveIterator *i = new UTL_IdListActiveIterator (idl);
- long first = I_TRUE;
- long second = I_FALSE;
+ long first = I_TRUE;
+ long second = I_FALSE;
+
+ UTL_IdListActiveIterator *i = 0;
+ ACE_NEW_RETURN (i,
+ UTL_IdListActiveIterator (idl),
+ *this);
- while (!(i->is_done ()))
+ while (!i->is_done ())
{
if (!first)
- *this << "::";
+ {
+ *this << "::";
+ }
else if (second)
- first = second = I_FALSE;
- // print the identifier
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
*this << i->item ();
+
if (first)
{
if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0)
- // does not start with a ""
- first = I_FALSE;
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
else
- second = I_TRUE;
+ {
+ second = I_TRUE;
+ }
}
+
i->next ();
}
+
return *this;
}
@@ -71,7 +88,7 @@ TAO_SunSoft_OutStream::print (AST_Expression *expr)
this->TAO_OutStream::print ("%ld", ev->u.lval);
break;
case AST_Expression::EV_ulong:
- this->TAO_OutStream::print ("%lu%c", ev->u.ulval, 'U');
+ this->TAO_OutStream::print ("%u%c", ev->u.ulval, 'U');
break;
case AST_Expression::EV_longlong:
#if ! defined (ACE_LACKS_LONGLONG_T)
@@ -80,9 +97,7 @@ TAO_SunSoft_OutStream::print (AST_Expression *expr)
break;
case AST_Expression::EV_ulonglong:
#if ! defined (ACE_LACKS_LONGLONG_T)
- this->TAO_OutStream::print (ACE_UINT64_FORMAT_SPECIFIER "%c",
- ev->u.ullval,
- 'U');
+ this->TAO_OutStream::print ("%u%c", ev->u.ullval, 'U');
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
break;
case AST_Expression::EV_float:
@@ -160,9 +175,10 @@ TAO_SunSoft_OutStream::print (AST_Expression *expr)
break;
}
}
- else //
+ else
{
// XXXASG: need to add code here
}
+
return *this;
}
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index e48af9ccaf5..d25a52f5959 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -19,17 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
ACE_RCSID(be, be_type, "$Id$")
-
-/*
- * BE_Type
- */
-
be_type::be_type (void)
: tc_name_ (0),
type_name_ (0),
@@ -37,8 +32,12 @@ be_type::be_type (void)
{
}
-be_type::be_type (AST_Decl::NodeType nt, UTL_ScopedName *n, UTL_StrList *p)
- : AST_Decl (nt, n, p),
+be_type::be_type (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : AST_Decl (nt,
+ n,
+ p),
tc_name_ (0),
type_name_ (0),
nested_type_name_ (0)
@@ -47,14 +46,9 @@ be_type::be_type (AST_Decl::NodeType nt, UTL_ScopedName *n, UTL_StrList *p)
be_type::~be_type (void)
{
- if (this->nested_type_name_ != 0)
- {
- delete[] this->nested_type_name_;
- this->nested_type_name_ = 0;
- }
}
-// compute the typecode name. The idea is to use the fully scoped name,
+// Compute the typecode name. The idea is to use the fully scoped name,
// however, prepend a _tc_ to the last component. A slightly different approach
// is required of the predefined types. Hence this method is overridden for
// predefined types.
@@ -63,65 +57,104 @@ void
be_type::compute_tc_name (void)
{
static char namebuf [NAMEBUFSIZE];
- UTL_ScopedName *n;
+ UTL_ScopedName *n = this->name ();
- this->tc_name_ = NULL;
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- n = this->name ();
- while (n->tail () != NULL)
+ this->tc_name_ = 0;
+
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ while (n->tail () != 0)
{
- if (!this->tc_name_)
+ // Does not exist.
+ if (this->tc_name_ == 0)
{
- // does not exist
- this->tc_name_ = new UTL_ScopedName (n->head (), NULL);
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (n->head ()->copy (),
+ 0));
}
else
{
- this->tc_name_->nconc (new UTL_ScopedName (n->head (), NULL));
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (n->head ()->copy (),
+ 0));
+
+ this->tc_name_->nconc (conc_name);
}
+
n = (UTL_ScopedName *)n->tail ();
}
- ACE_OS::sprintf (namebuf, "_tc_%s", n->last_component ()->get_string ());
- if (!this->tc_name_)
+
+ ACE_OS::sprintf (namebuf,
+ "_tc_%s",
+ n->last_component ()->get_string ());
+
+ Identifier *id = 0;
+ ACE_NEW (id,
+ Identifier (namebuf,
+ 1,
+ 0,
+ I_FALSE));
+
+ // Does not exist.
+ if (this->tc_name_ == 0)
{
- // does not exist
- this->tc_name_ = new UTL_ScopedName (new Identifier (ACE_OS::strdup
- (namebuf), 1, 0, I_FALSE), NULL);
+ ACE_NEW (this->tc_name_,
+ UTL_ScopedName (id,
+ 0));
}
else
{
- this->tc_name_->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup
- (namebuf), 1,
- 0, I_FALSE), NULL));
- }
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
- return;
+ this->tc_name_->nconc (conc_name);
+ }
}
UTL_ScopedName *
-be_type::compute_tc_name (const char *prefix, const char *suffix)
+be_type::compute_tc_name (const char *prefix,
+ const char *suffix)
{
// Both prefix and suffix has to be valid. Else return.
if (prefix == 0 || suffix == 0)
- return 0;
+ {
+ return 0;
+ }
static char namebuf [NAMEBUFSIZE];
- UTL_ScopedName *n;
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ UTL_ScopedName *n = this->name ();
+ UTL_ScopedName *result = 0;
- UTL_ScopedName *result = NULL;
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- n = this->name ();
- while (n->tail () != NULL)
+ while (n->tail () != 0)
{
- if (!result)
+ if (result == 0)
{
- // does not exist
- result = new UTL_ScopedName (n->head (), NULL);
+ // Does not exist.
+ ACE_NEW_RETURN (result,
+ UTL_ScopedName (n->head ()->copy (),
+ 0),
+ 0);
}
else
{
- result->nconc (new UTL_ScopedName (n->head (), NULL));
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_ScopedName (n->head ()->copy (),
+ 0),
+ 0);
+
+ result->nconc (conc_name);
}
+
n = (UTL_ScopedName *)n->tail ();
}
@@ -131,35 +164,53 @@ be_type::compute_tc_name (const char *prefix, const char *suffix)
n->last_component ()->get_string (),
suffix);
- if (!result)
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (namebuf,
+ 1,
+ 0,
+ I_FALSE),
+ 0);
+
+ if (result == 0)
{
- // does not exist
- result = new UTL_ScopedName (new Identifier (ACE_OS::strdup
- (namebuf), 1, 0, I_FALSE), NULL);
+ // Does not exist.
+ ACE_NEW_RETURN (result,
+ UTL_ScopedName (id,
+ 0),
+ 0);
}
else
{
- result->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup
- (namebuf), 1,
- 0, I_FALSE), NULL));
+ UTL_ScopedName *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ result->nconc (conc_name);
}
return result;
}
-// retrieve typecode name
+// Retrieve typecode name.
UTL_ScopedName *
-be_type::tc_name (const char *prefix, const char *suffix)
+be_type::tc_name (const char *prefix,
+ const char *suffix)
{
if (prefix != 0 && suffix != 0)
{
// Just compute and return the name.
- return compute_tc_name (prefix, suffix);
+ return compute_tc_name (prefix,
+ suffix);
}
// Compute and init the member.
- if (!this->tc_name_)
- compute_tc_name ();
+ if (this->tc_name_ == 0)
+ {
+ compute_tc_name ();
+ }
return this->tc_name_;
}
@@ -170,10 +221,10 @@ be_type::tc_name (const char *prefix, const char *suffix)
// This version always generates ACE_NESTED_CLASS, (leave ace/ACE.h and friends
// do the porting)
//
-// caution: returns the same buffer pointer even if the contents may change
+// Caution: returns the same buffer pointer even if the contents may change
// in the next call. (return std::string anyone?)
//
-// return the type name using the ACE_NESTED_CLASS macro
+// Return the type name using the ACE_NESTED_CLASS macro
const char *
be_type::nested_type_name (be_decl *use_scope,
@@ -198,31 +249,47 @@ be_type::nested_sp_type_name (be_decl *use_scope,
const char *suffix,
const char *prefix)
{
- be_decl *fu_scope; // our defining scope
- char fu_name [NAMEBUFSIZE],fl_name[NAMEBUFSIZE];
+ // Our defining scope.
+ be_decl *fu_scope = 0;
+
+ char fu_name [NAMEBUFSIZE];
+ char fl_name [NAMEBUFSIZE];
- ACE_OS::memset (fu_name, '\0', NAMEBUFSIZE);
- ACE_OS::memset (fl_name, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (fu_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::memset (fl_name,
+ '\0',
+ NAMEBUFSIZE);
- fu_scope = ((this->defined_in ())?
- (be_scope::narrow_from_scope (this->defined_in ())->decl ()):
- 0);
+ fu_scope = this->defined_in ()
+ ? be_scope::narrow_from_scope (this->defined_in ())->decl ()
+ : 0;
- ACE_OS::strcat (fu_name, fu_scope->full_name ());
- ACE_OS::strcat (fu_name, "::TAO_");
- ACE_OS::strcat (fu_name, this->flat_name());
+ ACE_OS::strcat (fu_name,
+ fu_scope->full_name ());
+
+ ACE_OS::strcat (fu_name,
+ "::TAO_");
+
+ ACE_OS::strcat (fu_name,
+ this->flat_name());
- ACE_OS::strcat (fl_name, "TAO_");
- ACE_OS::strcat (fl_name, this->flat_name());
+ ACE_OS::strcat (fl_name,
+ "TAO_");
+
+ ACE_OS::strcat (fl_name,
+ this->flat_name());
- return nested_name(fl_name,
- fu_name,
- use_scope,
- suffix,
- prefix);
+ return this->nested_name (fl_name,
+ fu_name,
+ use_scope,
+ suffix,
+ prefix);
}
-// This is the real thing used by the two other methods above
+// This is the real thing used by the two other methods above.
const char *
be_type::nested_name (const char* local_name,
const char* full_name,
@@ -230,7 +297,7 @@ be_type::nested_name (const char* local_name,
const char *suffix,
const char *prefix)
{
- // some compilers do not like generating a fully scoped name for a type that
+ // Some compilers do not like generating a fully scoped name for a type that
// was defined in the same enclosing scope in which it was defined. For such,
// we emit a macro defined in the ACE library.
//
@@ -239,170 +306,254 @@ be_type::nested_name (const char* local_name,
// typename we are using was defined in the current scope. But we
// need to ensure that it was not defined in any of our ancestor
// scopes as well. If that is the case, then we can generate a fully
- // scoped name for that type, else we use the ACE_NESTED_CLASS macro
+ // scoped name for that type, else we use the ACE_NESTED_CLASS macro.
- // thus we need some sort of relative name to be generated
+ // Thus we need some sort of relative name to be generated.
if (this->nested_type_name_ == 0)
- ACE_NEW_RETURN (this->nested_type_name_, char[NAMEBUFSIZE], 0);
-
- be_decl *def_scope = 0; // our defining scope
- char // hold the fully scoped name
- def_name [NAMEBUFSIZE],
- use_name [NAMEBUFSIZE];
- char // these point to the prev, curr and next component in the scope
- *def_curr = def_name,
- *def_next = 0,
- *use_curr = use_name,
- *use_next = 0;
-
- int len_to_match = 0; // how many chars to compare
-
- // initialize the buffers
- ACE_OS::memset (this->nested_type_name_, '\0', NAMEBUFSIZE);
- ACE_OS::memset (def_name, '\0', NAMEBUFSIZE);
- ACE_OS::memset (use_name, '\0', NAMEBUFSIZE);
-
- // traverse every component of the def_scope and use_scope beginning at the
+ {
+ ACE_NEW_RETURN (this->nested_type_name_,
+ char[NAMEBUFSIZE],
+ 0);
+ }
+
+ // Our defining scope.
+ be_decl *def_scope = 0;
+
+ // Hold the fully scoped name.
+ char def_name [NAMEBUFSIZE];
+ char use_name [NAMEBUFSIZE];
+
+ // These point to the prev, curr and next component in the scope.
+ char *def_curr = def_name;
+ char *def_next = 0;
+ char *use_curr = use_name;
+ char *use_next = 0;
+
+ // How many chars to compare.
+ int len_to_match = 0;
+
+ // Initialize the buffers.
+ ACE_OS::memset (this->nested_type_name_,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::memset (def_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::memset (use_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ // Traverse every component of the def_scope and use_scope beginning at the
// root and proceeding towards the leaf trying to see if the components
// match. Continue until there is a match and keep accumulating the path
// traversed. This forms the first argument to the ACE_NESTED_CLASS
// macro. Whenever there is no match, the remaining components of the
// def_scope form the second argument.
- def_scope = ((this->defined_in ())?
- (be_scope::narrow_from_scope (this->defined_in ())->decl ()):
- 0);
+ def_scope = this->defined_in ()
+ ? be_scope::narrow_from_scope (this->defined_in ())->decl ()
+ : 0;
- if (def_scope && def_scope->node_type () != AST_Decl::NT_root && use_scope)
- // if both scopes exist and that we are not in the root scope
+ if (def_scope
+ && def_scope->node_type () != AST_Decl::NT_root
+ && use_scope)
+ // If both scopes exist and that we are not in the root scope.
{
- ACE_OS::strcpy (def_name, def_scope->full_name ());
- ACE_OS::strcpy (use_name, use_scope->full_name ());
+ ACE_OS::strcpy (def_name,
+ def_scope->full_name ());
- // find the first occurrence of a :: and advance the next pointers accordingly
+ ACE_OS::strcpy (use_name,
+ use_scope->full_name ());
+
+ // Find the first occurrence of a :: and advance
+ // the next pointers accordingly.
def_next = ACE_OS::strstr (def_curr, "::");
use_next = ACE_OS::strstr (use_curr, "::");
// If the scopes are identical, don't supply them.
- if(!ACE_OS::strcmp (def_name, use_name))
+ if (ACE_OS::strcmp (def_name,
+ use_name)
+ == 0)
{
- if (prefix)
- ACE_OS::strcat (this->nested_type_name_, prefix);
+ if (prefix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ prefix);
+ }
ACE_OS::strcat (this->nested_type_name_,
local_name);
- if (suffix)
- ACE_OS::strcat (this->nested_type_name_, suffix);
+ if (suffix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ suffix);
+ }
return this->nested_type_name_;
}
- if (def_next)
- len_to_match = ACE_OS::strlen (def_curr)
- - ACE_OS::strlen (def_next);
+ if (def_next != 0)
+ {
+ len_to_match =
+ ACE_OS::strlen (def_curr) - ACE_OS::strlen (def_next);
+ }
else
- len_to_match = ACE_OS::strlen (def_curr);
+ {
+ len_to_match = ACE_OS::strlen (def_curr);
+ }
- if (use_next)
+ if (use_next != 0)
{
- int len = ACE_OS::strlen (use_curr)
- - ACE_OS::strlen (use_next);
+ int len =
+ ACE_OS::strlen (use_curr) - ACE_OS::strlen (use_next);
+
if (len > len_to_match)
- len_to_match = len;
+ {
+ len_to_match = len;
+ }
}
else
{
int len = ACE_OS::strlen (use_curr);
+
if (len > len_to_match)
- len_to_match = len;
+ {
+ len_to_match = len;
+ }
}
- if (!ACE_OS::strncmp (def_curr, use_curr, len_to_match))
+ if (ACE_OS::strncmp (def_curr,
+ use_curr,
+ len_to_match)
+ == 0)
{
- // initial prefix matches i.e., they have a common root
- // start by initializing the macro
+ // Initial prefix matches i.e., they have a common root.
+ // Start by initializing the macro.
+ ACE_OS::sprintf (this->nested_type_name_,
+ "ACE_NESTED_CLASS (");
- ACE_OS::sprintf (this->nested_type_name_, "ACE_NESTED_CLASS (");
+ // Initialize the first argument.
ACE_OS::strncat (this->nested_type_name_,
def_curr,
- len_to_match); // initialize the first argument
+ len_to_match);
- // shift the curr scopes to the next level
- def_curr = (def_next ? (def_next + 2) : 0); // skip the ::
- use_curr = (use_next ? (use_next + 2) : 0); // skip the ::
+ // Shift the current scopes to the next level.
+ def_curr = (def_next ? (def_next + 2) : 0); // Skip the ::
+ use_curr = (use_next ? (use_next + 2) : 0); // Skip the ::
while (def_curr && use_curr)
{
- // find the first occurrence of a :: and advance the next pointers accordingly
+ // Find the first occurrence of a :: and advance the
+ // next pointers accordingly.
def_next = ACE_OS::strstr (def_curr, "::");
use_next = ACE_OS::strstr (use_curr, "::");
- if (def_next)
- len_to_match = ACE_OS::strlen (def_curr)
- - ACE_OS::strlen (def_next);
+ if (def_next != 0)
+ {
+ len_to_match =
+ ACE_OS::strlen (def_curr) - ACE_OS::strlen (def_next);
+ }
else
- len_to_match = ACE_OS::strlen (def_curr);
+ {
+ len_to_match = ACE_OS::strlen (def_curr);
+ }
- if (use_next)
+ if (use_next != 0)
{
- int len = ACE_OS::strlen (use_curr)
- - ACE_OS::strlen (use_next);
+ int len =
+ ACE_OS::strlen (use_curr) - ACE_OS::strlen (use_next);
+
if (len > len_to_match)
- len_to_match = len;
+ {
+ len_to_match = len;
+ }
}
else
{
int len = ACE_OS::strlen (use_curr);
+
if (len > len_to_match)
- len_to_match = len;
+ {
+ len_to_match = len;
+ }
}
- if (!ACE_OS::strncmp (def_curr, use_curr, len_to_match))
+ if (ACE_OS::strncmp (def_curr,
+ use_curr,
+ len_to_match)
+ == 0)
{
- // they have same prefix, append to arg1
- ACE_OS::strcat (this->nested_type_name_, "::");
+ // They have same prefix, append to arg1.
+ ACE_OS::strcat (this->nested_type_name_,
+ "::");
+
ACE_OS::strncat (this->nested_type_name_,
def_curr,
- len_to_match);
- def_curr = (def_next ? (def_next + 2) : 0); // skip the ::
- use_curr = (use_next ? (use_next + 2) : 0); // skip the ::
+ len_to_match);
+
+ def_curr = (def_next ? (def_next + 2) : 0); // Skip the ::
+ use_curr = (use_next ? (use_next + 2) : 0); // Skip the ::
}
else
{
- // no match. This is the end of the first argument. Get out
- // of the loop as no more comparisons are necessary
+ // No match. This is the end of the first argument. Get out
+ // of the loop as no more comparisons are necessary.
break;
}
}
- // start the 2nd argument of the macro
+ // Start the 2nd argument of the macro.
ACE_OS::strcat (this->nested_type_name_, ", ");
- // copy the remaining def_name (if any left)
- if (def_curr)
+ // Copy the remaining def_name (if any are left).
+ if (def_curr != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ def_curr);
+
+ ACE_OS::strcat (this->nested_type_name_,
+ "::");
+ }
+
+ // Append our local name.
+ if (prefix != 0)
{
- ACE_OS::strcat (this->nested_type_name_, def_curr);
- ACE_OS::strcat (this->nested_type_name_, "::");
+ ACE_OS::strcat (this->nested_type_name_, prefix);
}
- // append our local name
- if (prefix)
- ACE_OS::strcat (this->nested_type_name_, prefix);
- ACE_OS::strcat (this->nested_type_name_, local_name);
- if (suffix)
- ACE_OS::strcat (this->nested_type_name_, suffix);
- ACE_OS::strcat (this->nested_type_name_, ")");
+ ACE_OS::strcat (this->nested_type_name_,
+ local_name);
+
+ if (suffix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ suffix);
+ }
+
+ ACE_OS::strcat (this->nested_type_name_,
+ ")");
+
return this->nested_type_name_;
- } // end of if the root prefixes match
+ } // End of if the root prefixes match.
+ }
+
+ // Otherwise just emit our full_name.
+ if (prefix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_, prefix);
}
- // otherwise just emit our full_name
- if (prefix)
- ACE_OS::strcat (this->nested_type_name_, prefix);
- ACE_OS::strcat (this->nested_type_name_, full_name);
- if (suffix)
- ACE_OS::strcat (this->nested_type_name_, suffix);
+ ACE_OS::strcat (this->nested_type_name_,
+ full_name);
+
+ if (suffix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ suffix);
+ }
return this->nested_type_name_;
}
@@ -411,22 +562,23 @@ be_type::nested_name (const char* local_name,
// CODE GENERATION
// *****************************
-// generate the _var definition for ourself
+// Generate the _var definition for ourself.
int
be_type::gen_var_defn (char *)
{
return 0;
}
-// implementation of the _var class. All of these get generated in the inline
-// file
+// Implementation of the _var class. All of these get generated
+// in the inline file
int
-be_type::gen_var_impl (char *, char *)
+be_type::gen_var_impl (char *,
+ char *)
{
return 0;
}
-// generate the _out definition
+// Generate the _out definition.
int
be_type::gen_out_defn (char *)
{
@@ -434,7 +586,8 @@ be_type::gen_out_defn (char *)
}
int
-be_type::gen_out_impl (char *, char *)
+be_type::gen_out_impl (char *,
+ char *)
{
return 0;
}
@@ -442,22 +595,46 @@ be_type::gen_out_impl (char *, char *)
AST_Decl::NodeType
be_type::base_node_type (void) const
{
- return ACE_const_cast(be_type*, this)->node_type ();
+ return ACE_const_cast (be_type*, this)->node_type ();
}
idl_bool
be_type::in_recursion (be_type *)
{
- // be default we are not involved in recursion
+ // By default we are not involved in recursion.
return 0;
}
+// Cleanup method
+void
+be_type::destroy (void)
+{
+ if (this->tc_name_ != 0)
+ {
+ this->tc_name_->destroy ();
+ delete this->tc_name_;
+ this->tc_name_ = 0;
+ }
+
+ if (this->type_name_ != 0)
+ {
+ ACE_OS::free (this->type_name_);
+ this->type_name_ = 0;
+ }
+
+ if (this->nested_type_name_ != 0)
+ {
+ delete this->nested_type_name_;
+ this->nested_type_name_ = 0;
+ }
+}
+
int
be_type::accept (be_visitor *visitor)
{
return visitor->visit_type (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS2 (be_type, AST_Type, be_decl)
IMPL_NARROW_FROM_DECL (be_type)
diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp
index aaefcccf9c2..c65373d6100 100644
--- a/TAO/TAO_IDL/be/be_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_typedef.cpp
@@ -19,13 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
ACE_RCSID(be, be_typedef, "$Id$")
-
be_typedef::be_typedef (void)
{
}
@@ -35,63 +34,81 @@ be_typedef::be_typedef (AST_Type *bt,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Typedef (bt, n, p, bt->is_local () || local, abstract),
- AST_Decl (AST_Decl::NT_typedef, n, p),
- COMMON_Base (local, abstract)
+ : AST_Typedef (bt,
+ n,
+ p,
+ bt->is_local () || local,
+ abstract),
+ AST_Decl (AST_Decl::NT_typedef,
+ n,
+ p),
+ COMMON_Base (local,
+ abstract)
{
}
-// given a typedef node, traverse the chain of base types until they are no
-// more typedefs, and return that most primitive base type
+// Given a typedef node, traverse the chain of base types until they are no
+// more typedefs, and return that most primitive base type.
be_type *
be_typedef::primitive_base_type (void)
{
- be_type *d;
+ be_type *d = this;
+ be_typedef *temp = 0;
- d = this;
while (d && d->node_type () == AST_Decl::NT_typedef)
{
- be_typedef *temp; // temporary
-
temp = be_typedef::narrow_from_decl (d);
d = be_type::narrow_from_decl (temp->base_type ());
}
+
return d;
}
-// compute the size type of the node in question
+// 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)
+
+ if (type == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_typedef::compute_size_type - "
- "bad base type\n"), -1);
+ "bad base type\n"),
+ -1);
}
- // our size type is the same as our type
+ // Our size type is the same as our type.
this->size_type (type->size_type ());
- // and while we're here, take care of has_constructor
+ //While we're here, take care of has_constructor.
this->has_constructor (type->has_constructor ());
return 0;
}
-AST_Decl::NodeType be_typedef::base_node_type (void) const
+AST_Decl::NodeType
+be_typedef::base_node_type (void) const
{
- be_type *base = be_type::narrow_from_decl (ACE_const_cast(be_typedef*, this)->base_type ());
+ be_typedef *td = ACE_const_cast (be_typedef *, this);
+
+ be_type *base = be_type::narrow_from_decl (td->base_type ());
+
return base->base_node_type ();
}
+void
+be_typedef::destroy (void)
+{
+ // Do nothing
+}
+
int
be_typedef::accept (be_visitor *visitor)
{
return visitor->visit_typedef (this);
}
-// Narrowing
+// 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 ef9852500fa..7fcebfc36cf 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -26,13 +26,10 @@
ACE_RCSID(be, be_union, "$Id$")
-/*
- * BE_Union
- */
-
be_union::be_union (void)
{
- this->has_constructor (I_TRUE); // always the case
+ // Always the case.
+ this->has_constructor (I_TRUE);
}
be_union::be_union (AST_ConcreteType *dt,
@@ -40,82 +37,108 @@ be_union::be_union (AST_ConcreteType *dt,
UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Union (dt, n, p, local, abstract),
- AST_Structure (AST_Decl::NT_union, n, p, local, abstract),
- AST_Decl (AST_Decl::NT_union, n, p),
+ : AST_Union (dt,
+ n,
+ p,
+ local,
+ abstract),
+ AST_Structure (AST_Decl::NT_union,
+ n,
+ p,
+ local,
+ abstract),
+ AST_Decl (AST_Decl::NT_union,
+ n,
+ p),
UTL_Scope (AST_Decl::NT_union),
- COMMON_Base (local, abstract),
+ COMMON_Base (local,
+ abstract),
default_index_ (-2)
{
this->default_value_.computed_ = -2;
- this->has_constructor (I_TRUE); // always the case
+
+ // Always the case.
+ this->has_constructor (I_TRUE);
}
-// compute total number of members
+// Compute total number of members.
int
be_union::compute_default_index (void)
{
- UTL_ScopeActiveIterator *si; // iterator
- AST_Decl *d; // temp node
- be_union_branch *bub; // union branch node
- int i = 0; // counter
+ UTL_ScopeActiveIterator *si = 0;
+ AST_Decl *d = 0;
+ be_union_branch *bub = 0;
+ int i = 0;
- // if default case does not exist, it will have a value of -1 according to
- // the spec
+ // If default case does not exist, it will have a value of -1 according to
+ // the spec.
this->default_index_ = -1;
- // if there are elements in this scope
+ // If there are elements in this scope...
if (this->nmembers () > 0)
{
- // instantiate a scope iterator.
- si = new UTL_ScopeActiveIterator (this,
- UTL_Scope::IK_decls);
+ // Instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
- while (!(si->is_done ()))
+ while (!si->is_done ())
{
- // get the next AST decl node
+ // Get the next AST decl node.
d = si->item ();
+
if (!d->imported ())
{
bub = be_union_branch::narrow_from_decl (d);
+
for (unsigned long j = 0;
j < bub->label_list_length ();
++j)
{
- // check if we are printing the default case
+ // Check if we are printing the default case.
if (bub->label (j)->label_kind ()
- == AST_UnionLabel::UL_default)
- this->default_index_ = i; // zero based indexing
+ == AST_UnionLabel::UL_default)
+ {
+ // Zero based indexing.
+ this->default_index_ = i;
+ }
}
+
// TAO's Typecode class keeps only a member count (not
// a label count) so this increment has been moved
// out of the inner loop.
i++;
}
+
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
+
return 0;
}
-// return the default_index
+// Return the default_index.
int
be_union::default_index (void)
{
if (this->default_index_ == -2)
- this->compute_default_index ();
+ {
+ this->compute_default_index ();
+ }
return this->default_index_;
}
-// generate the _var definition for ourself
+// Generate the _var definition for ourself.
int
be_union::gen_var_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -125,59 +148,61 @@ be_union::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
-
- // generate the var definition (always in the client header).
+ // Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // default constr
+
+ // Default constructor.
*ch << namebuf << " (void); // default constructor" << nl;
- // constr
+
+ // Constructor.
*ch << namebuf << " (" << this->local_name () << " *);" << nl;
- // copy constructor
+
+ // Copy constructor.
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
*ch << namebuf << " (const " << this->local_name ()
<< " &); // fixed-size types only" << nl;
}
- // destructor
+ // Destructor.
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
+
+ // Assignment operator from a pointer.
*ch << namebuf << " &operator= ("
<< this->local_name () << " *);" << nl;
- // assignment from _var
+
+ // Assignment from _var.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
*ch << namebuf << " &operator= (const " << this->local_name ()
<< " &); // fixed-size types only" << nl;
}
- // arrow operator
+ // Arrow operator.
*ch << local_name () << " *operator-> (void);" << nl;
*ch << "const " << this->local_name ()
<< " *operator-> (void) const;" << nl;
*ch << nl;
- // other extra types (cast operators, [] operator, and others)
+ // Other extra types (cast operators, [] operator, and others).
*ch << "operator const " << this->local_name () << " &() const;" << nl;
*ch << "operator " << this->local_name () << " &();" << nl;
*ch << "operator " << this->local_name () << " &() const;" << nl;
@@ -190,8 +215,9 @@ be_union::gen_var_defn (char *)
*ch << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
+
+ // The return types of in, out, inout, and _retn are based on the parameter
+ // passing rules and the base type.
if (this->size_type () == be_decl::FIXED)
{
*ch << "const " << local_name () << " &in (void) const;" << nl;
@@ -207,13 +233,14 @@ be_union::gen_var_defn (char *)
*ch << this->local_name () << " *_retn (void);" << nl;
}
- // generate an additional member function that returns the underlying pointer
+ // Generate an additional member function that
+ // returns the underlying pointer.
*ch << this->local_name () << " *ptr(void) const;\n";
*ch << "\n";
ch->decr_indent ();
- // generate the private section
+ // Generate the private section
*ch << "private:\n";
ch->incr_indent ();
*ch << this->local_name () << " *ptr_;\n";
@@ -223,16 +250,18 @@ be_union::gen_var_defn (char *)
return 0;
}
-// implementation of the _var class. All of these get generated in the inline
-// file
+// Implementation of the _var class. All of these get generated in the inline
+// file.
int
be_union::gen_var_impl (char *,
char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _var names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+
+ // To hold the full and local _var names.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -250,26 +279,24 @@ be_union::gen_var_impl (char *,
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // default constr
+ // Default constructor.
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
*ci << " " << ": ptr_ (0)" << nl;
*ci << "{}\n\n";
- // constr from a pointer
+ // Constructor from a pointer.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->local_name ()
@@ -277,11 +304,11 @@ be_union::gen_var_impl (char *,
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const ::" << fname <<
- " &p) // copy constructor" << nl;
+ *ci << fname << "::" << lname << " (const ::" << fname
+ << " &p) // copy constructor" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "if (p.ptr_)" << nl;
@@ -292,7 +319,7 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
*ci << "// fixed-size types only" << nl;
@@ -307,7 +334,7 @@ be_union::gen_var_impl (char *,
*ci << "}\n\n";
}
- // destructor
+ // Destructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -317,7 +344,7 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from a pointer
+ // Assignment operator from a pointer.
ci->indent ();
*ci << "ACE_INLINE ::" << fname << " &" << nl;
*ci << fname << "::operator= (" << this->local_name ()
@@ -330,11 +357,11 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE ::" << fname << " &" << nl;
- *ci << fname << "::operator= (const ::" << fname <<
- " &p)" << nl;
+ *ci << fname << "::operator= (const ::" << fname
+ << " &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "if (this != &p)" << nl;
@@ -349,7 +376,7 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // fixed-size types only
+ // Fixed-size types only.
if (this->size_type () == be_decl::FIXED)
{
ci->indent ();
@@ -372,7 +399,7 @@ be_union::gen_var_impl (char *,
*ci << "}\n\n";
}
- // two arrow operators
+ // Two arrow operators.
ci->indent ();
*ci << "ACE_INLINE const ::" << this->name () << " *" << nl;
*ci << fname << "::operator-> (void) const" << nl;
@@ -391,7 +418,7 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - 3 cast operator ()
+ // Other extra methods - 3 cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator const ::" << this->name ()
@@ -422,7 +449,7 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // variable-size types only
+ // Variable-size types only.
if (this->size_type () == be_decl::VARIABLE)
{
ci->indent ();
@@ -437,7 +464,7 @@ be_union::gen_var_impl (char *,
*ci << "}\n\n";
}
- // in, inout, out, _retn, and ptr
+ // in, inout, out, _retn, and ptr.
ci->indent ();
*ci << "ACE_INLINE const ::" << this->name () << " &" << nl;
*ci << fname << "::in (void) const" << nl;
@@ -456,7 +483,7 @@ be_union::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // the out and _retn are handled differently based on our size type
+ // The out and _retn are handled differently based on our size type.
ci->indent ();
if (this->size_type () == be_decl::VARIABLE)
{
@@ -504,7 +531,7 @@ be_union::gen_var_impl (char *,
*ci << "}\n\n";
}
- // the additional ptr () member function
+ // The additional ptr () member function.
ci->indent ();
*ci << "ACE_INLINE ::" << this->name () << " *" << nl;
*ci << fname << "::ptr (void) const" << nl;
@@ -517,13 +544,15 @@ be_union::gen_var_impl (char *,
return 0;
}
-// generate the _out definition
+// Generate the _out definition
int
be_union::gen_out_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+
+ // To hold the _out name.
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -533,38 +562,45 @@ be_union::gen_out_defn (char *)
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
+ // Generate the out definition (always in the client header).
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ch->indent ();
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // No default constructor
+ // No default constructor.
- // constructor from a pointer
+ // Constructor from a pointer.
*ch << namebuf << " (" << this->local_name () << " *&);" << nl;
- // constructor from a _var &
+
+ // Constructor from a _var &.
*ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
- // constructor from a _out &
+
+ // Constructor from a _out &.
*ch << namebuf << " (const " << namebuf << " &);" << nl;
- // assignment operator from a _out &
+
+ // Assignment operator from a _out &.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // assignment
+
+ // Assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators.
+
+ // Assignment.
*ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
- // operator ()
+
+ // operator ().
*ch << "operator " << local_name () << " *&();" << nl;
- // ptr fn
+
+ // ptr function.
*ch << this->local_name () << " *&ptr (void);" << nl;
+
// operator ->
*ch << this->local_name () << " *operator-> (void);" << nl;
@@ -585,10 +621,12 @@ int
be_union::gen_out_impl (char *,
char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _out names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+
+ // To hold the full and local _out names.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -606,21 +644,19 @@ be_union::gen_out_impl (char *,
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // constr from a pointer
+ // Constructor from a pointer.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->local_name ()
@@ -632,7 +668,7 @@ be_union::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // constructor from _var &
+ // Constructor from _var &.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->local_name ()
@@ -645,7 +681,7 @@ be_union::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const ::" << fname
@@ -653,7 +689,7 @@ be_union::gen_out_impl (char *,
*ci << " : ptr_ (ACE_const_cast (" << lname << "&, p).ptr_)" << nl;
*ci << "{}\n\n";
- // assignment operator from _out &
+ // Assignment operator from _out &.
ci->indent ();
*ci << "ACE_INLINE ::" << fname << " &" << nl;
*ci << fname << "::operator= (const ::" << fname
@@ -665,9 +701,9 @@ be_union::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment from _var is not allowed by a private declaration
+ // Assignment from _var is not allowed by a private declaration.
- // assignment operator from pointer
+ // Assignment operator from pointer.
ci->indent ();
*ci << "ACE_INLINE ::" << fname << " &" << nl;
*ci << fname << "::operator= (" << this->local_name () << " *p)" << nl;
@@ -678,7 +714,7 @@ be_union::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator ::" << this->name ()
@@ -689,7 +725,7 @@ be_union::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // ptr function
+ // ptr function.
ci->indent ();
*ci << "ACE_INLINE ::" << this->name () << " *&" << nl;
*ci << fname << "::ptr (void) // ptr" << nl;
@@ -713,30 +749,32 @@ be_union::gen_out_impl (char *,
return 0;
}
-// compute the size type of the node in question
+// Compute the size type of the node in question.
int
be_union::compute_size_type (void)
{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
+ UTL_ScopeActiveIterator *si = 0;
+ AST_Decl *d = 0;
+ be_decl *bd = 0;
if (this->nmembers () > 0)
{
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this,
- UTL_Scope::IK_decls);
+ // If there are elements in this scope,
// instantiate a scope iterator.
- while (!(si->is_done ()))
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
+
+ while (!si->is_done ())
{
- // get the next AST decl node
+ // 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
+ // 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.
@@ -748,37 +786,42 @@ be_union::compute_size_type (void)
"WARNING (%N:%l) be_union::compute_size_type - "
"narrow_from_decl returned 0\n"));
}
+
si->next ();
- } // end of while
- delete si; // free the iterator object
+ }
+
+ delete si;
}
+
return 0;
}
-// Are we or the parameter node involved in any recursion
+// Are we or the parameter node involved in any recursion?
idl_bool
be_union::in_recursion (be_type *node)
{
- if (!node)
+ if (node == 0)
{
- // we are determining the recursive status for ourselves
+ // We are determining the recursive status for ourselves.
node = this;
}
- // proceed if the number of members in our scope is greater than 0
+ // Proceed if the number of members in our scope is greater than 0.
if (this->nmembers () > 0)
{
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
+ // Initialize an iterator to iterate thru our scope.
+ UTL_ScopeActiveIterator *si = 0;
ACE_NEW_RETURN (si,
UTL_ScopeActiveIterator (this,
UTL_Scope::IK_decls),
- -1);
- // continue until each element is visited
+ 0);
+ // Continue until each element is visited.
while (!si->is_done ())
{
- be_union_branch *field = be_union_branch::narrow_from_decl (si->item ());
- if (!field)
+ be_union_branch *field =
+ be_union_branch::narrow_from_decl (si->item ());
+
+ if (field == 0)
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
@@ -787,8 +830,10 @@ be_union::in_recursion (be_type *node)
ACE_TEXT ("bad field node\n")),
0);
}
+
be_type *type = be_type::narrow_from_decl (field->field_type ());
- if (!type)
+
+ if (type == 0)
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
@@ -797,27 +842,30 @@ be_union::in_recursion (be_type *node)
ACE_TEXT ("bad field type\n")),
0);
}
+
if (type->in_recursion (node))
{
delete si;
return 1;
}
+
si->next ();
- } // end of while loop
+ }
+
delete si;
- } // end of if
+ }
- // not in recursion
+ // Not in recursion.
return 0;
}
-// return the default value
+// Return the default value.
int
be_union::default_value (be_union::DefaultValue &dv)
{
if (this->default_value_.computed_ == -2)
{
- // we need to compute it
+ // We need to compute it.
if (this->compute_default_value () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -828,43 +876,52 @@ be_union::default_value (be_union::DefaultValue &dv)
-1);
}
}
+
dv = this->default_value_;
return 0;
}
-// determine the implicit default value (if any)
+// Determine the implicit default value (if any).
int
be_union::compute_default_value (void)
{
- // check if we really need a default value. This will be true if there is an
+ // Check if we really need a default value. This will be true if there is an
// explicit default case OR if an implicit default exists because not all
// values of the discriminant type are covered by the cases.
- // compute the total true "case" labels i.e., exclude the "default" case
+ // Compute the total true "case" labels i.e., exclude the "default" case.
int total_case_members = 0;
- // instantiate a scope iterator.
- UTL_ScopeActiveIterator *si
- = new UTL_ScopeActiveIterator (this,
- UTL_Scope::IK_decls);
- while (!(si->is_done ()))
+ // Instantiate a scope iterator.
+ UTL_ScopeActiveIterator *si = 0;
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
+
+ while (!si->is_done ())
{
- // get the next AST decl node
+ // Get the next AST decl node.
be_union_branch *ub =
be_union_branch::narrow_from_decl (si->item ());
- if (ub)
+
+ if (ub != 0)
{
- // if the label is a case label, increment by 1
+ // If the label is a case label, increment by 1.
for (unsigned long i = 0;
i < ub->label_list_length ();
++i)
{
if (ub->label (i)->label_kind () == AST_UnionLabel::UL_label)
- total_case_members++;
+ {
+ total_case_members++;
+ }
}
}
+
si->next ();
}
+
delete si;
// Check if the total_case_members cover the entire
@@ -878,17 +935,23 @@ be_union::compute_default_value (void)
{
case AST_Expression::EV_short:
case AST_Expression::EV_ushort:
- if (total_case_members == ACE_UINT16_MAX+1)
- this->default_value_.computed_ = 0;
+ if (total_case_members == ACE_UINT16_MAX + 1)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
break;
case AST_Expression::EV_long:
case AST_Expression::EV_ulong:
if ((unsigned int) total_case_members > ACE_UINT32_MAX)
- this->default_value_.computed_ = 0;
+ {
+ this->default_value_.computed_ = 0;
+ }
+
break;
case AST_Expression::EV_longlong:
case AST_Expression::EV_ulonglong:
- // error for now
+ // Error for now.
this->default_value_.computed_ = -1;
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_union::compute_default_value ")
@@ -897,35 +960,49 @@ be_union::compute_default_value (void)
-1);
ACE_NOTREACHED (break;)
case AST_Expression::EV_char:
- if (total_case_members == ACE_OCTET_MAX+1)
- this->default_value_.computed_ = 0;
+ if (total_case_members == ACE_OCTET_MAX + 1)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
break;
case AST_Expression::EV_wchar:
- if (total_case_members == ACE_WCHAR_MAX+1)
- this->default_value_.computed_ = 0;
+ if (total_case_members == ACE_WCHAR_MAX + 1)
+ {
+ this->default_value_.computed_ = 0;
+ }
+
break;
case AST_Expression::EV_bool:
if (total_case_members == 2)
- this->default_value_.computed_ = 0;
+ {
+ this->default_value_.computed_ = 0;
+ }
+
break;
case AST_Expression::EV_any:
- // has to be enum
+ // Has to be enum.
{
be_decl *d = be_decl::narrow_from_decl (this->disc_type ());
+
if (d->node_type () == AST_Decl::NT_typedef)
{
be_typedef *bt = be_typedef::narrow_from_decl (d);
d = bt->primitive_base_type ();
}
+
be_enum *en = be_enum::narrow_from_decl (d);
- if (en)
+
+ if (en != 0)
{
if (total_case_members == en->member_count ())
- this->default_value_.computed_ = 0;
+ {
+ this->default_value_.computed_ = 0;
+ }
}
else
{
- // error
+ // Error.
this->default_value_.computed_ = -1;
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_union::")
@@ -936,21 +1013,21 @@ be_union::compute_default_value (void)
}
break;
default:
- // error
+ // Error.
this->default_value_.computed_ = -1;
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_union::compute_default_value ")
ACE_TEXT ("- Bad discriminant type\n")),
-1);
ACE_NOTREACHED (break;)
- } // end of switch
+ } // End of switch
- // if we have determined that we don't need a default case and even then a
- // default case was provided, flag this off as error
- if ((this->default_value_.computed_ == 0) &&
- (this->default_index () != -1))
+ // If we have determined that we don't need a default case and even then a
+ // default case was provided, flag this off as error.
+ if ((this->default_value_.computed_ == 0)
+ && (this->default_index () != -1))
{
- // error
+ // Error.
this->default_value_.computed_ = -1;
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_union::compute_default_value ")
@@ -958,22 +1035,22 @@ be_union::compute_default_value (void)
-1);
}
- // proceed only if necessary
+ // Proceed only if necessary.
switch (this->default_value_.computed_)
{
case -1:
- // error. We should never be here because errors have already been caught
- // above
+ // Error. We should never be here because errors have already been caught
+ // above.
return -1;
case 0:
- // nothing more to do
+ // Nothing more to do.
return 0;
default:
- // proceed further down
+ // Proceed further down.
break;
}
- // initialization of the default value data member
+ // Initialization of the default value data member.
switch (this->udisc_type ())
{
case AST_Expression::EV_short:
@@ -983,7 +1060,7 @@ be_union::compute_default_value (void)
this->default_value_.u.ushort_val = 0;
break;
case AST_Expression::EV_long:
- // The +1 is to avert an MSVC warning
+ // The +1 is to avert a warning on many compilers.
this->default_value_.u.long_val = ACE_INT32_MIN + 1;
break;
case AST_Expression::EV_ulong:
@@ -1003,25 +1080,30 @@ be_union::compute_default_value (void)
break;
case AST_Expression::EV_longlong:
case AST_Expression::EV_ulonglong:
- // unimplemented
+ // Unimplemented.
default:
- // error caught earlier.
+ // Error caught earlier.
break;
- } // end of switch
+ }
- // proceed until we have found the appropriate default value
+ // Proceed until we have found the appropriate default value.
while (this->default_value_.computed_ == -2)
{
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
+ // Instantiate a scope iterator.
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ -1);
int break_loop = 0;
- while (!(si->is_done ()) && !break_loop)
+ while (!si->is_done () && break_loop == 0)
{
- // get the next AST decl node
- be_union_branch *ub = be_union_branch::narrow_from_decl (si->item ());
- if (ub)
+ // Get the next AST decl node
+ be_union_branch *ub =
+ be_union_branch::narrow_from_decl (si->item ());
+
+ if (ub != 0)
{
for (unsigned long i = 0;
i < ub->label_list_length () && !break_loop;
@@ -1029,11 +1111,12 @@ be_union::compute_default_value (void)
{
if (ub->label (i)->label_kind () == AST_UnionLabel::UL_label)
{
- // not a default
+ // Not a default.
AST_Expression *expr = ub->label (i)->label_val ();
- if (!expr)
+
+ if (expr == 0)
{
- // error
+ // Error.
this->default_value_.computed_ = -1;
ACE_ERROR_RETURN
((LM_ERROR,
@@ -1045,96 +1128,108 @@ be_union::compute_default_value (void)
switch (expr->ev ()->et)
{
- // check if they match in which case this
+ // Check if they match in which case this
// cannot be the implicit default value. So
// start with a new value and try the whole loop
- // again because our case labels may not be sorted
+ // again because our case labels may not be sorted.
case AST_Expression::EV_short:
if (this->default_value_.u.short_val
- == expr->ev ()->u.sval)
+ == expr->ev ()->u.sval)
{
this->default_value_.u.short_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_ushort:
if (this->default_value_.u.ushort_val
- == expr->ev ()->u.usval)
+ == expr->ev ()->u.usval)
{
this->default_value_.u.ushort_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_long:
if (this->default_value_.u.long_val
- == expr->ev ()->u.lval)
+ == expr->ev ()->u.lval)
{
this->default_value_.u.long_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_ulong:
if (this->default_value_.u.ulong_val
- == expr->ev ()->u.ulval)
+ == expr->ev ()->u.ulval)
{
this->default_value_.u.ulong_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_char:
if (this->default_value_.u.char_val
- == expr->ev ()->u.cval)
+ == expr->ev ()->u.cval)
{
this->default_value_.u.char_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_wchar:
if (this->default_value_.u.wchar_val
- == expr->ev ()->u.wcval)
+ == expr->ev ()->u.wcval)
{
this->default_value_.u.wchar_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_bool:
if (this->default_value_.u.bool_val
- == expr->ev ()->u.bval)
+ == expr->ev ()->u.bval)
{
this->default_value_.u.bool_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_any:
// this is the case of enums. We maintain
// evaluated values which always start with 0
if (this->default_value_.u.enum_val
- == expr->ev ()->u.eval)
+ == expr->ev ()->u.eval)
{
this->default_value_.u.enum_val++;
break_loop = 1;
}
+
break;
case AST_Expression::EV_longlong:
case AST_Expression::EV_ulonglong:
- // unimplemented. right now flag as error.
+ // Unimplemented. right now - flag as error.
default:
- // error
+ // Error.
break;
- } // end of switch
+ } // End of switch.
} // if label_Kind == label
- } // end of for loop going thru all labels
- } // if valid union branch
+ } // End of for loop going thru all labels.
+ } // If valid union branch.
+
si->next ();
- } // end of while scope iterator loop
- delete si; // free the iterator object
+ } // End of while scope iterator loop.
- // we have not aborted the inner loops which means we have found the
- // default value
- if (!break_loop)
- this->default_value_.computed_ = 1;
+ delete si;
- } // end of outer while
+ // We have not aborted the inner loops which means we have found the
+ // default value.
+ if (break_loop == 0)
+ {
+ this->default_value_.computed_ = 1;
+ }
+
+ } // End of outer while (default_value.computed == -2).
return 0;
}
@@ -1142,10 +1237,12 @@ be_union::compute_default_value (void)
idl_bool
be_union::has_duplicate_case_labels (void)
{
- // instantiate a scope iterator.
- UTL_ScopeActiveIterator *si =
- new UTL_ScopeActiveIterator (this,
- UTL_Scope::IK_decls);
+ // Instantiate a scope iterator.
+ UTL_ScopeActiveIterator *si = 0;
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls),
+ 0);
while (!si->is_done ())
{
@@ -1164,15 +1261,22 @@ be_union::has_duplicate_case_labels (void)
return I_FALSE;
}
-// visitor method
+void
+be_union::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_type::destroy ();
+}
+// Visitor method.
int
be_union::accept (be_visitor *visitor)
{
return visitor->visit_union (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS3 (be_union, AST_Union, be_scope, be_type)
IMPL_NARROW_FROM_DECL (be_union)
IMPL_NARROW_FROM_SCOPE (be_union)
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index 1c45b78dda8..0d20ee99a56 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -19,16 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
ACE_RCSID(be, be_union_branch, "$Id$")
-
-/*
- * BE_UnionBranch
- */
be_union_branch::be_union_branch (void)
{
}
@@ -37,28 +33,40 @@ be_union_branch::be_union_branch (UTL_LabelList *ll,
AST_Type *ft,
UTL_ScopedName *n,
UTL_StrList *p)
- : AST_UnionBranch (ll, ft, n, p),
- AST_Field (AST_Decl::NT_union_branch, ft, n, p),
- AST_Decl (AST_Decl::NT_union_branch, n, p),
- COMMON_Base (ft->is_local (), ft->is_abstract ())
+ : AST_UnionBranch (ll,
+ ft,
+ n,
+ p),
+ AST_Field (AST_Decl::NT_union_branch,
+ ft,
+ n,
+ p),
+ AST_Decl (AST_Decl::NT_union_branch,
+ n,
+ p),
+ COMMON_Base (ft->is_local (),
+ ft->is_abstract ())
{
}
-// compute the size type of the node in question
+// Compute the size type of the node in question.
int
be_union_branch::compute_size_type (void)
{
be_type *type = be_type::narrow_from_decl (this->field_type ());
- if (!type)
+
+ if (type == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_field::compute_size_type - "
- "bad field type\n"), -1);
+ "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
+ // Our size type is the same as our type.
+ // As a side effect will also update the size type of parent.
+ this->size_type (type->size_type ());
+
return 0;
}
@@ -66,6 +74,7 @@ int
be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index)
{
AST_Expression *e = this->label (index)->label_val ();
+
if (e->ec () != AST_Expression::EC_symbol)
{
// Easy, just a number...
@@ -76,13 +85,19 @@ be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index)
// If the enum is not in the global scope we have to prefix it.
be_union *u =
be_union::narrow_from_scope (this->defined_in ());
+
if (u == 0)
- return -1;
+ {
+ return -1;
+ }
be_type* dt =
be_type::narrow_from_decl (u->disc_type ());
+
if (dt == 0)
- return -1;
+ {
+ return -1;
+ }
// Check if discriminator is a typedef of an integer. If so, and the
// first IF block in this function didn't catch it, then we
@@ -99,6 +114,7 @@ be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index)
// scope, then it is easy to generate the enum values....
be_scope* scope =
be_scope::narrow_from_scope (dt->defined_in ());
+
if (scope == 0)
{
*os << e->n ();
@@ -107,10 +123,10 @@ be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index)
// But if it was generated inside a module or something similar then
// we must prefix the enum value with something...
- be_decl* decl =
- scope->decl ();
+ be_decl* decl = scope->decl ();
*os << decl->full_name () << "::" << e->n ()->last_component ();
+
return 0;
}
@@ -164,15 +180,16 @@ be_union_branch::gen_default_label_value (TAO_OutStream *os,
}
case AST_Expression::EV_longlong:
case AST_Expression::EV_ulonglong:
- // unimplemented
+ // Unimplemented.
default:
- // error caught earlier.
+ // Error caught earlier.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch::"
"gen_default_label_value - "
"bad or unimplemented discriminant type\n"),
-1);
}
+
return 0;
}
@@ -182,6 +199,6 @@ be_union_branch::accept (be_visitor *visitor)
return visitor->visit_union_branch (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl)
IMPL_NARROW_FROM_DECL (be_union_branch)
diff --git a/TAO/TAO_IDL/be/be_union_label.cpp b/TAO/TAO_IDL/be/be_union_label.cpp
index aeab28d0d56..6a1cd05dbec 100644
--- a/TAO/TAO_IDL/be/be_union_label.cpp
+++ b/TAO/TAO_IDL/be/be_union_label.cpp
@@ -1,22 +1,19 @@
//
// $Id$
//
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
ACE_RCSID(be, be_union_label, "$Id$")
-
-/*
- * BE_UnionLabel
- */
be_union_label::be_union_label()
{
}
-be_union_label::be_union_label(AST_UnionLabel::UnionLabel ul,
+be_union_label::be_union_label (AST_UnionLabel::UnionLabel ul,
AST_Expression *v)
- : AST_UnionLabel(ul, v)
+ : AST_UnionLabel (ul,
+ v)
{
}
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
index 3fe6c8329b2..9294dc67cc3 100644
--- a/TAO/TAO_IDL/be/be_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -21,45 +21,74 @@
#include "idl.h"
#include "idl_extern.h"
-// #include "be_visitor_valuetype.h"
#include "be.h"
#ifdef IDL_HAS_VALUETYPE
ACE_RCSID(be, be_valuetype, "$Id$")
-/*
- * BE_Valuetype
- */
-
-// default constructor
+// Default constructor.
be_valuetype::be_valuetype (void)
: full_obv_skel_name_ (0),
abstract_ (0)
{
- this->size_type (be_decl::VARIABLE); // always the case
- (AST_Module::narrow_from_scope (this->defined_in ()))->set_has_nested_valuetype ();
- this->has_constructor (I_TRUE); // always the case
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
+
+ AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ());
+
+ if (m != 0)
+ {
+ m->set_has_nested_valuetype ();
+ }
+
+ // Always the case.
+ this->has_constructor (I_TRUE);
}
-// constructor used to build the AST
+// Constructor used to build the AST.
be_valuetype::be_valuetype (UTL_ScopedName *n,
AST_Interface **ih,
long nih,
UTL_StrList *p,
idl_bool set_abstract)
- : be_interface (n, ih, nih, 0, 0, p, 0, 0),
- AST_Interface (n, ih, nih, 0, 0, p, 0, 0),
- AST_Decl (AST_Decl::NT_interface, n, p), // it's like an interface
+ : be_interface (n,
+ ih,
+ nih,
+ 0,
+ 0,
+ p,
+ 0,
+ 0),
+ AST_Interface (n,
+ ih,
+ nih,
+ 0,
+ 0,
+ p,
+ 0,
+ 0),
+ AST_Decl (AST_Decl::NT_interface, // It's like an interface.
+ n,
+ p),
UTL_Scope (AST_Decl::NT_interface),
full_obv_skel_name_ (0),
abstract_ (set_abstract)
{
- // check that redefine() copy all members !
- // ---
- this->size_type (be_decl::VARIABLE); // always the case
- (AST_Module::narrow_from_scope (this->defined_in ()))->set_has_nested_valuetype ();
- this->has_constructor (I_TRUE); // always the case
+ // Check that redefine() copies all members.
+
+ // Always the case.
+ this->size_type (be_decl::VARIABLE);
+
+ AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ());
+
+ if (m != 0)
+ {
+ m->set_has_nested_valuetype ();
+ }
+
+ // Always the case.
+ this->has_constructor (I_TRUE);
}
be_valuetype::~be_valuetype (void)
@@ -71,37 +100,39 @@ void
be_valuetype::redefine (AST_Interface *from,
UTL_StrList *p)
{
- this->AST_Interface::redefine (from, p);
- abstract_ = from->is_abstract_valuetype();
+ this->AST_Interface::redefine (from,
+ p);
+
+ abstract_ = from->is_abstract_valuetype ();
}
-// Is true if no-virtual accessor and modifier should be generated
-// If #pragma TAO OBV opt_accessor (todo) is used or -Wb,obv_opt_accessor
+// Is true if non-virtual accessor and modifier should be generated
+// If #pragma TAO OBV opt_accessor (todo) is used or -Wb,obv_opt_accessor.
idl_bool
-be_valuetype::opt_accessor ()
+be_valuetype::opt_accessor (void)
{
- return idl_global->obv_opt_accessor ();
+ return be_global->obv_opt_accessor ();
}
idl_bool
-be_valuetype::is_valuetype ()
+be_valuetype::is_valuetype (void)
{
return 1;
}
idl_bool
-be_valuetype::is_abstract_valuetype ()
+be_valuetype::is_abstract_valuetype (void)
{
- return abstract_;
+ return this->abstract_;
}
void
-be_valuetype::set_abstract_valuetype ()
+be_valuetype::set_abstract_valuetype (void)
{
- abstract_ = 1;
+ this->abstract_ = 1;
}
-// compute stringified fully scoped skeleton name (OBV_name)
+// Compute stringified fully scoped skeleton name (OBV_name).
void
be_valuetype::compute_fullobvskelname (void)
{
@@ -110,25 +141,27 @@ be_valuetype::compute_fullobvskelname (void)
}
-// retrieve the fully scoped skeleton name
+// Retrieve the fully scoped skeleton name.
const char*
be_valuetype::full_obv_skel_name (void)
{
if (!this->full_obv_skel_name_)
- compute_fullobvskelname ();
+ {
+ compute_fullobvskelname ();
+ }
return this->full_obv_skel_name_;
}
-// generate the var definition
+// Generate the var definition.
int
be_valuetype::gen_var_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -138,69 +171,68 @@ be_valuetype::gen_var_defn (char *)
"%s_var",
this->local_name ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
-
- // generate the var definition (always in the client header).
+ // Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->stub_export_macro ()
+ // Start with whatever was our current indent level.
+ ch->indent ();
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // default constr
+ // Default constructor.
*ch << namebuf << " (void); // default constructor" << nl;
*ch << namebuf << " (" << this->local_name () << "*);" << nl;
*ch << namebuf << " (const " << this->local_name ()
<< "*); // (TAO extension)" << nl;
- // copy constructor
+ // Copy constructor.
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
- // destructor
+ // Destructor.
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
+ // Assignment operator from a pointer.
*ch << namebuf << " &operator= (" << this->local_name ()
<< "*);" << nl;
- // assignment from _var
+ // Assignment from _var.
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
- // arrow operator
+ // Arrow operator.
*ch << local_name () << "* operator-> (void) const;" << nl;
*ch << nl;
- // other extra types (cast operators, [] operator, and others)
+ // Other extra types (cast operators, [] operator, and others).
*ch << "operator const " << this->local_name ()
<< "* () const;" << nl;
*ch << "operator " << this->local_name () << "* ();" << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
+ // The return types of in, out, inout, and _retn are based on the parameter
+ // passing rules and the base type.
*ch << this->local_name () << "* in (void) const;" << nl;
*ch << this->local_name () << "* &inout (void);" << nl;
*ch << this->local_name () << "* &out (void);" << nl;
*ch << this->local_name () << "* _retn (void);" << nl;
- // generate an additional member function that returns the underlying pointer
+ // Generate an additional member function that returns
+ // the underlying pointer.
*ch << this->local_name () << "* ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
- // private
+ // Private.
*ch << "private:\n";
ch->incr_indent ();
*ch << this->local_name () << "* ptr_;\n";
@@ -211,16 +243,18 @@ be_valuetype::gen_var_defn (char *)
return 0;
}
-// implementation of the _var class. All of these get generated in the inline
-// file
+// Implementation of the _var class. All of these get generated in the inline
+// file.
int
be_valuetype::gen_var_impl (char *,
char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _var names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+
+ // To hold the full and local _var names.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -238,12 +272,9 @@ be_valuetype::gen_var_impl (char *,
"%s_var",
this->local_name ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
@@ -254,14 +285,14 @@ be_valuetype::gen_var_impl (char *,
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // default constr
+ // Default constructor.
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
*ci << " " << ": ptr_ (0)" << nl;
*ci << "{}\n\n";
- // constr from a pointer
+ // Constructor from a pointer.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " ("
@@ -269,7 +300,7 @@ be_valuetype::gen_var_impl (char *,
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
- // constr from a const pointer
+ // Constructor from a const pointer.
// TAO extension - it appears that there are problems with at least g++
// which reclaims amguity between T(T*) and T(const T_var &)
ci->indent ();
@@ -280,7 +311,7 @@ be_valuetype::gen_var_impl (char *,
<< this->local_name () << "*, p))" << nl;
*ci << "{}\n\n";
- // the additional ptr () member function. This member function must be
+ // The additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
@@ -293,7 +324,7 @@ be_valuetype::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << lname <<
@@ -303,7 +334,7 @@ be_valuetype::gen_var_impl (char *,
<< "this->ptr_ = p.ptr ();" << be_uidt_nl
<< "}\n\n";
- // destructor
+ // Destructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -313,11 +344,11 @@ be_valuetype::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator
+ // Assignment operator.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->local_name () <<
- "* p)" << nl;
+ *ci << fname << "::operator= (" << this->local_name ()
+ << "* p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::remove_ref (this->ptr_);" << nl;
@@ -326,11 +357,11 @@ be_valuetype::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << lname <<
- " &p)" << nl;
+ *ci << fname << "::operator= (const " << lname
+ << " &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "if (this != &p)" << nl;
@@ -346,7 +377,7 @@ be_valuetype::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator const " << this->name ()
@@ -360,7 +391,7 @@ be_valuetype::gen_var_impl (char *,
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator " << this->name ()
- << "* () // cast " << nl; // %! &()?
+ << "* () // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -377,7 +408,7 @@ be_valuetype::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // in, inout, out, and _retn
+ // in, inout, out, and _retn.
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "*" << nl;
*ci << fname << "::in (void) const" << nl;
@@ -422,13 +453,13 @@ be_valuetype::gen_var_impl (char *,
return 0;
}
-// generate the _out definition
+// Generate the _out definition.
int
be_valuetype::gen_out_defn (char *)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -438,41 +469,47 @@ be_valuetype::gen_out_defn (char *)
"%s_out",
this->local_name ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
+ // Generate the out definition (always in the client header).
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ch->indent ();
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // No default constructor
+ // No default constructor.
- // constructor from a pointer
+ // Constructor from a pointer.
*ch << namebuf << " (" << this->local_name () << "* &);" << nl;
- // constructor from a _var &
+
+ // Constructor from a _var &.
*ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
- // constructor from a _out &
+
+ // Constructor from a _out &.
*ch << namebuf << " (const " << namebuf << " &);" << nl;
- // assignment operator from a _out &
+
+ // Assignment operator from a _out &.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // only interface allows assignment from var &
+
+ // Assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators.
+ // Only interface allows assignment from var &.
*ch << namebuf << " &operator= (const " << this->local_name ()
<< "_var &);" << nl;
*ch << namebuf << " &operator= (" << this->local_name ()
<< "*);" << nl;
- // cast
+
+ // Cast.
*ch << "operator " << this->local_name () << "* &();" << nl;
- // ptr fn
+
+ // ptr function.
*ch << this->local_name () << "* &ptr (void);" << nl;
+
// operator ->
*ch << this->local_name () << "* operator-> (void);" << nl;
@@ -488,12 +525,15 @@ be_valuetype::gen_out_defn (char *)
}
int
-be_valuetype::gen_out_impl (char *, char *)
+be_valuetype::gen_out_impl (char *,
+ char *)
{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _out names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+
+ // To hold the full and local _out names.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -511,23 +551,21 @@ be_valuetype::gen_out_impl (char *, char *)
"%s_out",
this->local_name ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // constr from a pointer
+ // Constructor from a pointer.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->local_name ()
@@ -539,11 +577,11 @@ be_valuetype::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // constructor from _var &
+ // Constructor from _var &.
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->local_name () <<
- "_var &p) // constructor from _var" << nl;
+ *ci << fname << "::" << lname << " (" << this->local_name ()
+ << "_var &p) // constructor from _var" << nl;
*ci << " : ptr_ (p.out ())" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -552,15 +590,15 @@ be_valuetype::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << lname <<
- " &p) // copy constructor" << nl;
+ *ci << fname << "::" << lname << " (const " << lname
+ << " &p) // copy constructor" << nl;
*ci << " : ptr_ (ACE_const_cast (" << lname << "&,p).ptr_)" << nl;
*ci << "{}\n\n";
- // assignment operator from _out &
+ // Assignment operator from _out &.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << lname <<
@@ -572,7 +610,7 @@ be_valuetype::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << this->local_name ()
@@ -586,7 +624,7 @@ be_valuetype::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from *
+ // Assignment operator from *.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->local_name ()
@@ -598,18 +636,18 @@ be_valuetype::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
- "* &() // cast" << nl;
+ *ci << fname << "::operator " << this->name ()
+ << "* &() // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
ci->decr_indent ();
*ci << "}\n\n";
- // ptr function
+ // ptr function.
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "* &" << nl;
*ci << fname << "::ptr (void) // ptr" << nl;
@@ -619,7 +657,7 @@ be_valuetype::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // operator->
+ // operator->
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "* " << nl;
*ci << fname << "::operator-> (void)" << nl;
@@ -632,40 +670,46 @@ be_valuetype::gen_out_impl (char *, char *)
return 0;
}
-// for building the pre and postfix of private data fields
+// For building the pre and postfix of private data fields.
const char*
-be_valuetype::field_pd_prefix ()
+be_valuetype::field_pd_prefix (void)
{
return "_pd_";
}
const char*
-be_valuetype::field_pd_postfix ()
+be_valuetype::field_pd_postfix (void)
{
return "";
}
be_valuetype*
-be_valuetype::statefull_inherit ()
+be_valuetype::statefull_inherit (void)
{
- be_valuetype *rval;
+ be_valuetype *rval = 0;
+
if (this->n_inherits () > 0)
{
rval = be_valuetype::narrow_from_decl (this->inherits ()[0]);
- if (rval && (rval->is_valuetype ()) && (!rval->is_abstract_valuetype ()))
- return rval;
+
+ if (rval && (rval->is_valuetype ())
+ && (!rval->is_abstract_valuetype ()))
+ {
+ return rval;
+ }
}
+
return 0;
}
-// accept a visitor
+// Accept a visitor.
int
be_valuetype::accept (be_visitor *visitor)
{
return visitor->visit_valuetype (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS1 (be_valuetype, be_interface)
IMPL_NARROW_FROM_DECL (be_valuetype)
IMPL_NARROW_FROM_SCOPE (be_valuetype)
diff --git a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
index d6165e74e31..6f8eb673de3 100644
--- a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
@@ -21,28 +21,30 @@
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
#ifdef IDL_HAS_VALUETYPE
ACE_RCSID(be, be_valuetype_fwd, "$Id$")
-/*
- * BE_ValuetypeFwd
- */
-
-
be_valuetype_fwd::be_valuetype_fwd (void)
{
}
be_valuetype_fwd::be_valuetype_fwd (AST_Interface *dummy,
- UTL_ScopedName *n, UTL_StrList *p)
- : be_interface_fwd (dummy, n, p),
- AST_InterfaceFwd (dummy, n, p),
- AST_Decl (AST_Decl::NT_interface_fwd, n, p)
+ UTL_ScopedName *n,
+ UTL_StrList *p)
+ : be_interface_fwd (dummy,
+ n,
+ p),
+ AST_InterfaceFwd (dummy,
+ n,
+ p),
+ AST_Decl (AST_Decl::NT_interface_fwd,
+ n,
+ p)
{
}
@@ -52,19 +54,19 @@ be_valuetype_fwd::~be_valuetype_fwd (void)
void
-be_valuetype_fwd::set_abstract_valuetype ()
+be_valuetype_fwd::set_abstract_valuetype (void)
{
- this->full_definition()->set_abstract_valuetype();
+ this->full_definition ()->set_abstract_valuetype ();
}
-// generate the var definition
+// Generate the var definition
int
be_valuetype_fwd::gen_var_defn (char *)
{
ACE_ASSERT (0);
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -74,67 +76,66 @@ be_valuetype_fwd::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
+ ch = tao_cg->client_header ();
- // generate the var definition (always in the client header).
+ // Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->stub_export_macro ()
+ // Start with whatever was our current indent level.
+ ch->indent ();
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // default constr
+ // Default constructor.
*ch << namebuf << " (void); // default constructor" << nl;
*ch << namebuf << " (" << this->local_name () << "_ptr);" << nl;
- // copy constructor
+ // Copy constructor.
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
- // destructor
+ // Destructor.
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
+ // Assignment operator from a pointer.
*ch << namebuf << " &operator= (" << this->local_name ()
<< "_ptr);" << nl;
- // assignment from _var
+ // Assignment from _var.
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
- // arrow operator
+ // Arrow operator.
*ch << this->local_name () << "_ptr operator-> (void) const;" << nl;
*ch << nl;
- // other extra types (cast operators, [] operator, and others)
+ // Other extra types (cast operators, [] operator, and others).
*ch << "operator const " << this->local_name ()
<< "_ptr &() const;" << nl;
*ch << "operator " << this->local_name () << "_ptr &();" << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
+ // The return types of in, out, inout, and _retn are based on the parameter
+ // passing rules and the base type.
*ch << this->local_name () << "_ptr in (void) const;" << nl;
*ch << this->local_name () << "_ptr &inout (void);" << nl;
*ch << this->local_name () << "_ptr &out (void);" << nl;
*ch << this->local_name () << "_ptr _retn (void);" << nl;
- // generate an additional member function that returns the underlying pointer
+ // Generate an additional member function that returns
+ // the underlying pointer.
*ch << this->local_name () << "_ptr ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
- // private
+ // Private.
*ch << "private:\n";
ch->incr_indent ();
*ch << this->local_name () << "_ptr ptr_;\n";
@@ -145,17 +146,19 @@ be_valuetype_fwd::gen_var_defn (char *)
return 0;
}
-// implementation of the _var class. All of these get generated in the inline
-// file
+// Implementation of the _var class. All of these get generated in the inline
+// file.
int
be_valuetype_fwd::gen_var_impl (char *,
char *)
{
ACE_ASSERT (0);
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _var names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+
+ // To hold the full and local _var names.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -173,30 +176,28 @@ be_valuetype_fwd::gen_var_impl (char *,
"%s_var",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // default constr
+ // Default constructor.
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname <<
- " (void) // default constructor" << nl;
+ *ci << fname << "::" << lname
+ << " (void) // default constructor" << nl;
*ci << " " << ": ptr_ (" << this->name () << "::_nil ())" << nl;
*ci << "{}\n\n";
- // constr from a _ptr
+ // Constructor from a _ptr.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->name ()
@@ -204,7 +205,7 @@ be_valuetype_fwd::gen_var_impl (char *,
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
- // the additional ptr () member function. This member function must be
+ // The additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
@@ -217,15 +218,15 @@ be_valuetype_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
+ *ci << fname << "::" << lname << " (const " << fname
+ << " &p) // copy constructor" << nl;
*ci << " : ptr_ (" << this->name () << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
- // destructor
+ // Destructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -235,11 +236,11 @@ be_valuetype_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator
+ // Assignment operator.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- "_ptr p)" << nl;
+ *ci << fname << "::operator= (" << this->name ()
+ << "_ptr p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::release (this->ptr_);" << nl;
@@ -248,11 +249,11 @@ be_valuetype_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- " &p)" << nl;
+ *ci << fname << "::operator= (const " << fname
+ << " &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "if (this != &p)" << nl;
@@ -266,11 +267,11 @@ be_valuetype_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << this->name () <<
- "_ptr &() const // cast" << nl;
+ *ci << fname << "::operator const " << this->name ()
+ << "_ptr &() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -297,7 +298,7 @@ be_valuetype_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // in, inout, out, and _retn
+ // in, inout, out, and _retn.
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "_ptr" << nl;
*ci << fname << "::in (void) const" << nl;
@@ -342,14 +343,14 @@ be_valuetype_fwd::gen_var_impl (char *,
return 0;
}
-// generate the _out definition
+// Generate the _out definition.
int
be_valuetype_fwd::gen_out_defn (char *)
{
ACE_ASSERT (0);
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
+ TAO_OutStream *ch = 0;
+ TAO_NL nl;
+ char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
'\0',
@@ -359,41 +360,47 @@ be_valuetype_fwd::gen_out_defn (char *)
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ch = tao_cg->client_header ();
- ch = cg->client_header ();
+ // Generate the out definition (always in the client header).
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ch->indent ();
- *ch << "class " << idl_global->stub_export_macro ()
+ *ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // No default constructor
+ // No default constructor.
- // constructor from a pointer
+ // Constructor from a pointer.
*ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl;
- // constructor from a _var &
+
+ // Constructor from a _var &.
*ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
- // constructor from a _out &
+
+ // Constructor from a _out &.
*ch << namebuf << " (const " << namebuf << " &);" << nl;
- // assignment operator from a _out &
+
+ // Assignment operator from a _out &.
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // only valuetype allows assignment from var &
+
+ // Assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators.
+ // Only valuetype allows assignment from var &.
*ch << namebuf << " &operator= (const " << this->local_name ()
<< "_var &);" << nl;
*ch << namebuf << " &operator= (" << this->local_name ()
<< "_ptr);" << nl;
- // cast
+
+ // Cast.
*ch << "operator " << this->local_name () << "_ptr &();" << nl;
- // ptr fn
+
+ // ptr function.
*ch << this->local_name () << "_ptr &ptr (void);" << nl;
+
// operator ->
*ch << this->local_name () << "_ptr operator-> (void);" << nl;
@@ -414,10 +421,12 @@ be_valuetype_fwd::gen_out_impl (char *,
char *)
{
ACE_ASSERT (0);
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _out names
+ TAO_OutStream *ci = 0;
+ TAO_NL nl;
+
+ // To hold the full and local _out names.
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
ACE_OS::memset (fname,
'\0',
@@ -435,23 +444,21 @@ be_valuetype_fwd::gen_out_impl (char *,
"%s_out",
this->local_name ()->get_string ());
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
+ ci = tao_cg->client_inline ();
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ // Start with whatever was our current indent level.
+ ci->indent ();
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // constr from a _ptr
+ // Constructor from a _ptr.
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->name ()
@@ -463,11 +470,11 @@ be_valuetype_fwd::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // constructor from _var &
+ // Constructor from _var &.
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name () <<
- "_var &p) // constructor from _var" << nl;
+ *ci << fname << "::" << lname << " (" << this->name ()
+ << "_var &p) // constructor from _var" << nl;
*ci << " : ptr_ (p.out ())" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -476,20 +483,20 @@ be_valuetype_fwd::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // copy constructor
+ // Copy constructor.
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
+ *ci << fname << "::" << lname << " (const " << fname
+ << " &p) // copy constructor" << nl;
*ci << " : ptr_ (ACE_const_cast (" << fname
<< "&,p).ptr_)" << nl;
*ci << "{}\n\n";
- // assignment operator from _out &
+ // Assignment operator from _out &.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- " &p)" << nl;
+ *ci << fname << "::operator= (const " << fname
+ << " &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "this->ptr_ = ACE_const_cast (" << fname << "&,p).ptr_;" << nl;
@@ -497,11 +504,11 @@ be_valuetype_fwd::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // Assignment operator from _var.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << this->name () <<
- "_var &p)" << nl;
+ *ci << fname << "::operator= (const " << this->name ()
+ << "_var &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
@@ -509,11 +516,11 @@ be_valuetype_fwd::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _ptr
+ // Assignment operator from _ptr.
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- "_ptr p)" << nl;
+ *ci << fname << "::operator= (" << this->name ()
+ << "_ptr p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "this->ptr_ = p;" << nl;
@@ -521,18 +528,18 @@ be_valuetype_fwd::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // other extra methods - cast operator ()
+ // Other extra methods - cast operator ().
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
- "_ptr &() // cast" << nl;
+ *ci << fname << "::operator " << this->name ()
+ << "_ptr &() // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
ci->decr_indent ();
*ci << "}\n\n";
- // ptr function
+ // ptr function.
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
*ci << fname << "::ptr (void) // ptr" << nl;
@@ -542,7 +549,7 @@ be_valuetype_fwd::gen_out_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // operator->
+ // operator->
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::operator-> (void)" << nl;
@@ -561,7 +568,7 @@ be_valuetype_fwd::accept (be_visitor *visitor)
return visitor->visit_valuetype_fwd (this);
}
-// Narrowing
+// Narrowing.
IMPL_NARROW_METHODS1 (be_valuetype_fwd, be_interface_fwd)
IMPL_NARROW_FROM_DECL (be_valuetype_fwd)
diff --git a/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp
index b07b3a29980..afd2cf49496 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp
@@ -52,10 +52,10 @@ be_visitor_array_any_op_ch::visit_array (be_array *node)
// generate the Any <<= and >>= operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, const " << node->name ()
<< "_forany &);" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << "_forany &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
index 5c00d001cb3..ae0b44e6e0f 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
@@ -286,7 +286,7 @@ be_visitor_array_ch::gen_var_defn (be_array *node)
// for over here.
os->indent (); // start with whatever was our current indent level
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << varnamebuf << be_nl;
*os << "{" << be_nl;
*os << "public:" << be_idt_nl;
@@ -384,7 +384,7 @@ be_visitor_array_ch::gen_out_defn (be_array *node)
// generate the out definition (always in the client header)
os->indent (); // start with whatever was our current indent level
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << outnamebuf << be_nl;
*os << "{" << be_nl;
*os << "public:" << be_idt_nl;
@@ -451,7 +451,7 @@ be_visitor_array_ch::gen_forany_defn (be_array *node)
// for over here.
os->indent (); // start with whatever was our current indent level
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << foranyname << be_nl;
*os << "{" << be_nl;
*os << "public:" << be_idt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
index 7ea55c0ca08..a41135a71a0 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
@@ -51,7 +51,7 @@ be_visitor_array_cdr_op_ch::visit_array (be_array *node)
TAO_OutStream *os = this->ctx_->stream ();
// generate the CDR << and >> operator declarations
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const ";
// @@ TODO: this should be done in the node, it is absurd to repeat
// this code all over the visitors!!!!
@@ -67,7 +67,7 @@ be_visitor_array_cdr_op_ch::visit_array (be_array *node)
{
*os << node->name () << "_forany &);" << be_nl;
}
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, ";
if (!this->ctx_->tdef ())
{
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp
index 379703e1dc5..e22fa6ca3bf 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp
@@ -51,10 +51,10 @@ be_visitor_enum_any_op_ch::visit_enum (be_enum *node)
// generate the Any <<= and >>= operators
os->indent ();
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< ");" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << " &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
index 8b56aed6bd2..c0c2e045d92 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
@@ -52,10 +52,10 @@ be_visitor_enum_cdr_op_ch::visit_enum (be_enum *node)
// generate the CDR << and >> operators
os->indent ();
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &); // " << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, "
<< node->name () << " &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp
index 19ca3242e47..b2fb66569ab 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp
@@ -53,16 +53,16 @@ be_visitor_exception_any_op_ch::visit_exception (be_exception *node)
// generate the Any <<= and >>= operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, const " << node->name ()
<< " &); // copying version" << be_nl;
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< "*); // noncopying version" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << " *&); // deprecated\n";
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, const "
<< node->name () << " *&);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
index be09076d45f..342fcc6a103 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
@@ -53,10 +53,10 @@ be_visitor_exception_cdr_op_ch::visit_exception (be_exception *node)
// generate the CDR << and >> operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &);" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, "
<< node->name () << " &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
index 55d81c1954a..78b8f4e49f4 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
@@ -53,7 +53,7 @@ int be_visitor_exception_ch::visit_exception (be_exception *node)
os->gen_ifdef_macro (node->flat_name ());
os->indent ();
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << node->local_name ()
<< " : public CORBA::UserException" << be_nl;
*os << "{" << be_nl << "public:" << be_idt_nl;
@@ -117,7 +117,7 @@ int be_visitor_exception_ch::visit_exception (be_exception *node)
<< "// = TAO extension" << be_nl
<< "static CORBA::Exception *_alloc (void);";
- if (!node->is_local () && idl_global->tc_support ())
+ if (!node->is_local () && be_global->tc_support ())
*os << be_nl <<"virtual CORBA::TypeCode_ptr _type (void) const;";
*os << be_uidt_nl << "}; // exception " << node->name ()
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
index 307bb43c836..7bf5be5715f 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
@@ -179,7 +179,7 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
<< "{" << be_idt_nl
<< "if (cdr << *this)" << be_nl
<< " return;" << be_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
@@ -191,7 +191,7 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
<< "CORBA::Environment &ACE_TRY_ENV) const"
<< be_uidt << be_uidt_nl
<< "{" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
@@ -211,7 +211,7 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
<< "{" << be_idt_nl
<< "if (cdr >> *this)" << be_nl
<< " return;" << be_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
@@ -223,7 +223,7 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
<< "CORBA::Environment &ACE_TRY_ENV)"
<< be_uidt << be_uidt_nl
<< "{" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
@@ -305,7 +305,7 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
}
}
- if (!node->is_local () && idl_global->tc_support ())
+ if (!node->is_local () && be_global->tc_support ())
{
*os << "\n// TAO extension - the virtual _type method" << be_nl;
*os << "CORBA::TypeCode_ptr " << node->name ()
diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp
index 928ac84bb81..f67fcb563a7 100644
--- a/TAO/TAO_IDL/be/be_visitor_factory.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp
@@ -106,7 +106,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
// this is the starting point for generation of all Any operators. If we
// have the any support enabled, then go ahead
- if (idl_global->any_support ())
+ if (be_global->any_support ())
return new be_visitor_root_any_op (new_ctx);
else
// return a NO_OP visitor
@@ -406,7 +406,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_TYPECODE_DECL:
// Do we need TypeCode Support?
- if (idl_global->tc_support ())
+ if (be_global->tc_support ())
return new be_visitor_typecode_decl (new_ctx);
else
// return a NO_OP visitor
@@ -414,7 +414,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_TYPECODE_DEFN:
// Do we need TypeCode Support?
- if (idl_global->tc_support ())
+ if (be_global->tc_support ())
return new be_visitor_typecode_defn (new_ctx);
else
// return a NO_OP visitor
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
index 9731f2aab39..0bc218af559 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
@@ -55,7 +55,7 @@ be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
// Generate the stub factory function pointer declaration the interface is
// not locality constraint.
- *os << "extern " << idl_global->stub_export_macro () << " "
+ *os << "extern " << be_global->stub_export_macro () << " "
<< node->full_name () << "_ptr (*_TAO_collocation_"
<< node->flat_name () << "_Stub_Factory_function_pointer) ("
<< be_idt << be_idt_nl
@@ -65,10 +65,10 @@ be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
// generate the Any <<= and >>= operator declarations
os->indent ();
*os << "// Any operators for interface " << node->name () << be_nl;
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< "_ptr);" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << " *&);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
index 4f016fc364e..5c1b9c100c6 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
@@ -54,10 +54,10 @@ be_visitor_interface_cdr_op_ch::visit_interface (be_interface *node)
// generate the CDR << and >> operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " CORBA::Boolean "
+ *os << be_global->stub_export_macro () << " CORBA::Boolean "
<< "operator<< (TAO_OutputCDR &, const " << node->full_name ()
<< "_ptr );" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean "
+ *os << be_global->stub_export_macro () << " CORBA::Boolean "
<< "operator>> (TAO_InputCDR &, "
<< node->full_name () << "_ptr &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_collocated_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_collocated_sh.cpp
index 970dae75a0e..a191343b0ab 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/direct_collocated_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_collocated_sh.cpp
@@ -50,7 +50,7 @@ int be_visitor_interface_direct_collocated_sh::visit_interface (be_interface *no
// output the class defn
os->indent ();
- *os << "class " << idl_global->skel_export_macro ()
+ *os << "class " << be_global->skel_export_macro ()
<< " " << node->local_coll_name (be_interface::DIRECT);
os->incr_indent ();
*os << " : public virtual " << node->name ();
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
index 88bddf18110..27d1cc13e3d 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -101,8 +101,8 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
os->gen_ifdef_macro (node->flat_name ());
// now generate the class definition
- *os << "class " << idl_global->stub_export_macro ()
- << " " << node->local_name ();
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ();
if (node->n_inherits () > 0) // node interface inherits from other
// interfaces
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
index 3dbf36152c5..b0cdd100ce7 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
@@ -57,36 +57,44 @@ be_visitor_interface_ih::visit_interface (be_interface *node)
ACE_OS::sprintf (namebuf, "%s", node->flat_name ());
- *os << "//Class " << idl_global->impl_class_prefix ()<<namebuf << idl_global->impl_class_suffix ()<< be_nl;
+ *os << "//Class " << be_global->impl_class_prefix ()
+ << namebuf << be_global->impl_class_suffix () << be_nl;
// now generate the class definition
- *os << "class " << idl_global->stub_export_macro ()
- << " " <<idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " : ";
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " : ";
//inherit from the base skeleton file
- *os<<"public virtual "<<node->full_skel_name ();
+ *os <<"public virtual "<< node->full_skel_name ();
*os << be_nl
<< "{" << be_nl
<< "public:" << be_idt_nl
<< "//Constructor " << be_nl
- << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " (void);" << be_nl << be_nl;
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " (void);" << be_nl << be_nl;
- if (idl_global->gen_copy_ctor ())
+ if (be_global->gen_copy_ctor ())
{
*os << "//Copy Constructor"<<be_nl
- << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " (const "
- << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << "&);" <<be_nl <<be_nl;
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " (const "
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << "&);" <<be_nl <<be_nl;
}
- if (idl_global->gen_assign_op ())
+ if (be_global->gen_assign_op ())
{
*os << "//Copy Assignment" << be_nl
- << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << "& "
- << "operator=(const " << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << "&);"<<be_nl << be_nl;
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << "& " << "operator=(const "
+ << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << "&);" << be_nl << be_nl;
}
*os << "//Destructor " << be_nl
- << "virtual " << "~" << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " (void);" << be_nl << be_uidt_nl;
+ << "virtual " << "~" << be_global->impl_class_prefix () << namebuf
+ << be_global->impl_class_suffix () << " (void);" << be_nl << be_uidt_nl;
// generate code for elements in the scope (e.g., operations)
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
index 54dbf737053..1d9249dc417 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
@@ -60,16 +60,11 @@ be_visitor_interface_is::visit_interface (be_interface *node)
// constructor
*os << "// Implementation skeleton constructor" << be_nl;
// find if we are at the top scope or inside some module
- *os << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () <<"::" << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () <<
- " (void)" << be_idt_nl;
-
- /*
- if(node->n_inherits () >0)
- {
- //generate the default constructors of all the base classes
- node->gen_def_ctors(os);
- }
- */
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () <<"::"
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix ()
+ << " (void)" << be_idt_nl;
*os << "{" << be_nl
<< "}" << be_nl << be_uidt_nl;
@@ -78,19 +73,26 @@ be_visitor_interface_is::visit_interface (be_interface *node)
os->indent ();
*os << "// Implementation skeleton destructor" << be_nl;
- *os << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () <<"::~" << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () <<
- " (void)" << be_idt_nl;
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () <<"::~"
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix ()
+ << " (void)" << be_idt_nl;
*os << "{" <<be_nl;
*os << "}" << be_nl <<be_uidt_nl;
- if (idl_global->gen_copy_ctor () )
+ if (be_global->gen_copy_ctor () )
{
*os << "//Implementation Skeleton Copy Constructor" << be_nl;
- *os <<idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () <<"::"
- << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () << " (const "
- << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () << "& t)"<< be_idt_nl;
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () <<"::"
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << " (const "
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "& t)"<< be_idt_nl;
+
if(node->n_inherits () >0)
{
node->gen_copy_ctors(os);
@@ -100,13 +102,16 @@ be_visitor_interface_is::visit_interface (be_interface *node)
<< "}" << be_nl << be_uidt_nl;
}
- if (idl_global->gen_assign_op ())
+ if (be_global->gen_assign_op ())
{
*os << "//Implementation Skeleton Copy Assignment" << be_nl;
- *os << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () << "& "
- << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () << "::operator=(const "
- << idl_global->impl_class_prefix () << node->flat_name () << idl_global->impl_class_suffix () << "& t)" <<be_idt_nl
+ *os << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "& "
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "::operator=(const "
+ << be_global->impl_class_prefix () << node->flat_name ()
+ << be_global->impl_class_suffix () << "& t)" <<be_idt_nl
<< "{" << be_idt_nl
<< "return *this;" << be_uidt_nl
<< "}" << be_nl << be_uidt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
index 796709f6451..e576b1897d9 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
@@ -76,7 +76,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
<< "_ptr;" << be_nl;
// now generate the class definition
- *os << "class " << idl_global->skel_export_macro ()
+ *os << "class " << be_global->skel_export_macro ()
<< " " << namebuf << " : ";
if (node->n_inherits () > 0)
{
@@ -202,7 +202,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
*os << be_uidt_nl << "};\n\n";
ctx = *this->ctx_;
// generate the collocated class
- if (idl_global->gen_thru_poa_collocation ())
+ if (be_global->gen_thru_poa_collocation ())
{
ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SH);
visitor = tao_cg->make_visitor (&ctx);
@@ -219,7 +219,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
visitor = 0;
}
- if (idl_global->gen_direct_collocation ())
+ if (be_global->gen_direct_collocation ())
{
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH);
@@ -237,7 +237,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
visitor = 0;
}
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
{
// generate the TIE class.
ctx = *this->ctx_;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
index f0d33d8da98..7ac5571926c 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
@@ -72,7 +72,7 @@ be_visitor_interface_si::visit_interface (be_interface *node)
"codegen for base class skeletons failed\n"), -1);
}
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
{
// generate the TIE class
be_visitor_context ctx (*this->ctx_);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
index 0d40db9fc9b..dd551007d1d 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -75,7 +75,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
<< " ()->get_collocation_strategy ())" << be_idt_nl
<< "{" << be_nl << "case TAO_ORB_Core::THRU_POA:" << be_idt_nl;
- if (idl_global->gen_thru_poa_collocation ())
+ if (be_global->gen_thru_poa_collocation ())
*os << "{" << be_nl
<< node->full_name () << "_ptr retval = 0;" << be_nl
<< "ACE_NEW_RETURN (" << be_idt << be_idt_nl
@@ -91,7 +91,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "case TAO_ORB_Core::DIRECT:" << be_idt_nl;
- if (idl_global->gen_direct_collocation ())
+ if (be_global->gen_direct_collocation ())
*os << "if (obj->_servant () != 0)" << be_idt_nl
<< "{" << be_idt_nl
<< node->full_skel_name () << " *servant = ACE_reinterpret_cast ("
@@ -228,7 +228,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "CORBA::Boolean _tao_retval = 0;" << be_nl;
*os << "CORBA::String_var value;" << be_nl;
*os << "if (!(_tao_in >> value.out ()))" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt_nl << be_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
@@ -238,7 +238,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "ACE_CHECK;" << be_nl;
*os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" << be_nl;
*os << "if (!(_tao_out << CORBA::Any::from_boolean (_tao_retval)))" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt << be_uidt_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
@@ -262,7 +262,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "ACE_CHECK;" << be_nl;
*os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" << be_nl;
*os << "if (!(_tao_out << CORBA::Any::from_boolean (_tao_retval)))" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt << be_uidt_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
@@ -363,7 +363,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
<< "case TAO_ORB_Core::THRU_POA:" << be_idt_nl;
// Thru POA stub
- if (idl_global->gen_thru_poa_collocation ())
+ if (be_global->gen_thru_poa_collocation ())
*os << "{" << be_idt_nl
<< "::" << node->full_name () << "_ptr retval = 0;" << be_nl
<< "ACE_NEW_RETURN (" << be_idt << be_idt_nl
@@ -378,7 +378,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// Direct stub
*os << "case TAO_ORB_Core::DIRECT:" << be_idt_nl;
- if (idl_global->gen_direct_collocation ())
+ if (be_global->gen_direct_collocation ())
*os << "{" << be_idt_nl
<< "::" << node->full_name () << "_ptr retval = 0;" << be_nl
<< "ACE_NEW_RETURN (" << be_idt << be_idt_nl
@@ -409,7 +409,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// not generate the type of collocated stub but the orb is asking
// for it, simply return null so a remote stub will be used.
// generate the collocated class impl
- if (idl_global->gen_thru_poa_collocation ())
+ if (be_global->gen_thru_poa_collocation ())
{
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS);
@@ -434,7 +434,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
delete visitor;
}
- if (idl_global->gen_direct_collocation ())
+ if (be_global->gen_direct_collocation ())
{
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
index 918a958fe0f..c78072777df 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
@@ -45,7 +45,7 @@ be_visitor_interface_smart_proxy_ch::~be_visitor_interface_smart_proxy_ch (void)
int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
{
- if (idl_global->gen_smart_proxies ())
+ if (be_global->gen_smart_proxies ())
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -59,7 +59,7 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
bt = node;
// output the class defn
- *os << "class " << idl_global->stub_export_macro ()<< " "
+ *os << "class " << be_global->stub_export_macro ()<< " "
<< "TAO_" << node->flat_name ()
<< "_Default_Proxy_Factory" << be_nl
<< "{" << be_nl
@@ -85,7 +85,7 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
<< ");" << be_uidt << be_uidt_nl
<< "};\n\n";
- *os << "class " << idl_global->stub_export_macro ()<< " "
+ *os << "class " << be_global->stub_export_macro ()<< " "
<< "TAO_" << node->flat_name ()
<< "_Proxy_Factory_Adapter" << be_nl
<< "{" << be_nl
@@ -130,7 +130,7 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
<< "_Proxy_Factory_Adapter, ACE_SYNCH_RECURSIVE_MUTEX> TAO_"
<< node->flat_name ()<< "_PROXY_FACTORY_ADAPTER;"<<be_nl << be_nl;
- *os << "class " << idl_global->stub_export_macro ()<< " "
+ *os << "class " << be_global->stub_export_macro ()<< " "
<< "TAO_"<< node->flat_name ()
<< "_Smart_Proxy_Base" << be_idt_nl
<< ": public virtual "
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
index eb9ea6f8e58..dfefcac77d0 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
@@ -45,7 +45,7 @@ be_visitor_interface_smart_proxy_cs::~be_visitor_interface_smart_proxy_cs (void)
int be_visitor_interface_smart_proxy_cs::visit_interface (be_interface *node)
{
- if (idl_global->gen_smart_proxies ())
+ if (be_global->gen_smart_proxies ())
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_collocated_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_collocated_sh.cpp
index d754632f9b6..c8be8110686 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_collocated_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_collocated_sh.cpp
@@ -50,7 +50,7 @@ int be_visitor_interface_thru_poa_collocated_sh::visit_interface (be_interface *
// output the class defn
os->indent ();
- *os << "class " << idl_global->skel_export_macro ()
+ *os << "class " << be_global->skel_export_macro ()
<< " " << node->local_coll_name (be_interface::THRU_POA);
os->incr_indent ();
*os << " : public virtual ::" << node->full_name ();
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
index 4045873173b..fbe7e1e7336 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
@@ -87,7 +87,7 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node)
*os << "// TIE class: Refer to CORBA v2.2, Section 20.34.4" << be_nl;
*os << "template <class T>" << be_nl;
- *os << "class " << idl_global->skel_export_macro ()
+ *os << "class " << be_global->skel_export_macro ()
<< " " << tiename << " : public " << namebuf << be_nl;
*os << "{" << be_nl
<< "public:" << be_idt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
index 78d6408eb39..9b152e2c76c 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
@@ -250,14 +250,14 @@ be_visitor_operation_ami_cs::gen_raise_exception (be_type *bt,
if (this->void_return_type (bt))
{
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw ";
else
*os << "ACE_THROW (";
*os << excep << " (" << completion_status << ")";
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << ";\n";
else
*os << ");\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
index 62902b25556..64dde7baf4d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
@@ -102,7 +102,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (be_oper
}
*os << node->local_name () << "(";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os << "CORBA::Environment &ACE_TRY_ENV";
*os << ")" << be_uidt;
@@ -188,7 +188,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (be_oper
<< " // Could not demarshal the exception id, raise an local" << be_nl
<< " // CORBA::MARSHAL" << be_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
{
*os << " throw CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE," << be_nl;
*os << " CORBA::COMPLETED_YES);" << be_nl;
@@ -207,7 +207,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (be_oper
<< "CORBA::ULong completion = 0;" << be_nl
<< "if ((_tao_in >> minor) == 0 ||" << be_nl
<< " (_tao_in >> completion) == 0)" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
{
*os << " throw CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE," << be_idt_nl;
*os << " CORBA::COMPLETED_MAYBE);"
@@ -270,7 +270,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (be_oper
<< "if (exception == 0)" << be_idt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
{
*os << "throw CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE," << be_nl;
*os << " CORBA::COMPLETED_YES);"
@@ -306,7 +306,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (be_oper
<< be_nl
<< "// completed." << be_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
{
*os << "throw CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE," << be_nl;
*os << " CORBA::COMPLETED_YES);"
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
index eee86b81e9c..ae6a393b103 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
@@ -233,7 +233,7 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op
<< "_tao_reply_handler_object->"
<< node->local_name () << "_excep (exception_holder_var";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os << "," << be_nl << " ACE_TRY_ENV";
*os << ");" << be_uidt_nl
@@ -301,14 +301,14 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::gen_raise_exception (
if (this->void_return_type (bt))
{
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw ";
else
*os << "ACE_THROW (";
*os << excep << " (" << completion_status << ")";
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << ";\n";
else
*os << ");\n";
@@ -501,7 +501,7 @@ be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::
*os << be_uidt << be_uidt_nl
<< " ))" << be_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw CORBA::MARSHAL ();" << be_uidt_nl << be_nl;
else
*os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index 58f8e68eba5..1e385c2d4be 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -61,7 +61,7 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
}
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
// if the operation node has parameters, then we need to insert a comma
if (node->argument_count () > 0)
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
index a36cdc1baaa..b8e6967f892 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
@@ -84,7 +84,7 @@ be_visitor_operation_argument::visit_operation (be_operation *node)
// if we are supporting the alternate mapping, we must pass the
// CORBA::Environment parameter as the last parameter
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
switch (this->ctx_->state ())
{
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
index 69911d26df6..6d58039a73c 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
@@ -59,7 +59,7 @@ be_visitor_operation_interceptors_arglist::visit_operation (be_operation *node)
}
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
os->indent ();
switch (this->ctx_->state ())
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
index c1f91ab5ce3..2569ee87835 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
@@ -156,7 +156,7 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node)
os->indent ();
// Here I still need to generate the other methods + private args
*os << " virtual Dynamic::ParameterList * arguments (";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
*os << be_idt_nl <<"CORBA::Environment &ACE_TRY_ENV ="
<<be_idt_nl << " TAO_default_environment ())"
@@ -170,7 +170,7 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node)
<< be_uidt_nl << be_nl;
os->indent ();
*os << "virtual Dynamic::ExceptionList * exceptions ( ";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
*os << be_idt_nl <<"CORBA::Environment &ACE_TRY_ENV ="
<<be_idt_nl << " TAO_default_environment ())"
@@ -183,7 +183,7 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node)
<< be_uidt_nl << be_nl;
os->indent ();
*os << "virtual CORBA::Any * result (";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
*os << be_idt_nl <<"CORBA::Environment &ACE_TRY_ENV ="
<<be_idt_nl << " TAO_default_environment ())"
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
index 2670e33aa89..bda3cf96142 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
@@ -222,7 +222,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
*os<< "::"
<< "arguments (";
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os<<"CORBA::Environment &";
else
*os << "void";
@@ -308,7 +308,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
*os<< "::"
<< "exceptions (";
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os<<"CORBA::Environment &";
else
*os << "void";
@@ -385,7 +385,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
*os<< "::"
<< "result (";
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os<<"CORBA::Environment &";
else
*os << "void";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
index e50ef7f0390..b40112276a0 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
@@ -148,7 +148,7 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
os->indent ();
// Here I still need to generate the other methods + private args
*os << " virtual Dynamic::ParameterList * arguments (";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
*os << be_idt_nl <<"CORBA::Environment &ACE_TRY_ENV ="
<<be_idt_nl << " TAO_default_environment ())"
@@ -161,7 +161,7 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
<< be_uidt_nl << be_nl;
os->indent ();
*os << "virtual Dynamic::ExceptionList * exceptions ( ";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
*os << be_idt_nl <<"CORBA::Environment &ACE_TRY_ENV ="
<<be_idt_nl << " TAO_default_environment ())"
@@ -174,7 +174,7 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
<< be_uidt_nl << be_nl;
os->indent ();
*os << "virtual CORBA::Any * result (";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
*os << be_idt_nl <<"CORBA::Environment &ACE_TRY_ENV ="
<<be_idt_nl << " TAO_default_environment ())"
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
index bc1d529b1bb..33f6832bb4e 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
@@ -209,7 +209,7 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
*os<< "::"
<< "arguments (";
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os<<"CORBA::Environment &";
else
*os << "void";
@@ -295,7 +295,7 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
*os<< "::"
<< "exceptions (";
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os<<"CORBA::Environment &";
else
*os << "void";
@@ -371,7 +371,7 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
*os<< "::"
<< "result (";
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os<<"CORBA::Environment &";
else
*os << "void";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
index f6d5a8b6952..e661447d52c 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -90,7 +90,7 @@ be_visitor_operation::gen_throw_spec (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << be_idt_nl << "throw (";
else
*os << be_idt_nl << "ACE_THROW_SPEC ((";
@@ -127,7 +127,7 @@ be_visitor_operation::gen_throw_spec (be_operation *node)
delete ei;
} // end of if
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << be_uidt_nl << ")"<< be_uidt;
else
*os << be_uidt_nl << "))"<< be_uidt;
@@ -144,7 +144,7 @@ be_visitor_operation::gen_environment_var ()
static const char *null_env_decl = "";
// check if we are generating stubs/skeletons for true C++ exception support
- if (idl_global->exception_support ())
+ if (be_global->exception_support ())
{
return ace_try_env_decl;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
index bcca308f2b1..d6a1c3d7d8d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -831,7 +831,7 @@ be_visitor_operation_cs::gen_marshal_and_invoke (be_operation *node,
// Forward Request exception needs to be taken care off here.
// For now we dont bother about it.
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw;" << be_uidt_nl;
else
*os << "ACE_RE_THROW;" << be_uidt_nl;
@@ -862,14 +862,14 @@ be_visitor_operation_cs::gen_raise_exception (be_type *bt,
if (this->void_return_type (bt))
{
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw ";
else
*os << "ACE_THROW (";
*os << excep << " (" << completion_status << ")";
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << ";\n";
else
*os << ");\n";
@@ -900,7 +900,7 @@ be_visitor_operation_cs::gen_raise_interceptor_exception (be_type *bt,
if (this->void_return_type (bt))
{
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw ";
else
*os << "TAO_INTERCEPTOR_THROW (";
@@ -908,7 +908,7 @@ be_visitor_operation_cs::gen_raise_interceptor_exception (be_type *bt,
*os << excep << "("
<< completion_status << ")";
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << ";";
else
*os << ");";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
index d5e2353f9d0..eb8bd41d298 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
@@ -116,7 +116,8 @@ be_visitor_operation_is::visit_operation (be_operation *node)
}
// STEP 2: generate the operation name
- *os << " " << idl_global->impl_class_prefix () << classname << idl_global->impl_class_suffix () << "::" << node->local_name ();
+ *os << " " << be_global->impl_class_prefix () << classname
+ << be_global->impl_class_suffix () << "::" << node->local_name ();
// STEP 3: generate the argument list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
index d81113f49a1..32f5e5724ae 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -397,7 +397,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
<< "ACE_TRY_ENV" << be_uidt_nl
<< ");" << be_uidt_nl;
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw;" << be_uidt_nl;
else
*os << "ACE_RE_THROW;" << be_uidt_nl;
@@ -673,14 +673,14 @@ be_visitor_operation_ss::gen_raise_exception (be_type *,
os->indent ();
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << "throw ";
else
*os << "ACE_THROW (";
*os << excep << "(" << completion_status << ")";
- if (idl_global->use_raw_throw ())
+ if (be_global->use_raw_throw ())
*os << ";\n";
else
*os << ");\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
index d25528490b2..67166a5d8fc 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
@@ -44,7 +44,7 @@ int
be_visitor_operation_smart_proxy_ch::visit_operation (be_operation *node)
{
- if (idl_global->gen_smart_proxies ())
+ if (be_global->gen_smart_proxies ())
{
TAO_OutStream *os; // output stream
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
index f0448a09f78..5875b61103a 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
@@ -43,7 +43,7 @@ be_visitor_operation_smart_proxy_cs::~be_visitor_operation_smart_proxy_cs (void)
int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
{
- if (idl_global->gen_smart_proxies ())
+ if (be_global->gen_smart_proxies ())
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp
index c19d19f9dfc..fc50a4cfcf0 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp
@@ -130,7 +130,7 @@ int be_visitor_operation_thru_poa_collocated_ss::visit_operation (be_operation *
*os << "{" << be_idt << "\n";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
// Declare a return type
ctx = *this->ctx_;
@@ -176,7 +176,7 @@ int be_visitor_operation_thru_poa_collocated_ss::visit_operation (be_operation *
<< "servant_upcall.prepare_for_upcall (" << be_idt << be_idt_nl
<< "this->_object_key ()," << be_nl
<< "\"" << node->original_local_name () << "\"";
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
*os << "," << be_nl
<< "ACE_TRY_ENV" << be_uidt_nl
<< ");\n" << be_uidt;
@@ -184,7 +184,7 @@ int be_visitor_operation_thru_poa_collocated_ss::visit_operation (be_operation *
*os << be_uidt_nl << ");\n" << be_uidt;
// check if there is an exception
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
if (this->gen_check_exception (bt) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index 0c8b7af6ac0..4193dd94fae 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -133,11 +133,13 @@ int be_visitor_root::visit_root (be_root *node)
break;
case TAO_CodeGen::TAO_ROOT_IH:
- (void) tao_cg->end_implementation_header (idl_global->be_get_implementation_hdr_fname (0));
+ (void) tao_cg->end_implementation_header (
+ be_global->be_get_implementation_hdr_fname (0)
+ );
break;
case TAO_CodeGen::TAO_ROOT_SH:
(void) tao_cg->end_server_header ();
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
(void) tao_cg->end_server_template_header ();
return 0;
@@ -148,7 +150,7 @@ int be_visitor_root::visit_root (be_root *node)
case TAO_CodeGen::TAO_ROOT_SI:
return 0; // nothing to be done
case TAO_CodeGen::TAO_ROOT_SS:
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
(void) tao_cg->end_server_template_skeletons ();
return 0; // nothing to be done
default:
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
index 29a3dacdfb9..fd3b609d362 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
@@ -44,8 +44,8 @@ int
be_visitor_root_ch::init (void)
{
// first open the client-side header file for writing
- if (tao_cg->start_client_header (idl_global->be_get_client_hdr_fname ())
- == -1)
+ if (tao_cg->start_client_header (be_global->be_get_client_hdr_fname ())
+ == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_visitor_root_ch::init - "
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
index d7ca5008cba..a7c9d9e60db 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
@@ -44,8 +44,8 @@ int
be_visitor_root_ci::init (void)
{
// first open the client-side inline file for writing
- if (tao_cg->start_client_inline (idl_global->be_get_client_inline_fname ())
- == -1)
+ if (tao_cg->start_client_inline (be_global->be_get_client_inline_fname ())
+ == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_visitor_root_ci - "
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
index a6d0bc90b54..aea6f39d996 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
@@ -44,8 +44,8 @@ int
be_visitor_root_cs::init (void)
{
// first open the file
- if (tao_cg->start_client_stubs (idl_global->be_get_client_stub_fname ())
- == -1)
+ if (tao_cg->start_client_stubs (be_global->be_get_client_stub_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_cs - "
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
index 8b40bc778b5..e913ee653b6 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
@@ -42,14 +42,16 @@ int
be_visitor_root_ih::init (void)
{
// open the file
- if (tao_cg->start_implementation_header (idl_global->be_get_implementation_hdr_fname ())
+ if (tao_cg->start_implementation_header (
+ be_global->be_get_implementation_hdr_fname ()
+ )
== -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_ih::init - "
"Error :%p: Unable to open implementation header file : %s\n",
"start_implementation_header",
- idl_global->be_get_implementation_hdr_fname ()),
+ be_global->be_get_implementation_hdr_fname ()),
-1);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
index 5cf2a47ffce..c6b1aeab137 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
@@ -40,25 +40,16 @@ int
be_visitor_root_is::init (void)
{
// first open the file for writing
- if (tao_cg->start_implementation_skeleton (idl_global
- ->be_get_implementation_skel_fname ())
+ if (tao_cg->start_implementation_skeleton (
+ be_global->be_get_implementation_skel_fname ()
+ )
== -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_is::init - "
"Error opening implementation skeletons file\n"), -1);
}
- /*
- if (tao_cg->start_server_template_skeletons
- (idl_global->be_get_server_template_skeleton_fname ())
- == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root_ss::init - "
- "Error opening server template skeleton file\n"),
- -1);
- }
- */
+
// set stream
this->ctx_->stream (tao_cg->implementation_skeleton ());
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp
index 57aaadbfe5f..235f91da26a 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp
@@ -44,21 +44,21 @@ int
be_visitor_root_sh::init (void)
{
// open the file
- if (tao_cg->start_server_header (idl_global->be_get_server_hdr_fname ())
- == -1)
+ if (tao_cg->start_server_header (be_global->be_get_server_hdr_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_sh::init - "
"Error :%p: Unable to open server header file : %s\n",
"start_server_header",
- idl_global->be_get_server_hdr_fname ()),
+ be_global->be_get_server_hdr_fname ()),
-1);
}
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
{
if (tao_cg->start_server_template_header (
- idl_global->be_get_server_template_hdr_fname ()
+ be_global->be_get_server_template_hdr_fname ()
)
== -1)
{
@@ -66,8 +66,10 @@ be_visitor_root_sh::init (void)
LM_ERROR,
"(%N:%l) be_visitor_root_sh::init - "
"Error:Unable to openin server template header file : %s\n",
- idl_global->be_get_server_template_hdr_fname ()
- ), -1);
+ be_global->be_get_server_template_hdr_fname ()
+ ),
+ -1
+ );
}
}
// set the stream and the next state
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
index d4e73c9cc67..dedd3512e93 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
@@ -44,18 +44,18 @@ int
be_visitor_root_si::init (void)
{
// first open the file for writing
- if (tao_cg->start_server_inline (idl_global->be_get_server_inline_fname ())
- == -1)
+ if (tao_cg->start_server_inline (be_global->be_get_server_inline_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_si::init - "
"server inline open failed\n"), -1);
}
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
{
if (tao_cg->start_server_template_inline (
- idl_global->be_get_server_template_inline_fname ()
+ be_global->be_get_server_template_inline_fname ()
)
== -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
index 94949c60549..c661b0ffea1 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
@@ -44,8 +44,9 @@ int
be_visitor_root_ss::init (void)
{
// first open the file for writing
- if (tao_cg->start_server_skeletons (idl_global
- ->be_get_server_skeleton_fname ())
+ if (tao_cg->start_server_skeletons (
+ be_global->be_get_server_skeleton_fname ()
+ )
== -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -53,10 +54,10 @@ be_visitor_root_ss::init (void)
"Error opening server skeletons file\n"), -1);
}
- if (idl_global->gen_tie_classes ())
+ if (be_global->gen_tie_classes ())
{
if (tao_cg->start_server_template_skeletons (
- idl_global->be_get_server_template_skeleton_fname ()
+ be_global->be_get_server_template_skeleton_fname ()
)
== -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp
index ced58f67ca1..8702d07b34b 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp
@@ -53,16 +53,16 @@ be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node)
// generate the Any <<= and >>= operators
os->indent ();
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, const " << node->name ()
<< " &); // copying version" << be_nl;
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< "*); // noncopying version" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << " *&); // deprecated\n";
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, const "
<< node->name () << " *&);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
index 35dfb4583f7..32c29cc8b76 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
@@ -65,12 +65,12 @@ be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node)
<< "#define _TAO_CDR_OP_" << node->flat_name () << "_H_\n\n";
}
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &," << be_nl
<< "const " << node->name () << " &" << be_uidt_nl
<< ");" << be_uidt_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (" << be_idt << be_idt_nl
<< "TAO_InputCDR &," << be_nl
<< node->name () << " &" << be_uidt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
index 1cdcc583874..614e272f79e 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
@@ -99,12 +99,12 @@ be_visitor_sequence_cdr_op_ci::visit_sequence (be_sequence *node)
<< "#define _TAO_CDR_OP_" << node->flat_name () << "_I_\n\n";
}
- *os << "CORBA::Boolean " << idl_global->stub_export_macro ()
+ *os << "CORBA::Boolean " << be_global->stub_export_macro ()
<< " operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &," << be_nl
<< "const " << node->name () << " &" << be_uidt_nl
<< ");" << be_uidt_nl;
- *os << "CORBA::Boolean " << idl_global->stub_export_macro ()
+ *os << "CORBA::Boolean " << be_global->stub_export_macro ()
<< " operator>> (" << be_idt << be_idt_nl
<< "TAO_InputCDR &," << be_nl
<< node->name () << " &" << be_uidt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
index 5d38c72ab52..58fa247372d 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -317,7 +317,7 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
<< be_nl << be_nl;
// generate a typedef to a parametrized sequence
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << node->local_name () << " : public ";
if (this->gen_base_sequence_class (node) == -1)
@@ -492,7 +492,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
// for over here.
os->indent (); // start with whatever was our current indent level
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << namebuf << be_nl;
*os << "{" << be_nl;
*os << "public:\n";
@@ -622,7 +622,7 @@ be_visitor_sequence_ch::gen_out_defn (be_sequence *node)
// generate the out definition (always in the client header)
os->indent (); // start with whatever was our current indent level
- *os << "class " << idl_global->stub_export_macro () << " "
+ *os << "class " << be_global->stub_export_macro () << " "
<< namebuf << be_nl;
*os << "{" << be_nl;
*os << "public:\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp
index ca1eecdeb61..270d28077df 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp
@@ -53,16 +53,16 @@ be_visitor_structure_any_op_ch::visit_structure (be_structure *node)
// generate the Any <<= and >>= operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, const " << node->name ()
<< " &); // copying version" << be_nl;
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< "*); // noncopying version" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << " *&); // deprecated\n";
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, const "
<< node->name () << " *&);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
index 4aed27f26e2..4f561b10d61 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
@@ -53,10 +53,10 @@ be_visitor_structure_cdr_op_ch::visit_structure (be_structure *node)
// generate the CDR << and >> operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &);" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, "
<< node->name () << " &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
index 25b45192584..60d96548220 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
@@ -55,7 +55,7 @@ int be_visitor_structure_ch::visit_structure (be_structure *node)
*os << "struct " << node->local_name () << ";" << be_nl;
*os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
- *os << "struct " << idl_global->stub_export_macro () << " "
+ *os << "struct " << be_global->stub_export_macro () << " "
<< node->local_name () << be_nl
<< "{" << be_idt << "\n\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
index d6aa162da31..1c062214ac4 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
@@ -67,8 +67,10 @@ be_visitor_typecode_decl::visit_type (be_type *node)
{
// we are in the ROOT scope
os->indent ();
- *os << "extern " << idl_global->stub_export_macro () << " CORBA::TypeCode_ptr "
- << " " << node->tc_name (prefix, postfix)->last_component () << ";\n\n";
+ *os << "extern " << be_global->stub_export_macro ()
+ << " CORBA::TypeCode_ptr "
+ << " " << node->tc_name (prefix, postfix)->last_component ()
+ << ";\n\n";
}
return 0;
}
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 ef7f390de3a..ec0d503679b 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -107,7 +107,7 @@ be_visitor_typecode_defn::visit_type (be_type *node)
// check if optimized typecodes are desired OR if the node is involved in
// some form of recursion
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -792,7 +792,7 @@ be_visitor_typecode_defn::gen_typecode (be_enum *node)
}
else
{
- if (idl_global->opt_tc ())
+ if (be_global->opt_tc ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
{
@@ -924,7 +924,7 @@ be_visitor_typecode_defn::gen_typecode (be_exception *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -1072,7 +1072,7 @@ be_visitor_typecode_defn::gen_typecode (be_interface *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -1243,7 +1243,7 @@ be_visitor_typecode_defn::gen_typecode (be_predefined_type *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -1469,7 +1469,7 @@ be_visitor_typecode_defn::gen_typecode (be_structure *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -1584,7 +1584,7 @@ be_visitor_typecode_defn::gen_typecode (be_typedef *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -1698,7 +1698,7 @@ be_visitor_typecode_defn::gen_typecode (be_union *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
@@ -2067,7 +2067,7 @@ be_visitor_typecode_defn::compute_tc_size (be_enum *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2177,7 +2177,7 @@ be_visitor_typecode_defn::compute_tc_size (be_exception *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2304,7 +2304,7 @@ be_visitor_typecode_defn::compute_tc_size (be_interface *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2383,7 +2383,7 @@ be_visitor_typecode_defn::compute_tc_size (be_predefined_type *node)
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2516,7 +2516,7 @@ be_visitor_typecode_defn::compute_tc_size (be_structure *node)
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2615,7 +2615,7 @@ be_visitor_typecode_defn::compute_tc_size (be_typedef *node)
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2693,7 +2693,7 @@ be_visitor_typecode_defn::compute_tc_size (be_union *node)
}
else
{
- if (idl_global->opt_tc () ||
+ if (be_global->opt_tc () ||
node->in_recursion ())
{
if (this->queue_insert (this->compute_queue_, node, this->tc_offset_) == 0)
@@ -2833,7 +2833,7 @@ be_visitor_typecode_defn::gen_repoID (be_decl *node)
// exception in which case it is mandatory to have the repository ID)
// generate repoID
- if (idl_global->opt_tc ())
+ if (be_global->opt_tc ())
{
switch (node->node_type ())
{
@@ -2910,7 +2910,7 @@ be_visitor_typecode_defn::gen_name (be_decl *node)
// case. (Alex).
// Generate name.
- if (idl_global->opt_tc ())
+ if (be_global->opt_tc ())
{
*os << "1, 0x0,";
*os << " // name = " << node->local_name ();
@@ -2951,7 +2951,7 @@ be_visitor_typecode_defn::repoID_encap_len (be_decl *node)
// exception in which case it is mandatory to have the repository ID)
// generate repoID
- if (idl_global->opt_tc ())
+ if (be_global->opt_tc ())
{
switch (node->node_type ())
{
@@ -3002,7 +3002,7 @@ be_visitor_typecode_defn::repoID_encap_len (be_decl *node)
ACE_CDR::ULong
be_visitor_typecode_defn::name_encap_len (be_decl *node)
{
- if (idl_global->opt_tc ())
+ if (be_global->opt_tc ())
{
return 4 + 4;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp
index 9075cb591a5..fccf30875f8 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp
@@ -53,16 +53,16 @@ be_visitor_union_any_op_ch::visit_union (be_union *node)
// generate the Any <<= and >>= operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, const " << node->name ()
<< " &); // copying version" << be_nl;
- *os << idl_global->stub_export_macro () << " void"
+ *os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< "*); // noncopying version" << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
<< node->name () << " *&); // deprecated\n";
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, const "
<< node->name () << " *&);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
index 95b1d63d3dd..bf5bfb922f7 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
@@ -53,10 +53,10 @@ be_visitor_union_cdr_op_ch::visit_union (be_union *node)
// generate the CDR << and >> operator declarations
os->indent ();
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &); // " << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, "
<< node->name () << " &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
index c3fe22b3a65..e47e52b51af 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
@@ -64,7 +64,7 @@ int be_visitor_union_ch::visit_union (be_union *node)
*os << "class " << node->local_name () << ";" << be_nl;
*os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
- *os << "class " << idl_global->stub_export_macro () << " "
+ *os << "class " << be_global->stub_export_macro () << " "
<< node->local_name () << be_nl
<< "{" << be_nl
<< "public:" << be_idt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
index ee26d59dec1..c4f33bccd4c 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
@@ -64,7 +64,7 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
}
// generate the CORBA::Environment parameter for the alternative mapping
- if (!idl_global->exception_support ())
+ if (!be_global->exception_support ())
{
// if the operation node has parameters, then we need to insert a comma
if (node->argument_count () > 0)
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
index af60399b98d..b23d0243509 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
@@ -50,10 +50,10 @@ be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
// generate the CDR << and >> operator declarations (prototypes)
os->indent ();
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->full_name ()
<< " *); // " << be_nl;
- *os << idl_global->stub_export_macro () << " CORBA::Boolean"
+ *os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, "
<< node->full_name () << " *&);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
index 441f0c1b2fd..280108ce3f9 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
@@ -792,7 +792,7 @@ be_visitor_valuetype::gen_init_defn (be_valuetype *node)
os = this->ctx_->stream ();
os->indent (); // start with whatever indentation level we are at
- *os << "class " << idl_global->skel_export_macro ()
+ *os << "class " << be_global->skel_export_macro ()
<< " " << node->local_name ()
<< "_init : public CORBA_ValueFactoryBase" << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
index 8d93ac634b7..83df8603550 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
@@ -109,7 +109,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
// now generate the class definition
os->indent ();
- *os << "class " << idl_global->stub_export_macro ()
+ *os << "class " << be_global->stub_export_macro ()
<< " " << node->local_name ();
// node valuetype inherits from other valuetypes (OMG 20.17.9)