summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-21 21:44:36 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-21 21:44:36 +0000
commit3964ff41bd794cc44dac9637b59407fac50e127a (patch)
tree94e48df8129e2613f3c0ff824b6127822ec6d3b1 /TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
parentb3cb49903ed3694b69b9e70fb7bd91bf6e5ed26b (diff)
downloadATCD-3964ff41bd794cc44dac9637b59407fac50e127a.tar.gz
ChangeLogTag: Mon Aug 21 16:40:21 2000 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
index 609721db9e0..9fd0bbb37ac 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
@@ -41,19 +41,22 @@ be_visitor_enum_ch::~be_visitor_enum_ch (void)
{
}
-// visit the Enum_Ch node and its scope
+// Visit the enum_ch node and its scope.
int
be_visitor_enum_ch::visit_enum (be_enum *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- this->ctx_->comma (1); // comma to be generated by the scope visitor
+
+ // Comma to be generated by the scope visitor.
+ this->ctx_->comma (1);
if (!node->cli_hdr_gen () && !node->imported ())
{
- os->indent (); // start from whatever indentation level we were at
+ // Start from whatever indentation level we were at.
+ os->indent ();
*os << "enum " << node->local_name () << be_nl;
- *os << "{\n";
- os->incr_indent ();
+ *os << "{" << be_idt_nl;
+
if (this->visit_scope (node) == 1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -64,45 +67,49 @@ be_visitor_enum_ch::visit_enum (be_enum *node)
}
os->indent ();
- // The following ensures that the underlying enum type
- // is 32 bits
- *os << node->local_name ()
- << "_TAO_ENUM_32BIT_ENFORCER = 0x7FFFFFFF\n";
- os->decr_indent ();
+ *os << be_uidt_nl;
*os << "};" << be_nl;
+
// As per the ORBOS spec, we need the following typedef
*os << "typedef " << node->local_name () << " &" << node->local_name ()
<< "_out;\n";
if (!node->is_local ())
{
- // by using a visitor to declare and define the TypeCode, we have the
- // added advantage to conditionally not generate any code. This will be
- // based on the command line options. This is still TO-DO
- be_visitor *visitor;
+ // By using a visitor to declare and define the TypeCode, we have
+ // the added advantage to conditionally not generate any code. This
+ // will be based on the command line options. This is still TO-DO.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
if (!visitor || (node->accept (visitor) == -1))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_enum_ch::"
"visit_enum - "
"TypeCode declaration failed\n"
- ), -1);
+ ),
+ -1);
}
}
+
node->cli_hdr_gen (I_TRUE);
}
+
return 0;
}
int
-be_visitor_enum_ch::post_process (be_decl *)
+be_visitor_enum_ch::post_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();
- *os << "," << be_nl;
+ // Am I the last one?
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
return 0;
}