# HG changeset patch # User Masataka Kohagura # Date 1387721555 -32400 # Node ID 7122e6edce5e5189cc54fdbd005661771a903378 # Parent 429cf7e669a1c5b96a06c6511f00622be771625a add Read.cc & Read.h diff -r 429cf7e669a1 -r 7122e6edce5e example/regex_mas/ppe/Read.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/regex_mas/ppe/Read.cc Sun Dec 22 23:12:35 2013 +0900 @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "SchedTask.h" +#include "Print.h" +#include "Func.h" + +/* これは必須 */ +SchedDefineTask1(TASK_READ,Read_task); + +static int +Read_task(SchedTask *s, void *rbuf, void *wbuf) +{ + int *fd = (int *)s->get_input(rbuf,0); ///ファイルディスクリプタの受取 + + long task_number = (long)s->get_param(0); //何番目のtaskか + long division_size = (long)s->get_param(1); + long read_size = (long)s->get_param(2); + + char *readtext = (char*)s->get_output(wbuf,0); + + char *text = (char*)s->allocate(sizeof(char)*read_size + 1); + //char text[(long)read_size]; + text[(long)read_size + 1] = '\0'; + + pread(*fd, text, (long)read_size , division_size*task_number); + + readtext = text; + + return 0; +} diff -r 429cf7e669a1 -r 7122e6edce5e example/regex_mas/ppe/Read.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/regex_mas/ppe/Read.h Sun Dec 22 23:12:35 2013 +0900 @@ -0,0 +1,7 @@ +#ifndef INCLUDED_TASK_HELLO +#define INCLUDED_TASK_HELLO + +#include "SchedTask.h" + + +#endif