aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-13 19:59:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-13 19:59:28 -0400
commit51c346bbc5f6c5179b56b09b75eec466acbe7ad7 (patch)
treef20dc8b2ecec208dda83896be3448f9d6a8881b2
parenteae0a36b3921a9b4a93e8efa7b5f9d6b843c607b (diff)
Code cleanup
-rw-r--r--Makefile4
-rw-r--r--builtins/array.c1
-rw-r--r--builtins/array.h1
-rw-r--r--builtins/channel.c2
-rw-r--r--builtins/functiontype.c35
-rw-r--r--builtins/functiontype.h9
-rw-r--r--builtins/integers.h2
-rw-r--r--builtins/metamethods.c123
-rw-r--r--builtins/metamethods.h15
-rw-r--r--builtins/optionals.c1
-rw-r--r--builtins/path.c1
-rw-r--r--builtins/pattern.c1
-rw-r--r--builtins/pointer.c2
-rw-r--r--builtins/shell.c1
-rw-r--r--builtins/stdlib.c (renamed from builtins/functions.c)129
-rw-r--r--builtins/stdlib.h (renamed from builtins/functions.h)8
-rw-r--r--builtins/table.c1
-rw-r--r--builtins/text.c1
-rw-r--r--builtins/tomo.h3
-rw-r--r--builtins/types.c14
-rw-r--r--builtins/types.h1
-rw-r--r--environment.c1
-rw-r--r--parse.c1
23 files changed, 194 insertions, 163 deletions
diff --git a/Makefile b/Makefile
index 820de549..6f29a964 100644
--- a/Makefile
+++ b/Makefile
@@ -28,10 +28,10 @@ O=-Og
CFLAGS=$(CCONFIG) $(EXTRA) $(CWARN) $(G) $(O) $(OSFLAGS)
CFLAGS_PLACEHOLDER="$$(echo -e '\033[2m<flags...>\033[m')"
LDLIBS=-lgc -lcord -lm -lunistring -lgmp -ldl
-BUILTIN_OBJS=builtins/siphash.o builtins/array.o builtins/bool.o builtins/channel.o builtins/nums.o builtins/functions.o builtins/integers.o \
+BUILTIN_OBJS=builtins/siphash.o builtins/array.o builtins/bool.o builtins/channel.o builtins/nums.o builtins/integers.o \
builtins/pointer.o builtins/memory.o builtins/text.o builtins/thread.o builtins/c_string.o builtins/table.o \
builtins/types.o builtins/util.o builtins/files.o builtins/range.o builtins/shell.o builtins/path.o \
- builtins/optionals.o builtins/pattern.o
+ builtins/optionals.o builtins/pattern.o builtins/metamethods.o builtins/functiontype.o builtins/stdlib.o
TESTS=$(patsubst %.tm,%.tm.testresult,$(wildcard test/*.tm))
all: libtomo.so tomo
diff --git a/builtins/array.c b/builtins/array.c
index f4d7a3da..35227725 100644
--- a/builtins/array.c
+++ b/builtins/array.c
@@ -6,6 +6,7 @@
#include <sys/param.h>
#include "array.h"
+#include "metamethods.h"
#include "optionals.h"
#include "table.h"
#include "text.h"
diff --git a/builtins/array.h b/builtins/array.h
index 478cd773..1e945e5e 100644
--- a/builtins/array.h
+++ b/builtins/array.h
@@ -5,7 +5,6 @@
#include <stdbool.h>
#include "datatypes.h"
-#include "functions.h"
#include "integers.h"
#include "types.h"
#include "util.h"
diff --git a/builtins/channel.c b/builtins/channel.c
index ffe9318b..11978397 100644
--- a/builtins/channel.c
+++ b/builtins/channel.c
@@ -11,7 +11,7 @@
#include <sys/param.h>
#include "array.h"
-#include "functions.h"
+#include "metamethods.h"
#include "integers.h"
#include "siphash.h"
#include "text.h"
diff --git a/builtins/functiontype.c b/builtins/functiontype.c
new file mode 100644
index 00000000..c376ba26
--- /dev/null
+++ b/builtins/functiontype.c
@@ -0,0 +1,35 @@
+// Logic for handling function type values
+
+#include "datatypes.h"
+#include "table.h"
+#include "text.h"
+#include "types.h"
+#include "util.h"
+
+static Table_t function_names = {};
+
+public void register_function(void *fn, Text_t name)
+{
+ Table$set(&function_names, &fn, &name, Table$info(Function$info("???"), &Text$info));
+}
+
+public Text_t *get_function_name(void *fn)
+{
+ return Table$get(function_names, &fn, Table$info(Function$info("???"), &Text$info));
+}
+
+public Text_t Func$as_text(const void *fn, bool colorize, const TypeInfo *type)
+{
+ (void)fn;
+ Text_t text = Text$from_str(type->FunctionInfo.type_str);
+ if (fn) {
+ Text_t *name = get_function_name(*(void**)fn);
+ if (name)
+ text = *name;
+ }
+ if (fn && colorize)
+ text = Text$concat(Text("\x1b[32;1m"), text, Text("\x1b[m"));
+ return text;
+}
+
+// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/functiontype.h b/builtins/functiontype.h
new file mode 100644
index 00000000..e3feb03e
--- /dev/null
+++ b/builtins/functiontype.h
@@ -0,0 +1,9 @@
+#pragma once
+
+// Logic for handling function type values
+
+void register_function(void *fn, Text_t name);
+Text_t *get_function_name(void *fn);
+Text_t Func$as_text(const void *fn, bool colorize, const TypeInfo *type);
+
+// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/integers.h b/builtins/integers.h
index c0fceb34..1c0ab1cd 100644
--- a/builtins/integers.h
+++ b/builtins/integers.h
@@ -8,8 +8,8 @@
#include <gmp.h>
#include "datatypes.h"
-#include "functions.h"
#include "nums.h"
+#include "stdlib.h"
#include "types.h"
#include "util.h"
diff --git a/builtins/metamethods.c b/builtins/metamethods.c
new file mode 100644
index 00000000..a244bf75
--- /dev/null
+++ b/builtins/metamethods.c
@@ -0,0 +1,123 @@
+// Metamethods are methods that all types share for hashing, equality, comparison, and textifying
+
+#include <stdint.h>
+
+#include "array.h"
+#include "channel.h"
+#include "functiontype.h"
+#include "metamethods.h"
+#include "optionals.h"
+#include "pointer.h"
+#include "siphash.h"
+#include "table.h"
+#include "text.h"
+#include "util.h"
+
+
+PUREFUNC public uint64_t generic_hash(const void *obj, const TypeInfo *type)
+{
+ switch (type->tag) {
+ case TextInfo: return Text$hash((void*)obj);
+ case ArrayInfo: return Array$hash(obj, type);
+ case ChannelInfo: return Channel$hash((Channel_t**)obj, type);
+ case TableInfo: return Table$hash(obj, type);
+ case OptionalInfo: return is_null(obj, type->OptionalInfo.type) ? 0 : generic_hash(obj, type->OptionalInfo.type);
+ case EmptyStructInfo: return 0;
+ case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
+ if (!type->CustomInfo.hash)
+ goto hash_data;
+ return type->CustomInfo.hash(obj, type);
+ case PointerInfo: case FunctionInfo: case TypeInfoInfo: case OpaqueInfo: default: {
+ hash_data:;
+ return siphash24((void*)obj, (size_t)(type->size));
+ }
+ }
+}
+
+PUREFUNC public int32_t generic_compare(const void *x, const void *y, const TypeInfo *type)
+{
+ if (x == y) return 0;
+
+ 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 ChannelInfo: return Channel$compare((Channel_t**)x, (Channel_t**)y, type);
+ case TableInfo: return Table$compare(x, y, type);
+ case OptionalInfo: {
+ bool x_is_null = is_null(x, type->OptionalInfo.type);
+ bool y_is_null = is_null(y, type->OptionalInfo.type);
+ if (x_is_null && y_is_null) return 0;
+ else if (x_is_null != y_is_null) return (int32_t)y_is_null - (int32_t)x_is_null;
+ else return generic_compare(x, y, type->OptionalInfo.type);
+ }
+ case EmptyStructInfo: return 0;
+ case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
+ if (!type->CustomInfo.compare)
+ goto compare_data;
+ return type->CustomInfo.compare(x, y, type);
+ case TypeInfoInfo: case OpaqueInfo: default:
+ compare_data:
+ return (int32_t)memcmp((void*)x, (void*)y, (size_t)(type->size));
+ }
+}
+
+PUREFUNC public bool generic_equal(const void *x, const void *y, const TypeInfo *type)
+{
+ if (x == y) return true;
+
+ 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 ChannelInfo: return Channel$equal((Channel_t**)x, (Channel_t**)y, type);
+ case TableInfo: return Table$equal(x, y, type);
+ case EmptyStructInfo: return true;
+ case OptionalInfo: {
+ bool x_is_null = is_null(x, type->OptionalInfo.type);
+ bool y_is_null = is_null(y, type->OptionalInfo.type);
+ if (x_is_null && y_is_null) return true;
+ else if (x_is_null != y_is_null) return false;
+ else return generic_equal(x, y, type->OptionalInfo.type);
+ }
+ case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
+ if (!type->CustomInfo.equal)
+ goto use_generic_compare;
+ return type->CustomInfo.equal(x, y, type);
+ case TypeInfoInfo: case OpaqueInfo: default:
+ use_generic_compare:
+ return (generic_compare(x, y, type) == 0);
+ }
+}
+
+public Text_t 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 Text$as_text(obj, colorize, type);
+ case ArrayInfo: return Array$as_text(obj, colorize, type);
+ case ChannelInfo: return Channel$as_text((Channel_t**)obj, colorize, type);
+ case TableInfo: return Table$as_text(obj, colorize, type);
+ case TypeInfoInfo: return Type$as_text(obj, colorize, type);
+ case OptionalInfo: return Optional$as_text(obj, colorize, type);
+ case EmptyStructInfo: return colorize ?
+ Text$concat(Text("\x1b[0;1m"), Text$from_str(type->EmptyStructInfo.name), Text("\x1b[m()"))
+ : Text$concat(Text$from_str(type->EmptyStructInfo.name), Text("()"));
+ case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
+ if (!type->CustomInfo.as_text)
+ fail("No text function provided for type!\n");
+ return type->CustomInfo.as_text(obj, colorize, type);
+ case OpaqueInfo: return Text("???");
+ default: errx(1, "Invalid type tag: %d", type->tag);
+ }
+}
+
+public int generic_print(const void *obj, bool colorize, const TypeInfo *type)
+{
+ Text_t text = generic_as_text(obj, colorize, type);
+ return Text$print(stdout, text) + printf("\n");
+}
+
+
+// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/metamethods.h b/builtins/metamethods.h
new file mode 100644
index 00000000..be712a61
--- /dev/null
+++ b/builtins/metamethods.h
@@ -0,0 +1,15 @@
+#pragma once
+// Metamethods are methods that all types share:
+
+#include <stdint.h>
+
+#include "types.h"
+#include "util.h"
+
+PUREFUNC uint64_t generic_hash(const void *obj, const TypeInfo *type);
+PUREFUNC int32_t generic_compare(const void *x, const void *y, const TypeInfo *type);
+PUREFUNC bool generic_equal(const void *x, const void *y, const TypeInfo *type);
+Text_t generic_as_text(const void *obj, bool colorize, const TypeInfo *type);
+int generic_print(const void *obj, bool colorize, const TypeInfo *type);
+
+// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/optionals.c b/builtins/optionals.c
index 8b890c97..276e92f8 100644
--- a/builtins/optionals.c
+++ b/builtins/optionals.c
@@ -3,6 +3,7 @@
#include "bool.h"
#include "datatypes.h"
#include "integers.h"
+#include "metamethods.h"
#include "thread.h"
#include "text.h"
#include "util.h"
diff --git a/builtins/path.c b/builtins/path.c
index 09cdc4f1..0168462f 100644
--- a/builtins/path.c
+++ b/builtins/path.c
@@ -14,7 +14,6 @@
#include "array.h"
#include "files.h"
-#include "functions.h"
#include "integers.h"
#include "optionals.h"
#include "path.h"
diff --git a/builtins/pattern.c b/builtins/pattern.c
index 6f46000c..7e82ec13 100644
--- a/builtins/pattern.c
+++ b/builtins/pattern.c
@@ -6,7 +6,6 @@
#include <uniname.h>
#include "array.h"
-#include "functions.h"
#include "integers.h"
#include "pattern.h"
#include "table.h"
diff --git a/builtins/pointer.c b/builtins/pointer.c
index 7113f839..1ad9f407 100644
--- a/builtins/pointer.c
+++ b/builtins/pointer.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <sys/param.h>
-#include "functions.h"
+#include "metamethods.h"
#include "text.h"
#include "types.h"
#include "util.h"
diff --git a/builtins/shell.c b/builtins/shell.c
index d8807188..a73b0aac 100644
--- a/builtins/shell.c
+++ b/builtins/shell.c
@@ -3,7 +3,6 @@
#include <stdint.h>
#include "array.h"
-#include "functions.h"
#include "integers.h"
#include "pattern.h"
#include "shell.h"
diff --git a/builtins/functions.c b/builtins/stdlib.c
index aabb7cab..e072a8fc 100644
--- a/builtins/functions.c
+++ b/builtins/stdlib.c
@@ -1,4 +1,5 @@
// Built-in functions
+
#include <errno.h>
#include <execinfo.h>
#include <gc.h>
@@ -8,23 +9,14 @@
#include <sys/param.h>
#include <sys/random.h>
#include <time.h>
-#include <uninorm.h>
-#include <unistd.h>
-#include "array.h"
-#include "bool.h"
-#include "channel.h"
#include "files.h"
-#include "functions.h"
#include "integers.h"
-#include "optionals.h"
+#include "metamethods.h"
#include "pattern.h"
-#include "pointer.h"
#include "siphash.h"
-#include "string.h"
#include "table.h"
#include "text.h"
-#include "types.h"
#include "util.h"
public void tomo_init(void)
@@ -42,18 +34,6 @@ public void tomo_init(void)
errx(1, "Couldn't set printf specifier");
}
-static Table_t function_names = {};
-
-public void register_function(void *fn, Text_t name)
-{
- Table$set(&function_names, &fn, &name, Table$info(Function$info("???"), &Text$info));
-}
-
-public Text_t *get_function_name(void *fn)
-{
- return Table$get(function_names, &fn, Table$info(Function$info("???"), &Text$info));
-}
-
void print_stack_trace(FILE *out, int start, int stop)
{
// Print stack trace:
@@ -119,111 +99,6 @@ public _Noreturn void fail_source(const char *filename, int64_t start, int64_t e
_exit(1);
}
-PUREFUNC public uint64_t generic_hash(const void *obj, const TypeInfo *type)
-{
- switch (type->tag) {
- case TextInfo: return Text$hash((void*)obj);
- case ArrayInfo: return Array$hash(obj, type);
- case ChannelInfo: return Channel$hash((Channel_t**)obj, type);
- case TableInfo: return Table$hash(obj, type);
- case OptionalInfo: return is_null(obj, type->OptionalInfo.type) ? 0 : generic_hash(obj, type->OptionalInfo.type);
- case EmptyStructInfo: return 0;
- case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
- if (!type->CustomInfo.hash)
- goto hash_data;
- return type->CustomInfo.hash(obj, type);
- case PointerInfo: case FunctionInfo: case TypeInfoInfo: case OpaqueInfo: default: {
- hash_data:;
- return siphash24((void*)obj, (size_t)(type->size));
- }
- }
-}
-
-PUREFUNC public int32_t generic_compare(const void *x, const void *y, const TypeInfo *type)
-{
- if (x == y) return 0;
-
- 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 ChannelInfo: return Channel$compare((Channel_t**)x, (Channel_t**)y, type);
- case TableInfo: return Table$compare(x, y, type);
- case OptionalInfo: {
- bool x_is_null = is_null(x, type->OptionalInfo.type);
- bool y_is_null = is_null(y, type->OptionalInfo.type);
- if (x_is_null && y_is_null) return 0;
- else if (x_is_null != y_is_null) return (int32_t)y_is_null - (int32_t)x_is_null;
- else return generic_compare(x, y, type->OptionalInfo.type);
- }
- case EmptyStructInfo: return 0;
- case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
- if (!type->CustomInfo.compare)
- goto compare_data;
- return type->CustomInfo.compare(x, y, type);
- case TypeInfoInfo: case OpaqueInfo: default:
- compare_data:
- return (int32_t)memcmp((void*)x, (void*)y, (size_t)(type->size));
- }
-}
-
-PUREFUNC public bool generic_equal(const void *x, const void *y, const TypeInfo *type)
-{
- if (x == y) return true;
-
- 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 ChannelInfo: return Channel$equal((Channel_t**)x, (Channel_t**)y, type);
- case TableInfo: return Table$equal(x, y, type);
- case EmptyStructInfo: return true;
- case OptionalInfo: {
- bool x_is_null = is_null(x, type->OptionalInfo.type);
- bool y_is_null = is_null(y, type->OptionalInfo.type);
- if (x_is_null && y_is_null) return true;
- else if (x_is_null != y_is_null) return false;
- else return generic_equal(x, y, type->OptionalInfo.type);
- }
- case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
- if (!type->CustomInfo.equal)
- goto use_generic_compare;
- return type->CustomInfo.equal(x, y, type);
- case TypeInfoInfo: case OpaqueInfo: default:
- use_generic_compare:
- return (generic_compare(x, y, type) == 0);
- }
-}
-
-public Text_t 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 Text$as_text(obj, colorize, type);
- case ArrayInfo: return Array$as_text(obj, colorize, type);
- case ChannelInfo: return Channel$as_text((Channel_t**)obj, colorize, type);
- case TableInfo: return Table$as_text(obj, colorize, type);
- case TypeInfoInfo: return Type$as_text(obj, colorize, type);
- case OptionalInfo: return Optional$as_text(obj, colorize, type);
- case EmptyStructInfo: return colorize ?
- Text$concat(Text("\x1b[0;1m"), Text$from_str(type->EmptyStructInfo.name), Text("\x1b[m()"))
- : Text$concat(Text$from_str(type->EmptyStructInfo.name), Text("()"));
- case CustomInfo: case StructInfo: case EnumInfo: case CStringInfo: // These all share the same info
- if (!type->CustomInfo.as_text)
- fail("No text function provided for type!\n");
- return type->CustomInfo.as_text(obj, colorize, type);
- case OpaqueInfo: return Text("???");
- default: errx(1, "Invalid type tag: %d", type->tag);
- }
-}
-
-public int generic_print(const void *obj, bool colorize, const TypeInfo *type)
-{
- Text_t text = generic_as_text(obj, colorize, type);
- return Text$print(stdout, text) + printf("\n");
-}
-
public Text_t builtin_last_err()
{
return Text$from_str(strerror(errno));
diff --git a/builtins/functions.h b/builtins/stdlib.h
index 3ad2ef18..da3ddbf7 100644
--- a/builtins/functions.h
+++ b/builtins/stdlib.h
@@ -11,9 +11,6 @@
#include "util.h"
void tomo_init(void);
-void register_function(void *fn, Text_t name);
-Text_t *get_function_name(void *fn);
-
__attribute__((format(printf, 1, 2)))
_Noreturn void fail(const char *fmt, ...);
__attribute__((format(printf, 4, 5)))
@@ -29,11 +26,6 @@ void say(Text_t text, bool newline);
Text_t ask(Text_t prompt, bool bold, bool force_tty);
_Noreturn void tomo_exit(Text_t text, int32_t status);
-PUREFUNC uint64_t generic_hash(const void *obj, const TypeInfo *type);
-PUREFUNC int32_t generic_compare(const void *x, const void *y, const TypeInfo *type);
-PUREFUNC bool generic_equal(const void *x, const void *y, const TypeInfo *type);
-Text_t generic_as_text(const void *obj, bool colorize, const TypeInfo *type);
-int generic_print(const void *obj, bool colorize, const TypeInfo *type);
Closure_t spawn(Closure_t fn);
bool pop_flag(char **argv, int *i, const char *flag, Text_t *result);
void print_stack_trace(FILE *out, int start, int stop);
diff --git a/builtins/table.c b/builtins/table.c
index c8a73fdf..1b017ff6 100644
--- a/builtins/table.c
+++ b/builtins/table.c
@@ -20,6 +20,7 @@
#include "c_string.h"
#include "datatypes.h"
#include "memory.h"
+#include "metamethods.h"
#include "siphash.h"
#include "table.h"
#include "text.h"
diff --git a/builtins/text.c b/builtins/text.c
index 8ed3cfd3..42a6c165 100644
--- a/builtins/text.c
+++ b/builtins/text.c
@@ -62,7 +62,6 @@
#include <uniname.h>
#include "array.h"
-#include "functions.h"
#include "integers.h"
#include "pattern.h"
#include "table.h"
diff --git a/builtins/tomo.h b/builtins/tomo.h
index b487f09e..78458304 100644
--- a/builtins/tomo.h
+++ b/builtins/tomo.h
@@ -14,10 +14,11 @@
#include "c_string.h"
#include "channel.h"
#include "datatypes.h"
-#include "functions.h"
+#include "functiontype.h"
#include "integers.h"
#include "macros.h"
#include "memory.h"
+#include "metamethods.h"
#include "nums.h"
#include "optionals.h"
#include "path.h"
diff --git a/builtins/types.c b/builtins/types.c
index 307b4756..cf0e30c1 100644
--- a/builtins/types.c
+++ b/builtins/types.c
@@ -35,18 +35,4 @@ public const TypeInfo TypeInfo$info = {
public const TypeInfo Void$info = {.size=0, .align=0, .tag=EmptyStructInfo};
public const TypeInfo Abort$info = {.size=0, .align=0, .tag=EmptyStructInfo};
-public Text_t Func$as_text(const void *fn, bool colorize, const TypeInfo *type)
-{
- (void)fn;
- Text_t text = Text$from_str(type->FunctionInfo.type_str);
- if (fn) {
- Text_t *name = get_function_name(*(void**)fn);
- if (name)
- text = *name;
- }
- if (fn && colorize)
- text = Text$concat(Text("\x1b[32;1m"), text, Text("\x1b[m"));
- return text;
-}
-
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/types.h b/builtins/types.h
index a0b48e53..bcdafad2 100644
--- a/builtins/types.h
+++ b/builtins/types.h
@@ -82,6 +82,5 @@ extern const TypeInfo Abort$info;
#define Void_t void
Text_t Type$as_text(const void *typeinfo, bool colorize, const TypeInfo *type);
-Text_t Func$as_text(const void *fn, bool colorize, const TypeInfo *type);
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/environment.c b/environment.c
index 12a470e2..ac1e27e1 100644
--- a/environment.c
+++ b/environment.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <signal.h>
-#include "builtins/functions.h"
#include "builtins/table.h"
#include "builtins/text.h"
#include "builtins/util.h"
diff --git a/parse.c b/parse.c
index e98a57d7..e1567c4b 100644
--- a/parse.c
+++ b/parse.c
@@ -12,7 +12,6 @@
#include <signal.h>
#include "ast.h"
-#include "builtins/functions.h"
#include "builtins/integers.h"
#include "builtins/text.h"
#include "builtins/table.h"