VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/7.0/X11/extensions/xtrapemacros.h@ 6202

Last change on this file since 6202 was 6202, checked in by vboxsync, 17 years ago

re-export x11

  • Property svn:eol-style set to native
File size: 16.2 KB
Line 
1/* $XFree86: xc/include/extensions/xtrapemacros.h,v 1.1 2001/11/02 23:29:26 dawes Exp $ */
2#ifndef __XTRAPEMACROS__
3#define __XTRAPEMACROS__ "@(#)xtrapemacros.h 1.9 - 90/09/18 "
4
5/*****************************************************************************
6Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp.,
7Maynard, MA
8
9Permission to use, copy, modify, and distribute this software and its
10documentation for any purpose and without fee is hereby granted,
11provided that the above copyright notice appear in all copies and that
12both that copyright notice and this permission notice appear in
13supporting documentation, and that the name of Digital not be
14used in advertising or publicity pertaining to distribution of the
15software without specific, written prior permission.
16
17DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
18ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
19DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23SOFTWARE.
24
25*****************************************************************************/
26/*
27 *
28 * CONTRIBUTORS:
29 *
30 * Dick Annicchiarico
31 * Robert Chesler
32 * Dan Coutu
33 * Gene Durso
34 * Marc Evans
35 * Alan Jamison
36 * Mark Henry
37 * Ken Miller
38 *
39 * DESCRIPTION:
40 * This include file is designed to provide the *visible*
41 * interface to XTrap data structures. Fields can be set
42 * using these macros by client programs unless otherwise
43 * specified; however, use of Trap Context convenience
44 * routines is strongly encouraged (XETrapContext.c)
45 */
46#include <X11/extensions/xtrapbits.h>
47#include <signal.h>
48
49/* msleep macro to replace msleep() for portability reasons */
50#define msleep(m) usleep((m)*1000)
51
52/* Copying TC's assumes that the new TC must be created */
53#define XECopyTC(src,mask,dest) \
54 (dest = XECreateTC(((src)->dpy), (mask), (&((src)->values))))
55
56/* Expands to SET each element of the TCValues structure
57 * Returns the TCValues Mask so that the Set can be entered
58 * as an argument to the XEChangeTC() routine call
59 */
60/* Note: req_cb & evt_cb would only be used if you wanted to
61 * *share* callbacks between Trap Contexts. Normally,
62 * XEAddRequestCB() and XEAddEventCB() would be used.
63 */
64#define XETrapSetCfgReqCB(tcv,x) ((tcv)->req_cb = (x))
65#define XETrapSetCfgEvtCB(tcv,x) ((tcv)->evt_cb = (x))
66#define XETrapSetCfgMaxPktSize(tcv,x) ((tcv)->v.max_pkt_size = (x))
67#define XETrapSetCfgCmdKey(tcv,x) ((tcv)->v.cmd_key = (x))
68/* Note: e is only pertinent for "valid" or "data" */
69#define XETrapSetCfgFlags(tcv,e,a) \
70 memcpy((tcv)->v.flags.e, (a), sizeof((tcv)->v.flags.e))
71#define XETrapSetCfgFlagTimestamp(tcv,e,x) \
72 BitSet((tcv)->v.flags.e, XETrapTimestamp, (x))
73#define XETrapSetCfgFlagCmd(tcv,e,x) \
74 BitSet((tcv)->v.flags.e, XETrapCmd, (x))
75#define XETrapSetCfgFlagCmdKeyMod(tcv,e,x) \
76 BitSet((tcv)->v.flags.e, XETrapCmdKeyMod, (x))
77#define XETrapSetCfgFlagRequest(tcv,e,x) \
78 BitSet((tcv)->v.flags.e, XETrapRequest, (x))
79#define XETrapSetCfgFlagEvent(tcv,e,x) \
80 BitSet((tcv)->v.flags.e, XETrapEvent, (x))
81#define XETrapSetCfgFlagMaxPacket(tcv,e,x) \
82 BitSet((tcv)->v.flags.e, XETrapMaxPacket, (x))
83#define XETrapSetCfgFlagStatistics(tcv,e,x) \
84 BitSet((tcv)->v.flags.e, XETrapStatistics, (x))
85#define XETrapSetCfgFlagWinXY(tcv,e,x) \
86 BitSet((tcv)->v.flags.e, XETrapWinXY, (x))
87#define XETrapSetCfgFlagCursor(tcv,e,x) \
88 BitSet((tcv)->v.flags.e, XETrapCursor, (x))
89#define XETrapSetCfgFlagReq(tcv,request,x) \
90 BitSet((tcv)->v.flags.req, (request), (x))
91#define XETrapSetCfgFlagXInput(tcv,e,x) \
92 BitSet((tcv)->v.flags.e, XETrapXInput, (x))
93#define XETrapSetCfgFlagColorReplies(tcv,e,x) \
94 BitSet((tcv)->v.flags.e, XETrapColorReplies, (x))
95#define XETrapSetCfgFlagGrabServer(tcv,e,x) \
96 BitSet((tcv)->v.flags.e, XETrapGrabServer, (x))
97#define XETrapSetCfgFlagEvt(tcv,evt,x) \
98 BitSet((tcv)->v.flags.event, (evt), (x))
99
100#define XETrapSetValFlagDeltaTimes(tcv,x) \
101 BitSet((tcv)->tc_flags, XETCDeltaTimes, (x))
102
103/* Fields returned in the "GetAvailable" request */
104#define XETrapGetAvailPFIdent(avail) ((avail)->pf_ident)
105#define XETrapGetAvailRelease(avail) ((avail)->xtrap_release)
106#define XETrapGetAvailVersion(avail) ((avail)->xtrap_version)
107#define XETrapGetAvailRevision(avail) ((avail)->xtrap_revision)
108#define XETrapGetAvailMaxPktSize(avail) ((avail)->max_pkt_size)
109#define XETrapGetAvailFlags(avail,a) \
110 memcpy((a), (avail)->valid, sizeof((avail)->valid))
111#define XETrapGetAvailFlagTimestamp(avail) \
112 (BitValue((avail)->valid, XETrapTimestamp))
113#define XETrapGetAvailFlagCmd(avail) \
114 (BitValue((avail)->valid, XETrapCmd))
115#define XETrapGetAvailFlagCmdKeyMod(avail) \
116 (BitValue((avail)->valid, XETrapCmdKeyMod))
117#define XETrapGetAvailFlagRequest(avail) \
118 (BitValue((avail)->valid, XETrapRequest))
119#define XETrapGetAvailFlagEvent(avail) \
120 (BitValue((avail)->valid, XETrapEvent))
121#define XETrapGetAvailFlagMaxPacket(avail) \
122 (BitValue((avail)->valid, XETrapMaxPacket))
123#define XETrapGetAvailFlagStatistics(avail) \
124 (BitValue((avail)->valid, XETrapStatistics))
125#define XETrapGetAvailFlagWinXY(avail) \
126 (BitValue((avail)->valid, XETrapWinXY))
127#define XETrapGetAvailFlagCursor(avail) \
128 (BitValue((avail)->valid, XETrapCursor))
129#define XETrapGetAvailFlagXInput(avail) \
130 (BitValue((avail)->valid, XETrapXInput))
131#define XETrapGetAvailFlagVecEvt(avail) \
132 (BitValue((avail)->valid, XETrapVectorEvents))
133#define XETrapGetAvailFlagColorReplies(avail) \
134 (BitValue((avail)->valid, XETrapColorReplies))
135#define XETrapGetAvailFlagGrabServer(avail) \
136 (BitValue((avail)->valid, XETrapGrabServer))
137#define XETrapGetAvailOpCode(avail) ((avail)->major_opcode)
138/* Macro's for creating current request and trap context macros */
139#define XETrapGetCfgMaxPktSize(cfg) ((cfg)->max_pkt_size)
140#define XETrapGetCfgCmdKey(cfg) ((cfg)->cmd_key)
141#define XETrapGetCfgFlags(cfg,e,a) \
142 memcpy((a), (cfg)->flags.e, sizeof((cfg)->flags.e))
143#define XETrapGetCfgFlagTimestamp(cfg,e) \
144 (BitValue((cfg)->flags.e, XETrapTimestamp))
145#define XETrapGetCfgFlagCmd(cfg,e) \
146 (BitValue((cfg)->flags.e, XETrapCmd))
147#define XETrapGetCfgFlagCmdKeyMod(cfg,e) \
148 (BitValue((cfg)->flags.e, XETrapCmdKeyMod))
149#define XETrapGetCfgFlagRequest(cfg,e) \
150 (BitValue((cfg)->flags.e, XETrapRequest))
151#define XETrapGetCfgFlagEvent(cfg,e) \
152 (BitValue((cfg)->flags.e, XETrapEvent))
153#define XETrapGetCfgFlagMaxPacket(cfg,e) \
154 (BitValue((cfg)->flags.e, XETrapMaxPacket))
155#define XETrapGetCfgFlagStatistics(cfg,e) \
156 (BitValue((cfg)->flags.e, XETrapStatistics))
157#define XETrapGetCfgFlagWinXY(cfg,e) \
158 (BitValue((cfg)->flags.e, XETrapWinXY))
159#define XETrapGetCfgFlagCursor(cfg,e) \
160 (BitValue((cfg)->flags.e, XETrapCursor))
161#define XETrapGetCfgFlagXInput(cfg,e) \
162 (BitValue((cfg)->flags.e, XETrapXInput))
163#define XETrapGetCfgFlagColorReplies(cfg,e) \
164 (BitValue((cfg)->flags.e, XETrapColorReplies))
165#define XETrapGetCfgFlagGrabServer(cfg,e) \
166 (BitValue((cfg)->flags.e, XETrapGrabServer))
167/* Request values are in "Xproto.h" of the flavor X_RequestType */
168#define XETrapGetCfgFlagReq(cfg,request) \
169 (BitValue((cfg)->flags.req, (request)))
170/* Event types are in "X.h" of the flavor EventType (e.g. KeyPress) */
171#define XETrapGetCfgFlagEvt(cfg,evt) \
172 (BitValue((cfg)->flags.event, (evt)))
173
174/* Fields returned int the "GetCurrent" Request */
175#define XETrapGetCurX(avail) ((avail)->cur_x)
176#define XETrapGetCurY(avail) ((avail)->cur_y)
177#define XETrapGetCurSFlags(cur,a) \
178 memcpy((a), (cur)->state_flags, sizeof((cur)->state_flags))
179#define XETrapGetCurMaxPktSize(cur) (XETrapGetCfgMaxPktSize(&((cur)->config)))
180#define XETrapGetCurCmdKey(cur) (XETrapGetCfgCmdKey(&((cur)->config)))
181/* Note: e is only pertinent for "valid" or "data" */
182#define XETrapGetCurCFlags(cur,e,a) (XETrapGetCfgFlags(&((cur)->config),e,a))
183#define XETrapGetCurFlagTimestamp(cur,e) \
184 (XETrapGetCfgFlagTimestamp(&((cur)->config),e))
185#define XETrapGetCurFlagCmd(cur,e) (XETrapGetCfgFlagCmd(&((cur)->config),e))
186#define XETrapGetCurFlagCmdKeyMod(cur,e) \
187 (XETrapGetCfgFlagCmdKeyMod(&((cur)->config),e))
188#define XETrapGetCurFlagRequest(cur,r) \
189 (XETrapGetCfgFlagRequest(&((cur)->config),r))
190#define XETrapGetCurFlagEvent(cur,e) \
191 (XETrapGetCfgFlagEvent(&((cur)->config),e))
192#define XETrapGetCurFlagMaxPacket(cur,e) \
193 (XETrapGetCfgFlagMaxPacket(&((cur)->config),e))
194#define XETrapGetCurFlagStatistics(cur,e) \
195 (XETrapGetCfgFlagStatistics(&((cur)->config),e))
196#define XETrapGetCurFlagWinXY(cur,e) \
197 (XETrapGetCfgFlagWinXY(&((cur)->config),e))
198#define XETrapGetCurFlagCursor(cur,e) \
199 (XETrapGetCfgFlagCursor(&((cur)->config),e))
200#define XETrapGetCurFlagXInput(cur,e) \
201 (XETrapGetCfgFlagXInput(&((cur)->config),e))
202#define XETrapGetCurFlagColorReplies(cur,e) \
203 (XETrapGetCfgFlagColorReplies(&((cur)->config),e))
204#define XETrapGetCurFlagGrabServer(cur,e) \
205 (XETrapGetCfgFlagGrabServer(&((cur)->config),e))
206/* Request values are in "Xproto.h" of the flavor X_RequestType */
207#define XETrapGetCurFlagReq(cur,r) (XETrapGetCfgFlagReq(&((cur)->config),r))
208/* Event types are in "X.h" of the flavor EventType (e.g. KeyPress) */
209#define XETrapGetCurFlagEvt(cur,e) (XETrapGetCfgFlagEvt(&((cur)->config),e))
210
211/* Fields returned int the "GetStatistics" Request */
212#define XETrapGetStatsReq(stat,e) ((stat)->requests[(e)])
213#define XETrapGetStatsEvt(stat,e) ((stat)->events[(e)])
214
215/* Fields returned in the "GetVersion" request */
216#define XETrapGetVersRelease(vers) ((vers)->xtrap_release)
217#define XETrapGetVersVersion(vers) ((vers)->xtrap_version)
218#define XETrapGetVersRevision(vers) ((vers)->xtrap_revision)
219
220/* Fields returned in the "GetLastInpTime" request */
221#define XETrapGetLastInpTime(time_rep) ((time_rep)->last_time)
222
223/* Expands to GET each element of the TCValues structure */
224#define XETrapGetTCReqCB(tc) ((tc)->values.req_cb)
225#define XETrapGetTCEvtCB(tc) ((tc)->values.evt_cb)
226#define XETrapGetTCTime(tc) ((tc)->values.last_time)
227/* TC specific flags */
228#define XETrapGetTCLFlags(tc,a) \
229 memcpy((a), (tc)->values.tc_flags, sizeof((tc)->values.tc_flags))
230#define XETrapGetTCFlagDeltaTimes(tc) \
231 (BitValue((tc)->values.tc_flags, XETCDeltaTimes))
232#define XETrapGetTCFlagTrapActive(tc) \
233 (BitValue((tc)->values.tc_flags, XETCTrapActive))
234#define XETrapGetTCMaxPktSize(tc) (XETrapGetCfgMaxPktSize(&((tc)->values.v)))
235#define XETrapGetTCCmdKey(tc) (XETrapGetCfgCmdKey(&((tc)->values.v)))
236/* Note: e is only pertinent for "valid" or "data" */
237#define XETrapGetTCFlags(tc,e,a) (XETrapGetCfgFlags(&((tc)->values.v),e,a))
238#define XETrapGetTCFlagTimestamp(tc,e) \
239 (XETrapGetCfgFlagTimestamp(&((tc)->values.v),e))
240#define XETrapGetTCFlagCmd(tc,e) \
241 (XETrapGetCfgFlagCmd(&((tc)->values.v),e))
242#define XETrapGetTCFlagCmdKeyMod(tc,e) \
243 (XETrapGetCfgFlagCmdKeyMod(&((tc)->values.v),e))
244#define XETrapGetTCFlagRequest(tc,r) \
245 (XETrapGetCfgFlagRequest(&((tc)->values.v),r))
246#define XETrapGetTCFlagEvent(tc,e) \
247 (XETrapGetCfgFlagEvent(&((tc)->values.v),e))
248#define XETrapGetTCFlagMaxPacket(tc,e) \
249 (XETrapGetCfgFlagMaxPacket(&((tc)->values.v),e))
250#define XETrapGetTCFlagStatistics(tc,e) \
251 (XETrapGetCfgFlagStatistics(&((tc)->values.v),e))
252#define XETrapGetTCFlagWinXY(tc,e) \
253 (XETrapGetCfgFlagWinXY(&((tc)->values.v),e))
254#define XETrapGetTCFlagCursor(tc,e) \
255 (XETrapGetCfgFlagCursor(&((tc)->values.v),e))
256#define XETrapGetTCFlagXInput(tc,e) \
257 (XETrapGetCfgFlagXInput(&((tc)->values.v),e))
258#define XETrapGetTCFlagColorReplies(tc,e) \
259 (XETrapGetCfgFlagColorReplies(&((tc)->values.v),e))
260#define XETrapGetTCFlagGrabServer(tc,e) \
261 (XETrapGetCfgFlagGrabServer(&((tc)->values.v),e))
262/* Request values are in "Xproto.h" of the flavor X_RequestType */
263#define XETrapGetTCFlagReq(tc,r) \
264 (XETrapGetCfgFlagReq(&((tc)->values.v),r))
265/* Event types are in "X.h" of the flavor EventType (e.g. KeyPress) */
266#define XETrapGetTCFlagEvt(tc,e) \
267 (XETrapGetCfgFlagEvt(&((tc)->values.v),e))
268/* The following can/should *not* be set directly! */
269#define XETrapGetNext(tc) ((tc)->next)
270#define XETrapGetDpy(tc) ((tc)->dpy)
271#define XETrapGetEventBase(tc) ((tc)->eventBase)
272#define XETrapGetErrorBase(tc) ((tc)->errorBase)
273#define XETrapGetExtOpcode(tc) ((tc)->extOpcode)
274#define XETrapGetXBuff(tc) ((tc)->xbuff)
275#define XETrapGetXMaxSize(tc) ((tc)->xmax_size)
276#define XETrapGetExt(tc) ((tc)->ext_data)
277#define XETrapGetDirty(tc) ((tc)->dirty)
278#define XETrapGetValues(tc) memcpy((x),(tc)->values,sizeof((tc)->values))
279#define XETrapGetEventFunc(tc) ((tc)->eventFunc)
280
281#define XETrapGetHeaderCount(phdr) ((phdr)->count)
282#define XETrapGetHeaderTimestamp(phdr) ((phdr)->timestamp)
283#define XETrapGetHeaderType(phdr) ((phdr)->type)
284#define XETrapGetHeaderScreen(phdr) ((phdr)->screen)
285#define XETrapGetHeaderWindowX(phdr) ((phdr)->win_x)
286#define XETrapGetHeaderWindowY(phdr) ((phdr)->win_y)
287#define XETrapGetHeaderClient(phdr) ((phdr)->client)
288
289#define XEGetRelease(tc) ((tc)->release)
290#define XEGetVersion(tc) ((tc)->version)
291#define XEGetRevision(tc) ((tc)->revision)
292
293/* Condition handling macros */
294#if !defined(vms) && \
295 (!defined(_InitExceptionHandling) || !defined(_ClearExceptionHandling))
296# ifndef _SetSIGBUSHandling
297# ifdef SIGBUS
298# define _SetSIGBUSHandling(rtn) (void)signal(SIGBUS, rtn)
299# else
300# define _SetSIGBUSHandling(rtn) /* */
301# endif
302# endif
303# ifndef _SetSIGSEGVHandling
304# ifdef SIGSEGV
305# define _SetSIGSEGVHandling(rtn) (void)signal(SIGSEGV, rtn)
306# else
307# define _SetSIGSEGVHandling(rtn) /* */
308# endif
309# endif
310# ifndef _SetSIGFPEHandling
311# ifdef SIGFPE
312# define _SetSIGFPEHandling(rtn) (void)signal(SIGFPE, rtn)
313# else
314# define _SetSIGFPEHandling(rtn) /* */
315# endif
316# endif
317# ifndef _SetSIGILLHandling
318# ifdef SIGILL
319# define _SetSIGILLHandling(rtn) (void)signal(SIGILL, rtn)
320# else
321# define _SetSIGILLHandling(rtn) /* */
322# endif
323# endif
324# ifndef _SetSIGSYSHandling
325# ifdef SIGSYS
326# define _SetSIGSYSHandling(rtn) (void)signal(SIGSYS, rtn)
327# else
328# define _SetSIGSYSHandling(rtn) /* */
329# endif
330# endif
331# ifndef _SetSIGHUPHandling
332# ifdef SIGHUP
333# define _SetSIGHUPHandling(rtn) (void)signal(SIGHUP, rtn)
334# else
335# define _SetSIGHUPHandling(rtn) /* */
336# endif
337# endif
338# ifndef _SetSIGPIPEHandling
339# ifdef SIGPIPE
340# define _SetSIGPIPEHandling(rtn) (void)signal(SIGPIPE, rtn)
341# else
342# define _SetSIGPIPEHandling(rtn) /* */
343# endif
344# endif
345# ifndef _SetSIGTERMHandling
346# ifdef SIGTERM
347# define _SetSIGTERMHandling(rtn) (void)signal(SIGTERM, rtn)
348# else
349# define _SetSIGTERMHandling(rtn) /* */
350# endif
351# endif
352#endif
353#ifndef _InitExceptionHandling
354#ifdef vms
355#define _InitExceptionHandling(rtn) \
356 VAXC$ESTABLISH(rtn) /* VMS exception handler */
357#else /* vms */
358#define _InitExceptionHandling(rtn) \
359 _SetSIGBUSHandling(rtn); /* Bus error */ \
360 _SetSIGSEGVHandling(rtn); /* Accvio/Segment error */ \
361 _SetSIGFPEHandling(rtn); /* Floating point exception */ \
362 _SetSIGILLHandling(rtn); /* Illegal instruction */ \
363 _SetSIGSYSHandling(rtn); /* Param error in sys call */ \
364 _SetSIGHUPHandling(rtn); \
365 _SetSIGPIPEHandling(rtn); \
366 _SetSIGTERMHandling(rtn)
367#endif /* vms */
368#endif /* _InitExceptionHandling */
369
370#ifndef _ClearExceptionHandling
371#ifdef vms
372#define _ClearExceptionHandling() \
373 LIB$REVERT()
374#else
375#define _ClearExceptionHandling() \
376 _SetSIGBUSHandling(SIG_DFL); /* Bus error */ \
377 _SetSIGSEGVHandling(SIG_DFL); /* Accvio/Segment error */ \
378 _SetSIGFPEHandling(SIG_DFL); /* Floating point exception */ \
379 _SetSIGILLHandling(SIG_DFL); /* Illegal instruction */ \
380 _SetSIGSYSHandling(SIG_DFL); /* Param error in sys call */ \
381 _SetSIGHUPHandling(SIG_DFL); \
382 _SetSIGPIPEHandling(SIG_DFL); \
383 _SetSIGTERMHandling(SIG_DFL)
384#endif /* vms */
385#endif /* _ClearExceptionHandling */
386
387#endif /* __XTRAPEMACROS__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette