本文整理汇总了C++中LoadBlock函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadBlock函数的具体用法?C++ LoadBlock怎么用?C++ LoadBlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadBlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
示例2: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h, '=');
LoadBlock(S,s,LUAC_HEADERSIZE);
S->swap=(s[6]!=h[6]); s[6]=h[6];
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
示例3: LoadMem
static void LoadMem (LoadState* S, void* b, int n, size_t size)
{
LoadBlock(S,b,n*size);
if (S->swap && b)
{
char* p=(char*) b;
char c;
switch (size)
{
case 1:
break;
case 2:
while (n--)
{
c=p[0];
p[0]=p[1];
p[1]=c;
p+=2;
}
break;
case 4:
while (n--)
{
c=p[0];
p[0]=p[3];
p[3]=c;
c=p[1];
p[1]=p[2];
p[2]=c;
p+=4;
}
break;
case 8:
while (n--)
{
c=p[0];
p[0]=p[7];
p[7]=c;
c=p[1];
p[1]=p[6];
p[6]=c;
c=p[2];
p[2]=p[5];
p[5]=c;
c=p[3];
p[3]=p[4];
p[4]=c;
p+=8;
}
break;
default:
IF(1, "bad size");
break;
}
}
}
示例4: XERROR
BOOL XBaseProp::Load( LPCTSTR szFilename, XE::xtENCODING encode )
{
CToken token;
if( token.LoadFile( szFilename, XE::TXT_UTF16 ) == xFAIL )
{
XERROR( "%s 읽기 실패", szFilename );
return FALSE;
}
return LoadBlock( token, NULL, NULL );
}
示例5: fin
void BufferManager::LoadTable(Table table){
string filename=table.name+".table";
fstream fin(filename.c_str(),ios::in);
for(int i=0;i<table.blockNum;i++)
if(IfinBuffer(filename,i)==-1){
int bufferID=GetEmptyBlockExcept(filename);
LoadBlock(filename,i,bufferID);
}
fin.close();
}
示例6: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h);
if ( h[8] > SIZE_T_PRECOMPILED_CHUNK )
h[8] = SIZE_T_PRECOMPILED_CHUNK;
LoadBlock(S,s,LUAC_HEADERSIZE);
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
示例7: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
S->flip = h[ENDIAN_OFFSET] != s[ENDIAN_OFFSET];
s[ENDIAN_OFFSET] = h[ENDIAN_OFFSET];
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
示例8: LoadString
static TString* LoadString(LoadState* S)
{
int32_t size;
LoadVar(S,size);
if (size==0)
return NULL;
else
{
char* s;
if (!luaZ_direct_mode(S->Z)) {
s = luaZ_openspace(S->L,S->b,size);
LoadBlock(S,s,size);
return luaS_newlstr(S->L,s,size-1); /* remove trailing zero */
} else {
s = (char*)luaZ_get_crt_address(S->Z);
LoadBlock(S,NULL,size);
return luaS_newrolstr(S->L,s,size-1);
}
}
}
示例9: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
#ifdef LUAC_SWAP_ON_LOAD
S->swap=(s[6]!=h[6]); s[6]=h[6];
#endif
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
示例10: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
if (memcmp(h,s,N0)==0) return;
if (memcmp(h,s,N1)!=0) error(S,"not a");
if (memcmp(h,s,N2)!=0) error(S,"version mismatch in");
if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted");
}
示例11: LoadString
static TString* LoadString(LoadState* S)
{
int size=LoadInt(S);
if (size==0)
return NULL;
else
{
char* s=luaZ_openspace(S->L,S->b,size);
LoadBlock(S,s,size);
return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
}
}
示例12: LoadString
static TString* LoadString (lua_State* L, ZIO* Z, int swap)
{
size_t size=LoadSize(L,Z,swap);
if (size==0)
return NULL;
else
{
char* s=luaO_openspace(L,size);
LoadBlock(L,s,size,Z,0);
return luaS_newlstr(L,s,size-1); /* remove trailing '\0' */
}
}
示例13: LoadDebug
static void LoadDebug(LoadState* S, Proto* f)
{
int i,n;
n=LoadInt(S);
Align4(S);
#ifdef LUA_OPTIMIZE_DEBUG
if(n) {
if (!luaZ_direct_mode(S->Z)) {
f->packedlineinfo=luaM_newvector(S->L,n,unsigned char);
LoadBlock(S,f->packedlineinfo,n);
} else {
示例14: LoadHeader
static void LoadHeader(LoadState* S)
{
lu_byte h[LUAC_HEADERSIZE];
lu_byte s[LUAC_HEADERSIZE];
luaU_header(h);
memcpy(s,h,sizeof(char)); /* first char already read */
LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char));
if (memcmp(h,s,N0)==0) return;
if (memcmp(h,s,N1)!=0) error(S,"not a");
if (memcmp(h,s,N2)!=0) error(S,"version mismatch in");
if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted");
}
示例15: LoadHeader
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
int intck = (((lua_Number)0.5)==0); /* 0=float, 1=int */
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
S->swap=(s[6]!=h[6]); s[6]=h[6]; /* Check if byte-swapping is needed */
S->numsize=h[10]=s[10]; /* length of lua_Number */
S->toflt=(s[11]>intck); /* check if conversion from int lua_Number to flt is needed */
if(S->toflt) s[11]=h[11];
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}