Mercurial > hg-old > index.cgi
diff src/expr.c @ 14:b28d7cb60779
checkpoint
author | lost |
---|---|
date | Thu, 23 Oct 2008 02:44:07 +0000 |
parents | 05d4115b4860 |
children | 1f598d89b9b0 |
line wrap: on
line diff
--- a/src/expr.c Wed Oct 22 04:51:16 2008 +0000 +++ b/src/expr.c Thu Oct 23 02:44:07 2008 +0000 @@ -23,3 +23,53 @@ used by LWASM. */ + +#include <malloc.h> + +#define __expr_c_seen__ +#include "expr.h" + +LWVAL *lwval_construct_int(int value) +{ + LWVAL *v; + + v = malloc(sizeof(LWVAL)); + if (!v) + return NULL; + + v -> lwval_type = LWVAL_TYPE_INT; + v -> dt.lwval_int = value; + + return v; +} + +void lwval_destroy(LWVAL *value) +{ + if (value) + free(value); +} + +// v1 + v2 -> v3, return v3 +LWVAL *lwval_add(LWVAL *v1, LWVAL *v2, LWVAL *v3) +{ +} + +// v1 - v2 -> v3, return v3 +LWVAL *lwval_sub(LWVAL *v1, LWVAL *v2, LWVAL *v3) +{ +} + +// v1 * v2 -> v3, return v3 +LWVAL *lwval_mul(LWVAL *v1, LWVAL *v2, LWVAL *v3) +{ +} + +// v1 / v2 -> v3, return v3 +LWVAL *lwval_div(LWVAL *v1, LWVAL *v2, LWVAL *v3) +{ +} + +// v1 % v2 -> v3, return v3 +LWVAL *lwval_mod(LWVAL *v1, LWVAL *v2, LWVAL *v3) +{ +}