Gavin Howard | 5715b04 | 2018-02-12 16:11:42 -0700 | [diff] [blame] | 1 | /* |
Gavin Howard | b5904bf | 2018-02-20 13:28:18 -0700 | [diff] [blame] | 2 | * ***************************************************************************** |
Gavin Howard | 5715b04 | 2018-02-12 16:11:42 -0700 | [diff] [blame] | 3 | * |
Gavin Howard | b5904bf | 2018-02-20 13:28:18 -0700 | [diff] [blame] | 4 | * Copyright 2018 Gavin D. Howard |
Gavin Howard | 5715b04 | 2018-02-12 16:11:42 -0700 | [diff] [blame] | 5 | * |
| 6 | * Permission to use, copy, modify, and/or distribute this software for any |
| 7 | * purpose with or without fee is hereby granted. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
| 10 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 11 | * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
| 12 | * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 13 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 14 | * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 15 | * PERFORMANCE OF THIS SOFTWARE. |
| 16 | * |
Gavin Howard | b5904bf | 2018-02-20 13:28:18 -0700 | [diff] [blame] | 17 | * ***************************************************************************** |
Gavin Howard | 5715b04 | 2018-02-12 16:11:42 -0700 | [diff] [blame] | 18 | * |
| 19 | * Definitions for bc's virtual machine. |
| 20 | * |
| 21 | */ |
| 22 | |
Gavin Howard | 8a596d4 | 2018-01-15 15:46:01 -0700 | [diff] [blame] | 23 | #ifndef BC_VM_H |
| 24 | #define BC_VM_H |
| 25 | |
Gavin Howard | 3ba6c8d | 2018-02-15 12:23:35 -0700 | [diff] [blame] | 26 | #include <bc.h> |
| 27 | #include <program.h> |
| 28 | #include <parse.h> |
Gavin Howard | 8a596d4 | 2018-01-15 15:46:01 -0700 | [diff] [blame] | 29 | |
| 30 | #define BC_VM_BUF_SIZE (1024) |
| 31 | |
| 32 | typedef struct BcVm { |
| 33 | |
Gavin Howard | 4bc73ee | 2018-01-26 11:39:20 -0700 | [diff] [blame] | 34 | BcProgram program; |
| 35 | BcParse parse; |
Gavin Howard | 8a596d4 | 2018-01-15 15:46:01 -0700 | [diff] [blame] | 36 | |
Gavin Howard | 4bc73ee | 2018-01-26 11:39:20 -0700 | [diff] [blame] | 37 | int filec; |
| 38 | const char** filev; |
Gavin Howard | 8a596d4 | 2018-01-15 15:46:01 -0700 | [diff] [blame] | 39 | |
| 40 | } BcVm; |
| 41 | |
| 42 | BcStatus bc_vm_init(BcVm* vm, int filec, const char* filev[]); |
| 43 | |
Gavin Howard | c5e491b | 2018-02-20 13:51:20 -0700 | [diff] [blame] | 44 | void bc_vm_free(BcVm* vm); |
| 45 | |
Gavin Howard | 8a596d4 | 2018-01-15 15:46:01 -0700 | [diff] [blame] | 46 | BcStatus bc_vm_exec(BcVm* vm); |
| 47 | |
Gavin Howard | 8a596d4 | 2018-01-15 15:46:01 -0700 | [diff] [blame] | 48 | #endif // BC_VM_H |