Mercurial > baum
comparison actions.c @ 36:b11ac43f3917
removed node blackhole and substituted by node number now executing its child
author | meillo@marmaro.de |
---|---|
date | Sat, 01 Mar 2008 17:51:25 +0100 |
parents | 4e60d96265f0 |
children | ff01f0f076e4 |
comparison
equal
deleted
inserted
replaced
35:3e93e66ff8d3 | 36:b11ac43f3917 |
---|---|
7 unsigned char action_print(struct Node* node); | 7 unsigned char action_print(struct Node* node); |
8 unsigned char action_sum(struct Node* node); | 8 unsigned char action_sum(struct Node* node); |
9 unsigned char action_number(struct Node* node); | 9 unsigned char action_number(struct Node* node); |
10 unsigned char action_input(struct Node* node); | 10 unsigned char action_input(struct Node* node); |
11 unsigned char action_times(struct Node* node); | 11 unsigned char action_times(struct Node* node); |
12 unsigned char action_blackhole(struct Node* node); | |
13 | 12 |
14 | 13 |
15 | 14 |
16 unsigned char action(struct Node* node) { | 15 unsigned char action(struct Node* node) { |
17 if (node == NULL) { | 16 if (node == NULL) { |
33 } else if (strcmp(node->name, "input") == 0) { | 32 } else if (strcmp(node->name, "input") == 0) { |
34 return action_input(node); | 33 return action_input(node); |
35 | 34 |
36 } else if (strcmp(node->name, "times") == 0) { | 35 } else if (strcmp(node->name, "times") == 0) { |
37 return action_times(node); | 36 return action_times(node); |
38 | |
39 } else if (strcmp(node->name, "blackhole") == 0) { | |
40 return action_blackhole(node); | |
41 | 37 |
42 } else { | 38 } else { |
43 fprintf(stderr, "unknown kind of node\n"); | 39 fprintf(stderr, "unknown kind of node\n"); |
44 exit(4); | 40 exit(4); |
45 } | 41 } |
69 return node->value; | 65 return node->value; |
70 } | 66 } |
71 | 67 |
72 | 68 |
73 unsigned char action_number(struct Node* node) { | 69 unsigned char action_number(struct Node* node) { |
70 action(node->down); | |
74 return node->value; | 71 return node->value; |
75 } | 72 } |
76 | 73 |
77 | 74 |
78 unsigned char action_input(struct Node* node) { | 75 unsigned char action_input(struct Node* node) { |
100 } | 97 } |
101 | 98 |
102 } | 99 } |
103 return 0; | 100 return 0; |
104 } | 101 } |
105 | |
106 | |
107 unsigned char action_blackhole(struct Node* node) { | |
108 action(node->down); | |
109 return 0; | |
110 } | |
111 | |
112 |