From 078e21a1feb811f9ef7797ce3ee5d2e8ffcccfce Mon Sep 17 00:00:00 2001 From: nasr Date: Fri, 17 Apr 2026 17:49:10 +0200 Subject: feature(main): during my work on other projects I improved the base library a bit. this is a drag and drop of that in the project. the next steps exit out of implementing lineair regression and attempting to calcualte what the value would be of a key in the btree... Signed-off-by: nasr feature(main): during my work on other projects I improved the base library a bit. this is a drag and drop of that in the project. the next steps exit out of implementing lineair regression and attempting to calcualte what the value would be of a key in the btree... Signed-off-by: nasr --- source/base/base_io.h | 60 --------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 source/base/base_io.h (limited to 'source/base/base_io.h') diff --git a/source/base/base_io.h b/source/base/base_io.h deleted file mode 100644 index ac55737..0000000 --- a/source/base/base_io.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef BASE_IO_H -#define BASE_IO_H - -#define STDIN_FD 0 -#define STDOUT_FD 1 -#define STDERR_FD 2 - -internal s64 -os_write(s32 fd, void const *buf, u64 count) -{ - return syscall(SYS_write, fd, buf, count); -} - -internal s64 -os_read(s32 fd, void *buf, u64 count) -{ - return syscall(SYS_read, fd, buf, count); -} - -internal void -print_s8(string8 s) -{ - os_write(STDOUT_FILENO, s.data, s.size); -} - -internal void -print(const char *str) -{ - s32 len = 0; - while (str[len]) len++; - os_write(STDOUT_FILENO, str, len); - -} - -internal void -write_int(s32 num) -{ - - if (num < 0) - { - write(STDERR_FILENO, "-", 1); - num = -num; - } - if (num >= 10) - write_int(num / 10); - char digit = '0' + (num % 10); - - write(STDERR_FILENO, &digit, 1); -} - -internal void -write_string(s32 fd, const char *str) -{ - s32 len = 0; - while (str[len]) len++; - os_write(fd, str, len); -} - - -#endif /* BASE_IO_H */ -- cgit v1.3