aboutsummaryrefslogtreecommitdiffstats
path: root/variable.h
blob: da3badc0a37d13f6d2d5199df80541e52c8c7314 (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>

typedef struct {
	uint8_t used :1;
	uint8_t fromc :1;
	uint8_t valtype :4;
	union {
		float f;
		uint32_t p;
	} value;
} variable;

enum valtype {
	STRING = 0,
	NUMBER,
	FUNC,
	EXPR
};

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);

int try_number(variable *v, const char *text);
int try_variable(char **name, const char *text);

#endif // VARIABLE_H_