Mercurial > hg > Game > Cerium
changeset 1604:e6855e99bdde draft
create line_print method in regex_mas
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 11 Apr 2013 23:05:04 +0900 |
parents | 44ff9443cc1c |
children | 5b99bcc6bdb0 |
files | example/regex_mas/ppe/Exec.cc |
diffstat | 1 files changed, 21 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/ppe/Exec.cc Tue Apr 09 17:17:57 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Thu Apr 11 23:05:04 2013 +0900 @@ -2,7 +2,7 @@ #include <string.h> #include "Exec.h" #include "Func.h" - +void line_print(int,int,char*); #define BUFFER_SIZE 4096 /* これは必須 */ @@ -22,27 +22,27 @@ bool a_flag = 0; bool match_flag = 0; char line_data[BUFFER_SIZE]; - int line_i = 0; + int line_length = 0; //head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A); for (; i < length; i++) { if (i_data[i] == 0x0A) { if (match_flag == true) { - printf("%d : ",line_num); - for (int k = 0; k < line_i; k++) { - printf("%c",line_data[k]); - } + line_print(line_num,line_length,line_data); +/* printf("%d : ",line_num); + for (int k = 0; k < line_length; k++) { + printf("%c",line_data[k]); + } printf("\n"); +*/ } - match_flag = false; - line_i = 0; + match_flag = false; + line_length = 0; line_num++; - //output_line_data(line_num); } else { - //input_line_data(i_data[i]); - line_data[line_i] = i_data[i]; - line_i++; + 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)) { @@ -62,10 +62,13 @@ return 0; } -/* -void input_line_data(char *input_data,char *output_data){ - int i = 0; - char *line_data =; - + +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"); } -*/ +