1
/* $Xorg: pl_nameset.c,v 1.4 2001/02/09 02:03:28 xorgcvs Exp $ */
3
/******************************************************************************
5
Copyright 1992, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall not be
24
used in advertising or otherwise to promote the sale, use or other dealings
25
in this Software without prior written authorization from The Open Group.
28
Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
32
Permission to use, copy, modify, distribute, and sell this software and its
33
documentation for any purpose is hereby granted without fee, provided that
34
the above copyright notice appear in all copies and that both that copyright
35
notice and this permission notice appear in supporting documentation, and that
36
the name of Digital not be used in advertising or publicity
37
pertaining to distribution of the software without specific, written prior
38
permission. Digital make no representations about the suitability
39
of this software for any purpose. It is provided "as is" without express or
42
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
43
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
44
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
45
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
46
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
47
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49
******************************************************************************/
52
#include "PEXlibint.h"
56
PEXCreateNameSet (display)
58
INPUT Display *display;
61
register pexCreateNameSetReq *req;
67
* Get a nameset resource id from X.
70
ns = XAllocID (display);
74
* Lock around the critical section, for multithreading.
77
LockDisplay (display);
81
* Put the request in the X request buffer.
84
PEXGetReq (CreateNameSet, pBuf);
86
BEGIN_REQUEST_HEADER (CreateNameSet, pBuf, req);
88
PEXStoreReqHead (CreateNameSet, req);
91
END_REQUEST_HEADER (CreateNameSet, pBuf, req);
95
* Done, so unlock and check for synchronous-ness.
98
UnlockDisplay (display);
99
PEXSyncHandle (display);
106
PEXFreeNameSet (display, ns)
108
INPUT Display *display;
112
register pexFreeNameSetReq *req;
117
* Lock around the critical section, for multithreading.
120
LockDisplay (display);
124
* Put the request in the X request buffer.
127
PEXGetReq (FreeNameSet, pBuf);
129
BEGIN_REQUEST_HEADER (FreeNameSet, pBuf, req);
131
PEXStoreReqHead (FreeNameSet, req);
134
END_REQUEST_HEADER (FreeNameSet, pBuf, req);
138
* Done, so unlock and check for synchronous-ness.
141
UnlockDisplay (display);
142
PEXSyncHandle (display);
147
PEXCopyNameSet (display, srcNs, destNs)
149
INPUT Display *display;
150
INPUT PEXNameSet srcNs;
151
INPUT PEXNameSet destNs;
154
register pexCopyNameSetReq *req;
159
* Lock around the critical section, for multithreading.
162
LockDisplay (display);
166
* Put the request in the X request buffer.
169
PEXGetReq (CopyNameSet, pBuf);
171
BEGIN_REQUEST_HEADER (CopyNameSet, pBuf, req);
173
PEXStoreReqHead (CopyNameSet, req);
177
END_REQUEST_HEADER (CopyNameSet, pBuf, req);
181
* Done, so unlock and check for synchronous-ness.
184
UnlockDisplay (display);
185
PEXSyncHandle (display);
190
PEXGetNameSet (display, ns, numNamesReturn, namesReturn)
192
INPUT Display *display;
194
OUTPUT unsigned long *numNamesReturn;
195
OUTPUT PEXName **namesReturn;
198
register pexGetNameSetReq *req;
200
pexGetNameSetReply rep;
204
* Lock around the critical section, for multithreading.
207
LockDisplay (display);
211
* Put the request in the X request buffer and get a reply.
214
PEXGetReq (GetNameSet, pBuf);
216
BEGIN_REQUEST_HEADER (GetNameSet, pBuf, req);
218
PEXStoreReqHead (GetNameSet, req);
221
END_REQUEST_HEADER (GetNameSet, pBuf, req);
223
if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
225
UnlockDisplay (display);
226
PEXSyncHandle (display);
229
return (0); /* return an error */
232
*numNamesReturn = rep.numNames;
236
* Allocate a buffer for the replies to pass back to the user.
239
*namesReturn = (PEXName *) Xmalloc (
240
(unsigned) (sizeof (PEXName) * rep.numNames));
242
XREAD_LISTOF_CARD32 (display, rep.numNames, *namesReturn);
246
* Done, so unlock and check for synchronous-ness.
249
UnlockDisplay (display);
250
PEXSyncHandle (display);
257
PEXChangeNameSet (display, ns, action, numValues, values)
259
INPUT Display *display;
262
INPUT unsigned long numValues;
263
INPUT PEXName *values;
266
register pexChangeNameSetReq *req;
272
* Lock around the critical section, for multithreading.
275
LockDisplay (display);
279
* Put the request in the X request buffer.
282
size = numValues * SIZEOF (pexName);
283
PEXGetReqExtra (ChangeNameSet, size, pBuf);
285
BEGIN_REQUEST_HEADER (ChangeNameSet, pBuf, req);
287
PEXStoreReqExtraHead (ChangeNameSet, size, req);
289
req->action = action;
291
END_REQUEST_HEADER (ChangeNameSet, pBuf, req);
293
STORE_LISTOF_CARD32 (numValues, values, pBuf);
297
* Done, so unlock and check for synchronous-ness.
300
UnlockDisplay (display);
301
PEXSyncHandle (display);