8 this->returns = v->ThrowError(__VA_ARGS__); \
12 VXRepr::VXRepr(VXState
* _v
, const VXObject
& ob
): v(_v
), root_ob(ob
)
15 do_serialize(root_ob
);
18 void VXRepr::do_serialize(const VXObject
& o
)
26 case VX_OT_NATIVECLOSURE
:
27 /* TODO: this is where the function proto should be emitted */
49 Err("cannot serialize type '%s'", o
.TypeString());
54 void VXRepr::emit_othertype(const VXObject
& o
)
56 const VXUserPointer o_addr
= VXUserPointer(&o
);
57 strm
<< "<" << o
.TypeString() << " at " << o_addr
<< ">";
60 void VXRepr::emit_string(const VXObject
& o
)
65 o
.String(&str_p
, &len_p
);
66 tmp
.append(str_p
, len_p
);
67 strm
<< strhelp_quote(tmp
);
70 void VXRepr::emit_table(const VXObject
& o
)
74 VXInteger ridx
= 0; // start at first index
77 VXTableObj
* tb
= o
.Table();
80 while((ridx
= tb
->Next(false, ridx
, outkey
, outval
)) != -1)
94 void VXRepr::emit_array(const VXObject
& o
)
97 VXInteger ridx
= 0; // start at first index
100 VXArrayObj
* arr
= o
.Array();
103 while((ridx
= arr
->Next(ridx
, outkey
, outval
)) != -1)
105 do_serialize(outval
);
114 std::string
VXRepr::str()
116 return this->strm
.str();
119 VXInteger
VXRepr::status()