void DumpPackage(FILE *flp, USB_REG_INFO_PACKET *pack) { fprintf(flp, "\n------ Header: ------ \n"); fprintf(flp, "WORD PacketSize = %d: ", pack->PacketSize); fflush(flp); DumpWORD(flp, pack->PacketSize); fflush(flp); fprintf(flp, "\n");fflush(flp); fprintf(flp, "WORD ProtocolVersion = %d: ", pack->ProtocolVersion); fflush(flp); DumpWORD(flp, pack->ProtocolVersion); fflush(flp); fprintf(flp, "\n");fflush(flp); fprintf(flp, "WORD SubblockID = %d: ", pack->SubblockID); fflush(flp); DumpWORD(flp, pack->SubblockID); fflush(flp); fprintf(flp, "\n");fflush(flp); fprintf(flp, "WORD PacketNo = %d: ", pack->PacketNo); fprintf(flp, "WORD PartNo = %d: ", pack->PartNo); fflush(flp); DumpWORD(flp, pack->PartNo); fflush(flp); fprintf(flp, "\n");fflush(flp); fprintf(flp, " ---------- DATA ---------- \n"); fflush(flp); for (int i = 0; i < 990; i+=2) { fprintf(flp, "word %d = 0x%x : ", i / 2, pack->RegInfo[i]); fflush(flp); DumpByte(flp, (char*)&pack->RegInfo[i]); fflush(flp); fprintf(flp, " "); DumpByte(flp, (char*)&pack->RegInfo[i + 1]); fflush(flp); fprintf(flp, "\n"); fflush(flp); } fprintf(flp, " -------------------------- \n\n"); fflush(flp); }
static void DumpConstants (const Proto *f, DumpState *D) { int i; int n = f->sizek; DumpInt(n, D); for (i = 0; i < n; i++) { const TValue *o = &f->k[i]; DumpByte(ttype(o), D); switch (ttype(o)) { case LUA_TNIL: break; case LUA_TBOOLEAN: DumpByte(bvalue(o), D); break; case LUA_TNUMFLT: DumpNumber(fltvalue(o), D); break; case LUA_TNUMINT: DumpInteger(ivalue(o), D); break; case LUA_TSHRSTR: case LUA_TLNGSTR: DumpString(tsvalue(o), D); break; default: lua_assert(0); } } }
static void DumpUpvalues (const Proto *f, DumpState *D) { int i, n = f->sizeupvalues; DumpInt(n, D); for (i = 0; i < n; i++) { DumpByte(f->upvalues[i].instack, D); DumpByte(f->upvalues[i].idx, D); } }
static void DumpString (const TString *s, DumpState *D) { if (s == NULL) DumpByte(0, D); else { size_t size = s->len + 1; /* include trailing '\0' */ if (size < 0xFF) DumpByte(cast_int(size), D); else { DumpByte(0xFF, D); DumpVar(size, D); } DumpVector(getstr(s), size - 1, D); /* no need to save '\0' */ } }
static void DumpFunction(const Proto* f, const TString* p, DumpState* D) { DumpString((f->source==p) ? NULL : f->source,D); DumpInt(f->lineDefined,D); DumpByte(f->nups,D); DumpByte(f->numparams,D); DumpByte(f->is_vararg,D); DumpByte(f->maxstacksize,D); DumpLines(f,D); DumpLocals(f,D); DumpUpvalues(f,D); DumpConstants(f,D); DumpCode(f,D); }
static void DumpHeader(DumpState* D) { DumpLiteral(LUA_SIGNATURE,D); DumpByte(VERSION,D); DumpByte(luaU_endianness(),D); DumpByte(sizeof(int),D); DumpByte(sizeof(size_t),D); DumpByte(sizeof(Instruction),D); DumpByte(SIZE_OP,D); DumpByte(SIZE_A,D); DumpByte(SIZE_B,D); DumpByte(SIZE_C,D); DumpByte(sizeof(lua_Number),D); DumpNumber(TEST_NUMBER,D); }
static void DumpHeader(void* D) { DumpByte(ID_CHUNK,D); DumpSig(SIGNATURE, D); DumpByte(VERSION,D); DumpByte(luaU_endianess(),D); DumpByte(sizeof(int),D); DumpByte(sizeof(size_t),D); DumpByte(sizeof(Instruction),D); DumpByte(SIZE_INSTRUCTION,D); DumpByte(SIZE_OP,D); DumpByte(SIZE_B,D); DumpByte(sizeof(Number),D); DumpNumber(TEST_NUMBER,D); }
static void DumpConstants(const Proto* f, DumpState* D) { int i,n; DumpInt(n=f->sizek,D); for (i=0; i<n; i++) { const TObject* o=&f->k[i]; DumpByte(ttype(o),D); switch (ttype(o)) { case LUA_TNUMBER: DumpNumber(nvalue(o),D); break; case LUA_TSTRING: DumpString(tsvalue(o),D); break; case LUA_TNIL: break; default: lua_assert(0); /* cannot happen */ break; } } DumpInt(n=f->sizep,D); for (i=0; i<n; i++) DumpFunction(f->p[i],f->source,D); }
static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { if (D->strip || f->source == psource) DumpString(NULL, D); /* no debug info or same source as its parent */ else DumpString(f->source, D); DumpInt(f->linedefined, D); DumpInt(f->lastlinedefined, D); DumpByte(f->numparams, D); DumpByte(f->is_vararg, D); DumpByte(f->maxstacksize, D); DumpCode(f, D); DumpConstants(f, D); DumpUpvalues(f, D); DumpProtos(f, D); DumpDebug(f, D); }
int clsDump::DumpConst(clsConst * pConst, int onlyCalculateSize) { int iSize = 0; unsigned int iIndex; iSize += DumpLine("----- CONST BEG -----\n", onlyCalculateSize); iSize += DumpLine("\tUID %u\n", pConst->m_UID, onlyCalculateSize); iSize += DumpLine("\tData Type UID %u\n", pConst->m_pDataType->m_UID, onlyCalculateSize); iSize += DumpLine("\tConst Width: %u\n", pConst->m_pDataType->m_iWidth, onlyCalculateSize); for (iIndex = 0; iIndex < pConst->m_pDataType->m_iWidth; ++iIndex) { iSize += DumpByte("\tBits: %u\n", pConst->m_sBits[iIndex], onlyCalculateSize); } iSize += DumpByte("\tBits End: %u\n", '\0', onlyCalculateSize); iSize += DumpLine("----- CONST END -----\n", onlyCalculateSize); return iSize; }
void TRsReadTester::DumpBytes(const TAny* aPtr,TInt aLen) { TUint8* src=(TUint8*)aPtr; TBuf<100> whole; TUint8* tar=(TUint8*)whole.Ptr(); TInt len=0; while (aLen--) { TUint val=(*src++); TUint top=val/16; TUint bottom=val%16; *tar++=DumpByte(top); *tar++=DumpByte(bottom); *tar++=' '; len+=3; } whole.SetLength(len); test.Printf(whole); test.Printf(_L("\r\n")); }
/* ** dump Lua function as precompiled chunk */ int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, int strip) { DumpState D; D.L = L; D.writer = w; D.data = data; D.strip = strip; D.status = 0; DumpHeader(&D); DumpByte(f->sizeupvalues, &D); DumpFunction(f, NULL, &D); return D.status; }
static void DumpFunction(const Proto* tf, void* D) { DumpString(tf->source,D); DumpInt(tf->lineDefined,D); DumpInt(tf->numparams,D); DumpByte(tf->is_vararg,D); DumpInt(tf->maxstacksize,D); DumpLocals(tf,D); DumpLines(tf,D); DumpConstants(tf,D); DumpCode(tf,D); }
static void DumpDebug (const Proto *f, DumpState *D) { int i, n; n = (D->strip) ? 0 : f->sizelineinfo; DumpInt(n, D); DumpVector(f->lineinfo, n, D); /* n = (D->strip) ? 0 : f->sizelocvars; */ n = f->sizelocvars; DumpInt(n, D); for (i = 0; i < n; i++) { DumpString((D->strip) ? NULL : f->locvars[i].varname, D); DumpInt(f->locvars[i].startpc, D); DumpInt(f->locvars[i].endpc, D); DumpByte(f->locvars[i].ravi_type, D); } /* n = (D->strip) ? 0 : f->sizeupvalues; */ n = f->sizeupvalues; DumpInt(n, D); for (i = 0; i < n; i++) { DumpString((D->strip) ? NULL : f->upvalues[i].name, D); DumpByte(f->upvalues[i].type, D); } }
static void DumpHeader (DumpState *D) { DumpLiteral(LUA_SIGNATURE, D); DumpByte(LUAC_VERSION, D); DumpByte(LUAC_FORMAT, D); DumpLiteral(LUAC_DATA, D); DumpByte(sizeof(int), D); DumpByte(sizeof(size_t), D); DumpByte(sizeof(Instruction), D); DumpByte(sizeof(lua_Integer), D); DumpByte(sizeof(lua_Number), D); DumpInteger(LUAC_INT, D); DumpNumber(LUAC_NUM, D); }
void DumpWORD(FILE *flp, short word) { char byte; short wordswp; wordswp = swap2bytes(word); for (unsigned int i = 0; i < sizeof(WORD); i++) { memcpy(&byte, (char*)&wordswp + i, 1); DumpByte(flp, &byte); fprintf(flp, " "); } }
static void DumpFunction(const Proto* tf, FILE* D) { DumpString(tf->source,D); DumpInt(tf->lineDefined,D); DumpInt(tf->numparams,D); DumpByte(tf->is_vararg,D); DumpInt(tf->maxstacksize,D); DumpLocals(tf,D); DumpLines(tf,D); DumpConstants(tf,D); DumpCode(tf,D); if (ferror(D)) { perror("luac: write error"); exit(1); } }
static int DumpVolumeHeader(int dumpfd, register Volume * vp) { int code = 0; if (verbose) fprintf(stderr, "dumping volume header\n"); if (!code) code = DumpTag(dumpfd, D_VOLUMEHEADER); if (!code) code = DumpInt32(dumpfd, 'i', V_id(vp)); if (!code) code = DumpInt32(dumpfd, 'v', V_stamp(vp).version); if (!code) code = DumpString(dumpfd, 'n', V_name(vp)); if (!code) code = DumpBool(dumpfd, 's', V_inService(vp)); if (!code) code = DumpBool(dumpfd, 'b', V_blessed(vp)); if (!code) code = DumpInt32(dumpfd, 'u', V_uniquifier(vp)); if (!code) code = DumpByte(dumpfd, 't', (byte) V_type(vp)); if (!code) code = DumpInt32(dumpfd, 'p', V_parentId(vp)); if (!code) code = DumpInt32(dumpfd, 'c', V_cloneId(vp)); if (!code) code = DumpInt32(dumpfd, 'q', V_maxquota(vp)); if (!code) code = DumpInt32(dumpfd, 'm', V_minquota(vp)); if (!code) code = DumpInt32(dumpfd, 'd', V_diskused(vp)); if (!code) code = DumpInt32(dumpfd, 'f', V_filecount(vp)); if (!code) code = DumpInt32(dumpfd, 'a', V_accountNumber(vp)); if (!code) code = DumpInt32(dumpfd, 'o', V_owner(vp)); if (!code) code = DumpInt32(dumpfd, 'C', V_creationDate(vp)); /* Rw volume creation date */ if (!code) code = DumpInt32(dumpfd, 'A', V_accessDate(vp)); if (!code) code = DumpInt32(dumpfd, 'U', V_updateDate(vp)); if (!code) code = DumpInt32(dumpfd, 'E', V_expirationDate(vp)); if (!code) code = DumpInt32(dumpfd, 'B', V_backupDate(vp)); /* Rw volume backup clone date */ if (!code) code = DumpString(dumpfd, 'O', V_offlineMessage(vp)); /* * We do NOT dump the detailed volume statistics residing in the old * motd field, since we cannot tell from the info in a dump whether * statistics data has been put there. Instead, we dump a null string, * just as if that was what the motd contained. */ if (!code) code = DumpString(dumpfd, 'M', ""); if (!code) code = DumpArrayInt32(dumpfd, 'W', (afs_uint32 *) V_weekUse(vp), sizeof(V_weekUse(vp)) / sizeof(V_weekUse(vp)[0])); if (!code) code = DumpInt32(dumpfd, 'D', V_dayUseDate(vp)); if (!code) code = DumpInt32(dumpfd, 'Z', V_dayUse(vp)); if (!code) code = DumpInt32(dumpfd, 'V', V_volUpCounter(vp)); return code; }
static int DumpVnode(int dumpfd, struct VnodeDiskObject *v, int volid, int vnodeNumber, int dumpEverything, struct Volume *vp) { int code = 0; IHandle_t *ihP; FdHandle_t *fdP; if (verbose) fprintf(stderr, "dumping vnode %d\n", vnodeNumber); if (!v || v->type == vNull) return code; if (!code) code = DumpDouble(dumpfd, D_VNODE, vnodeNumber, v->uniquifier); if (!dumpEverything) return code; if (!code) code = DumpByte(dumpfd, 't', (byte) v->type); if (!code) code = DumpShort(dumpfd, 'l', v->linkCount); /* May not need this */ if (!code) code = DumpInt32(dumpfd, 'v', v->dataVersion); if (!code) code = DumpInt32(dumpfd, 'm', v->unixModifyTime); if (!code) code = DumpInt32(dumpfd, 'a', v->author); if (!code) code = DumpInt32(dumpfd, 'o', v->owner); if (!code && v->group) code = DumpInt32(dumpfd, 'g', v->group); /* default group is 0 */ if (!code) code = DumpShort(dumpfd, 'b', v->modeBits); if (!code) code = DumpInt32(dumpfd, 'p', v->parent); if (!code) code = DumpInt32(dumpfd, 's', v->serverModifyTime); if (v->type == vDirectory) { acl_HtonACL(VVnodeDiskACL(v)); if (!code) code = DumpByteString(dumpfd, 'A', (byte *) VVnodeDiskACL(v), VAclDiskSize(v)); } if (VNDISK_GET_INO(v)) { IH_INIT(ihP, V_device(vp), V_parentId(vp), VNDISK_GET_INO(v)); fdP = IH_OPEN(ihP); if (fdP == NULL) { fprintf(stderr, "Unable to open inode %s for vnode %u (volume %i); not dumped, error %d\n", PrintInode(NULL, VNDISK_GET_INO(v)), vnodeNumber, volid, errno); } else { if (verbose) fprintf(stderr, "about to dump inode %s for vnode %u\n", PrintInode(NULL, VNDISK_GET_INO(v)), vnodeNumber); code = DumpFile(dumpfd, vnodeNumber, fdP, v); FDH_CLOSE(fdP); } IH_RELEASE(ihP); } if (verbose) fprintf(stderr, "done dumping vnode %d\n", vnodeNumber); return code; }