vm.h

Go to the documentation of this file.
00001 /* TinyaML
00002  * Copyright (C) 2007 Damien Leroux
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  */
00018 
00019 #ifndef _BML_VM_H_
00020 #define _BML_VM_H_
00021 
00022 #include "vm_types.h"
00023 #include "containers.h"
00024 #include "abstract_io.h"
00025 #include "code.h"
00026 #include "thread.h"
00027 
00028 #include "../config.h"
00029 
00135 #define TINYAML_VERSION PACKAGE_VERSION
00136 
00151 vm_t vm_new();
00153 void vm_del(vm_t);
00154 
00156 vm_t vm_set_lib_file(vm_t, const char*);
00158 vm_t vm_add_opcode(vm_t, const char*name, opcode_arg_t, opcode_stub_t);
00160 opcode_dict_t vm_get_dict(vm_t);
00161 
00163 opcode_t vm_get_opcode_by_name(vm_t, const char*);
00164 
00175 vm_t vm_serialize_program(vm_t, program_t, writer_t);
00176 
00180 program_t vm_unserialize_program(vm_t, reader_t);
00182 program_t vm_compile_file(vm_t, const char*);
00184 program_t vm_compile_buffer(vm_t, const char*);
00185 
00193 vm_t vm_run_program_fg(vm_t, program_t, word_t ip, word_t prio);
00195 vm_t vm_run_program_bg(vm_t, program_t, word_t ip, word_t prio);
00196 
00201 thread_t vm_add_thread(vm_t, program_t, word_t ip, word_t prio, int fg);
00202 
00204 thread_t vm_get_current_thread(vm_t);
00205 
00207 vm_t vm_kill_thread(vm_t,thread_t);
00208 
00216 vm_t vm_push_data(vm_t,vm_data_type_t, word_t);
00218 vm_t vm_push_caller(vm_t, program_t, word_t ip, word_t has_closure);
00220 vm_t vm_push_catcher(vm_t, program_t, word_t);
00222 vm_t vm_peek_data(vm_t,int,vm_data_type_t*,word_t*);
00224 vm_t vm_poke_data(vm_t,vm_data_type_t,word_t);
00226 vm_t vm_peek_caller(vm_t,program_t*,word_t*);
00228 vm_t vm_peek_catcher(vm_t,program_t*,word_t*);
00230 vm_t vm_pop_data(vm_t,word_t);
00232 vm_t vm_pop_caller(vm_t,word_t);
00234 vm_t vm_pop_catcher(vm_t,word_t);
00235 
00237 program_t _VM_CALL vm_get_CS(vm_t);
00239 word_t _VM_CALL vm_get_IP(vm_t);
00240 
00242 vm_data_t _VM_CALL _vm_pop(vm_t vm);
00244 vm_data_t _VM_CALL _vm_peek(vm_t vm);
00245 
00253 vm_t vm_set_engine(vm_t, vm_engine_t);
00254 
00262 void _VM_CALL vm_schedule_cycle(vm_t);
00263 
00267 vm_t _VM_CALL vm_collect(vm_t vm, vm_obj_t o);
00269 vm_t _VM_CALL vm_uncollect(vm_t vm, vm_obj_t o);
00270 
00272 int vm_printf(const char* fmt, ...);
00274 int vm_printerrf(const char* fmt, ...);
00277 #endif
00278 

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