Mercurial > hg > Gears > Gears
changeset 985:33d7b8a86f69
fix gearsDirectory
author | matac42 <matac@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 20 Nov 2021 03:13:21 +0900 |
parents | f86f3496f5fd |
children | 3c9f6fda000d |
files | src/parallel_execution/examples/gearsDirectory/GearsDirectoryImpl.cbc src/parallel_execution/examples/gearsDirectory/GearsDirectory_test.cbc |
diffstat | 2 files changed, 33 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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); } -
--- 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();