# HG changeset patch # User Masa # Date 1368521300 -32400 # Node ID 0003782eaec95721c3cad1960ffcf79e24b733ec # Parent 05d449e7b9f8d906f737d7e67f1ca21fd5b4b8fd printf move Exec.cc to Print.cc & display result the first letter in match line. diff -r 05d449e7b9f8 -r 0003782eaec9 example/regex_mas/b.txt --- a/example/regex_mas/b.txt Tue May 14 13:40:50 2013 +0900 +++ b/example/regex_mas/b.txt Tue May 14 17:48:20 2013 +0900 @@ -1,4 +1,4 @@ -ab aaa dddd ssss abab -ab bbbbbbbbbb aaaaaaa -aaaaaaa aaaaaaaaa aaa -ab aaaab +1cb aaa dddd ssss ababx +2ab bbbbbbbbbb aaaaaaa +3aaaaaaa aaaaaaaaa aaa +4ab aaaab diff -r 05d449e7b9f8 -r 0003782eaec9 example/regex_mas/ppe/Exec.cc --- a/example/regex_mas/ppe/Exec.cc Tue May 14 13:40:50 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue May 14 17:48:20 2013 +0900 @@ -2,7 +2,7 @@ #include #include "Exec.h" #include "Func.h" -void line_print(int,int,char*); +//void line_print(int,int,char*); #define BUFFER_SIZE 4096 /* これは必須 */ @@ -13,31 +13,25 @@ { char *i_data = (char *)rbuf; unsigned long long *o_data = (unsigned long long*)wbuf; - unsigned long long *head_tail_flag = o_data +2; int length = (int)s->get_inputSize(0); - int *offset = (int*)s->get_param(1); - printf("offset = %d\n",offset); - int word_num = 0; - int line_num = 1; + //int *offset = (int*)s->get_param(1); + //printf("offset = %d\n",offset); int i = 0; - bool word_head_a_flag = false; + int j = 0; + int line_head_diff = 1; bool a_flag = 0; bool match_flag = 0; - char line_data[BUFFER_SIZE]; - int line_length = 0; for (; i < length; i++) { if (i_data[i] == 0x0A) { if (match_flag == true) { - + o_data[j] = *((char *)rbuf + i - line_head_diff + 1); + j++; } match_flag = false; - line_length = 0; - line_num++; + line_head_diff = 0; } else { - line_data[line_length] = i_data[i]; - line_length++; if (i_data[i] == 0x61) { a_flag = true; }else if ((i_data[i] == 0x62) && (a_flag == true)) { @@ -46,19 +40,18 @@ a_flag = false; } } + line_head_diff++; } - head_tail_flag[1] = (word_head_a_flag == true); - return 0; } -void line_print(int _line_num,int _line_length,char *input_data){ - - printf("%d : ",_line_num); - for (int k = 0; k < _line_length; k++) { - printf("%c",input_data[k]); - } - printf("\n"); -} - +//void line_print(int _line_num,int _line_length,char *input_data){ +// +// printf("%d : ",_line_num); +// for (int k = 0; k < _line_length; k++) { +// printf("%c",input_data[k]); +// } +// printf("\n"); +//} +// diff -r 05d449e7b9f8 -r 0003782eaec9 example/regex_mas/ppe/Print.cc --- a/example/regex_mas/ppe/Print.cc Tue May 14 13:40:50 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Tue May 14 17:48:20 2013 +0900 @@ -13,77 +13,8 @@ WordCount *w = *(WordCount**)rbuf; unsigned long long *idata = w->o_data; // long task_num = w->task_num; - long status_num = w->status_num; - int out_task_num = w->out_task_num; - - /* - * head_flag - * o_data[0] - * o_data[1] - * - */ - unsigned long long word_data[2]; - - int flag_cal_sum = 0; - //printf("pad %d\n",pad); - - - /* head_tail_flag : task = 2 : 1 - * - * head_tail_flag[2] - * ___________ __________ - * | | | - * | head_flag | tail_fag | - * |___________|__________| - * [0] [1] - * - * |----------------------| - * unsigned long long - * 16byte - * - * 配列先頭の head_flag はみない - * 配列末尾の tail_flag はみない - * 担当範囲前の末尾文字が「改行と、スペース以外」(tail_flag = 1)で、 - * 担当範囲の先頭文字が「改行とスペース」(head_flag = 0)の場合 - * 単語数を +1 することで、整合性がとれる。 - * - * ex. - * task_num 4 - * head_tail_flag[8] - * - * 0 1 2 3 4 5 6 7 - * ___ ___ ___ ___ ___ ___ ___ ___ - * | h | t | h | t | h | t | h | t | - * |___|___|___|___|___|___|___|___| - * |-------|-------|-------| - * 比較 比較 比較 - * - */ - - //s->printf("start sum\n"); - - for (int i = 0; i < status_num; i++) { - word_data[i] = 0; + for (int i = 0;i < 4;i++) { + s->printf("%c\n",(char)idata[i]); } - - for (int i = 0; i < out_task_num ; i++) { - word_data[0] += idata[i*w->out_size+0]; - word_data[1] += idata[i*w->out_size+1]; - unsigned long long *head_tail_flag = - &idata[i*w->out_size+2]; - if((i!=out_task_num-1)&& - (head_tail_flag[1] == 1) && (head_tail_flag[4] == 0)) { - flag_cal_sum++; - } - } - - word_data[0] += flag_cal_sum; - - //for (int i = status_num-1; i >=0; i--) { - // s->printf("%llu ",word_data[i]); - //} - - //s->printf("\n"); - return 0; }