aboutsummaryrefslogtreecommitdiff
path: root/builtins/functions.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-03 18:16:33 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-03 18:16:33 -0500
commit23478e7036fe9fbee17263e52d5d8a37adce1c95 (patch)
tree7c588c0f7b7ac2f81dbbd960a8f70b197613b229 /builtins/functions.c
parent8fab88c56f95c03ffcb4be178f5dbb21b239d95e (diff)
Rename as_str -> as_text
Diffstat (limited to 'builtins/functions.c')
-rw-r--r--builtins/functions.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/builtins/functions.c b/builtins/functions.c
index 5f66c1e1..69fe5934 100644
--- a/builtins/functions.c
+++ b/builtins/functions.c
@@ -107,18 +107,18 @@ public bool generic_equal(const void *x, const void *y, const TypeInfo *type)
}
}
-public CORD generic_as_str(const void *obj, bool colorize, const TypeInfo *type)
+public CORD generic_as_text(const void *obj, bool colorize, const TypeInfo *type)
{
switch (type->tag) {
case PointerInfo: return Pointer__cord(obj, colorize, type);
- case FunctionInfo: return Func__as_str(obj, colorize, type);
- case ArrayInfo: return Array__as_str(obj, colorize, type);
- case TableInfo: return Table_as_str(obj, colorize, type);
- case TypeInfoInfo: return Type__as_str(obj, colorize, type);
+ case FunctionInfo: return Func__as_text(obj, colorize, type);
+ case ArrayInfo: return Array__as_text(obj, colorize, type);
+ case TableInfo: return Table_as_text(obj, colorize, type);
+ case TypeInfoInfo: return Type__as_text(obj, colorize, type);
case CustomInfo:
- if (!type->CustomInfo.as_str)
+ if (!type->CustomInfo.as_text)
fail("No cord function provided for type!\n");
- return type->CustomInfo.as_str(obj, colorize, type);
+ return type->CustomInfo.as_text(obj, colorize, type);
default: errx(1, "Invalid type tag: %d", type->tag);
}
}
@@ -158,12 +158,12 @@ public void __doctest(void *expr, const TypeInfo *type, CORD expected, const cha
CORD_fprintf(stderr, USE_COLOR ? "\x1b[33;1m>> \x1b[0m%.*s\x1b[m\n" : ">> %.*s\n", (end - start), file->text + start);
if (expr) {
- CORD expr_str = generic_as_str(expr, USE_COLOR, type);
- CORD type_name = generic_as_str(NULL, false, type);
+ CORD expr_str = generic_as_text(expr, USE_COLOR, type);
+ CORD type_name = generic_as_text(NULL, false, type);
CORD_fprintf(stderr, USE_COLOR ? "\x1b[2m=\x1b[0m %r \x1b[2m: %r\x1b[m\n" : "= %r : %r\n", expr_str, type_name);
if (expected) {
- CORD expr_plain = USE_COLOR ? generic_as_str(expr, false, type) : expr_str;
+ CORD expr_plain = USE_COLOR ? generic_as_text(expr, false, type) : expr_str;
bool success = (CORD_cmp(expr_plain, expected) == 0);
if (!success && CORD_chr(expected, 0, ':')) {
success = (CORD_cmp(CORD_catn(3, expr_plain, " : ", type_name), expected) == 0);