#include #include #include "system.h" #ifdef Plan9 #include #endif # include "stdio.h" # include "defines.h" # include "object.h" # include "path.h" #include "njerq.h" # include "graphics.h" #ifdef VAX unsigned char bytemap[256]; #endif void init(char *cacheflg) { Line_no = 1 ; savestackinit() ; operstackinit() ; mybinit(); /* must be after saveinit & before dictinit*/ dictstackinit() ; execstackinit() ; graphicsstackinit() ; pathinit() ; deviceinit() ; initgraphicsOP() ; type1init() ; Graphics.flat = FLAT ; push(makearray(0,XA_EXECUTABLE)) ; settransferOP(); Graphics.screen.frequency = 20.0 ; Graphics.screen.angle = 0.0 ; Graphics.screen.proc = makearray(1,XA_EXECUTABLE) ; Graphics.screen.proc.value.v_array.object[0] = makeoperator(popOP) ; } #ifdef Plan9 Bitmap *pgrey[5], *ones; unsigned char grey[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xFF, 0xFF, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #endif #ifdef FAX Rectangle Drect = { 0, 0, FXMAX, YMAX }; #else Rectangle Drect = { 0, 0, XMAX, YMAX }; #endif Bitmap *bp; void mybinit(void) { int i, j, k; unsigned char *g; Rectangle r; #ifdef VAX for (i = 128, j = 1; i > 0; i >>= 1, j <<= 1) for (k = 0; k < 256; k++) if (k&i) bytemap[k] |= j; #endif #ifndef Plan9 bp = balloc(Drect, 0); if(bp == (Bitmap *)NULL){ fprintf(stderr,"failed to init - space\n"); done(1); } screen = *bp; for(i=0;i<5;i++) pgrey[i] = &grey[i]; #else binit(0, 0, "psi"); einit(Emouse|Ekeyboard); bp = &screen; if(bp == (Bitmap *)NULL){ fprintf(stderr,"failed in init - space\n"); done(1); } g = grey; for(i=0; i<5; i++){ pgrey[i] = balloc(Rect(0, 0, 16, 16), 0); wrbitmap(pgrey[i], 0, 16, g); g += 32; } ones = pgrey[0]; r = inset(screen.r, 6); orig = screen.r.min; corn = screen.r.max; texture(&screen, r, pgrey[4], Zero); #endif }