fx: implement updated interfaces in builtin classes
This commit is contained in:
@@ -17,8 +17,10 @@ int main(void)
|
||||
size_t nr_delims = sizeof delims / sizeof delims[0];
|
||||
|
||||
fx_iterator *it = fx_string_tokenise(str, delims, nr_delims, 0);
|
||||
fx_foreach(const char *, tok, it)
|
||||
fx_foreach(val, it)
|
||||
{
|
||||
const char *tok = NULL;
|
||||
fx_value_get_cstr(&val, &tok);
|
||||
printf("%s\n", tok);
|
||||
}
|
||||
fx_iterator_unref(it);
|
||||
|
||||
+19
-2
@@ -1,10 +1,27 @@
|
||||
#include <fx/value-type.h>
|
||||
#include <fx/value.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
fx_value v = FX_I32(1024);
|
||||
printf("%u\n", __fx_type_get_value_type(FX_TYPE_I64));
|
||||
fx_value x = FX_I32(1024);
|
||||
fx_value y = FX_I16(512);
|
||||
fx_value z = FX_VALUE_EMPTY;
|
||||
|
||||
fx_type_id common_type = fx_value_get_common_type(&x, &y);
|
||||
fx_value_change_type(&x, &x, common_type);
|
||||
fx_value_change_type(&y, &y, common_type);
|
||||
|
||||
fx_status status = fx_value_add(&x, &y, &z);
|
||||
if (!FX_OK(status)) {
|
||||
printf("add failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
u64 result = 0;
|
||||
fx_value_get_u64(&z, &result);
|
||||
printf("result: %" PRIu64 "\n", result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user