/[emacs]/emacs/src/ccl.c
ViewVC logotype

Diff of /emacs/src/ccl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.85 by handa, Fri May 14 12:41:32 2004 UTC revision 1.86 by handa, Sat Jun 12 02:33:39 2004 UTC
# Line 626  do                                                             \ Line 626  do                                                             \
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)
# Line 710  while (0) Line 713  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)                                              \
# Line 809  while(0) Line 827  while(0)
827        }                                                 \        }                                                 \
828      else if (ccl->last_block)                           \      else if (ccl->last_block)                           \
829        {                                                 \        {                                                 \
830          ic = ccl->eof_ic;                               \          ic = eof_ic;                                    \
831          goto ccl_repeat;                                \          goto ccl_repeat;                                \
832        }                                                 \        }                                                 \
833      else                                                \      else                                                \
# Line 854  while(0) Line 872  while(0)
872  #define CCL_DEBUG_BACKTRACE_LEN 256  #define CCL_DEBUG_BACKTRACE_LEN 256
873  int ccl_backtrace_table[CCL_DEBUG_BACKTRACE_LEN];  int ccl_backtrace_table[CCL_DEBUG_BACKTRACE_LEN];
874  int ccl_backtrace_idx;  int ccl_backtrace_idx;
875    
876    int
877    ccl_debug_hook (int ic)
878    {
879      return ic;
880    }
881    
882  #endif  #endif
883    
884  struct ccl_prog_stack  struct ccl_prog_stack
885    {    {
886      Lisp_Object *ccl_prog;      /* Pointer to an array of CCL code.  */      Lisp_Object *ccl_prog;      /* Pointer to an array of CCL code.  */
887      int ic;                     /* Instruction Counter.  */      int ic;                     /* Instruction Counter.  */
888        int eof_ic;                 /* Instruction Counter to jump on EOF.  */
889    };    };
890    
891  /* For the moment, we only support depth 256 of stack.  */  /* For the moment, we only support depth 256 of stack.  */
# Line 888  ccl_driver (ccl, source, destination, sr Line 914  ccl_driver (ccl, source, destination, sr
914       sequence.  For that conversion, we remember how many more bytes       sequence.  For that conversion, we remember how many more bytes
915       we must keep in DESTINATION in this variable.  */       we must keep in DESTINATION in this variable.  */
916    int extra_bytes = ccl->eight_bit_control;    int extra_bytes = ccl->eight_bit_control;
917      int eof_ic = ccl->eof_ic;
918      int eof_hit = 0;
919    
920    if (ic >= ccl->eof_ic)    if (ic >= eof_ic)
921      ic = CCL_HEADER_MAIN;      ic = CCL_HEADER_MAIN;
922    
923    if (ccl->buf_magnification == 0) /* We can't produce any bytes.  */    if (ccl->buf_magnification == 0) /* We can't produce any bytes.  */
# Line 1093  ccl_driver (ccl, source, destination, sr Line 1121  ccl_driver (ccl, source, destination, sr
1121                    {                    {
1122                      ccl_prog = ccl_prog_stack_struct[0].ccl_prog;                      ccl_prog = ccl_prog_stack_struct[0].ccl_prog;
1123                      ic = ccl_prog_stack_struct[0].ic;                      ic = ccl_prog_stack_struct[0].ic;
1124                        eof_ic = ccl_prog_stack_struct[0].eof_ic;
1125                    }                    }
1126                  CCL_INVALID_CMD;                  CCL_INVALID_CMD;
1127                }                }
1128    
1129              ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;              ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
1130              ccl_prog_stack_struct[stack_idx].ic = ic;              ccl_prog_stack_struct[stack_idx].ic = ic;
1131                ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic;
1132              stack_idx++;              stack_idx++;
1133              ccl_prog = XVECTOR (AREF (slot, 1))->contents;              ccl_prog = XVECTOR (AREF (slot, 1))->contents;
1134              ic = CCL_HEADER_MAIN;              ic = CCL_HEADER_MAIN;
1135                eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]);
1136            }            }
1137            break;            break;
1138    
# Line 1131  ccl_driver (ccl, source, destination, sr Line 1162  ccl_driver (ccl, source, destination, sr
1162                stack_idx--;                stack_idx--;
1163                ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog;                ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog;
1164                ic = ccl_prog_stack_struct[stack_idx].ic;                ic = ccl_prog_stack_struct[stack_idx].ic;
1165                  eof_ic = ccl_prog_stack_struct[stack_idx].eof_ic;
1166                  if (eof_hit)
1167                    ic = eof_ic;
1168                break;                break;
1169              }              }
1170            if (src)            if (src)
# Line 1367  ccl_driver (ccl, source, destination, sr Line 1401  ccl_driver (ccl, source, destination, sr
1401                src--;                src--;
1402                if (ccl->last_block)                if (ccl->last_block)
1403                  {                  {
1404                    ic = ccl->eof_ic;                    ic = eof_ic;
1405                      eof_hit = 1;
1406                    goto ccl_repeat;                    goto ccl_repeat;
1407                  }                  }
1408                else                else

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26