Debian Codegraph @

terps/tads/tads3/vminit.h

raw symbols SCIP
1 /* $Header: d:/cvsroot/tads/tads3/VMINIT.H,v 1.2 1999/05/17 02:52:28 MJRoberts Exp $ */
2
3 /*
4 * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved.
5 *
6 * Please see the accompanying license file, LICENSE.TXT, for information
7 * on using and copying this software.
8 */
9 /*
10 Name
11 vminit.h - initialize and terminate a VM session
12 Function
13
14 Notes
15 VM initialization is configurable via the linker. To select a
16 configuration, link in exactly one of the vmcfgxxx.cpp object files.
17 Modified
18 04/06/99 MJRoberts - Creation
19 */
20
21 #ifndef VMINIT_H
22 #define VMINIT_H
23
24 #include "vmglob.h"
25
26 /*
27 * Generic initialization function. Client code calls this function to
28 * initialize the VM. The actual implementation of this function is
29 * selected at link time from the several provided configurations.
30 *
31 * 'charset' is the name of the display character mapping that we should
32 * use. If 'charset' is null, we'll use the default character set
33 * obtained from the OS layer.
34 */
35 void vm_initialize(struct vm_globals **vmg,
36 const struct vm_init_options *opts);
37
38 /*
39 * Initialization options - this structure is passed to vm_initialize to
40 * specify the configuration. (We pass this as a structure, rather than as
41 * individual parameters, because we internally have several different
42 * implementations of the initialization function that we choose from based
43 * on the VM link-time configuration. Packaging these arguments as a
44 * structure generally lets us avoid changes to the various implementations
45 * when we add new configuration parameters.)
46 */
47 struct vm_init_options
48 {
49 vm_init_options(class CVmHostIfc *hi, class CVmMainClientIfc *ci,
50 const char *cs = 0, const char *lcs = 0)
51 {
52 hostifc = hi;
53 clientifc = ci;
54 charset = cs;
55 log_charset = lcs;
56 }
57
58 /* the host interface */
59 class CVmHostIfc *hostifc;
60
61 /* the client interface */
62 class CVmMainClientIfc *clientifc;
63
64 /* the display character set (or null to use the OS default) */
65 const char *charset;
66
67 /* the log file character set (or null to use the OS default) */
68 const char *log_charset;
69 };
70
71 /*
72 * Initialization, phase 2 - just before loading the image file
73 */
74 void vm_init_before_load(VMG_ const char *image_filename);
75
76 /*
77 * Initialization, phase 3 - just after loading the image file
78 */
79 void vm_init_after_load(VMG0_);
80
81 /*
82 * Terminate the VM. Deletes all objects created by vm_init(). This
83 * can be used to clean up memory after a program has finished
84 * executing.
85 */
86 void vm_terminate(struct vm_globals *vmg, class CVmMainClientIfc *clientifc);
87
88
89 /* ------------------------------------------------------------------------ */
90 /*
91 * Private interface. Client code does not call any of the following
92 * routines; they're for use internally by the initialization mechanism
93 * only.
94 */
95
96 /*
97 * Initialize the VM with in-memory pools. Creates all global objects
98 * necessary for the VM to run.
99 */
100 void vm_init_in_mem(struct vm_globals **vmg, const vm_init_options *opts);
101
102 /* initialize the VM with the "flat" memory pool manager */
103 void vm_init_flat(struct vm_globals **vmg, const vm_init_options *opts);
104
105 /*
106 * Initialize the VM with swapping pools with the given maximum number
107 * of pages in memory.
108 */
109 void vm_init_swap(struct vm_globals **vmg, size_t max_mem_pages,
110 const vm_init_options *opts);
111
112 /*
113 * Internal base initialization routine. Clients do not call this
114 * routine directly; it's for use by vm_init_in_mem(), vm_init_swap(),
115 * and any other vm_init_xxx routines.
116 */
117 void vm_init_base(struct vm_globals **vmg, const vm_init_options *opts);
118
119 /*
120 * Initialize debugger-related objects. For non-debug versions, this
121 * doesn't need to do anything.
122 */
123 void vm_init_debugger(VMG0_);
124
125 /*
126 * Get the amount of stack space to allocate as a reserve for handling
127 * stack overflows in the debugger. For non-debug versions, we don't
128 * normally use a reserve, since the reserve is only useful for manually
129 * recovering from stack overflows in the debugger.
130 */
131 size_t vm_init_stack_reserve();
132
133 /*
134 * Termination - shut down the debugger. Notifies the debugger UI that
135 * we're terminating the executable.
136 */
137 void vm_terminate_debug_shutdown(VMG0_);
138
139 /*
140 * termination - delete debugger-related objects, if any were allocated
141 * in vm_init_debugger()
142 */
143 void vm_terminate_debug_delete(VMG0_);
144
145
146 #endif /* VMINIT_H */
147