1 /* 2 $Header: d:/cvsroot/tads/TADS2/PRP.H,v 1.2 1999/05/17 02:52:13 MJRoberts Exp $ 3 */ 4 5 /* 6 * Copyright (c) 1991, 2002 Michael J. Roberts. All Rights Reserved. 7 * 8 * Please see the accompanying license file, LICENSE.TXT, for information 9 * on using and copying this software. 10 */ 11 /* 12 Name 13 prp.h - property definitions 14 Function 15 Defines the structure of properties 16 Notes 17 A property structure must be binary-portable, because properties are 18 stored in objects, which must be binary-portable. Hence, the internal 19 structure of a property header is not a C structure, but a portable 20 sequence of bytes. Multi-byte quantities are stored in Intel format. 21 22 property number - 2 bytes 23 property datatype - 1 byte 24 property size - 2 bytes 25 property flags - 1 byte 26 27 This header is followed immediately by the property value. For 28 convenience, a set of macros is defined to provide access to the 29 fields of a property header. 30 Modified 31 12/16/92 MJRoberts - TADS/Graphic properties 32 08/11/91 MJRoberts - creation 33 */ 34 35 #ifndef PRP_INCLUDED 36 #define PRP_INCLUDED 37 38 #ifndef DAT_INCLUDED 39 #include "dat.h" 40 #endif 41 42 /* a property number, used to look up all properties */ 43 typedef ushort prpnum; 44 45 /* a property definition, used to associate data with properties */ 46 /* 47 typedef struct prpdef prpdef; 48 struct prpdef 49 { 50 prpnum prpprop; /o property number of this property o/ 51 dattyp prptype; /o datatype of the property value o/ 52 ushort prpsize; /o size of the property's data o/ 53 ushort prpflg; /o flags for the property o/ 54 uchar prpval[1]; /o value of the property (if applicable) o/ 55 }; 56 */ 57 typedef uchar prpdef; /* prpdef is just an array of bytes */ 58 #define PRPHDRSIZ 6 /* "sizeof(prpdef)" - size of property header */ 59 60 /* Macros to provide access to property header entries */ 61 #define prpprop(p) osrp2((uchar *)(p)) 62 #define prptype(p) (*(((uchar *)(p)) + 2)) 63 #define prpsize(p) osrp2((((uchar *)(p)) + 3)) 64 #define prpflg(p) (*(((uchar *)(p)) + 5)) 65 #define prpvalp(p) (((uchar *)(p)) + 6) 66 67 #define prpsetprop(p,n) oswp2((uchar *)(p), n) 68 #define prpsetsize(p,s) oswp2((((uchar *)(p)) + 3), s) 69 70 /* property flag values */ 71 #define PRPFORG 0x01 /* property is original startup value */ 72 #define PRPFIGN 0x02 /* ignore this prop (has been changed) */ 73 #define PRPFDEL 0x04 /* property has been permanently deleted */ 74 75 /* 76 * invalid property number - this number will never be used as an actual 77 * property, so it can be used to signify the lack of a valid property 78 */ 79 #define PRP_INVALID 0 80 81 /* certain property types are special, and are reserved here */ 82 #define PRP_DOACTION 1 /* doAction property */ 83 84 /* vocabulary properties - keep these contiguous, and must start at 2 */ 85 #define PRP_VERB 2 /* verb vocabulary property */ 86 #define PRP_NOUN 3 /* noun vocabulary property */ 87 #define PRP_ADJ 4 /* adjective vocabulary property */ 88 #define PRP_PREP 5 /* preposition vocabulary property */ 89 #define PRP_ARTICLE 6 /* article vocabulary property */ 90 #define PRP_PLURAL 7 /* plural vocabulary property */ 91 92 /* determine if a property is a vocab property */ 93 /* int prpisvoc(prpnum p); */ 94 #define prpisvoc(p) ((p) >= PRP_VERB && (p) <= PRP_PLURAL) 95 96 /* more properties... */ 97 #define PRP_SDESC 8 98 #define PRP_THEDESC 9 99 #define PRP_DODEFAULT 10 100 #define PRP_IODEFAULT 11 101 #define PRP_IOACTION 12 102 #define PRP_LOCATION 13 103 #define PRP_VALUE 14 104 #define PRP_ROOMACTION 15 105 #define PRP_ACTORACTION 16 106 #define PRP_CONTENTS 17 107 #define PRP_TPL 18 /* special built-in TEMPLATE structure */ 108 #define PRP_PREPDEFAULT 19 109 #define PRP_VERACTOR 20 110 #define PRP_VALIDDO 21 111 #define PRP_VALIDIO 22 112 #define PRP_LOOKAROUND 23 113 #define PRP_ROOMCHECK 24 114 #define PRP_STATUSLINE 25 115 #define PRP_LOCOK 26 116 #define PRP_ISVIS 27 117 #define PRP_NOREACH 28 118 #define PRP_ISHIM 29 119 #define PRP_ISHER 30 120 #define PRP_ACTION 31 /* action method */ 121 #define PRP_VALDOLIST 32 /* validDoList */ 122 #define PRP_VALIOLIST 33 /* validIoList */ 123 #define PRP_IOBJGEN 34 /* iobjGen */ 124 #define PRP_DOBJGEN 35 /* dobjGen */ 125 #define PRP_NILPREP 36 /* nilPrep */ 126 #define PRP_REJECTMDO 37 /* rejectMultiDobj */ 127 #define PRP_MOVEINTO 38 /* moveInto */ 128 #define PRP_CONSTRUCT 39 /* construct */ 129 #define PRP_DESTRUCT 40 /* destruct */ 130 #define PRP_VALIDACTOR 41 /* validActor */ 131 #define PRP_PREFACTOR 42 /* preferredActor */ 132 #define PRP_ISEQUIV 43 /* isEquivalent */ 133 #define PRP_ADESC 44 134 #define PRP_MULTISDESC 45 135 #define PRP_TPL2 46 /* new-style built-in TEMPLATE structure */ 136 #define PRP_ANYVALUE 47 /* anyvalue(n) - value to use for '#' with ANY */ 137 #define PRP_NEWNUMOBJ 48 /* newnumbered(n) - create new numbered object */ 138 #define PRP_UNKNOWN 49 /* internal property for unknown words */ 139 #define PRP_PARSEUNKNOWNDOBJ 50 /* parseUnknownDobj */ 140 #define PRP_PARSEUNKNOWNIOBJ 51 /* parseUnknownIobj */ 141 #define PRP_DOBJCHECK 52 /* dobjCheck */ 142 #define PRP_IOBJCHECK 53 /* iobjCheck */ 143 #define PRP_VERBACTION 54 /* verbAction */ 144 #define PRP_DISAMBIGDO 55 /* disambigDobj */ 145 #define PRP_DISAMBIGIO 56 /* disambigIobj */ 146 #define PRP_PREFIXDESC 57 /* prefixdesc */ 147 #define PRP_ISTHEM 58 /* isThem */ 148 149 /* properties used by TADS/Graphic */ 150 #define PRP_GP_PIC 100 /* gp_picture */ 151 #define PRP_GP_NAME 101 /* gp_name */ 152 #define PRP_GP_DEFVERB 102 /* gp_defverb */ 153 #define PRP_GP_ACTIVE 103 /* gp_active */ 154 #define PRP_GP_HOTLIST 104 /* gp_hotlist */ 155 #define PRP_GP_ICON 105 /* gp_icon */ 156 #define PRP_GP_DEFVERB2 106 /* gp_defverb2 */ 157 #define PRP_GP_DEFPREP 107 /* gp_defprep */ 158 #define PRP_GP_HOTID 108 /* gp_hotid */ 159 #define PRP_GP_OVERLAY 109 /* gp_overlay */ 160 #define PRP_GP_HOTX 110 /* gp_hotx */ 161 #define PRP_GP_HOTY 111 /* gp_hoty */ 162 163 /* highest reserved property number - must match last one above */ 164 #define PRP_LASTRSV 111 165 166 #endif /* PRP_INCLUDED */ 167