1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
/* $TOG: pl_xdata.h /main/6 1998/02/06 16:12:50 kaleb $ */
/*
Copyright 1992, 1998 The Open Group
All Rights Reserved.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/*
* Read data from the X buffer
*/
#ifndef WORD64
#define XREAD_LISTOF_CARD32(_display, _count, _pList) \
_XRead (_display, (char *) _pList, (long) (SIZEOF (CARD32) * _count));
#define XREAD_LISTOF_CARD16(_display, _count, _pList) \
_XRead (_display, (char *) _pList, (long) (SIZEOF (CARD16) * _count));
#define XREAD_LISTOF_FLOAT32(_display, _count, _pList, _fpConvert, _fpFormat) \
{ \
if (!fpConvert) \
{ \
_XRead (_display, (char *) _pList, (long) (_count * SIZEOF (float))); \
} \
else \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_FLOAT32 (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
} \
}
#define XREAD_LISTOF_COORD3D(_display, _count, _pList, _fpConvert, _fpFormat) \
{ \
if (!fpConvert) \
{ \
_XRead (_display, (char *) _pList, \
(long) (_count * SIZEOF (pexCoord3D))); \
} \
else \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_COORD3D (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
} \
}
#define XREAD_LISTOF_DEVCOORD(_display, _count, _pList, _fpConvert, _fpFormat)\
{ \
if (!fpConvert) \
{ \
_XRead (_display, (char *) _pList, \
(long) (_count * SIZEOF (pexDeviceCoord))); \
} \
else \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, \
_count * SIZEOF (pexDeviceCoord)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_DEVCOORD (_count, _pBuf, _pList, \
_fpConvert, _fpFormat); \
FINISH_WITH_SCRATCH (_display, _pBufSave, \
_count * SIZEOF (pexDeviceCoord)); \
} \
}
#define XREAD_LISTOF_DEVRECT(_display, _count, _pList) \
_XRead (_display, (char *) _pList, \
(long) (_count * SIZEOF (pexDeviceRect)));
#define XREAD_LISTOF_ELEMINFO(_display, _count, _pList) \
_XRead (_display, (char *) _pList, \
(long) (SIZEOF (pexElementInfo) * _count));
#define XREAD_LISTOF_ELEMREF(_display, _count, _pList) \
_XRead (_display, (char *) _pList, \
(long) (_count * SIZEOF (pexElementRef)));
#define XREAD_LISTOF_PICKELEMREF(_display, _count, _pList) \
_XRead (_display, (char *) _pList, \
(long) (_count * SIZEOF (pexPickElementRef)));
#else /* WORD64 */
#define XREAD_LISTOF_CARD32(_display, _count, _pList) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD32)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_CARD32 (_count, _pBuf, _pList); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD32)); \
}
#define XREAD_LISTOF_CARD16(_display, _count, _pList) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD16)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_CARD16 (_count, _pBuf, _pList); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD16)); \
}
#define XREAD_LISTOF_FLOAT32(_display, _count, _pList, _fpConvert, _fpFormat) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_FLOAT32 (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
}
#define XREAD_LISTOF_COORD3D(_display, _count, _pList, _fpConvert, _fpFormat) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_COORD3D (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
}
#define XREAD_LISTOF_DEVCOORD(_display, _count, _pList, _fpConvert, _fpFormat)\
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceCoord)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_DEVCOORD (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceCoord)); \
}
#define XREAD_LISTOF_DEVRECT(_display, _count, _pList) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceRect)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_DEVRECT (_count, _pBuf, _pList); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceRect)); \
}
#define XREAD_LISTOF_ELEMINFO(_display, _count, _pList) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementInfo)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_ELEMINFO (_count, _pBuf, _pList); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementInfo)); \
}
#define XREAD_LISTOF_ELEMREF(_display, _count, _pList) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementRef)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_ELEMREF (_count, _pBuf, _pList); \
FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementRef)); \
}
#define XREAD_LISTOF_PICKELEMREF(_display, _count, _pList) \
{ \
char *_pBuf, *_pBufSave; \
XREAD_INTO_SCRATCH (_display, _pBufSave, \
_count * SIZEOF (pexPickElementRef)); \
_pBuf = _pBufSave; \
EXTRACT_LISTOF_PICKELEMREF (_count, _pBuf, _pList); \
FINISH_WITH_SCRATCH (_display, _pBufSave, \
_count * SIZEOF (pexPickElementRef)); \
}
#endif /* WORD64 */
/*
* Send data to the X buffer
*/
#ifndef WORD64
#define XDATA_CARD32(_display, _val) \
Data (_display, (char *) &_val, SIZEOF (CARD32));
#define XDATA_MONOENCODING(_display, _encoding) \
Data (_display, (char *) _encoding, SIZEOF (pexMonoEncoding));
#else /* WORD64 */
#define XDATA_CARD32(_display, _val) \
{ \
char tVal[4]; \
CARD64_TO_32 (_val, tVal); \
Data (_display, tVal, SIZEOF (CARD32)); \
}
#define XDATA_MONOENCODING(_display, _encoding) \
{ \
pexMonoEncoding tEncoding; \
tEncoding.characterSet = _encoding->character_set; \
tEncoding.characterSetWidth = _encoding->character_set_width; \
tEncoding.encodingState = _encoding->encoding_state; \
tEncoding.numChars = _encoding->length; \
Data (_display, (char *) &tEncoding, SIZEOF (pexMonoEncoding)); \
}
#endif /* WORD64 */
|