1: #include <X/mit-copyright.h>
   2: 
   3: /* Copyright    Massachusetts Institute of Technology    1985	*/
   4: /* $Header: Xint.h,v 10.8 86/02/01 15:15:27 tony Rel $ */
   5: 
   6: /* Internal definitions for X server */
   7: 
   8: #include <sys/param.h>
   9: #include <stdio.h>
  10: #include "X.h"
  11: #include "Xproto.h"
  12: #include "vsinput.h"
  13: #include "Xdev.h"
  14: 
  15: #define funclim 16          /* max GXfunction + 1 */
  16: 
  17: #define maxsocks (NOFILE - 1)       /* maximum open sockets */
  18: #define mskcnt ((maxsocks + 31) / 32)   /* size of bit array */
  19: 
  20: #if (mskcnt==1)
  21: #define copybits(src, dst) dst[0] = src[0]
  22: #define clearbits(buf) buf[0] = 0
  23: #endif
  24: #if (mskcnt==2)
  25: #define copybits(src, dst) dst[0] = src[0]; dst[1] = src[1]
  26: #define clearbits(buf) buf[0] = 0; buf[1] = 0
  27: #endif
  28: #if (mskcnt==3)
  29: #define copybits(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];
  30: #define clearbits(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0
  31: #endif
  32: #if (mskcnt>3)
  33: #define copybits(src, dst) bcopy((caddr_t) src, (caddr_t) dst, sizeof (src))
  34: #define clearbits(buf) bzero((caddr_t) buf, sizeof (buf))
  35: #endif
  36: 
  37: #if (mskcnt==1)
  38: #define bitmask(i) (1 << (i))
  39: #define maskidx(i) 0
  40: #endif
  41: #if (mskcnt>1)
  42: #define bitmask(i) (1 << ((i) & 31))
  43: #define maskidx(i) ((i) >> 5)
  44: #endif
  45: 
  46: #define maskword(buf, i) buf[maskidx(i)]
  47: #define bitset(buf, i) maskword(buf, i) |= bitmask(i)
  48: #define bitclear(buf, i) maskword(buf, i) &= ~bitmask(i)
  49: #define getbit(buf, i) (maskword(buf, i) & bitmask(i))
  50: 
  51: #if (mskcnt==1)
  52: #define singlebit(buf, i) maskword(buf, i) = bitmask(i)
  53: #endif
  54: #if (mskcnt>1)
  55: #define singlebit(buf, i) clearbits(buf); bitset(buf, i)
  56: #endif
  57: 
  58: typedef struct _resource {
  59:     struct _resource *next, *prev;      /* chain pointers */
  60:     caddr_t value;              /* the object */
  61:     char type;              /* RT_* */
  62:     long id;                /* resource id */
  63: } RESOURCE;
  64: 
  65: #define RT_FREE     0
  66: #define RT_WINDOW   1
  67: #define RT_FONT     2
  68: #define RT_BITMAP   3
  69: #define RT_PIXMAP   4
  70: #define RT_CURSOR   5
  71: 
  72: #define RESIDX(id) ((id) & 0xffff)      /* index in low 16 bits */
  73: 
  74: /* Now define the rectangle types and the rectangle itself */
  75: 
  76: #define contents_rec 0
  77: #define new_rec 1
  78: #define border_rec 2
  79: 
  80: /* The first 4 components must match RASTER */
  81: 
  82: typedef struct rec {
  83:     short bottom;       /* not inclusive */
  84:     short right;        /* not inclusive */
  85:     short left;
  86:     short top;
  87:     short type;     /* one of *_rec types above */
  88:     short internal;     /* 1: not head of malloc() area */
  89:     struct rec *next;   /* chain pointer */
  90: } RECTANGLE;
  91: 
  92: typedef struct {        /* components must match REGION */
  93:     short bottom;       /* not inclusive */
  94:     short right;        /* not inclusive */
  95:     short left;
  96:     short top;
  97: } RASTER;
  98: 
  99: typedef struct {        /* component order dictated by protocol */
 100:     short height;
 101:     short width;
 102:     short left;
 103:     short top;
 104: } REGION;
 105: 
 106: /* A window */
 107: /*  If mapped is true, coords are absolute (i.e. relative only to the root
 108:  *  window).  Otherwise, they are relative to the parent window's origin.
 109:  */
 110: 
 111: typedef struct wnode {
 112:     RASTER full;        /* Inside dimensions not clipped by parent */
 113:     RASTER vs;      /* Inside dimensions clipped by parent */
 114:     RASTER ovs;     /* Outside dimensions clipped by parent */
 115:     CLIP clip;      /* vs as clipping rectangle */
 116:     struct wnode *parent;   /* Who contains this window */
 117:     struct wnode *next_sib; /* Other windows it contains */
 118:     struct wnode *prev_sib; /* (linked two ways) */
 119:     struct wnode *first_child;  /* Bottom-most window this contains */
 120:     struct wnode *last_child;   /* Top-most window it contains */
 121:     RECTANGLE *visible; /* List of visible rectangles */
 122:     RECTANGLE *cmvisible;   /* List of visible rectangles when clipmode */
 123:     ushort level;       /* The level in the window hierarchy */
 124:                 /*	child.level = parent.level + 1 */
 125:     char unobscured;    /* 0: obscured, 1: unobscured (3 temp), OB_* */
 126:     char kind;      /* 0: transparent, 1: opaque, 2: icon */
 127:     char clipmode;      /* 0: clipped, 1: draw-thru */
 128:     char tilemode;      /* 0: absolute, 1: relative */
 129:     char mapped;        /* 0: unmapped, 1: mapped */
 130:     char should_be_mapped;  /* 0: unmapped, 1: should be mapped */
 131:     CURSOR *cursor;     /* The cursor information */
 132:     PIXMAP *tile;       /* The background tile */
 133:     PIXMAP *border;     /* The border tile */
 134:     short bwidth;       /* The border width */
 135:     char bgrabs;        /* Button grab count */
 136:     char internal;      /* 1: not head of malloc() area */
 137:     long mask;      /* The input event mask */
 138:     int client;     /* Client asking for events */
 139:     long rid;       /* Resource identifier */
 140:     short width0;       /* Minimum width */
 141:     short widthinc;     /* Width increment */
 142:     short height0;      /* Minimum height */
 143:     short heightinc;    /* Height increment */
 144:     char *name;     /* Window name */
 145:     struct wnode *icon; /* Icon or normal window */
 146:     struct wnode *next; /* mapped_list chain pointers */
 147:     struct wnode *prev;
 148: } WINDOW;
 149: 
 150: #define OB_NOT 0
 151: #define OB_YES 1
 152: #define OB_TMP 3        /* not 2, for lsb test */
 153: 
 154: #define max(x,y) ((x) >= (y) ? (x) : (y))
 155: #define min(x,y) ((x) <= (y) ? (x) : (y))
 156: 
 157: /* create a new rectangle */
 158: #define NEWRECT(r,lf,rt,tp,bt,ty)   if ((r = free_rectangles) == NULL)\
 159:                         r = Alloc_rectangle ();\
 160:                     free_rectangles = r->next;\
 161:                     r->left = lf; r->right = rt;\
 162:                     r->top = tp; r->bottom = bt;\
 163:                     r->type = ty
 164: 
 165: /* create a new rectangle from a raster */
 166: #define RASTRECT(r,rs,ty)       if ((r = free_rectangles) == NULL)\
 167:                         r = Alloc_rectangle ();\
 168:                     free_rectangles = r->next;\
 169:                     *(RASTER *) r = rs;\
 170:                     r->type = ty
 171: 
 172: /* free a rectangle */
 173: #define FREERECT(r)     r->next = free_rectangles; free_rectangles = r
 174: 
 175: #define BytePad(n) (((n) + 3) & ~3)
 176: #define WordPad(n) (((n) + 3) & ~3)
 177: 
 178: /* byte swap a long literal */
 179: #define lswapl(x) ((((x) & 0xff) << 24) |\
 180:            (((x) & 0xff00) << 8) |\
 181:            (((x) & 0xff000) >> 8) |\
 182:            (((x) >> 24) & 0xff))
 183: /* byte swap a short literal */
 184: #define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
 185: /* byte swap a long */
 186: #define swapl(x) n = ((char *) (x))[0];\
 187:          ((char *) (x))[0] = ((char *) (x))[3];\
 188:          ((char *) (x))[3] = n;\
 189:          n = ((char *) (x))[1];\
 190:          ((char *) (x))[1] = ((char *) (x))[2];\
 191:          ((char *) (x))[2] = n
 192: /* byte swap a short */
 193: #define swaps(x) n = ((char *) (x))[0];\
 194:          ((char *) (x))[0] = ((char *) (x))[1];\
 195:          ((char *) (x))[1] = n
 196: /* byte swap a long parameter */
 197: #define pswapl(x, i) n = (x)->param.b[4*(i)];\
 198:              (x)->param.b[4*(i)] = (x)->param.b[4*(i)+3];\
 199:              (x)->param.b[4*(i)+3] = n;\
 200:              n = (x)->param.b[4*(i)+1];\
 201:              (x)->param.b[4*(i)+1] = (x)->param.b[4*(i)+2];\
 202:              (x)->param.b[4*(i)+2] = n
 203: /* byte swap a short parameter */
 204: #define pswaps(x, i) n = (x)->param.b[2*(i)];\
 205:              (x)->param.b[2*(i)] = (x)->param.b[2*(i)+1];\
 206:              (x)->param.b[2*(i)+1] = n
 207: 
 208: #ifdef vax
 209: #define swaptype int
 210: #else
 211: #define swaptype char
 212: #endif
 213: 
 214: #ifdef vax
 215: #define TRUE(b) ((b) & 1)
 216: #define FALSE(b) (!((b) & 1))
 217: #else
 218: #define TRUE(b) (b)
 219: #define FALSE(b) (!(b))
 220: #endif

