annotate paper/src/akashaMeta.c @ 116:ed6719c301fc

Update slide
author atton <atton@cr.ie.u-ryukyu.ac.jp>
date Mon, 13 Feb 2017 17:31:45 +0900
parents 36ce493604fb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 __code meta(struct Context* context, enum Code next) {
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 struct Iterator* iter = &context->data[Iter]->iterator;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 switch (context->prev) {
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 case GoToPreviousDepth:
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 if (iter->iteratedPointDataNum == 0) break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 if (iter->iteratedPointHeap == NULL) break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 unsigned int diff =(unsigned long)context->heap - (unsigned long)iter->iteratedPointHeap;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 memset(iter->iteratedPointHeap, 0, diff);
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 context->dataNum = iter->iteratedPointDataNum;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 context->heap = iter->iteratedPointHeap;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 default:
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 switch (next) {
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 case PutAndGoToNextDepth: // with assert check
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 if (context->prev == GoToPreviousDepth) break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 if (iter->previousDepth == NULL) break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 iter->previousDepth->iteratedPointDataNum = context->dataNum;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 iter->previousDepth->iteratedPointHeap = context->heap;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 default:
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 break;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 context->prev = next;
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 goto (context->code[next])(context);
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 }
36ce493604fb Add akasha result
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31