Add load(), load_library(), lisp std
diff --git a/src/lisp/plat/linux.c b/src/lisp/plat/linux.c
index 4a223a6..b71f342 100644
--- a/src/lisp/plat/linux.c
+++ b/src/lisp/plat/linux.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
+#include <unistd.h>
void *malloc_aligned(size_t size)
{
@@ -20,7 +21,7 @@
free(addr);
}
-void *link(dasm_State **Dst)
+void *link_program(dasm_State **Dst)
{
size_t size;
void *buf;
@@ -33,3 +34,8 @@
mprotect(buf, size, PROT_READ | PROT_EXEC);
return buf;
}
+
+bool file_exists(const char *path)
+{
+ return access(path, F_OK) == 0;
+}
diff --git a/src/lisp/plat/plat.h b/src/lisp/plat/plat.h
index 3640005..1c4216a 100644
--- a/src/lisp/plat/plat.h
+++ b/src/lisp/plat/plat.h
@@ -3,6 +3,8 @@
#include <dasm_proto.h>
#include <stddef.h>
#include <stdint.h>
+#include <stdbool.h>
+#include <sys/types.h>
/* Platform specific definitions */
@@ -11,6 +13,9 @@
void *realloc_aligned(void *addr, size_t size);
void free_aligned(void *addr);
-void *link(dasm_State **Dst);
+void *link_program(dasm_State **Dst);
+
+extern ssize_t readlink(const char *pathname, char *buf, size_t buf_size);
+bool file_exists(const char *path);
#define THREAD_LOCAL