# HG changeset patch # User matac42 # Date 1637345601 -32400 # Node ID 33d7b8a86f6968b599832354a0954e1d9490c0c0 # Parent f86f3496f5fd86fa5d7042afee314c4f7644986f fix gearsDirectory diff -r f86f3496f5fd -r 33d7b8a86f69 src/parallel_execution/examples/gearsDirectory/GearsDirectoryImpl.cbc --- a/src/parallel_execution/examples/gearsDirectory/GearsDirectoryImpl.cbc Thu Nov 11 17:12:20 2021 +0900 +++ b/src/parallel_execution/examples/gearsDirectory/GearsDirectoryImpl.cbc Sat Nov 20 03:13:21 2021 +0900 @@ -24,12 +24,30 @@ return gearsDirectory; } __code cd2Child(struct GearsDirectoryImpl* gearsDirectory, __code next(...)) { - printf("hoge"); + // treeを作る + struct Tree* tree = new RedBlackTree(); + // currentDirectoryを作ったtreeに変更する + struct Tree* parentDirectory = gearsDirectory->currentDirectory; + gearsDirectory->currentDirectory = tree; + // current treeをstackにpushする + struct Stack* ds = gearsDirectory->directoryStack; + goto ds->push(parentDirectory, next(...)); +} + + +__code cd2Parent(struct GearsDirectoryImpl* gearsDirectory, __code next(...)) { + struct Stack* ds = gearsDirectory->directoryStack; + goto ds->pop(cd2Parent2); +} + +__code cd2Parent2(struct GearsDirectoryImpl* gearsDirectory, struct Tree* tree, __code next(...)) { + gearsDirectory->currentDirectory = tree; goto next(...); } -__code cd2Parent(struct GearsDirectoryImpl* gearsDirectory, __code next(...)) { - - goto next(...); +__code cd2Parent2_stub(struct Context* context) { + GearsDirectoryImpl* gearsDirectory = (GearsDirectoryImpl*)GearImpl(context, GearsDirectory, gearsDirectory); + Tree* tree = Gearef(context, Stack)->data; + enum Code next = Gearef(context, GearsDirectory)->next; + goto cd2Parent2(context, gearsDirectory, tree, next); } - diff -r f86f3496f5fd -r 33d7b8a86f69 src/parallel_execution/examples/gearsDirectory/GearsDirectory_test.cbc --- a/src/parallel_execution/examples/gearsDirectory/GearsDirectory_test.cbc Thu Nov 11 17:12:20 2021 +0900 +++ b/src/parallel_execution/examples/gearsDirectory/GearsDirectory_test.cbc Sat Nov 20 03:13:21 2021 +0900 @@ -13,6 +13,7 @@ } __code task2(GearsDirectory* gearsDirectory){ + goto gearsDirectory->cd2Parent(task3); } __code task2_stub(struct Context* context){ @@ -20,6 +21,15 @@ goto task2(context, gearsDirectory); } +__code task3(GearsDirectory* gearsDirectory){ + +} + +__code task3_stub(struct Context* context){ + GearsDirectory* gearsDirectory = (struct GearsDirectory*)Gearef(context, GearsDirectory)->gearsDirectory; + goto task3(context, gearsDirectory); +} + int main(int argc, char** argv) { printf("main\n"); goto task1();