#ifndef APFL_CONTEXT_H #define APFL_CONTEXT_H #ifdef __cplusplus extern "C" { #endif #include #include "bytecode.h" #include "hashmap.h" #include "gc.h" #include "value.h" #include "scope.h" struct stack { struct apfl_value *items; size_t len; size_t cap; }; struct apfl_ctx_data { struct gc gc; struct scope *scope; struct stack *stack; int execution_line; }; void apfl_stack_deinit(struct apfl_allocator, struct stack *); void apfl_gc_stack_traverse(struct stack *, gc_visitor, void *); bool apfl_stack_push(apfl_ctx, struct apfl_value); bool apfl_stack_check_index(apfl_ctx, apfl_stackidx *); bool apfl_stack_pop(apfl_ctx, struct apfl_value *value, apfl_stackidx); bool apfl_stack_get(apfl_ctx, struct apfl_value *value, apfl_stackidx); bool apfl_stack_drop(apfl_ctx, apfl_stackidx); void apfl_stack_clear(apfl_ctx); #ifdef __cplusplus } #endif #endif