2
* Copyright 1999, 2002 Michael J. Roberts
4
* Please see the accompanying license file, LICENSE.TXT, for information
5
* on using and copying this software.
8
* T3 Image File Test - Load and Execute
22
* Client services interface
24
class MyClientIfc: public CVmMainClientIfc
27
/* set plain ASCII mode */
28
void set_plain_mode() { os_plain(); }
30
/* create the main console */
31
CVmConsoleMain *create_console(struct vm_globals *vmg)
34
return new CVmConsoleMain(vmg0_);
37
/* delete the console */
38
void delete_console(struct vm_globals *vmg, CVmConsoleMain *con)
42
/* flush any pending buffered output */
43
con->flush(vmg_ VM_NL_NONE);
45
/* delete the output formatter */
50
void client_init(struct vm_globals *,
60
void client_terminate(struct vm_globals *) { }
62
/* pre-execution initialization */
63
void pre_exec(struct vm_globals *globals)
68
* Turn off MORE mode in the display formatter, since this host
69
* environment is meant primarily for automated testing.
71
G_console->set_more_state(FALSE);
74
/* post-execution termination/error termination */
75
void post_exec(struct vm_globals *) { }
76
void post_exec_err(struct vm_globals *) { }
78
/* display an error */
79
void display_error(struct vm_globals *, const char *msg,
82
/* display the error on the stdio console */
85
/* add a blank line if desired */
92
* Main program entrypoint
94
int main(int argc, char **argv)
97
MyClientIfc clientifc;
98
CVmHostIfc *hostifc = new CVmHostIfcStdio(argv[0]);
100
/* initialize for testing */
104
* Initialize the OS layer. Since this is a command-line-only
105
* implementation, there's no need to ask the OS layer to try to get
106
* us a filename to run, so pass in null for the prompt and filename
109
os_init(&argc, argv, 0, 0, 0);
112
stat = vm_run_image_main(&clientifc, "test_exec", argc, argv,
113
TRUE, TRUE, hostifc);
115
/* uninitialize the OS layer */
118
/* done with the host interface */
121
/* show any unfreed memory */
122
t3_list_memory_blocks(0);