| 1 | /* $Header: d:/cvsroot/tads/tads3/VMPREDEF.H,v 1.2 1999/05/17 02:52:28 MJRoberts Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 1998, 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 | vmpredef.h - pre-defined objects and properties |
| 12 | Function |
| 13 | Defines a global structure containing the pre-defined objects |
| 14 | and properties. These values are provided by the load image file's |
| 15 | predefined value symbol table; at load time, we cache these values |
| 16 | for quick access. |
| 17 | Notes |
| 18 | |
| 19 | Modified |
| 20 | 12/09/98 MJRoberts - Creation |
| 21 | */ |
| 22 | |
| 23 | #ifndef VMPREDEF_H |
| 24 | #define VMPREDEF_H |
| 25 | |
| 26 | #include "t3std.h" |
| 27 | #include "vmtype.h" |
| 28 | |
| 29 | /* |
| 30 | * some special import names - these are exports that we might need to |
| 31 | * synthesize, so we need to know their names in the image loader code as |
| 32 | * well as in the imports table |
| 33 | */ |
| 34 | #define VM_IMPORT_NAME_LASTPROPOBJ "*LastPropObj" |
| 35 | #define VM_IMPORT_NAME_RTERRMSG "exceptionMessage" |
| 36 | #define VM_IMPORT_NAME_CONSTSTR "*ConstStrObj" |
| 37 | #define VM_IMPORT_NAME_CONSTLST "*ConstLstObj" |
| 38 | #define VM_IMPORT_NAME_ISARGTABLE "_isNamedArgTable" |
| 39 | |
| 40 | /* |
| 41 | * pre-defined values |
| 42 | */ |
| 43 | struct CVmPredef |
| 44 | { |
| 45 | /* initialize */ |
| 46 | CVmPredef() |
| 47 | { |
| 48 | /* |
| 49 | * the pre-defined variables are all undefined initially |
| 50 | */ |
| 51 | reset(); |
| 52 | } |
| 53 | |
| 54 | /* |
| 55 | * Reset the predef variables to their initial undefined values |
| 56 | */ |
| 57 | void reset() |
| 58 | { |
| 59 | /* |
| 60 | * include the import list to generate initializations for the |
| 61 | * predef variables |
| 62 | */ |
| 63 | #define VM_IMPORT_OBJ(sym, mem) mem = VM_INVALID_OBJ; |
| 64 | #define VM_NOIMPORT_OBJ(sym, mem) VM_IMPORT_OBJ(sym, mem) |
| 65 | |
| 66 | #define VM_IMPORT_PROP(sym, mem) mem = VM_INVALID_PROP; |
| 67 | #define VM_NOIMPORT_PROP(sym, mem) VM_IMPORT_PROP(sym, mem) |
| 68 | |
| 69 | #define VM_IMPORT_FUNC(sym, mem) mem = 0; |
| 70 | |
| 71 | #include "vmimport.h" |
| 72 | } |
| 73 | |
| 74 | /* |
| 75 | * Now include the import list to generate the actual member variables |
| 76 | * for the imported symbols. During image file load, the loader will |
| 77 | * set these members to the actual values imported from the image |
| 78 | * file. |
| 79 | */ |
| 80 | #define VM_IMPORT_OBJ(sym, mem) vm_obj_id_t mem; |
| 81 | #define VM_NOIMPORT_OBJ(sym, mem) VM_IMPORT_OBJ(sym, mem) |
| 82 | |
| 83 | #define VM_IMPORT_PROP(sym, mem) vm_prop_id_t mem; |
| 84 | #define VM_NOIMPORT_PROP(sym, mem) VM_IMPORT_PROP(sym, mem) |
| 85 | |
| 86 | #define VM_IMPORT_FUNC(sym, mem) pool_ofs_t mem; |
| 87 | |
| 88 | #include "vmimport.h" |
| 89 | }; |
| 90 | |
| 91 | #endif /* VMPREDEF_H */ |
| 92 |