626 |
{ \ |
{ \ |
627 |
ccl_prog = ccl_prog_stack_struct[0].ccl_prog; \ |
ccl_prog = ccl_prog_stack_struct[0].ccl_prog; \ |
628 |
ic = ccl_prog_stack_struct[0].ic; \ |
ic = ccl_prog_stack_struct[0].ic; \ |
629 |
|
eof_ic = ccl_prog_stack_struct[0].eof_ic; \ |
630 |
} \ |
} \ |
631 |
CCL_INVALID_CMD; \ |
CCL_INVALID_CMD; \ |
632 |
} \ |
} \ |
633 |
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; \ |
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; \ |
634 |
ccl_prog_stack_struct[stack_idx].ic = (ret_ic); \ |
ccl_prog_stack_struct[stack_idx].ic = (ret_ic); \ |
635 |
|
ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; \ |
636 |
stack_idx++; \ |
stack_idx++; \ |
637 |
ccl_prog = called_ccl.prog; \ |
ccl_prog = called_ccl.prog; \ |
638 |
ic = CCL_HEADER_MAIN; \ |
ic = CCL_HEADER_MAIN; \ |
639 |
|
eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); \ |
640 |
goto ccl_repeat; \ |
goto ccl_repeat; \ |
641 |
} \ |
} \ |
642 |
while (0) |
while (0) |
713 |
|
|
714 |
/* Terminate CCL program because of invalid command. Should not occur |
/* Terminate CCL program because of invalid command. Should not occur |
715 |
in the normal case. */ |
in the normal case. */ |
716 |
|
#ifndef CCL_DEBUG |
717 |
|
|
718 |
|
#define CCL_INVALID_CMD \ |
719 |
|
do \ |
720 |
|
{ \ |
721 |
|
ccl->status = CCL_STAT_INVALID_CMD; \ |
722 |
|
goto ccl_error_handler; \ |
723 |
|
} \ |
724 |
|
while(0) |
725 |
|
|
726 |
|
#else |
727 |
|
|
728 |
#define CCL_INVALID_CMD \ |
#define CCL_INVALID_CMD \ |
729 |
do \ |
do \ |
730 |
{ \ |
{ \ |
731 |
|
ccl_debug_hook (this_ic); \ |
732 |
ccl->status = CCL_STAT_INVALID_CMD; \ |
ccl->status = CCL_STAT_INVALID_CMD; \ |
733 |
goto ccl_error_handler; \ |
goto ccl_error_handler; \ |
734 |
} \ |
} \ |
735 |
while(0) |
while(0) |
736 |
|
|
737 |
|
#endif |
738 |
|
|
739 |
/* Encode one character CH to multibyte form and write to the current |
/* Encode one character CH to multibyte form and write to the current |
740 |
output buffer. If CH is less than 256, CH is written as is. */ |
output buffer. If CH is less than 256, CH is written as is. */ |
741 |
#define CCL_WRITE_CHAR(ch) \ |
#define CCL_WRITE_CHAR(ch) \ |
827 |
} \ |
} \ |
828 |
else if (ccl->last_block) \ |
else if (ccl->last_block) \ |
829 |
{ \ |
{ \ |
830 |
ic = ccl->eof_ic; \ |
REG = -1; \ |
831 |
|
ic = eof_ic; \ |
832 |
goto ccl_repeat; \ |
goto ccl_repeat; \ |
833 |
} \ |
} \ |
834 |
else \ |
else \ |
873 |
#define CCL_DEBUG_BACKTRACE_LEN 256 |
#define CCL_DEBUG_BACKTRACE_LEN 256 |
874 |
int ccl_backtrace_table[CCL_DEBUG_BACKTRACE_LEN]; |
int ccl_backtrace_table[CCL_DEBUG_BACKTRACE_LEN]; |
875 |
int ccl_backtrace_idx; |
int ccl_backtrace_idx; |
876 |
|
|
877 |
|
int |
878 |
|
ccl_debug_hook (int ic) |
879 |
|
{ |
880 |
|
return ic; |
881 |
|
} |
882 |
|
|
883 |
#endif |
#endif |
884 |
|
|
885 |
struct ccl_prog_stack |
struct ccl_prog_stack |
886 |
{ |
{ |
887 |
Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */ |
Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */ |
888 |
int ic; /* Instruction Counter. */ |
int ic; /* Instruction Counter. */ |
889 |
|
int eof_ic; /* Instruction Counter to jump on EOF. */ |
890 |
}; |
}; |
891 |
|
|
892 |
/* For the moment, we only support depth 256 of stack. */ |
/* For the moment, we only support depth 256 of stack. */ |
915 |
sequence. For that conversion, we remember how many more bytes |
sequence. For that conversion, we remember how many more bytes |
916 |
we must keep in DESTINATION in this variable. */ |
we must keep in DESTINATION in this variable. */ |
917 |
int extra_bytes = ccl->eight_bit_control; |
int extra_bytes = ccl->eight_bit_control; |
918 |
|
int eof_ic = ccl->eof_ic; |
919 |
|
int eof_hit = 0; |
920 |
|
|
921 |
if (ic >= ccl->eof_ic) |
if (ic >= eof_ic) |
922 |
ic = CCL_HEADER_MAIN; |
ic = CCL_HEADER_MAIN; |
923 |
|
|
924 |
if (ccl->buf_magnification == 0) /* We can't produce any bytes. */ |
if (ccl->buf_magnification == 0) /* We can't produce any bytes. */ |
1122 |
{ |
{ |
1123 |
ccl_prog = ccl_prog_stack_struct[0].ccl_prog; |
ccl_prog = ccl_prog_stack_struct[0].ccl_prog; |
1124 |
ic = ccl_prog_stack_struct[0].ic; |
ic = ccl_prog_stack_struct[0].ic; |
1125 |
|
eof_ic = ccl_prog_stack_struct[0].eof_ic; |
1126 |
} |
} |
1127 |
CCL_INVALID_CMD; |
CCL_INVALID_CMD; |
1128 |
} |
} |
1129 |
|
|
1130 |
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; |
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; |
1131 |
ccl_prog_stack_struct[stack_idx].ic = ic; |
ccl_prog_stack_struct[stack_idx].ic = ic; |
1132 |
|
ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; |
1133 |
stack_idx++; |
stack_idx++; |
1134 |
ccl_prog = XVECTOR (AREF (slot, 1))->contents; |
ccl_prog = XVECTOR (AREF (slot, 1))->contents; |
1135 |
ic = CCL_HEADER_MAIN; |
ic = CCL_HEADER_MAIN; |
1136 |
|
eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); |
1137 |
} |
} |
1138 |
break; |
break; |
1139 |
|
|
1163 |
stack_idx--; |
stack_idx--; |
1164 |
ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog; |
ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog; |
1165 |
ic = ccl_prog_stack_struct[stack_idx].ic; |
ic = ccl_prog_stack_struct[stack_idx].ic; |
1166 |
|
eof_ic = ccl_prog_stack_struct[stack_idx].eof_ic; |
1167 |
|
if (eof_hit) |
1168 |
|
ic = eof_ic; |
1169 |
break; |
break; |
1170 |
} |
} |
1171 |
if (src) |
if (src) |
1402 |
src--; |
src--; |
1403 |
if (ccl->last_block) |
if (ccl->last_block) |
1404 |
{ |
{ |
1405 |
ic = ccl->eof_ic; |
ic = eof_ic; |
1406 |
|
eof_hit = 1; |
1407 |
goto ccl_repeat; |
goto ccl_repeat; |
1408 |
} |
} |
1409 |
else |
else |