From 952cb2d6dbd1b4cd76bb7c5dd46c1053631476a3 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 7 Mar 2018 15:25:07 -0500 Subject: big changes; no ints; things work better --- variable.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'variable.h') diff --git a/variable.h b/variable.h index beb8be3..b4a7c72 100644 --- a/variable.h +++ b/variable.h @@ -3,33 +3,26 @@ #include -#define INT(v) (*((int32_t *)&(v)->value)) -#define FLOAT(v) (*((float *)&(v)->value)) - typedef struct { uint8_t used :1; uint8_t fromc :1; uint8_t valtype :4; - uint32_t value; - char *svalue; + union { + float f; + uint32_t p; + } value; } variable; enum valtype { STRING = 0, - INTEGER, - FLOAT, + NUMBER, FUNC, EXPR }; -variable *vmake(uint8_t fromc, uint8_t valtype, void *value); -variable *vmakef(float value); - -void isetstr(variable *i); -void fsetstr(variable *f); - -variable *itostring(variable *v); -variable *itoint(variable *v); -variable *itofloat(variable *v); +variable *make_varn(variable *v, float value); +variable *make_vars(variable *v, const char *s); +variable *make_varf(variable *v, uint8_t fromc, uint32_t func); +variable *make_vare(variable *v, const char *e); #endif // VARIABLE_H_ -- cgit v1.2.3