本文整理汇总了C++中DtBuilder::dword方法的典型用法代码示例。如果您正苦于以下问题:C++ DtBuilder::dword方法的具体用法?C++ DtBuilder::dword怎么用?C++ DtBuilder::dword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DtBuilder
的用法示例。
在下文中一共展示了DtBuilder::dword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nteh_gentables
void nteh_gentables(Symbol *sfunc)
{
symbol *s = s_table;
symbol_debug(s);
#if MARS
//except_fillInEHTable(s);
#else
/* NTEH table for C.
* The table consists of triples:
* parent index
* filter address
* handler address
*/
unsigned fsize = 4; // target size of function pointer
DtBuilder dtb;
int sz = 0; // size so far
for (block *b = startblock; b; b = b->Bnext)
{
if (b->BC == BC_try)
{
block *bhandler;
dtb.dword(b->Blast_index); // parent index
// If try-finally
if (b->numSucc() == 2)
{
dtb.dword(0); // filter address
bhandler = b->nthSucc(1);
assert(bhandler->BC == BC_finally);
// To successor of BC_finally block
bhandler = bhandler->nthSucc(0);
}
else // try-except
{
bhandler = b->nthSucc(1);
assert(bhandler->BC == BC_filter);
dtb.coff(bhandler->Boffset); // filter address
bhandler = b->nthSucc(2);
assert(bhandler->BC == BC_except);
}
dtb.coff(bhandler->Boffset); // handler address
sz += 4 + fsize * 2;
}
}
assert(sz != 0);
s->Sdt = dtb.finish();
#endif
outdata(s); // output the scope table
#if MARS
nteh_framehandler(sfunc, s);
#endif
s_table = NULL;
}
示例2: genModuleInfo
void genModuleInfo(Module *m)
{
//printf("Module::genmoduleinfo() %s\n", m->toChars());
if (!Module::moduleinfo)
{
ObjectNotFound(Id::ModuleInfo);
}
Symbol *msym = toSymbol(m);
//////////////////////////////////////////////
m->csym->Sclass = SCglobal;
m->csym->Sfl = FLdata;
DtBuilder dtb;
ClassDeclarations aclasses;
//printf("members->dim = %d\n", members->dim);
for (size_t i = 0; i < m->members->dim; i++)
{
Dsymbol *member = (*m->members)[i];
//printf("\tmember '%s'\n", member->toChars());
member->addLocalClass(&aclasses);
}
// importedModules[]
size_t aimports_dim = m->aimports.dim;
for (size_t i = 0; i < m->aimports.dim; i++)
{
Module *mod = m->aimports[i];
if (!mod->needmoduleinfo)
aimports_dim--;
}
FuncDeclaration *sgetmembers = m->findGetMembers();
// These must match the values in druntime/src/object_.d
#define MIstandalone 0x4
#define MItlsctor 0x8
#define MItlsdtor 0x10
#define MIctor 0x20
#define MIdtor 0x40
#define MIxgetMembers 0x80
#define MIictor 0x100
#define MIunitTest 0x200
#define MIimportedModules 0x400
#define MIlocalClasses 0x800
#define MIname 0x1000
unsigned flags = 0;
if (!m->needmoduleinfo)
flags |= MIstandalone;
if (m->sctor)
flags |= MItlsctor;
if (m->sdtor)
flags |= MItlsdtor;
if (m->ssharedctor)
flags |= MIctor;
if (m->sshareddtor)
flags |= MIdtor;
if (sgetmembers)
flags |= MIxgetMembers;
if (m->sictor)
flags |= MIictor;
if (m->stest)
flags |= MIunitTest;
if (aimports_dim)
flags |= MIimportedModules;
if (aclasses.dim)
flags |= MIlocalClasses;
flags |= MIname;
dtb.dword(flags); // _flags
dtb.dword(0); // _index
if (flags & MItlsctor)
dtb.xoff(m->sctor, 0, TYnptr);
if (flags & MItlsdtor)
dtb.xoff(m->sdtor, 0, TYnptr);
if (flags & MIctor)
dtb.xoff(m->ssharedctor, 0, TYnptr);
if (flags & MIdtor)
dtb.xoff(m->sshareddtor, 0, TYnptr);
if (flags & MIxgetMembers)
dtb.xoff(toSymbol(sgetmembers), 0, TYnptr);
if (flags & MIictor)
dtb.xoff(m->sictor, 0, TYnptr);
if (flags & MIunitTest)
dtb.xoff(m->stest, 0, TYnptr);
if (flags & MIimportedModules)
{
dtb.size(aimports_dim);
for (size_t i = 0; i < m->aimports.dim; i++)
{
Module *mod = m->aimports[i];
if (!mod->needmoduleinfo)
//.........这里部分代码省略.........