summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-09-13 19:46:52 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-09-13 19:46:52 +0000
commit0312d3bb9f9dd231d3582dff9939031a34930ed1 (patch)
tree16f8fc52902bf91b486ac9f75a466f28664cd98e
parent5fe9534fe8893fa4d0ce4dfd38857df57a04ae6f (diff)
downloadATCD-0312d3bb9f9dd231d3582dff9939031a34930ed1.tar.gz
ChangeLogTag: Wed Sep 13 14:31:39 2000 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp140
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp102
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp43
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp5
6 files changed, 221 insertions, 86 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp
index 2ccb5186348..c71ba207acd 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp
@@ -55,8 +55,6 @@ int be_visitor_args_request_info_arglist::visit_argument (be_argument *node)
-1);
}
- *os << be_nl;
-
// Different types have different mappings when used as in/out or
// inout parameters. Let this visitor deal with the type
@@ -90,73 +88,155 @@ int be_visitor_args_request_info_arglist::visit_array (be_array *node)
{
case AST_Argument::dir_IN:
{
- be_decl* scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+ be_decl* scope =
+ be_scope::narrow_from_scope (bt->defined_in ())->decl ();
- if (bt->is_nested () && (scope->node_type () == AST_Decl::NT_interface
- || scope->node_type () == AST_Decl::NT_union ))
+ if (bt->is_nested ()
+ && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
{
*os << "const ACE_NESTED_CLASS (";
- *os << scope->name () << ",";
- *os << bt->local_name ();
- *os << ")";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << ")";
}
else
- *os << "const " << this->type_name (node);
+ {
+ *os << "const " << this->type_name (node);
+ }
+
break;
}
case AST_Argument::dir_INOUT:
{
- be_decl* scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+ be_decl* scope =
+ be_scope::narrow_from_scope (bt->defined_in ())->decl ();
- if (bt->is_nested () && (scope->node_type () == AST_Decl::NT_interface
- || scope->node_type () == AST_Decl::NT_union ))
+ if (bt->is_nested ()
+ && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
{
*os << "ACE_NESTED_CLASS (";
- *os << scope->name () << ",";
- *os << bt->local_name ();
- *os << ")";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << ")";
}
else
- *os << this->type_name (node);
+ {
+ *os << this->type_name (node);
+ }
+
break;
}
case AST_Argument::dir_OUT:
{
- be_decl* scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+ be_decl* scope =
+ be_scope::narrow_from_scope (bt->defined_in ())->decl ();
- if (bt->is_nested () && (scope->node_type () == AST_Decl::NT_interface
- || scope->node_type () == AST_Decl::NT_union ))
+ if (bt->is_nested ()
+ && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
{
*os << "ACE_NESTED_CLASS (";
- *os << scope->name () << ",";
- *os << bt->local_name ();
- *os << "_out)";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << "_out)";
}
else
- *os << this->type_name (node, "_out");
+ {
+ *os << this->type_name (node, "_out");
+ }
+
break;
}
-
}
+
return 0;
}
int be_visitor_args_request_info_arglist::visit_enum (be_enum *node)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ be_type *bt; // type to use
+
+ // use the typedefed name if that is the one used in the IDL defn
+ if (this->ctx_->alias ())
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ // ACE_NESTED_CLASS macros needed for MSVC.
+
+ be_decl *scope =
+ be_decl::narrow_from_decl (ScopeAsDecl (node->defined_in ()));
switch (this->direction ())
{
case AST_Argument::dir_IN:
- *os << this->type_name (node);
- break;
+ {
+ be_decl* scope =
+ be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+
+ if (bt->is_nested ()
+ && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
+ {
+ *os << "const ACE_NESTED_CLASS (";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << ")";
+ }
+ else
+ {
+ *os << "const " << this->type_name (node);
+ }
+
+ break;
+ }
case AST_Argument::dir_INOUT:
- *os << this->type_name (node) << " &";
- break;
+ {
+ be_decl* scope =
+ be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+
+ if (bt->is_nested ()
+ && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
+ {
+ *os << "ACE_NESTED_CLASS (";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << ") &";
+ }
+ else
+ {
+ *os << this->type_name (node) << " &";
+ }
+ break;
+
+ }
case AST_Argument::dir_OUT:
- *os << this->type_name (node, "_out");
- break;
+ {
+ be_decl* scope =
+ be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+
+ if (bt->is_nested ()
+ && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
+ {
+ *os << "ACE_NESTED_CLASS (";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << "_out)";
+ }
+ else
+ {
+ *os << this->type_name (node, "_out");
+ }
+
+ break;
+ }
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp
index 25aa94d36f4..03583f3596b 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp
@@ -68,7 +68,7 @@ int be_visitor_args_request_info_ch::visit_argument (be_argument *node)
}
// As we visit each type we print out the &.
- *os << " " << node->local_name () << "_;\n";
+ *os << " " << node->local_name () << "_;" << be_nl;
return 0;
}
@@ -101,8 +101,11 @@ int be_visitor_args_request_info_ch::visit_array (be_array *node)
*os << "_slice) *";
}
else
- *os << "const " << this->type_name (node) << "_slice *";
- break;
+ {
+ *os << "const " << this->type_name (node) << "_slice *";
+ }
+
+ break;
}
case AST_Argument::dir_INOUT:
{
@@ -112,12 +115,15 @@ int be_visitor_args_request_info_ch::visit_array (be_array *node)
|| scope->node_type () == AST_Decl::NT_union ))
{
*os << "ACE_NESTED_CLASS (";
- *os << scope->name () << ",";
- *os << bt->local_name ();
- *os << "_slice) *";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << "_slice) *";
}
else
- *os << this->type_name (node) << "_slice *";
+ {
+ *os << this->type_name (node) << "_slice *";
+ }
+
break;
}
case AST_Argument::dir_OUT:
@@ -128,12 +134,15 @@ int be_visitor_args_request_info_ch::visit_array (be_array *node)
|| scope->node_type () == AST_Decl::NT_union ))
{
*os << "ACE_NESTED_CLASS (";
- *os << scope->name () << ",";
- *os << bt->local_name ();
- *os << "_out) ";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << "_out) ";
}
else
- *os << this->type_name (node, "_out");
+ {
+ *os << this->type_name (node, "_out");
+ }
+
break;
}
@@ -145,19 +154,78 @@ int be_visitor_args_request_info_ch::visit_array (be_array *node)
int be_visitor_args_request_info_ch::visit_enum (be_enum *node)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ be_type *bt; // type to use
+ // use the typedefed name if that is the one used in the IDL defn
+ if (this->ctx_->alias ())
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ // ACE_NESTED_CLASS macros needed for MSVC. Note we are particluarly checking
+ // for those types which get generated as a class in C++.
switch (this->direction ())
{
case AST_Argument::dir_IN:
- *os << this->type_name (node)<< " &";
- break;
+ {
+ be_decl* scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+
+ if (bt->is_nested () && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
+ {
+ *os << "const ACE_NESTED_CLASS (";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << ") &";
+ }
+ else
+ {
+ *os << "const " << this->type_name (node) << " &";
+ }
+
+ break;
+ }
case AST_Argument::dir_INOUT:
- *os << this->type_name (node) << " &";
- break;
+ {
+ be_decl* scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+
+ if (bt->is_nested () && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
+ {
+ *os << "ACE_NESTED_CLASS (";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << ") &";
+ }
+ else
+ {
+ *os << this->type_name (node) << " &";
+ }
+
+ break;
+ }
case AST_Argument::dir_OUT:
- *os << this->type_name (node, "_out");
- break;
+ {
+ be_decl* scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+
+ if (bt->is_nested () && (scope->node_type () == AST_Decl::NT_interface
+ || scope->node_type () == AST_Decl::NT_union ))
+ {
+ *os << "ACE_NESTED_CLASS (";
+ *os << scope->name () << ",";
+ *os << bt->local_name ();
+ *os << "_out)";
+ }
+ else
+ {
+ *os << this->type_name (node, "_out");
+ }
+
+ break;
+ }
+
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp
index 021df8ee051..76f1659c139 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp
@@ -41,10 +41,12 @@ be_visitor_args_request_info_cs::~be_visitor_args_request_info_cs (void)
int be_visitor_args_request_info_cs::visit_argument (be_argument *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- this->ctx_->node (node); // save the argument node
- // retrieve the type
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ // Retrieve the type.
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -53,15 +55,14 @@ int be_visitor_args_request_info_cs::visit_argument (be_argument *node)
"Bad argument type\n"),
-1);
}
-
- os->indent ();
+
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS:
{
// Generate the memberlist definition for the constructor.
- *os << node->local_name () << "_ " << "("<< node->local_name ()
- <<")";
+ *os << " " << node->local_name () << "_ " << "(" << node->local_name ()
+ << ")";
break;
}
case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS:
@@ -79,5 +80,6 @@ int be_visitor_args_request_info_cs::visit_argument (be_argument *node)
-1);
}
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp
index c47dbe792c2..b5cc2b9adc7 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp
@@ -49,41 +49,26 @@ int be_visitor_interface_interceptors_cs::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
- // generate code for the interface definition by traversing thru the
+ // Generate code for the interface definition by traversing thru the
// elements of its scope. We depend on the front-end to have made sure
// that only legal syntactic elements appear in our scope.
os->indent ();
*os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
- // generate code for the interface definition by traversing thru the
- // elements of its scope. We depend on the front-end to have made sure
- // that only legal syntactic elements appear in our scope.
-
- os->indent ();
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for scope failed\n"), -1);
- }
- /*
- be_visitor_context ctx (*this->ctx_);
- be_visitor *visitor = 0;
- // Interceptor related classes.
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_cs::"
- "visit_interface - "
- "codegen for interceptor classes failed\n"),
- -1);
- }
- delete visitor;*/
+ // Generate code for the interface definition by traversing thru the
+ // elements of its scope. We depend on the front-end to have made sure
+ // that only legal syntactic elements appear in our scope.
+
+ os->indent ();
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
*os << "#endif /* TAO_HAS_INTERCEPTORS */\n";
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 84cab6ee1b2..fcf4150daf1 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
@@ -347,7 +347,6 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node)
// void since we can't have a private member to be of void type.
if (!this->void_return_type (bt))
{
- os->indent ();
*os << "void result (";
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_RETTYPE_CH);
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 81e73ce5f17..189c4febb2d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
@@ -133,7 +133,8 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
}
}
- *os << " (const char *_tao_operation," << be_nl
+ *os << " (" << be_idt << be_idt_nl
+ << "const char *_tao_operation," << be_nl
<< "IOP::ServiceContextList &_tao_service_context_list," << be_nl
<< "CORBA::Object *_tao_target";
@@ -156,7 +157,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
delete visitor;
os->indent ();
- *os << ")" << be_nl;
+ *os << be_uidt_nl << ")" << be_uidt_nl;
// Generate the member list and set each member but before that,
// its necessary to pass on some args to the base class.