long pend_not_register;
BytesReadable_t pend_not_register;
void N_XWaitForWritable(Display *dpy){    unsigned long r_mask[MSKCNT];    unsigned long w_mask[MSKCNT];    int nfound;    CLEARBITS(r_mask);    CLEARBITS(w_mask);    while (1) {	BITSET(r_mask, dpy->fd);        BITSET(w_mask, dpy->fd);	do {	    nfound = select (dpy->fd + 1, (SELECT_TYPE) r_mask,			     (SELECT_TYPE) w_mask, (SELECT_TYPE) NULL,			     (struct timeval *) NULL);	    if (nfound < 0 && errno != EINTR)		_XIOError(dpy);	} while (nfound <= 0);	if (_XANYSET(r_mask)) {	    char buf[BUFSIZE];	    long pend_not_register;	    register long pend;	    register xEvent *ev;	    /* find out how much data can be read */	    if (BytesReadable(dpy->fd, (char *) &pend_not_register) < 0)		_XIOError(dpy);	    pend = pend_not_register;	    /* must read at least one xEvent; if none is pending, then	       we'll just block waiting for it */	    if (pend < SIZEOF(xEvent)) pend = SIZEOF(xEvent);			    /* but we won't read more than the max buffer size */	    if (pend > BUFSIZE) pend = BUFSIZE;	    /* round down to an integral number of XReps */	    pend = (pend / SIZEOF(xEvent)) * SIZEOF(xEvent);	    N_XRead (dpy, buf, pend);	    /* no space between comma and type or else macro will die */	    STARTITERATE (ev,xEvent, buf, (pend > 0),			  (pend -= SIZEOF(xEvent))) {		if (ev->u.u.type == X_Error)		    _XError (dpy, (xError *) ev);		else		/* it's an event packet; die */		    DPSFatalProc((DPSContext)0, "N_XWaitForWritable read bogus X event");	    }	    ENDITERATE	}	if (_XANYSET(w_mask))	    return;    }}