本文整理汇总了C++中Outbuffer::writen方法的典型用法代码示例。如果您正苦于以下问题:C++ Outbuffer::writen方法的具体用法?C++ Outbuffer::writen怎么用?C++ Outbuffer::writen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Outbuffer
的用法示例。
在下文中一共展示了Outbuffer::writen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cv8_func_term
void cv8_func_term(Symbol *sfunc)
{
//printf("cv8_func_term(%s)\n", sfunc->Sident);
assert(currentfuncdata.sfunc == sfunc);
currentfuncdata.section_length = retoffset + retsize;
funcdata->write(¤tfuncdata, sizeof(currentfuncdata));
// Write function symbol
assert(tyfunc(sfunc->ty()));
idx_t typidx;
func_t* fn = sfunc->Sfunc;
if(fn->Fclass)
{
// generate member function type info
// it would be nicer if this could be in cv4_typidx, but the function info is not available there
unsigned nparam;
unsigned char call = cv4_callconv(sfunc->Stype);
idx_t paramidx = cv4_arglist(sfunc->Stype,&nparam);
unsigned next = cv4_typidx(sfunc->Stype->Tnext);
type* classtype = (type*)fn->Fclass;
unsigned classidx = cv4_typidx(classtype);
type *tp = type_allocn(TYnptr, classtype);
unsigned thisidx = cv4_typidx(tp); // TODO
debtyp_t *d = debtyp_alloc(2 + 4 + 4 + 4 + 1 + 1 + 2 + 4 + 4);
TOWORD(d->data,LF_MFUNCTION_V2);
TOLONG(d->data + 2,next); // return type
TOLONG(d->data + 6,classidx); // class type
TOLONG(d->data + 10,thisidx); // this type
d->data[14] = call;
d->data[15] = 0; // reserved
TOWORD(d->data + 16,nparam);
TOLONG(d->data + 18,paramidx);
TOLONG(d->data + 22,0); // this adjust
typidx = cv_debtyp(d);
}
else
typidx = cv_typidx(sfunc->Stype);
const char *id = sfunc->prettyIdent ? sfunc->prettyIdent : prettyident(sfunc);
size_t len = strlen(id);
if(len > CV8_MAX_SYMBOL_LENGTH)
len = CV8_MAX_SYMBOL_LENGTH;
/*
* 2 length (not including these 2 bytes)
* 2 S_GPROC_V3
* 4 parent
* 4 pend
* 4 pnext
* 4 size of function
* 4 size of function prolog
* 4 offset to function epilog
* 4 type index
* 6 seg:offset of function start
* 1 flags
* n 0 terminated name string
*/
Outbuffer *buf = currentfuncdata.f1buf;
buf->reserve(2 + 2 + 4 * 7 + 6 + 1 + len + 1);
buf->writeWordn( 2 + 4 * 7 + 6 + 1 + len + 1);
buf->writeWordn(sfunc->Sclass == SCstatic ? S_LPROC_V3 : S_GPROC_V3);
buf->write32(0); // parent
buf->write32(0); // pend
buf->write32(0); // pnext
buf->write32(currentfuncdata.section_length); // size of function
buf->write32(startoffset); // size of prolog
buf->write32(retoffset); // offset to epilog
buf->write32(typidx);
F1_Fixups f1f;
f1f.s = sfunc;
f1f.offset = buf->size();
currentfuncdata.f1fixup->write(&f1f, sizeof(f1f));
buf->write32(0);
buf->writeWordn(0);
buf->writeByte(0);
buf->writen(id, len);
buf->writeByte(0);
// Write local symbol table
bool endarg = false;
for (SYMIDX si = 0; si < globsym.top; si++)
{ //printf("globsym.tab[%d] = %p\n",si,globsym.tab[si]);
symbol *sa = globsym.tab[si];
if (endarg == false &&
sa->Sclass != SCparameter &&
sa->Sclass != SCfastpar &&
sa->Sclass != SCshadowreg)
{
buf->writeWord(2);
buf->writeWord(S_ENDARG);
endarg = true;
}
cv8_outsym(sa);
}
/* Put out function return record S_RETURN
//.........这里部分代码省略.........