wip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/libkc3/buf_inspect.c b/libkc3/buf_inspect.c
index 555b3a8..7cad451 100644
--- a/libkc3/buf_inspect.c
+++ b/libkc3/buf_inspect.c
@@ -1868,10 +1868,29 @@ sw buf_inspect_map (s_buf *buf, const s_map *map)
sw buf_inspect_map_size (const s_map *map)
{
+ uw i = 0;
+ s_tag *k;
+ sw result = 0;
assert(map);
- assert(! "buf_inspect_map_size: not implemented");
- (void) map;
- return -1;
+ result += strlen("%{");
+ while (i < map->count) {
+ k = map->key + i;
+ if (k->type == TAG_SYM) {
+ result += strlen(k->data.sym->str.ptr.pchar);
+ result += strlen(": ");
+ }
+ else {
+ result += buf_inspect_tag_size(map->key + i);
+ result += strlen(" => ");
+ }
+ result += buf_inspect_tag_size(map->value + i);
+ i++;
+ if (i < map->count) {
+ result += strlen(", ");
+ }
+ }
+ result += strlen("}");
+ return result;
}
sw buf_inspect_paren_sym (s_buf *buf, const s_sym *sym)