123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /*
- * 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.
- */
- int
- e_0(void)
- {
- /* digit-width space */
- return ' ';
- }
- int
- dv(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;
- }
- int
- e_v(void)
- {
- dv(eval(getqarg()));
- return 0;
- }
- int
- e_u(void)
- {
- dv(eval(L("-0.5m")));
- return 0;
- }
- int
- e_d(void)
- {
- dv(eval(L("0.5m")));
- return 0;
- }
- int
- e_r(void)
- {
- dv(eval(L("-1m")));
- return 0;
- }
- int
- e_h(void)
- {
- getqarg();
- return 0;
- }
- int
- e_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;
- }
- int
- e_k(void)
- {
- getname();
- warn("%Ck not available", backslash);
- return 0;
- }
- void
- t11init(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);
- }
|