Ejemplo n.º 1
0
void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName,
        const PARAM_CFG_ARRAY& aParams, const wxString& aFileName )
{
    std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName, aFileName ) );

    if( !cfg.get() )
    {
        // could not find template
        return;
    }

    cfg->SetPath( wxT( "/" ) );

    cfg->Write( wxT( "update" ), DateAndTime() );

    // @todo: pass in aLastClient wxString:
    cfg->Write( wxT( "last_client" ), Pgm().App().GetAppName() );

    // Save parameters
    cfg->DeleteGroup( aGroupName );     // Erase all data
    cfg->Flush();

    cfg->SetPath( aGroupName );
    cfg->Write( wxT( "version" ), CONFIG_VERSION );

    cfg->SetPath( wxT( "/" ) );

    wxConfigSaveParams( cfg.get(), aParams, aGroupName );

    cfg->SetPath( wxT( "/" ) );

    // cfg is deleted here by std::unique_ptr, that saves the *.pro file to disk
}
Ejemplo n.º 2
0
bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString&  aGroupName,
        const PARAM_CFG_ARRAY& aParams, const wxString& aForeignProjectFileName )
{
    std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName,
                                                     aForeignProjectFileName ) );

    if( !cfg.get() )
    {
        // could not find template
        return false;
    }

    cfg->SetPath( wxCONFIG_PATH_SEPARATOR );

    wxString timestamp = cfg->Read( wxT( "update" ) );

    m_pro_date_and_time = timestamp;

    // We do not want expansion of env var values when reading our project config file
    bool state = cfg.get()->IsExpandingEnvVars();
    cfg.get()->SetExpandEnvVars( false );

    wxConfigLoadParams( cfg.get(), aParams, aGroupName );

    cfg.get()->SetExpandEnvVars( state );

    return true;
}
Ejemplo n.º 3
0
bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName,
        const wxString&  aGroupName, const PARAM_CFG_ARRAY& aParams,
        bool doLoadOnlyIfNew )
{
    std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, false ) );

    if( !cfg.get() )
    {
        // could not find template
        return false;
    }

    cfg->SetPath( wxCONFIG_PATH_SEPARATOR );

    wxString timestamp = cfg->Read( wxT( "update" ) );

    if( doLoadOnlyIfNew && timestamp.size() && timestamp == m_pro_date_and_time )
    {
        return false;
    }

    m_pro_date_and_time = timestamp;

    wxConfigLoadParams( cfg.get(), aParams, aGroupName );

    return true;
}
Ejemplo n.º 4
0
Archivo: main.c Proyecto: doniexun/fcc
int main (int argc, char** argv) {
    debugInit(stdout);

    bool fail = false;

    /*Parse the command line options into a config*/
    config conf = configCreate();
    optionsParse(&conf, argc, argv);

    /*Initialize the arch with defaults from <fcc>/defaults.h, which is generated
      by <fcc>/makedefaults.sh and included (with -include) by the makefile.*/
    archSetup(&conf.arch, defaultOS, defaultWordsize);

    if (conf.fail)
        fail = true;

    else if (conf.mode == modeVersion) {
        puts("Fedjmike's C Compiler (fcc) v0.01b");
        puts("Copyright 2014 Sam Nipps.");
        puts("This is free software; see the source for copying conditions.  There is NO");
        puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");

    } else if (conf.mode == modeHelp) {
        puts("Usage: fcc [options...] <files...>");
        puts("Options:");
        puts("  -I <dir>   Add a directory to be searched for headers");
        puts("  -c         Compile and assemble only, do not link");
        puts("  -S         Compile only, do not assemble or link");
        puts("  -s         Keep temporary assembly output after compilation");
        puts("  -o <file>  Output into a specific file");
        puts("  --help     Display command line information");
        puts("  --version  Display version information");

    } else
        fail = driver(conf);

    configDestroy(conf);

    return fail ? 1 : 0;
}