ccm/lib/value.h

36 lines
874 B
C

#ifndef CCM_VALUE_H
#define CCM_VALUE_H
#include "commons.h"
#include "type.h"
#include "vec.h"
typedef struct {
union {
double num;
vec_t* tuple;
int boolean;
char* str;
vec_t* array;
size_t ref;
} data;
Type type;
int line;
} value_t;
void value_init_num(value_t* self, double num, int line);
void value_init_new_tuple(value_t* self, vec_t* values, int line);
void value_init_boolean(value_t* self, int boolean, int line);
void value_init_str(value_t* self, char const* value, int line);
void value_init_new_array(value_t* self, vec_t* value, int line);
void value_init_ref(value_t* self, size_t value, int line);
value_t* value_new_clone(value_t* self);
void value_free(value_t* self);
size_t value_str(value_t* self, char* buffer, size_t size);
int value_equals(value_t* self, value_t* rhs);
#endif