1 /* -------------------------------- pktdef.h -------------------------------- */
2 /* Combined 16 & 32-bit version. */
4 /*------------------------------------------------------------------------------
5 The text and information contained in this file may be freely used,
6 copied, or distributed without compensation or licensing restrictions.
8 This file is copyright 1991-1998 by LCS/Telegraphics.
9 ------------------------------------------------------------------------------*/
10 /*------------------------------------------------------------------------------
15 2. if using just one packet format:
16 a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits
17 (use the PK_* identifiers).
19 c. The generated structure typedef will be called PACKET. Use PACKETDATA
20 and PACKETMODE to fill in the LOGCONTEXT structure.
21 3. If using multiple packet formats, for each one:
22 a. Define PACKETNAME. Its text value will be a prefix for this packet's
24 b. Define <PACKETNAME>PACKETDATA and <PACKETNAME>PACKETMODE similar to
27 d. The generated structure typedef will be called
28 <PACKETNAME>PACKET. Compare with 2.c. above and example #2 below.
29 4. If using extension packet data, do the following additional steps
31 a. Before including pktdef.h, define <PACKETNAME>PACKET<EXTENSION>
32 as either PKEXT_ABSOLUTE or PKEXT_RELATIVE.
33 b. The generated structure typedef will contain a field for the
35 c. Scan the WTI_EXTENSION categories to find the extension's
37 d. OR the packet mask bit with <PACKETNAME>PACKETDATA and use the
38 result in the lcPktData field of the LOGCONTEXT structure.
39 e. If <PACKETNAME>PACKET<EXTENSION> was PKEXT_RELATIVE, OR the
40 packet mask bit with <PACKETNAME>PACKETMODE and use the result
41 in the lcPktMode field of the LOGCONTEXT structure.
44 Example #1. -- single packet format
47 #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
48 #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
51 lc.lcPktData = PACKETDATA;
52 lc.lcPktMode = PACKETMODE;
54 Example #2. -- multiple formats
57 #define PACKETNAME MOE
58 #define MOEPACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
59 #define MOEPACKETMODE PK_BUTTONS /@ buttons relative mode @/
61 #define PACKETNAME LARRY
62 #define LARRYPACKETDATA PK_Y | PK_Z | PK_BUTTONS /@ y, z, buttons @/
63 #define LARRYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
65 #define PACKETNAME CURLY
66 #define CURLYPACKETDATA PK_X | PK_Z | PK_BUTTONS /@ x, z, buttons @/
67 #define CURLYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
70 lcMOE.lcPktData = MOEPACKETDATA;
71 lcMOE.lcPktMode = MOEPACKETMODE;
73 lcLARRY.lcPktData = LARRYPACKETDATA;
74 lcLARRY.lcPktMode = LARRYPACKETMODE;
76 lcCURLY.lcPktData = CURLYPACKETDATA;
77 lcCURLY.lcPktMode = CURLYPACKETMODE;
79 Example #3. -- extension packet data "XFOO".
82 #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
83 #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
84 #define PACKETXFOO PKEXT_ABSOLUTE /@ XFOO absolute mode @/
87 UINT ScanExts(UINT wTag)
92 /@ scan for wTag's info category. @/
93 for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) {
94 if (wTag == wScanTag) {
95 /@ return category offset from WTI_EXTENSIONS. @/
99 /@ return error code. @/
103 lc.lcPktData = PACKETDATA;
104 lc.lcPktMode = PACKETMODE;
106 categoryXFOO = ScanExts(WTX_XFOO);
107 WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO);
108 lc.lcPktData |= maskXFOO;
109 #if PACKETXFOO == PKEXT_RELATIVE
110 lc.lcPktMode |= maskXFOO;
113 WTOpen(hWnd, &lc, TRUE);
116 ------------------------------------------------------------------------------*/
119 #endif /* __cplusplus */
122 /* if no packet name prefix */
124 #define __IFX(x,y) x ## y
126 /* add prefixes and infixes to packet format names */
127 #define __PFX(x) __PFX2(PACKETNAME,x)
128 #define __PFX2(p,x) __PFX3(p,x)
129 #define __PFX3(p,x) p ## x
130 #define __IFX(x,y) __IFX2(x,PACKETNAME,y)
131 #define __IFX2(x,i,y) __IFX3(x,i,y)
132 #define __IFX3(x,i,y) x ## i ## y
135 #define __SFX2(x,s) __SFX3(x,s)
136 #define __SFX3(x,s) x ## s
138 #define __TAG __IFX(tag,PACKET)
139 #define __TYPES __PFX(PACKET), * __IFX(P,PACKET), NEAR * __IFX(NP,PACKET), \
140 FAR * __IFX(LP,PACKET)
142 #define __DATA (__PFX(PACKETDATA))
143 #define __MODE (__PFX(PACKETMODE))
144 #define __EXT(x) __SFX2(__PFX(PACKET),x)
147 typedef struct __TAG {
148 #if (__DATA & PK_CONTEXT)
151 #if (__DATA & PK_STATUS)
154 #if (__DATA & PK_TIME)
157 #if (__DATA & PK_CHANGED)
160 #if (__DATA & PK_SERIAL_NUMBER)
163 #if (__DATA & PK_CURSOR)
166 #if (__DATA & PK_BUTTONS)
178 #if (__DATA & PK_NORMAL_PRESSURE)
179 #if (__MODE & PK_NORMAL_PRESSURE)
181 int pkNormalPressure;
184 UINT pkNormalPressure;
187 #if (__DATA & PK_TANGENT_PRESSURE)
188 #if (__MODE & PK_TANGENT_PRESSURE)
190 int pkTangentPressure;
193 UINT pkTangentPressure;
196 #if (__DATA & PK_ORIENTATION)
197 ORIENTATION pkOrientation;
199 #if (__DATA & PK_ROTATION)
200 ROTATION pkRotation; /* 1.1 */
203 #ifndef NOWTEXTENSIONS
204 /* extensions begin here. */
205 #if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE)
208 #if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE)
233 #endif /* __cplusplus */