本文整理汇总了C++中pvalue函数的典型用法代码示例。如果您正苦于以下问题:C++ pvalue函数的具体用法?C++ pvalue怎么用?C++ pvalue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pvalue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: kp_equalobjv
/*
* equality of ktap values. ks == NULL means raw equality
*/
int kp_equalobjv(ktap_State *ks, const Tvalue *t1, const Tvalue *t2)
{
switch (ttype(t1)) {
case KTAP_TNIL:
return 1;
case KTAP_TNUMBER:
return nvalue(t1) == nvalue(t2);
case KTAP_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case KTAP_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2);
case KTAP_TLCF:
return fvalue(t1) == fvalue(t2);
case KTAP_TSHRSTR:
return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
case KTAP_TLNGSTR:
return kp_tstring_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
case KTAP_TUSERDATA:
if (uvalue(t1) == uvalue(t2))
return 1;
else if (ks == NULL)
return 0;
case KTAP_TTABLE:
if (hvalue(t1) == hvalue(t2))
return 1;
else if (ks == NULL)
return 0;
default:
return gcvalue(t1) == gcvalue(t2);
}
return 0;
}
开发者ID:eric-zhu,项目名称:ktap,代码行数:36,代码来源:object.c
示例2: kp_obj_equal
/*
* equality of ktap values. ks == NULL means raw equality
*/
int kp_obj_equal(ktap_state *ks, const ktap_value *t1, const ktap_value *t2)
{
switch (ttype(t1)) {
case KTAP_TYPE_NIL:
return 1;
case KTAP_TYPE_NUMBER:
return nvalue(t1) == nvalue(t2);
case KTAP_TYPE_BOOLEAN:
return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case KTAP_TYPE_LIGHTUSERDATA:
return pvalue(t1) == pvalue(t2);
case KTAP_TYPE_CFUNCTION:
return fvalue(t1) == fvalue(t2);
case KTAP_TYPE_SHRSTR:
return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
case KTAP_TYPE_LNGSTR:
return kp_str_eqlng(rawtsvalue(t1), rawtsvalue(t2));
case KTAP_TYPE_TABLE:
if (hvalue(t1) == hvalue(t2))
return 1;
else if (ks == NULL)
return 0;
case KTAP_TYPE_BTRACE:
return btrace_equal(btvalue(t1), btvalue(t2));
default:
return gcvalue(t1) == gcvalue(t2);
}
return 0;
}
开发者ID:WinLinKer,项目名称:ktap,代码行数:33,代码来源:kp_obj.c
示例3: luaV_equalval
/* Note: 'luaV_equalval()' and 'luaO_rawequalObj()' have largely overlapping
* implementation.
*/
int luaV_equalval (lua_State *L, const TValue *l, const TValue *r) {
const TValue *tm;
lua_assert( ttype_ext(l) == ttype_ext(r) );
switch (ttype(l)) {
case LUA_TNIL: return 1;
#ifdef LUA_TINT
case LUA_TINT:
#endif
case LUA_TNUMBER: return luaO_rawequalObj(l,r);
case LUA_TBOOLEAN: return bvalue(l) == bvalue(r); /* true must be 1 !! */
case LUA_TLIGHTUSERDATA: return pvalue(l) == pvalue(r);
case LUA_TUSERDATA: {
if (uvalue(l) == uvalue(r)) return 1;
tm = get_compTM(L, uvalue(l)->metatable, uvalue(r)->metatable, TM_EQ);
break; /* will try TM */
}
case LUA_TTABLE: {
if (hvalue(l) == hvalue(r)) return 1;
tm = get_compTM(L, hvalue(l)->metatable, hvalue(r)->metatable, TM_EQ);
break; /* will try TM */
}
default: return gcvalue(l) == gcvalue(r);
}
if (tm == NULL) return 0; /* no TM? */
callTMres(L, L->top, tm, l, r); /* call TM */
return !l_isfalse(L->top);
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:30,代码来源:lvm.c
示例4: luaV_equalval
int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
const TValue *tm;
lua_assert(ttype(t1) == ttype(t2));
switch (ttype(t1)) {
case LUA_TNIL: return 1;
case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
case LUA_TUSERDATA: {
if (uvalue(t1) == uvalue(t2)) return 1;
tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable,
TM_EQ);
break; /* will try TM */
}
case LUA_TTABLE: {
if (hvalue(t1) == hvalue(t2)) return 1;
tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
default: return gcvalue(t1) == gcvalue(t2);
}
if (tm == NULL) return 0; /* no TM? */
callTMres(L, L->top, tm, t1, t2); /* call TM */
return !l_isfalse(L->top);
}
开发者ID:angryzor,项目名称:luajit-tilepro64,代码行数:25,代码来源:lvm.c
示例5: kp_equalobjv
/*
* equality of ktap values. ks == NULL means raw equality
*/
int kp_equalobjv(ktap_state *ks, const ktap_value *t1, const ktap_value *t2)
{
switch (ttype(t1)) {
case KTAP_TNIL:
return 1;
case KTAP_TNUMBER:
return nvalue(t1) == nvalue(t2);
case KTAP_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case KTAP_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2);
case KTAP_TLCF:
return fvalue(t1) == fvalue(t2);
case KTAP_TSHRSTR:
return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
case KTAP_TLNGSTR:
return kp_tstring_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
case KTAP_TTABLE:
if (hvalue(t1) == hvalue(t2))
return 1;
else if (ks == NULL)
return 0;
#ifdef __KERNEL__
case KTAP_TBTRACE:
return kp_btrace_equal(btvalue(t1), btvalue(t2));
#endif
default:
return gcvalue(t1) == gcvalue(t2);
}
return 0;
}
开发者ID:gokulnatha,项目名称:ktap,代码行数:35,代码来源:object.c
示例6: luaV_equalobj_
/*
** equality of Lua values. L == NULL means raw equality (no metamethods)
*/
int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {
const TValue *tm;
lua_assert(ttisequal(t1, t2));
switch (ttype(t1)) {
case LUA_TNIL: return 1;
case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
case LUA_TLCF: return fvalue(t1) == fvalue(t2);
case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2));
case LUA_TUSERDATA: {
if (uvalue(t1) == uvalue(t2)) return 1;
else if (L == NULL) return 0;
tm = get_equalTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
case LUA_TTABLE: {
if (hvalue(t1) == hvalue(t2)) return 1;
else if (L == NULL) return 0;
tm = get_equalTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
default:
lua_assert(iscollectable(t1));
return gcvalue(t1) == gcvalue(t2);
}
if (tm == NULL) return 0; /* no TM? */
callTM(L, tm, t1, t2, L->top, 1); /* call TM */
return !l_isfalse(L->top);
}
开发者ID:lriki,项目名称:Volkoff,代码行数:33,代码来源:lvm.c
示例7: luaV_equalobj
/*
** Main operation for equality of Lua values; return 't1 == t2'.
** L == NULL means raw equality (no metamethods)
*/
int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) {
const TValue *tm;
if (ttype(t1) != ttype(t2)) { /* not the same variant? */
#ifndef _KERNEL
if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER)
return 0; /* only numbers can be equal with different variants */
else { /* two numbers with different variants */
lua_Integer i1, i2; /* compare them as integers */
return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2);
}
#else /* _KERNEL */
return 0; /* numbers have only the integer variant */
#endif /* _KERNEL */
}
/* values have same type and same variant */
switch (ttype(t1)) {
case LUA_TNIL: return 1;
case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2));
#ifndef _KERNEL
case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2));
#endif /* _KERNEL */
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
case LUA_TLCF: return fvalue(t1) == fvalue(t2);
case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2));
case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2));
case LUA_TUSERDATA: {
if (uvalue(t1) == uvalue(t2)) return 1;
else if (L == NULL) return 0;
tm = fasttm(L, uvalue(t1)->metatable, TM_EQ);
if (tm == NULL)
tm = fasttm(L, uvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
case LUA_TTABLE: {
if (hvalue(t1) == hvalue(t2)) return 1;
else if (L == NULL) return 0;
tm = fasttm(L, hvalue(t1)->metatable, TM_EQ);
if (tm == NULL)
tm = fasttm(L, hvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
default:
return gcvalue(t1) == gcvalue(t2);
}
if (tm == NULL) /* no TM? */
return 0; /* objects are different */
luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */
return !l_isfalse(L->top);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:54,代码来源:lvm.c
示例8: switch
static Node *mainposition (const Table *t, const Tvalue *key)
{
switch (ttype(key)) {
case KTAP_TNUMBER:
return hashnum(t, nvalue(key));
case KTAP_TLNGSTR: {
Tstring *s = rawtsvalue(key);
if (s->tsv.extra == 0) { /* no hash? */
s->tsv.hash = kp_string_hash(getstr(s), s->tsv.len, s->tsv.hash);
s->tsv.extra = 1; /* now it has its hash */
}
return hashstr(t, rawtsvalue(key));
}
case KTAP_TSHRSTR:
return hashstr(t, rawtsvalue(key));
case KTAP_TBOOLEAN:
return hashboolean(t, bvalue(key));
case KTAP_TLIGHTUSERDATA:
return hashpointer(t, pvalue(key));
case KTAP_TLCF:
return hashpointer(t, fvalue(key));
default:
return hashpointer(t, gcvalue(key));
}
}
开发者ID:eric-zhu,项目名称:ktap,代码行数:25,代码来源:table.c
示例9: Cursor_next
static PyObject *
Cursor_next(KyotoCursor *self)
{
std::string key;
std::string value;
bool succeed = self->m_cursor->get(&key, &value, true);
if (succeed) {
switch (self->m_type) {
case KYOTO_VALUE: {
return KyotoDB_load(value, self->m_db->use_pickle);
}
case KYOTO_ITEMS:{
APR pkey(KyotoDB_load(key, self->m_db->use_pickle));
APR pvalue(KyotoDB_load(value, self->m_db->use_pickle));
return PyTuple_Pack(2, (PyObject *)pkey, (PyObject *)pvalue);
}
case KYOTO_KEY:
default:
return KyotoDB_load(key, self->m_db->use_pickle);
}
}
PyErr_SetString(PyExc_StopIteration, "");
return NULL;
}
开发者ID:informationsea,项目名称:Yet-Another-Kyoto-Cabinet-Python-Binding,代码行数:25,代码来源:yakc.cpp
示例10: switch
/*
** returns the `main' position of an element in a table (that is, the index
** of its hash value)
**
** Floating point numbers with integer value give the hash position of the
** integer (so they use the same table position).
*/
static Node *mainposition (const Table *t, const TValue *key) {
switch (ttype(key)) {
#ifdef LUA_TINT
case LUA_TINT:
return hashint(t,ivalue(key));
#endif
case LUA_TNUMBER: {
#ifdef LUA_TINT
lua_Integer i;
if (tt_integer_valued(key,&i))
return hashint(t, i);
# ifdef LNUM_COMPLEX
/* Complex numbers are hashed by their scalar part. Pure imaginary values
* with scalar 0 or -0 should give same hash.
*/
if (nvalue_img_fast(key)!=0 && luai_numeq(nvalue_fast(key),0))
return gnode(t, 0); /* 0 and -0 to give same hash */
# endif
#else
if (luai_numeq(nvalue(key),0)) return gnode(t, 0); /* 0 and -0 to give same hash */
#endif
return hashnum(t,nvalue_fast(key));
}
case LUA_TSTRING:
return hashstr(t, rawtsvalue(key));
case LUA_TBOOLEAN:
return hashboolean(t, bvalue(key));
case LUA_TLIGHTUSERDATA:
return hashpointer(t, pvalue(key));
default:
return hashpointer(t, gcvalue(key));
}
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:40,代码来源:ltable.c
示例11: pvalue
// -------------------------------------------------------------------
// MyOnlineState
// -------------------------------------------------------------------
void SFSBuddyManager::MyOnlineState(bool value)
{
boost::shared_ptr<bool> pvalue (new bool());
*pvalue = value;
boost::shared_ptr<BuddyVariable> variable(new SFSBuddyVariable(ReservedBuddyVariables::BV_ONLINE, pvalue, VARIABLETYPE_BOOL));
SetMyVariable (variable);
}
开发者ID:ThiQuocCuong,项目名称:RPS,代码行数:10,代码来源:SFSBuddyManager.cpp
示例12: kp_obj_dump
void kp_obj_dump(ktap_state_t *ks, const ktap_val_t *v)
{
switch (itype(v)) {
case KTAP_TNIL:
kp_puts(ks, "NIL");
break;
case KTAP_TTRUE:
kp_printf(ks, "true");
break;
case KTAP_TFALSE:
kp_printf(ks, "false");
break;
case KTAP_TNUM:
kp_printf(ks, "NUM %ld", nvalue(v));
break;
case KTAP_TLIGHTUD:
kp_printf(ks, "LIGHTUD 0x%lx", (unsigned long)pvalue(v));
break;
case KTAP_TFUNC:
kp_printf(ks, "FUNCTION 0x%lx", (unsigned long)fvalue(v));
break;
case KTAP_TSTR:
kp_printf(ks, "STR #%s", svalue(v));
break;
case KTAP_TTAB:
kp_printf(ks, "TABLE 0x%lx", (unsigned long)hvalue(v));
break;
default:
kp_printf(ks, "GCVALUE 0x%lx", (unsigned long)gcvalue(v));
break;
}
}
开发者ID:awreece,项目名称:ktap,代码行数:32,代码来源:kp_obj.c
示例13: kp_obj_dump
void kp_obj_dump(ktap_state *ks, const ktap_value *v)
{
switch (ttype(v)) {
case KTAP_TYPE_NIL:
kp_puts(ks, "NIL");
break;
case KTAP_TYPE_NUMBER:
kp_printf(ks, "NUMBER %ld", nvalue(v));
break;
case KTAP_TYPE_BOOLEAN:
kp_printf(ks, "BOOLEAN %d", bvalue(v));
break;
case KTAP_TYPE_LIGHTUSERDATA:
kp_printf(ks, "LIGHTUSERDATA 0x%lx", (unsigned long)pvalue(v));
break;
case KTAP_TYPE_CFUNCTION:
kp_printf(ks, "LIGHTCFCUNTION 0x%lx", (unsigned long)fvalue(v));
break;
case KTAP_TYPE_SHRSTR:
case KTAP_TYPE_LNGSTR:
kp_printf(ks, "SHRSTR #%s", svalue(v));
break;
case KTAP_TYPE_TABLE:
kp_printf(ks, "TABLE 0x%lx", (unsigned long)hvalue(v));
break;
default:
kp_printf(ks, "GCVALUE 0x%lx", (unsigned long)gcvalue(v));
break;
}
}
开发者ID:WinLinKer,项目名称:ktap,代码行数:30,代码来源:kp_obj.c
示例14: kp_obj_dump
void kp_obj_dump(ktap_State *ks, const Tvalue *v)
{
switch (ttype(v)) {
case KTAP_TNIL:
kp_printf(ks, "NIL");
break;
case KTAP_TNUMBER:
kp_printf(ks, "NUMBER %d", nvalue(v));
break;
case KTAP_TBOOLEAN:
kp_printf(ks, "BOOLEAN %d", bvalue(v));
break;
case KTAP_TLIGHTUSERDATA:
kp_printf(ks, "LIGHTUSERDATA %d", pvalue(v));
break;
case KTAP_TLCF:
kp_printf(ks, "LIGHTCFCUNTION 0x%x", fvalue(v));
break;
case KTAP_TSHRSTR:
case KTAP_TLNGSTR:
kp_printf(ks, "SHRSTR #%s", svalue(v));
break;
case KTAP_TUSERDATA:
kp_printf(ks, "USERDATA %d", uvalue(v));
break;
case KTAP_TTABLE:
kp_printf(ks, "TABLE 0x%x", hvalue(v));
break;
default:
kp_printf(ks, "GCVALUE 0x%x", gcvalue(v));
break;
}
}
开发者ID:eric-zhu,项目名称:ktap,代码行数:33,代码来源:object.c
示例15: luaO_rawequalObj
int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
if (ttype(t1) != ttype(t2)) return 0;
else switch (ttype(t1)) {
case LUA_TNIL:
return 1;
case LUA_TNUMBER:
return luai_numeq(nvalue(t1), nvalue(t2));
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
case LUA_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2);
default:
lua_assert(iscollectable(t1));
return gcvalue(t1) == gcvalue(t2);
}
}
开发者ID:alucard-dracula,项目名称:yggdrasil,代码行数:16,代码来源:lobject.c
示例16: debug_getsize
int debug_getsize(lua_State* L)
{
TValue* o = L->base;
switch (o->tt) {
/* Container types */
case LUA_TTABLE: {
Table *h = hvalue(o);
lua_pushinteger(L, sizeof(Table) + sizeof(TValue) * h->sizearray +
sizeof(Node) * sizenode(h));
break;
}
case LUA_TFUNCTION: {
Closure *cl = clvalue(o);
lua_pushinteger(L, (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :
sizeLclosure(cl->l.nupvalues));
break;
}
case LUA_TTHREAD: {
lua_State *th = thvalue(o);
lua_pushinteger(L, sizeof(lua_State) + sizeof(TValue) * th->stacksize +
sizeof(CallInfo) * th->size_ci);
break;
}
case LUA_TPROTO: {
Proto *p = pvalue(o);
lua_pushinteger(L, sizeof(Proto) + sizeof(Instruction) * p->sizecode +
sizeof(Proto *) * p->sizep +
sizeof(TValue) * p->sizek +
sizeof(int) * p->sizelineinfo +
sizeof(LocVar) * p->sizelocvars +
sizeof(TString *) * p->sizeupvalues);
break;
}
/* Non-containers */
case LUA_TUSERDATA: {
lua_pushnumber(L, uvalue(o)->len);
break;
}
case LUA_TLIGHTUSERDATA: {
lua_pushnumber(L, sizeof(void*));
break;
}
case LUA_TSTRING: {
TString *s = rawtsvalue(o);
lua_pushinteger(L, sizeof(TString) + s->tsv.len + 1);
break;
}
case LUA_TNUMBER: {
lua_pushinteger(L, sizeof(lua_Number));
break;
}
case LUA_TBOOLEAN: {
lua_pushinteger(L, sizeof(int));
break;
}
default: return 0;
}
return 1;
}
开发者ID:987690183,项目名称:selfNote,代码行数:59,代码来源:getsize.c
示例17: kp_cdata_value
static void kp_cdata_value(ktap_state_t *ks, ktap_val_t *val, void **out_addr,
size_t *out_size, void **temp)
{
ktap_cdata_t *cd;
csymbol *cs;
ffi_type type;
switch (ttypenv(val)) {
case KTAP_TYPE_BOOLEAN:
*out_addr = &bvalue(val);
*out_size = sizeof(int);
return;
case KTAP_TYPE_LIGHTUSERDATA:
*out_addr = pvalue(val);
*out_size = sizeof(void *);
return;
case KTAP_TYPE_NUMBER:
*out_addr = &nvalue(val);
*out_size = sizeof(ktap_number);
return;
case KTAP_TYPE_STRING:
*temp = (void *)svalue(val);
*out_addr = temp;
*out_size = sizeof(void *);
return;
}
cd = cdvalue(val);
cs = cd_csym(ks, cd);
type = csym_type(cs);
*out_size = csym_size(ks, cs);
switch (type) {
case FFI_VOID:
kp_error(ks, "Error: Cannot copy data from void type\n");
return;
case FFI_UINT8:
case FFI_INT8:
case FFI_UINT16:
case FFI_INT16:
case FFI_UINT32:
case FFI_INT32:
case FFI_UINT64:
case FFI_INT64:
*out_addr = &cd_int(cd);
return;
case FFI_PTR:
*out_addr = &cd_ptr(cd);
return;
case FFI_STRUCT:
case FFI_UNION:
*out_addr = cd_record(cd);
return;
case FFI_FUNC:
case FFI_UNKNOWN:
kp_error(ks, "Error: internal error for csymbol %s\n",
csym_name(cs));
return;
}
}
开发者ID:ktap,项目名称:ktap,代码行数:59,代码来源:cdata.c
示例18: index2addr
LUA_API void *lua_touserdata (lua_State *L, int idx) {
StkId o = index2addr(L, idx);
switch (ttypenv(o)) {
case LUA_TUSERDATA: return (rawuvalue(o) + 1);
case LUA_TLIGHTUSERDATA: return pvalue(o);
default: return NULL;
}
}
开发者ID:AdunSG,项目名称:Pktgen-DPDK,代码行数:8,代码来源:lapi.c
示例19: luaA_indexAcceptable
LUA_API void *lua_touserdata (lua_State *L, int idx) {
StkId o = luaA_indexAcceptable(L, idx);
if (o == NULL) return NULL;
switch (ttype(o)) {
case LUA_TUSERDATA: return (uvalue(o) + 1);
case LUA_TLIGHTUSERDATA: return pvalue(o);
default: return NULL;
}
}
开发者ID:TheWaWaR,项目名称:my-lua5.0,代码行数:9,代码来源:lapi.c
示例20: kp_obj_show
void kp_obj_show(ktap_state_t *ks, const ktap_val_t *v)
{
switch (itype(v)) {
case KTAP_TNIL:
kp_puts(ks, "nil");
break;
case KTAP_TTRUE:
kp_puts(ks, "true");
break;
case KTAP_TFALSE:
kp_puts(ks, "false");
break;
case KTAP_TNUM:
kp_printf(ks, "%ld", nvalue(v));
break;
case KTAP_TLIGHTUD:
kp_printf(ks, "lightud 0x%lx", (unsigned long)pvalue(v));
break;
case KTAP_TCFUNC:
kp_printf(ks, "cfunction 0x%lx", (unsigned long)fvalue(v));
break;
case KTAP_TFUNC:
kp_printf(ks, "function 0x%lx", (unsigned long)gcvalue(v));
break;
case KTAP_TSTR:
kp_puts(ks, svalue(v));
break;
case KTAP_TTAB:
kp_printf(ks, "table 0x%lx", (unsigned long)hvalue(v));
break;
#ifdef CONFIG_KTAP_FFI
case KTAP_TCDATA:
kp_cdata_dump(ks, cdvalue(v));
break;
#endif
case KTAP_TEVENTSTR:
/* check event context */
if (!ks->current_event) {
kp_error(ks,
"cannot stringify event str in invalid context\n");
return;
}
kp_transport_event_write(ks, ks->current_event);
break;
case KTAP_TKSTACK:
kp_transport_print_kstack(ks, v->val.stack.depth,
v->val.stack.skip);
break;
default:
kp_error(ks, "print unknown value type: %d\n", itype(v));
break;
}
}
开发者ID:awreece,项目名称:ktap,代码行数:54,代码来源:kp_obj.c
注:本文中的pvalue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论