summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/util
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/util')
-rw-r--r--TAO/TAO_IDL/util/utl_err.cpp36
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp103
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp109
3 files changed, 197 insertions, 51 deletions
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp
index 51b2afc7e7c..98a9f56c6ff 100644
--- a/TAO/TAO_IDL/util/utl_err.cpp
+++ b/TAO/TAO_IDL/util/utl_err.cpp
@@ -199,8 +199,6 @@ error_string (UTL_Error::ErrorCode c)
return "module must contain at least one declaration: ";
case UTL_Error::EIDL_BACK_END:
return "back end: ";
- case UTL_Error::EIDL_ILLEGAL_INFIX:
- return "illegal infix operator in expression";
}
return 0;
@@ -945,7 +943,26 @@ UTL_Error::abstract_support_error (UTL_ScopedName *v,
idl_global->set_err_count (idl_global->err_count () + 1);
}
-// Report illegal component or home support of local interface.
+// Report illegal component or home support of abstract interface.
+void
+UTL_Error::concrete_interface_expected (UTL_ScopedName *c,
+ UTL_ScopedName *i)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
+ ACE_ERROR ((LM_ERROR,
+ " component or home "));
+ c->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to support an abstract interface: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report illegal component or home support of abstract interface.
void
UTL_Error::unconstrained_interface_expected (UTL_ScopedName *c,
UTL_ScopedName *i)
@@ -1339,19 +1356,6 @@ UTL_Error::back_end (long lineno,
idl_error_header (EIDL_BACK_END,
lineno,
s);
- ACE_ERROR ((LM_ERROR,
- "\n"));
- idl_global->set_err_count (idl_global->err_count () + 1);
-}
-
-void
-UTL_Error::illegal_infix (void)
-{
- idl_error_header (EIDL_ILLEGAL_INFIX,
- idl_global->lineno (),
- idl_global->filename ());
- ACE_ERROR ((LM_ERROR,
- "\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 008eae5be2c..2059501580e 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -179,11 +179,11 @@ IDL_GlobalData::IDL_GlobalData (void)
gperf_path_ (0),
temp_dir_ (0),
ident_string_ (0),
+ obv_support_ (I_TRUE),
case_diff_error_ (I_TRUE),
nest_orb_ (I_FALSE),
idl_flags_ (""),
- preserve_cpp_keywords_ (I_TRUE),
- pass_orb_idl_ (I_FALSE)
+ preserve_cpp_keywords_ (I_TRUE)
{
// Path for the perfect hash generator(gperf) program.
// Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined.
@@ -191,7 +191,6 @@ IDL_GlobalData::IDL_GlobalData (void)
// in the environment.
// Form the absolute pathname.
char* ace_root = ACE_OS::getenv ("ACE_ROOT");
-
if (ace_root == 0)
// This may not cause any problem if -g option is used to specify
// the correct path for the gperf program. Let us ignore this
@@ -981,6 +980,18 @@ IDL_GlobalData::ident_string (void) const
}
void
+IDL_GlobalData::obv_support (idl_bool val)
+{
+ this->obv_support_ = val;
+}
+
+idl_bool
+IDL_GlobalData::obv_support (void)
+{
+ return this->obv_support_;
+}
+
+void
IDL_GlobalData::case_diff_error (idl_bool val)
{
this->case_diff_error_ = val;
@@ -1308,16 +1319,86 @@ IDL_GlobalData::file_prefixes (void)
return this->file_prefixes_;
}
-idl_bool
-IDL_GlobalData::pass_orb_idl (void) const
-{
- return this->pass_orb_idl_;
-}
-
void
-IDL_GlobalData::pass_orb_idl (idl_bool val)
+IDL_GlobalData::create_uses_multiple_stuff (
+ AST_Component *c,
+ AST_Component::port_description &pd
+ )
{
- this->pass_orb_idl_ = val;
+ ACE_CString struct_name (pd.id->get_string ());
+ struct_name += "Connection";
+ Identifier struct_id (struct_name.c_str ());
+ UTL_ScopedName sn (&struct_id, 0);
+ AST_Structure *connection =
+ idl_global->gen ()->create_structure (&sn, 0, 0);
+ struct_id.destroy ();
+
+ Identifier object_id ("objref");
+ UTL_ScopedName object_name (&object_id,
+ 0);
+ AST_Field *object_field =
+ idl_global->gen ()->create_field (pd.impl,
+ &object_name,
+ AST_Field::vis_NA);
+ (void) DeclAsScope (connection)->fe_add_field (object_field);
+ object_id.destroy ();
+
+ Identifier local_id ("Cookie");
+ UTL_ScopedName local_name (&local_id,
+ 0);
+ Identifier module_id ("Components");
+ UTL_ScopedName scoped_name (&module_id,
+ &local_name);
+ AST_Decl *d = c->lookup_by_name (&scoped_name,
+ I_TRUE);
+ local_id.destroy ();
+ module_id.destroy ();
+
+ if (d == 0)
+ {
+ // This would happen if we haven't included Componennts.idl.
+ idl_global->err ()->lookup_error (&scoped_name);
+ return;
+ }
+
+ AST_ValueType *cookie = AST_ValueType::narrow_from_decl (d);
+
+ Identifier cookie_id ("ck");
+ UTL_ScopedName cookie_name (&cookie_id,
+ 0);
+ AST_Field *cookie_field =
+ idl_global->gen ()->create_field (cookie,
+ &cookie_name,
+ AST_Field::vis_NA);
+ (void) DeclAsScope (connection)->fe_add_field (cookie_field);
+ cookie_id.destroy ();
+
+ (void) c->fe_add_structure (connection);
+
+ ACE_UINT64 bound = 0;
+ AST_Expression *bound_expr =
+ idl_global->gen ()->create_expr (bound,
+ AST_Expression::EV_ulong);
+ AST_Sequence *sequence =
+ idl_global->gen ()->create_sequence (bound_expr,
+ connection,
+ 0,
+ 0,
+ 0);
+
+ ACE_CString seq_string (pd.id->get_string ());
+ seq_string += "Connections";
+ Identifier seq_id (seq_string.c_str ());
+ UTL_ScopedName seq_name (&seq_id,
+ 0);
+ AST_Typedef *connections =
+ idl_global->gen ()->create_typedef (sequence,
+ &seq_name,
+ 0,
+ 0);
+ seq_id.destroy ();
+
+ (void) c->fe_add_typedef (connections);
}
// Return 0 on success, -1 failure. The <errno> corresponding to the
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 083cb626c64..b790d4070c7 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -1576,20 +1576,79 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
return 0;
}
-// Look through inherited list. Overridden in AST_Interface.
+// Look through inherited interfaces.
AST_Decl *
-UTL_Scope::look_in_inherited (UTL_ScopedName *,
- idl_bool )
+UTL_Scope::look_in_inherited (UTL_ScopedName *e,
+ idl_bool treat_as_ref)
{
- return 0;
-}
+ AST_Decl *d = 0;
+ AST_Decl *d_before = 0;
+ AST_Interface *i = AST_Interface::narrow_from_scope (this);
+ AST_Interface **is = 0;
+ long nis = -1;
-// Look through supported interface list. Overridden where necessary.
-AST_Decl *
-UTL_Scope::look_in_supported (UTL_ScopedName *,
- idl_bool)
-{
- return 0;
+ // This scope is not an interface.
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ // Can't look in an interface which was not yet defined.
+ if (!i->is_defined ())
+ {
+ idl_global->err ()->fwd_decl_lookup (i,
+ e);
+ return 0;
+ }
+
+ // OK, loop through inherited interfaces.
+
+ // (Don't leave the inheritance hierarchy, no module or global ...)
+ // Find all and report ambiguous results as error.
+
+ for (nis = i->n_inherits (), is = i->inherits (); nis > 0; nis--, is++)
+ {
+ d = (*is)->lookup_by_name (e,
+ treat_as_ref,
+ 0 /* not in parent */);
+ if (d != 0)
+ {
+ if (d_before == 0)
+ {
+ // First result found.
+ d_before = d;
+ }
+ else
+ {
+ // Conflict against further results?
+ if (d != d_before)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "warning in %s line %d: ",
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+
+ e->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ " is ambiguous in scope.\n"
+ "Found "));
+
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ " and "));
+
+ d_before->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+
+ ACE_ERROR ((LM_ERROR,
+ ".\n"));
+ }
+ }
+ }
+ }
+
+ return d_before;
}
// Look up a String * in local scope only.
@@ -1620,11 +1679,7 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
idl_bool in_corba =
ACE_OS::strcmp (e->get_string (), "CORBA") == 0;
- // Iterate over this scope. We need IK_both here for the legacy
- // case where a recursive type is defined via an anonymous sequence.
- // Looking up the anonymous sequence parameter succeeds only if
- // references are included, since the decl for the (unfinished)
- // enclosing type has not yet been added to the scope decls.
+ // Iterate over this scope.
for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_both);
!i.is_done ();
i.next ())
@@ -1770,13 +1825,17 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
if (d == 0)
{
- // A no-op unless d can inherit.
- d = look_in_inherited (e, treat_as_ref);
-
- if (d == 0)
+
+ // Special case for scope which is an interface or value type.
+ // We have to look in the inherited interfaces as well.
+ // Look before parent scopes.
+ if (pd_scope_node_type == AST_Decl::NT_interface
+ || pd_scope_node_type == AST_Decl::NT_valuetype
+ || pd_scope_node_type == AST_Decl::NT_component
+ || pd_scope_node_type == AST_Decl::NT_eventtype)
{
- // A no-op unless d can support interfaces.
- d = look_in_supported (e, treat_as_ref);
+ d = look_in_inherited (e,
+ treat_as_ref);
}
if ((d == 0) && in_parent && idl_global->err_count () == 0)
@@ -1847,6 +1906,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
}
// For the possible call to look_in_inherited() below.
+ AST_Decl::NodeType nt = d->node_type ();
t = DeclAsScope (d);
// OK, start of name is defined. Now loop doing local lookups
@@ -1865,9 +1925,10 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// up was inherited into that interface. The first call to
// look_in_inherited() is this function only checks base classes
// of the scope (interface) we started the lookup from.
- if (d == 0)
+ if (d == 0 && nt == AST_Decl::NT_interface)
{
- d = t->look_in_inherited (sn, treat_as_ref);
+ d = t->look_in_inherited (sn,
+ treat_as_ref);
}
// If treat_as_ref is true and d is not 0, add d to