本文整理汇总了C++中ExeMaker::Reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ ExeMaker::Reserve方法的具体用法?C++ ExeMaker::Reserve怎么用?C++ ExeMaker::Reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExeMaker
的用法示例。
在下文中一共展示了ExeMaker::Reserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Put
void SstGlobalSym::Put( ExeMaker& eMaker, const uint cSeg )
/***************************************************************/
{
if ( _symbolInfo.isEmpty() ) {
eMaker.DumpToExe( (unsigned_16) 0 );
eMaker.DumpToExe( (unsigned_16) 0 );
eMaker.DumpToExe( (unsigned_32) 0 );
eMaker.DumpToExe( (unsigned_32) 0 );
eMaker.DumpToExe( (unsigned_32) 0 );
return;
}
unsigned_32 currentOffset = 0;
/*
cerr << "entered SstGlobalSym::Put()\n";
cerr << "creating nameHash for ";
cerr << _symbolInfo.entries();
cerr << " symbols.\n";
cerr.flush();
*/
eMaker.DumpToExe( (unsigned_16) DEFAULT_NAME_HASH );
eMaker.DumpToExe( (unsigned_16) DEFAULT_ADDR_HASH );
streampos pos = eMaker.TellPos();
eMaker.Reserve(3*LONG_WORD);
NameHashTable nameHash(_symbolInfo.entries());
/*
cerr << "NameHashTable complete\n";
cerr.flush();
*/
AddrHashTable addrHash(cSeg);
/*
cerr << "AddrHashTable complete\n";
cerr.flush();
*/
//WCPtrConstSListIter<SymbolStruct> iter(_symbolInfo);
SymbolStruct* currentPtr = NULL;
long cnt=0, mcnt;
mcnt = _symbolInfo.entries();
/*
cerr << "_symbolInfo has ";
cerr << mcnt;
cerr << " entries.\n";
cerr.flush();
*/
//while ( ++iter ) {
while ( cnt++ < mcnt) {
/*
cerr << "global Symbol count: ";
cerr << cnt;
cerr << "\n";
cerr.flush();
*/
//currentPtr = iter.current();
currentPtr = _symbolInfo.get(cnt);
//cerr << "OK\n";
//cerr.flush();
currentPtr -> SetOffset(currentOffset);
if ( currentPtr -> cSum() == NO_CHKSUM ) {
if ( addrHash.TryToInsert(currentPtr) ) {
currentOffset += SymbolSubsection::PageAlign(eMaker,currentPtr->Length(),currentOffset);
currentOffset += currentPtr -> Length();
currentPtr -> Put(eMaker);
}
} else if ( nameHash.TryToInsert(currentPtr) ) {
currentOffset += SymbolSubsection::PageAlign(eMaker,currentPtr->Length(),currentOffset);
currentOffset += currentPtr -> Length();
currentPtr -> Put(eMaker);
addrHash.TryToInsert(currentPtr);
}
}
currentOffset += SymbolSubsection::DumpPageAlign(eMaker,LONG_WORD,0xff);
unsigned_32 preNameHasPos = eMaker.TellPos();
nameHash.Put(eMaker);
unsigned_32 suNameHasPos = eMaker.TellPos();
addrHash.Put(eMaker);
unsigned_32 currentPos = eMaker.TellPos();
eMaker.SeekTo(pos);
eMaker.DumpToExe(currentOffset);
eMaker.DumpToExe(suNameHasPos - preNameHasPos);
eMaker.DumpToExe(currentPos - suNameHasPos);
eMaker.SeekTo(currentPos);
}