aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/arrays.c2
-rw-r--r--stdlib/arrays.h4
-rw-r--r--stdlib/tables.c12
3 files changed, 9 insertions, 9 deletions
diff --git a/stdlib/arrays.c b/stdlib/arrays.c
index 41d46741..1e1ce5f0 100644
--- a/stdlib/arrays.c
+++ b/stdlib/arrays.c
@@ -555,7 +555,7 @@ public Text_t Array$as_text(const void *obj, bool colorize, const TypeInfo_t *ty
{
Array_t *arr = (Array_t*)obj;
if (!arr)
- return Text$concat(Text("["), generic_as_text(NULL, false, type->ArrayInfo.item), Text("]"));
+ return Text$concat(Text("List("), generic_as_text(NULL, false, type->ArrayInfo.item), Text(")"));
const TypeInfo_t *item_type = type->ArrayInfo.item;
Text_t text = Text("[");
diff --git a/stdlib/arrays.h b/stdlib/arrays.h
index 332a1db0..6b88b1ee 100644
--- a/stdlib/arrays.h
+++ b/stdlib/arrays.h
@@ -36,7 +36,7 @@
#define Array_set(item_type, arr, index, value, start, end) \
Array_lvalue(item_type, arr_expr, index, start, end) = value
#define is_atomic(x) _Generic(x, bool: true, int8_t: true, int16_t: true, int32_t: true, int64_t: true, float: true, double: true, default: false)
-#define TypedArray(t, ...) ({ t items[] = {__VA_ARGS__}; \
+#define TypedList(t, ...) ({ t items[] = {__VA_ARGS__}; \
(Array_t){.length=sizeof(items)/sizeof(items[0]), \
.stride=(int64_t)&items[1] - (int64_t)&items[0], \
.data=memcpy(GC_MALLOC(sizeof(items)), items, sizeof(items)), \
@@ -48,7 +48,7 @@
.data=memcpy(GC_MALLOC(sizeof(items)), items, sizeof(items)), \
.atomic=0, \
.data_refcount=0}; })
-#define Array(x, ...) ({ __typeof(x) items[] = {x, __VA_ARGS__}; \
+#define List(x, ...) ({ __typeof(x) items[] = {x, __VA_ARGS__}; \
(Array_t){.length=sizeof(items)/sizeof(items[0]), \
.stride=(int64_t)&items[1] - (int64_t)&items[0], \
.data=memcpy(is_atomic(x) ? GC_MALLOC_ATOMIC(sizeof(items)) : GC_MALLOC(sizeof(items)), items, sizeof(items)), \
diff --git a/stdlib/tables.c b/stdlib/tables.c
index 97419327..73a3af19 100644
--- a/stdlib/tables.c
+++ b/stdlib/tables.c
@@ -582,16 +582,16 @@ public Text_t Table$as_text(const void *obj, bool colorize, const TypeInfo_t *ty
if (!t) {
if (table.value != &Void$info)
return Text$concat(
- Text("{"),
+ Text("Table("),
generic_as_text(NULL, false, table.key),
- Text(","),
+ Text(", "),
generic_as_text(NULL, false, table.value),
- Text("}"));
+ Text(")"));
else
return Text$concat(
- Text("{"),
+ Text("Set("),
generic_as_text(NULL, false, table.key),
- Text("}"));
+ Text(")"));
}
int64_t val_off = (int64_t)value_offset(type);
@@ -606,7 +606,7 @@ public Text_t Table$as_text(const void *obj, bool colorize, const TypeInfo_t *ty
}
if (t->fallback) {
- text = Text$concat(text, Text("; fallback="), Table$as_text(t->fallback, colorize, type));
+ text = Text$concat(text, colorize ? Text("; \033[33mfallback\033[m=") : Text("; fallback="), Table$as_text(t->fallback, colorize, type));
}
text = Text$concat(text, Text("}"));