runtime: move value formatting functionality to a dedicated api

This commit is contained in:
2026-06-13 13:46:29 +01:00
parent 4c04ca6de8
commit 73519eb7aa
6 changed files with 134 additions and 27 deletions
+4 -11
View File
@@ -21,17 +21,10 @@ static void format_value_fallback(const fx_value *value, fx_stream *dest)
enum bshell_status format_value_default(const fx_value *value, fx_stream *dest)
{
if (fx_type_is_value_type(value->v_type)) {
format_value_fallback(value, dest);
return BSHELL_SUCCESS;
}
fx_object *object = NULL;
fx_value_get_object(value, &object);
enum bshell_status status = format_object_table(object, dest);
if (status != BSHELL_SUCCESS) {
format_value_fallback(value, dest);
}
struct bshell_value_writer writer;
bshell_value_writer_init(&writer, dest);
bshell_value_writer_write(&writer, value);
bshell_value_writer_cleanup(&writer);
return BSHELL_SUCCESS;
}