diff options
Diffstat (limited to 'nx-X11/lib/X11/Xlibint.h')
-rw-r--r-- | nx-X11/lib/X11/Xlibint.h | 82 |
1 files changed, 18 insertions, 64 deletions
diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h index 56da2349b..bcd42b52b 100644 --- a/nx-X11/lib/X11/Xlibint.h +++ b/nx-X11/lib/X11/Xlibint.h @@ -215,13 +215,6 @@ struct _XDisplay #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) -/* - * define the following if you want the Data macro to be a procedure instead - */ -#ifdef CRAY -#define DataRoutineIsProcedure -#endif /* CRAY */ - #ifndef _XEVENT_ /* * _QEvent datatype for use in input queueing. @@ -426,26 +419,8 @@ extern LockInfoPtr _Xglobal_lock; * X Protocol packetizing macros. */ -/* Need to start requests on 64 bit word boundaries - * on a CRAY computer so add a NoOp (127) if needed. - * A character pointer on a CRAY computer will be non-zero - * after shifting right 61 bits of it is not pointing to - * a word boundary. - */ -#ifdef WORD64 -#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\ - dpy->last_req = dpy->bufptr;\ - *(dpy->bufptr) = X_NoOperation;\ - *(dpy->bufptr+1) = 0;\ - *(dpy->bufptr+2) = 0;\ - *(dpy->bufptr+3) = 1;\ - dpy->request++;\ - dpy->bufptr += 4;\ - } -#else /* else does not require alignment on 64-bit boundaries */ +/* Leftover from CRAY support - was defined empty on all non-Cray systems */ #define WORD64ALIGN -#endif /* WORD64 */ - /* * GetReq - Get the next available X request packet in the buffer and @@ -458,7 +433,6 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ _XFlush(dpy);\ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ @@ -469,7 +443,6 @@ extern LockInfoPtr _Xglobal_lock; #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ #define GetReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ _XFlush(dpy);\ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ @@ -484,7 +457,6 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetReqExtra(name, n, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\ _XFlush(dpy);\ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ @@ -494,7 +466,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #else #define GetReqExtra(name, n, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\ _XFlush(dpy);\ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ @@ -513,7 +484,6 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetResReq(name, rid, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ @@ -524,7 +494,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #else #define GetResReq(name, rid, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ @@ -541,7 +510,6 @@ extern LockInfoPtr _Xglobal_lock; */ #if !defined(UNIXCPP) || defined(ANSICPP) #define GetEmptyReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xReq *) (dpy->last_req = dpy->bufptr);\ @@ -551,7 +519,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #else #define GetEmptyReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xReq *) (dpy->last_req = dpy->bufptr);\ @@ -561,18 +528,14 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #endif -#ifdef WORD64 -#define MakeBigReq(req,n) \ - { \ - char _BRdat[4]; \ - unsigned long _BRlen = req->length - 1; \ - req->length = 0; \ - memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ - memcpy(((char *)req) + 4, _BRdat, 4); \ - Data32(dpy, (long *)&_BRdat, 4); \ - } -#else +/* + * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 + * length, after req->length, before the data in the request. The new length + * includes the "n" extra 32-bit words. + * + * Do not use MakeBigReq if there is no data already in the request. + * req->length must already be >= 2. + */ #ifdef LONG64 #define MakeBigReq(req,n) \ { \ @@ -580,7 +543,7 @@ extern LockInfoPtr _Xglobal_lock; CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } @@ -591,13 +554,19 @@ extern LockInfoPtr _Xglobal_lock; CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } #endif -#endif +/* + * SetReqLen increases the count of 32-bit words in the request by "n", + * or by "badlen" if "n" is too large. + * + * Do not use SetReqLen if "req" does not already have data after the + * xReq header. req->length must already be >= 2. + */ #define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ if (dpy->bigreq_size) { \ @@ -655,10 +624,6 @@ extern void _XFlushGCCache(Display *dpy, GC gc); (void)ptr; \ dpy->bufptr += (n); -#ifdef WORD64 -#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len) -#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len) -#else #define Data16(dpy, data, len) Data((dpy), (char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) @@ -678,7 +643,6 @@ extern void _XRead32( #define Data32(dpy, data, len) Data((dpy), (char *)(data), (len)) #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #endif -#endif /* not WORD64 */ #define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len) @@ -747,20 +711,10 @@ extern void _XRead32( } -#ifdef MUSTCOPY - -/* for when 32-bit alignment is not good enough */ -#define OneDataCard32(dpy,dstaddr,srcvar) \ - { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); } - -#else - /* srcvar must be a variable for large architecture version */ #define OneDataCard32(dpy,dstaddr,srcvar) \ { *(CARD32 *)(dstaddr) = (srcvar); } -#endif /* MUSTCOPY */ - typedef struct _XInternalAsync { struct _XInternalAsync *next; /* |