Exemple #1
0
int main(int argc, char *argv[])
{
	int fd;
	vm_module_t *module;
	vm_context_t *context;

	argv++; argc--;

	if (argc == 0) {
		rtl_print_fd(2, "main: no file name provided.\n");
		return 1;
	}

	rtl_print_fd(2, "main: reading '%s'\n", argv[0]);
	
	fd = vm_open(argv[0], O_RDONLY, 0);
	if (fd < 0) {
		vm_panic("vm_load_exec: failed to open the image.");
	}
	
	module = vm_load_fd(fd);
	vm_close(fd);
	if (!module) {
		vm_panic("vm_load_exec: failed to load the image.");
	}

	context = vm_context_create(module);
	
	for (;;) {
		vm_step(context);
	}
	
	rtl_print_fd(1, "\n\nDone.\n");
	return 0;
}
Exemple #2
0
int
main(int argc, char* argv[]) {
  if (argc < 2) return -1;
  char *buf = read_file(argv[1]);
  struct VM* vm = vm_new(4000);
  value res = vm_run(vm, buf);
  print_value(res);
  vm_close(vm);
  free(buf);
  return 0;
}
Exemple #3
0
 ~ConnectionAutoClosing()
 {
   if (m_con != VOICEMAN_BAD_CONNECTION)
     vm_close(m_con);
 }
Exemple #4
0
/**
 *	Closes the SCN 2.0 library.
 *	Called when the app closes.
 */
int scn20_close(void)
{
	vm_close();
	return 1;
}