home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / dix / swapreq.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-05  |  27.2 KB  |  1,168 lines

  1. /************************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ********************************************************/
  24.  
  25. /* $XConsortium: swapreq.c,v 1.34 91/06/05 17:20:22 rws Exp $ */
  26.  
  27. #include "X.h"
  28. #define NEED_EVENTS
  29. #include "Xproto.h"
  30. #include "Xprotostr.h"
  31. #include "misc.h"
  32. #include "dixstruct.h"
  33.  
  34. extern int (* ProcVector[256]) ();
  35. extern void (* EventSwapVector[128]) ();  /* for SendEvent */
  36.  
  37. /* Thanks to Jack Palevich for testing and subsequently rewriting all this */
  38.  
  39. /* Byte swap a list of longs */
  40.  
  41. void
  42. SwapLongs (list, count)
  43.     register long *list;
  44.     register unsigned long count;
  45. {
  46.     register char n;
  47.  
  48.     while (count >= 8) {
  49.         swapl(list+0, n);
  50.         swapl(list+1, n);
  51.         swapl(list+2, n);
  52.         swapl(list+3, n);
  53.         swapl(list+4, n);
  54.         swapl(list+5, n);
  55.         swapl(list+6, n);
  56.         swapl(list+7, n);
  57.         list += 8;
  58.         count -= 8;
  59.     }
  60.     if (count != 0) {
  61.         do {
  62.         swapl(list, n);
  63.         list++;
  64.         } while (--count != 0);
  65.     }
  66. }
  67.  
  68. /* Byte swap a list of shorts */
  69.  
  70. void
  71. SwapShorts (list, count)
  72.     register short *list;
  73.     register unsigned long count;
  74. {
  75.     register char n;
  76.  
  77.     while (count >= 16) {
  78.         swaps(list+0, n);
  79.         swaps(list+1, n);
  80.         swaps(list+2, n);
  81.         swaps(list+3, n);
  82.         swaps(list+4, n);
  83.         swaps(list+5, n);
  84.         swaps(list+6, n);
  85.         swaps(list+7, n);
  86.         swaps(list+8, n);
  87.         swaps(list+9, n);
  88.         swaps(list+10, n);
  89.         swaps(list+11, n);
  90.         swaps(list+12, n);
  91.         swaps(list+13, n);
  92.         swaps(list+14, n);
  93.         swaps(list+15, n);
  94.         list += 16;
  95.         count -= 16;
  96.     }
  97.     if (count != 0) {
  98.         do {
  99.         swaps(list, n);
  100.         list++;
  101.         } while (--count != 0);
  102.     }
  103. }
  104.  
  105. /* The following is used for all requests that have
  106.    no fields to be swapped (except "length") */
  107. int
  108. SProcSimpleReq(client)
  109.     register ClientPtr client;
  110. {
  111.     register char n;
  112.  
  113.     REQUEST(xReq);
  114.     swaps(&stuff->length, n);
  115.     return(*ProcVector[stuff->reqType])(client);
  116. }
  117.  
  118. /* The following is used for all requests that have
  119.    only a single 32-bit field to be swapped, coming
  120.    right after the "length" field */
  121. int
  122. SProcResourceReq(client)
  123.     register ClientPtr client;
  124. {
  125.     register char n;
  126.  
  127.     REQUEST(xResourceReq);
  128.     swaps(&stuff->length, n);
  129.     REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */
  130.     swapl(&stuff->id, n);
  131.     return(*ProcVector[stuff->reqType])(client);
  132. }
  133.  
  134. int
  135. SProcCreateWindow(client)
  136.     register ClientPtr client;
  137. {
  138.     register char n;
  139.  
  140.     REQUEST(xCreateWindowReq);
  141.     swaps(&stuff->length, n);
  142.     REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
  143.     swapl(&stuff->wid, n);
  144.     swapl(&stuff->parent, n);
  145.     swaps(&stuff->x, n);
  146.     swaps(&stuff->y, n);
  147.     swaps(&stuff->width, n);
  148.     swaps(&stuff->height, n);
  149.     swaps(&stuff->borderWidth, n);
  150.     swaps(&stuff->class, n);
  151.     swapl(&stuff->visual, n);
  152.     swapl(&stuff->mask, n);
  153.     SwapRestL(stuff);
  154.     return((* ProcVector[X_CreateWindow])(client));
  155. }
  156.  
  157. int
  158. SProcChangeWindowAttributes(client)
  159.     register ClientPtr client;
  160. {
  161.     register char n;
  162.  
  163.     REQUEST(xChangeWindowAttributesReq);
  164.     swaps(&stuff->length, n);
  165.     REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
  166.     swapl(&stuff->window, n);
  167.     swapl(&stuff->valueMask, n);
  168.     SwapRestL(stuff);
  169.     return((* ProcVector[X_ChangeWindowAttributes])(client));
  170. }
  171.  
  172. int
  173. SProcReparentWindow(client)
  174.     register ClientPtr client;
  175. {
  176.     register char n;
  177.     REQUEST(xReparentWindowReq);
  178.     swaps(&stuff->length, n);
  179.     REQUEST_SIZE_MATCH(xReparentWindowReq);
  180.     swapl(&stuff->window, n);
  181.     swapl(&stuff->parent, n);
  182.     swaps(&stuff->x, n);
  183.     swaps(&stuff->y, n);
  184.     return((* ProcVector[X_ReparentWindow])(client));
  185. }
  186.  
  187. int
  188. SProcConfigureWindow(client)
  189.     register ClientPtr client;
  190. {
  191.     register char n;
  192.     REQUEST(xConfigureWindowReq);
  193.     swaps(&stuff->length, n);
  194.     REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
  195.     swapl(&stuff->window, n);
  196.     swaps(&stuff->mask, n);
  197.     SwapRestL(stuff);
  198.     return((* ProcVector[X_ConfigureWindow])(client));
  199.  
  200. }
  201.  
  202.  
  203. int
  204. SProcInternAtom(client)
  205.     register ClientPtr client;
  206. {
  207.     register char n;
  208.     REQUEST(xInternAtomReq);
  209.     swaps(&stuff->length, n);
  210.     REQUEST_AT_LEAST_SIZE(xInternAtomReq);
  211.     swaps(&stuff->nbytes, n);
  212.     return((* ProcVector[X_InternAtom])(client));
  213. }
  214.  
  215. int
  216. SProcChangeProperty(client)
  217.     register ClientPtr client;
  218. {
  219.     register char n;
  220.     REQUEST(xChangePropertyReq);
  221.     swaps(&stuff->length, n);
  222.     REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
  223.     swapl(&stuff->window, n);
  224.     swapl(&stuff->property, n);
  225.     swapl(&stuff->type, n);
  226.     swapl(&stuff->nUnits, n);
  227.     switch ( stuff->format ) {
  228.         case 8 :
  229.         break;
  230.         case 16:
  231.         SwapRestS(stuff);
  232.         break;
  233.     case 32:
  234.         SwapRestL(stuff);
  235.         break;
  236.     }
  237.     return((* ProcVector[X_ChangeProperty])(client));
  238. }
  239.  
  240. int 
  241. SProcDeleteProperty(client)
  242.     register ClientPtr client;
  243. {
  244.     register char n;
  245.     REQUEST(xDeletePropertyReq);
  246.     swaps(&stuff->length, n);
  247.     REQUEST_SIZE_MATCH(xDeletePropertyReq);
  248.     swapl(&stuff->window, n);
  249.     swapl(&stuff->property, n);
  250.     return((* ProcVector[X_DeleteProperty])(client));
  251.               
  252. }
  253.  
  254. int 
  255. SProcGetProperty(client)
  256.     register ClientPtr client;
  257. {
  258.     register char n;
  259.     REQUEST(xGetPropertyReq);
  260.     swaps(&stuff->length, n);
  261.     REQUEST_SIZE_MATCH(xGetPropertyReq);
  262.     swapl(&stuff->window, n);
  263.     swapl(&stuff->property, n);
  264.     swapl(&stuff->type, n);
  265.     swapl(&stuff->longOffset, n);
  266.     swapl(&stuff->longLength, n);
  267.     return((* ProcVector[X_GetProperty])(client));
  268. }
  269.  
  270. int
  271. SProcSetSelectionOwner(client)
  272.     register ClientPtr client;
  273. {
  274.     register char n;
  275.     REQUEST(xSetSelectionOwnerReq);
  276.     swaps(&stuff->length, n);
  277.     REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
  278.     swapl(&stuff->window, n);
  279.     swapl(&stuff->selection, n);
  280.     swapl(&stuff->time, n);
  281.     return((* ProcVector[X_SetSelectionOwner])(client));
  282. }
  283.  
  284. int
  285. SProcConvertSelection(client)
  286.     register ClientPtr client;
  287. {
  288.     register char n;
  289.     REQUEST(xConvertSelectionReq);
  290.     swaps(&stuff->length, n);
  291.     REQUEST_SIZE_MATCH(xConvertSelectionReq);
  292.     swapl(&stuff->requestor, n);
  293.     swapl(&stuff->selection, n);
  294.     swapl(&stuff->target, n);
  295.     swapl(&stuff->property, n);
  296.     swapl(&stuff->time, n);
  297.     return((* ProcVector[X_ConvertSelection])(client));
  298. }
  299.  
  300. int
  301. SProcSendEvent(client)
  302.     register ClientPtr client;
  303. {
  304.     register char n;
  305.     xEvent eventT;
  306.     void (*proc)(), NotImplemented();
  307.     REQUEST(xSendEventReq);
  308.     swaps(&stuff->length, n);
  309.     REQUEST_SIZE_MATCH(xSendEventReq);
  310.     swapl(&stuff->destination, n);
  311.     swapl(&stuff->eventMask, n);
  312.  
  313.     /* Swap event */
  314.     proc = EventSwapVector[stuff->event.u.u.type & 0177];
  315.     if (!proc || (int (*)()) proc == (int (*)()) NotImplemented)    /* no swapping proc; invalid event type? */
  316.        return (BadValue);
  317.     (*proc)(&stuff->event, &eventT);
  318.     stuff->event = eventT;
  319.  
  320.     return((* ProcVector[X_SendEvent])(client));
  321. }
  322.  
  323. int
  324. SProcGrabPointer(client)
  325.     register ClientPtr client;
  326. {
  327.     register char n;
  328.     REQUEST(xGrabPointerReq);
  329.     swaps(&stuff->length, n);
  330.     REQUEST_SIZE_MATCH(xGrabPointerReq);
  331.     swapl(&stuff->grabWindow, n);
  332.     swaps(&stuff->eventMask, n);
  333.     swapl(&stuff->confineTo, n);
  334.     swapl(&stuff->cursor, n);
  335.     swapl(&stuff->time, n);
  336.     return((* ProcVector[X_GrabPointer])(client));
  337. }
  338.  
  339. int
  340. SProcGrabButton(client)
  341.     register ClientPtr client;
  342. {
  343.     register char n;
  344.     REQUEST(xGrabButtonReq);
  345.     swaps(&stuff->length, n);
  346.     REQUEST_SIZE_MATCH(xGrabButtonReq);
  347.     swapl(&stuff->grabWindow, n);
  348.     swaps(&stuff->eventMask, n);
  349.     swapl(&stuff->confineTo, n);
  350.     swapl(&stuff->cursor, n);
  351.     swaps(&stuff->modifiers, n);
  352.     return((* ProcVector[X_GrabButton])(client));
  353. }
  354.  
  355. int
  356. SProcUngrabButton(client)
  357.     register ClientPtr client;
  358. {
  359.     register char n;
  360.     REQUEST(xUngrabButtonReq);
  361.     swaps(&stuff->length, n);
  362.     REQUEST_SIZE_MATCH(xUngrabButtonReq);
  363.     swapl(&stuff->grabWindow, n);
  364.     swaps(&stuff->modifiers, n);
  365.     return((* ProcVector[X_UngrabButton])(client));
  366. }
  367.  
  368. int
  369. SProcChangeActivePointerGrab(client)
  370.     register ClientPtr client;
  371. {
  372.     register char n;
  373.     REQUEST(xChangeActivePointerGrabReq);
  374.     swaps(&stuff->length, n);
  375.     REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
  376.     swapl(&stuff->cursor, n);
  377.     swapl(&stuff->time, n);
  378.     swaps(&stuff->eventMask, n);
  379.     return((* ProcVector[X_ChangeActivePointerGrab])(client));
  380. }
  381.  
  382. int
  383. SProcGrabKeyboard(client)
  384.     register ClientPtr client;
  385. {
  386.     register char n;
  387.     REQUEST(xGrabKeyboardReq);
  388.     swaps(&stuff->length, n);
  389.     REQUEST_SIZE_MATCH(xGrabKeyboardReq);
  390.     swapl(&stuff->grabWindow, n);
  391.     swapl(&stuff->time, n);
  392.     return((* ProcVector[X_GrabKeyboard])(client));
  393. }
  394.  
  395. int
  396. SProcGrabKey(client)
  397.     register ClientPtr client;
  398. {
  399.     register char n;
  400.     REQUEST(xGrabKeyReq);
  401.     swaps(&stuff->length, n);
  402.     REQUEST_SIZE_MATCH(xGrabKeyReq);
  403.     swapl(&stuff->grabWindow, n);
  404.     swaps(&stuff->modifiers, n);
  405.     return((* ProcVector[X_GrabKey])(client));
  406. }
  407.  
  408. int
  409. SProcUngrabKey(client)
  410.     register ClientPtr client;
  411. {
  412.     register char n;
  413.     REQUEST(xUngrabKeyReq);
  414.     swaps(&stuff->length, n);
  415.     REQUEST_SIZE_MATCH(xUngrabKeyReq);
  416.     swapl(&stuff->grabWindow, n);
  417.     swaps(&stuff->modifiers, n);
  418.     return((* ProcVector[X_UngrabKey])(client));
  419. }
  420.  
  421. int
  422. SProcGetMotionEvents(client)
  423.     register ClientPtr client;
  424. {
  425.     register char n;
  426.     REQUEST(xGetMotionEventsReq);
  427.     swaps(&stuff->length, n);
  428.     REQUEST_SIZE_MATCH(xGetMotionEventsReq);
  429.     swapl(&stuff->window, n);
  430.     swapl(&stuff->start, n);
  431.     swapl(&stuff->stop, n);
  432.     return((* ProcVector[X_GetMotionEvents])(client));
  433. }
  434.  
  435. int
  436. SProcTranslateCoords(client)
  437.     register ClientPtr client;
  438. {
  439.     register char n;
  440.     REQUEST(xTranslateCoordsReq);
  441.     swaps(&stuff->length, n);
  442.     REQUEST_SIZE_MATCH(xTranslateCoordsReq);
  443.     swapl(&stuff->srcWid, n);
  444.     swapl(&stuff->dstWid, n);
  445.     swaps(&stuff->srcX, n);
  446.     swaps(&stuff->srcY, n);
  447.     return((* ProcVector[X_TranslateCoords])(client));
  448. }
  449.  
  450. int
  451. SProcWarpPointer(client)
  452.     register ClientPtr client;
  453. {
  454.     register char n;
  455.     REQUEST(xWarpPointerReq);
  456.     swaps(&stuff->length, n);
  457.     REQUEST_SIZE_MATCH(xWarpPointerReq);
  458.     swapl(&stuff->srcWid, n);
  459.     swapl(&stuff->dstWid, n);
  460.     swaps(&stuff->srcX, n);
  461.     swaps(&stuff->srcY, n);
  462.     swaps(&stuff->srcWidth, n);
  463.     swaps(&stuff->srcHeight, n);
  464.     swaps(&stuff->dstX, n);
  465.     swaps(&stuff->dstY, n);
  466.     return((* ProcVector[X_WarpPointer])(client));
  467. }
  468.  
  469. int
  470. SProcSetInputFocus(client)
  471.     register ClientPtr client;
  472. {
  473.     register char n;
  474.     REQUEST(xSetInputFocusReq);
  475.     swaps(&stuff->length, n);
  476.     REQUEST_SIZE_MATCH(xSetInputFocusReq);
  477.     swapl(&stuff->focus, n);
  478.     swapl(&stuff->time, n);
  479.     return((* ProcVector[X_SetInputFocus])(client));
  480. }
  481.  
  482.  
  483. SProcOpenFont(client)
  484.     register ClientPtr client;
  485. {
  486.     register char n;
  487.     REQUEST(xOpenFontReq);
  488.     swaps(&stuff->length, n);
  489.     REQUEST_AT_LEAST_SIZE(xOpenFontReq);
  490.     swapl(&stuff->fid, n);
  491.     swaps(&stuff->nbytes, n);
  492.     return((* ProcVector[X_OpenFont])(client));
  493. }
  494.  
  495. int
  496. SProcListFonts(client)
  497.     register ClientPtr client;
  498. {
  499.     register char n;
  500.     REQUEST(xListFontsReq);
  501.     swaps(&stuff->length, n);
  502.     REQUEST_AT_LEAST_SIZE(xListFontsReq);
  503.     swaps(&stuff->maxNames, n);
  504.     swaps(&stuff->nbytes, n);
  505.     return((* ProcVector[X_ListFonts])(client));
  506. }
  507.  
  508. int
  509. SProcListFontsWithInfo(client)
  510.     register ClientPtr client;
  511. {
  512.     register char n;
  513.     REQUEST(xListFontsWithInfoReq);
  514.     swaps(&stuff->length, n);
  515.     REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);
  516.     swaps(&stuff->maxNames, n);
  517.     swaps(&stuff->nbytes, n);
  518.     return((* ProcVector[X_ListFontsWithInfo])(client));
  519. }
  520.  
  521. int
  522. SProcSetFontPath(client)
  523.     register ClientPtr client;
  524. {
  525.     register char n;
  526.     REQUEST(xSetFontPathReq);
  527.     swaps(&stuff->length, n);
  528.     REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
  529.     swaps(&stuff->nFonts, n);
  530.     return((* ProcVector[X_SetFontPath])(client));
  531. }
  532.  
  533. int
  534. SProcCreatePixmap(client)
  535.     register ClientPtr client;
  536. {
  537.     register char n;
  538.     REQUEST(xCreatePixmapReq);
  539.  
  540.     swaps(&stuff->length, n);
  541.     REQUEST_SIZE_MATCH(xCreatePixmapReq);
  542.     swapl(&stuff->pid, n);
  543.     swapl(&stuff->drawable, n);
  544.     swaps(&stuff->width, n);
  545.     swaps(&stuff->height, n);
  546.     return((* ProcVector[X_CreatePixmap])(client));
  547. }
  548.  
  549. int
  550. SProcCreateGC(client)
  551.     register ClientPtr client;
  552. {
  553.     register char n;
  554.     REQUEST(xCreateGCReq);
  555.     swaps(&stuff->length, n);
  556.     REQUEST_AT_LEAST_SIZE(xCreateGCReq);
  557.     swapl(&stuff->gc, n);
  558.     swapl(&stuff->drawable, n);
  559.     swapl(&stuff->mask, n);
  560.     SwapRestL(stuff);
  561.     return((* ProcVector[X_CreateGC])(client));
  562. }
  563.  
  564. int
  565. SProcChangeGC(client)
  566.     register ClientPtr client;
  567. {
  568.     register char n;
  569.     REQUEST(xChangeGCReq);
  570.     swaps(&stuff->length, n);
  571.     REQUEST_AT_LEAST_SIZE(xChangeGCReq);
  572.     swapl(&stuff->gc, n);
  573.     swapl(&stuff->mask, n);
  574.     SwapRestL(stuff);
  575.     return((* ProcVector[X_ChangeGC])(client));
  576. }
  577.  
  578. int
  579. SProcCopyGC(client)
  580.     register ClientPtr client;
  581. {
  582.     register char n;
  583.     REQUEST(xCopyGCReq);
  584.     swaps(&stuff->length, n);
  585.     REQUEST_SIZE_MATCH(xCopyGCReq);
  586.     swapl(&stuff->srcGC, n);
  587.     swapl(&stuff->dstGC, n);
  588.     swapl(&stuff->mask, n);
  589.     return((* ProcVector[X_CopyGC])(client));
  590. }
  591.  
  592. int
  593. SProcSetDashes(client)
  594.     register ClientPtr client;
  595. {
  596.     register char n;
  597.     REQUEST(xSetDashesReq);
  598.     swaps(&stuff->length, n);
  599.     REQUEST_AT_LEAST_SIZE(xSetDashesReq);
  600.     swapl(&stuff->gc, n);
  601.     swaps(&stuff->dashOffset, n);
  602.     swaps(&stuff->nDashes, n);
  603.     return((* ProcVector[X_SetDashes])(client));
  604.  
  605. }
  606.  
  607. int
  608. SProcSetClipRectangles(client)
  609.     register ClientPtr client;
  610. {
  611.     register char n;
  612.     REQUEST(xSetClipRectanglesReq);
  613.     swaps(&stuff->length, n);
  614.     REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
  615.     swapl(&stuff->gc, n);
  616.     swaps(&stuff->xOrigin, n);
  617.     swaps(&stuff->yOrigin, n);
  618.     SwapRestS(stuff);
  619.     return((* ProcVector[X_SetClipRectangles])(client));
  620. }
  621.  
  622. int
  623. SProcClearToBackground(client)
  624.     register ClientPtr client;
  625. {
  626.     register char n;
  627.     REQUEST(xClearAreaReq);
  628.     swaps(&stuff->length, n);
  629.     REQUEST_SIZE_MATCH(xClearAreaReq);
  630.     swapl(&stuff->window, n);
  631.     swaps(&stuff->x, n);
  632.     swaps(&stuff->y, n);
  633.     swaps(&stuff->width, n);
  634.     swaps(&stuff->height, n);
  635.     return((* ProcVector[X_ClearArea])(client));
  636. }
  637.  
  638. int
  639. SProcCopyArea(client)
  640.     register ClientPtr client;
  641. {
  642.     register char n;
  643.     REQUEST(xCopyAreaReq);
  644.     swaps(&stuff->length, n);
  645.     REQUEST_SIZE_MATCH(xCopyAreaReq);
  646.     swapl(&stuff->srcDrawable, n);
  647.     swapl(&stuff->dstDrawable, n);
  648.     swapl(&stuff->gc, n);
  649.     swaps(&stuff->srcX, n);
  650.     swaps(&stuff->srcY, n);
  651.     swaps(&stuff->dstX, n);
  652.     swaps(&stuff->dstY, n);
  653.     swaps(&stuff->width, n);
  654.     swaps(&stuff->height, n);
  655.     return((* ProcVector[X_CopyArea])(client));
  656. }
  657.  
  658. int
  659. SProcCopyPlane(client)
  660.     register ClientPtr client;
  661. {
  662.     register char n;
  663.     REQUEST(xCopyPlaneReq);
  664.     swaps(&stuff->length, n);
  665.     REQUEST_SIZE_MATCH(xCopyPlaneReq);
  666.     swapl(&stuff->srcDrawable, n);
  667.     swapl(&stuff->dstDrawable, n);
  668.     swapl(&stuff->gc, n);
  669.     swaps(&stuff->srcX, n);
  670.     swaps(&stuff->srcY, n);
  671.     swaps(&stuff->dstX, n);
  672.     swaps(&stuff->dstY, n);
  673.     swaps(&stuff->width, n);
  674.     swaps(&stuff->height, n);
  675.     swapl(&stuff->bitPlane, n);
  676.     return((* ProcVector[X_CopyPlane])(client));
  677. }
  678.  
  679. /* The following routine is used for all Poly drawing requests
  680.    (except FillPoly, which uses a different request format) */
  681. int
  682. SProcPoly(client)
  683.     register ClientPtr client;
  684. {
  685.     register char n;
  686.  
  687.     REQUEST(xPolyPointReq);
  688.     swaps(&stuff->length, n);
  689.     REQUEST_AT_LEAST_SIZE(xPolyPointReq);
  690.     swapl(&stuff->drawable, n);
  691.     swapl(&stuff->gc, n);
  692.     SwapRestS(stuff);
  693.     return((* ProcVector[stuff->reqType])(client));
  694. }
  695.  
  696. /* cannot use SProcPoly for this one, because xFillPolyReq
  697.    is longer than xPolyPointReq, and we don't want to swap
  698.    the difference as shorts! */
  699. int
  700. SProcFillPoly(client)
  701.     register ClientPtr client;
  702. {
  703.     register char n;
  704.  
  705.     REQUEST(xFillPolyReq);
  706.     swaps(&stuff->length, n);
  707.     REQUEST_AT_LEAST_SIZE(xFillPolyReq);
  708.     swapl(&stuff->drawable, n);
  709.     swapl(&stuff->gc, n);
  710.     SwapRestS(stuff);
  711.     return((* ProcVector[X_FillPoly])(client));
  712. }
  713.  
  714. int
  715. SProcPutImage(client)
  716.     register ClientPtr client;
  717. {
  718.     register char n;
  719.     REQUEST(xPutImageReq);
  720.     swaps(&stuff->length, n);
  721.     REQUEST_AT_LEAST_SIZE(xPutImageReq);
  722.     swapl(&stuff->drawable, n);
  723.     swapl(&stuff->gc, n);
  724.     swaps(&stuff->width, n);
  725.     swaps(&stuff->height, n);
  726.     swaps(&stuff->dstX, n);
  727.     swaps(&stuff->dstY, n);
  728.     /* Image should already be swapped */
  729.     return((* ProcVector[X_PutImage])(client));
  730.  
  731. }
  732.  
  733. int
  734. SProcGetImage(client)
  735.     register ClientPtr    client;
  736. {
  737.     register char n;
  738.     REQUEST(xGetImageReq);
  739.     swaps(&stuff->length, n);
  740.     REQUEST_SIZE_MATCH(xGetImageReq);
  741.     swapl(&stuff->drawable, n);
  742.     swaps(&stuff->x, n);
  743.     swaps(&stuff->y, n);
  744.     swaps(&stuff->width, n);
  745.     swaps(&stuff->height, n);
  746.     swapl(&stuff->planeMask, n);
  747.     return((* ProcVector[X_GetImage])(client));
  748. }
  749.  
  750. /* ProcPolyText used for both PolyText8 and PolyText16 */
  751.  
  752. int
  753. SProcPolyText(client)
  754.     register ClientPtr client;
  755. {
  756.     register char n;
  757.     REQUEST(xPolyTextReq);
  758.     swaps(&stuff->length, n);
  759.     REQUEST_AT_LEAST_SIZE(xPolyTextReq);
  760.     swapl(&stuff->drawable, n);
  761.     swapl(&stuff->gc, n);
  762.     swaps(&stuff->x, n);
  763.     swaps(&stuff->y, n);
  764.     return((* ProcVector[stuff->reqType])(client));
  765. }
  766.  
  767. /* ProcImageText used for both ImageText8 and ImageText16 */
  768.  
  769. int
  770. SProcImageText(client)
  771.     register ClientPtr client;
  772. {
  773.     register char n;
  774.     REQUEST(xImageTextReq);
  775.     swaps(&stuff->length, n);
  776.     REQUEST_AT_LEAST_SIZE(xImageTextReq);
  777.     swapl(&stuff->drawable, n);
  778.     swapl(&stuff->gc, n);
  779.     swaps(&stuff->x, n);
  780.     swaps(&stuff->y, n);
  781.     return((* ProcVector[stuff->reqType])(client));
  782. }
  783.  
  784. int
  785. SProcCreateColormap(client)
  786.     register ClientPtr client;
  787. {
  788.     register char n;
  789.     REQUEST(xCreateColormapReq);
  790.     swaps(&stuff->length, n);
  791.     REQUEST_SIZE_MATCH(xCreateColormapReq);
  792.     swapl(&stuff->mid, n);
  793.     swapl(&stuff->window, n);
  794.     swapl(&stuff->visual, n);
  795.     return((* ProcVector[X_CreateColormap])(client));
  796. }
  797.  
  798.  
  799. int
  800. SProcCopyColormapAndFree(client)
  801.     register ClientPtr client;
  802. {
  803.     register char n;
  804.     REQUEST(xCopyColormapAndFreeReq);
  805.     swaps(&stuff->length, n);
  806.     REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
  807.     swapl(&stuff->mid, n);
  808.     swapl(&stuff->srcCmap, n);
  809.     return((* ProcVector[X_CopyColormapAndFree])(client));
  810.  
  811. }
  812.  
  813. int
  814. SProcAllocColor                (client)
  815.     register ClientPtr client;
  816. {
  817.     register char n;
  818.     REQUEST(xAllocColorReq);
  819.     swaps(&stuff->length, n);
  820.     REQUEST_SIZE_MATCH(xAllocColorReq);
  821.     swapl(&stuff->cmap, n);
  822.     swaps(&stuff->red, n);
  823.     swaps(&stuff->green, n);
  824.     swaps(&stuff->blue, n);
  825.     return((* ProcVector[X_AllocColor])(client));
  826. }
  827.  
  828. int
  829. SProcAllocNamedColor           (client)
  830.     register ClientPtr client;
  831. {
  832.     register char n;
  833.  
  834.     REQUEST(xAllocNamedColorReq);
  835.     swaps(&stuff->length, n);
  836.     REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq);
  837.     swapl(&stuff->cmap, n);
  838.     swaps(&stuff->nbytes, n);
  839.     return((* ProcVector[X_AllocNamedColor])(client));
  840. }
  841.  
  842. int
  843. SProcAllocColorCells           (client)
  844.     register ClientPtr client;
  845. {
  846.     register char n;
  847.     REQUEST(xAllocColorCellsReq);
  848.     swaps(&stuff->length, n);
  849.     REQUEST_SIZE_MATCH(xAllocColorCellsReq);
  850.     swapl(&stuff->cmap, n);
  851.     swaps(&stuff->colors, n);
  852.     swaps(&stuff->planes, n);
  853.     return((* ProcVector[X_AllocColorCells])(client));
  854. }
  855.  
  856. int
  857. SProcAllocColorPlanes(client)
  858.     register ClientPtr client;
  859. {
  860.     register char n;
  861.     REQUEST(xAllocColorPlanesReq);
  862.     swaps(&stuff->length, n);
  863.     REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
  864.     swapl(&stuff->cmap, n);
  865.     swaps(&stuff->colors, n);
  866.     swaps(&stuff->red, n);
  867.     swaps(&stuff->green, n);
  868.     swaps(&stuff->blue, n);
  869.     return((* ProcVector[X_AllocColorPlanes])(client));
  870. }
  871.  
  872. int
  873. SProcFreeColors          (client)
  874.     register ClientPtr client;
  875. {
  876.     register char n;
  877.     REQUEST(xFreeColorsReq);
  878.     swaps(&stuff->length, n);
  879.     REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
  880.     swapl(&stuff->cmap, n);
  881.     swapl(&stuff->planeMask, n);
  882.     SwapRestL(stuff);
  883.     return((* ProcVector[X_FreeColors])(client));
  884.  
  885. }
  886.  
  887. int
  888. SProcStoreColors               (client)
  889.     register ClientPtr client;
  890. {
  891.     register char n;
  892.     long count;
  893.     xColorItem     *pItem;
  894.  
  895.     REQUEST(xStoreColorsReq);
  896.     swaps(&stuff->length, n);
  897.     REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
  898.     swapl(&stuff->cmap, n);
  899.     pItem = (xColorItem *) &stuff[1];
  900.     for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
  901.     SwapColorItem(pItem++);
  902.     return((* ProcVector[X_StoreColors])(client));
  903. }
  904.  
  905. int
  906. SProcStoreNamedColor           (client)
  907.     register ClientPtr client;
  908. {
  909.     register char n;
  910.     REQUEST(xStoreNamedColorReq);
  911.     swaps(&stuff->length, n);
  912.     REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq);
  913.     swapl(&stuff->cmap, n);
  914.     swapl(&stuff->pixel, n);
  915.     swaps(&stuff->nbytes, n);
  916.     return((* ProcVector[X_StoreNamedColor])(client));
  917. }
  918.  
  919. int
  920. SProcQueryColors(client)
  921.     register ClientPtr client;
  922. {
  923.     register char n;
  924.     REQUEST(xQueryColorsReq);
  925.     swaps(&stuff->length, n);
  926.     REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
  927.     swapl(&stuff->cmap, n);
  928.     SwapRestL(stuff);
  929.     return((* ProcVector[X_QueryColors])(client));
  930.  
  931. int
  932. SProcLookupColor(client)
  933.     register ClientPtr client;
  934. {
  935.     register char n;
  936.     REQUEST(xLookupColorReq);
  937.     swaps(&stuff->length, n);
  938.     REQUEST_AT_LEAST_SIZE(xLookupColorReq);
  939.     swapl(&stuff->cmap, n);
  940.     swaps(&stuff->nbytes, n);
  941.     return((* ProcVector[X_LookupColor])(client));
  942. }
  943.  
  944. int
  945. SProcCreateCursor( client)
  946.     register ClientPtr client;
  947. {
  948.     register char n;
  949.     REQUEST(xCreateCursorReq);
  950.     swaps(&stuff->length, n);
  951.     REQUEST_SIZE_MATCH(xCreateCursorReq);
  952.     swapl(&stuff->cid, n);
  953.     swapl(&stuff->source, n);
  954.     swapl(&stuff->mask, n);
  955.     swaps(&stuff->foreRed, n);
  956.     swaps(&stuff->foreGreen, n);
  957.     swaps(&stuff->foreBlue, n);
  958.     swaps(&stuff->backRed, n);
  959.     swaps(&stuff->backGreen, n);
  960.     swaps(&stuff->backBlue, n);
  961.     swaps(&stuff->x, n);
  962.     swaps(&stuff->y, n);
  963.     return((* ProcVector[X_CreateCursor])(client));
  964. }
  965.  
  966. int
  967. SProcCreateGlyphCursor( client)
  968.     register ClientPtr client;
  969. {
  970.     register char n;
  971.     REQUEST(xCreateGlyphCursorReq);
  972.     swaps(&stuff->length, n);
  973.     REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
  974.     swapl(&stuff->cid, n);
  975.     swapl(&stuff->source, n);
  976.     swapl(&stuff->mask, n);
  977.     swaps(&stuff->sourceChar, n);
  978.     swaps(&stuff->maskChar, n);
  979.     swaps(&stuff->foreRed, n);
  980.     swaps(&stuff->foreGreen, n);
  981.     swaps(&stuff->foreBlue, n);
  982.     swaps(&stuff->backRed, n);
  983.     swaps(&stuff->backGreen, n);
  984.     swaps(&stuff->backBlue, n);
  985.     return((* ProcVector[X_CreateGlyphCursor])(client));
  986. }
  987.  
  988.  
  989. int
  990. SProcRecolorCursor(client)
  991.     register ClientPtr client;
  992. {
  993.     register char n;
  994.     REQUEST(xRecolorCursorReq);
  995.     swaps(&stuff->length, n);
  996.     REQUEST_SIZE_MATCH(xRecolorCursorReq);
  997.     swapl(&stuff->cursor, n);
  998.     swaps(&stuff->foreRed, n);
  999.     swaps(&stuff->foreGreen, n);
  1000.     swaps(&stuff->foreBlue, n);
  1001.     swaps(&stuff->backRed, n);
  1002.     swaps(&stuff->backGreen, n);
  1003.     swaps(&stuff->backBlue, n);
  1004.     return((* ProcVector[X_RecolorCursor])(client));
  1005. }
  1006.  
  1007. int
  1008. SProcQueryBestSize   (client)
  1009.     register ClientPtr client;
  1010. {
  1011.     register char n;
  1012.     REQUEST(xQueryBestSizeReq);
  1013.     swaps(&stuff->length, n);
  1014.     REQUEST_SIZE_MATCH(xQueryBestSizeReq);
  1015.     swapl(&stuff->drawable, n);
  1016.     swaps(&stuff->width, n);
  1017.     swaps(&stuff->height, n);
  1018.     return((* ProcVector[X_QueryBestSize])(client));
  1019.  
  1020. }
  1021.  
  1022. int
  1023. SProcQueryExtension   (client)
  1024.     register ClientPtr client;
  1025. {
  1026.     register char n;
  1027.     REQUEST(xQueryExtensionReq);
  1028.     swaps(&stuff->length, n);
  1029.     REQUEST_AT_LEAST_SIZE(xQueryExtensionReq);
  1030.     swaps(&stuff->nbytes, n);
  1031.     return((* ProcVector[X_QueryExtension])(client));
  1032. }
  1033.  
  1034. int
  1035. SProcChangeKeyboardMapping   (client)
  1036.     register ClientPtr client;
  1037. {
  1038.     register char n;
  1039.     REQUEST(xChangeKeyboardMappingReq);
  1040.     swaps(&stuff->length, n);
  1041.     REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
  1042.     SwapRestL(stuff);
  1043.     return((* ProcVector[X_ChangeKeyboardMapping])(client));
  1044. }
  1045.  
  1046.  
  1047. int
  1048. SProcChangeKeyboardControl   (client)
  1049.     register ClientPtr client;
  1050. {
  1051.     register char n;
  1052.     REQUEST(xChangeKeyboardControlReq);
  1053.     swaps(&stuff->length, n);
  1054.     REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
  1055.     swapl(&stuff->mask, n);
  1056.     SwapRestL(stuff);
  1057.     return((* ProcVector[X_ChangeKeyboardControl])(client));
  1058. }
  1059.  
  1060. int
  1061. SProcChangePointerControl   (client)
  1062.     register ClientPtr client;
  1063. {
  1064.     register char n;
  1065.     REQUEST(xChangePointerControlReq);
  1066.     swaps(&stuff->length, n);
  1067.     REQUEST_SIZE_MATCH(xChangePointerControlReq);
  1068.     swaps(&stuff->accelNum, n);
  1069.     swaps(&stuff->accelDenum, n);
  1070.     swaps(&stuff->threshold, n);
  1071.     return((* ProcVector[X_ChangePointerControl])(client));
  1072. }
  1073.  
  1074.  
  1075. int
  1076. SProcSetScreenSaver            (client)
  1077.     register ClientPtr client;
  1078. {
  1079.     register char n;
  1080.     REQUEST(xSetScreenSaverReq);
  1081.     swaps(&stuff->length, n);
  1082.     REQUEST_SIZE_MATCH(xSetScreenSaverReq);
  1083.     swaps(&stuff->timeout, n);
  1084.     swaps(&stuff->interval, n);
  1085.     return((* ProcVector[X_SetScreenSaver])(client));
  1086. }
  1087.  
  1088. int
  1089. SProcChangeHosts(client)
  1090.     register ClientPtr client;
  1091. {
  1092.     register char n;
  1093.  
  1094.     REQUEST(xChangeHostsReq);
  1095.     swaps(&stuff->length, n);
  1096.     REQUEST_AT_LEAST_SIZE(xChangeHostsReq);
  1097.     swaps(&stuff->hostLength, n);
  1098.     return((* ProcVector[X_ChangeHosts])(client));
  1099.  
  1100. }
  1101.  
  1102. int SProcRotateProperties(client)
  1103.     register ClientPtr client;
  1104. {
  1105.     register char n;
  1106.     REQUEST(xRotatePropertiesReq);
  1107.     swaps(&stuff->length, n);
  1108.     REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq);
  1109.     swapl(&stuff->window, n);
  1110.     swaps(&stuff->nAtoms, n);
  1111.     swaps(&stuff->nPositions, n);
  1112.     SwapRestL(stuff);
  1113.     return ((* ProcVector[X_RotateProperties])(client));
  1114. }
  1115.  
  1116. /*ARGSUSED*/
  1117. int
  1118. SProcNoOperation(client)
  1119.     ClientPtr client;
  1120. {
  1121.     /* noop -- don't do anything */
  1122.     return(Success);
  1123. }
  1124.  
  1125. SwapTimecoord(pCoord)
  1126.     xTimecoord *pCoord;
  1127. {
  1128.     register char n;
  1129.  
  1130.     swapl(&pCoord->time, n);
  1131.     swaps(&pCoord->x, n);
  1132.     swaps(&pCoord->y, n);
  1133. }
  1134.  
  1135.  
  1136. SwapRGB(prgb)
  1137.     xrgb    *prgb;
  1138. {
  1139.     register char n;
  1140.  
  1141.     swaps(&prgb->red, n);
  1142.     swaps(&prgb->green, n);
  1143.     swaps(&prgb->blue, n);
  1144. }
  1145.  
  1146. SwapColorItem(pItem)
  1147.     xColorItem    *pItem;
  1148. {
  1149.     register char n;
  1150.  
  1151.     swapl(&pItem->pixel, n);
  1152.     swaps(&pItem->red, n);
  1153.     swaps(&pItem->green, n);
  1154.     swaps(&pItem->blue, n);
  1155. }
  1156.  
  1157. SwapConnClientPrefix(pCCP)
  1158.     xConnClientPrefix    *pCCP;
  1159. {
  1160.     register char n;
  1161.  
  1162.     swaps(&pCCP->majorVersion, n);
  1163.     swaps(&pCCP->minorVersion, n);
  1164.     swaps(&pCCP->nbytesAuthProto, n);
  1165.     swaps(&pCCP->nbytesAuthString, n);
  1166. }
  1167.