summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-07 22:58:30 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-07 22:58:30 +0000
commitaf094bcffd20f5bb5cae58e0532b12dd7f9236c1 (patch)
tree0aeb4bb733629c7912189439acf1acf2f9da8df8
parent971c5d93332c98567e36ab2bf67d3d240c8b040e (diff)
downloadATCD-af094bcffd20f5bb5cae58e0532b12dd7f9236c1.tar.gz
ChangeLogTag: Mon Jul 7 17:53:06 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog_ref16
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp137
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp131
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp1
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h5
-rw-r--r--TAO/TAO_IDL/include/idl_global.h9
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp16
9 files changed, 265 insertions, 54 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref
index 1d9cb60f9c0..821662a1886 100644
--- a/TAO/ChangeLog_ref
+++ b/TAO/ChangeLog_ref
@@ -1,3 +1,19 @@
+Mon Jul 7 17:53:06 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_argument.cpp:
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_decl.cpp:
+ * TAO_IDL/be/be_operation.cpp:
+ * TAO_IDL/be_include/be_codegen.h:
+ * TAO_IDL/be_include/be_decl.h:
+ * TAO_IDL/include/idl_global.h:
+ * TAO_IDL/util/utl_global.cpp:
+
+ Separated the generation of file includes in the stub header file
+ into its own function call, and added a mechanism for generating
+ includes of the ORB argument template classes based on what has
+ been seen in the IDL file's operation declarations.
+
Mon Jul 7 14:39:48 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
* tao/Argument.cpp:
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
index 87735f1bd2c..2944b352d08 100644
--- a/TAO/TAO_IDL/be/be_argument.cpp
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -53,6 +53,7 @@ be_argument::be_argument (AST_Argument::Direction d,
{
be_type *bt = be_type::narrow_from_decl (ft);
bt->seen_in_operation (I_TRUE);
+ this->set_arg_seen_bit (bt);
}
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index c46d02879fb..9aedf3d2e8b 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -186,57 +186,7 @@ TAO_CodeGen::start_client_header (const char *fname)
<< "\"";
}
- // Include the Messaging files if AMI is enabled.
- if (be_global->ami_call_back () == I_TRUE)
- {
- // Include Messaging skeleton file.
- this->gen_standard_include (this->client_header_,
- "tao/Messaging/Messaging.h");
-
- // Turn on generation of files from the Valuetype library.
- ACE_SET_BITS (idl_global->decls_seen_info_,
- idl_global->decls_seen_masks.valuetype_seen_);
- }
-
- idl_global->root ();
-
- if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
- idl_global->decls_seen_masks.abstract_iface_seen_))
- {
- // Include the AbstractBase file from the Valuetype library.
- this->gen_standard_include (this->client_header_,
- "tao/Valuetype/AbstractBase.h");
-
- // Turn on generation of the rest of the Valuetype library files.
- ACE_SET_BITS (idl_global->decls_seen_info_,
- idl_global->decls_seen_masks.valuetype_seen_);
- }
-
- if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
- idl_global->decls_seen_masks.valuetype_seen_))
- {
- // Include files from the Valuetype library.
- this->gen_standard_include (this->client_header_,
- "tao/Valuetype/ValueBase.h");
- this->gen_standard_include (this->client_header_,
- "tao/Valuetype/Value_VarOut_T.h");
- this->gen_standard_include (this->client_header_,
- "tao/Valuetype/Valuetype_Adapter_Impl.h");
-
- // @@@@ (JP) These can be logically separated later
- // with additional checks.
- this->gen_standard_include (this->client_header_,
- "tao/Valuetype/ValueFactory.h");
- this->gen_standard_include (this->client_header_,
- "tao/Valuetype/Sequence_T.h");
- }
-
- // Include the smart proxy base class if smart proxies are enabled.
- if (be_global->gen_smart_proxies () == I_TRUE)
- {
- this->gen_standard_include (this->client_header_,
- "tao/SmartProxies/Smart_Proxies.h");
- }
+ this->gen_orb_file_includes (this->client_header_);
size_t nfiles = idl_global->n_included_idl_files ();
@@ -1404,3 +1354,88 @@ TAO_CodeGen::gen_standard_include (TAO_OutStream *stream,
<< included_file
<< end_delimiter;
}
+
+void
+TAO_CodeGen::gen_orb_file_includes (TAO_OutStream *stream)
+{
+ // Include the Messaging files if AMI is enabled.
+ if (be_global->ami_call_back () == I_TRUE)
+ {
+ // Include Messaging skeleton file.
+ this->gen_standard_include (this->client_header_,
+ "tao/Messaging/Messaging.h");
+
+ // Turn on generation of files from the Valuetype library.
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.valuetype_seen_);
+ }
+
+ // Include the smart proxy base class if smart proxies are enabled.
+ if (be_global->gen_smart_proxies () == I_TRUE)
+ {
+ this->gen_standard_include (this->client_header_,
+ "tao/SmartProxies/Smart_Proxies.h");
+ }
+
+ if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.abstract_iface_seen_))
+ {
+ // Include the AbstractBase file from the Valuetype library.
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/AbstractBase.h");
+
+ // Turn on generation of the rest of the Valuetype library files.
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.valuetype_seen_);
+ }
+
+ if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.valuetype_seen_))
+ {
+ // Include files from the Valuetype library.
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/ValueBase.h");
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/Value_VarOut_T.h");
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/Valuetype_Adapter_Impl.h");
+
+ // @@@@ (JP) These can be logically separated later
+ // with additional checks.
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/ValueFactory.h");
+ this->gen_standard_include (this->client_header_,
+ "tao/Valuetype/Sequence_T.h");
+ }
+
+ this->gen_arg_file_include (idl_global->decls_seen_masks.basic_arg_seen_,
+ "tao/Basic_Arguments.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.bd_string_arg_seen_,
+ "tao/BD_String_Argument_T.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.fixed_array_arg_seen_,
+ "tao/Fixed_Array_Argument_T.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.fixed_size_arg_seen_,
+ "tao/Fixed_Size_Argument_T.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.object_arg_seen_,
+ "tao/Object_Argument_T.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.special_basic_arg_seen_,
+ "tao/Special_Basic_Arguments.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.ub_string_arg_seen_,
+ "tao/UB_String_Arguments.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.var_array_arg_seen_,
+ "tao/Var_Array_Argument_T.h");
+ this->gen_arg_file_include (idl_global->decls_seen_masks.var_size_arg_seen_,
+ "tao/Var_Size_Argument_T.h");
+}
+
+void
+TAO_CodeGen::gen_arg_file_include (ACE_UINT64 mask, const char *filepath)
+{
+ if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
+ mask))
+ {
+ this->gen_standard_include (this->client_header_,
+ filepath);
+ }
+}
+
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index 3ddea533250..831090db995 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -37,7 +37,10 @@
#include "be_factory.h"
#include "be_sequence.h"
#include "be_visitor.h"
+#include "ast_structure_fwd.h"
+#include "ast_string.h"
#include "utl_identifier.h"
+#include "global_extern.h"
#include "ace/Log_Msg.h"
#include "ace/String_Base.h"
@@ -455,6 +458,134 @@ be_decl::accept (be_visitor *visitor)
return visitor->visit_decl (this);
}
+void
+be_decl::set_arg_seen_bit (be_type *bt)
+{
+ if (bt == 0)
+ {
+ return;
+ }
+
+ switch (bt->node_type ())
+ {
+ case NT_typedef:
+ {
+ AST_Typedef *td = AST_Typedef::narrow_from_decl (bt);
+ this->set_arg_seen_bit (
+ be_type::narrow_from_decl (td->primitive_base_type ())
+ );
+ break;
+ }
+ case NT_interface:
+ case NT_interface_fwd:
+ case NT_valuetype:
+ case NT_valuetype_fwd:
+ case NT_component:
+ case NT_component_fwd:
+ case NT_home:
+ case NT_eventtype:
+ case NT_eventtype_fwd:
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.object_arg_seen_);
+ break;
+ case NT_union:
+ case NT_struct:
+ if (bt->size_type () == AST_Type::FIXED)
+ {
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.fixed_size_arg_seen_);
+ }
+ else
+ {
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.var_size_arg_seen_);
+ }
+
+ break;
+ case NT_struct_fwd:
+ case NT_union_fwd:
+ {
+ AST_StructureFwd *fwd = AST_StructureFwd::narrow_from_decl (bt);
+ be_type *fd = be_type::narrow_from_decl (fwd->full_definition ());
+ this->set_arg_seen_bit (fd);
+ break;
+ }
+ case NT_enum:
+ case NT_enum_val:
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.basic_arg_seen_);
+ break;
+ case NT_string:
+ case NT_wstring:
+ {
+ AST_String *str = AST_String::narrow_from_decl (bt);
+
+ if (str->max_size ()->ev ()->u.ulval == 0)
+ {
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.ub_string_arg_seen_);
+ }
+ else
+ {
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.bd_string_arg_seen_);
+ }
+
+ break;
+ }
+ case NT_array:
+ if (bt->size_type () == AST_Type::FIXED)
+ {
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.fixed_array_arg_seen_);
+ }
+ else
+ {
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.var_array_arg_seen_);
+ }
+
+ break;
+ case NT_sequence:
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.var_size_arg_seen_);
+ break;
+ case NT_pre_defined:
+ {
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (bt);
+
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_object:
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_value:
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.object_arg_seen_);
+ break;
+ case AST_PredefinedType::PT_any:
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.var_size_arg_seen_);
+ break;
+ case AST_PredefinedType::PT_char:
+ case AST_PredefinedType::PT_wchar:
+ case AST_PredefinedType::PT_octet:
+ case AST_PredefinedType::PT_boolean:
+ ACE_SET_BITS (
+ idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.special_basic_arg_seen_
+ );
+ break;
+ default:
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.basic_arg_seen_);
+ break;
+ }
+ }
+ default:
+ break;
+ }
+}
+
// Narrowing methods.
IMPL_NARROW_METHODS1 (be_decl, AST_Decl)
IMPL_NARROW_FROM_DECL (be_decl)
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index 798eeaa1395..32264dce193 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -65,6 +65,7 @@ be_operation::be_operation (AST_Type *rt,
be_type *bt = be_type::narrow_from_decl (rt);
bt->seen_in_operation (I_TRUE);
+ this->set_arg_seen_bit (bt);
}
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index cd8abfe2831..6b91422c07e 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -400,6 +400,9 @@ private:
void gen_standard_include (TAO_OutStream *stream,
const char *included_file);
+ void gen_orb_file_includes (TAO_OutStream *stream);
+ void gen_arg_file_include (ACE_UINT64, const char *);
+
private:
TAO_OutStream *client_header_;
// Client header stream.
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index 9cf08d22907..4d766ea2e39 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -26,6 +26,7 @@
class be_scope;
class be_visitor;
+class be_type;
class be_decl : public virtual AST_Decl
{
@@ -108,6 +109,10 @@ public:
DEF_NARROW_METHODS1 (be_decl, AST_Decl);
DEF_NARROW_FROM_DECL (be_decl);
+protected:
+ // Called by be_operation (for the return type) and be_argument.
+ void set_arg_seen_bit (be_type *);
+
private:
// Variables that indicate if the code generation for that node is already
// been done. This way we avoid regenerating same code.
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index ac486cab596..948901cabbc 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -274,6 +274,15 @@ public:
ACE_UINT64 valuetype_seen_;
ACE_UINT64 abstract_iface_seen_;
ACE_UINT64 iface_seq_seen_;
+ ACE_UINT64 basic_arg_seen_;
+ ACE_UINT64 bd_string_arg_seen_;
+ ACE_UINT64 fixed_array_arg_seen_;
+ ACE_UINT64 fixed_size_arg_seen_;
+ ACE_UINT64 object_arg_seen_;
+ ACE_UINT64 special_basic_arg_seen_;
+ ACE_UINT64 ub_string_arg_seen_;
+ ACE_UINT64 var_array_arg_seen_;
+ ACE_UINT64 var_size_arg_seen_;
} decls_seen_masks;
// Constructor
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index b0e1204ae3d..6dc60397909 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -194,9 +194,19 @@ IDL_GlobalData::IDL_GlobalData (void)
const ACE_UINT64 cursor = 1U;
- ACE_SET_BITS (this->decls_seen_masks.valuetype_seen_, cursor);
- ACE_SET_BITS (this->decls_seen_masks.abstract_iface_seen_, cursor << 1);
- ACE_SET_BITS (this->decls_seen_masks.iface_seq_seen_, cursor << 2);
+ ACE_SET_BITS (this->decls_seen_masks.valuetype_seen_, cursor);
+ ACE_SET_BITS (this->decls_seen_masks.abstract_iface_seen_, cursor << 1);
+ ACE_SET_BITS (this->decls_seen_masks.iface_seq_seen_, cursor << 2);
+
+ ACE_SET_BITS (this->decls_seen_masks.basic_arg_seen_, cursor << 32);
+ ACE_SET_BITS (this->decls_seen_masks.bd_string_arg_seen_, cursor << 33);
+ ACE_SET_BITS (this->decls_seen_masks.fixed_array_arg_seen_, cursor << 34);
+ ACE_SET_BITS (this->decls_seen_masks.fixed_size_arg_seen_, cursor << 35);
+ ACE_SET_BITS (this->decls_seen_masks.object_arg_seen_, cursor << 36);
+ ACE_SET_BITS (this->decls_seen_masks.special_basic_arg_seen_, cursor << 37);
+ ACE_SET_BITS (this->decls_seen_masks.ub_string_arg_seen_, cursor << 38);
+ ACE_SET_BITS (this->decls_seen_masks.var_array_arg_seen_, cursor << 39);
+ ACE_SET_BITS (this->decls_seen_masks.var_size_arg_seen_, cursor << 40);
}
IDL_GlobalData::~IDL_GlobalData (void)