1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XQueryColors.c,v 10.4 86/02/01 15:38:50 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: #define MAXREQS 80  /* to prevent deadlock due to full TCP buffers */
   8: 
   9: XQueryColors (colors, ncolors)
  10:         Color colors[];
  11:     int ncolors;
  12: {
  13:     register Display *dpy;
  14:     register XReq *req;
  15:     register int i;
  16:     register Color *color = colors;
  17:     XRep rep;
  18: 
  19:     while (ncolors > 0) {
  20:         register int nreqs = (ncolors > MAXREQS) ? MAXREQS : ncolors;
  21:         for (i=0;i<nreqs;i++) {
  22:             GetReq (X_QueryColor, 0);
  23:             req->param.u[0] = (color++)->pixel;
  24:             }
  25: 
  26:         /* Reset request number, so error packets are handled correctly */
  27:         dpy->request -= nreqs;
  28:         color -= nreqs;
  29: 
  30:         for (i=0;i<nreqs;i++) {
  31:             /* Increment request number, so error packets are handled
  32: 	    	    correctly */
  33:             dpy->request++;
  34:             _XReply (dpy, &rep);
  35:             color->red = rep.param.u[0];
  36:             color->green = rep.param.u[1];
  37:             (color++)->blue = rep.param.u[2];
  38:             }
  39: 
  40:         ncolors -= nreqs;
  41:         }
  42: }

Defined functions

XQueryColors defined in line 9; never used

Defined macros

MAXREQS defined in line 7; used 2 times
  • in line 20(2)
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 750
Valid CSS Valid XHTML 1.0 Strict