Esempio n. 1
0
// Compare two const char *.
bool
UTL_String::compare (const char *lhs, const char *rhs)
{
  bool result= false;
  bool mixed=  false;

  if (lhs && rhs && strcmp_caseless (lhs, rhs, mixed))
    {
      result= !mixed;
      if (mixed) // Strings match (differing case)
        {
          if (idl_global->case_diff_error ())
            {
              idl_global->err ()->name_case_error (
                  const_cast<char *> (lhs),
                  const_cast<char *> (rhs));

              // If we try to continue from here, we risk a crash.
              throw Bailout ();
            }
          else
            {
              idl_global->err ()->name_case_warning (
                const_cast<char *> (lhs),
                const_cast<char *> (rhs));
            }
        }
    }

  return result;
}
Esempio n. 2
0
void
FE_populate (void)
{
  AST_Root *r = 0;

  // Check that the BE init created a generator object
  if (idl_global->gen () == 0)
    {
      ACE_ERROR ((
          LM_ERROR,
          ACE_TEXT ("IDL: idl_global->gen() not initialized, exiting\n")
        ));

      throw Bailout ();
    }

  // Create a global root for the AST. Note that the AST root has no name.
  Identifier root_id ("");
  UTL_ScopedName root_name (&root_id, 0);
  r = idl_global->gen ()->create_root (&root_name);
  idl_global->set_root (r);

  if (r == 0)
    {
      ACE_ERROR ((
          LM_ERROR,
          ACE_TEXT ("IDL: FE init failed to create AST root, exiting\n")
        ));

      throw Bailout ();
    }

  // Push it on the stack
  idl_global->scopes ().push (idl_global->root ());

  // Populate it with nodes for predefined types.
  fe_populate_global_scope ();

  // Set flag to indicate we are processing the main file now.
  idl_global->set_in_main_file (true);

  // Populate the IDL keyword container, for checking local identifiers.
  fe_populate_idl_keywords ();
}
Esempio n. 3
0
// Push an argument into the DRV_arglist.
void
DRV_cpp_putarg (const char *str)
{
  if (DRV_argcount >= DRV_MAX_ARGCOUNT)
    {
      ACE_ERROR ((LM_ERROR,
                  "%C: More than %d arguments to preprocessor\n",
                  idl_global->prog_name (),
                  DRV_MAX_ARGCOUNT ));

      throw Bailout ();
    }

  DRV_arglist[DRV_argcount++] =
    ACE::strnew (ACE_TEXT_CHAR_TO_TCHAR (str));
}
Esempio n. 4
0
void
AST_UnionBranch::add_labels (AST_Union *u)
{
  for (UTL_LabellistActiveIterator i (this->pd_ll);
       !i.is_done ();
       i.next ())
    {
      if (AST_UnionLabel::UL_default == i.item ()->label_kind ())
        {
          return;
        }
    }

  const bool enum_labels = (u->udisc_type () == AST_Expression::EV_enum);

  for (UTL_LabellistActiveIterator i (this->pd_ll);
       !i.is_done ();
       i.next ())
    {
      AST_Expression *ex = i.item ()->label_val ();
      UTL_ScopedName *n = ex->n ();

      if (n)
        {
          u->add_to_name_referenced (n->first_component ());
        }

      // If we have enum val labels, we need to set the type and
      // evaluate here, so the value will be available when the
      // default index in calculated.
      if (enum_labels)
        {
          ex->ev ()->et = AST_Expression::EV_enum;
          AST_Enum *disc = AST_Enum::narrow_from_decl (u->disc_type ());
          AST_EnumVal *dval = disc->lookup_by_value (ex);

          if (dval == 0)
            {
              idl_global->err ()->incompatible_disc_error (disc, ex);
              throw Bailout ();
            }

          ex->ev ()->u.eval = dval->constant_value ()->ev ()->u.ulval;
        }
    }
}
void InitCoh(int vers) {
    addrmap *am;

    ZeroMemory(addrmap_cache, sizeof(addrmap_cache));
    if (vers == 23)
        am = addrs_i23;
    else if (vers == 24)
        am = addrs_i24;
    else {
        Bailout("An impossible thing happened! Check that the laws of physics are still working.");
        return;
    }

    while (am && am->addr) {
        addrmap_cache[am->id] = am->addr;
        ++am;
    }
}
Esempio n. 6
0
void
FE_ComponentHeader::compile_inheritance (UTL_ScopedName *base_component)
{
  // If there is a base component, look up the decl and assign our member.
  // We also inherit its supported interfaces.
  if (base_component == 0)
    {
      return;
    }

  UTL_Scope *s = idl_global->scopes ().top_non_null ();
  AST_Decl *d = s->lookup_by_name (base_component,
                                   true);

  if (d == 0)
    {
      idl_global->err ()->lookup_error (base_component);

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

  if (d->node_type () == AST_Decl::NT_typedef)
    {
      d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
    }

  this->base_component_ = AST_Component::narrow_from_decl (d);

  if (this->base_component_ == 0)
    {
      idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_USE,
                                  d);
    }
  else if (!this->base_component_->is_defined ())
    {
      idl_global->err ()->inheritance_fwd_error (
                              this->name (),
                              this->base_component_
                            );
      this->base_component_ = 0;
    }
}
Esempio n. 7
0
void
FE_Utils::tmpl_mod_ref_check (AST_Decl *context,
                              AST_Decl *ref)
{
  if (ref == 0
      || ref->node_type () == AST_Decl::NT_param_holder
      || idl_global->in_tmpl_mod_alias ())
    {
      return;
    }

  bool ok = true;

  if (ref->in_tmpl_mod_not_aliased ())
    {
      if (! context->in_tmpl_mod_not_aliased ())
        {
          ok = false;
        }
      else
        {
          AST_Template_Module *context_tm =
            FE_Utils::get_tm_container (context);
          AST_Template_Module *ref_tm =
            FE_Utils::get_tm_container (ref);

          if (context_tm != ref_tm)
            {
              ok = false;
            }
        }
    }

  if (! ok)
    {
      idl_global->err ()->template_scope_ref_not_aliased (ref);
      throw Bailout ();
    }
}
static void RunPatch() {
    int vers = 0;

	ULONG gIntVal = GetInt(0x00BE15D4);
    if (gIntVal == 0xa77f40)
		vers = 23;
    else if (GetInt(0x00BE38BC) == 0xa76044)
		vers = 24;
    else
		Bailout("Sorry, your cityofheroes.exe file is not a supported version.");

    InitCoh(vers);

    WriteStrings();
    WriteData();
    RelocateCode();
    FixupCode(vers);
    WriteCode();

    if (vers == 23)
		PatchI23();
    else if (vers == 24)
		PatchI24();
}
Esempio n. 9
0
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  ACE_Argv_Type_Converter atc (argc, argv);
  try
    {
      if (0 != DRV_init (atc.get_argc (), atc.get_TCHAR_argv ()))
        {
          throw Bailout ();
        }

      // Parse arguments.
      DRV_parse_args (atc.get_argc (), atc.get_ASCII_argv ());

      // If a version message is requested, print it and exit cleanly.
      if (idl_global->compile_flags () & IDL_CF_VERSION)
        {
          DRV_version ();
          DRV_cleanup ();
          return 0;
        }

      // If a usage message is requested, print it and exit cleanly.
      if (idl_global->compile_flags () & IDL_CF_ONLY_USAGE)
        {
          DRV_usage ();
          DRV_cleanup ();
          return 0;
        }

      // If there are no input files, and we are not using the
      // directory recursion option, there's no sense going any further.
      if (0 == DRV_nfiles && 0 == idl_global->recursion_start ())
        {
          ACE_ERROR ((LM_ERROR,
                      ACE_TEXT ("IDL: No input files\n")));

          throw Bailout ();
        }

      AST_Generator *gen = be_util::generator_init ();

      if (0 == gen)
        {
          ACE_ERROR ((
              LM_ERROR,
              ACE_TEXT ("IDL: DRV_generator_init() failed to create ")
              ACE_TEXT ("generator, exiting\n")
            ));

          throw Bailout ();
        }
      else
        {
          idl_global->set_gen (gen);
        }

      // Initialize AST and load predefined types.
      FE_populate ();

      // Does various things in various backends.
      BE_post_init (DRV_files, DRV_nfiles);

      FILE *output_file = 0;

      if (idl_global->multi_file_input ())
        {
          output_file =
            ACE_OS::fopen (idl_global->big_file_name (), "w");
        }

      for (DRV_file_index = 0;
           DRV_file_index < DRV_nfiles;
           ++DRV_file_index)
        {
          if (idl_global->multi_file_input ())
            {
              ACE_OS::fprintf (output_file,
                               "#include \"%s\"\n",
                               DRV_files[DRV_file_index]);
            }
          else
            {
              DRV_drive (DRV_files[DRV_file_index]);
            }
        }

      if (idl_global->multi_file_input ())
        {
          ACE_OS::fclose (output_file);
          DRV_drive (idl_global->big_file_name ());
          ACE_OS::unlink (idl_global->big_file_name ());
        }
    }
  catch (Bailout)
    {
      // Incrementing here may be redundant, but the error count
      // is the exit value, and we want to make sure it isn't 0
      // if there was in fact an error. If a non-zero value is
      // off by 1, it's not so important.
      idl_global->set_err_count (idl_global->err_count () + 1);
    }

  int retval = idl_global->err_count ();
  DRV_cleanup ();

  return retval;
}
Esempio n. 10
0
void
DRV_drive (const char *s)
{
  // Set the name of the IDL file we are parsing. This is useful to
  // the backend when it generates C++ headers and files.
  UTL_String *utl_string = 0;
  ACE_NEW (utl_string,
           UTL_String (s, true));

  idl_global->idl_src_file (utl_string);

  // Pass through CPP.
  if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT("%C: preprocessing %C\n"),
                  idl_global->prog_name (),
                  s));
    }

  DRV_pre_proc (s);

  if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC)
    {
      // Go straight to cleanup, process the next file, if any.
      DRV_refresh ();
      return;
    }

  // Parse.
  if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT("%C: parsing %C\n"),
                  idl_global->prog_name (),
                  s));
    }

  // Return value not used - error count stored in idl_global
  // and checked below.
  (void) FE_yyparse ();

  // This option creates a single IDL file that includes all
  // input files. The backend outputs their names individually.
  if (!idl_global->multi_file_input ())
    {
      // Filename set by FE_yyparse(), so we output it immediately after.
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT("processing %C\n"),
                  idl_global->filename ()->get_string ()));
    }

  // We must do this as late as possible to make sure any
  // forward declared structs or unions contained in a
  // primary key at some level have been fully defined.
  idl_global->check_primary_keys ();

  // If there were any errors, stop.
  if (idl_global->err_count () > 0)
    {
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT("%C: %C: found %d error%s\n"),
                  idl_global->prog_name (),
                  s,
                  idl_global->err_count (),
                  (idl_global->err_count () > 1
                    ? ACE_TEXT ("s")
                    : ACE_TEXT ("")) ));

      // Backend will be cleaned up after the exception is caught.
      throw Bailout ();
    }

  // Dump the code.
  if ((idl_global->compile_flags () & IDL_CF_INFORMATIVE)
      && (idl_global->compile_flags () & IDL_CF_DUMP_AST))
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT("%C: dump %C\n"),
                  idl_global->prog_name (),
                  s));
    }

  if (idl_global->compile_flags () & IDL_CF_DUMP_AST)
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("Dump of AST:\n")));

      idl_global->root ()->dump (*ACE_DEFAULT_LOG_STREAM);
    }

  // Call the main entry point for the BE.
  if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT("%C: BE processing on %C\n"),
                  idl_global->prog_name (),
                  s));
    }

  // Make sure all forward declared structs and unions are defined
  // before proceeding to code generation.
  AST_check_fwd_decls ();

  if (0 == idl_global->err_count ())
    {
      BE_produce ();
    }
  else
    {
      throw Bailout ();
    }

  DRV_refresh ();
}
Esempio n. 11
0
// Parse arguments on command line
void
DRV_parse_args (long ac, char **av)
{
  ACE_CString buffer;
  char *s = 0;
  long i;
  bool has_space = false;

  FE_store_env_include_paths ();
  DRV_cpp_init ();
  idl_global->set_prog_name (av[0]);

  for (i = 1; i < ac; i++)
    {
      if (av[i][0] == '-')
        {
          idl_global->append_idl_flag (av[i]);

          switch (av[i][1])
            {
            case 0:
              // One or more letters expected after the dash.
              ACE_ERROR ((
                  LM_ERROR,
                  ACE_TEXT ("IDL: Space between dash and option ")
                  ACE_TEXT ("letters not allowed\n")
                ));

              ++i;
              idl_global->set_err_count (idl_global->err_count () + 1);
              break;
            case 'A':
              if (av[i][2] == '\0')
                {
                  if (i < ac - 1)
                    {
                      s = av[i + 1];
                      ++i;
                    }
                  else
                    {
                      ACE_ERROR ((
                          LM_ERROR,
                          ACE_TEXT ("IDL: incorrect use of ")
                          ACE_TEXT ("the -A option\n")
                        ));

                      idl_global->set_compile_flags (
                                      idl_global->compile_flags ()
                                      | IDL_CF_ONLY_USAGE
                                    );
                      break;
                    }
                }
              else
                {
                  s = av[i] + 2;
                }

              ACE_OS::strcat (idl_global->local_escapes (), s);
              ACE_OS::strcat (idl_global->local_escapes (), " ");
              break;
            case 'a':
              if (av[i][2] == 'e')
                {
                  idl_global->anon_type_diagnostic (
                    IDL_GlobalData::ANON_TYPE_ERROR);
                }
              else if (av[i][2] == 'w')
                {
                  idl_global->anon_type_diagnostic (
                    IDL_GlobalData::ANON_TYPE_WARNING);
                }
              else if (av[i][2] == 's')
                {
                  idl_global->anon_type_diagnostic (
                    IDL_GlobalData::ANON_TYPE_SILENT);
                }
              else
                {
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: I don't understand")
                      ACE_TEXT (" the '%s' option\n"),
                      ACE_TEXT_CHAR_TO_TCHAR (av[i])
                    ));
                 }

               break;
            // Temp directory for the IDL compiler to keep its files.
            case 't':
              if ((av[i][2] == '\0') && (i < ac - 1))
                {
                  idl_global->append_idl_flag (av[i + 1]);
                  idl_global->temp_dir (av[i + 1]);
                  ++i;
                }
              else
                {
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: I don't understand")
                      ACE_TEXT (" the '%s' option\n"),
                      ACE_TEXT_CHAR_TO_TCHAR (av[i])
                    ));

                  idl_global->set_compile_flags (
                                  idl_global->compile_flags ()
                                  | IDL_CF_ONLY_USAGE
                                );
                }

              break;
            case 'D':
            case 'U':
            case 'I':
              if (av[i][2] == '\0')
                {
                  if (i < ac - 1)
                    {
                      idl_global->append_idl_flag (av[i + 1]);
                      has_space = FE_Utils::hasspace (av[i + 1]);

                      // If the include path has a space, we need to
                      // add literal "s.
                      ACE_CString arg = av[i];
                      arg += (has_space ? "\"" : "");
                      arg += av[i + 1];
                      arg += (has_space ? "\"" : "");

                      DRV_cpp_putarg (arg.c_str ());
                      idl_global->add_include_path (arg.substr (2).c_str (), false);
                      ++i;
                    }
                  else
                    {
                      ACE_ERROR ((
                          LM_ERROR,
                          ACE_TEXT ("IDL: I don't understand")
                          ACE_TEXT (" the '%s' option\n"),
                          ACE_TEXT_CHAR_TO_TCHAR (av[i])
                        ));

                      idl_global->set_compile_flags (
                                      idl_global->compile_flags ()
                                      | IDL_CF_ONLY_USAGE
                                    );
                      break;
                    }
                }
              else
                {
                  has_space = FE_Utils::hasspace (av[i]);

                  // If the include path has a space, we need to
                  // add literal "s.
                  ACE_CString arg (av[i], 2);
                  arg += (has_space ? "\"" : "");
                  arg += av[i] + 2;
                  arg += (has_space? "\"" : "");

                  idl_global->add_include_path (arg.substr (2).c_str (), false);
                  DRV_cpp_putarg (arg.c_str ());
                }

              break;
            case 'E':
              idl_global->set_compile_flags (idl_global->compile_flags () |
                                             IDL_CF_ONLY_PREPROC);
              break;
            case 'V':
              idl_global->set_compile_flags (idl_global->compile_flags () |
                                             IDL_CF_VERSION);
              break;
            case 'W':
              if (av[i][2] == '\0')
                {
                  if (i < ac - 1)
                    {
                      s = av[i + 1];
                      ++i;
                    }
                  else
                    {
                      ACE_ERROR ((
                          LM_ERROR,
                          ACE_TEXT ("IDL: I don't understand")
                          ACE_TEXT (" the '%s' option\n"),
                          ACE_TEXT_CHAR_TO_TCHAR (av[i])
                        ));

                      idl_global->set_compile_flags (
                                      idl_global->compile_flags ()
                                      | IDL_CF_ONLY_USAGE
                                    );
                      break;
                    }
                }
              else
                {
                  s = av[i] + 2;
                }

              switch (*s)
                {
                default:
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: Incorrect use of -W option\n")
                    ));

                  idl_global->set_compile_flags (
                                  idl_global->compile_flags ()
                                  | IDL_CF_ONLY_USAGE
                                );
                  break;
                case 'p':
                  if (*(s + 1) == ',')
                    {
                      DRV_prep_cpp_arg (s + 2);
                    }

                  break;
                case 'b':
                  if (*(s + 1) == ',')
                    {
                      be_util::prep_be_arg (s + 2);
                    }

                  break;
                }

              break;
            case 'Y':
              if (av[i][2] == '\0')
                {
                  if (i < ac - 1)
                    {
                      s = av[i + 1];
                      ++i;
                    }
                  else
                    {
                      ACE_ERROR ((
                          LM_ERROR,
                          ACE_TEXT ("IDL: I don't understand")
                          ACE_TEXT (" the '%s' option\n"),
                          ACE_TEXT_CHAR_TO_TCHAR (av[i])
                        ));

                      idl_global->set_compile_flags (
                                      idl_global->compile_flags ()
                                      | IDL_CF_ONLY_USAGE
                                    );
                      break;
                    }
                }
              else
                {
                  s = av[i] + 2;
                }

              switch (*s)
                {
                  case 'p':
                    if (*(s + 1) == ',')
                      {
                        idl_global->set_cpp_location (s + 2);
                        DRV_cpp_new_location (s + 2);
                      }
                    else
                      {
                        ACE_ERROR ((
                            LM_ERROR,
                            ACE_TEXT ("IDL: I don't understand")
                            ACE_TEXT (" the '-Y' option\n")
                          ));

                        idl_global->set_compile_flags (
                                        idl_global->compile_flags ()
                                        | IDL_CF_ONLY_USAGE
                                      );
                      }

                    break;
                  default:
                    ACE_ERROR ((
                        LM_ERROR,
                        ACE_TEXT ("IDL: I dont' understand the use of")
                        ACE_TEXT (" %s with the '-Y' option\n"),
                        ACE_TEXT_CHAR_TO_TCHAR (s)
                      ));

                    idl_global->set_compile_flags (
                                    idl_global->compile_flags ()
                                    | IDL_CF_ONLY_USAGE
                                  );
                   break;
                }
              break;
            case 'd':
              idl_global->set_compile_flags (idl_global->compile_flags ()
                                             | IDL_CF_DUMP_AST);
              break;
            case 'u':
              idl_global->set_compile_flags (idl_global->compile_flags ()
                                             | IDL_CF_ONLY_USAGE);
              break;
            case 'v':
              idl_global->set_compile_flags (idl_global->compile_flags ()
                                             | IDL_CF_INFORMATIVE);
              break;
            case 'w':
              idl_global->set_compile_flags (idl_global->compile_flags ()
                                             | IDL_CF_NOWARNINGS);
              break;
            case 'C':
              // If identifiers in the same scope differ only by case...
              if (av[i][2] == 'e')
                {
                  // ...report an error.
                  idl_global->case_diff_error (true);
                }
              else if (av[i][2] == 'w')
                {
                  // ...report a warning (default for now)
                  idl_global->case_diff_error (false);
                }
              else
                {
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
                      ACE_TEXT_CHAR_TO_TCHAR (av[i])
                    ));

                  idl_global->set_compile_flags (
                                  idl_global->compile_flags ()
                                  | IDL_CF_ONLY_USAGE
                                );
                }

              break;
            default:
              be_global->parse_args (i, av);
              break;
            } // End of switch (av[i][1])
        } // End of IF (av[i][0] == '-')
      else
        {
          DRV_push_file (av[i]);
        }
    } // End of FOR (i = 1; i < ac; i++)

  be_util::arg_post_proc ();

  // Make sure the output directory is valid.
  if (idl_global->temp_dir () == 0)
    {
      ACE_TCHAR tmpdir[MAXPATHLEN + 1];

      if (ACE::get_temp_dir (tmpdir, MAXPATHLEN) == -1)
        {
          ACE_ERROR ((LM_ERROR,
                      ACE_TEXT ("Temporary path too long, ")
                      ACE_TEXT ("defaulting to current directory\n")));

          ACE_OS::strcpy (tmpdir, ACE_TEXT ("."));
        }

#if defined(ACE_MVS)
      if (ACE_OS::access (tmpdir, F_OK) == -1
          || ACE_OS::access (tmpdir, R_OK) == -1
          || ACE_OS::access (tmpdir, W_OK) == -1)
#else
      if (ACE_OS::access (tmpdir, F_OK | R_OK | W_OK) == -1)
#endif /* ACE_MVS */
        {
          ACE_ERROR ((
              LM_ERROR,
              ACE_TEXT ("Can't access temporary directory (%s),")
              ACE_TEXT (" using current directory for temp files.\n"),
              tmpdir
            ));

          ACE_OS::strcpy (tmpdir, ACE_TEXT ("."));
#if defined(ACE_MVS)
          if (ACE_OS::access (tmpdir, F_OK) == -1
              || ACE_OS::access (tmpdir, R_OK) == -1
              || ACE_OS::access (tmpdir, W_OK) == -1)
#else
          if (ACE_OS::access (tmpdir, F_OK | R_OK | W_OK) == -1)
#endif /* ACE_MVS */
            {
              ACE_ERROR ((LM_ERROR,
                          "Error: Can't access temporary directory %s\n",
                          tmpdir));

              throw Bailout ();
            }
        }

      idl_global->temp_dir (ACE_TEXT_ALWAYS_CHAR (tmpdir));
    }

  DRV_cpp_post_init ();
}
Esempio n. 12
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_;
    }