From 71ced998122c357bc62e54d9bb4e124c88acf94b Mon Sep 17 00:00:00 2001 From: nasr Date: Sun, 8 Mar 2026 21:01:43 +0000 Subject: refactor(main): worked on string handling in C and other stuff --- source/base/base_io.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'source/base/base_io.h') diff --git a/source/base/base_io.h b/source/base/base_io.h index ece4d7c..85fedc7 100644 --- a/source/base/base_io.h +++ b/source/base/base_io.h @@ -1,11 +1,38 @@ #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 -input_read() +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); } +#define Os_read(buffer, buffer_count) + + #endif /* BASE_IO_H */ -- cgit v1.3