diff options
author | David Walter Seikel | 2012-01-10 03:49:52 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-10 03:49:52 +1000 |
commit | d5de744364f7e9c574a5f5604c94120b9eeb22a7 (patch) | |
tree | 5fc9dac30508eb05fcb96fac246b1ad60c147a75 /LuaSL/src | |
parent | Get rid of the comment function. (diff) | |
download | SledjHamr-d5de744364f7e9c574a5f5604c94120b9eeb22a7.zip SledjHamr-d5de744364f7e9c574a5f5604c94120b9eeb22a7.tar.gz SledjHamr-d5de744364f7e9c574a5f5604c94120b9eeb22a7.tar.bz2 SledjHamr-d5de744364f7e9c574a5f5604c94120b9eeb22a7.tar.xz |
Leaf cloner.
Diffstat (limited to 'LuaSL/src')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.c b/LuaSL/src/LuaSL_LSL_tree.c index cc6ed3f..3728054 100644 --- a/LuaSL/src/LuaSL_LSL_tree.c +++ b/LuaSL/src/LuaSL_LSL_tree.c | |||
@@ -154,19 +154,21 @@ static void burnLeaf(LSL_Leaf *leaf) | |||
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | LSL_Leaf *addInteger(LSL_Leaf *lval, int value) | 157 | static LSL_Leaf *cloneLeaf(LSL_Leaf *source) |
158 | { | 158 | { |
159 | LSL_Leaf *leaf = newLeaf(LSL_INTEGER, NULL, NULL); | 159 | LSL_Leaf *leaf = newLeaf(LSL_UNKNOWN, NULL, NULL); |
160 | 160 | ||
161 | if (leaf) | 161 | if (leaf) |
162 | { | 162 | memcpy(leaf, source, sizeof(LSL_Leaf)); |
163 | leaf->value.integerValue = value; | ||
164 | leaf->ignorableText = lval->ignorableText; | ||
165 | } | ||
166 | 163 | ||
167 | return leaf; | 164 | return leaf; |
168 | } | 165 | } |
169 | 166 | ||
167 | LSL_Leaf *addInteger(LSL_Leaf *lval, int value) | ||
168 | { | ||
169 | return cloneLeaf(lval); | ||
170 | } | ||
171 | |||
170 | LSL_Leaf *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) | 172 | LSL_Leaf *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) |
171 | { | 173 | { |
172 | LSL_Leaf *leaf = newLeaf(type, left, right); | 174 | LSL_Leaf *leaf = newLeaf(type, left, right); |
@@ -216,7 +218,9 @@ LSL_Leaf *addStatement(LSL_Statement *statement, LSL_Leaf *root) | |||
216 | LSL_Leaf *leaf = newLeaf(LSL_STATEMENT, root, NULL); | 218 | LSL_Leaf *leaf = newLeaf(LSL_STATEMENT, root, NULL); |
217 | 219 | ||
218 | if (leaf) | 220 | if (leaf) |
221 | { | ||
219 | leaf->value.statementValue = statement; | 222 | leaf->value.statementValue = statement; |
223 | } | ||
220 | 224 | ||
221 | return leaf; | 225 | return leaf; |
222 | } | 226 | } |