/[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.76.4.4 by miles, Tue Jul 6 09:14:34 2004 UTC revision 1.76.4.5 by miles, Tue Jul 6 10:10:52 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;                               \          REG = -1;                                       \
831            ic = eof_ic;                                    \
832          goto ccl_repeat;                                \          goto ccl_repeat;                                \
833        }                                                 \        }                                                 \
834      else                                                \      else                                                \
# Line 854  while(0) Line 873  while(0)
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.  */
# Line 888  ccl_driver (ccl, source, destination, sr Line 915  ccl_driver (ccl, source, destination, sr
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.  */
# Line 1093  ccl_driver (ccl, source, destination, sr Line 1122  ccl_driver (ccl, source, destination, sr
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    
# Line 1131  ccl_driver (ccl, source, destination, sr Line 1163  ccl_driver (ccl, source, destination, sr
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)
# Line 1367  ccl_driver (ccl, source, destination, sr Line 1402  ccl_driver (ccl, source, destination, sr
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

Legend:
Removed from v.1.76.4.4  
changed lines
  Added in v.1.76.4.5

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