aboutsummaryrefslogtreecommitdiff
path: root/include/base.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/base.h')
-rw-r--r--include/base.h80
1 files changed, 42 insertions, 38 deletions
diff --git a/include/base.h b/include/base.h
index 7077731..df580c3 100644
--- a/include/base.h
+++ b/include/base.h
@@ -3,8 +3,10 @@
// ------------------------------------------------------------------------
// standard library
-//#include <arch/types.h>
-//
+#include <sys.h>
+#include <arch/types.h>
+
+// TODO: remove dependency system headers
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -125,9 +127,6 @@ char *str·copyn(char *dst, char *src, int n);
// -----------------------------------------------------------------------------
// i/o
-typedef FILE io·Stream;
-typedef struct stat io·Stat;
-
enum SeekPos
{
seek·cur = SEEK_CUR,
@@ -135,37 +134,6 @@ enum SeekPos
seek·end = SEEK_END
};
-/* XXX: change casing */
-enum
-{
- ReadOK = R_OK,
- WriteOK = W_OK,
- ExecOK = X_OK,
-};
-
-/* file handling */
-io·Stream *io·open(byte *name, byte *mode);
-int io·fd(io·Stream *s);
-int io·stat(io·Stream *s, io·Stat *buf);
-int io·close(io·Stream *s);
-byte io·getbyte(io·Stream *s);
-int io·ungetbyte(io·Stream *s, byte c);
-int io·read(io·Stream *s, int sz, int n, void *buf);
-int io·readln(io·Stream *s, int n, byte *buf);
-int io·putbyte(io·Stream *s, byte c);
-int io·putstring(io·Stream *s, string str);
-int io·write(io·Stream *s, int sz, int n, void *buf);
-int io·flush(io·Stream *s);
-int io·seek(io·Stream *s, long off, enum SeekPos whence);
-long io·tell(io·Stream *s);
-
-/* basic os helpers */
-int os·exists(byte *path, int flag);
-byte *os·dirname(byte *path);
-byte *os·basename(byte *path);
-int os·sep(void);
-
-/* io interfaces */
typedef struct io·Reader
{
int (*read)(void*, int sz, int n, void *buf);
@@ -227,6 +195,42 @@ typedef struct io·ReadWriter
} io·ReadWriter;
extern io·ReadWriter sys·ReadWriter;
+/* XXX: change casing */
+enum
+{
+ ReadOK = R_OK,
+ WriteOK = W_OK,
+ ExecOK = X_OK,
+};
+
+/* XXX(deprecated): file handling */
+
+typedef FILE io·Stream;
+typedef struct stat io·Stat;
+
+io·Stream *io·open(byte *name, byte *mode);
+int io·fd(io·Stream *s);
+int io·stat(io·Stream *s, io·Stat *buf);
+int io·close(io·Stream *s);
+byte io·getbyte(io·Stream *s);
+int io·ungetbyte(io·Stream *s, byte c);
+int io·read(io·Stream *s, int sz, int n, void *buf);
+int io·readln(io·Stream *s, int n, byte *buf);
+int io·putbyte(io·Stream *s, byte c);
+int io·putstring(io·Stream *s, string str);
+int io·write(io·Stream *s, int sz, int n, void *buf);
+int io·flush(io·Stream *s);
+int io·seek(io·Stream *s, long off, enum SeekPos whence);
+long io·tell(io·Stream *s);
+
+/* basic os helpers */
+
+int os·exists(byte *path, int flag);
+byte *os·dirname(byte *path);
+byte *os·basename(byte *path);
+int os·sep(void);
+
+/* io interfaces */
/* buffered i/o */
typedef struct io·Buffer io·Buffer;
@@ -364,9 +368,9 @@ long gz·tell(gz·Stream *s);
void exits(char *s);
void errorf(byte* fmt, ...);
-void verrorf(byte* fmt, va_list args);
+void verrorf(byte* fmt, va_list args);
void panicf(byte *fmt, ...);
-void vpanicf(byte *fmt, va_list args);
+void vpanicf(byte *fmt, va_list args);
// -----------------------------------------------------------------------------
// sorting