changeset 1041:9b2f5dc02b2a

...
author matac42 <matac@cr.ie.u-ryukyu.ac.jp>
date Sun, 12 Nov 2023 12:19:56 +0900
parents cf2aa790afe7
children 751d26c368fb
files src/parallel_execution/RedBlackTree.cbc src/parallel_execution/Tree.h src/parallel_execution/test/rbTreeCopy_test.cbc
diffstat 3 files changed, 20 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/RedBlackTree.cbc	Sun Nov 12 12:01:57 2023 +0900
+++ b/src/parallel_execution/RedBlackTree.cbc	Sun Nov 12 12:19:56 2023 +0900
@@ -140,19 +140,20 @@
     } else {
         node->right = newNode;
         newNode = node;
-        goto nodeStack->isEmpty(popWhenNoEmpty, next(...));
+        goto nodeStack->isEmpty(popWhenNoEmpty, popWhenEmpty);
     }
 }
 
+__code popWhenEmpty(struct Node* node, struct RedBlackTree* tree, struct Stack* inputStack, struct Stack* outputStack) {
+    struct Stack* nodeStack = tree->nodeStack;
+    goto next(...);
+}
+
 __code popWhenNoEmpty(struct Node* node, struct RedBlackTree* tree, struct Stack* inputStack, struct Stack* outputStack) {
     struct Stack* nodeStack = tree->nodeStack;
     goto nodeStack->pop(up1);
 }
 
-__code popWhenEmpty(struct Node* node, struct RedBlackTree* tree, struct Stack* inputStack, struct Stack* outputStack) {
-    
-}
-
 __code up1(struct Node* node, struct RedBlackTree* tree, struct Stack* inputStack, struct Stack* outputStack) {
     struct Stack* nodeStack = tree->nodeStack;
     goto nodeStack->pop(up2);
--- a/src/parallel_execution/Tree.h	Sun Nov 12 12:01:57 2023 +0900
+++ b/src/parallel_execution/Tree.h	Sun Nov 12 12:19:56 2023 +0900
@@ -1,12 +1,13 @@
-typedef struct Tree<>{
-    /* future Code */
-    /* Type* tree; */
-    /* Type* node; */
-    union Data* tree;
-    struct Node* node;
-    __code put(Impl* tree,Type* node, __code next(...));
-    __code get(Impl* tree, Type* node, __code next(...));
-    __code remove(Impl* tree,Type* node, __code next(...));
-    // __code clearRedBlackTree();
-    __code next(...);
+typedef struct Tree<> {
+  /* future Code */
+  /* Type* tree; */
+  /* Type* node; */
+  union Data *tree;
+  struct Node *node;
+  __code put(Impl *tree, Type *node, __code next(...));
+  __code get(Impl *tree, Type *node, __code next(...));
+  __code remove(Impl *tree, Type *node, __code next(...));
+  __code copy(Impl *tree, Type *node, __code next(...));
+  // __code clearRedBlackTree();
+  __code next(...);
 } Tree;
--- a/src/parallel_execution/test/rbTreeCopy_test.cbc	Sun Nov 12 12:01:57 2023 +0900
+++ b/src/parallel_execution/test/rbTreeCopy_test.cbc	Sun Nov 12 12:19:56 2023 +0900
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #interface "Tree.h"
 
+
 /* #include <assert.h> */
 
 __code rbTreeTest1(struct Tree* tree) {
@@ -70,7 +71,7 @@
   printf("test5\n");
   Node* node = new Node();
   node->value = (union Data*)new Integer();
-  goto tree->copy(exit_code);
+  goto tree->copy(node, exit_code);
 }
 
 __code rbTreeTest5_stub(struct Context* context) {