Annotation of 43BSDTahoe/new/X/Xlib/XQueryColors.c, revision 1.1

1.1     ! root        1: #include <X/mit-copyright.h>
        !             2: 
        !             3: /* $Header: XQueryColors.c,v 10.5 86/04/22 15:23:30 jg 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->paramu0 = (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.paramu0;
        !            36:                color->green = rep.paramu1;
        !            37:                (color++)->blue = rep.paramu2;
        !            38:                }
        !            39:            
        !            40:            ncolors -= nreqs;
        !            41:            }
        !            42: }
        !            43: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.