plan 9 kernel history: overview | file list | diff list

1991/1228/pc/vga.c (diff list | history)

1991/1211/sys/src/9/pc/vga.c:193,2341991/1228/sys/src/9/pc/vga.c:193,245 (short | long | prev | next)
1991/0723    
} 
1991/0727    
 
1991/0730    
void 
screenputc(int c) 
1991/1228    
screenputnl(void) 
1991/0730    
{ 
	char buf[2]; 
	int nx; 
                 
	if(c == '\n'){ 
		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, 
1991/0801    
		    Rect(0, out.pos.y, gscreen.r.max.x, out.pos.y+2*defont0.height), flipD[0]); 
1991/0730    
	}else if(c == '\t'){ 
		out.pos.x += (8-((out.pos.x-MINX)/out.bwid&7))*out.bwid; 
		if(out.pos.x >= gscreen.r.max.x) 
			screenputc('\n'); 
	}else if(c == '\b'){ 
		if(out.pos.x >= out.bwid+MINX){ 
			out.pos.x -= out.bwid; 
			screenputc(' '); 
			out.pos.x -= out.bwid; 
		} 
	}else{ 
		if(out.pos.x >= gscreen.r.max.x-out.bwid) 
			screenputc('\n'); 
		buf[0] = c&0x7F; 
		buf[1] = 0; 
1991/0801    
		out.pos = gstring(&gscreen, out.pos, defont, buf, flipD[S]); 
1991/0730    
	} 
1991/1228    
	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), flipD[0]); 
1991/0730    
} 
 
void 
screenputs(char *s, int n) 
{ 
	while(n-- > 0) 
		screenputc(*s++); 
1991/1228    
	Rune r; 
	int i; 
	char buf[4]; 
 
	lock(&printq); 
	while(n > 0){ 
		i = chartorune(&r, s); 
		if(i == 0){ 
			s++; 
			--n; 
			continue; 
		} 
		memmove(buf, s, i); 
		buf[i] = 0; 
		n -= i; 
		s += i; 
		if(r == '\n') 
			screenputnl(); 
		else if(r == '\t'){ 
			out.pos.x += (8-((out.pos.x-MINX)/out.bwid&7))*out.bwid; 
			if(out.pos.x >= gscreen.r.max.x) 
				screenputnl(); 
		}else if(r == '\b'){ 
			if(out.pos.x >= out.bwid+MINX){ 
				out.pos.x -= out.bwid; 
				gstring(&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]); 
		} 
	} 
	unlock(&printq); 
1991/0730    
} 
 
int 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)