static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); #if 0 return load_aux(L, luaL_loadfile(L, fname)); #else return load_aux(L, luaL_loadfsfile(L, fname)); #endif }
static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); const char *mode = luaL_optstring(L, 2, NULL); int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ int status = luaL_loadfilex(L, fname, mode); return load_aux(L, status, env); }
static int luaB_loadstring (lua_State *L) { size_t l; const char *s = luaL_checklstring(L, 1, &l); const char *chunkname = luaL_optstring(L, 2, s); return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); }
static int luaB_load (lua_State *L) { int status; size_t l; int top = lua_gettop(L); const char *s = lua_tolstring(L, 1, &l); const char *mode = luaL_optstring(L, 3, "bt"); if (s != NULL) { /* loading a string? */ const char *chunkname = luaL_optstring(L, 2, s); status = (checkrights(L, mode, s) != NULL) || luaL_loadbuffer(L, s, l, chunkname); } else { /* loading from a reader function */ const char *chunkname = luaL_optstring(L, 2, "=(load)"); loaddata ld; ld.mode = mode; luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, RESERVEDSLOT); /* create reserved slot */ status = lua_load(L, generic_reader, &ld, chunkname); } if (status == LUA_OK && top >= 4) { /* is there an 'env' argument */ lua_pushvalue(L, 4); /* environment for loaded function */ lua_setupvalue(L, -2, 1); /* set it as 1st upvalue */ } return load_aux(L, status); }
static int luaB_load (lua_State *L) { int status; const char *cname = luaL_optstring(L, 2, "=(load)"); luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ status = lua_load(L, generic_reader, NULL, cname); return load_aux(L, status); }
static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); const char *mode = luaL_optstring(L, 2, NULL); int env = !lua_isnone(L, 3); /* 'env' parameter? */ int status = luaL_loadfilex(L, fname, mode); if (status == LUA_OK && env) { /* 'env' parameter? */ lua_pushvalue(L, 3); lua_setupvalue(L, -2, 1); /* set it as 1st upvalue of loaded chunk */ } return load_aux(L, status); }
static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); const char *mode = luaL_optstring(L, 2, NULL); int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ #if defined( LUA_USES_LOADF ) int status = luaL_loadfilex(L, fname, mode); #else int status = luaL_loadfsfilex(L, fname, mode); #endif return load_aux(L, status, env); }
/* Load a value from memory. Loads of more than 8 byte are split into a series of 8-byte loads and combined using appropriate IROps. */ static IRExpr * load(IREndness endian, IRType type, HWord haddr) { IROp concat; IRExpr *addr, *next_addr; vassert(type == Ity_I1 || sizeofIRType(type) <= 16); if (VEX_HOST_WORDSIZE == 8) { addr = mkU64(haddr); next_addr = binop(Iop_Add64, addr, mkU64(8)); } else if (VEX_HOST_WORDSIZE == 4) { addr = mkU32(haddr); next_addr = binop(Iop_Add32, addr, mkU32(8)); } else { vpanic("invalid #bytes for address"); } switch (type) { case Ity_I128: concat = Iop_64HLto128; type = Ity_I64; goto load128; case Ity_F128: concat = Iop_F64HLtoF128; type = Ity_F64; goto load128; case Ity_D128: concat = Iop_D64HLtoD128; type = Ity_D64; goto load128; load128: /* Two loads of 64 bit each. */ if (endian == Iend_BE) { /* The more significant bits are at the lower address. */ return binop(concat, load_aux(endian, type, addr), load_aux(endian, type, next_addr)); } else { /* The more significant bits are at the higher address. */ return binop(concat, load_aux(endian, type, next_addr), load_aux(endian, type, addr)); } default: return load_aux(endian, type, addr); } }
static int luaB_load (lua_State *L) { int status; size_t l; const char *s = lua_tolstring(L, 1, &l); const char *mode = luaL_optstring(L, 3, "bt"); int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ if (s != NULL) { /* loading a string? */ const char *chunkname = luaL_optstring(L, 2, s); status = luaL_loadbufferx(L, s, l, chunkname, mode); } else { /* loading from a reader function */ const char *chunkname = luaL_optstring(L, 2, "=(load)"); luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, RESERVEDSLOT); /* create reserved slot */ status = lua_load(L, generic_reader, NULL, chunkname, mode); } return load_aux(L, status, env); }
static int luaB_load_aux (lua_State *L, int farg) { int status; Readstat stat; size_t l; const char *s = lua_tolstring(L, farg, &l); stat.mode = luaL_optstring(L, farg + 2, "bt"); if (s != NULL) { /* loading a string? */ const char *chunkname = luaL_optstring(L, farg + 1, s); status = (checkrights(L, stat.mode, s) != NULL) || luaL_loadbuffer(L, s, l, chunkname); } else { /* loading from a reader function */ const char *chunkname = luaL_optstring(L, farg + 1, "=(load)"); luaL_checktype(L, farg, LUA_TFUNCTION); stat.f = farg; lua_settop(L, RESERVEDSLOT); /* create reserved slot */ status = lua_load(L, generic_reader, &stat, chunkname); } return load_aux(L, status); }
void SDArrayCompress::load(InpArchive &ar) { ar.loadclass("SDArray_Compress"); cbits.load(ar.var("compressed_bits")); load_aux(ar.var("aux"), &cbits); ar.endclass(); }
static int luaB_loadfile (lua_State *L) { const char *fname = luaL_op_string(L, 1, NULL); return load_aux(L, luaL_loadfile(L, fname)); }