aboutsummaryrefslogtreecommitdiffstats
path: root/variable.h
blob: 82c6b2583cdc481c2a20a6bb0f7468c03f75137f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef VARIABLE_H_
#define VARIABLE_H_

#include <stdint.h>

#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 :2;
	uint32_t value;
	char *svalue;
} variable;

enum valtype {
	STRING = 0,
	INTEGER,
	FLOAT,
	FUNC
};

void isetstr(variable *i);
void fsetstr(variable *f);

variable *itostring(variable *v);
variable *itoint(variable *v);
variable *itofloat(variable *v);

#endif // VARIABLE_H_