+ case ISO2022_JP:
+ if (c >= 128) goto ilseq;
+ if (c == '\033') {
+ l = 3;
+ if (*inb < 3) goto starved;
+ c = *((unsigned char *)*in + 1);
+ d = *((unsigned char *)*in + 2);
+ if (c != '(' && c != '$') goto ilseq;
+ switch (128*(c=='$') + d) {
+ case 'B': scd->state=0; continue;
+ case 'J': scd->state=1; continue;
+ case 'I': scd->state=4; continue;
+ case 128+'@': scd->state=2; continue;
+ case 128+'B': scd->state=3; continue;
+ }
+ goto ilseq;
+ }
+ switch (scd->state) {
+ case 1:
+ if (c=='\\') c = 0xa5;
+ if (c=='~') c = 0x203e;
+ break;
+ case 2:
+ case 3:
+ l = 2;
+ if (*inb < 2) goto starved;
+ d = *((unsigned char *)*in + 1);
+ c -= 0x21;
+ d -= 0x21;
+ if (c >= 84 || d >= 94) goto ilseq;
+ c = jis0208[c][d];
+ if (!c) goto ilseq;
+ break;
+ case 4:
+ if (c-0x60 < 0x1f) goto ilseq;
+ if (c-0x21 < 0x5e) c += 0xff61-0x21;
+ break;
+ }
+ break;