mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
40 lines
1 KiB
C
40 lines
1 KiB
C
#pragma once
|
|
|
|
#include "../../runtime/gc.h"
|
|
#include "runtime_externs.h"
|
|
#include "types.h"
|
|
#include "utils.h"
|
|
|
|
#include "stdlib.h"
|
|
|
|
void **s_top(struct State *s);
|
|
bool s_is_empty(struct State *s);
|
|
void **s_nth(struct State *s, aint n);
|
|
void **s_peek(struct State *s);
|
|
aint *s_peek_i(struct State *s);
|
|
|
|
void s_push(struct State *s, void *val);
|
|
void s_push_i(struct State *s, aint val);
|
|
void s_push_nil(struct State *s);
|
|
void s_pushn_nil(struct State *s, size_t n);
|
|
|
|
void *s_pop(struct State *s);
|
|
aint s_pop_i(struct State *s);
|
|
void s_popn(struct State *s, size_t n);
|
|
|
|
// ------ functions ------
|
|
|
|
// |> param_0 ... param_n | frame[ ret rp prev_fp ¶ms &locals &end
|
|
// ]
|
|
// |> local_0 ... local_m |> | ...
|
|
//
|
|
// where |> defines corresponding frame pointer, | is stack pointer
|
|
// location before / after new frame added
|
|
void s_enter_f(struct State *s, char *rp, bool is_closure_call, auint args_sz,
|
|
auint locals_sz);
|
|
|
|
void s_exit_f(struct State *s);
|
|
|
|
// ---- category ---
|
|
|
|
void **var_by_category(struct State *s, enum VarCategory category, int id);
|