summaryrefslogtreecommitdiff
path: root/euler
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-05-19 11:39:07 -0400
committerBenji Dial <benji@benjidial.net>2024-05-19 11:39:07 -0400
commitd2448d151edad03fb2ca2274cb02426f5fb69582 (patch)
treef5e92bf96fe3a87068a9365d693456d258c22180 /euler
parent17c1bd441de115720d7c6758550c49c1b4689900 (diff)
downloadhilbert-os-d2448d151edad03fb2ca2274cb02426f5fb69582.tar.gz
add font loading and rendering to daguerre
Diffstat (limited to 'euler')
-rw-r--r--euler/include/cstdio5
-rw-r--r--euler/makefile2
-rw-r--r--euler/source/io/fseek.cpp11
3 files changed, 17 insertions, 1 deletions
diff --git a/euler/include/cstdio b/euler/include/cstdio
index 27073db..75472c1 100644
--- a/euler/include/cstdio
+++ b/euler/include/cstdio
@@ -10,6 +10,11 @@ namespace std {
FILE *fopen(const char *filename, const char *mode);
int fclose(FILE *stream);
+ int fseek(FILE *stream, long offset, int origin);
+ #define SEEK_SET 0
+ #define SEEK_CUR 2
+ #define SEEK_END 1
+
size_t fread(void *buffer, size_t size, size_t count, FILE *stream);
}
diff --git a/euler/makefile b/euler/makefile
index 3b8022d..b9d440f 100644
--- a/euler/makefile
+++ b/euler/makefile
@@ -1,6 +1,6 @@
LIBSTDCPP_SOURCES = euler/stream.cpp strings/strlen.cpp euler/syscall.asm \
euler/entry.cpp io/fopen.cpp euler/gcc.asm memory/delete.cpp euler/heap.cpp \
- memory/new.cpp io/fclose.cpp io/fread.cpp strings/memcpy.cpp
+ memory/new.cpp io/fclose.cpp io/fread.cpp strings/memcpy.cpp io/fseek.cpp
clean:
rm -rf build
diff --git a/euler/source/io/fseek.cpp b/euler/source/io/fseek.cpp
new file mode 100644
index 0000000..3254468
--- /dev/null
+++ b/euler/source/io/fseek.cpp
@@ -0,0 +1,11 @@
+#include <cstdio>
+
+namespace std {
+
+ int fseek(FILE *stream, long offset, int origin) {
+ if (origin < 0 || origin > 2)
+ return 1;
+ return stream->try_seek((__euler_seek_from)origin, offset) ? 0 : 2;
+ }
+
+}