diff options
Diffstat (limited to 'src/lib/libkogata')
-rw-r--r-- | src/lib/libkogata/bam.lua | 4 | ||||
-rw-r--r-- | src/lib/libkogata/debug.c | 4 | ||||
-rw-r--r-- | src/lib/libkogata/stdio.c | 22 |
3 files changed, 14 insertions, 16 deletions
diff --git a/src/lib/libkogata/bam.lua b/src/lib/libkogata/bam.lua deleted file mode 100644 index 1e69e5d..0000000 --- a/src/lib/libkogata/bam.lua +++ /dev/null @@ -1,4 +0,0 @@ -local source = Collect('src/lib/libkogata/*.c') -local obj = Compile(user_settings, source) - -libkogata = {obj, common_libc, common_libalgo, common_libkogata} diff --git a/src/lib/libkogata/debug.c b/src/lib/libkogata/debug.c index ac3e0e2..847ecca 100644 --- a/src/lib/libkogata/debug.c +++ b/src/lib/libkogata/debug.c @@ -4,13 +4,13 @@ #include <syscall.h> -void panic(const char* msg, const char* file, int line) { +void sys_panic(const char* msg, const char* file, int line) { dbg_printf("PANIC in user process\n %s\n at %s:%d\n", msg, file, line); exit(-1); while(true); } -void panic_assert(const char* assert, const char* file, int line) { +void sys_panic_assert(const char* assert, const char* file, int line) { dbg_printf("ASSERT FAILED in user process\n %s\n at %s:%d\n", assert, file, line); exit(-1); while(true); diff --git a/src/lib/libkogata/stdio.c b/src/lib/libkogata/stdio.c index e62aa30..94dec22 100644 --- a/src/lib/libkogata/stdio.c +++ b/src/lib/libkogata/stdio.c @@ -7,7 +7,7 @@ fd_t stdio = 1; -int getc() { +int getchar() { char chr; size_t sz = read(stdio, 0, 1, &chr); ASSERT(sz == 1); @@ -15,39 +15,41 @@ int getc() { } -void putc(int c) { +int putchar(int c) { char chr = c; write(stdio, 0, 1, &chr); + return 0; //TODO what? } -void puts(char* s) { - write(stdio, 0, strlen(s), s); +int puts(const char* s) { + // TODO return EOF on error + return write(stdio, 0, strlen(s), s); } void getline(char* buf, size_t l) { size_t i = 0; while (true) { - int c = getc(); + int c = getchar(); if (c == '\n') { - putc('\n'); + putchar('\n'); buf[i] = 0; break; } else if (c == '\b') { if (i > 0) { i--; - putc('\b'); + putchar('\b'); } } else if (c >= ' ') { buf[i] = c; if (i < l-1) { i++; - putc(c); + putchar(c); } } } } -void printf(char* fmt, ...) { +int printf(const char* fmt, ...) { va_list ap; char buffer[256]; @@ -55,7 +57,7 @@ void printf(char* fmt, ...) { vsnprintf(buffer, 256, fmt, ap); va_end(ap); - puts(buffer); + return puts(buffer); } /* vim: set ts=4 sw=4 tw=0 noet :*/ |