annotate final_pre/src/SingleLinkedStack.cbc.replace @ 11:ef87093f92d4

add pdf
author e155702
date Sun, 17 Feb 2019 17:13:37 +0900
parents 0e8b9646d43f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
1 __code pushSingleLinkedStack(struct Single LinkedStack* stack,union Data* data, __code next(...)) {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
2 Element* element = new Element();
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
3 element->next = stack->top;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
4 element->data = data;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
5 stack->top = element;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
6 goto next(...);
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
7 }
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
8 __code popSingleLinkedStack(struct Single LinkedStack* stack, __code next(union Data* data, ...)) {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
9 if (stack->top) {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
10 data = stack->top->data;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
11 stack->top = stack->top->next;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
12 } else {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
13 data = NULL;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
14 }
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
15 goto next(data, ...);
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
16 }