示例#1
0
void ExportPass::execute()
{
  assert(theEnv != NULL) ;

  OutputInformation("Export pass begins") ;

  // Get the information regarding the current procedure by looking at
  //  the first procedure from the first file in the file set block.

  Iter<FileBlock*> temp =
    theEnv->get_file_set_block()->get_file_block_iterator() ;
  Iter<ProcedureDefinition*> temp2 = (temp.current())->get_definition_block()->get_procedure_definition_iterator() ;

  originalProcedure = temp2.current() ;
  assert(originalProcedure != NULL) ;

  // Modules have been transformed into structs so all the previous 
  //  passes work, and here we have to do a little bit of backtracking
  //  and convert them to the straight model.
  BrickAnnote* rocccType = 
    dynamic_cast<BrickAnnote*>(originalProcedure->lookup_annote_by_name("FunctionType")) ;
  assert(rocccType != NULL) ;
  IntegerBrick* valueBrick = 
    dynamic_cast<IntegerBrick*>(rocccType->get_brick(0)) ;
  assert(valueBrick != NULL) ;
  int functionType = valueBrick->get_value().c_int() ;
  delete rocccType->remove_brick(0) ;
  delete originalProcedure->remove_annote_by_name("FunctionType") ;

  if (functionType == 1) // Module
  {
    // De-modulize it
    ConstructModuleSymbols() ;
  }
  else if (functionType == 2 || functionType == 3) // Systems
  {
    // Just create clones
    ConstructSystemSymbols() ;
  }
  else
  {
    assert(0 && "Trying to export something unknown") ;
  }

  ReadRepository() ;  
  AddSymbols() ;

  DumpRepository() ;

  OutputInformation("Export pass ends") ;
}
示例#2
0
/*!
 * \brief Create a document from a specified file.
 *
 * \param path Pathname of the configuration file.
 */
bool CNutConfDoc::OnCreate(const wxString & path, long flags)
{
    bool rc = false;
    wxString normPath(path);
    CSettings *cfg = wxGetApp().GetSettings();

    normPath.Replace(wxT("\\"), wxT("/"));
    cfg->m_configname = normPath;

    wxGetApp().m_currentDoc = this;

    /*
     * The repository may refer to certain configuration values. Thus, 
     * it must be loaded before reading the repository.
     */
    cfg->Load(cfg->m_configname);
    if ((rc = ReadRepository(cfg->m_repositoryname, normPath)) == true) {

        Modify(false);
        SetDocumentSaved(false);

        rc = wxDocument::OnCreate(path, flags);
        if (rc) {
            if (flags & wxDOC_NEW) {
                wxBusyCursor wait;

                CNutConfHint hint(NULL, nutSelChanged);
                UpdateAllViews(NULL, &hint);

                SetFilename(GetFilename(), true);
            }
        }
    }

    if(!rc) {
        wxGetApp().m_currentDoc = NULL;
    }
    return rc;
}