116 lines · 1.6 KB · C
RawDownload
/*  * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ #include "a.h" /* * 11. Local Horizontal and Vertical Motions, and the Width Function. */ inte_0(void){	/* digit-width space */	return ' ';} intdv(int d){	Rune sub[6]; 	d += getnr(L(".dv"));	nr(L(".dv"), d); 	runestrcpy(sub, L("<sub>"));	sub[0] = Ult;	sub[4] = Ugt;	if(d < 0){		sub[3] = 'p';		ihtml(L(".dv"), sub);	}else if(d > 0)		ihtml(L(".dv"), sub);	else		ihtml(L(".dv"), nil);	return 0;} inte_v(void){	dv(eval(getqarg()));	return 0;} inte_u(void){	dv(eval(L("-0.5m")));	return 0;} inte_d(void){	dv(eval(L("0.5m")));	return 0;} inte_r(void){	dv(eval(L("-1m")));	return 0;} inte_h(void){	getqarg();	return 0;} inte_w(void){	Rune *a;	Rune buf[40];		a = getqarg();	runesnprint(buf, sizeof buf, "%ld", runestrlen(a));	pushinputstring(buf);	nr(L("st"), 0);	nr(L("sb"), 0);	nr(L("ct"), 0);	return 0;} inte_k(void){	getname();	warn("%Ck not available", backslash);	return 0;} voidt11init(void){	addesc('|', e_nop, 0);	addesc('^', e_nop, 0);	addesc('v', e_v, 0);	addesc('h', e_h, 0);	addesc('w', e_w, 0);	addesc('0', e_0, 0);	addesc('u', e_u, 0);	addesc('d', e_d, 0);	addesc('r', e_r, 0);	addesc('k', e_k, 0);}