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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1598
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include <string.h>
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "Exec.h"
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
44ff9443cc1c Display match lines.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1600
diff changeset
6 #define BUFFER_SIZE 4096
44ff9443cc1c Display match lines.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1600
diff changeset
7
1598
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 /* これは必須 */
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 SchedDefineTask(Exec);
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 static int
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 run(SchedTask *s, void *rbuf, void *wbuf)
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 {
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 char *i_data = (char *)rbuf;
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 unsigned long long *o_data = (unsigned long long*)wbuf;
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
44ff9443cc1c Display match lines.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1600
diff changeset
21 bool a_flag = 0;
44ff9443cc1c Display match lines.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1600
diff changeset
22 bool match_flag = 0;
44ff9443cc1c Display match lines.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1600
diff changeset
23
1598
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }
1603
44ff9443cc1c Display match lines.
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1600
diff changeset
34
1598
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 return 0;
0f94d9d580f9 add regex_mas
Masa <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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 //