Mercurial > hg > Game > Cerium
comparison example/regex_mas/ppe/Exec.cc @ 1610:da6835e6d306 draft
fix regex_mas
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 30 Apr 2013 18:38:32 +0900 |
parents | e6855e99bdde |
children | 0003782eaec9 |
comparison
equal
deleted
inserted
replaced
1609:5d0b20373d95 | 1610:da6835e6d306 |
---|---|
13 { | 13 { |
14 char *i_data = (char *)rbuf; | 14 char *i_data = (char *)rbuf; |
15 unsigned long long *o_data = (unsigned long long*)wbuf; | 15 unsigned long long *o_data = (unsigned long long*)wbuf; |
16 unsigned long long *head_tail_flag = o_data +2; | 16 unsigned long long *head_tail_flag = o_data +2; |
17 int length = (int)s->get_inputSize(0); | 17 int length = (int)s->get_inputSize(0); |
18 int *offset = (int*)s->get_param(1); | |
19 printf("offset = %d\n",offset); | |
18 int word_num = 0; | 20 int word_num = 0; |
19 int line_num = 1; | 21 int line_num = 1; |
20 int i = 0; | 22 int i = 0; |
21 bool word_head_a_flag = false; | 23 bool word_head_a_flag = false; |
22 bool a_flag = 0; | 24 bool a_flag = 0; |
23 bool match_flag = 0; | 25 bool match_flag = 0; |
24 char line_data[BUFFER_SIZE]; | 26 char line_data[BUFFER_SIZE]; |
25 int line_length = 0; | 27 int line_length = 0; |
26 //head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A); | |
27 | 28 |
28 for (; i < length; i++) { | 29 for (; i < length; i++) { |
29 if (i_data[i] == 0x0A) { | 30 if (i_data[i] == 0x0A) { |
30 | 31 |
31 if (match_flag == true) { | 32 if (match_flag == true) { |
32 line_print(line_num,line_length,line_data); | 33 |
33 /* printf("%d : ",line_num); | |
34 for (int k = 0; k < line_length; k++) { | |
35 printf("%c",line_data[k]); | |
36 } | |
37 printf("\n"); | |
38 */ | |
39 } | 34 } |
40 match_flag = false; | 35 match_flag = false; |
41 line_length = 0; | 36 line_length = 0; |
42 line_num++; | 37 line_num++; |
43 } else { | 38 } else { |
51 a_flag = false; | 46 a_flag = false; |
52 } | 47 } |
53 } | 48 } |
54 } | 49 } |
55 | 50 |
56 //head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A); | |
57 head_tail_flag[1] = (word_head_a_flag == true); | 51 head_tail_flag[1] = (word_head_a_flag == true); |
58 | |
59 | |
60 o_data[0] = (unsigned long long)word_num; | |
61 o_data[1] = (unsigned long long)line_num; | |
62 | 52 |
63 return 0; | 53 return 0; |
64 } | 54 } |
65 | 55 |
66 void line_print(int _line_num,int _line_length,char *input_data){ | 56 void line_print(int _line_num,int _line_length,char *input_data){ |