diff --git a/flecs.c b/flecs.c index d9e2021947..9461fccf9a 100644 --- a/flecs.c +++ b/flecs.c @@ -24730,6 +24730,61 @@ void FlecsSystemImport( #endif +#ifdef FLECS_JSON + +void json_next( + ecs_strbuf_t *buf); + +void json_literal( + ecs_strbuf_t *buf, + const char *value); + +void json_number( + ecs_strbuf_t *buf, + double value); + +void json_true( + ecs_strbuf_t *buf); + +void json_false( + ecs_strbuf_t *buf); + +void json_array_push( + ecs_strbuf_t *buf); + +void json_array_pop( + ecs_strbuf_t *buf); + +void json_object_push( + ecs_strbuf_t *buf); + +void json_object_pop( + ecs_strbuf_t *buf); + +void json_string( + ecs_strbuf_t *buf, + const char *value); + +void json_member( + ecs_strbuf_t *buf, + const char *name); + +void json_path( + ecs_strbuf_t *buf, + const ecs_world_t *world, + ecs_entity_t e); + +void json_id( + ecs_strbuf_t *buf, + const ecs_world_t *world, + ecs_id_t id); + +ecs_primitive_kind_t json_op_to_primitive_kind( + ecs_meta_type_op_kind_t kind); + +#endif + + #ifdef FLECS_JSON void json_next( @@ -24836,61 +24891,6 @@ ecs_primitive_kind_t json_op_to_primitive_kind( -#ifdef FLECS_JSON - -void json_next( - ecs_strbuf_t *buf); - -void json_literal( - ecs_strbuf_t *buf, - const char *value); - -void json_number( - ecs_strbuf_t *buf, - double value); - -void json_true( - ecs_strbuf_t *buf); - -void json_false( - ecs_strbuf_t *buf); - -void json_array_push( - ecs_strbuf_t *buf); - -void json_array_pop( - ecs_strbuf_t *buf); - -void json_object_push( - ecs_strbuf_t *buf); - -void json_object_pop( - ecs_strbuf_t *buf); - -void json_string( - ecs_strbuf_t *buf, - const char *value); - -void json_member( - ecs_strbuf_t *buf, - const char *name); - -void json_path( - ecs_strbuf_t *buf, - const ecs_world_t *world, - ecs_entity_t e); - -void json_id( - ecs_strbuf_t *buf, - const ecs_world_t *world, - ecs_id_t id); - -ecs_primitive_kind_t json_op_to_primitive_kind( - ecs_meta_type_op_kind_t kind); - -#endif - - #ifdef FLECS_JSON static @@ -26007,7 +26007,7 @@ int json_typeinfo_ser_type_ops( return -1; } -int ecs_type_info_to_buf( +int ecs_type_info_to_json_buf( const ecs_world_t *world, ecs_entity_t type, ecs_strbuf_t *buf) @@ -26041,7 +26041,7 @@ char* ecs_type_info_to_json( { ecs_strbuf_t str = ECS_STRBUF_INIT; - if (ecs_type_info_to_buf(world, type, &str) != 0) { + if (ecs_type_info_to_json_buf(world, type, &str) != 0) { ecs_strbuf_reset(&str); return NULL; } diff --git a/flecs.h b/flecs.h index 8bf132fd7f..515f49d284 100644 --- a/flecs.h +++ b/flecs.h @@ -7874,7 +7874,7 @@ char* ecs_type_info_to_json( * @return Zero if success, non-zero if failed. */ FLECS_API -char* ecs_type_info_to_json_buf( +int ecs_type_info_to_json_buf( const ecs_world_t *world, ecs_entity_t type, ecs_strbuf_t *buf_out); diff --git a/include/flecs/addons/json.h b/include/flecs/addons/json.h index e9ec545a51..256f6a8b3c 100644 --- a/include/flecs/addons/json.h +++ b/include/flecs/addons/json.h @@ -137,7 +137,7 @@ char* ecs_type_info_to_json( * @return Zero if success, non-zero if failed. */ FLECS_API -char* ecs_type_info_to_json_buf( +int ecs_type_info_to_json_buf( const ecs_world_t *world, ecs_entity_t type, ecs_strbuf_t *buf_out); diff --git a/src/addons/json/json.c b/src/addons/json/json.c index ea7a25f264..eb66e61469 100644 --- a/src/addons/json/json.c +++ b/src/addons/json/json.c @@ -1,4 +1,4 @@ -#include "../../private_api.h" +#include "json.h" #ifdef FLECS_JSON diff --git a/src/addons/json/serialize_type_info.c b/src/addons/json/serialize_type_info.c index 0b0275bc8c..9db5553268 100644 --- a/src/addons/json/serialize_type_info.c +++ b/src/addons/json/serialize_type_info.c @@ -162,7 +162,7 @@ int json_typeinfo_ser_type_ops( return -1; } -int ecs_type_info_to_buf( +int ecs_type_info_to_json_buf( const ecs_world_t *world, ecs_entity_t type, ecs_strbuf_t *buf) @@ -196,7 +196,7 @@ char* ecs_type_info_to_json( { ecs_strbuf_t str = ECS_STRBUF_INIT; - if (ecs_type_info_to_buf(world, type, &str) != 0) { + if (ecs_type_info_to_json_buf(world, type, &str) != 0) { ecs_strbuf_reset(&str); return NULL; }