summaryrefslogtreecommitdiff
path: root/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO_IDL/be/be_visitor_ccm_pre_proc.cpp')
-rw-r--r--TAO_IDL/be/be_visitor_ccm_pre_proc.cpp244
1 files changed, 134 insertions, 110 deletions
diff --git a/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
index 1dfac8b8822..a61db51ab69 100644
--- a/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
+++ b/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -68,7 +68,7 @@ const int N_LW_EXCEPS =
sizeof (LW_EXCEP_NAMES) / sizeof (char *);
const int N_ADDL_EXCEPS =
sizeof (ADDL_EXCEP_NAMES) / sizeof (char *);
-
+
be_exception *LW_EXCEPS[N_LW_EXCEPS];
be_exception *ADDL_EXCEPS[N_ADDL_EXCEPS];
@@ -106,7 +106,7 @@ be_visitor_ccm_pre_proc::visit_root (be_root *node)
/// No need to check for the -GM option here - what's
/// generated by this call depends only on the contents
/// of the ciao_ami_recep_names_ queue.
- int status = this->generate_ami4ccm_uses ();
+ int const status = this->generate_ami4ccm_uses ();
if (status == -1)
{
@@ -173,7 +173,7 @@ be_visitor_ccm_pre_proc::visit_component (be_component *node)
ACE_TEXT ("lookups failed\n")),
-1);
}
-
+
this->ccm_lookups_done_ = true;
}
@@ -321,64 +321,70 @@ be_visitor_ccm_pre_proc::visit_uses (be_uses *node)
int
be_visitor_ccm_pre_proc::visit_publishes (be_publishes *node)
{
- if (this->gen_subscribe (node) == -1)
+ if (!be_global->gen_noeventccm ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_ccm_pre_proc::")
- ACE_TEXT ("visit_publishes - ")
- ACE_TEXT ("gen_subscribe failed\n")),
- -1);
- }
+ if (this->gen_subscribe (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_publishes - ")
+ ACE_TEXT ("gen_subscribe failed\n")),
+ -1);
+ }
- if (this->gen_unsubscribe (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_ccm_pre_proc::")
- ACE_TEXT ("visit_publishes - ")
- ACE_TEXT ("gen_unsubscribe failed\n")),
- -1);
+ if (this->gen_unsubscribe (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_publishes - ")
+ ACE_TEXT ("gen_unsubscribe failed\n")),
+ -1);
+ }
}
-
return 0;
}
int
be_visitor_ccm_pre_proc::visit_emits (be_emits *node)
{
- if (this->gen_emits_connect (node) == -1)
+ if (!be_global->gen_noeventccm ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_ccm_pre_proc::")
- ACE_TEXT ("visit_emits - ")
- ACE_TEXT ("gen_emits_connect failed\n")),
- -1);
- }
+ if (this->gen_emits_connect (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_emits - ")
+ ACE_TEXT ("gen_emits_connect failed\n")),
+ -1);
+ }
- if (this->gen_emits_disconnect (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_ccm_pre_proc::")
- ACE_TEXT ("visit_emits - ")
- ACE_TEXT ("gen_emits_disconnect failed\n")),
- -1);
+ if (this->gen_emits_disconnect (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_emits - ")
+ ACE_TEXT ("gen_emits_disconnect failed\n")),
+ -1);
+ }
}
-
return 0;
}
int
be_visitor_ccm_pre_proc::visit_consumes (be_consumes *node)
{
- if (this->gen_get_consumer (node) == -1)
+ if (!be_global->gen_noeventccm ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_ccm_pre_proc::")
- ACE_TEXT ("visit_comsumes - ")
- ACE_TEXT ("gen_get_consumer failed\n")),
- -1);
- }
-
- return 0;
+ if (this->gen_get_consumer (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_comsumes - ")
+ ACE_TEXT ("gen_get_consumer failed\n")),
+ -1);
+ }
+ }
+ return 0;
}
int
@@ -431,21 +437,24 @@ be_visitor_ccm_pre_proc::visit_home (be_home *node)
int
be_visitor_ccm_pre_proc::visit_eventtype (be_eventtype *node)
{
- if (node->ccm_pre_proc_gen ())
+ if (!be_global->gen_noeventccm ())
{
- return 0;
- }
+ if (node->ccm_pre_proc_gen ())
+ {
+ return 0;
+ }
- if (this->create_event_consumer (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_ccm_pre_proc::")
- ACE_TEXT ("visit_eventtype - code generation ")
- ACE_TEXT ("for consumer failed\n")),
- -1);
- }
+ if (this->create_event_consumer (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_eventtype - code generation ")
+ ACE_TEXT ("for consumer failed\n")),
+ -1);
+ }
- node->ccm_pre_proc_gen (true);
+ node->ccm_pre_proc_gen (true);
+ }
return 0;
}
@@ -803,50 +812,52 @@ int
be_visitor_ccm_pre_proc::gen_push_op (be_eventtype *node,
AST_Interface *consumer)
{
- UTL_ScopedName *op_full_name =
- this->create_scoped_name ("push_",
- node->local_name (),
- 0,
- consumer);
- be_operation *push_op = 0;
- ACE_NEW_RETURN (push_op,
- be_operation (be_global->void_type (),
- AST_Operation::OP_noflags,
- 0,
- false,
- false),
- -1);
- push_op->set_defined_in (consumer);
- push_op->set_imported (node->imported ());
- push_op->set_name (op_full_name);
- ACE_CString arg_string ("the_",
- 0,
- false);
- arg_string += node->local_name ();
- Identifier arg_id (arg_string.fast_rep ());
- UTL_ScopedName arg_name (&arg_id,
- 0);
- be_argument *arg = 0;
- ACE_NEW_RETURN (arg,
- be_argument (AST_Argument::dir_IN,
- node,
- &arg_name),
- -1);
- arg_id.destroy ();
- push_op->be_add_argument (arg);
-
- if (0 == consumer->be_add_operation (push_op))
+ if (!be_global->gen_noeventccm ())
{
- return -1;
- }
+ UTL_ScopedName *op_full_name =
+ this->create_scoped_name ("push_",
+ node->local_name (),
+ 0,
+ consumer);
+ be_operation *push_op = 0;
+ ACE_NEW_RETURN (push_op,
+ be_operation (be_global->void_type (),
+ AST_Operation::OP_noflags,
+ 0,
+ false,
+ false),
+ -1);
+ push_op->set_defined_in (consumer);
+ push_op->set_imported (node->imported ());
+ push_op->set_name (op_full_name);
+ ACE_CString arg_string ("the_",
+ 0,
+ false);
+ arg_string += node->local_name ();
+ Identifier arg_id (arg_string.fast_rep ());
+ UTL_ScopedName arg_name (&arg_id,
+ 0);
+ be_argument *arg = 0;
+ ACE_NEW_RETURN (arg,
+ be_argument (AST_Argument::dir_IN,
+ node,
+ &arg_name),
+ -1);
+ arg_id.destroy ();
+ push_op->be_add_argument (arg);
+ if (0 == consumer->be_add_operation (push_op))
+ {
+ return -1;
+ }
+ }
return 0;
}
int
be_visitor_ccm_pre_proc::gen_subscribe (be_publishes *node)
{
- if (be_global->gen_lwccm ())
+ if ((be_global->gen_lwccm ()) ||(be_global->gen_noeventccm ()))
{
return 0;
}
@@ -907,7 +918,7 @@ be_visitor_ccm_pre_proc::gen_subscribe (be_publishes *node)
int
be_visitor_ccm_pre_proc::gen_unsubscribe (be_publishes *node)
{
- if (be_global->gen_lwccm ())
+ if (be_global->gen_lwccm () ||be_global->gen_noeventccm ())
{
return 0;
}
@@ -967,7 +978,7 @@ be_visitor_ccm_pre_proc::gen_unsubscribe (be_publishes *node)
int
be_visitor_ccm_pre_proc::gen_emits_connect (be_emits *node)
{
- if (be_global->gen_lwccm ())
+ if ((be_global->gen_lwccm ()) ||(be_global->gen_noeventccm ()))
{
return 0;
}
@@ -1027,7 +1038,7 @@ be_visitor_ccm_pre_proc::gen_emits_connect (be_emits *node)
int
be_visitor_ccm_pre_proc::gen_emits_disconnect (be_emits *node)
{
- if (be_global->gen_lwccm ())
+ if ((be_global->gen_lwccm ()) ||(be_global->gen_noeventccm ()))
{
return 0;
}
@@ -1077,7 +1088,7 @@ be_visitor_ccm_pre_proc::gen_emits_disconnect (be_emits *node)
int
be_visitor_ccm_pre_proc::gen_get_consumer (be_consumes *node)
{
- if (be_global->gen_lwccm ())
+ if (be_global->gen_lwccm () || be_global->gen_noeventccm ())
{
return 0;
}
@@ -1155,7 +1166,7 @@ be_visitor_ccm_pre_proc::gen_create (be_home *node,
-1);
arg_id.destroy ();
op->be_add_argument (arg);
-
+
UTL_ExceptList *tail = 0;
ACE_NEW_RETURN (tail,
UTL_ExceptList (this->invalid_key_,
@@ -1210,10 +1221,10 @@ be_visitor_ccm_pre_proc::gen_find_by_primary_key (be_home *node,
-1);
arg_id.destroy ();
op->be_add_argument (arg);
-
+
UTL_ExceptList *tail = 0;
UTL_ExceptList *middle = 0;
-
+
if (!be_global->gen_lwccm ())
{
ACE_NEW_RETURN (tail,
@@ -1225,7 +1236,7 @@ be_visitor_ccm_pre_proc::gen_find_by_primary_key (be_home *node,
tail),
-1);
}
-
+
UTL_ExceptList *exceps = 0;
ACE_NEW_RETURN (exceps,
UTL_ExceptList (this->finder_failure_,
@@ -1272,10 +1283,10 @@ be_visitor_ccm_pre_proc::gen_remove (be_home *node,
-1);
arg_id.destroy ();
op->be_add_argument (arg);
-
+
UTL_ExceptList *tail = 0;
UTL_ExceptList *middle = 0;
-
+
if (!be_global->gen_lwccm ())
{
ACE_NEW_RETURN (tail,
@@ -1287,7 +1298,7 @@ be_visitor_ccm_pre_proc::gen_remove (be_home *node,
tail),
-1);
}
-
+
UTL_ExceptList *exceps = 0;
ACE_NEW_RETURN (exceps,
UTL_ExceptList (this->remove_failure_,
@@ -1415,7 +1426,7 @@ be_visitor_ccm_pre_proc::lookup_exceptions (void)
this->create_failure_ = LW_EXCEPS[4];
this->remove_failure_ = LW_EXCEPS[5];
this->finder_failure_ = LW_EXCEPS[6];
-
+
if (!be_global->gen_lwccm ())
{
for (int j = 0; j < N_ADDL_EXCEPS; ++j)
@@ -1433,7 +1444,7 @@ be_visitor_ccm_pre_proc::lookup_exceptions (void)
this->unknown_key_value_ = ADDL_EXCEPS[1];
this->duplicate_key_value_ = ADDL_EXCEPS[2];
}
-
+
return 0;
}
@@ -1470,6 +1481,7 @@ be_visitor_ccm_pre_proc::lookup_one_exception (const char *name,
int
be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node)
{
+
UTL_Scope *s = node->defined_in ();
UTL_ScopedName *consumer_name =
@@ -1648,6 +1660,9 @@ be_visitor_ccm_pre_proc::create_implicit (be_home *node)
header.destroy ();
parent_list.destroy ();
+ // So we can generate the proper typecode.
+ i->home_equiv (true);
+
i->set_name (implicit_name);
i->set_defined_in (node->defined_in ());
i->set_imported (node->imported ());
@@ -1700,7 +1715,7 @@ be_visitor_ccm_pre_proc::create_equivalent (be_home *node,
// Back to reality.
idl_global->scopes ().pop ();
- // So we can skip typecode generation.
+ // So we can generate the proper typecode.
retval->home_equiv (true);
retval->set_name (equiv_name);
@@ -1718,7 +1733,7 @@ be_visitor_ccm_pre_proc::create_equivalent (be_home *node,
ScopeAsDecl (s));
node->set_name (mangled_name);
AST_Module *m = AST_Module::narrow_from_scope (s);
-
+
/// Calling be_add_interface() here calls add_to_referenced(),
/// which will give a redef error.
m->add_to_scope (retval);
@@ -1850,9 +1865,18 @@ be_visitor_ccm_pre_proc::generate_ami4ccm_uses (void)
if (d == 0)
{
idl_global->err ()->lookup_error (sn);
+
+ sn->destroy ();
+ delete sn;
+ sn = 0;
+
continue;
}
+ sn->destroy ();
+ delete sn;
+ sn = 0;
+
be_uses *u = be_uses::narrow_from_decl (d);
if (u == 0)
@@ -1867,7 +1891,7 @@ be_visitor_ccm_pre_proc::generate_ami4ccm_uses (void)
be_interface *iface =
be_interface::narrow_from_decl (u->uses_type ());
-
+
/// The real AMI_xxx exists only in the *A.idl file, so
/// we create a dummy as the uses type for the implied
/// receptacle created below, but only if it hasn't
@@ -1879,7 +1903,7 @@ be_visitor_ccm_pre_proc::generate_ami4ccm_uses (void)
if (ami_iface == 0)
{
ACE_CString iname ("AMI4CCM_");
-
+
iname += iface->local_name ();
Identifier itmp_id (iname.c_str ());
UTL_ScopedName itmp_sn (&itmp_id, 0);
@@ -1901,11 +1925,11 @@ be_visitor_ccm_pre_proc::generate_ami4ccm_uses (void)
/// Make it imported so it doesn't trigger
/// any unwanted code generation.
ami_iface->set_imported (true);
-
+
s->add_to_scope (ami_iface);
iface->ami4ccm_uses (ami_iface);
}
-
+
/// Now create the receptacle, passing in
/// the local interface created above as the
/// uses type. We don't generate anything
@@ -1928,7 +1952,7 @@ be_visitor_ccm_pre_proc::generate_ami4ccm_uses (void)
s->add_to_scope (ami_uses);
idl_global->scopes ().pop ();
-
+
if (u->is_multiple ())
{
/*