| | 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() { return io_safety_; } |
| | 40 | |
| | 41 | /* set I/O safety level */ |
| | 42 | virtual void set_io_safety(int level) { io_safety_ = level; } |
| | 43 | |
| | 44 | /* get the resource loader */ |
| | 45 | virtual class CResLoader *get_cmap_res_loader() { return cmap_loader_; } |
| | 46 | |
| | 47 | /* get the resource path */ |
| | 48 | virtual const char *get_res_path() { return 0; } |
| | 49 | |
| | 50 | /* get an image file name */ |
| | 51 | virtual vmhost_gin_t get_image_name(char *, size_t) |
| | 52 | { return VMHOST_GIN_IGNORED; } |
| | 53 | |
| | 54 | /* get a special file system path */ |
| | 55 | virtual void get_special_file_path(char *buf, size_t buflen, int id) |
| | 56 | { os_get_special_path(buf, buflen, argv0_, id); } |
| | 57 | |
| | 58 | protected: |
| | 59 | /* |
| | 60 | * the original main program's argv[0] - we need to remember this |
| | 61 | * because it's sometimes needed to resolve special file system paths |
| | 62 | * on the local system |
| | 63 | */ |
| | 64 | char *argv0_; |
| | 65 | |
| | 66 | /* character mapping file resource loader */ |
| | 67 | class CResLoader *cmap_loader_; |
| | 68 | |
| | 69 | /* current I/O safety level */ |
| | 70 | int io_safety_; |
| | 71 | }; |
| | 72 | |
| | 73 | #endif /* VMHOSTSI_H */ |
| | 74 | |