| 1 | /* |
| 2 | * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved. |
| 3 | * |
| 4 | * Please see the accompanying license file, LICENSE.TXT, for information |
| 5 | * on using and copying this software. |
| 6 | */ |
| 7 | /* |
| 8 | Name |
| 9 | vmhosttx.h - host interface base class for text-only implementations |
| 10 | Function |
| 11 | Provides a base class for text-only T3 VM Host Interface |
| 12 | implementations. In particular, this class provides a simple resource |
| 13 | manager implementation, which is usually needed in text-only interpreter |
| 14 | systems because there is no larger host application (such as HTML TADS) |
| 15 | that provides its own resource manager. |
| 16 | |
| 17 | Our resource manager implementation simply stores the names of the |
| 18 | embedded resources in a hash table. |
| 19 | Notes |
| 20 | |
| 21 | Modified |
| 22 | 07/29/99 MJRoberts - Creation |
| 23 | */ |
| 24 | |
| 25 | #ifndef VMHOSTTX_H |
| 26 | #define VMHOSTTX_H |
| 27 | |
| 28 | #include "vmhost.h" |
| 29 | |
| 30 | class CVmHostIfcText: public CVmHostIfc |
| 31 | { |
| 32 | public: |
| 33 | CVmHostIfcText(); |
| 34 | ~CVmHostIfcText(); |
| 35 | |
| 36 | /* set the image file name */ |
| 37 | virtual void set_image_name(const char *fname); |
| 38 | |
| 39 | /* set the resource directory */ |
| 40 | virtual void set_res_dir(const char *dir); |
| 41 | |
| 42 | /* add a resource file */ |
| 43 | virtual int add_resfile(const char *fname); |
| 44 | |
| 45 | /* we do support external resource files */ |
| 46 | virtual int can_add_resfiles() { return TRUE; } |
| 47 | |
| 48 | /* add a resource */ |
| 49 | virtual void add_resource(unsigned long ofs, unsigned long siz, |
| 50 | const char *resname, size_t resnamelen, |
| 51 | int fileno); |
| 52 | |
| 53 | /* add a resource file link */ |
| 54 | virtual void add_resource(const char *fname, size_t fnamelen, |
| 55 | const char *resname, size_t resnamelen); |
| 56 | |
| 57 | /* find a resource */ |
| 58 | virtual osfildef *find_resource(const char *resname, size_t resname_len, |
| 59 | unsigned long *res_size); |
| 60 | |
| 61 | /* determine if a resource exists */ |
| 62 | virtual int resfile_exists(const char *resname, size_t resnamelen); |
| 63 | |
| 64 | protected: |
| 65 | /* resource map hash table */ |
| 66 | class CVmHashTable *restab_; |
| 67 | |
| 68 | /* array of external resource bundle filenames */ |
| 69 | char **ext_; |
| 70 | size_t ext_cnt_; |
| 71 | size_t ext_max_; |
| 72 | |
| 73 | /* resource root directory */ |
| 74 | char *res_dir_; |
| 75 | }; |
| 76 | |
| 77 | #endif /* VMHOSTTX_H */ |