-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathvm.h
More file actions
30 lines (22 loc) · 630 Bytes
/
vm.h
File metadata and controls
30 lines (22 loc) · 630 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// Created by Ryan Pendleton on 6/28/18.
// Copyright © 2018 Ryan Pendleton. All rights reserved.
//
#pragma once
#include <stddef.h>
typedef struct vm_impl* vm_ctx;
typedef enum {
VM_LOAD_SUCCESS,
VM_LOAD_INPUT_NOT_FOUND,
VM_LOAD_INPUT_TOO_LARGE,
} vm_load_result;
typedef enum {
VM_RUN_SUCCESS,
VM_RUN_UNIMPLEMENTED_OPCODE,
} vm_run_result;
vm_ctx vm_create(void);
void vm_destroy(vm_ctx vm);
void vm_load_os(vm_ctx vm);
vm_load_result vm_load_file(vm_ctx vm, const char *file);
vm_load_result vm_load_data(vm_ctx vm, unsigned const char *data, size_t length);
vm_run_result vm_run(vm_ctx vm);