diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-03-09 18:22:12 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-03-09 18:22:12 -0500 |
| commit | 2b83ab279dbfb77cfd699d6da944c51c2353e64a (patch) | |
| tree | 820f23b5c418e9d501a9fecf4fc84d2e26158cb2 /builtins/functions.c | |
| parent | 1b8f7307a9c9cef191f6277cea5f2d11ef0a5788 (diff) | |
Add langs to the language
Diffstat (limited to 'builtins/functions.c')
| -rw-r--r-- | builtins/functions.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtins/functions.c b/builtins/functions.c index 9cf05fe0..815e8ff2 100644 --- a/builtins/functions.c +++ b/builtins/functions.c @@ -57,6 +57,7 @@ public uint32_t generic_hash(const void *obj, const TypeInfo *type) { switch (type->tag) { case PointerInfo: case FunctionInfo: return Pointer__hash(obj, type); + case TextInfo: return Text__hash(obj); case ArrayInfo: return Array__hash(obj, type); case TableInfo: return Table_hash(obj, type); case CustomInfo: @@ -76,6 +77,7 @@ public int32_t generic_compare(const void *x, const void *y, const TypeInfo *typ { switch (type->tag) { case PointerInfo: case FunctionInfo: return Pointer__compare(x, y, type); + case TextInfo: return Text__compare(x, y); case ArrayInfo: return Array__compare(x, y, type); case TableInfo: return Table_compare(x, y, type); case CustomInfo: @@ -84,10 +86,6 @@ public int32_t generic_compare(const void *x, const void *y, const TypeInfo *typ return type->CustomInfo.compare(x, y, type); default: compare_data: - { - int diff = memcmp((void*)x, (void*)y, type->size); - printf("GOT DIFF: %d\n", diff); - } return (int32_t)memcmp((void*)x, (void*)y, type->size); } } @@ -96,6 +94,7 @@ public bool generic_equal(const void *x, const void *y, const TypeInfo *type) { switch (type->tag) { case PointerInfo: case FunctionInfo: return Pointer__equal(x, y, type); + case TextInfo: return Text__equal(x, y); case ArrayInfo: return Array__equal(x, y, type); case TableInfo: return Table_equal(x, y, type); case CustomInfo: @@ -113,6 +112,7 @@ public CORD generic_as_text(const void *obj, bool colorize, const TypeInfo *type switch (type->tag) { case PointerInfo: return Pointer__as_text(obj, colorize, type); case FunctionInfo: return Func__as_text(obj, colorize, type); + case TextInfo: return obj ? Text__quoted(*(CORD*)obj, colorize) :type->TextInfo.lang; 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); |
