+ /*
+ * Verify that we've seen the right kind of character for
+ * what we're currently doing. This only matters in 8-bit
+ * subsets.
+ */
+ if (iso->eightbit) {
+ cont = (state->s1 >> 28) & 7;
+ /*
+ * If cont==0, we're entitled to see either GL or GR
+ * characters. If cont==2, we expect only GR; otherwise
+ * we expect only GL.
+ *
+ * If we see a GR character while cont==0, we set
+ * cont=2 immediately.
+ */
+ if ((cont == 2 && !(input_chr & 0x80)) ||
+ (cont != 0 && cont != 2 && (input_chr & 0x80))) {
+ /*
+ * Clear the previous character; it was prematurely
+ * terminated by this error.
+ */
+ state->s1 &= ~0x0F000000;
+ state->s0 &= 0xFF000000;
+ emit(emitctx, ERROR);
+ /*
+ * If we were in the SS2 or SS3 container, we
+ * automatically exit it.
+ */
+ if (state->s1 & 0x60000000)
+ state->s1 &= 0x9FFFFFFF;
+ }
+
+ if (cont == 0 && (input_chr & 0x80)) {
+ state->s1 |= 0x20000000;
+ }
+ }
+