15 a state machine for interpreting gb.
18 gbproc(int c, Rune **r, long input_loc)
20 static enum { state0, state1 } state = state0;
26 case state0: /* idle state */
37 case state1: /* seen a font spec */
39 n = (lastc-0xA0)*100 + (c-0xA0);
43 EPR "%s: bad gb glyph %d (from 0x%x,0x%lx) near byte %ld in %s\n", argv0, c-0xA0, lastc, cold, input_loc, file);
53 EPR "%s: unknown gb %ld (from 0x%x,0x%lx) near byte %ld in %s\n", argv0, n, lastc, cold, input_loc, file);
63 gb_in(int fd, long *notused, struct convert *out)
75 while((n = read(fd, ibuf, sizeof ibuf)) > 0){
76 for(i = 0; i < n; i++){
77 gbproc(ibuf[i], &r, nin++);
95 gb_out(Rune *base, int n, long *notused)
100 static int first = 1;
105 for(i = 0; i < NRUNE; i++)
107 for(i = 0; i < GBMAX; i++)
113 for(i = 0; i < n; i++){
120 *p++ = 0xA0 + (r/100);
121 *p++ = 0xA0 + (r%100);
125 EPR "%s: rune 0x%x not in output cs\n", argv0, r);
134 write(1, obuf, p-obuf);