Annotation of 43BSD/contrib/X/Xlib/XlibInternal.h, revision 1.1.1.1

1.1       root        1: #include <X/mit-copyright.h>
                      2: 
                      3: /* $Header: XlibInternal.h,v 10.8 86/02/01 15:42:21 tony Rel $ */
                      4: /* Copyright 1984, 1985  Massachusetts Institute of Technology */
                      5: 
                      6: /*
                      7:  *     XlibInternal.h - Header definition and support file for the internal
                      8:  *     support routines (XlibInternal) used by the C subroutine interface
                      9:  *     library (Xlib) to the X Window System.
                     10:  *
                     11:  */
                     12: 
                     13: #include <sys/types.h>
                     14: #include "Xlib.h"
                     15: #include "../X/Xproto.h"
                     16: #include <stdio.h>
                     17: #include <netinet/in.h>
                     18: #include <sys/ioctl.h>
                     19: #include <netdb.h>
                     20: #include <errno.h>
                     21: 
                     22: extern int errno;                      /* Internal system error number. */
                     23: extern char *malloc();                 /* commonly used in the library. */
                     24: extern char *realloc();                        /* used with some frequency.     */
                     25: 
                     26: extern Display *_XlibCurrentDisplay;   /* Currently active Display. */
                     27: 
                     28: extern (*_XIOErrorFunction)();         /* X system error reporting routine. */
                     29: extern (*_XErrorFunction)();           /* X_Error event reporting routine. */
                     30: 
                     31: /*
                     32:  * Boolean datatype.
                     33:  */
                     34: 
                     35: typedef enum _bool {FALSE, TRUE} Bool;
                     36: 
                     37: /* Pointers to the above routines. */
                     38: #define _XIOError (*_XIOErrorFunction)
                     39: #define _XError (*_XErrorFunction)
                     40: 
                     41: #define BUFSIZE 2048                   /* X output buffer size. */
                     42: 
                     43: 
                     44: /*
                     45:  * X Protocol packetizing macros.
                     46:  */
                     47: 
                     48: 
                     49: /*
                     50:  * GetReq - Get the next avilable X request packet in the buffer and
                     51:  * return it. 
                     52:  *
                     53:  * "cd" is the X protocol code.
                     54:  * "id" is the window id of the requesting window.
                     55:  */
                     56: #define GetReq(cd, id) \
                     57:        dpy = _XlibCurrentDisplay;\
                     58:        if ((dpy->bufptr + sizeof(XReq)) > dpy->bufmax)\
                     59:                _XFlush(dpy);\
                     60:        req = (XReq *)dpy->bufptr;\
                     61:        req->code = cd;\
                     62:        req->windowId = id;\
                     63:        dpy->bufptr += sizeof(XReq);\
                     64:        dpy->request++;\
                     65:        dpy->lastdraw = NULL
                     66: 
                     67: /*
                     68:  * Data - Place data in the buffer and pad the end to provide
                     69:  * 32 bit word alignment.  Transmit if the buffer fills.
                     70:  *
                     71:  * "dpy" is a pointer to a Display.
                     72:  * "data" is a pinter to a data buffer.
                     73:  * "len" is the lenght of the data buffer.
                     74:  */
                     75: #define Data(dpy, data, len) \
                     76:        if (dpy->bufptr + len < dpy->bufmax) {\
                     77:                bcopy(data, dpy->bufptr, len);\
                     78:                dpy->bufptr += (len + 3) & ~3;\
                     79:        } else\
                     80:                _XSend(dpy, data, len)
                     81: 
                     82: 

unix.superglobalmegacorp.com

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