Newer
Older
Tardis / lang / vm.h
// SPDX-License-Identifier: MIT
// Copyright (c) 2023 John Watts and the LuminaSensum contributors

#ifndef VM_H
#define VM_H

struct object;

struct vm_state {
	struct object **stack_base;
	struct object **stack_next;
};

void vm_stack_set(struct vm_state *state, int index, struct object *obj);
struct object *vm_stack_get(struct vm_state *state, int index);
void vm_stack_push(struct vm_state *state, struct object *obj);
struct object *vm_stack_pop(struct vm_state *state);
void vm_stack_drop(struct vm_state *state, int count);

void vm_call(struct object *obj, const char *name, int arg_count,
	struct vm_state *state);

#endif