changeset 144:eef045e9772a

update pipe_read
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 15 Dec 2019 13:43:23 +0900
parents f70c4ec3fb8a
children 6c81e02e323f
files src/gearsTools/trans_impl.pl src/impl/PipeRead.cbc
diffstat 2 files changed, 61 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/gearsTools/trans_impl.pl	Sat Dec 14 18:52:21 2019 +0900
+++ b/src/gearsTools/trans_impl.pl	Sun Dec 15 13:43:23 2019 +0900
@@ -114,6 +114,12 @@
         }
   }
 
+
+  for my $code (@{$impl_ir->{codes}}) {
+      my $code_gear = $code->{name};
+      print $out "    ${instance_impl}->$code_gear = C_$code_gear$impl_ir->{name};\n"
+  }
+
   for my $code (@{$inter_ir->{codes}}) {
       my $code_gear = $code->{name};
       print $out "    ${instance_inter}->$code_gear = C_$code_gear$impl_ir->{name};\n"
--- a/src/impl/PipeRead.cbc	Sat Dec 14 18:52:21 2019 +0900
+++ b/src/impl/PipeRead.cbc	Sun Dec 15 13:43:23 2019 +0900
@@ -1,11 +1,15 @@
-#include "../context.h";
-#interface "SysRead.h";
+#include "../context.h"
+#interface "SysRead.h"
 
 // ----
 // 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, int i, struct pipe* p, __code next(...));
+//   __code next(...);
 // } PipeRead;
 // ----
 
@@ -13,12 +17,47 @@
     struct SysRead* sys_read  = new SysRead();
     struct PipeRead* pipe_read = new PipeRead();
     sys_read->sys_read = (union Data*)pipe_read;
-    pipe_read->num = NULL;
+    pipe_read->p = NULL;
+    pipe_read->i  = 0;
+    pipe_read->n  = 0;
+    sys_read->impl = NULL;
+    sys_read->addr = NULL;
+    sys_read->n  = 0;
+    pipe_read->cbc_piperead1 = C_cbc_piperead1PipeRead;
+    pipe_read->cbc_piperead2 = C_cbc_piperead2PipeRead;
+    pipe_read->cbc_piperead3 = C_cbc_piperead3PipeRead;
+    pipe_read->next = C_nextPipeRead;
     sys_read->read = C_readPipeRead;
     sys_read->next = C_nextPipeRead;
     return sys_read;
 }
-__code readPipeRead(__code next(...)) {
+
+SysRead* createPipeReadUseArgs(struct Context* cbc_context,struct pipe* p, char* addr, int n) {
+    struct SysRead* sys_read  = new SysRead();
+    struct PipeRead* pipe_read = new PipeRead();
+    sys_read->sys_read = (union Data*)pipe_read;
+    pipe_read->p = p;
+    pipe_read->i  = 0;
+    pipe_read->n  = n;
+    sys_read->impl = (union Data*)p;
+    sys_read->addr = addr;
+    sys_read->n  = n;
+    sys_read->read = C_readPipeRead;
+    sys_read->next = C_nextPipeRead;
+    return sys_read;
+}
+
+__code cbc_piperead1PipeRead(struct PipeRead* sys_read, struct pipe* p, __code next(...)) {
+
+  goto next(...);
+}
+
+__code cbc_piperead2PipeRead(struct PipeRead* sys_read, int i, int n, struct pipe* p, __code next(...)) {
+
+  goto next(...);
+}
+
+__code cbc_piperead3PipeRead(struct PipeRead* sys_read, int i, struct pipe* p, __code next(...)) {
 
   goto next(...);
 }
@@ -27,3 +66,12 @@
 
 }
 
+__code readPipeRead(struct PipeRead* sys_read, union Data* impl, char* addr, int n, __code next(int ret,...)) {
+
+  goto next(int ret,...);
+}
+
+__code nextPipeRead(...) {
+
+}
+