Debian Codegraph @

terps/tads/tads3/vmhostsi.cpp

raw symbols SCIP
1 #ifdef RCSID
2 static char RCSid[] =
3 "$Header$";
4 #endif
5
6 /*
7 * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved.
8 *
9 * Please see the accompanying license file, LICENSE.TXT, for information
10 * on using and copying this software.
11 */
12 /*
13 Name
14 vmhostsi.cpp - stdio-based VM host application environment
15 Function
16
17 Notes
18
19 Modified
20 08/06/99 MJRoberts - Creation
21 */
22
23 #include "t3std.h"
24 #include "os.h"
25 #include "resload.h"
26 #include "vmhost.h"
27 #include "vmhostsi.h"
28
29 /*
30 * initialize
31 */
32 CVmHostIfcStdio::CVmHostIfcStdio(const char *argv0)
33 {
34 char buf[OSFNMAX];
35
36 /* remember the program's argv[0], in case we need it later */
37 argv0_ = lib_copy_str(argv0);
38
39 /*
40 * Create the resource loader for system resources (character mapping
41 * files, etc) in the same directory as the executable.
42 */
43 os_get_special_path(buf, sizeof(buf), argv0, OS_GSP_T3_RES);
44 sys_res_loader_ = new CResLoader(buf);
45
46 /* set the executable filename in the loader, if available */
47 if (os_get_exe_filename(buf, sizeof(buf), argv0))
48 sys_res_loader_->set_exe_filename(buf);
49
50 /*
51 * the default safety level allows reading and writing to the current
52 * directory only
53 */
54 io_safety_read_ = VM_IO_SAFETY_READWRITE_CUR;
55 io_safety_write_ = VM_IO_SAFETY_READWRITE_CUR;
56 net_client_safety_ = VM_NET_SAFETY_LOCALHOST;
57 net_server_safety_ = VM_NET_SAFETY_LOCALHOST;
58 }
59
60 /*
61 * delete
62 */
63 CVmHostIfcStdio::~CVmHostIfcStdio()
64 {
65 /* delete our system resource loader */
66 delete sys_res_loader_;
67
68 /* delete our saved argv[0] */
69 lib_free_str(argv0_);
70 }