comparison src/ccl.c @ 17323:15fa68d983e7

(ccl_driver): Fix bug of the case CCL_WriteArrayReadJump.
author Kenichi Handa <handa@m17n.org>
date Mon, 07 Apr 1997 07:12:13 +0000
parents a5feb61ebe5c
children 6db43d8c9dfc
comparison
equal deleted inserted replaced
17322:a7d9b8e167ca 17323:15fa68d983e7
194 IC += LENGTH + 2; (... pointing at N+1) 194 IC += LENGTH + 2; (... pointing at N+1)
195 read (reg[rrr]); 195 read (reg[rrr]);
196 IC += ADDRESS; 196 IC += ADDRESS;
197 */ 197 */
198 /* Note: If read is suspended, the resumed execution starts from the 198 /* Note: If read is suspended, the resumed execution starts from the
199 Mth code (YYYYY == CCL_ReadJump). */ 199 Nth code (YYYYY == CCL_ReadJump). */
200 200
201 #define CCL_ReadJump 0x0C /* Read and jump: 201 #define CCL_ReadJump 0x0C /* Read and jump:
202 1:A--D--D--R--E--S--S-rrrYYYYY 202 1:A--D--D--R--E--S--S-rrrYYYYY
203 ----------------------------- 203 -----------------------------
204 read (reg[rrr]); 204 read (reg[rrr]);
460 ccl->status = CCL_STAT_INVALID_CMD; \ 460 ccl->status = CCL_STAT_INVALID_CMD; \
461 goto ccl_error_handler; \ 461 goto ccl_error_handler; \
462 } while (0) 462 } while (0)
463 463
464 /* Encode one character CH to multibyte form and write to the current 464 /* Encode one character CH to multibyte form and write to the current
465 output buffer. If CH is negative, write one byte -CH. */ 465 output buffer. If CH is less than 256, CH is written as is. */
466 #define CCL_WRITE_CHAR(ch) \ 466 #define CCL_WRITE_CHAR(ch) \
467 do { \ 467 do { \
468 if (!dst) \ 468 if (!dst) \
469 CCL_INVALID_CMD; \ 469 CCL_INVALID_CMD; \
470 else \ 470 else \
653 ic += ADDR - 1; 653 ic += ADDR - 1;
654 break; 654 break;
655 655
656 case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ 656 case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
657 i = reg[rrr]; 657 i = reg[rrr];
658 j = ccl_prog[ic++]; 658 j = ccl_prog[ic];
659 if ((unsigned int) i < j) 659 if ((unsigned int) i < j)
660 { 660 {
661 i = XINT (ccl_prog[ic + i]); 661 i = XINT (ccl_prog[ic + 1 + i]);
662 CCL_WRITE_CHAR (i); 662 CCL_WRITE_CHAR (i);
663 } 663 }
664 ic += j + 1; 664 ic += j + 2;
665 CCL_READ_CHAR (reg[rrr]); 665 CCL_READ_CHAR (reg[rrr]);
666 ic += ADDR - (j + 2); 666 ic += ADDR - (j + 2);
667 break; 667 break;
668 668
669 case CCL_ReadJump: /* A--D--D--R--E--S--S-rrrYYYYY */ 669 case CCL_ReadJump: /* A--D--D--R--E--S--S-rrrYYYYY */
924 break; 924 break;
925 bcopy (msg, dst, msglen); 925 bcopy (msg, dst, msglen);
926 dst += msglen; 926 dst += msglen;
927 } 927 }
928 } 928 }
929 #endif
929 goto ccl_finish; 930 goto ccl_finish;
930 #endif
931 931
932 case CCL_STAT_QUIT: 932 case CCL_STAT_QUIT:
933 sprintf(msg, "\nCCL: Quited."); 933 sprintf(msg, "\nCCL: Quited.");
934 break; 934 break;
935 935