2023-12-20 19:54:58 +00:00
|
|
|
#ifndef RZ_PROGRAM_H
|
|
|
|
#define RZ_PROGRAM_H
|
|
|
|
|
|
|
|
#include "commons.h"
|
|
|
|
#include "opcodes.h"
|
|
|
|
|
|
|
|
struct value;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
size_t size;
|
|
|
|
size_t cap;
|
|
|
|
Opcode* ops;
|
|
|
|
param_t* params;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
size_t size;
|
|
|
|
size_t cap;
|
|
|
|
struct value** data;
|
|
|
|
} values;
|
|
|
|
|
|
|
|
} program_t;
|
|
|
|
|
|
|
|
void program_init(program_t* program);
|
2023-12-24 19:24:41 +00:00
|
|
|
program_t* program_new_clone(program_t* program);
|
2023-12-20 19:54:58 +00:00
|
|
|
void program_free(program_t* program);
|
|
|
|
|
|
|
|
size_t program_push_instr(program_t* program, Opcode op, param_t param);
|
|
|
|
size_t program_push_new_value(program_t* program, struct value* value);
|
|
|
|
|
|
|
|
size_t program_str(program_t* program, char* buffer, size_t size);
|
|
|
|
|
|
|
|
#endif
|