2019-10-17 19:21:45 +08:00
|
|
|
import { AsmToken } from "../instructions";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The virtual machine calls these methods when it requires input.
|
|
|
|
*/
|
2019-11-11 21:21:13 +08:00
|
|
|
export interface VirtualMachineInput {}
|
2019-10-17 19:21:45 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The virtual machine calls these methods when it outputs something.
|
|
|
|
*/
|
|
|
|
export interface VirtualMachineOutput {
|
|
|
|
window_msg(msg: string): void;
|
|
|
|
message(msg: string): void;
|
|
|
|
add_msg(msg: string): void;
|
|
|
|
winend(): void;
|
|
|
|
mesend(): void;
|
2019-11-11 21:21:13 +08:00
|
|
|
list(list_items: string[]): void;
|
2019-10-17 19:21:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Methods that are outside of the context of the game.
|
|
|
|
*/
|
|
|
|
export interface VirtualMachineMetaIO {
|
|
|
|
/**
|
|
|
|
* The virtual machine emits warning messages about suspicious execution
|
|
|
|
* patterns that could possibly cause problems or have unintended effects.
|
|
|
|
*/
|
|
|
|
warning(msg: string, srcloc?: AsmToken): void;
|
2019-10-17 22:50:19 +08:00
|
|
|
error(err: Error, srcloc?: AsmToken): void;
|
2019-10-17 19:21:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles input/output to/from the virtual machine.
|
|
|
|
*/
|
|
|
|
export interface VirtualMachineIO
|
|
|
|
extends VirtualMachineInput,
|
|
|
|
VirtualMachineOutput,
|
|
|
|
VirtualMachineMetaIO {}
|