emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/ccl.c


From: Dave Love
Subject: [Emacs-diffs] Changes to emacs/src/ccl.c
Date: Fri, 05 Jul 2002 14:54:23 -0400

Index: emacs/src/ccl.c
diff -c emacs/src/ccl.c:1.76 emacs/src/ccl.c:1.77
*** emacs/src/ccl.c:1.76        Wed Nov 28 02:25:03 2001
--- emacs/src/ccl.c     Fri Jul  5 14:54:22 2002
***************
*** 1,6 ****
  /* CCL (Code Conversion Language) interpreter.
     Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
!    Copyright (C) 2001 Free Software Foundation, Inc.
     Licensed to the Free Software Foundation.
  
  This file is part of GNU Emacs.
--- 1,6 ----
  /* CCL (Code Conversion Language) interpreter.
     Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
!    Copyright (C) 2001, 2002 Free Software Foundation, Inc.
     Licensed to the Free Software Foundation.
  
  This file is part of GNU Emacs.
***************
*** 65,70 ****
--- 65,79 ----
     already resolved to index numbers or not.  */
  Lisp_Object Vccl_program_table;
  
+ /* Vector of registered hash tables for translation.  */
+ Lisp_Object Vtranslation_hash_table_vector;
+ 
+ /* Return a hash table of id number ID.  */
+ #define GET_HASH_TABLE(id) \
+   (XHASH_TABLE 
(XCDR(XVECTOR(Vtranslation_hash_table_vector)->contents[(id)])))
+ /* Copied from fns.c.  */
+ #define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1)
+ 
  /* CCL (Code Conversion Language) is a simple language which has
     operations on one input buffer, one output buffer, and 7 registers.
     The syntax of CCL is described in `ccl.el'.  Emacs Lisp function
***************
*** 652,657 ****
--- 661,678 ----
                                          set reg[RRR] to -1.
                                     */
  
+ #define CCL_LookupIntConstTbl 0x13 /* Lookup multibyte character by
+                                     integer key.  Afterwards R7 set
+                                     to 1 iff lookup succeeded.
+                                     1:ExtendedCOMMNDRrrRRRXXXXXXXX
+                                     2:ARGUMENT(Hash table ID) */
+ 
+ #define CCL_LookupCharConstTbl 0x14 /* Lookup integer by multibyte
+                                      character key.  Afterwards R7 set
+                                      to 1 iff lookup succeeded.
+                                      1:ExtendedCOMMNDRrrRRRrrrXXXXX
+                                      2:ARGUMENT(Hash table ID) */
+ 
  /* CCL arithmetic/logical operators. */
  #define CCL_PLUS      0x00    /* X = Y + Z */
  #define CCL_MINUS     0x01    /* X = Y - Z */
***************
*** 1406,1411 ****
--- 1427,1476 ----
              reg[rrr] = i;
              break;
  
+           case CCL_LookupIntConstTbl:
+             op = XINT (ccl_prog[ic]); /* table */
+             ic++;
+             {         
+               struct Lisp_Hash_Table *h = GET_HASH_TABLE (op);
+ 
+               op = hash_lookup (h, make_number (reg[RRR]), NULL);
+               if (op >= 0)
+                 {
+                   op = HASH_VALUE (h, op);
+                   if (!CHAR_VALID_P (op, 0))
+                     CCL_INVALID_CMD;
+                   SPLIT_CHAR (XINT (op), reg[RRR], i, j);
+                   if (j != -1)
+                     i = (i << 7) | j;
+                   reg[rrr] = i;
+                   reg[7] = 1; /* r7 true for success */
+                 }
+               else
+                 reg[7] = 0;
+             }
+             break;
+ 
+           case CCL_LookupCharConstTbl:
+             op = XINT (ccl_prog[ic]); /* table */
+             ic++;
+             CCL_MAKE_CHAR (reg[RRR], reg[rrr], i);
+             {         
+               struct Lisp_Hash_Table *h = GET_HASH_TABLE (op);
+ 
+               op = hash_lookup (h, make_number (i), NULL);
+               if (op >= 0)
+                 {
+                   op = HASH_VALUE (h, op);
+                   if (!INTEGERP (op))
+                     CCL_INVALID_CMD;
+                   reg[RRR] = XINT (op);
+                   reg[7] = 1; /* r7 true for success */
+                 }
+               else
+                 reg[7] = 0;
+             }
+             break;
+ 
            case CCL_IterateMultipleMap:
              {
                Lisp_Object map, content, attrib, value;
***************
*** 2335,2340 ****
--- 2400,2412 ----
   when the execution terminated.
   If the font is single-byte font, the register R2 is not used.  */);
    Vfont_ccl_encoder_alist = Qnil;
+ 
+   DEFVAR_LISP ("translation-hash-table-vector", 
&Vtranslation_hash_table_vector,
+     doc: /* Vector containing all translation hash tables ever defined.
+ Comprises pairs (SYMBOL . TABLE) where SYMBOL and TABLE were set up by calls
+ to `define-translation-hash-table'.  The vector is indexed by the table id
+ used by CCL.  */);
+     Vtranslation_hash_table_vector = Qnil;
  
    defsubr (&Sccl_program_p);
    defsubr (&Sccl_execute);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]