From 801a5affb61ecd5a82cc8ada3f3996fadc38ab6a Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 8 Feb 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-02-08 --- gnot/dat.h | 2 +- gnot/main.c | 2 +- gnot/screen.c | 8 ++++---- pc/dat.h | 2 +- pc/main.c | 2 +- pc/vga.c | 8 ++++---- port/devbit.c | 22 +++++++++++----------- port/sturp.c | 19 ++++++++++--------- ss/dat.h | 2 +- ss/main.c | 2 +- ss/screen.c | 8 ++++---- 11 files changed, 39 insertions(+), 38 deletions(-) diff --git a/gnot/dat.h b/gnot/dat.h index c2604a40517c1a217dd8fe32a0f93ef07aa2e77d..93bef57f1ca0ee0b4fb8fac4a41f47e471ad4a4c 100644 --- a/gnot/dat.h +++ b/gnot/dat.h @@ -95,7 +95,7 @@ struct Conf int nsrv; /* public servers (devsrv.c) */ int nbitmap; /* bitmap structs (devbit.c) */ int nbitbyte; /* bytes of bitmap data (devbit.c) */ - int nfont; /* font structs (devbit.c) */ + int nsubfont; /* Gsubfont structs (devbit.c) */ int nurp; /* max urp conversations */ int nasync; /* number of async protocol modules */ int npipe; /* number of pipes */ diff --git a/gnot/main.c b/gnot/main.c index f6cedbfb57f8a900080c3763ed6347efc3b6c743..086a0ca67adf484408d857b22075a6664cfdeee3 100644 --- a/gnot/main.c +++ b/gnot/main.c @@ -271,7 +271,7 @@ confinit(void) conf.nmux = 10; if(*(uchar*)MOUSE & (1<<4)) conf.nbitbyte *= 2; /* ldepth 1 */ - conf.nfont = 10*mul; + conf.nsubfont = 10*mul; conf.nurp = 32; conf.nasync = 1; conf.npipe = conf.nstream/2; diff --git a/gnot/screen.c b/gnot/screen.c index 52f6a00d805523edf94a55539c4befb5d144558a..3984f3eba32122114763f4a3ff1dcee0cb0a20da 100644 --- a/gnot/screen.c +++ b/gnot/screen.c @@ -13,8 +13,8 @@ #define MINX 8 -extern GFont defont0; -GFont *defont; +extern GSubfont defont0; +GSubfont *defont; struct{ Point pos; @@ -87,12 +87,12 @@ screenputs(char *s, int n) }else if(r == '\b'){ if(out.pos.x >= out.bwid+MINX){ out.pos.x -= out.bwid; - gstring(&gscreen, out.pos, defont, " ", S); + gsubfstring(&gscreen, out.pos, defont, " ", S); } }else{ if(out.pos.x >= gscreen.r.max.x-out.bwid) screenputnl(); - out.pos = gstring(&gscreen, out.pos, defont, buf, S); + out.pos = gsubfstring(&gscreen, out.pos, defont, buf, S); } } unlock(&screenlock); diff --git a/pc/dat.h b/pc/dat.h index e1606e52513b1b9e2d5fc20892ef22089addbfff..faf9f05706e1e0d9ec553b6f55f71b2550c1ba32 100644 --- a/pc/dat.h +++ b/pc/dat.h @@ -76,7 +76,7 @@ struct Conf ulong nsrv; /* public servers (devsrv.c) */ ulong nbitmap; /* bitmap structs (devbit.c) */ ulong nbitbyte; /* bytes of bitmap data (devbit.c) */ - ulong nfont; /* font structs (devbit.c) */ + ulong nsubfont; /* Gsubfont structs (devbit.c) */ ulong nnoifc; /* number of nonet interfaces */ ulong nnoconv; /* number of nonet conversations/ifc */ ulong nurp; /* max urp conversations */ diff --git a/pc/main.c b/pc/main.c index af52c58eeb57e53b1bba4f7b59abb7bf38184288..b744b3613a054cba95abb371eb45a606a092bcf2 100644 --- a/pc/main.c +++ b/pc/main.c @@ -220,7 +220,7 @@ confinit(void) conf.nsrv = 16*mul; /* was 32 */ conf.nbitmap = 512*mul; conf.nbitbyte = conf.nbitmap*1024*screenbits(); - conf.nfont = 10*mul; + conf.nsubfont = 10*mul; conf.nnoifc = 1; conf.nnoconv = 32; conf.nurp = 32; diff --git a/pc/vga.c b/pc/vga.c index 062d96e79c903827ddee77157e8d74cb03ac56ea..765a9135d6e175b8238561d810bf1bf246ee6d37 100644 --- a/pc/vga.c +++ b/pc/vga.c @@ -11,8 +11,8 @@ #define MINX 8 -extern GFont defont0; -GFont *defont; +extern GSubfont defont0; +GSubfont *defont; struct{ Point pos; @@ -231,12 +231,12 @@ screenputs(char *s, int n) }else if(r == '\b'){ if(out.pos.x >= out.bwid+MINX){ out.pos.x -= out.bwid; - gstring(&gscreen, out.pos, defont, " ", flipD[S]); + gsubfstring(&gscreen, out.pos, defont, " ", flipD[S]); } }else{ if(out.pos.x >= gscreen.r.max.x-out.bwid) screenputnl(); - out.pos = gstring(&gscreen, out.pos, defont, buf, flipD[S]); + out.pos = gsubfstring(&gscreen, out.pos, defont, buf, flipD[S]); } } unlock(&printq); diff --git a/port/devbit.c b/port/devbit.c index 667c925624d5fcb6183e46a45c42406f36d82fd7..3e40f15a7a2136bec31ab8b7838fbf2b1bfc4303 100644 --- a/port/devbit.c +++ b/port/devbit.c @@ -11,7 +11,7 @@ #include #include "screen.h" -extern GFont *defont; +extern GSubfont *defont; /* * Some monochrome screens are reversed from what we like: @@ -53,7 +53,7 @@ struct ulong *words; /* storage */ ulong nwords; /* total in arena */ ulong *wfree; /* pointer to next free word */ - GFont *font; /* arena; looked up linearly BUG */ + GSubfont *font; /* arena; looked up linearly BUG */ int lastid; /* last allocated bitmap id */ int lastfid; /* last allocated font id */ int init; /* freshly opened; init message pending */ @@ -161,9 +161,9 @@ bitreset(void) bit.words = ialloc(conf.nbitbyte, 0); bit.nwords = conf.nbitbyte/sizeof(ulong); bit.wfree = bit.words; - bit.font = ialloc(conf.nfont * sizeof(GFont), 0); + bit.font = ialloc(conf.nsubfont * sizeof(GSubfont), 0); bit.font[0] = *defont; - for(i=1; iqid.path!=CHDIR && (c->flag&COPEN)){ lock(&bit); @@ -271,7 +271,7 @@ bitclose(Chan *c) for(i=1,bp=&bit.map[1]; ildepth >= 0) bitfree(bp); - for(i=1,fp=&bit.font[1]; ibits = 0; } unlock(&bit); @@ -531,7 +531,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset) Fcode fc; Fontchar *fcp; GBitmap *bp, *src, *dst; - GFont *f; + GSubfont *f; if(c->qid.path == CHDIR) error(Eisdir); @@ -718,7 +718,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset) error(Ebadblt); v = GSHORT(p+1); f = &bit.font[v]; - if(v<0 || v>=conf.nfont || f->bits==0) + if(v<0 || v>=conf.nsubfont || f->bits==0) error(Ebadfont); f->bits = 0; m -= 3; @@ -752,7 +752,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset) v = GSHORT(p+1); if(v<0 || v>NINFO || m<7+6*(v+1)) /* BUG */ error(Ebadblt); - for(i=1; i=conf.nfont || f->bits==0 || f->bits->ldepth<0) + if(v<0 || v>=conf.nsubfont || f->bits==0 || f->bits->ldepth<0) error(Ebadblt); p += 15; m -= 15; @@ -936,7 +936,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset) cursoroff(1); isoff = 1; } - gstring(dst, pt, f, (char*)p, fc); + gsubfstring(dst, pt, f, (char*)p, fc); q++; m -= q-p; p = q; diff --git a/port/sturp.c b/port/sturp.c index dbadaa55976550f35550e8aa78cea4a2ff47da63..2f09ef755ede8de24e41c6c2aec852c81bb14897 100644 --- a/port/sturp.c +++ b/port/sturp.c @@ -11,7 +11,7 @@ enum { Nmask= 0x7, }; -#define DPRINT if(q->flag&QDEBUG)print +#define DPRINT if(q->flag&QDEBUG)kprint typedef struct Urp Urp; @@ -376,7 +376,7 @@ void urpiput(Queue *q, Block *bp) { Urp *up; - int i; + int i, len; int ctl; up = (Urp *)q->ptr; @@ -496,24 +496,25 @@ urpiput(Queue *q, Block *bp) */ case SEQ+0: case SEQ+1: case SEQ+2: case SEQ+3: case SEQ+4: case SEQ+5: case SEQ+6: case SEQ+7: - DPRINT("rSEQ%d...", ctl-SEQ); + len = up->trbuf[1] + (up->trbuf[2]<<8); + DPRINT("rSEQ%d(%d,%d,%d)...", ctl-SEQ, up->trx, len, q->len); i = ctl & Nmask; if(up->trx != 3){ urpstat.rjtrs++; sendrej(up); break; - } else if(q->len != up->trbuf[1] + (up->trbuf[2]<<8)){ - DPRINT("rej %d rcvd %d xpctd\n", q->len, - up->trbuf[1] + (up->trbuf[2]<<8)); + }else if(q->len != len){ urpstat.rjpks++; sendrej(up); break; - } else if(i != ((up->iseq+1)&Nmask)) { + }else if(i != ((up->iseq+1)&Nmask)){ urpstat.rjseq++; sendrej(up); break; - } else if(q->next->len > (3*Streamhi)/2 - || q->next->nb > (3*Streambhi)/2) { + }else if(q->next->len > (3*Streamhi)/2 + || q->next->nb > (3*Streambhi)/2){ + DPRINT("next->len=%d, next->nb=%d\n", + q->next->len, q->next->nb); flushinput(up); break; } diff --git a/ss/dat.h b/ss/dat.h index f7fa9dd6580191bd7a2690fcfef2b3d7bdca5629..80751fe65228c0ab178db199f771b9e3cdd25320 100644 --- a/ss/dat.h +++ b/ss/dat.h @@ -85,7 +85,7 @@ struct Conf int nsrv; /* public servers (devsrv.c) */ int nbitmap; /* bitmap structs (devbit.c) */ int nbitbyte; /* bytes of bitmap data (devbit.c) */ - int nfont; /* font structs (devbit.c) */ + int nsubfont; /* Gsubfont structs (devbit.c) */ ulong nnoifc; /* number of nonet interfaces */ ulong nnoconv; /* number of nonet conversations/ifc */ int nurp; /* max urp conversations */ diff --git a/ss/main.c b/ss/main.c index 4eab132ca534b4788e4da3bb84f669ffd828066f..bac942bf0cec10ba015d7be158501120cae5f07d 100644 --- a/ss/main.c +++ b/ss/main.c @@ -229,7 +229,7 @@ confinit(void) conf.nsrv = 16*mul; /* was 32 */ conf.nbitmap = 300*mul; conf.nbitbyte = 300*1024*mul; - conf.nfont = 10*mul; + conf.nsubfont = 10*mul; conf.nnoifc = 1; conf.nnoconv = 32; conf.nurp = 32; diff --git a/ss/screen.c b/ss/screen.c index a5401bebbb65c031bb7287e180b619e7b94fa480..75dcdb214f31a042138a4353b14882884992d4c2 100644 --- a/ss/screen.c +++ b/ss/screen.c @@ -12,8 +12,8 @@ #define MINX 8 -extern GFont defont0; -GFont *defont; +extern GSubfont defont0; +GSubfont *defont; struct{ Point pos; @@ -83,12 +83,12 @@ screenputs(char *s, int n) }else if(r == '\b'){ if(out.pos.x >= out.bwid+MINX){ out.pos.x -= out.bwid; - gstring(&gscreen, out.pos, defont, " ", S); + gsubfstring(&gscreen, out.pos, defont, " ", S); } }else{ if(out.pos.x >= gscreen.r.max.x-out.bwid) screenputnl(); - out.pos = gstring(&gscreen, out.pos, defont, buf, S); + out.pos = gsubfstring(&gscreen, out.pos, defont, buf, S); } } unlock(&screenlock);