本文整理汇总了C++中setsvalue函数的典型用法代码示例。如果您正苦于以下问题:C++ setsvalue函数的具体用法?C++ setsvalue怎么用?C++ setsvalue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setsvalue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ktap_init_arguments
static void ktap_init_arguments(ktap_state *ks, int argc, char **argv)
{
const ktap_value *gt = kp_table_getint(hvalue(&G(ks)->registry),
KTAP_RIDX_GLOBALS);
ktap_table *global_tbl = hvalue(gt);
ktap_table *arg_tbl = kp_table_new(ks);
ktap_value arg_tblval;
ktap_value arg_tsval;
int i;
setsvalue(&arg_tsval, kp_tstring_new(ks, "arg"));
sethvalue(&arg_tblval, arg_tbl);
kp_table_setvalue(ks, global_tbl, &arg_tsval, &arg_tblval);
if (!argc)
return;
kp_table_resize(ks, arg_tbl, 100, 100);
for (i = 0; i < argc; i++) {
int res;
ktap_value val;
if (!kstrtoint(argv[i], 10, &res)) {
setnvalue(&val, res);
} else
setsvalue(&val, kp_tstring_new(ks, argv[i]));
kp_table_setint(ks, arg_tbl, i, &val);
}
}
开发者ID:joelagnel,项目名称:ktap,代码行数:31,代码来源:vm.c
示例2: kp_register_lib
/* function for register library */
void kp_register_lib(ktap_state *ks, const char *libname, const ktap_Reg *funcs)
{
int i;
ktap_table *target_tbl;
const ktap_value *gt = kp_table_getint(hvalue(&G(ks)->registry),
KTAP_RIDX_GLOBALS);
/* lib is null when register baselib function */
if (libname == NULL)
target_tbl = hvalue(gt);
else {
ktap_value key, val;
target_tbl = kp_table_new(ks);
kp_table_resize(ks, target_tbl, 0,
sizeof(*funcs) / sizeof(ktap_Reg));
setsvalue(&key, kp_tstring_new(ks, libname));
sethvalue(&val, target_tbl);
kp_table_setvalue(ks, hvalue(gt), &key, &val);
}
for (i = 0; funcs[i].name != NULL; i++) {
ktap_value func_name, cl;
setsvalue(&func_name, kp_tstring_new(ks, funcs[i].name));
setfvalue(&cl, funcs[i].func);
kp_table_setvalue(ks, target_tbl, &func_name, &cl);
cfunction_cache_add(ks, &cl);
}
}
开发者ID:joelagnel,项目名称:ktap,代码行数:33,代码来源:vm.c
示例3: ktap_lib_execname
static int ktap_lib_execname(ktap_State *ks)
{
Tstring *ts = kp_tstring_new(ks, current->comm);
setsvalue(ks->top, ts);
incr_top(ks);
return 1;
}
开发者ID:WeiY,项目名称:ktap,代码行数:7,代码来源:baselib.c
示例4: luaK_stringK
int luaK_stringK(FuncState *fs, TString *s)
{
TValue o;
setsvalue(fs->ls->L, &o, s);
return addk(fs, &o, &o);
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:7,代码来源:lcode.c
示例5: event_regstr
/* support other architecture pt_regs showing */
static void event_regstr(ktap_state *ks, struct ktap_event *e, StkId ra)
{
struct pt_regs *regs = e->regs;
char str[256] = {0};
#if defined(CONFIG_X86_32)
snprintf(str, sizeof(str),
"{ax: 0x%lx, orig_ax: 0x%lx, bx: 0x%lx, cx: 0x%lx, dx: 0x%lx, "
"si: 0x%lx, di: 0x%lx, bp: 0x%lx, ds: 0x%lx, es: 0x%lx, fs: 0x%lx, "
"gs: 0x%lx, ip: 0x%lx, cs: 0x%lx, flags: 0x%lx, sp: 0x%lx, ss: 0x%lx}\n",
regs->ax, regs->orig_ax, regs->bx, regs->cx, regs->dx,
regs->si, regs->di, regs->bp, regs->ds, regs->es, regs->fs,
regs->gs, regs->ip, regs->cs, regs->flags, regs->sp, regs->ss);
#elif defined(CONFIG_X86_64)
/* x86_64 pt_regs doesn't have ds, es, fs or gs. */
snprintf(str, sizeof(str),
"{ax: 0x%lx, orig_ax: 0x%lx, bx: 0x%lx, cx: 0x%lx, dx: 0x%lx, "
"si: 0x%lx, di: 0x%lx, r8: 0x%lx, r9: 0x%lx, r10: 0x%lx, r11: 0x%lx, "
"r12: 0x%lx, r13: 0x%lx, r14: 0x%lx, r15: 0x%lx, bp: 0x%lx, ip: 0x%lx, "
"cs: 0x%lx, flags: 0x%lx, sp: 0x%lx, ss: 0x%lx}\n",
regs->ax, regs->orig_ax, regs->bx, regs->cx, regs->dx,
regs->si, regs->di, regs->r8, regs->r9, regs->r10, regs->r11,
regs->r12, regs->r13, regs->r14, regs->r15, regs->bp, regs->ip,
regs->cs, regs->flags, regs->sp, regs->ss);
#endif
setsvalue(ra, kp_tstring_new_local(ks, str));
}
开发者ID:andradeandrey,项目名称:ktap,代码行数:28,代码来源:kdebug.c
示例6: codegen_stringK
int codegen_stringK(FuncState *fs, Tstring *s)
{
Tvalue o;
setsvalue(&o, s);
return addk(fs, &o, &o);
}
开发者ID:WeiY,项目名称:ktap,代码行数:7,代码来源:code.c
示例7: codegen_stringK
int codegen_stringK(ktap_funcstate *fs, ktap_string *s)
{
ktap_value o;
setsvalue(&o, s);
return addk(fs, &o, &o);
}
开发者ID:unixbhaskar,项目名称:ktap,代码行数:7,代码来源:code.c
示例8: load_constants
static int load_constants(struct load_state *S, ktap_proto *f)
{
int i,n;
n = READ_INT(S);
f->sizek = n;
f->k = NEW_VECTOR(S, n * sizeof(ktap_value));
for (i = 0; i < n; i++)
setnilvalue(&f->k[i]);
for (i=0; i < n; i++) {
ktap_value *o = &f->k[i];
int t = READ_CHAR(S);
switch (t) {
case KTAP_TNIL:
setnilvalue(o);
break;
case KTAP_TBOOLEAN:
setbvalue(o, READ_CHAR(S));
break;
case KTAP_TNUMBER:
/*
* todo: kernel not support fp, check double when
* loading
*/
setnvalue(o, READ_NUMBER(S));
break;
case KTAP_TSTRING:
setsvalue(o, READ_STRING(S));
break;
default:
kp_error(S->ks, "ktap: load_constants: "
"unknow ktap_value\n");
return -1;
}
}
n = READ_INT(S);
f->p = NEW_VECTOR(S, n * sizeof(ktap_proto));
f->sizep = n;
for (i = 0; i < n; i++)
f->p[i] = NULL;
for (i = 0; i < n; i++) {
f->p[i] = kp_newproto(S->ks);
if (load_function(S, f->p[i]))
return -1;
}
return 0;
}
开发者ID:rousya,项目名称:ktap,代码行数:53,代码来源:loader.c
示例9: luaR_next_helper
static void luaR_next_helper(lua_State *L, const luaR_entry *pentries, int pos, TValue *key, TValue *val) {
setnilvalue(key);
setnilvalue(val);
if (pentries[pos].key.type != LUA_TNIL) {
/* Found an entry */
if (pentries[pos].key.type == LUA_TSTRING)
setsvalue(L, key, luaS_newro(L, pentries[pos].key.id.strkey))
else
setnvalue(key, (lua_Number)pentries[pos].key.id.numkey)
setobj2s(L, val, &pentries[pos].value);
}
}
开发者ID:Theemuts,项目名称:eLuaBrain,代码行数:12,代码来源:lrotable.c
示例10: luaK_stringK
int luaK_stringK (FuncState *fs, TString *s) {
TValue o;
#if LUA_REFCOUNT
lua_State *L = fs->L;
int ret;
setsvalue2n(fs->L, &o, s);
ret = addk(fs, &o, &o);
setnilvalue(&o);
return ret;
#else
setsvalue(fs->L, &o, s);
return addk(fs, &o, &o);
#endif /* LUA_REFCOUNT */
}
开发者ID:henryfung01,项目名称:GameCode4,代码行数:14,代码来源:lcode.c
示例11: luaK_numberK
int luaK_numberK (FuncState *fs, lua_Number r) {
int n;
lua_State *L = fs->ls->L;
TValue o;
setnvalue(&o, r);
if (r == 0 || luai_numisnan(NULL, r)) { /* handle -0 and NaN */
/* use raw representation as key to avoid numeric problems */
setsvalue(L, L->top++, luaS_newlstr(L, (char *)&r, sizeof(r)));
n = addk(fs, L->top - 1, &o);
L->top--;
}
else
n = addk(fs, &o, &o); /* regular case */
return n;
}
开发者ID:0x7F800000,项目名称:Aleph-NONE,代码行数:15,代码来源:lcode.c
示例12: ktap_lib_user_string
static int ktap_lib_user_string(ktap_State *ks)
{
unsigned long addr = nvalue(GetArg(ks, 1));
char str[256] = {0};
int ret;
pagefault_disable();
ret = __copy_from_user_inatomic((void *)str, (const void *)addr, 256);
(void) &ret; /* Silence compiler warning. */
pagefault_enable();
str[255] = '\0';
setsvalue(ks->top, kp_tstring_new(ks, str));
incr_top(ks);
return 1;
}
开发者ID:WeiY,项目名称:ktap,代码行数:16,代码来源:baselib.c
示例13: codegen_numberK
int codegen_numberK(FuncState *fs, ktap_Number r)
{
int n;
Tvalue o, s;
setnvalue(&o, r);
if (r == 0 || ktap_numisnan(NULL, r)) { /* handle -0 and NaN */
/* use raw representation as key to avoid numeric problems */
setsvalue(&s, ktapc_ts_newlstr((char *)&r, sizeof(r)));
// incr_top(L);
n = addk(fs, &s, &o);
// L->top--;
} else
n = addk(fs, &o, &o); /* regular case */
return n;
}
开发者ID:WeiY,项目名称:ktap,代码行数:16,代码来源:code.c
示例14: addk
static int addk (FuncState *fs, TValue *k, TValue *v) {
lua_State *L = fs->L;
TValue *idx = luaH_set(L, fs->h, k);
#ifdef LUA_TINT
/* Note: Integer-valued LUA_TNUMBER's are handled as in unpatched Lua (below)
*/
if (ttype(idx)==LUA_TINT) {
int i;
# ifdef LNUM_INT64
lua_assert( (int)ivalue(idx) == ivalue(idx) ); /* make sure no data is lost in the casting */
# endif
i= (int)ivalue(idx);
lua_assert(luaO_rawequalObj(&fs->f->k[i], v));
return i;
}
else if (ttype(idx)==LUA_TNUMBER) {
#else
if (ttisnumber(idx)) {
#endif
int i= cast_int(nvalue_fast(idx));
lua_assert(luaO_rawequalObj(&fs->f->k[i], v));
return i;
}
else { /* constant not found; create a new entry */
Proto *f = fs->f;
int oldsize = f->sizek;
setivalue(idx, fs->nk);
luaM_growvector(L, f->k, fs->nk, f->sizek, TValue,
MAXARG_Bx, "constant table overflow");
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
setobj(L, &f->k[fs->nk], v);
luaC_barrier(L, f, v);
return fs->nk++;
}
}
int luaK_stringK (FuncState *fs, TString *s) {
TValue o;
setsvalue(fs->L, &o, s);
return addk(fs, &o, &o);
}
开发者ID:7568168,项目名称:cheat-engine,代码行数:42,代码来源:lcode.c
示例15: ktap_concat
static void ktap_concat(ktap_state *ks, int start, int end)
{
int i, len = 0;
StkId top = ks->ci->u.l.base;
ktap_string *ts;
char *ptr, *buffer;
for (i = start; i <= end; i++) {
if (!ttisstring(top + i)) {
kp_error(ks, "cannot concat non-string\n");
setnilvalue(top + start);
return;
}
len += rawtsvalue(top + i)->tsv.len;
}
if (len >= KTAP_PERCPU_BUFFER_SIZE) {
kp_error(ks, "Error: too long string concatenation\n");
return;
}
preempt_disable_notrace();
buffer = kp_percpu_data(KTAP_PERCPU_DATA_BUFFER);
ptr = buffer;
for (i = start; i <= end; i++) {
int len = rawtsvalue(top + i)->tsv.len;
strncpy(ptr, svalue(top + i), len);
ptr += len;
}
ts = kp_tstring_newlstr(ks, buffer, len);
setsvalue(top + start, ts);
preempt_enable_notrace();
}
开发者ID:joelagnel,项目名称:ktap,代码行数:37,代码来源:vm.c
示例16: setsvalue
void MCExecPoint::setstaticbytes(const void *p_bytes, uindex_t p_length)
{
setsvalue(MCString((const char *)p_bytes, p_length));
}
开发者ID:bduck,项目名称:livecode,代码行数:4,代码来源:execpt.cpp
示例17: luaK_stringK
/*
** Add a string to list of constants and return its index.
*/
int luaK_stringK (FuncState *fs, TString *s) {
TValue o;
setsvalue(fs->ls->L, &o, s);
return addk(fs, &o, &o); /* use string itself as key */
}
开发者ID:celskeggs,项目名称:selkie,代码行数:8,代码来源:lcode.c
示例18: ktap_execute
//.........这里部分代码省略.........
/*go through */
case OP_TFORLOOP:
if (!ttisnil(ra + 1)) { /* continue loop? */
setobj(ra, ra + 1); /* save control variable */
ci->u.l.savedpc += GETARG_sBx(instr); /* jump back */
}
break;
case OP_SETLIST: {
int n = GETARG_B(instr);
int c = GETARG_C(instr);
int last;
ktap_table *h;
if (n == 0)
n = (int)(ks->top - ra) - 1;
if (c == 0)
c = GETARG_Ax(*ci->u.l.savedpc++);
h = hvalue(ra);
last = ((c - 1) * LFIELDS_PER_FLUSH) + n;
if (last > h->sizearray) /* needs more space? */
kp_table_resizearray(ks, h, last);
for (; n > 0; n--) {
ktap_value *val = ra+n;
kp_table_setint(ks, h, last--, val);
}
/* correct top (in case of previous open call) */
ks->top = ci->top;
break;
}
case OP_CLOSURE: {
/* need to use closure cache? (multithread contention issue)*/
ktap_proto *p = cl->p->p[GETARG_Bx(instr)];
pushclosure(ks, p, cl->upvals, base, ra);
break;
}
case OP_VARARG: {
int b = GETARG_B(instr) - 1;
int j;
int n = (int)(base - ci->func) - cl->p->numparams - 1;
if (b < 0) { /* B == 0? */
b = n; /* get all var. arguments */
checkstack(ks, n);
/* previous call may change the stack */
ra = RA(instr);
ks->top = ra + n;
}
for (j = 0; j < b; j++) {
if (j < n) {
setobj(ra + j, base - n + j);
} else
setnilvalue(ra + j);
}
break;
}
case OP_EXTRAARG:
return;
case OP_EVENT: {
struct ktap_event *e = ks->current_event;
if (unlikely(!e)) {
kp_error(ks, "invalid event context\n");
return;
}
setevalue(ra, e);
break;
}
case OP_EVENTNAME: {
struct ktap_event *e = ks->current_event;
if (unlikely(!e)) {
kp_error(ks, "invalid event context\n");
return;
}
setsvalue(ra, kp_tstring_new(ks, e->call->name));
break;
}
case OP_EVENTARG:
if (unlikely(!ks->current_event)) {
kp_error(ks, "invalid event context\n");
return;
}
kp_event_getarg(ks, ra, GETARG_B(instr));
break;
case OP_LOAD_GLOBAL: {
ktap_value *cfunc = cfunction_cache_get(ks, GETARG_C(instr));
setobj(ra, cfunc);
}
break;
case OP_EXIT:
return;
}
goto mainloop;
}
开发者ID:joelagnel,项目名称:ktap,代码行数:101,代码来源:vm.c
示例19: luaK_stringK
int ICACHE_FLASH_ATTR luaK_stringK (FuncState *fs, TString *s) {
TValue o;
setsvalue(fs->L, &o, s);
return addk(fs, &o, &o);
}
开发者ID:Squonk42,项目名称:nodelua,代码行数:5,代码来源:lcode.c
示例20: pushstring
static void pushstring(lua_State *L, TString *s)
{
TValue o;
setsvalue(L, &o, s);
LIF(A,pushobject)(L, &o);
}
开发者ID:JakSprats,项目名称:Alchemy-Database,代码行数:6,代码来源:pluto.c
注:本文中的setsvalue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论