예제 #1
0
파일: root_ch.cpp 프로젝트: asdlei00/ACE
void
be_visitor_root_ch::gen_static_corba_overrides (void)
{
  size_t size = idl_global->mixed_parentage_interfaces ().size ();

  if (size == 0)
    {
      return;
    }

  size_t index = 0;
  AST_Interface *i = 0;

  *o_ << be_nl_2
      << "// TAO_IDL - Generated from" << be_nl
      << "// " << __FILE__ << ":" << __LINE__
      << be_nl;

  *o_ << be_global->core_versioning_begin ();

  *o_ << be_nl
      << "// Overrides of CORBA::release and CORBA::is_nil for"
      << be_nl
      << "// interfaces that inherit from both CORBA::Object" << be_nl
      << "// and CORBA::AbstractBase." << be_nl_2
      << "namespace CORBA" << be_nl
      << "{" << be_idt;

  for (index = 0; index < size; ++index)
    {
      idl_global->mixed_parentage_interfaces ().dequeue_head (i);

      *o_ << be_nl
          << "TAO_NAMESPACE_STORAGE_CLASS void release ("
          << i->name () << "_ptr);" << be_nl
          << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::Boolean is_nil ("
          << i->name () << "_ptr);";
    }

  *o_ << be_uidt_nl
      << "}";

  *o_ << be_global->core_versioning_end ();
}
예제 #2
0
void
FE_ComponentHeader::compile_supports (UTL_NameList *supports)
{
  if (supports == 0)
    {
      return;
    }

  AST_Decl *d = 0;
  UTL_ScopedName *item = 0;
  AST_Interface *iface = 0;
  AST_Type *t = 0;
  long j = 0;
  long k = 0;

  // Compute expanded flattened non-repeating list of interfaces
  // which this one inherits from.

  for (UTL_NamelistActiveIterator l (supports); !l.is_done (); l.next ())
    {
      item = l.item ();

      // Check that scope stack is valid.
      if (idl_global->scopes ().top () == 0)
        {
          idl_global->err ()->lookup_error (item);

          // This is probably the result of bad IDL.
          // We will crash if we continue from here.
          throw Bailout ();
        }

      // Look it up.
      UTL_Scope *s = idl_global->scopes ().top ();

      d = s->lookup_by_name  (item, true);

      if (d == 0)
        {
          AST_Decl *sad = ScopeAsDecl (s);

          if (sad->node_type () == AST_Decl::NT_module)
            {
              AST_Module *m = AST_Module::narrow_from_decl (sad);

              d = m->look_in_prev_mods_local (item->last_component ());
            }
        }

      // Not found?
      if (d == 0)
        {
          idl_global->err ()->lookup_error (item);

          // This is probably the result of bad IDL.
          // We will crash if we continue from here.
          throw Bailout ();
        }

      // Remove typedefs, if any.
      if (d->node_type () == AST_Decl::NT_typedef)
        {
          d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
        }

      AST_Decl::NodeType nt = d->node_type ();
      t = AST_Type::narrow_from_decl (d);

      if (nt == AST_Decl::NT_interface)
        {
          iface = AST_Interface::narrow_from_decl (d);

          // Undefined interface?
          if (!iface->is_defined ())
            {
              idl_global->err ()->inheritance_fwd_error (
                this->interface_name_,
                iface);

              continue;
            }

          // Local interface? (illegal for components to support).
          if (iface->is_local ())
            {
              idl_global->err ()->unconstrained_interface_expected (
                this->name (),
                iface->name ());

              continue;
           }
        }
      else if (nt == AST_Decl::NT_param_holder)
        {
          AST_Param_Holder *ph =
            AST_Param_Holder::narrow_from_decl (d);

          nt = ph->info ()->type_;

          if (nt != AST_Decl::NT_type
              && nt != AST_Decl::NT_interface)
            {
              idl_global->err ()->mismatched_template_param (
                ph->info ()->name_.c_str ());

              continue;
            }
        }
      else
        {
          idl_global->err ()->interface_expected (d);
          continue;
        }

      // OK, see if we have to add this to the list of interfaces
      // inherited from.
      this->compile_one_inheritance (t);
    }

  // OK, install in interface header.
  // First the flat list (all ancestors).
  if (this->iused_flat_ > 0)
    {
      ACE_NEW (this->inherits_flat_,
               AST_Interface *[this->iused_flat_]);

      for (j = 0; j < this->iused_flat_; ++j)
        {
          this->inherits_flat_[j] = this->iseen_flat_[j];
        }

      this->n_inherits_flat_ = this->iused_flat_;
    }