void LibOMF::addSymbol(ObjModule *om, const char *name, int pickAny) { #if LOG printf("LibOMF::addSymbol(%s, %s, %d)\n", om->name, name, pickAny); #endif StringValue *s = tab.insert(name, strlen(name)); if (!s) { // already in table if (!pickAny) { s = tab.lookup(name, strlen(name)); assert(s); ObjSymbol *os = (ObjSymbol *)s->ptrvalue; error("multiple definition of %s: %s and %s: %s", om->name, name, os->om->name, os->name); } } else { ObjSymbol *os = new ObjSymbol(); os->name = strdup(name); os->om = om; s->ptrvalue = (void *)os; objsymbols.push(os); } }
void initTraitsStringTable() { traitsStringTable._init(); for (size_t idx = 0; ; idx++) { const char *s = traits[idx]; if (!s) break; StringValue *sv = traitsStringTable.insert(s, strlen(s)); sv->ptrvalue = (void *)traits[idx]; } }
//--------------------------------------------------------------------------- unsigned int StringID( const std::string& stringValue ) { std::string value( stringValue ); ToLower( value ); StringTable::iterator iter = s_theStringTable.find( value ); if ( iter != s_theStringTable.end() ) { return iter->second.m_id; } else { StringTableEntry newEntry; newEntry.m_id = s_nextStringID; newEntry.m_originalString = stringValue; s_theStringTable.insert( std::make_pair( value, newEntry ) ); ++ s_nextStringID; return newEntry.m_id; } }