Mercurial > hg > xemacs-beta
changeset 4193:6438d53aabcf
[xemacs-hg @ 2007-09-30 11:37:59 by aidan]
Merge a CCL bugfix from GNU.
author | aidan |
---|---|
date | Sun, 30 Sep 2007 11:38:00 +0000 |
parents | 203027d0f2cd |
children | 4f2243a0dc04 |
files | src/ChangeLog src/mule-ccl.c |
diffstat | 2 files changed, 47 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Sep 29 21:51:01 2007 +0000 +++ b/src/ChangeLog Sun Sep 30 11:38:00 2007 +0000 @@ -1,3 +1,11 @@ +2007-09-30 Aidan Kehoe <kehoea@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. + 2007-09-26 Didier Verna <didier@xemacs.org> More fixes similar to previous patch:
--- a/src/mule-ccl.c Sat Sep 29 21:51:01 2007 +0000 +++ b/src/mule-ccl.c Sun Sep 30 11:38:00 2007 +0000 @@ -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