Defined struct's

_resource defined in line 58; used 2 times
  • in line 59(2)
rec defined in line 82; used 2 times
  • in line 89(2)
wnode defined in line 111; used 16 times

Defined typedef's

RECTANGLE defined in line 90; used 61 times
RESOURCE defined in line 63; used 16 times
WINDOW defined in line 148; used 142 times

Defined macros

BytePad defined in line 175; used 14 times
NEWRECT defined in line 158; used 42 times
OB_NOT defined in line 150; used 11 times
OB_TMP defined in line 152; used 4 times
OB_YES defined in line 151; used 6 times
RASTRECT defined in line 166; used 10 times
RT_BITMAP defined in line 68; used 10 times
RT_CURSOR defined in line 70; used 5 times
RT_FONT defined in line 67; used 10 times
RT_FREE defined in line 65; used 3 times
RT_PIXMAP defined in line 69; used 11 times
WordPad defined in line 176; used 12 times
bitclear defined in line 48; used 1 times
bitmask defined in line 42; used 9 times
bitset defined in line 47; used 4 times
clearbits defined in line 34; used 3 times
copybits defined in line 33; used 6 times
funclim defined in line 15; used 12 times
getbit defined in line 49; never used
lswapl defined in line 179; used 4 times
lswaps defined in line 184; used 1 times
maskidx defined in line 43; used 5 times
maskword defined in line 46; used 5 times
max defined in line 154; used 14 times
maxsocks defined in line 17; used 13 times
min defined in line 155; used 14 times
mskcnt defined in line 18; used 17 times
pswapl defined in line 197; used 51 times
pswaps defined in line 204; used 136 times
singlebit defined in line 55; used 2 times
swapl defined in line 186; used 30 times
swaps defined in line 193; used 30 times

Usage of this include

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1777
Valid CSS Valid XHTML 1.0 Strict