MSwitch* WEXPORT MFamily::findSwitch( MTool *tool, WString& switchtag, long fixed_version ) { // // Open Watcom IDE configuration/project files are buggy // There are many switch ID's which were changed by incompatible way // IDE uses various hacks to fix it later instead of proper solution // It is very hard to detect what was broken in each OW version because // there vere no change to version number of project files // #if CUR_CFG_VERSION < 5 tool = tool; #endif int icount = _switches.count(); bool isSetable = ( switchtag.size() > MASK_SIZE && switchtag[MASK_SIZE] != ' ' ); if( fixed_version == 0 || !isSetable ) { for( int i = 0; i < icount; i++ ) { MSwitch* sw = (MSwitch*)_switches[i]; if( sw->isTagEqual( switchtag ) ) { return( sw ); } } } else { for( int i = 0; i < icount; i++ ) { MSwitch* sw = (MSwitch*)_switches[i]; if( !sw->isSetable() ) continue; #if CUR_CFG_VERSION > 4 // upgrade switchtag to current configuration files version if( _config->version() > 4 || fixed_version < 41 ) { // check for old text if( sw->isTagEqual( tool, switchtag, 1 ) ) { sw->getTag( switchtag ); return( sw ); } // check for current text if( sw->isTagEqual( tool, switchtag ) ) { sw->getTag( switchtag ); return( sw ); } continue; } #endif if( sw->isTagEqual( switchtag ) ) { return( sw ); } // // hack for buggy version of configuration/project files // if( _config->version() == 4 || fixed_version == 40 ) { if( sw->isTagEqual( switchtag, 1 ) ) { // upgrade switchtag to current configuration files version sw->getTag( switchtag ); return( sw ); } } } } return( NULL ); }
bool WEXPORT MFamily::hasSwitches( bool setable ) { int icount = _switches.count(); for( int i=0; i<icount; i++ ) { MSwitch* sw = (MSwitch*)_switches[i]; if( !setable || sw->isSetable() ) { return( true ); } } return( false ); }