Mercurial > hg > Papers > 2022 > ikki-master
annotate Paper/src/WcImpl.cbc @ 10:7573c185aecf
add impl
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 25 Jan 2022 22:27:17 +0900 |
parents | 38dfa4d8b0be |
children |
rev | line source |
---|---|
6
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 __code putString(struct WcImpl* wc, int line, __code next(...)){ |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 if (wc->strTable[line] != NULL){ |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 wcString* string = NEW(wcString); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 string->str = wc->strTable[line]; |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 goto countUp(string, next); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 } else { |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 goto showResult(next); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 } |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 } |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 __code countUp(struct WcImpl* wc, wcString* string, __code next(...)) { |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 printf("countUp「%s」\n", string->str); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 wc->lineNum = wc->lineNum + 1; |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 int num = wc->lineNum; |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 wc->wordNum = wc->wordNum + strlen(string->str); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 Gearef(context, Wc)->line = num; |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 goto putString(num, next); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 } |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 __code showResult(struct WcImpl* wc, __code next(...)) { |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 printf("Number of Words is 「%d」\n", wc->wordNum); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 printf("EOF and finish codes\n"); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 goto next(...); |
38dfa4d8b0be
add GearsFile & Directory
ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 } |