Mercurial > hg > Papers > 2021 > ikki-sigos
diff Paper/codes/wc/UnixChrisFileImpl.cpp @ 21:218abc95edeb
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 06 May 2021 15:49:36 +0900 |
parents | 2d91b4d2569c |
children |
line wrap: on
line diff
--- a/Paper/codes/wc/UnixChrisFileImpl.cpp Thu May 06 00:00:26 2021 +0900 +++ b/Paper/codes/wc/UnixChrisFileImpl.cpp Thu May 06 15:49:36 2021 +0900 @@ -1,5 +1,5 @@ #include <stdio.h> -#impl "Wc.h" as "WcChrsImpl.h" +#impl "UnixCharImpl.h" as "UnixCharImpl.h" typedef struct UnixFileImpl <> ipml File { int fd; // unix file descriptor @@ -18,8 +18,11 @@ // Topology manageres determins input / output connection // -__code setOutput(Wc* wc, Output *output,__code next(...)) { +// Topology manageres determins input / output connection +// +__code gearsConnect(Wc* wc, Input *input, Output *output,__code next(...)) { file->reader = output ; + input->add(&file->ack,"ack"); goto next(...); } @@ -29,6 +32,7 @@ int len = read(fd, BUFSIZE, block->data); if (len <=0 ) { block->eof |= BLOCK_FLAG_EOF; + close(file->fd); return 0; } reader->put(block); @@ -43,14 +47,15 @@ if (putBlock(file,reader)) { putBlock(file,reader); } - goto next(file,...); + goto next(...); } __code uniAck(UnixFileImpl* file,Ack *ack, Output reader, __code next(...)) { if (!ack->isOk) { - close(fd); + close(file->fd); goto next(...); } putBlock(file,reader); goto next(...); // file is automaticaly put into local dataGearManger/input } +