Mercurial > baum
comparison actions.c @ 26:f0856c177403
removed obsolete stuff; only relevant stuff is extern now; refactoring
author | meillo@marmaro.de |
---|---|
date | Tue, 19 Feb 2008 22:23:37 +0100 |
parents | b62288419c1c |
children | cd979b979610 |
comparison
equal
deleted
inserted
replaced
25:6f2c1f9dc08f | 26:f0856c177403 |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <string.h> | 3 #include <string.h> |
4 #include "baum.h" | 4 #include "baum.h" |
5 #include "actions.h" | 5 #include "actions.h" |
6 | |
7 unsigned char action_print(struct Node* node); | |
8 unsigned char action_sum(struct Node* node); | |
9 unsigned char action_number(struct Node* node); | |
10 unsigned char action_input(struct Node* node); | |
11 unsigned char action_times(struct Node* node); | |
12 unsigned char action_blackhole(struct Node* node); | |
13 | |
6 | 14 |
7 | 15 |
8 unsigned char action(struct Node* node) { | 16 unsigned char action(struct Node* node) { |
9 if (node == NULL) { | 17 if (node == NULL) { |
10 fprintf(stderr, "action of non existing node\n"); | 18 fprintf(stderr, "action of non existing node\n"); |
11 return 0; | 19 return 0; |
12 } | 20 } |
13 | 21 |
22 logit(node->name); | |
23 | |
14 if (strcmp(node->name, "print") == 0) { | 24 if (strcmp(node->name, "print") == 0) { |
15 logit("print-node"); | |
16 return action_print(node); | 25 return action_print(node); |
17 | 26 |
18 } else if (strcmp(node->name, "sum") == 0) { | 27 } else if (strcmp(node->name, "sum") == 0) { |
19 logit("sum-node"); | |
20 return action_sum(node); | 28 return action_sum(node); |
21 | 29 |
22 } else if (strcmp(node->name, "number") == 0) { | 30 } else if (strcmp(node->name, "number") == 0) { |
23 logit("number-node"); | |
24 return action_number(node); | 31 return action_number(node); |
25 | 32 |
26 } else if (strcmp(node->name, "input") == 0) { | 33 } else if (strcmp(node->name, "input") == 0) { |
27 logit("input-node"); | |
28 return action_input(node); | 34 return action_input(node); |
29 | 35 |
30 } else if (strcmp(node->name, "times") == 0) { | 36 } else if (strcmp(node->name, "times") == 0) { |
31 logit("times-node"); | |
32 return action_times(node); | 37 return action_times(node); |
33 | 38 |
34 } else if (strcmp(node->name, "blackhole") == 0) { | 39 } else if (strcmp(node->name, "blackhole") == 0) { |
35 logit("blackhole-node"); | |
36 return action_blackhole(node); | 40 return action_blackhole(node); |
37 | 41 |
38 } else { | 42 } else { |
39 fprintf(stderr, "unknown kind of node"); | 43 fprintf(stderr, "unknown kind of node"); |
40 exit(4); | 44 exit(4); |