latin1.ed (612B)
1 ,s;Rune.*\*so;Rune so[64]; 2 /k\[0\] == 'X'/s/$/{/ 3 /return -5/a 4 } 5 . 6 1a 7 #include "lib.h" 8 #include "mem.h" 9 #include "dat.h" 10 #include "fns.h" 11 #include "keyboard.h" 12 13 . 14 $a 15 16 // Plan 9 VX 17 void 18 latin1putc(int c, void (*kputc)(int)) 19 { 20 int i; 21 static int collecting, nk; 22 static Rune kc[5]; 23 24 if(c == Kalt){ 25 collecting = !collecting; 26 nk = 0; 27 return; 28 } 29 30 if(!collecting){ 31 kputc(c); 32 return; 33 } 34 35 kc[nk++] = c; 36 c = latin1(kc, nk); 37 if(c < -1) /* need more keystrokes */ 38 return; 39 if(c != -1) /* valid sequence */ 40 kputc(c); 41 else 42 for(i=0; i<nk; i++) 43 kputc(kc[i]); 44 nk = 0; 45 collecting = 0; 46 } 47 48 .