add vget_vec/vput_vec
This commit is contained in:
parent
cbda3378da
commit
eed32242fe
2 changed files with 54 additions and 4 deletions
44
src/varray.c
44
src/varray.c
|
|
@ -65,6 +65,50 @@ int vput(var v, int idx, void* data)
|
|||
return method(obj, idx, data);
|
||||
}
|
||||
|
||||
int vget_vec(var v, int count, int* idxs, void** data)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
vget_vec_fn_t method = NULL;
|
||||
|
||||
if ((count < 1) || (idxs == NULL) || (data == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
obj = RTTI_DATA_TO_OBJ(v);
|
||||
if (RTTI_OBJ_INVALID(obj)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
RTTI_GET_METHOD(method, obj, varray, vget_vec);
|
||||
if (method == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return method(obj, count, idxs, data);
|
||||
}
|
||||
|
||||
int vput_vec(var v, int count, int* idxs, void** data)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
vput_vec_fn_t method = NULL;
|
||||
|
||||
if ((count < 1) || (idxs == NULL) || (data == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
obj = RTTI_DATA_TO_OBJ(v);
|
||||
if (RTTI_OBJ_INVALID(obj)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
RTTI_GET_METHOD(method, obj, varray, vput_vec);
|
||||
if (method == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return method(obj, count, idxs, data);
|
||||
}
|
||||
|
||||
int vclear(var v, int idx)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue