virtual uint findInterfaces( const char * interfaceName, InterfaceCallback & finder ) { uint n = 0; for ( ModIter it = mods.begin(); it != mods.end(); ++it ) { const char * s = it->first; Dll * d = it->second; ClassInfo *info = d->getClassInfo(); while ( info && info->iname ) { if ( ! strcmp( interfaceName, "*" ) ) // selected 'All' { uint r = finder.call( info->iname, info->cname, info->count() ); n ++; } else if ( ! strcmp( interfaceName, info->iname ) ) { uint r = finder.call( info->iname, info->cname, info->count() ); n ++; } ++ info; } } return n; }
virtual ~CEngine() { $X1("del()"); for ( ModIter it = mods.begin(); it != mods.end(); ++it ) { const char * s = it->first; Dll * d = it->second; ClassInfo *info = d->getClassInfo(); char b[300]; char b1[1024]; bool alive=0; b[0] = b1[0] = 0; while ( info->iname ) { if ( info->count() ) { alive=1; sprintf( b, "%s %i instances of %s alive !\n", info->cname, info->count(), info->iname ); strcat( b1, b ); } ++info; } if ( alive ) sys::alert("ref trouble !", b1 ); E_DELETE( d ); } }
virtual uint cleanupModules() { std::vector<ModIter> undead; for ( ModIter it = mods.begin(); it != mods.end(); ++it ) { uint n = 0; const char * s = it->first; Dll * d = it->second; ClassInfo *info = d->getClassInfo(); while ( info && info->iname ) { n += info->count(); ++info; } if ( n==0 ) { printf( "undead : %s\n", s ); undead.push_back( it ); } } for ( uint i=0; i<undead.size(); i++ ) { ModIter it = undead[i]; printf( "kill : %s\n", it->first ); Dll * d = it->second; E_DELETE( d ); mods.erase( it ); } return 1; }
void showDll(Dll * d, const char * s) { const ModVersion *mv = d->getVersion(); std::cerr << "< " << mv->modVersion << " : " << mv->e6Version << " >\n"; ClassInfo *info = d->getClassInfo(); while ( info && info->iname ) { std::cerr << "\t" << info->cname << (strlen(info->cname)<8?"\t\t":"") ; std::cerr << "\t" << info->iname << (strlen(info->iname)<8?"\t\t":"") ; std::cerr << "\t" << info->count() << "\n"; ++ info; } }