Esempio n. 1
0
MFamily::MFamily( WTokenFile& fil, WString& tok )
{
    if( !fil.eol() ) {
        fil.token( _name );
    }
    WString rGroup;
    for(;;) {
        fil.token( tok );
        if( tok == "RGroup" ) {
            fil.token( rGroup );
        } else if( tok == "VSwitch" ) {
            _switches.add( new MVSwitch( fil, tok ) );
        } else if( tok == "C2Switch" ) {
            _switches.add( new MC2Switch( fil, tok ) );
        } else if( tok == "CSwitch" ) {
            _switches.add( new MCSwitch( fil, tok ) );
        } else if( tok == "RSwitch" ) {
            _switches.add( new MRSwitch( fil, tok, rGroup ) );
        } else if( tok == "rem" ) {
            fil.flushLine( tok );
        } else {
            break;
        }
    }
}
Esempio n. 2
0
MC2Switch::MC2Switch( WTokenFile& fil, WString& tok )
    : MSwitch( fil, tok )
{
    fil.token( _on );
    fil.token( _off );
    bool state = false;
    for( int i=0; i<SWMODE_COUNT; i++ ) {
        if( !fil.eol() ) {
            state = ( fil.token( tok ) == "ON" );
        }
        _state[i] = state;
    }
}
Esempio n. 3
0
MTool::MTool( WTokenFile& fil, WString& tok )
{
    fil.token( _tag );
    fil.token( _name );
    fil.token( tok );
    for(;;) {
        if( tok == "Family" ) {
            _families.add( new MFamily( fil, tok ) );
        } else if( tok == "IncludeTool" ) {
            MTool* tool = _config->findTool( fil.token( tok ) );
            if( tool != NULL ) {
                _incTools.add( tool );
            }
            fil.token( tok );
#if CUR_CFG_VERSION > 4
        } else if( _config->version() > 4 && tok == "SwitchText" ) {
            WString id;
            fil.token( id );
            fil.token( tok );
            if( tok.size() > 0 ) {
                _switchesTexts.setThis( new WString( tok ), new WString( id ) );
            }
            // define map "text -> id" for older versions of project files
            while( !fil.eol() ) {
                fil.token( tok );
                if( tok.size() > 0 ) {
                    // define new switch text for map
                    _switchesIds.setThis( new WString( id ), new WString( tok ) );
                }
            }
            fil.token( tok );
#endif
        } else if( tok == "Help" ) {
            fil.token( _help );
            fil.token( tok );
        } else if( tok == "rem" ) {
            fil.flushLine( tok );
            fil.token( tok );
        } else {
            break;
        }
    }
}
Esempio n. 4
0
void MConfig::configProject( WTokenFile& fil, WString& tok )
{
    WString     target_os( "" );

    fil.token( tok );
    for(;;) {
        if( tok == "Editor" ) {
            // just ignore this and set things to the defaults
            // read all the stuff
            fil.flushLine( tok );
            fil.token( tok );
        } else if( tok == "Browse" ) {
            fil.token( _browseMerge );
            expandMacroes( _browseMerge );
            fil.token( _browse );
            expandMacroes( _browse );
            fil.token( tok );
        } else if( tok == "HelpFile" ) {
            fil.token( _helpFile );
            fil.token( tok );
        } else if( tok == "HtmlHelpFile" ) {
            fil.token( _htmlHelpFile );
            fil.token( tok );
        } else if( tok == "TargetGroup" ) {
            fil.token( target_os );
            fil.token( tok );
        } else if( tok == "Target" ) {
            _targets.add( new MTarget( fil, tok, target_os ) );
        } else if( tok == "ToolItem" ) {
            _toolItems.add( new MToolItem( fil, tok ) );
        } else if( tok == "Action" ) {
            _actions.add( new MAction( fil, tok ) );
        } else if( tok == "HelpAction" ) {
            _helpactions.add( new MAction( fil, tok ) );
        } else if( tok == "Before" ) {
            fil.token( tok );
            while( tok == "Command" ) {
                _before.concat( fil.token( tok ) );
                _before.concat( "\n" );
                fil.token( tok );
            }
        } else if( tok == "After" ) {
            fil.token( tok );
            while( tok == "Command" ) {
                _after.concat( fil.token( tok ) );
                _after.concat( "\n" );
            }
        } else if( tok == "Filter" ) {
            fil.token( tok );
            size_t size = _fileFilterSize;
            for( int i=0; i<2; i++ ) {
                _fileFilters = REALLOC( _fileFilters, size + (tok.size() + 1) + 1 );
                if( _fileFilters ) {
                    strcpy( &_fileFilters[size], tok );
                    size += tok.size() + 1;
                    _fileFilters[size] = '\0';
                }
                fil.token( tok );
            }
            _fileFilterSize = size;
        } else if( tok == "rem" ) {
            fil.flushLine( tok );
            fil.token( tok );
        } else {
            break;
        }
    }
}
Esempio n. 5
0
void MConfig::configMsgLog( WTokenFile& fil, WString& tok )
{
    fil.token( tok );
    for(;;) {
        if( tok == "Scan" ) {
            _logScanPatterns.add( new WString( fil.token( tok ) ) );
            fil.token( tok );
        } else if( tok == "BatchServer" ) {
            fil.token( _batserv );
            fil.token( tok );
        } else if( tok == "Help" ) {
            _logHelpFiles.add( new WString( fil.token( tok ) ) );
            _logHelpFiles.add( new WString( fil.token( tok ) ) );
            if( !fil.eol() ) {
                _logHelpFiles.add( new WString( fil.token( tok ) ) );
            } else {
                _logHelpFiles.add( new WString( "0" ) );
            }
            fil.token( tok );
        } else if( tok == "HtmlHelp" ) {
            _logHtmlHelpFiles.add( new WString( fil.token( tok ) ) );
            _logHtmlHelpFiles.add( new WString( fil.token( tok ) ) );
            if( !fil.eol() ) {
                _logHtmlHelpFiles.add( new WString( fil.token( tok ) ) );
            } else {
                _logHtmlHelpFiles.add( new WString( "0" ) );
            }
            fil.token( tok );
        } else if( tok == "rem" ) {
            fil.flushLine( tok );
            fil.token( tok );
        } else {
            break;
        }
    }
}
Esempio n. 6
0
bool MConfig::readFile( const WFileName& filename, bool reqd )
{
    WTokenFile fil;
    WFileName tmp_name( filename );

    _ok = false;
    if( tmp_name.addPath( _include_path ) ) {
        _ok = fil.open( tmp_name, OStyleRead );
    }
    if( !_ok ) {
        _ok = fil.open( filename, "PATH" );
    }
    if( !_ok ) {
        _ok = !reqd;
        if( !_ok ) {
            _errMsg.printf( "Unable to open '%s'", (const char*)filename );
        }
    } else {
        _filename = fil.filename();
        WString tok;
        fil.token( tok );
        for(; !fil.eof(); ) {
            if( tok == "Tool" ) {
                _tools.add( new MTool( fil, tok ) );
            } else if( tok == "Rule" ) {
                _rules.add( new MRule( fil, tok ) );
            } else if( tok == "Project" ) {
                configProject( fil, tok );
            } else if( tok == "MsgLog" ) {
                configMsgLog( fil, tok );
            } else if( tok == "IncludeFile" ) {
                WFileName fn;
                fil.token( fn );
                if( !readFile( fn, false ) ) break;
                fil.token( tok );
            } else if( tok == "HostMask" ) {
                fil.token( _hostMask );
                fil.token( tok );
            } else if( tok == "Version" ) {
                _version = (int)fil.token( tok );
                if( _version > CUR_CFG_VERSION ) {
                    _ok = false;
                    _errMsg.printf( "Configuration file '%s' format is too new.  "
                                    "you must use a newer version of the IDE.",
                                    (const char*)filename );
                    break;
                }
                fil.token( tok );
            } else if( tok == "rem" ) {
                fil.flushLine( tok );
                fil.token( tok );
            } else if( _version < 5 && tok == "Compat" ) {
                WString good;
                WString bad;
                fil.token( good );
                fil.token( bad );
                AddTypo( good, bad );
                fil.token( tok );
            } else {
                _ok = false;
                _errMsg.printf( "Error in '%s', line %d, at '%s'", (const char*)filename, fil.lineCount(), (const char*)tok );
                break;
            }
        }
        fil.close();
    }
    buildTargetOSList();
    return( _ok );
}
Esempio n. 7
0
WEXPORT MAction::MAction( WTokenFile& fil, WString& tok )
    : _defAction( FALSE )
    , _button( FALSE )
    , _okForMask( FALSE )
{
    _accel = NULL;
    fil.token( _name );
    if( fil.eol() ) {
        _tool = _config->nilTool();
    } else {
        _tool = _config->findTool( fil.token( tok ) ); //this must work
        if( !_tool ) {
            _tool = _config->nilTool();
        }
        if( !fil.eol() ) {
            _okForMask = ( fil.token( tok ) == "OKFORMASK" );
        }
    }
    fil.token( tok );   //read ahead
    for(;;) {
        if( tok == "Command" ) {
            _commands.add( new MCommand( fil, tok ) );
        } else if( tok == "Hint" ) {
            fil.token( _hint );
            fil.token( tok );
        } else if( tok == "AccelKey" ) {
            fil.token( _accelString );
            fil.token( tok );
        } else if( tok == "Button" ) {
            _button = TRUE;
            fil.token( tok );
        } else if( tok == "Default" ) {
            _defAction = TRUE;
            fil.token( tok );
        } else if( tok == "Help" ) {
            fil.token( _help );
            fil.token( tok );
        } else if( tok == "HotKey" ) {
            if( _accel == NULL ) {
                _accel = new MAccelerator( fil, tok );
            }
        } else if( tok == "rem" ) {
            fil.flushLine( tok );
            fil.token( tok );
        } else {
            break;
        }
    }
}