changeset 280:9f28b86fecc5

add nonefiles
author menikon <e165723@ie.u-ryukyu.ac.jp>
date Tue, 21 Jan 2020 15:52:07 +0900
parents 2842d9e65751
children 648247c08bbd
files src/impl/file_impl_none.cbc src/impl/none.h
diffstat 2 files changed, 49 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/impl/file_impl_none.cbc	Tue Jan 21 15:52:07 2020 +0900
@@ -0,0 +1,46 @@
+#include "../context.h"
+#interface "file.h"
+
+// ----
+// typedef struct none<Impl, Isa> impl file {
+//
+// } none;
+// ----
+
+file* createnone(struct Context* cbc_context) {
+    struct file* file  = new file();
+    struct none* none = new none();
+    file->file = (union Data*)none;
+    file->remoe  = 0;
+    file->off = 0;
+    file->st = NULL;
+    file->addr = NULL;
+    file->pipe  = 0;
+    file->inode  = 0;
+    file->n  = 0;
+    file->fd  = 0;
+    file->stat = C_statnone;
+    file->read = C_readnone;
+    file->write = C_writenone;
+    file->close = C_closenone;
+    return file;
+}
+__code statnone(struct none* file, struct stat* st, __code next(...)) {
+
+    goto next(...);
+}
+
+__code readnone(struct none* file, char* addr, __code next(...)) {
+
+    goto next(...);
+}
+
+__code writenone(struct none* file, char* addr, int n, __code next(...)) {
+
+    goto next(...);
+}
+
+__code closenone(struct none* file,int fd, __code next(...)) {
+
+    goto next(...);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/impl/none.h	Tue Jan 21 15:52:07 2020 +0900
@@ -0,0 +1,3 @@
+typedef struct none<Impl, Isa> impl file {
+
+} none;