956a0e3c076406b83d635174a201fd8761ee5133vboxsync * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * copy of this software and associated documentation files (the "Software"),
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * to deal in the Software without restriction, including without limitation
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * and/or sell copies of the Software, and to permit persons to whom the
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Software is furnished to do so, subject to the following conditions:
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * The above copyright notice including the dates of first publication and
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * either this permission notice or a reference to
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * shall be included in all copies or substantial portions of the Software.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * SOFTWARE.
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync * Except as contained in this notice, the name of Silicon Graphics, Inc.
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync * shall not be used in advertising or otherwise to promote the sale, use or
68fb2428898c55a7172e6a75a0a8d7ce259919bdvboxsync * other dealings in this Software without prior written authorization from
956a0e3c076406b83d635174a201fd8761ee5133vboxsync * Silicon Graphics, Inc.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync** Fetch the context-id out of a SingleReq request pointed to by pc.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync** Fetch a double from potentially unaligned memory.
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
956a0e3c076406b83d635174a201fd8761ee5133vboxsyncextern void __glXMemInit(void);
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync WriteToClient (client, sz_xGLXSingleReply, &__glXReply);
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** Get a buffer to hold returned data, with the given alignment. If we have
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** to realloc, allocate size+align, in case the pointer has to be bumped for
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** alignment. The answerBuffer should already be aligned.
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** NOTE: the cast (long)res below assumes a long is large enough to hold a
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \
956a0e3c076406b83d635174a201fd8761ee5133vboxsync (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \
956a0e3c076406b83d635174a201fd8761ee5133vboxsync *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
956a0e3c076406b83d635174a201fd8761ee5133vboxsync WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync WriteToClient(client, (len)*__GLX_SIZE_INT32, answer)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len)
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len)
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** PERFORMANCE NOTE:
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** Machine dependent optimizations abound here; these swapping macros can
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync** conceivably be replaced with routines that do the job faster.
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\
956a0e3c076406b83d635174a201fd8761ee5133vboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\
956a0e3c076406b83d635174a201fd8761ee5133vboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\
956a0e3c076406b83d635174a201fd8761ee5133vboxsync#endif /* !__GLX_unpack_h__ */