~kris/9p

9hist

801a5affb61ecd5a82cc8ada3f3996fadc38ab6a — David du Colombier 34 years ago 7d0d906
Plan 9 from Bell Labs 1992-02-08
11 files changed, 39 insertions(+), 38 deletions(-)

M gnot/dat.h
M gnot/main.c
M gnot/screen.c
M pc/dat.h
M pc/main.c
M pc/vga.c
M port/devbit.c
M port/sturp.c
M ss/dat.h
M ss/main.c
M ss/screen.c
M gnot/dat.h => gnot/dat.h +1 -1
@@ 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 */

M gnot/main.c => gnot/main.c +1 -1
@@ 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;

M gnot/screen.c => gnot/screen.c +4 -4
@@ 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);

M pc/dat.h => pc/dat.h +1 -1
@@ 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 */

M pc/main.c => pc/main.c +1 -1
@@ 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;

M pc/vga.c => pc/vga.c +4 -4
@@ 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);

M port/devbit.c => port/devbit.c +11 -11
@@ 11,7 11,7 @@
#include	<gnot.h>
#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; i<conf.nfont; i++)
	for(i=1; i<conf.nsubfont; i++)
		bit.font[i].info = ialloc((NINFO+1)*sizeof(Fontchar), 0);
	Cursortocursor(&arrow);
}


@@ 263,7 263,7 @@ bitclose(Chan *c)
{
	int i;
	GBitmap *bp;
	GFont *fp;
	GSubfont *fp;

	if(c->qid.path!=CHDIR && (c->flag&COPEN)){
		lock(&bit);


@@ 271,7 271,7 @@ bitclose(Chan *c)
			for(i=1,bp=&bit.map[1]; i<conf.nbitmap; i++,bp++)
				if(bp->ldepth >= 0)
					bitfree(bp);
			for(i=1,fp=&bit.font[1]; i<conf.nfont; i++,fp++)
			for(i=1,fp=&bit.font[1]; i<conf.nsubfont; i++,fp++)
				fp->bits = 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; i++)
			for(i=1; i<conf.nsubfont; i++)
				if(bit.font[i].bits == 0)
					goto fontfound;
			error(Enofont);


@@ 925,7 925,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset)
			pt.y = GLONG(p+7);
			v = GSHORT(p+11);
			f = &bit.font[v];
			if(v<0 || v>=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;

M port/sturp.c => port/sturp.c +10 -9
@@ 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;
		}

M ss/dat.h => ss/dat.h +1 -1
@@ 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 */

M ss/main.c => ss/main.c +1 -1
@@ 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;

M ss/screen.c => ss/screen.c +4 -4
@@ 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);