| plan 9 kernel history: overview | file list | diff list |
1992/0111/gnot/screen.c (diff list | history)
| gnot/screen.c on 1990/03091 | ||
| 1990/03091 | #include "u.h" #include "lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" | |
| 1990/0330 | #include "ureg.h" | |
| 1992/0111 | #include "../port/error.h" | |
| 1990/03091 | ||
| 1990/0912 | #include <libg.h> | |
| 1990/0902 | #include <gnot.h> | |
| 1991/0708 | #include "screen.h" | |
| 1990/03091 | #define MINX 8 | |
| 1990/0902 | extern GFont defont0; GFont *defont; | |
| 1990/03091 | struct{ Point pos; int bwid; }out; | |
| 1991/1228 | Lock screenlock; | |
| 1990/0912 | GBitmap gscreen = | |
| 1990/03091 | { | |
| 1990/0320 | (ulong*)((4*1024*1024-256*1024)|KZERO), /* BUG */ | |
| 1990/03091 | 0, 64, 0, 0, 0, 1024, 1024, 0 }; void screeninit(void) { | |
| 1990/05313 | /* * Read HEX switch to set ldepth */ | |
| 1990/0914 | if(*(uchar*)MOUSE & (1<<4)) | |
| 1990/0912 | gscreen.ldepth = 1; | |
| 1990/0914 | defont = &defont0; /* save space; let bitblt do the conversion work */ | |
| 1991/1225 | gbitblt(&gscreen, Pt(0, 0), &gscreen, gscreen.r, 0); | |
| 1990/03091 | out.pos.x = MINX; out.pos.y = 0; out.bwid = defont0.info[' '].width; } void | |
| 1991/1228 | screenputnl(void) { out.pos.x = MINX; out.pos.y += defont0.height; if(out.pos.y > gscreen.r.max.y-defont0.height) out.pos.y = gscreen.r.min.y; gbitblt(&gscreen, Pt(0, out.pos.y), &gscreen, Rect(0, out.pos.y, gscreen.r.max.x, out.pos.y+2*defont0.height), 0); } void | |
| 1991/1225 | screenputs(char *s, int n) | |
| 1990/03091 | { | |
| 1991/1225 | Rune r; int i; char buf[4]; | |
| 1990/03091 | ||
| 1991/1228 | lock(&screenlock); | |
| 1991/1225 | while(n > 0){ i = chartorune(&r, s); if(i == 0){ s++; --n; continue; | |
| 1990/03091 | } | |
| 1991/1225 | memmove(buf, s, i); buf[i] = 0; n -= i; s += i; | |
| 1991/1228 | if(r == '\n') screenputnl(); else if(r == '\t'){ | |
| 1991/1225 | out.pos.x += (8-((out.pos.x-MINX)/out.bwid&7))*out.bwid; if(out.pos.x >= gscreen.r.max.x) | |
| 1991/1228 | screenputnl(); | |
| 1991/1225 | }else if(r == '\b'){ if(out.pos.x >= out.bwid+MINX){ out.pos.x -= out.bwid; | |
| 1991/1228 | gstring(&gscreen, out.pos, defont, " ", S); | |
| 1991/1225 | } }else{ if(out.pos.x >= gscreen.r.max.x-out.bwid) | |
| 1991/1228 | screenputnl(); | |
| 1991/1225 | out.pos = gstring(&gscreen, out.pos, defont, buf, S); } | |
| 1990/03091 | } | |
| 1991/1228 | unlock(&screenlock); | |
| 1990/03091 | } | |
| 1991/0706 | int screenbits(void) { if(*(uchar*)MOUSE & (1<<4)) return 2; else return 1; } void getcolor(ulong p, ulong *pr, ulong *pg, ulong *pb) { ulong ans; /* * The gnot says 0 is white (max intensity) */ if(gscreen.ldepth == 0){ if(p == 0) ans = ~0; else ans = 0; }else{ switch(p){ case 0: ans = ~0; break; case 1: ans = 0xAAAAAAAA; break; case 2: ans = 0x55555555; break; default: ans = 0; break; | |
| 1991/0707 | } | |
| 1991/0706 | } *pr = *pg = *pb = ans; } int setcolor(ulong p, ulong r, ulong g, ulong b) { return 0; /* can't change mono screen colormap */ } int hwcursset(uchar *s, uchar *c, int ox, int oy) { return 0; } int hwcursmove(int x, int y) { return 0; | |
| 1991/0707 | } void mouseclock(void) /* called spl6 */ { ++mouse.clock; } void mousetry(Ureg *ur) { int s; if(mouse.clock && mouse.track && (ur->sr&SPL(7)) == 0 && canlock(&cursor)){ s = spl1(); mouseupdate(0); splx(s); unlock(&cursor); wakeup(&mouse.r); } | |
| 1991/0706 | } | |