aboutsummaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-06-18 00:09:38 +0100
committerMichael Williamson <mike@zwobble.org>2023-06-18 00:09:38 +0100
commit0272455c8bb06d5c63220172b2888510aeb7f40b (patch)
tree2ffd2ae9e64bd590152a7fc65e554664750ea591 /runtime/src
parent7aebd6993b58a0fcb5ee716e835812cfd817c347 (diff)
Hack together working HelloWorld compilation
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/shed.c8
-rw-r--r--runtime/src/shed.h16
2 files changed, 23 insertions, 1 deletions
diff --git a/runtime/src/shed.c b/runtime/src/shed.c
index 60d66e64..d2e4a72f 100644
--- a/runtime/src/shed.c
+++ b/runtime/src/shed.c
@@ -1,11 +1,16 @@
#include <stdbool.h>
+#include <stdlib.h>
#include <unistd.h>
#include "./shed.h"
ShedObject const shed_unit = 0;
-ShedObject shed__builtins__print(ShedEnv env, ShedString value) {
+void* shed__runtime__alloc(uint64_t size) {
+ return malloc(size);
+}
+
+ShedObject shed__runtime__print(ShedClosurePointer closurePointer, ShedString value) {
size_t total_bytes_written = 0;
while (total_bytes_written < value->length) {
ssize_t bytes_written = write(STDOUT_FILENO, &value->data[total_bytes_written], value->length - total_bytes_written);
@@ -16,3 +21,4 @@ ShedObject shed__builtins__print(ShedEnv env, ShedString value) {
}
return shed_unit;
}
+
diff --git a/runtime/src/shed.h b/runtime/src/shed.h
index 0c503db8..1fd8f44d 100644
--- a/runtime/src/shed.h
+++ b/runtime/src/shed.h
@@ -14,6 +14,22 @@ struct ShedString {
typedef struct ShedString* ShedString;
+struct ShedClosure {
+ void* function;
+ ShedObject freeVariables[];
+};
+
+typedef struct ShedClosure ShedClosureStruct;
+
+typedef struct ShedClosure* ShedClosurePointer;
+
typedef ShedObject* ShedEnv;
+ShedObject shed__runtime__print(ShedClosurePointer closurePointer, ShedString value);
+
+ShedClosureStruct shed__runtime__print_closure = {
+ .function = shed__runtime__print,
+ .freeVariables = {},
+};
+
#endif