Commit 04f8dd8226948ffa279940e22b98ceca89f6073e

Baptiste 2024-08-09T18:12:25

wip

diff --git a/libkc3/buf_inspect_u16_decimal.h b/libkc3/buf_inspect_u16_decimal.h
index 105099d..d26361e 100644
--- a/libkc3/buf_inspect_u16_decimal.h
+++ b/libkc3/buf_inspect_u16_decimal.h
@@ -16,7 +16,7 @@
 
 #include "types.h"
 
-sw buf_inspect_u16_decimal (s_buf *buf, const u16 *u);
-sw buf_inspect_u16_decimal_size (const u16 *u);
+sw buf_inspect_u16_decimal (s_pretty *pretty, s_buf *buf, const u16 *u);
+sw buf_inspect_u16_decimal_size (s_pretty *pretty, const u16 *u);
 
 #endif /* LIBKC3_BUF_INSPECT_U16_decimal_H */
diff --git a/libkc3/buf_inspect_u32_decimal.h b/libkc3/buf_inspect_u32_decimal.h
index a45f5d1..86ff55a 100644
--- a/libkc3/buf_inspect_u32_decimal.h
+++ b/libkc3/buf_inspect_u32_decimal.h
@@ -16,7 +16,7 @@
 
 #include "types.h"
 
-sw buf_inspect_u32_decimal (s_buf *buf, const u32 *u);
-sw buf_inspect_u32_decimal_size (const u32 *u);
+sw buf_inspect_u32_decimal (s_pretty *pretty, s_buf *buf, const u32 *u);
+sw buf_inspect_u32_decimal_size (s_pretty *pretty, const u32 *u);
 
 #endif /* LIBKC3_BUF_INSPECT_U32_decimal_H */
diff --git a/libkc3/buf_inspect_u64_decimal.h b/libkc3/buf_inspect_u64_decimal.h
index 212e36f..8a2bde6 100644
--- a/libkc3/buf_inspect_u64_decimal.h
+++ b/libkc3/buf_inspect_u64_decimal.h
@@ -16,7 +16,7 @@
 
 #include "types.h"
 
-sw buf_inspect_u64_decimal (s_buf *buf, const u64 *u);
-sw buf_inspect_u64_decimal_size (const u64 *u);
+sw buf_inspect_u64_decimal (s_pretty *pretty, s_buf *buf, const u64 *u);
+sw buf_inspect_u64_decimal_size (s_pretty *pretty, const u64 *u);
 
 #endif /* LIBKC3_BUF_INSPECT_U64_decimal_H */
diff --git a/libkc3/buf_inspect_u8_decimal.h b/libkc3/buf_inspect_u8_decimal.h
index 069ad9d..eb95ca9 100644
--- a/libkc3/buf_inspect_u8_decimal.h
+++ b/libkc3/buf_inspect_u8_decimal.h
@@ -16,7 +16,7 @@
 
 #include "types.h"
 
-sw buf_inspect_u8_decimal (s_buf *buf, const u8 *u);
-sw buf_inspect_u8_decimal_size (const u8 *u);
+sw buf_inspect_u8_decimal (s_pretty *pretty, s_buf *buf, const u8 *u);
+sw buf_inspect_u8_decimal_size (s_pretty *pretty, const u8 *u);
 
 #endif /* LIBKC3_BUF_INSPECT_U8_decimal_H */
diff --git a/libkc3/buf_inspect_u_base.h.in b/libkc3/buf_inspect_u_base.h.in
index 4f50989..61204d2 100644
--- a/libkc3/buf_inspect_u_base.h.in
+++ b/libkc3/buf_inspect_u_base.h.in
@@ -16,7 +16,7 @@
 
 #include "types.h"
 
-sw buf_inspect_u_bits$__BASE$ (s_buf *buf, const u_bits$ *u);
-sw buf_inspect_u_bits$__BASE$_size (const u_bits$ *u);
+sw buf_inspect_u_bits$__BASE$ (s_pretty *pretty, s_buf *buf, const u_bits$ *u);
+sw buf_inspect_u_bits$__BASE$_size (s_pretty *pretty, const u_bits$ *u);
 
 #endif /* LIBKC3_BUF_INSPECT_U_BITS$__BASE$_H */
