changeset 138:e3dd8f96c2fb

add impl file read interface
author anatofuz
date Thu, 12 Dec 2019 14:13:51 +0900
parents 7f9dac064c5f
children 0f8ae55cacbe
files src/impl/FileRead.h src/impl/PipeRead.h src/interface/SysRead.h
diffstat 3 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/FileRead.h	Thu Dec 12 14:01:06 2019 +0900
+++ b/src/impl/FileRead.h	Thu Dec 12 14:13:51 2019 +0900
@@ -1,3 +1,6 @@
 typedef struct FileRead<Type, Isa> impl SysRead {
   struct file* f;
+  int r;
+  __code cbc_fileread1(Type* file_read, struct file* f,int r,__code next(r,...));
+  __code next(...);
 } FileRead;
--- a/src/impl/PipeRead.h	Thu Dec 12 14:01:06 2019 +0900
+++ b/src/impl/PipeRead.h	Thu Dec 12 14:13:51 2019 +0900
@@ -1,5 +1,15 @@
 typedef struct PipeRead<Type, Isa> impl SysRead {
-  struct CbCPipe *pipe;
-  struct String *addr;
-  struct Integer* i;
+  struct pipe* p;
+  int i;
+  int n;
+  __code cbc_piperead1(Type* sys_read, struct pipe* p, __code next(...));
+  __code cbc_piperead2(Type* sys_read, int i, int n,struct pipe* p, __code next(...));
+  __code cbc_piperead3(Type* sys_read, struct pipe* p, int i, __code next(...));
+  __code next(...);
 } PipeRead;
+
+/*
+ __code cbc_piperead1(Impl* sys_read, struct pipe* p);
+ __code cbc_piperead2(Impl* sys_read, int i, int n,struct pipe* p);
+ __code cbc_piperead3(Impl* sys_read, struct pipe* p, int i);
+*/
--- a/src/interface/SysRead.h	Thu Dec 12 14:01:06 2019 +0900
+++ b/src/interface/SysRead.h	Thu Dec 12 14:13:51 2019 +0900
@@ -1,23 +1,9 @@
 typedef struct SysRead<Type, Impl>{
-   union  Data* sys_read;
+   union Data* sys_read;
    union Data* impl;
-   int num;
    char* addr;
-   struct file* file;
-   int r;
-   struct pipe* pipe;
+   int n;
+
    __code read(Impl* sys_read, union Data* impl, char* addr, int n, __code (*next)(int ret));
-   //__code ret(Impl* cbc_sys_file, UInteger* num);
    __code next(...);
-   //__code cbc_fileread1(Impl* sys_read, int r);
-   __code cbc_fileread(Impl* sys_read, struct file* file, char* addr, int n, __code (*next)(int ret));
-   __code cbc_piperead(Impl* sys_read, struct pipe *p, char *addr, int n, __code (*next)(int ret));
-   //__code cbc_piperead1(Impl* sys_read, struct pipe* p);
-   //__code cbc_piperead2(Impl* sys_read, int i, int n,struct pipe* p);
-   //__code cbc_piperead3(Impl* sys_read, struct pipe* p, int i);
 } SysRead;
-
-/*
- * cbc_piperead cbc_filereのAPIは微妙な違いしかない
- * union Dataから実装の型を見てキャストすると良さそう
- */