Update examples
This commit is contained in:
parent
bc69fbb7cc
commit
c81b412a82
@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
typedef vtype_array arr_t;
|
typedef vtype_array arr_t;
|
||||||
|
|
||||||
int print_value(void* value, ssize_t index, vtype type, void* data) {
|
int print_value(vtype_variable value, ssize_t index, void* data) {
|
||||||
const char *n = data;
|
const char *n = data;
|
||||||
vtype_int32 *v = value;
|
vtype_int32 *v = value.pointer;
|
||||||
|
|
||||||
assert(type == VTYPE_INT32);
|
assert(value.type == VTYPE_INT32);
|
||||||
|
|
||||||
printf("%s %d (index: %ld)\n", n, *v, index);
|
printf("%s %d (index: %ld)\n", n, *v, index);
|
||||||
|
|
||||||
|
@ -8,28 +8,28 @@
|
|||||||
|
|
||||||
typedef vtype_dict dict_t;
|
typedef vtype_dict dict_t;
|
||||||
|
|
||||||
int print_value(const void* key, vtype key_type, void* value, vtype value_type, void* data) {
|
int print_value(vtype_variable key, vtype_variable value, void* data) {
|
||||||
const char *n = data;
|
const char *n = data;
|
||||||
|
|
||||||
switch (key_type) {
|
switch (key.type) {
|
||||||
default: abort();
|
default: abort();
|
||||||
|
|
||||||
case VTYPE_INT32:
|
case VTYPE_INT32:
|
||||||
printf("%s %d: ", n, *(vtype_int32*)key);
|
printf("%s %d: ", n, *(vtype_int32*)key.pointer);
|
||||||
break;
|
break;
|
||||||
case VTYPE_FLOAT:
|
case VTYPE_FLOAT:
|
||||||
printf("%s %f: ", n, *(vtype_float*)key);
|
printf("%s %f: ", n, *(vtype_float*)key.pointer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (value_type) {
|
switch (value.type) {
|
||||||
default: abort();
|
default: abort();
|
||||||
|
|
||||||
case VTYPE_INT32:
|
case VTYPE_INT32:
|
||||||
printf("%d\n", *(vtype_int32*)value);
|
printf("%d\n", *(vtype_int32*)value.pointer);
|
||||||
break;
|
break;
|
||||||
case VTYPE_FLOAT:
|
case VTYPE_FLOAT:
|
||||||
printf("%f\n", *(vtype_float*)value);
|
printf("%f\n", *(vtype_float*)value.pointer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,17 +8,17 @@
|
|||||||
typedef vtype_list list_t;
|
typedef vtype_list list_t;
|
||||||
|
|
||||||
|
|
||||||
int print_value(void* value, ssize_t index, vtype type, void* data) {
|
int print_value(vtype_variable value, ssize_t index, void* data) {
|
||||||
const char *n = data;
|
const char *n = data;
|
||||||
|
|
||||||
switch (type) {
|
switch (value.type) {
|
||||||
default: abort();
|
default: abort();
|
||||||
|
|
||||||
case VTYPE_INT32:
|
case VTYPE_INT32:
|
||||||
printf("%s %d (index: %ld)\n", n, *(vtype_int32*)value, index);
|
printf("%s %d (index: %ld)\n", n, *(vtype_int32*)value.pointer, index);
|
||||||
break;
|
break;
|
||||||
case VTYPE_FLOAT:
|
case VTYPE_FLOAT:
|
||||||
printf("%s %f (index: %ld)\n", n, *(vtype_float*)value, index);
|
printf("%s %f (index: %ld)\n", n, *(vtype_float*)value.pointer, index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,22 +8,22 @@
|
|||||||
|
|
||||||
typedef vtype_map map_t;
|
typedef vtype_map map_t;
|
||||||
|
|
||||||
int print_value(const void* key, vtype key_type, void* value, vtype value_type, void* data) {
|
int print_value(vtype_variable key, vtype_variable value, void* data) {
|
||||||
const char *n = data;
|
const char *n = data;
|
||||||
vtype_int32 *k = (void*)key;
|
vtype_int32 *k = (void*)key.pointer;
|
||||||
|
|
||||||
assert(key_type == VTYPE_INT32);
|
assert(key.type == VTYPE_INT32);
|
||||||
|
|
||||||
printf("%s %d: ", n, *k);
|
printf("%s %d: ", n, *k);
|
||||||
|
|
||||||
switch (value_type) {
|
switch (value.type) {
|
||||||
default: abort();
|
default: abort();
|
||||||
|
|
||||||
case VTYPE_INT32:
|
case VTYPE_INT32:
|
||||||
printf("%d\n", *(vtype_int32*)value);
|
printf("%d\n", *(vtype_int32*)value.pointer);
|
||||||
break;
|
break;
|
||||||
case VTYPE_FLOAT:
|
case VTYPE_FLOAT:
|
||||||
printf("%f\n", *(vtype_float*)value);
|
printf("%f\n", *(vtype_float*)value.pointer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
typedef vtype_set vset_t;
|
typedef vtype_set vset_t;
|
||||||
|
|
||||||
int print_value(const void* value, vtype type, void* data) {
|
int print_value(vtype_variable value, void* data) {
|
||||||
const char *n = data;
|
const char *n = data;
|
||||||
vtype_int32 *v = (void*)value;
|
vtype_int32 *v = (void*)value.pointer;
|
||||||
|
|
||||||
assert(type == VTYPE_INT32);
|
assert(value.type == VTYPE_INT32);
|
||||||
|
|
||||||
printf("%s %d\n", n, *v);
|
printf("%s %d\n", n, *v);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user