Mercurial > hg > Game > Cerium
annotate example/regex_mas/ppe/Exec.cc @ 1620:bb0384fb5a56 draft
add separeta in word process
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 18 May 2013 20:20:10 +0900 |
parents | 0003782eaec9 |
children | f907bbac14f2 |
rev | line source |
---|---|
1598 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include "Exec.h" | |
4 #include "Func.h" | |
1617
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
5 //void line_print(int,int,char*); |
1603 | 6 #define BUFFER_SIZE 4096 |
7 | |
1598 | 8 /* これは必須 */ |
9 SchedDefineTask(Exec); | |
10 | |
11 static int | |
12 run(SchedTask *s, void *rbuf, void *wbuf) | |
13 { | |
14 char *i_data = (char *)rbuf; | |
15 unsigned long long *o_data = (unsigned long long*)wbuf; | |
16 int length = (int)s->get_inputSize(0); | |
1620
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
17 int *offset = (int*)s->get_param(1); |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
18 printf("offset = %d\n",offset); |
1598 | 19 int i = 0; |
1617
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
20 int j = 0; |
1603 | 21 bool a_flag = 0; |
22 bool match_flag = 0; | |
23 | |
1598 | 24 for (; i < length; i++) { |
1620
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
25 if (i_data[i] == 0x61) { |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
26 a_flag = true; |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
27 }else if ((i_data[i] == 0x62) && (a_flag == true)) { |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
28 o_data[j] = *((char *)rbuf + i - 2); |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
29 match_flag = true; |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
30 }else{ |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
31 a_flag = false; |
bb0384fb5a56
add separeta in word process
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1617
diff
changeset
|
32 } |
1598 | 33 } |
1603 | 34 |
1598 | 35 return 0; |
36 } | |
1604
e6855e99bdde
create line_print method in regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1603
diff
changeset
|
37 |
1617
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
38 //void line_print(int _line_num,int _line_length,char *input_data){ |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
39 // |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
40 // printf("%d : ",_line_num); |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
41 // for (int k = 0; k < _line_length; k++) { |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
42 // printf("%c",input_data[k]); |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
43 // } |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
44 // printf("\n"); |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
45 //} |
0003782eaec9
printf move Exec.cc to Print.cc & display result the first letter in match line.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
1610
diff
changeset
|
46 // |