diff --git a/libkc3/buf_inspect_uw_decimal.h b/libkc3/buf_inspect_uw_decimal.h
index 887ac48..aa6e148 100644
--- a/libkc3/buf_inspect_uw_decimal.h
+++ b/libkc3/buf_inspect_uw_decimal.h
@@ -16,7 +16,7 @@
 
 #include "types.h"
 
-sw buf_inspect_uw_decimal (s_buf *buf, const uw *u);
-sw buf_inspect_uw_decimal_size (const uw *u);
+sw buf_inspect_uw_decimal (s_pretty *pretty, s_buf *buf, const uw *u);
+sw buf_inspect_uw_decimal_size (s_pretty *pretty, const uw *u);
 
 #endif /* LIBKC3_BUF_INSPECT_UW_decimal_H */
diff --git a/libkc3/inspect.c b/libkc3/inspect.c
index c46d9ee..6561eb0 100644
--- a/libkc3/inspect.c
+++ b/libkc3/inspect.c
@@ -27,7 +27,7 @@ s_str * inspect_array (const s_array *array, s_str *dest)
     return NULL;
   }
   buf_init_alloc(&tmp, size);
-  buf_inspect_array(&tmp, array);
+  buf_inspect_array(&pretty, &tmp, array);
   if (tmp.wpos != tmp.size) {
     err_puts("inspect_array: tmp.wpos != tmp.size");
     assert(! "inspect_array: tmp.wpos != tmp.size");
@@ -51,7 +51,7 @@ s_str * inspect_block (const s_block *x, s_str *dest)
   }
   if (! buf_init_alloc(&buf, size))
     return NULL;
-  if ((r = buf_inspect_block(&buf, x)) < 0)
+  if ((r = buf_inspect_block(&pretty, &buf, x)) < 0)
     goto error;
   assert(r == size);
   if (r != size)
@@ -66,7 +66,7 @@ s_str * inspect_bool (bool *b, s_str *dest)
 {
   sw size;
   s_buf tmp;
-  size = buf_inspect_bool_size(b);
+  size = buf_inspect_bool_size(&pretty, b);
   if (size < 0) {
     err_write_1("inspect_bool: error: ");
     err_inspect_u8(b);
@@ -74,7 +74,7 @@ s_str * inspect_bool (bool *b, s_str *dest)
     return NULL;
   }
   buf_init_alloc(&tmp, size);
-  buf_inspect_bool(&tmp, b);
+  buf_inspect_bool(&pretty, &tmp, b);
   assert(tmp.wpos == tmp.size);
   if (tmp.wpos != tmp.size) {
     buf_clean(&tmp);
@@ -88,13 +88,13 @@ s_str * inspect_sym (const s_sym *sym, s_str *dest)
 {
   sw size;
   s_buf tmp = {0};
-  size = buf_inspect_sym_size(&sym);
+  size = buf_inspect_sym_size(&pretty, &sym);
   if (size < 0) {
     assert(! "error");
     return NULL;
   }
   buf_init_alloc(&tmp, size);
-  buf_inspect_sym(&tmp, &sym);
+  buf_inspect_sym(&pretty, &tmp, &sym);
   assert(tmp.wpos == tmp.size);
   return buf_to_str(&tmp, dest);
 }
@@ -105,13 +105,13 @@ s_str * inspect_tag (const s_tag *tag, s_str *dest)
   sw size;
   assert(tag);
   assert(dest);
-  if ((size = buf_inspect_tag_size(tag)) < 0) {
+  if ((size = buf_inspect_tag_size(&pretty, tag)) < 0) {
     err_puts("tag_inspect: size error");
     assert(! "tag_inspect: size error");
     return NULL;
   }
   buf_init_alloc(&buf, size);
-  if (buf_inspect_tag(&buf, tag) != size) {
+  if (buf_inspect_tag(&pretty, &buf, tag) != size) {
     err_puts("tag_inspect: inspect error");
     assert(! "tag_inspect: inspect error");
     return NULL;