vm.h File Reference

#include "vm_types.h"
#include "containers.h"
#include "abstract_io.h"
#include "code.h"
#include "thread.h"
#include "../config.h"

Go to the source code of this file.

Defines

#define TINYAML_VERSION   PACKAGE_VERSION

Functions

vm_t vm_new ()
 create a new Virtual Machine Actually, the VM is a singleton for internal reasons. But vm_new must be called once.
void vm_del (vm_t)
vm_t vm_set_lib_file (vm_t, const char *)
 link an external library file to the VM. Actual file name is dependant on architecture. On Linux, it is $prefix/lib/tinyaml/libtinyaml_<lib_file_name>.so
vm_t vm_add_opcode (vm_t, const char *name, opcode_arg_t, opcode_stub_t)
 declare a new opcode with (name, argument type, C function).
opcode_dict_t vm_get_dict (vm_t)
 get the opcode dictionary
opcode_t vm_get_opcode_by_name (vm_t, const char *)
 as it says. For VM analysis. Not much use otherwise.
vm_t vm_serialize_program (vm_t, program_t, writer_t)
program_t vm_unserialize_program (vm_t, reader_t)
 Unserialize a program using the given reader (see Tinyaml file and buffer IO).
program_t vm_compile_file (vm_t, const char *)
 Compile a file.
program_t vm_compile_buffer (vm_t, const char *)
 Compile a character string.
vm_t vm_run_program_fg (vm_t, program_t, word_t ip, word_t prio)
 run the given program with priority level prio and starting at offset ip, and join the thread.
vm_t vm_run_program_bg (vm_t, program_t, word_t ip, word_t prio)
 run the given program with priority level prio and starting at offset ip, and return immediately.
thread_t vm_add_thread (vm_t, program_t, word_t ip, word_t prio, int fg)
 start a new thread. Start a new thread with priority level prio and starting at offset ip in program. The VM engine is signaled the start and death of the thread if fg is non-zero.
thread_t vm_get_current_thread (vm_t)
 get current thread.
vm_t vm_kill_thread (vm_t, thread_t)
 kill a thread (thread resources won't be freed while it's referenced).
vm_t vm_push_data (vm_t, vm_data_type_t, word_t)
 push data onto current thread's data stack
vm_t vm_push_caller (vm_t, program_t, word_t ip, word_t has_closure)
 push a caller onto current thread's call stack
vm_t vm_push_catcher (vm_t, program_t, word_t)
 push a catcher onto current thread's catch stack
vm_t vm_peek_data (vm_t, int, vm_data_type_t *, word_t *)
 peek data at top of current thread's data stack
vm_t vm_poke_data (vm_t, vm_data_type_t, word_t)
 poke data at top of current thread's data stack
vm_t vm_peek_caller (vm_t, program_t *, word_t *)
 peek caller at top of current thread's call stack
vm_t vm_peek_catcher (vm_t, program_t *, word_t *)
 peek catcher at top of current thread's catch stack
vm_t vm_pop_data (vm_t, word_t)
 pop from current thread's data stack
vm_t vm_pop_caller (vm_t, word_t)
 pop from current thread's call stack
vm_t vm_pop_catcher (vm_t, word_t)
 pop from current_thread's catch stack
program_t _VM_CALL vm_get_CS (vm_t)
 get current thread's code segment (program)
word_t _VM_CALL vm_get_IP (vm_t)
 get current thread's IP
vm_data_t _VM_CALL _vm_pop (vm_t vm)
 pop data from current thread's data stack
vm_data_t _VM_CALL _vm_peek (vm_t vm)
 peek data on top of current thread's data stack
vm_t vm_set_engine (vm_t, vm_engine_t)
 set the VM's engine.
void _VM_CALL vm_schedule_cycle (vm_t)
 run one cycle.
vm_t _VM_CALL vm_collect (vm_t vm, vm_obj_t o)
 insert o into the VM's collection list
vm_t _VM_CALL vm_uncollect (vm_t vm, vm_obj_t o)
 remove o from the VM's collection list
int vm_printf (const char *fmt,...)
 output formatted data to VM's stdout.
int vm_printerrf (const char *fmt,...)
 output formatted data to VM's stderr.


Generated on Wed Feb 6 14:46:05 2008 for TinyaML by  doxygen 1.5.3