annotate paper/src/dequeue.c @ 16:958634b9fa32

make paper directory
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 17 Feb 2016 16:59:46 +0900
parents src/dequeue.c@a8c53472e1a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 // Dequeue
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 __code getQueue(struct Context* context, struct Queue* queue, struct Node* node) {
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 if (queue->first == 0)
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 return;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 struct Element* first = queue->first;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 queue->first = first->next;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 queue->count--;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 context->next = GetQueue;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 stack_push(context->code_stack, &context->next);
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 context->next = first->task->code;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 node->key = first->task->key;
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 goto meta(context, GetTree);
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 }
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // Meta Code Gear(stub)
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 __code getQueue_stub(struct Context* context) {
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 goto getQueue(context,
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 &context->data[ActiveQueue]->queue,
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 &context->data[Node]->node);
a8c53472e1a3 add file
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }