Mercurial > hg > CbC > old > akasha
view src/insert_verification/main.c @ 9:e864ede359cc
Add iterator
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Mar 2016 16:47:41 +0900 |
parents | 24ae2641fec5 |
children | b13d2c8d4b47 |
line wrap: on
line source
#include <stdio.h> #include "akashaLLRBContext.h" #include "akashaCS.h" void printTree(struct Node* node, int n) { if (node != 0) { printTree(node->left, n+1); for (int i=0;i<n;i++) printf(" "); printf("key=%d value=%d color=%s\t%p\n", node->key, node->value,/* n, */node->color==0? "R":"B", node); printTree(node->right, n+1); } } __code insertOnce_stub(struct Context* context) { goto insertOnce(context, &context->data[Node]->node); } __code insertOnce(struct Context* context, struct Node* node) { node->key = rand()%100+1; node->value = 100; context->next = ShowTree; goto meta(context, Put); } __code showTree_stub(struct Context* context) { goto showTree(context, &context->data[Tree]->tree); } __code showTree(struct Context* context, struct Tree* tree) { printTree(tree->root, 0); puts(""); goto meta(context, Exit); } int main(int argc, char const* argv[]) { goto startCode(InsertOnce); }