diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-26 00:31:21 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-26 00:31:21 +0000 |
commit | d1f04192efaead9408528477ab4f4fcbab1c29bb (patch) | |
tree | 392d445ff46ae4a1382ddb62dcbd48d290ba0681 | |
parent | 29436378604616d061ee94897d2476fc2cf5dac7 (diff) | |
download | ATCD-d1f04192efaead9408528477ab4f4fcbab1c29bb.tar.gz |
ChangeLogTag: Mon Mar 25 18:27:03 2002 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r-- | TAO/TAO_IDL/ast/ast_constant.cpp | 21 | ||||
-rw-r--r-- | TAO/TAO_IDL/ast/ast_expression.cpp | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_constant.cpp | 28 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_global.cpp | 43 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_sunsoft.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp | 17 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_constant.cpp | 1 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp | 61 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp | 40 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_constant.h | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_global.h | 205 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_args.cpp | 40 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/ast_constant.h | 2 |
13 files changed, 317 insertions, 152 deletions
diff --git a/TAO/TAO_IDL/ast/ast_constant.cpp b/TAO/TAO_IDL/ast/ast_constant.cpp index d891bc24b99..ef2de1b8cfa 100644 --- a/TAO/TAO_IDL/ast/ast_constant.cpp +++ b/TAO/TAO_IDL/ast/ast_constant.cpp @@ -146,7 +146,7 @@ AST_Constant::AST_Constant (AST_Expression::ExprType t, UTL_ScopedName *n) : AST_Decl (nt, n), - pd_constant_value (idl_global->gen ()->create_expr (v, t)), + pd_constant_value (v), pd_et (t), ifr_added_ (0) { @@ -158,10 +158,25 @@ AST_Constant::AST_Constant (AST_Expression::ExprType t, UTL_ScopedName *n) : AST_Decl (AST_Decl::NT_const, n), - pd_constant_value (idl_global->gen ()->create_expr (v, t)), + pd_constant_value (v), pd_et (t), ifr_added_ (0) { + // Avoids a truncation warning on MSVC when assigning a decimal + // literal to a float constant. + if (t == AST_Expression::EV_float) + { + AST_Expression::AST_ExprValue *ev = + this->pd_constant_value->ev (); + ev->et = t; + ev->u.fval = (float) ev->u.dval; + } + // Allows the enum value string name to be used in generating the + // rhs of the constant assignment. + else if (t == AST_Expression::EV_any) + { + this->pd_constant_value->ev ()->et = t; + } } AST_Constant::~AST_Constant (void) @@ -174,7 +189,7 @@ AST_Constant::~AST_Constant (void) void AST_Constant::dump (ACE_OSTREAM_TYPE &o) { - o << "const " << exprtype_to_string (pd_et) << " "; + o << "const " << exprtype_to_string (this->pd_et) << " "; this->local_name ()->dump (o); diff --git a/TAO/TAO_IDL/ast/ast_expression.cpp b/TAO/TAO_IDL/ast/ast_expression.cpp index 219c115b3b7..189ed2a84db 100644 --- a/TAO/TAO_IDL/ast/ast_expression.cpp +++ b/TAO/TAO_IDL/ast/ast_expression.cpp @@ -1519,6 +1519,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev, switch (ev->et) { case AST_Expression::EV_any: + case AST_Expression::EV_ulong: return ev; default: return 0; @@ -2514,8 +2515,8 @@ AST_Expression::ast_accept (ast_visitor *visitor) void AST_Expression::destroy (void) { - delete this->pd_ev; - this->pd_ev = 0; +// delete this->pd_ev; +// this->pd_ev = 0; } // Data accessors. diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp index fc9a775f943..a3a294771fb 100644 --- a/TAO/TAO_IDL/be/be_constant.cpp +++ b/TAO/TAO_IDL/be/be_constant.cpp @@ -21,6 +21,8 @@ #include "be_constant.h" #include "be_visitor.h" +#include "utl_scope.h" +#include "nr_extern.h" ACE_RCSID (be, be_constant, @@ -44,7 +46,7 @@ be_constant::be_constant (AST_Expression::ExprType et, const char * be_constant::exprtype_to_string (void) { - switch (this->et ()) + switch (this->pd_et) { case AST_Expression::EV_short: return "CORBA::Short"; @@ -66,8 +68,6 @@ be_constant::exprtype_to_string (void) return "CORBA::Boolean"; case AST_Expression::EV_string: return "char *const"; - case AST_Expression::EV_any: - return "CORBA::Any"; case AST_Expression::EV_void: return "void"; case AST_Expression::EV_none: @@ -81,9 +81,27 @@ be_constant::exprtype_to_string (void) case AST_Expression::EV_wstring: return "CORBA::WChar *const"; case AST_Expression::EV_longdouble: - return NULL; + case AST_Expression::EV_any: + return 0; + } + + return 0; +} + +UTL_ScopedName * +be_constant::enum_full_name (void) +{ + if (this->pd_et == AST_Expression::EV_any) + { + UTL_Scope *s = this->defined_in (); + AST_Decl *d = s->lookup_by_name (this->pd_constant_value->n (), + 1); + return (ScopeAsDecl (d->defined_in ()))->name (); + } + else + { + return 0; } - return NULL; } int diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 0adf9646ba1..524ea6868cd 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -70,6 +70,7 @@ BE_GlobalData::BE_GlobalData (void) gen_amh_classes_ (I_FALSE), gen_tie_classes_ (I_TRUE), gen_smart_proxies_ (I_FALSE), + gen_inline_constants_ (I_FALSE), lookup_strategy_ (TAO_PERFECT_HASH) { } @@ -664,7 +665,7 @@ BE_GlobalData::any_support (idl_bool val) } idl_bool -BE_GlobalData::any_support (void) +BE_GlobalData::any_support (void) const { return this->any_support_; } @@ -676,7 +677,7 @@ BE_GlobalData::tc_support (idl_bool val) } idl_bool -BE_GlobalData::tc_support (void) +BE_GlobalData::tc_support (void) const { return this->tc_support_; } @@ -688,7 +689,7 @@ BE_GlobalData::obv_opt_accessor (idl_bool val) } idl_bool -BE_GlobalData::obv_opt_accessor (void) +BE_GlobalData::obv_opt_accessor (void) const { return this->obv_opt_accessor_; } @@ -700,7 +701,7 @@ BE_GlobalData::gen_impl_files (idl_bool val) } idl_bool -BE_GlobalData::gen_impl_files (void) +BE_GlobalData::gen_impl_files (void) const { return this->gen_impl_files_; } @@ -712,7 +713,7 @@ BE_GlobalData::gen_copy_ctor (idl_bool val) } idl_bool -BE_GlobalData::gen_copy_ctor (void) +BE_GlobalData::gen_copy_ctor (void) const { return this->gen_copy_ctor_; } @@ -724,7 +725,7 @@ BE_GlobalData::gen_assign_op (idl_bool val) } idl_bool -BE_GlobalData::gen_assign_op (void) +BE_GlobalData::gen_assign_op (void) const { return this->gen_assign_op_; } @@ -736,7 +737,7 @@ BE_GlobalData::gen_thru_poa_collocation (idl_bool val) } idl_bool -BE_GlobalData::gen_thru_poa_collocation (void) +BE_GlobalData::gen_thru_poa_collocation (void) const { return this->gen_thru_poa_collocation_; } @@ -748,7 +749,7 @@ BE_GlobalData::gen_direct_collocation (idl_bool val) } idl_bool -BE_GlobalData::gen_direct_collocation (void) +BE_GlobalData::gen_direct_collocation (void) const { return this->gen_direct_collocation_; } @@ -760,7 +761,7 @@ BE_GlobalData::exception_support (idl_bool val) } idl_bool -BE_GlobalData::exception_support (void) +BE_GlobalData::exception_support (void) const { return this->exception_support_; } @@ -772,7 +773,7 @@ BE_GlobalData::use_raw_throw (idl_bool val) } idl_bool -BE_GlobalData::use_raw_throw (void) +BE_GlobalData::use_raw_throw (void) const { return this->use_raw_throw_; } @@ -784,7 +785,7 @@ BE_GlobalData::opt_tc (idl_bool val) } idl_bool -BE_GlobalData::opt_tc (void) +BE_GlobalData::opt_tc (void) const { return this->opt_tc_; } @@ -796,7 +797,7 @@ BE_GlobalData::ami_call_back (idl_bool val) } idl_bool -BE_GlobalData::ami_call_back (void) +BE_GlobalData::ami_call_back (void) const { return this->ami_call_back_; } @@ -808,7 +809,7 @@ BE_GlobalData::gen_amh_classes (idl_bool val) } idl_bool -BE_GlobalData::gen_amh_classes (void) +BE_GlobalData::gen_amh_classes (void) const { return this->gen_amh_classes_; } @@ -820,7 +821,7 @@ BE_GlobalData::gen_tie_classes (idl_bool val) } idl_bool -BE_GlobalData::gen_tie_classes (void) +BE_GlobalData::gen_tie_classes (void) const { return this->gen_tie_classes_; } @@ -832,12 +833,24 @@ BE_GlobalData::gen_smart_proxies (idl_bool val) } idl_bool -BE_GlobalData::gen_smart_proxies (void) +BE_GlobalData::gen_smart_proxies (void) const { return this->gen_smart_proxies_; } void +BE_GlobalData::gen_inline_constants (idl_bool val) +{ + this->gen_inline_constants_ = val; +} + +idl_bool +BE_GlobalData::gen_inline_constants (void) const +{ + return this->gen_inline_constants_; +} + +void BE_GlobalData::lookup_strategy (LOOKUP_STRATEGY s) { this->lookup_strategy_ = s; diff --git a/TAO/TAO_IDL/be/be_sunsoft.cpp b/TAO/TAO_IDL/be/be_sunsoft.cpp index 33339fb1bd3..262b42f5b9d 100644 --- a/TAO/TAO_IDL/be/be_sunsoft.cpp +++ b/TAO/TAO_IDL/be/be_sunsoft.cpp @@ -171,6 +171,9 @@ TAO_SunSoft_OutStream::print (AST_Expression *expr) case AST_Expression::EV_wstring: this->TAO_OutStream::print ("L\"%s\"", ev->u.wstrval); break; + case AST_Expression::EV_any: + this->print (expr->n ()); + break; default: break; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp index bec48df7cca..58524535750 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp @@ -172,7 +172,6 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) { TAO_OutStream *os = this->ctx_->stream (); // get output stream - // check if the type is an any if (node->pt () == AST_PredefinedType::PT_any) { switch (this->direction ()) @@ -186,9 +185,9 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (node->pt () == AST_PredefinedType::PT_pseudo) { // The only PT_pseudo that doesn't take a _ptr suffix. idl_bool is_tckind = @@ -221,9 +220,9 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end else if - else // simple predefined types + } + } + else { switch (this->direction ()) { @@ -236,8 +235,8 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end of else + } + } return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_constant.cpp b/TAO/TAO_IDL/be/be_visitor_constant.cpp index a93bbf6a987..9144be5d367 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant.cpp @@ -21,6 +21,7 @@ #include "be_constant.h" #include "be_module.h" #include "be_helper.h" +#include "be_extern.h" #include "utl_identifier.h" #include "be_visitor_constant.h" diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp index 67546a64bb7..308e48b5efb 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp @@ -48,27 +48,56 @@ be_visitor_constant_ch::visit_constant (be_constant *node) // If we are defined in the outermost scope, then the value is assigned // to us here itself, else it will be in the *.cpp file. - // Is our enclosing scope a module? We need this check because for - // platforms that support namespaces, the typecode must be declared - // extern. - if (node->is_nested () && - (node->defined_in ()->scope_node_type () == AST_Decl::NT_module)) + if (be_global->gen_inline_constants ()) { - *os << "TAO_NAMESPACE_STORAGE_CLASS "; + if (node->et () == AST_Expression::EV_any) + { + *os << node->enum_full_name (); + } + else + { + *os << node->exprtype_to_string (); + } + + *os << " const " + << node->local_name () << " = " + << node->constant_value (); } - else + // Is our enclosing scope a module? We need this check because for + // platforms that support namespaces, the constant must be declared + // extern. + else { - *os << "static "; - } + AST_Decl::NodeType nt = node->defined_in ()->scope_node_type (); - *os << "const " << node->exprtype_to_string () - << " " << node->local_name (); + if (node->is_nested () && nt == AST_Decl::NT_module) + { + *os << "TAO_NAMESPACE_STORAGE_CLASS "; + } + else + { + *os << "static "; + } - if (!node->is_nested ()) - { - // We were defined at the outermost scope. So we put the value in the - // header itself. - *os << " = " << node->constant_value (); + *os << "const "; + + if (node->et () == AST_Expression::EV_any) + { + *os << node->enum_full_name (); + } + else + { + *os << node->exprtype_to_string (); + } + + *os << " " << node->local_name (); + + if (!node->is_nested ()) + { + // We were defined at the outermost scope. So we put the value + // in the header itself. + *os << " = " << node->constant_value (); + } } *os << ";" << be_nl << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp index 2fbe7c355f9..4e82116ac96 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp @@ -43,7 +43,9 @@ be_visitor_constant_cs::visit_constant (be_constant *node) { TAO_OutStream *os = this->ctx_->stream (); - if (!node->cli_stub_gen () && !node->imported ()) + if (!node->cli_stub_gen () + && !node->imported () + && !be_global->gen_inline_constants ()) { if (node->is_nested ()) { @@ -51,31 +53,47 @@ be_visitor_constant_cs::visit_constant (be_constant *node) { *os << "TAO_NAMESPACE_TYPE (const " << node->exprtype_to_string () << ")" << be_nl; - be_module *module = be_module::narrow_from_scope (node->defined_in ()); - if (!module || (this->gen_nested_namespace_begin (module) == -1)) + be_module *module = + be_module::narrow_from_scope (node->defined_in ()); + + if (!module || this->gen_nested_namespace_begin (module) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_constant_cs::visit_constant - " + "be_visitor_constant_cs::" + "visit_constant - " "Error parsing nested name\n"), -1); } - *os << "TAO_NAMESPACE_DEFINE (const " - << node->exprtype_to_string () << ", " - << node->local_name () << ", " + + *os << "TAO_NAMESPACE_DEFINE (const "; + + if (node->et () == AST_Expression::EV_any) + { + *os << node->enum_full_name (); + } + else + { + *os << node->exprtype_to_string (); + } + + *os << ", " << node->local_name () << ", " << node->constant_value () << ")" << be_nl; + if (this->gen_nested_namespace_end (module) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_constant_cs::visit_constant - " + "be_visitor_constant_cs::" + "visit_constant - " "Error parsing nested name\n"), -1); } } else { - // for those constants not defined in the outer most scope, they get - // assigned to their values in the impl file - os->indent (); // start from whatever indentation level we were at + // For those constants not defined in the outer most scope, + // they get assigned to their values in the impl file. + os->indent (); + *os << "const " << node->exprtype_to_string () << " " << node->name () << " = " << node->constant_value () << ";\n\n"; diff --git a/TAO/TAO_IDL/be_include/be_constant.h b/TAO/TAO_IDL/be_include/be_constant.h index 06a28e71b26..d62db0481d5 100644 --- a/TAO/TAO_IDL/be_include/be_constant.h +++ b/TAO/TAO_IDL/be_include/be_constant.h @@ -43,6 +43,9 @@ public: const char *exprtype_to_string (void); // Returns the appropriate type. + UTL_ScopedName *enum_full_name (void); + // If our type is enum, we have to generate the scoped name. + // Visiting. virtual int accept (be_visitor *visitor); diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index 7ed669436f9..bf4773ecd0c 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -66,19 +66,36 @@ public: // The parameter <base_name_only> set to 0 (no base name, but full // name with output dir path, is useful, when I just want just the // base name to use in #include's etc. - static const char *be_get_client_hdr_fname (int base_name_only = 0); - static const char *be_get_client_stub_fname (void); - static const char *be_get_client_inline_fname (int base_name_only = 0); - static const char *be_get_server_hdr_fname (int base_name_only = 0); - static const char *be_get_implementation_hdr_fname (int base_name_only = 0); - static const char *be_get_implementation_skel_fname (int base_name_only = 0); - static const char *be_get_server_template_hdr_fname (int base_name_only = 0); - static const char *be_get_server_skeleton_fname (void); - static const char *be_get_implementation_skeleton_fname (void); - // static const char *be_get_implementation_hdr_fname (void); - static const char *be_get_server_template_skeleton_fname (int base_name_only = 0); - static const char *be_get_server_inline_fname (int base_name_only = 0); - static const char *be_get_server_template_inline_fname (int base_name_only = 0); + static const char *be_get_client_hdr_fname ( + int base_name_only = 0 + ); + static const char *be_get_client_stub_fname (void); + static const char *be_get_client_inline_fname ( + int base_name_only = 0 + ); + static const char *be_get_server_hdr_fname ( + int base_name_only = 0 + ); + static const char *be_get_implementation_hdr_fname ( + int base_name_only = 0 + ); + static const char *be_get_implementation_skel_fname ( + int base_name_only = 0 + ); + static const char *be_get_server_template_hdr_fname ( + int base_name_only = 0 + ); + static const char *be_get_server_skeleton_fname (void); + static const char *be_get_implementation_skeleton_fname (void); + static const char *be_get_server_template_skeleton_fname ( + int base_name_only = 0 + ); + static const char *be_get_server_inline_fname ( + int base_name_only = 0 + ); + static const char *be_get_server_template_inline_fname ( + int base_name_only = 0 + ); // Helper functions: obtain the names of each generated file given // the IDL file name. @@ -99,247 +116,255 @@ public: static const char *be_get_server_template_hdr (UTL_String *idl_file_name, int base_name_only = 0); static const char *be_get_server_skeleton (UTL_String *idl_file_name); - static const char *be_get_server_template_skeleton (UTL_String *idl_file_name, - int base_name_only = 0); + static const char *be_get_server_template_skeleton ( + UTL_String *idl_file_name, + int base_name_only = 0 + ); static const char *be_get_server_inline (UTL_String *idl_file_name, int base_name_only = 0); static const char *be_get_server_template_inline (UTL_String *idl_file_name, int base_name_only = 0); - virtual const char* skel_export_macro (void) const; + const char* skel_export_macro (void) const; // returns the macro name for exporting server side classes in Win32 // DLL. - virtual void skel_export_macro (const char* s); + void skel_export_macro (const char* s); // set the macro name for export server side classes in Win32 DLL. - virtual const char* skel_export_include (void) const; + const char* skel_export_include (void) const; // returns the name of the include file that contains the server // side export macro definition. - virtual void skel_export_include (const char* s); + void skel_export_include (const char* s); // set the name of the include file that contains the server side // export macro definition. - virtual const char* stub_export_macro (void) const; + const char* stub_export_macro (void) const; // returns the macro name for exporting client side classes in Win32 // DLL. - virtual void stub_export_macro (const char* s); + void stub_export_macro (const char* s); // set the macro name for export client side classes in Win32 DLL. - virtual const char* stub_export_include (void) const; + const char* stub_export_include (void) const; // returns the name of the include file that contains the client // side export macro definition. - virtual void stub_export_include (const char* s); + void stub_export_include (const char* s); // set the name of the include file that contains the client side // export macro definition. - virtual const char* pch_include (void) const; + const char* pch_include (void) const; // returns the name of the include file to be used for precompiled // header support. - virtual void pch_include (const char* s); + void pch_include (const char* s); // set the name of the include file to be used for precompiled // header support. - virtual const char* pre_include (void) const; + const char* pre_include (void) const; // returns the name of the include file to be put at the top of // every header file. - virtual void pre_include (const char* s); + void pre_include (const char* s); // set the name of the include file to be put at the top of every // header file. - virtual const char* post_include (void) const; + const char* post_include (void) const; // returns the name of the include file to be put at the bottom of // every header file. - virtual void post_include (const char* s); + void post_include (const char* s); // set the name of the include file to be put at the bottom of every // header file. // = Set and get methods for different file name endings. - virtual void client_hdr_ending (const char* s); + void client_hdr_ending (const char* s); // Set the client_hdr_ending. - virtual const char* client_hdr_ending (void) const; + const char* client_hdr_ending (void) const; // Get the client_hdr_ending. - virtual void client_inline_ending (const char* s); + void client_inline_ending (const char* s); // Set the client_inline_ending. - virtual const char* client_inline_ending (void) const; + const char* client_inline_ending (void) const; // Get the client_inline_ending. - virtual void client_stub_ending (const char* s); + void client_stub_ending (const char* s); // Set the client_stub_ending. - virtual const char* client_stub_ending (void) const; + const char* client_stub_ending (void) const; // Get the client_stub_ending. - virtual void server_hdr_ending (const char* s); + void server_hdr_ending (const char* s); // Set the server_hdr_ending. - virtual const char* server_hdr_ending (void) const; + const char* server_hdr_ending (void) const; // Get the server_hdr_ending. - virtual void implementation_hdr_ending (const char* s); + void implementation_hdr_ending (const char* s); // Set the implementation_hdr_ending. - virtual void impl_class_prefix (const char* s); + void impl_class_prefix (const char* s); // Set the implementation class prefix. - virtual void impl_class_suffix (const char* s); + void impl_class_suffix (const char* s); // Set the implementation class suffix. - virtual void implementation_skel_ending (const char* s); + void implementation_skel_ending (const char* s); // Set the implementation_skel_ending. - virtual const char* implementation_hdr_ending (void) const; + const char* implementation_hdr_ending (void) const; // Get the implementation_hdr_ending. - virtual const char* impl_class_prefix (void) const; + const char* impl_class_prefix (void) const; //Get implementation class prefix - virtual const char* impl_class_suffix (void) const; + const char* impl_class_suffix (void) const; //Get implementation class suffix - virtual const char* implementation_skel_ending (void) const; + const char* implementation_skel_ending (void) const; // Get the implementation_skel_ending. - virtual void server_template_hdr_ending (const char* s); + void server_template_hdr_ending (const char* s); // Set the server_template_hdr_ending. - virtual const char* server_template_hdr_ending (void) const; + const char* server_template_hdr_ending (void) const; // Get the server_template_hdr_ending. - virtual void server_skeleton_ending (const char* s); + void server_skeleton_ending (const char* s); // Set the server_skeleton_ending. - virtual const char* server_skeleton_ending (void) const; + const char* server_skeleton_ending (void) const; // Get the server_skeleton_ending. - virtual void server_template_skeleton_ending (const char* s); + void server_template_skeleton_ending (const char* s); // Set the server_template_skeleton_ending. - virtual const char* server_template_skeleton_ending (void) const; + const char* server_template_skeleton_ending (void) const; // Get the server_template_skeleton_ending. - virtual void server_inline_ending (const char* s); + void server_inline_ending (const char* s); // Set the server_inline_ending. - virtual const char* server_inline_ending (void) const; + const char* server_inline_ending (void) const; // Get the server_inline_ending. - virtual void server_template_inline_ending (const char* s); + void server_template_inline_ending (const char* s); // Set the server_template_inline_ending. - virtual const char* server_template_inline_ending (void) const; + const char* server_template_inline_ending (void) const; // Get the server_template_inline_ending. - virtual void output_dir (const char* s); + void output_dir (const char* s); // Set the directory where all the IDL-Compiler-Generated files are // to be kept. Default is current directory from which the // <tao_idl> is called. - virtual const char* output_dir (void) const; + const char* output_dir (void) const; // Get the directory where all the IDL-Compiler-Generated files are // to be kept. Default is current directory from which the // <tao_idl> is called. - virtual void any_support (idl_bool); + void any_support (idl_bool); // Set any support. - virtual idl_bool any_support (void); + idl_bool any_support (void) const; // Check Any support. - virtual void tc_support (idl_bool); + void tc_support (idl_bool); // Set TypeCode support. - virtual idl_bool tc_support (void); + idl_bool tc_support (void) const; // Check TypeCode support - virtual void obv_opt_accessor (idl_bool); + void obv_opt_accessor (idl_bool); // Set optimized valuetype member accessor generation. - virtual idl_bool obv_opt_accessor (void); + idl_bool obv_opt_accessor (void) const; // Check optimized valuetype member accessor generation. - virtual void gen_impl_files (idl_bool); + void gen_impl_files (idl_bool); // Set generation of implementation files. - virtual idl_bool gen_impl_files (void); + idl_bool gen_impl_files (void) const; // Check if we want to generate implementation files. - virtual void gen_copy_ctor (idl_bool); + void gen_copy_ctor (idl_bool); // Set generation of copy constructor. - virtual idl_bool gen_copy_ctor (void); + idl_bool gen_copy_ctor (void) const; // Check if we want to generate the copy constructor. - virtual void gen_assign_op (idl_bool); + void gen_assign_op (idl_bool); // Set the generation of the assignment operator. - virtual idl_bool gen_assign_op (void); + idl_bool gen_assign_op (void) const; // Check if we want to generate the assignment operator. - virtual void gen_thru_poa_collocation (idl_bool); + void gen_thru_poa_collocation (idl_bool); // Set whether we want to generate Thru_POA collocation stubs. - virtual idl_bool gen_thru_poa_collocation (void); + idl_bool gen_thru_poa_collocation (void) const; // Check if we want to generate Thru_POA collocation stubs. - virtual void gen_direct_collocation (idl_bool); + void gen_direct_collocation (idl_bool); // Set whether we want to generate Direct collocation stubs. - virtual idl_bool gen_direct_collocation (void); + idl_bool gen_direct_collocation (void) const; // Check if we want to generate Direct collocation stubs. - virtual void exception_support (idl_bool); + void exception_support (idl_bool); // Set real C++ exception support. - virtual idl_bool exception_support (void); + idl_bool exception_support (void) const; // Check if real C++ exception support is enabled. - virtual void use_raw_throw (idl_bool); + void use_raw_throw (idl_bool); // Set replacement of 'ACE_THROW_SPEC' with 'throw'. - virtual idl_bool use_raw_throw (void); + idl_bool use_raw_throw (void) const; // Check if raw 'throw' generation option is set. - virtual void opt_tc (idl_bool); + void opt_tc (idl_bool); // Set optimized typecodes. - virtual idl_bool opt_tc (void); + idl_bool opt_tc (void) const; // Check if TypeCodes are optimized. - virtual void ami_call_back (idl_bool value); + void ami_call_back (idl_bool value); // To enable or disable AMI call back feature of the Messaging // specification in the generated code. - virtual idl_bool ami_call_back (void); + idl_bool ami_call_back (void) const; // Return the flag. - virtual void gen_amh_classes (idl_bool value); + void gen_amh_classes (idl_bool value); // To enable or disable AMH in the generated code. - virtual idl_bool gen_amh_classes (void); + idl_bool gen_amh_classes (void) const; // Return the flag. - virtual void gen_tie_classes (idl_bool value); + void gen_tie_classes (idl_bool value); // Set the generation of tie classes and files. - virtual idl_bool gen_tie_classes (void); + idl_bool gen_tie_classes (void) const; // Return the flag. - virtual void gen_smart_proxies (idl_bool value); + void gen_smart_proxies (idl_bool value); // To enable or disable AMI call back feature of the Messaging // specification in the generated code. - virtual idl_bool gen_smart_proxies (void); + idl_bool gen_smart_proxies (void) const; + // Return the flag. + + void gen_inline_constants (idl_bool value); + // Set the flag. + + idl_bool gen_inline_constants (void) const; // Return the flag. void lookup_strategy (LOOKUP_STRATEGY s); @@ -349,7 +374,7 @@ public: // Return the enumerated value for the lookup strategy. Default is // perfect hashing. - virtual void destroy (void); + void destroy (void); // Cleanup function. ACE_Unbounded_Queue<be_interface *> non_local_interfaces; @@ -470,6 +495,10 @@ private: // Flag to indicate whether smart proxies classes will be generated // or not. + idl_bool gen_inline_constants_; + // Flag to indicate whether we are using an inline form of constant + // generation that pleases the C++ compiler better on some platforms. + LOOKUP_STRATEGY lookup_strategy_; // The enumerated value indicating the lookup strategy. }; diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp index 2cfb2763791..e245ccb5335 100644 --- a/TAO/TAO_IDL/driver/drv_args.cpp +++ b/TAO/TAO_IDL/driver/drv_args.cpp @@ -1137,6 +1137,7 @@ DRV_parse_args (long ac, char **av) ACE_OS::exit (99); } + break; case 'G': // Enable generation of ... @@ -1167,9 +1168,44 @@ DRV_parse_args (long ac, char **av) else if (av[i][2] == 's') { if (av[i][3] == 'p') - // smart proxies - be_global->gen_smart_proxies (I_TRUE); + { + // smart proxies + be_global->gen_smart_proxies (I_TRUE); + } + else + { + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("IDL: I don't understand ") + ACE_TEXT ("the '%s' option\n"), + av[i] + )); + + ACE_OS::exit (99); + } + break; + } + else if (av[i][2] == 'i') + { + if (av[i][3] == 'c') + { + // inline constants + be_global->gen_inline_constants (I_TRUE); + } + else + { + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("IDL: I don't understand ") + ACE_TEXT ("the '%s' option\n"), + av[i] + )); + + ACE_OS::exit (99); + } + + break; } else if (av[i][2] == 't') { diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h index f75ab767cdd..011cd0ab5af 100644 --- a/TAO/TAO_IDL/include/ast_constant.h +++ b/TAO/TAO_IDL/include/ast_constant.h @@ -118,7 +118,7 @@ public: // Cleanup. virtual void destroy (void); -private: +protected: AST_Expression *pd_constant_value; // The value. |