Debian Codegraph @

terps/tads/tads3/vmhostsi.h

raw symbols SCIP
1 /* $Header$ */
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 vmhostsi.h - simple stdio-based VM host application environment
12 Function
13 Provides a simple implementation of the VM host application interface.
14 This implementation is suitable for simple command-line tools with
15 minimal user interface; more complete implementations should be used
16 for most applications that embed the VM.
17 Notes
18
19 Modified
20 07/29/99 MJRoberts - Creation
21 */
22
23 #ifndef VMHOSTSI_H
24 #define VMHOSTSI_H
25
26 #include "vmhost.h"
27 #include "vmhosttx.h"
28
29 class CVmHostIfcStdio: public CVmHostIfcText
30 {
31 public:
32 /* create */
33 CVmHostIfcStdio(const char *argv0);
34
35 /* delete */
36 virtual ~CVmHostIfcStdio();
37
38 /* get the I/O safety level */
39 virtual int get_io_safety_read() { return io_safety_read_; }
40 virtual int get_io_safety_write() { return io_safety_write_; }
41
42 /* set I/O safety level */
43 virtual void set_io_safety(int read_level, int write_level)
44 {
45 io_safety_read_ = read_level;
46 io_safety_write_ = write_level;
47 }
48
49 /* get the network safety level */
50 virtual void get_net_safety(int *client_level, int *server_level)
51 {
52 *client_level = net_client_safety_;
53 *server_level = net_server_safety_;
54 }
55
56 /* set the network safety level */
57 virtual void set_net_safety(int client_level, int server_level)
58 {
59 net_client_safety_ = client_level;
60 net_server_safety_ = server_level;
61 }
62
63 /* get the system resource loader */
64 virtual class CResLoader *get_sys_res_loader() { return sys_res_loader_; }
65
66 /* get the resource path */
67 virtual const char *get_res_path() { return 0; }
68
69 /* get an image file name */
70 virtual vmhost_gin_t get_image_name(char *, size_t)
71 { return VMHOST_GIN_IGNORED; }
72
73 /* get a special file system path */
74 virtual void get_special_file_path(char *buf, size_t buflen, int id)
75 { os_get_special_path(buf, buflen, argv0_, id); }
76
77 protected:
78 /*
79 * the original main program's argv[0] - we need to remember this
80 * because it's sometimes needed to resolve special file system paths
81 * on the local system
82 */
83 char *argv0_;
84
85 /* system resource loader (character maps, etc) */
86 class CResLoader *sys_res_loader_;
87
88 /* current I/O safety levels */
89 int io_safety_read_;
90 int io_safety_write_;
91
92 /* current network safety levels */
93 int net_client_safety_;
94 int net_server_safety_;
95 };
96
97 #endif /* VMHOSTSI_H */
98