APPROVE COMMIT
NOTE: This patch has been committed.
Unfortunately, there are still problems provoked if you switch all the
ISO-2022 single-width coding systems to CCL. But this avoids crashing for
one of them; though further work is needed to avoid an ugly error message.
src/ChangeLog addition:
2007-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
* mule-ccl.c:
* mule-ccl.c (CCL_CALL_FOR_MAP_INSTRUCTION):
* mule-ccl.c (ccl_driver):
Merge Kenichi Handa's 2004-06-12 GNU bugfix, handling EOF in
ccl_driver correctly.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/mule-ccl.c
===================================================================
RCS
Index: src/mule-ccl.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-ccl.c,v
retrieving revision 1.35
diff -u -r1.35 mule-ccl.c
--- src/mule-ccl.c 2007/08/28 09:49:40 1.35
+++ src/mule-ccl.c 2007/09/30 11:34:55
@@ -634,14 +634,17 @@
{ \
ccl_prog = ccl_prog_stack_struct[0].ccl_prog; \
ic = ccl_prog_stack_struct[0].ic; \
+ eof_ic = ccl_prog_stack_struct[0].eof_ic; \
} \
CCL_INVALID_CMD; \
} \
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; \
ccl_prog_stack_struct[stack_idx].ic = (ret_ic); \
+ ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; \
stack_idx++; \
ccl_prog = called_ccl.prog; \
ic = CCL_HEADER_MAIN; \
+ eof_ic = XINT (ccl_prog[CCL_HEADER_EOF]); \
/* The "if (1)" prevents warning \
"end-of loop code not reached" */ \
if (1) goto ccl_repeat; \
@@ -926,6 +929,7 @@
{
Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */
int ic; /* Instruction Counter. */
+ int eof_ic; /* Instruction Counter to jump on EOF. */
};
/* For the moment, we only support depth 256 of stack. */
@@ -950,8 +954,11 @@
int stack_idx = ccl->stack_idx;
/* Instruction counter of the current CCL code. */
int this_ic = 0;
+ int eof_ic = ccl->eof_ic;
+ int eof_hit = 0;
+ static int ccl_driver_calls;
- if (ic >= ccl->eof_ic)
+ if (ic >= eof_ic)
ic = CCL_HEADER_MAIN;
if (ccl->buf_magnification ==0) /* We can't produce any bytes. */
@@ -964,6 +971,8 @@
ccl_backtrace_idx = 0;
#endif
+ ++ccl_driver_calls;
+
for (;;)
{
ccl_repeat:
@@ -1161,15 +1170,18 @@
{
ccl_prog = ccl_prog_stack_struct[0].ccl_prog;
ic = ccl_prog_stack_struct[0].ic;
+ eof_ic = ccl_prog_stack_struct[0].eof_ic;
}
CCL_INVALID_CMD;
}
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
ccl_prog_stack_struct[stack_idx].ic = ic;
+ ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic;
stack_idx++;
ccl_prog = XVECTOR (XVECTOR (slot)->contents[1])->contents;
ic = CCL_HEADER_MAIN;
+ eof_ic = XINT (ccl_prog[CCL_HEADER_EOF]);
}
break;
@@ -1200,6 +1212,9 @@
stack_idx--;
ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog;
ic = ccl_prog_stack_struct[stack_idx].ic;
+ eof_ic = ccl_prog_stack_struct[stack_idx].eof_ic;
+ if (eof_hit)
+ ic = eof_ic;
break;
}
if (src)
@@ -1398,10 +1413,32 @@
break;
ccl_read_multibyte_character_suspend:
+ if (src <= src_end && ccl->last_block)
+ {
+ /* #### Unclear when this happens. GNU use
+ CHARSET_8_BIT_CONTROL here, which we can't. */
+ if (i < 0x80)
+ {
+ reg[RRR] = LEADING_BYTE_ASCII;
+ reg[rrr] = i;
+ }
+ else if (i < 0xA0)
+ {
+ reg[RRR] = LEADING_BYTE_CONTROL_1;
+ reg[rrr] = i - 0xA0;
+ }
+ else
+ {
+ reg[RRR] = LEADING_BYTE_LATIN_ISO8859_1;
+ reg[rrr] = i & 0x7F;
+ }
+ break;
+ }
src--;
if (ccl->last_block)
{
- ic = ccl->eof_ic;
+ ic = eof_ic;
+ eof_hit = 1;
goto ccl_repeat;
}
else
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches