# HG changeset patch # User meillo@marmaro.de # Date 1204471972 -3600 # Node ID 036779d5da752f2ba01c3e540c4b2bccb8c12d1c # Parent 201b4603671a97a650df8dd0c415d08a0ab8e357 "sum" node clears its value now everytime it gets called diff -r 201b4603671a -r 036779d5da75 actions.c --- a/actions.c Sun Mar 02 16:26:06 2008 +0100 +++ b/actions.c Sun Mar 02 16:32:52 2008 +0100 @@ -64,6 +64,8 @@ unsigned char action_sum(struct Node* node) { struct Node* tp; + + node->value = 0; tp = node->down; while (tp != NULL) { node->value += action(tp); @@ -93,7 +95,6 @@ /* return value */ input = action(node->down); } - insertLast(node, newNode("number", (char) input)); return 0; } diff -r 201b4603671a -r 036779d5da75 baum.c --- a/baum.c Sun Mar 02 16:26:06 2008 +0100 +++ b/baum.c Sun Mar 02 16:32:52 2008 +0100 @@ -276,16 +276,16 @@ read_input(argv[0]); if (option_verbose) { - fprintf(stderr, "\n\ntree read from input\n(should be the same without comments and empty lines)\n\n"); - printTree(root, 0); + fprintf(stderr, "\n\ntree read from input:\n"); + printTree(root, 1); } shell_return = action(root); fflush(stdout); if (option_verbose) { - fprintf(stderr, "\n\ntree after execution of the program\n\n"); - printTree(root, 0); + fprintf(stderr, "\n\nmodified tree after execution:\n"); + printTree(root, 1); } delete(root);