void StrucViewItem::expandNode( int index ) //----------------------------------------- { VerboseListBox * listbox = _parent->getListBox(); WVList * listobjs = _parent->getObjs(); int childIndex = index + 1; int i; initState(); if( _expandState == Collapsed ) { _expandState=Expanded; } else { return; } char * tmp = name(); listbox->deleteString( index ); listbox->insertString( tmp, index ); delete tmp; listobjs->removeAt( index ); listobjs->insertAt( index, this ); for( i = 0; i < _kids.count(); i++ ) { char *tmp = ((StrucViewItem *)_kids[i])->name(); listbox->insertString( tmp, childIndex ); delete tmp; listobjs->insertAt( childIndex, _kids[i] ); childIndex ++; } listbox->select( index ); return; }
bool StrucViewItem::inhHook( DerivationPtr & ptr, void * info ) //------------------------------------------------------------- { InheritedData * data = (InheritedData *) info; WString name( *data->name ); StrucViewItem * item = NULL; name.concat( "::" ); name.concat( ptr._class->name() ); if( ptr._virtuality == DR_VIRTUALITY_VIRTUAL ) { WVList * list = data->me->_parent->getSeen(); for( int i = list->count(); i > 0; i -= 1 ) { StrucViewItem * test = (StrucViewItem *) (*list)[ i - 1 ]; if( test->_info->getHandle() == ptr._class->getHandle() ) { item = test; } } } if( item != NULL ) { item->_name.concat( ", " ); item->_name.concat( name ); } else { item = new StrucViewItem( data->me->_parent, ptr._class, data->me->_indentLevel ); item->_name = name; item->initState(); data->me->_kids.add( item ); } return true; }
void MItem::pruneStates( WVList& states ) { for( int i=states.count(); i>0; ) { i--; MState* s = (MState*)states[i]; if( !s->legal() ) { delete states.removeAt( i ); } } }
void StrucViewItem::initState() //----------------------------- // if i represent a variable, i must find my type // if the base type is a ClassType, then i am Collapsed // else i am LeafNode { bool do_inherited = false; ClassType * classType; dr_sym_type stype = _info->symtype(); REQUIRE( stype != DR_SYM_NOT_SYM,"strucview::initstate ack"); if( !_initialized ) { if( _classNode != NULL ) { REQUIRE( stype == DR_SYM_CLASS,"strucview::initstate nak"); classType = (ClassType *)_info; _type = _name; } else { classType = flattenTypeDesc( _info, _type ); _name = _info->name(); } if( classType ) { WVList kidInfos; FilterFlags flags = _parent->getFilter(); if( ( flags & FILT_INHERITED ) || ( flags & FILT_ALL_INHERITED )) { do_inherited = true; FILT_RESET_INHERITED( flags ); } classType->dataMembers( kidInfos, flags ); if( kidInfos.count() != 0 ) { _expandState = Collapsed; _parent->addSeen( this ); for( int i = 0; i < kidInfos.count(); i++ ) { _kids.add( new StrucViewItem( _parent, ((Symbol *)kidInfos[i]), _indentLevel + 1 ) ); } } else { _expandState = LeafNode; } if( classType != _info ) { delete classType; } if( do_inherited ) { startInherited(); } } else { _expandState = LeafNode; } _initialized = true; } }
int MConfig::findMatchingRules( WFileName& fn, WString& mask, WVList& list ) { int icount = _rules.count(); for( int i=0; i<icount; i++ ) { MRule* rule = (MRule*)_rules[i]; if( rule->match( mask, fn ) ) { list.add( rule ); } } return( list.count() ); }
int MItem::expandAction( const WString& actionName, WString& command ) { WVList actions; addActions( actions ); for( int i=0; i<actions.count(); i++ ) { MAction* action = (MAction*)actions[i]; if( action->name().match( actionName ) ) { return( expandAction( action, command ) ); } } return( -1 ); }
void MItem::addActions( WFileName& fn, WVList& list ) { WVList rules; if( _config->findMatchingRules( fn, _component->mask(), rules ) ) { for( int i=0; i<rules.count(); i++ ) { MRule* r = (MRule*)rules[i]; for( int j=0; j<r->actions().count(); j++ ) { list.add( r->actions()[j] ); } } } }
MRule* MConfig::findMatchingRule( WFileName& fn, MRule* tgtRule, WString& mask ) { WVList list; WVList& symbols = tgtRule->symbols(); int icount = symbols.count(); for( int i=0; i<icount; i++ ) { MSymbol& sym = *(MSymbol*)symbols[i]; addRules( fn, sym.mask(), list, mask ); if( list.count() > 0 ) { return( (MRule*)list[0] ); } } return( nilRule() ); }
void MC2Switch::getText( WString& str, WVList* states, SwMode mode ) { bool state = _state[mode]; WVList found; findStates( states, found ); int icount = found.count(); for( int i=0; i<icount; i++ ) { MCState* st = (MCState*)found[i]; if( st->mode() == mode ) { state = st->state(); } } addone( str, state ); }
void FunctionSym::callers( WVList & list ) //---------------------------------------- { int i; getModule()->findRefSyms( &list, this ); for( i = 0; i < list.count(); i += 1 ) { Symbol * sym = (Symbol *) list[ i ]; if( sym->symtype() != DR_SYM_FUNCTION ) { list.removeAt( i ); } } }
void ClassLattice::baseClasses( WVList & symlist ) //------------------------------------------------ { loadBases(); for( int i = 0; i < _bases.count(); i += 1 ) { symlist.add( _bases[ i ]->_class ); } }
void ClassLattice::derivedClasses( WVList & symlist ) //--------------------------------------------------- { loadDeriveds(); for( int i = 0; i < _deriveds.count(); i += 1 ) { symlist.add( _deriveds[ i ]->_class ); } }
static bool referenceHook( drmem_hdl, dr_ref_info * refinfo, char * name, void * info ) //----------------------------------------------------------------------- { Reference * ref; WVList * list = (WVList *) info; for( int i = 0; i < list->count(); i++ ) { ref = (Reference *) (*list)[i]; if( ref->line() == refinfo->line && ref->column() == refinfo->column && strcmp( ref->sourceFile(), refinfo->file ) == 0 ) { WBRFree( name ); return true; } } list->add( new Reference( refinfo, name ) ); return true; // keep going }
int MItem::addActions( WVList& list ) { if( !_isTarget ) { //add actions for Source addActions( *this, list ); } //add actions for result int ocount = list.count(); int icount = _rule->actions().count(); for( int i=0; i<icount; i++ ) { list.add( _rule->actions()[i] ); } WFileName fn; if( result( fn ) ) { addActions( fn, list ); } return( ocount ); }
void MConfig::addRules( WFileName& srcMask, WFileName& tgtMask, WVList& list, WString& tagMask ) { int icount = _rules.count(); for( int i=0; i<icount; i++ ) { MRule* rule = (MRule*)_rules[i]; if( rule->match( tagMask, srcMask, tgtMask ) ) { list.add( rule ); } } }
void MItem::addStates( WVList& list, SwMode mode ) { int icount = _states.count(); for( int i=0; i<icount; i++ ) { MState* st = (MState*)_states[i]; if( st->mode() == mode ) { list.add( _states[i] ); } } }
void MComponent::addWorkFiles( WVList& workFiles, SwMode mode, MComponent* comp ) { for( int i=0; i<_items.count(); i++ ) { MItem* m = (MItem*)_items[i]; WFileName f; m->absName( f ); MWorkFile* w = new MWorkFile( f, mode, m, comp ); workFiles.add( w ); } }
void MComponent::getMaskItems( WVList& list ) { int icount = _items.count(); for( int i=0; i<icount; i++ ) { MItem* m = (MItem*)_items[i]; if( m->isMask() ) { list.add( m ); } } }
void MTool::addFamilies( WVList& list ) { int icount = _families.count(); for( int i = 0; i < icount; i++ ) { list.add( _families[i] ); } icount = _incTools.count(); for( int i = 0; i < icount; i++ ) { MTool* tool = (MTool*)_incTools[i]; tool->addFamilies( list ); } }
int MItem::expandAction( MAction* action, WString& command ) { WFileName fn; if( _isTarget ) { absName( fn ); } else { WVList actions; int ocount = addActions( actions ); if( !action ) { int icount = actions.count(); if( icount > 0 ) { for( int i=0; i<icount; i++ ) { MAction* act = (MAction*)actions[i]; if( act->defAction() ) { if( act->okForMask() || !isMask() ) { action = act; break; } } } } } if( action ) { int ix = actions.indexOfSame( action ); if( ix < 0 ) { action = NULL; } else if( ix >= ocount ) { absResult( fn ); } else { absName( fn ); } } } if( action ) { WVList* states = findActionStates( action ); return( action->expand( command, &fn, _component->mask(), states, _component->mode() ) ); } return( -1 ); }
void StrucViewItem::collapseNode( int &index ) //-------------------------------------------- { WVList * listobjs = _parent->getObjs(); VerboseListBox * listbox = _parent->getListBox(); initState(); if( _expandState == Expanded ) { index += 1; for( int i = 0; i < _kids.count(); i++ ) { ((StrucViewItem *)_kids[ i ])->collapseNode( index ); } index -= 1; } listobjs->removeAt( index ); listbox->deleteString( index ); if( _expandState == Expanded ) { _expandState = Collapsed; } }
void StrucViewItem::expandAllNode( int &index ) //--------------------------------------------- { WVList * listobjs = _parent->getObjs(); VerboseListBox * listbox = _parent->getListBox(); initState(); if( (*listobjs)[ index ] != this ) { if( _expandState == Collapsed ) { _expandState = Expanded; } listobjs->insertAt( index, this ); char * tmp = name(); listbox->insertString( tmp, index ); delete tmp; if( _expandState == Collapsed ) { _expandState = Expanded; } } else { if( _expandState == Collapsed ) { _expandState = Expanded; listbox->deleteString( index ); char * tmp = name(); listbox->insertString( tmp, index ); delete tmp; } } index += 1; if( _expandState != LeafNode ) { for( int i = 0; i < _kids.count(); i++ ) { ((StrucViewItem *)_kids[ i ])->expandAllNode( index ); } } }
void DTViewClass::load() //---------------------- { WVList dataMembers; WVList methods; WVList friends; int i; WString str; ClassType * cls = (ClassType *) _symbol; Symbol * s; _members->clearAndDestroy(); cls->dataMembers( dataMembers ); cls->memberFunctions( methods ); cls->friendFunctions( friends ); for( i = 0; i < friends.count(); i += 1 ) { s = (Symbol *) friends[ i ]; str.printf( " friend %s;", s->scopedName( FALSE ) ); _members->insert( new ClassMember( s, str.gets() ) ); } for( i = 0; i < dataMembers.count(); i += 1 ) { s = (Symbol *) dataMembers[ i ]; str.printf( " %s;", s->scopedName( FALSE ) ); _members->insert( new ClassMember( s, str.gets() ) ); } for( i = 0; i < methods.count(); i += 1 ) { s = (Symbol *) methods[ i ]; str.printf( " %s;", s->scopedName( FALSE ) ); _members->insert( new ClassMember( s, str.gets() ) ); } addDescriptions(); fillBox(); }
void MWorkFile::addStates( WVList& states ) { for( int i=0; i<_states.count(); i++ ) { states.add( _states[i] ); } }
DescriptionPaint::DescriptionPaint( WBRWindow * prnt, const WRect & r, Symbol * sym ) : _parent( prnt ) , _rect( r ) , _current( -1 ) //-------------------------------------------------------------------- { int i; WVList desc; Description * entry; WString buf; const char * uDefSymName; int x = r.x(); int w; int h; _parts = new WCPtrOrderedVector<DescriptionPart>; sym->description( desc ); for( i = 0; i < desc.count(); i += 1 ) { entry = (Description *) desc[i]; if( entry->symbol() ) { if( sym->isEqual( entry->symbol() ) ) { // don't hilight the symbol we're describing buf.concat( entry->name() ); delete entry->symbol(); } else { if( buf != "" ) { // flush buf w = prnt->getTextExtentX( buf ); h = prnt->getTextExtentY( buf ); _parts->append( new DescriptionPart( buf.gets(), NULL, WRect(x,r.y(),w, h ) ) ); buf=""; x+=w; } uDefSymName = entry->name(); w = prnt->getTextExtentX( uDefSymName ); h = prnt->getTextExtentY( uDefSymName ); _parts->append( new DescriptionPart( uDefSymName, entry->symbol(), WRect(x,r.y(),w, h ) ) ); x+=w; } } else { buf.concat( entry->name() ); } } desc.deleteContents(); if( buf != "" ) { // flush buf w = prnt->getTextExtentX( buf ); h = prnt->getTextExtentY( buf ); _parts->append( new DescriptionPart( buf, NULL, WRect(x,r.y(),w, h ) ) ); buf=""; x+=w; } _rect.w( x - abs( _rect.x() ) ); }
ClassType * StrucViewItem::flattenTypeDesc( Symbol * sym, WString & desc ) //------------------------------------------------------------------------ { ClassType * classType = NULL; char * str = NULL; WVList typeParts; Description * entry; int i; REQUIRE( sym != NULL, "strucview::flatten passed null symbol!" ); dr_sym_type stype = sym->symtype(); REQUIRE( stype != DR_SYM_NOT_SYM,"strucview::flatten bad set"); switch( stype ) { case DR_SYM_VARIABLE: // need to find out the type of the data member ((VariableSym *) sym)->loadTypeInfo( typeParts ); for( i = 0; i < typeParts.count(); i++ ) { entry = (Description *) typeParts[i]; if( entry->_nameGoesHere ) { desc.concat( entry->u.text ); } else { if( !sym->isEqual( entry->u.sym ) ){ if( classType == NULL ) { classType = flattenTypeDesc( entry->u.sym, desc ); } else { desc.concat( entry->u.sym->name() ); } } } } break; case DR_SYM_TYPEDEF: case DR_SYM_ENUM: sym->description( typeParts ); for( i = 0; i < typeParts.count(); i++ ) { entry = (Description *) typeParts[ i ]; if( entry->_isUserDefined ) { if( entry->u.sym->symtype() == DR_SYM_CLASS && classType == NULL ) { classType = (ClassType *) entry->u.sym; } } } desc.concat( sym->name() ); break; case DR_SYM_CLASS: if( _parent->isSeen( sym ) ) { desc.concat( sym->name() ); classType = NULL; } else { classType = (ClassType *) sym; desc.concat( classType->name() ); } break; default: {} } for( i=0; i < typeParts.count(); i++ ) { entry = (Description *) typeParts[ i ]; if( entry->_isUserDefined && entry->u.sym != classType && entry->u.sym != sym ) { delete entry->u.sym; } } typeParts.deleteContents(); return classType; }