9 gbkproc(int c, Rune **r, long input_loc)
11 static enum { state0, state1 } state = state0;
17 case state0: /* idle state */
28 case state1: /* seen a font spec */
31 if(c >= GBKMIN && c < GBKMAX)
32 ch = tabgbk[c - GBKMIN];
36 warn("bad gbk glyph %d (from 0x%x,0x%lx) near byte %ld in %s", (c & 0xFF), lastc, cold, input_loc, file);
48 gbk_in(int fd, long *, struct convert *out)
59 while((n = read(fd, ibuf, sizeof ibuf)) > 0){
60 for(i = 0; i < n; i++){
61 gbkproc(ibuf[i], &r, nin++);
80 gbk_out(Rune *base, int n, long *)
89 for(i = 0; i < NRUNE; i++)
91 for(i = GBKMIN; i < GBKMAX; i++)
92 tab[tabgbk[i-GBKMIN]] = i;
96 for(i = 0; i < n; i++){
101 if(r < NRUNE && tab[r] != -1){
103 *p++ = (r>>8) & 0xFF;
108 warn("rune 0x%x not in output cs", r);
117 write(1, obuf, p-obuf);