Commit 0675e541bf57682220cbbfc1e3e1342e7aa23ad0

Thomas de Grivel 2024-07-31T18:13:35

buf_inspect_struct_size

diff --git a/libkc3/buf_inspect.c b/libkc3/buf_inspect.c
index 7cad451..d1dadfc 100644
--- a/libkc3/buf_inspect.c
+++ b/libkc3/buf_inspect.c
@@ -2847,6 +2847,8 @@ sw buf_inspect_var_size (const s_tag *tag)
 {
   sw r;
   sw result = 0;
+  if (tag->data.var.type == &g_sym_Tag)
+    return strlen("?");
   if ((r = buf_inspect_paren_sym_size(tag->data.var.type)) < 0)
     return r;
   result += r;
diff --git a/libkc3/data.c b/libkc3/data.c
index 9bb4025..8437ae6 100644
--- a/libkc3/data.c
+++ b/libkc3/data.c
@@ -41,6 +41,8 @@ sw data_buf_inspect (const s_sym *type, s_buf *buf, const void *data)
     return buf_inspect_integer(buf, data);
   if (type == &g_sym_List)
     return buf_inspect_list(buf, data);
+  if (type == &g_sym_Map)
+    return buf_inspect_map(buf, data);
   if (type == &g_sym_Ptag)
     return buf_inspect_ptag(buf, data);
   if (type == &g_sym_Ptr)
@@ -126,6 +128,8 @@ sw data_buf_inspect_size (const s_sym *type, const void *data)
     return buf_inspect_integer_size(data);
   if (type == &g_sym_List)
     return buf_inspect_list_size(data);
+  if (type == &g_sym_Map)
+    return buf_inspect_map_size(data);
   if (type == &g_sym_Ptag)
     return buf_inspect_ptag_size(data);
   if (type == &g_sym_Ptr)
diff --git a/libkc3/str.c b/libkc3/str.c
index bc6525b..fd1c7af 100644
--- a/libkc3/str.c
+++ b/libkc3/str.c
@@ -87,12 +87,16 @@
       return NULL;                                                     \
     }                                                                  \
     if ((r = buf_inspect_ ## name(&buf, x)) < 0) {                     \
-      err_puts("str_init_" # name ": buf_inspect_" # name);            \
+      err_puts("str_init_" # name ": buf_inspect_" # name " < 0");     \
       buf_clean(&buf);                                                 \
       return NULL;                                                     \
     }                                                                  \
     if (r != size) {                                                   \
-      err_puts("str_init_" # name ": buf_inspect_" # name);            \
+      err_write_1("str_init_" # name ": buf_inspect_" # name ": ");    \
+      err_inspect_sw_decimal(&r);                                      \
+      err_write_1(" != ");                                             \
+      err_inspect_sw_decimal(&size);                                   \
+      err_write_1("\n");                                               \
       buf_clean(&buf);                                                 \
       return NULL;                                                     \
     }                                                                  \