1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-14 04:34:48 +00:00
janet/vm.h

39 lines
915 B
C
Raw Normal View History

2017-02-09 20:02:59 +00:00
#ifndef VM_H_C4OZU8CQ
#define VM_H_C4OZU8CQ
#include "datatypes.h"
#include "value.h"
2017-02-09 20:02:59 +00:00
/* Initialize the VM */
void gst_init(Gst * vm);
2017-02-09 20:02:59 +00:00
/* Deinitialize the VM */
void gst_deinit(Gst * vm);
2017-02-09 20:02:59 +00:00
2017-03-08 15:54:50 +00:00
/* Start running the VM with a given entry point */
int gst_start(Gst * vm, GstValue func);
2017-02-09 20:02:59 +00:00
/* Run garbage collection */
void gst_collect(Gst * vm);
2017-02-09 20:02:59 +00:00
/* Collect garbage if enough memory has been allocated since
* the previous collection */
void gst_maybe_collect(Gst * vm);
2017-02-09 20:02:59 +00:00
/* Allocate memory */
void * gst_alloc(Gst * vm, uint32_t amount);
/* Allocate zeroed memory */
void * gst_zalloc(Gst * vm, uint32_t amount);
/* Get an argument from the stack */
GstValue gst_arg(Gst * vm, uint16_t index);
/* Put a value on the stack */
void gst_set_arg(Gst * vm, uint16_t index, GstValue x);
/* Get the number of arguments on the stack */
uint16_t gst_count_args(Gst * vm);
2017-02-09 20:02:59 +00:00
#endif /* end of include guard: VM_H_C4OZU8CQ */