Mercurial > hg > Papers > 2018 > ryokka-thesis
diff final_pre/src/SingleLinkedStack.cbc.replace @ 7:28f900230c26
add final_pre
author | ryokka |
---|---|
date | Mon, 19 Feb 2018 23:32:24 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/final_pre/src/SingleLinkedStack.cbc.replace Mon Feb 19 23:32:24 2018 +0900 @@ -0,0 +1,16 @@ +__code pushSingleLinkedStack(struct Single LinkedStack* stack,union Data* data, __code next(...)) { + Element* element = new Element(); + element->next = stack->top; + element->data = data; + stack->top = element; + goto next(...); +} +__code popSingleLinkedStack(struct Single LinkedStack* stack, __code next(union Data* data, ...)) { + if (stack->top) { + data = stack->top->data; + stack->top = stack->top->next; + } else { + data = NULL; + } + goto next(data, ...); +}