Mercurial > baum
comparison baum.c @ 41:1ad3d7305e5d
reduced output; cleanups
author | meillo@marmaro.de |
---|---|
date | Sat, 01 Mar 2008 20:35:00 +0100 |
parents | 5c13e29bc6fd |
children | 233ac9bea4f1 |
comparison
equal
deleted
inserted
replaced
40:5c13e29bc6fd | 41:1ad3d7305e5d |
---|---|
15 #include "actions.h" | 15 #include "actions.h" |
16 | 16 |
17 #define VERSION "0.3" | 17 #define VERSION "0.3" |
18 | 18 |
19 | 19 |
20 struct Node* root = 0; | |
21 struct Stackitem* stack = NULL; | |
22 | |
23 | |
24 void printNode(struct Node* node, int level); | 20 void printNode(struct Node* node, int level); |
25 void printTree(struct Node* root, int level); | 21 void printTree(struct Node* root, int level); |
26 struct Node* lastNode(struct Node* node); | 22 struct Node* lastNode(struct Node* node); |
27 void delete(struct Node* node); | 23 void delete(struct Node* node); |
28 | 24 |
25 | |
26 struct Stackitem { | |
27 struct Node* node; | |
28 struct Stackitem* next; | |
29 }; | |
30 | |
31 | |
32 | |
33 struct Node* root = 0; | |
34 struct Stackitem* stack = NULL; | |
29 | 35 |
30 | 36 |
31 void logit(char* text) { | 37 void logit(char* text) { |
32 if (option_verbose) { | 38 if (option_verbose) { |
33 fprintf(stderr, "[%s]\n", text); | 39 fprintf(stderr, "[%s]\n", text); |
258 } | 264 } |
259 | 265 |
260 read_input(argv[0]); | 266 read_input(argv[0]); |
261 | 267 |
262 if (option_verbose) { | 268 if (option_verbose) { |
269 fprintf(stderr, "\n\ntree read from input\n(should be the same without comments and empty lines)\n\n"); | |
263 printTree(root, 0); | 270 printTree(root, 0); |
264 } | 271 } |
265 | 272 |
266 shell_return = action(root); | 273 shell_return = action(root); |
267 fflush(stdout); | 274 fflush(stdout); |
268 | 275 |
269 if (option_verbose) { | 276 if (option_verbose) { |
277 fprintf(stderr, "\n\ntree after execution of the program\n\n"); | |
270 printTree(root, 0); | 278 printTree(root, 0); |
271 } | 279 } |
272 | 280 |
273 delete(root); | 281 delete(root); |
274 exit(shell_return); | 282 exit(shell_return); |