2023-12-09 17:24:41 +00:00
|
|
|
#ifndef RZ_VALUE_H
|
|
|
|
#define RZ_VALUE_H
|
|
|
|
|
|
|
|
#include "type.h"
|
2023-12-20 19:54:58 +00:00
|
|
|
#include "fun.h"
|
|
|
|
|
|
|
|
struct program;
|
2023-12-09 17:24:41 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
type_t* type;
|
|
|
|
|
|
|
|
union {
|
|
|
|
double num;
|
2023-12-09 21:59:24 +00:00
|
|
|
int bool;
|
2023-12-10 03:49:28 +00:00
|
|
|
char* str;
|
2023-12-20 19:54:58 +00:00
|
|
|
fun_t* fun;
|
2023-12-09 17:24:41 +00:00
|
|
|
} value;
|
|
|
|
|
2023-12-11 17:01:22 +00:00
|
|
|
int line;
|
2023-12-09 17:24:41 +00:00
|
|
|
} value_t;
|
|
|
|
|
2023-12-11 17:01:22 +00:00
|
|
|
void value_init(value_t* value, type_t* type, int line);
|
2023-12-09 17:24:41 +00:00
|
|
|
void value_free(value_t* value);
|
|
|
|
|
|
|
|
int value_eq(value_t* value, value_t* rhs);
|
|
|
|
|
|
|
|
size_t value_str(value_t* value, char* buffer, size_t size);
|
|
|
|
|
|
|
|
#endif
|