2026-03-16 10:35:43 +00:00
|
|
|
#include <fx/core/stream.h>
|
|
|
|
|
#include <fx/ds/array.h>
|
|
|
|
|
#include <fx/ds/dict.h>
|
|
|
|
|
#include <fx/ds/number.h>
|
|
|
|
|
#include <fx/ds/string.h>
|
|
|
|
|
#include <fx/serial.h>
|
2025-06-27 21:53:40 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_serial_ctx *ctx = fx_toml_serial_ctx_create();
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_dict *dict = fx_dict_create();
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_array *array = fx_array_create();
|
|
|
|
|
fx_array_append(array, FX_RV_INT(32));
|
|
|
|
|
fx_array_append(array, FX_RV_INT(64));
|
|
|
|
|
fx_array_append(array, FX_RV_INT(128));
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_dict_put(dict, "numbers", FX_RV(array));
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
array = fx_array_create();
|
|
|
|
|
fx_array_append(array, FX_RV_CSTR("hello"));
|
|
|
|
|
fx_array_append(array, FX_RV_CSTR("world"));
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_dict_put(dict, "strings", FX_RV(array));
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_object_to_string(dict, fx_stdout);
|
|
|
|
|
fx_stream_write_char(fx_stdout, '\n');
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_serial_ctx_serialise(ctx, dict, fx_stdout, 0);
|
2025-06-27 21:53:40 +01:00
|
|
|
|
2026-03-16 10:35:43 +00:00
|
|
|
fx_dict_unref(dict);
|
|
|
|
|
fx_serial_ctx_unref(ctx);
|
2025-06-27 21:53:40 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|