|
|
1.1 ! root 1: #ifndef JERQ_H ! 2: #define JERQ_H ! 3: ! 4: #ifdef X11 ! 5: #include <X11/Xlib.h> ! 6: #include <X11/Xatom.h> ! 7: #include <X11/Xutil.h> ! 8: #ifdef BSD ! 9: #include <sys/time.h> ! 10: #endif BSD ! 11: #endif X11 ! 12: #ifdef SUNTOOLS ! 13: #include <sunwindow/window_hs.h> ! 14: #undef Rect ! 15: #endif SUNTOOLS ! 16: ! 17: #ifndef NULL ! 18: #define NULL 0 ! 19: #endif ! 20: ! 21: #define nap(x) jnap(x) ! 22: #define wait(x) jwait(x) ! 23: #define Menu JMenu ! 24: #define sleep(x) Jsleep(x) ! 25: #define alarm(x) Jalarm(x) ! 26: #define own() (P->state|MOUSE) ! 27: ! 28: typedef int Word; /* 32 bits */ ! 29: ! 30: typedef unsigned int UWord; /* 32 bits */ ! 31: ! 32: typedef struct Point { /* short and to the point */ ! 33: short x; ! 34: short y; ! 35: } Point; ! 36: ! 37: typedef struct Rectangle { ! 38: Point origin; ! 39: Point corner; ! 40: } Rectangle; ! 41: #define cor corner ! 42: #define org origin ! 43: ! 44: typedef struct Bitmap { ! 45: #ifdef X11 ! 46: Drawable dr; ! 47: #endif X11 ! 48: #ifdef SUNTOOLS ! 49: char *dr; ! 50: #endif SUNTOOLS ! 51: Rectangle rect; ! 52: int flag; ! 53: #define BI_OFFSCREEN 1 /* Offscreen if set */ ! 54: } Bitmap; ! 55: ! 56: typedef struct Menu{ ! 57: char **item; /* string array, ending with 0 */ ! 58: char *(*generator)(); /* used if item == 0 */ ! 59: short prevhit; /* private to menuhit() */ ! 60: short prevtop; /* private to menuhit() */ ! 61: } Menu; ! 62: ! 63: struct Mouse { ! 64: Point xy; ! 65: int buttons; ! 66: unsigned long time; ! 67: }; ! 68: ! 69: #define min(x,y) (((x) < (y)) ? (x) : (y)) ! 70: #define max(x,y) (((x) > (y)) ? (x) : (y)) ! 71: ! 72: #ifdef X11 ! 73: typedef Pixmap Texture; ! 74: typedef Pixmap Texture32; ! 75: #define Font XFontStruct ! 76: #define fontheight(fp) ((fp)->max_bounds.ascent + (fp)->max_bounds.descent) ! 77: #define fontwidth(fp) ((fp)->max_bounds.width) ! 78: #define fontnchars(fp) ((fp)->max_char_or_byte2+1) ! 79: #endif X11 ! 80: #ifdef SUNTOOLS ! 81: typedef short *Texture; ! 82: typedef Word *Texture32; ! 83: typedef Pixfont *Font; ! 84: #define fontheight(fp) ((*fp)->pf_defaultsize.y) ! 85: #define fontwidth(fp) ((*fp)->pf_defaultsize.x) ! 86: #define fontnchars(fp) 255 ! 87: #define Cursor JCursor ! 88: typedef struct Cursor { ! 89: short *bits; ! 90: short hotx; ! 91: short hoty; ! 92: } Cursor; ! 93: #endif SUNTOOLS ! 94: ! 95: struct JProc { ! 96: int state; ! 97: Cursor *cursor; ! 98: }; ! 99: #define RESHAPED 1 /* window has been changed */ ! 100: #define KBD 2 /* we have keyboard input */ ! 101: #define RCV 4 /* recevied from "host" proc */ ! 102: #define MOUSE 8 /* we always have the mouse */ ! 103: #define SEND 16 /* for request compatability */ ! 104: #define CPU 32 ! 105: #define ALARM 64 ! 106: ! 107: typedef int Code; ! 108: ! 109: #if defined(sparc) || defined(lint) ! 110: #define Rect(a,b,c,d) SRect(a,b,c,d) ! 111: extern Point Pt(); ! 112: extern Rectangle SRect(); ! 113: extern Rectangle Rpt(); ! 114: #else ! 115: #define Pt(x, y) ((((short)(x))<<16)|((unsigned short)(y))) ! 116: #define Rect(x1, y1, x2, y2) Pt(x1, y1), Pt(x2, y2) ! 117: #define Rpt(p1, p2) (p1), (p2) ! 118: #endif ! 119: ! 120: #define muldiv(a,b,c) ((long)((a)*((long)b)/(c))) ! 121: ! 122: /* ! 123: * Function Codes ! 124: */ ! 125: #ifdef X11 ! 126: #define F_STORE (GXcopy) /* target = source */ ! 127: #define F_OR (GXor) /* target |= source */ ! 128: #define F_CLR (GXandInverted) /* target &= ~source */ ! 129: #define F_XOR (GXxor) /* target ^= source */ ! 130: #endif X11 ! 131: #ifdef SUNTOOLS ! 132: #define F_STORE (PIX_SRC) /* target = source */ ! 133: #define F_OR (PIX_SRC | PIX_DST) /* target |= source */ ! 134: #define F_CLR (PIX_NOT(PIX_SRC)&PIX_DST) /* target &= ~source */ ! 135: #define F_XOR (PIX_SRC ^ PIX_DST) /* target ^= source */ ! 136: #endif SUNTOOLS ! 137: ! 138: #define button(i) (mouse.buttons&(8>>i)) ! 139: #define button1() (mouse.buttons&4) ! 140: #define button2() (mouse.buttons&2) ! 141: #define button3() (mouse.buttons&1) ! 142: #define button12() (mouse.buttons&6) ! 143: #define button13() (mouse.buttons&5) ! 144: #define button23() (mouse.buttons&3) ! 145: #define button123() (mouse.buttons&7) ! 146: ! 147: Rectangle getrectb(), getrect(); ! 148: #define getrect1() getrectb(4,1) ! 149: #define getrect2() getrectb(2,1) ! 150: #define getrect3() getrectb(1,1) ! 151: #define getrect12() getrectb(6,1) ! 152: #define getrect13() getrectb(5,1) ! 153: #define getrect23() getrectb(3,1) ! 154: #define getrect123() getrectb(7,1) ! 155: ! 156: extern Point add(), sub(), mul(), div(), string(); ! 157: extern Rectangle rsubp(), raddp(), inset(); ! 158: extern Bitmap *balloc(); ! 159: extern char *gcalloc(), *calloc(); ! 160: extern void bfree(), gcfree(); ! 161: extern void rectf(), rectfD(), bitblt(), bitbltD(), texture(), evtomouse(); ! 162: ! 163: #define alloc(n) calloc(n,1) ! 164: ! 165: #ifdef X11 ! 166: extern Texture ToTexture(); ! 167: extern Texture32 ToTexture32(); ! 168: extern GC gc; ! 169: extern Display *dpy; ! 170: extern int fgpix, bgpix; ! 171: extern Colormap colormap; ! 172: extern XColor fgcolor, bgcolor; ! 173: #define jerqsync() XSync(dpy, 0) ! 174: #endif X11 ! 175: #ifdef SUNTOOLS ! 176: extern Pixwin *displaypw; ! 177: extern int damagedone; ! 178: #define ToTexture(x) x ! 179: #define ToTexture32(x) x ! 180: #define jerqsync() ! 181: #endif SUNTOOLS ! 182: ! 183: extern Font getfont(); ! 184: extern Rectangle Drect; ! 185: extern Bitmap display, Jfscreen, ToBitmap(); ! 186: extern Point Joffset; ! 187: extern int displayfd; ! 188: extern int jerqrcvmask; ! 189: extern Cursor ToCursor(), *cursswitch(), normalcursor; ! 190: extern struct Mouse mouse; ! 191: extern struct JProc *P; ! 192: extern Font defont; ! 193: ! 194: #endif JERQ_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.