Blob
1 #include "a.h"3 /*4 * 11. Local Horizontal and Vertical Motions, and the Width Function.5 */7 int8 e_0(void)9 {10 /* digit-width space */11 return ' ';12 }14 int15 dv(int d)16 {17 Rune sub[6];19 d += getnr(L(".dv"));20 nr(L(".dv"), d);22 runestrcpy(sub, L("<sub>"));23 sub[0] = Ult;24 sub[4] = Ugt;25 if(d < 0){26 sub[3] = 'p';27 ihtml(L(".dv"), sub);28 }else if(d > 0)29 ihtml(L(".dv"), sub);30 else31 ihtml(L(".dv"), nil);32 return 0;33 }35 int36 e_v(void)37 {38 dv(eval(getqarg()));39 return 0;40 }42 int43 e_u(void)44 {45 dv(eval(L("-0.5m")));46 return 0;47 }49 int50 e_d(void)51 {52 dv(eval(L("0.5m")));53 return 0;54 }56 int57 e_r(void)58 {59 dv(eval(L("-1m")));60 return 0;61 }63 int64 e_h(void)65 {66 getqarg();67 return 0;68 }70 int71 e_w(void)72 {73 Rune *a;74 Rune buf[40];75 static Rune zero;77 a = getqarg();78 if(a == nil){79 warn("no arg for \\w");80 a = &zero;81 }82 runesnprint(buf, sizeof buf, "%ld", runestrlen(a));83 pushinputstring(buf);84 nr(L("st"), 0);85 nr(L("sb"), 0);86 nr(L("ct"), 0);87 return 0;88 }90 int91 e_k(void)92 {93 getname();94 warn("%Ck not available", backslash);95 return 0;96 }98 void99 t11init(void)100 {101 addesc('|', e_nop, 0);102 addesc('^', e_nop, 0);103 addesc('v', e_v, 0);104 addesc('h', e_h, 0);105 addesc('w', e_w, 0);106 addesc('0', e_0, 0);107 addesc('u', e_u, 0);108 addesc('d', e_d, 0);109 addesc('r', e_r, 0);110 addesc('k', e_k, 0);111 }