Mercurial > hg-old > index.cgi
annotate src/expr.c @ 14:b28d7cb60779
checkpoint
author | lost |
---|---|
date | Thu, 23 Oct 2008 02:44:07 +0000 |
parents | 05d4115b4860 |
children | 1f598d89b9b0 |
rev | line source |
---|---|
13
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
1 /* |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
2 expr.c |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
3 Copyright © 2008 William Astle |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
4 |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
5 This file is part of LWASM. |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
6 |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
7 LWASM is free software: you can redistribute it and/or modify it under the |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
8 terms of the GNU General Public License as published by the Free Software |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
9 Foundation, either version 3 of the License, or (at your option) any later |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
10 version. |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
11 |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
12 This program is distributed in the hope that it will be useful, but WITHOUT |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
15 more details. |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
16 |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License along with |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
18 this program. If not, see <http://www.gnu.org/licenses/>. |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
19 */ |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
20 |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
21 /* |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
22 This file contains implementations associated with the expression evaluator |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
23 used by LWASM. |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
24 |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
diff
changeset
|
25 */ |
14 | 26 |
27 #include <malloc.h> | |
28 | |
29 #define __expr_c_seen__ | |
30 #include "expr.h" | |
31 | |
32 LWVAL *lwval_construct_int(int value) | |
33 { | |
34 LWVAL *v; | |
35 | |
36 v = malloc(sizeof(LWVAL)); | |
37 if (!v) | |
38 return NULL; | |
39 | |
40 v -> lwval_type = LWVAL_TYPE_INT; | |
41 v -> dt.lwval_int = value; | |
42 | |
43 return v; | |
44 } | |
45 | |
46 void lwval_destroy(LWVAL *value) | |
47 { | |
48 if (value) | |
49 free(value); | |
50 } | |
51 | |
52 // v1 + v2 -> v3, return v3 | |
53 LWVAL *lwval_add(LWVAL *v1, LWVAL *v2, LWVAL *v3) | |
54 { | |
55 } | |
56 | |
57 // v1 - v2 -> v3, return v3 | |
58 LWVAL *lwval_sub(LWVAL *v1, LWVAL *v2, LWVAL *v3) | |
59 { | |
60 } | |
61 | |
62 // v1 * v2 -> v3, return v3 | |
63 LWVAL *lwval_mul(LWVAL *v1, LWVAL *v2, LWVAL *v3) | |
64 { | |
65 } | |
66 | |
67 // v1 / v2 -> v3, return v3 | |
68 LWVAL *lwval_div(LWVAL *v1, LWVAL *v2, LWVAL *v3) | |
69 { | |
70 } | |
71 | |
72 // v1 % v2 -> v3, return v3 | |
73 LWVAL *lwval_mod(LWVAL *v1, LWVAL *v2, LWVAL *v3) | |
74 { | |
75 } |