annotate src/mule-ccl.c @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 3ecd8885ac67
children 8de8e3f6228a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* CCL (Code Conversion Language) interpreter.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995, 1997, 1998, 1999 Electrotechnical Laboratory, JAPAN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Licensed to the Free Software Foundation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 GNU General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with : FSF Emacs 20.3.10 without ExCCL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 * (including {Read|Write}MultibyteChar) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #ifdef STDC_HEADERS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "mule-charset.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "mule-ccl.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "file-coding.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #else /* not emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include "mulelib.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #endif /* not emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 /* This contains all code conversion map available to CCL. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Lisp_Object Vcode_conversion_map_vector;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 /* Alist of fontname patterns vs corresponding CCL program. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Lisp_Object Vfont_ccl_encoder_alist;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 /* This symbol is a property which assocates with ccl program vector.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Ex: (get 'ccl-big5-encoder 'ccl-program) returns ccl program vector. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 Lisp_Object Qccl_program;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 /* These symbols are properties which associate with code conversion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 map and their ID respectively. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 Lisp_Object Qcode_conversion_map;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 Lisp_Object Qcode_conversion_map_id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 /* Symbols of ccl program have this property, a value of the property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 is an index for Vccl_protram_table. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Lisp_Object Qccl_program_idx;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 /* Vector of CCL program names vs corresponding program data. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 Lisp_Object Vccl_program_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 /* CCL (Code Conversion Language) is a simple language which has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 operations on one input buffer, one output buffer, and 7 registers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 The syntax of CCL is described in `ccl.el'. Emacs Lisp function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 `ccl-compile' compiles a CCL program and produces a CCL code which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 is a vector of integers. The structure of this vector is as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 follows: The 1st element: buffer-magnification, a factor for the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 size of output buffer compared with the size of input buffer. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 2nd element: address of CCL code to be executed when encountered
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 with end of input stream. The 3rd and the remaining elements: CCL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 codes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 /* Header of CCL compiled code */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #define CCL_HEADER_BUF_MAG 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #define CCL_HEADER_EOF 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #define CCL_HEADER_MAIN 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 /* CCL code is a sequence of 28-bit non-negative integers (i.e. the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 MSB is always 0), each contains CCL command and/or arguments in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 following format:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 |----------------- integer (28-bit) ------------------|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 |------- 17-bit ------|- 3-bit --|- 3-bit --|- 5-bit -|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 |--constant argument--|-register-|-register-|-command-|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 ccccccccccccccccc RRR rrr XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 |------- relative address -------|-register-|-command-|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 cccccccccccccccccccc rrr XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 |------------- constant or other args ----------------|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 cccccccccccccccccccccccccccc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 where, `cc...c' is a non-negative integer indicating constant value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 (the left most `c' is always 0) or an absolute jump address, `RRR'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 and `rrr' are CCL register number, `XXXXX' is one of the following
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 CCL commands. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 /* CCL commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 Each comment fields shows one or more lines for command syntax and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 the following lines for semantics of the command. In semantics, IC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 stands for Instruction Counter. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #define CCL_SetRegister 0x00 /* Set register a register value:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 1:00000000000000000RRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 reg[rrr] = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 #define CCL_SetShortConst 0x01 /* Set register a short constant value:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 reg[rrr] = CCCCCCCCCCCCCCCCCCC;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 #define CCL_SetConst 0x02 /* Set register a constant value:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 1:00000000000000000000rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 2:CONSTANT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 reg[rrr] = CONSTANT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 IC++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 #define CCL_SetArray 0x03 /* Set register an element of array:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 1:CCCCCCCCCCCCCCCCCRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 2:ELEMENT[0]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 3:ELEMENT[1]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 if (0 <= reg[RRR] < CC..C)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 reg[rrr] = ELEMENT[reg[RRR]];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 IC += CC..C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 #define CCL_Jump 0x04 /* Jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 1:A--D--D--R--E--S--S-000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 /* Note: If CC..C is greater than 0, the second code is omitted. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 #define CCL_JumpCond 0x05 /* Jump conditional:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 if (!reg[rrr])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 #define CCL_WriteRegisterJump 0x06 /* Write register and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 write (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 #define CCL_WriteRegisterReadJump 0x07 /* Write register, read, and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 2:A--D--D--R--E--S--S-rrrYYYYY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 write (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 IC++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 /* Note: If read is suspended, the resumed execution starts from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 second code (YYYYY == CCL_ReadJump). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 #define CCL_WriteConstJump 0x08 /* Write constant and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 1:A--D--D--R--E--S--S-000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 2:CONST
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 write (CONST);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 #define CCL_WriteConstReadJump 0x09 /* Write constant, read, and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 2:CONST
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 3:A--D--D--R--E--S--S-rrrYYYYY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 write (CONST);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 IC += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 /* Note: If read is suspended, the resumed execution starts from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 second code (YYYYY == CCL_ReadJump). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 #define CCL_WriteStringJump 0x0A /* Write string and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 1:A--D--D--R--E--S--S-000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 2:LENGTH
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 3:0000STRIN[0]STRIN[1]STRIN[2]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 write_string (STRING, LENGTH);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #define CCL_WriteArrayReadJump 0x0B /* Write an array element, read, and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 2:LENGTH
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 3:ELEMENET[0]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 4:ELEMENET[1]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 N:A--D--D--R--E--S--S-rrrYYYYY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 if (0 <= reg[rrr] < LENGTH)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 write (ELEMENT[reg[rrr]]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 IC += LENGTH + 2; (... pointing at N+1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* Note: If read is suspended, the resumed execution starts from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 Nth code (YYYYY == CCL_ReadJump). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 #define CCL_ReadJump 0x0C /* Read and jump:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 1:A--D--D--R--E--S--S-rrrYYYYY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 #define CCL_Branch 0x0D /* Jump by branch table:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 2:A--D--D--R--E-S-S[0]000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 3:A--D--D--R--E-S-S[1]000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 if (0 <= reg[rrr] < CC..C)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 IC += ADDRESS[reg[rrr]];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 IC += ADDRESS[CC..C];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 #define CCL_ReadRegister 0x0E /* Read bytes into registers:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 2:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 while (CCC--)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 #define CCL_WriteExprConst 0x0F /* write result of expression:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 1:00000OPERATION000RRR000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 2:CONSTANT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 write (reg[RRR] OPERATION CONSTANT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 IC++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 /* Note: If the Nth read is suspended, the resumed execution starts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 from the Nth code. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 #define CCL_ReadBranch 0x10 /* Read one byte into a register,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 and jump by branch table:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 2:A--D--D--R--E-S-S[0]000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 3:A--D--D--R--E-S-S[1]000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 read (read[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 if (0 <= reg[rrr] < CC..C)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 IC += ADDRESS[reg[rrr]];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 IC += ADDRESS[CC..C];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 #define CCL_WriteRegister 0x11 /* Write registers:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 1:CCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 2:CCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 while (CCC--)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 write (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 /* Note: If the Nth write is suspended, the resumed execution
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 starts from the Nth code. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 #define CCL_WriteExprRegister 0x12 /* Write result of expression
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 1:00000OPERATIONRrrRRR000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 write (reg[RRR] OPERATION reg[Rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 #define CCL_Call 0x13 /* Call the CCL program whose ID is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 (CC..C).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 1:CCCCCCCCCCCCCCCCCCCC000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 call (CC..C)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 #define CCL_WriteConstString 0x14 /* Write a constant or a string:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 [2:0000STRIN[0]STRIN[1]STRIN[2]]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 [...]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 if (!rrr)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 write (CC..C)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 write_string (STRING, CC..C);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 IC += (CC..C + 2) / 3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 #define CCL_WriteArray 0x15 /* Write an element of array:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 2:ELEMENT[0]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 3:ELEMENT[1]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 if (0 <= reg[rrr] < CC..C)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 write (ELEMENT[reg[rrr]]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 IC += CC..C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 #define CCL_End 0x16 /* Terminate:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 1:00000000000000000000000XXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 terminate ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 /* The following two codes execute an assignment arithmetic/logical
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 operation. The form of the operation is like REG OP= OPERAND. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 #define CCL_ExprSelfConst 0x17 /* REG OP= constant:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 1:00000OPERATION000000rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 2:CONSTANT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 reg[rrr] OPERATION= CONSTANT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 #define CCL_ExprSelfReg 0x18 /* REG1 OP= REG2:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 1:00000OPERATION000RRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 reg[rrr] OPERATION= reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 /* The following codes execute an arithmetic/logical operation. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 form of the operation is like REG_X = REG_Y OP OPERAND2. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 #define CCL_SetExprConst 0x19 /* REG_X = REG_Y OP constant:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 1:00000OPERATION000RRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 2:CONSTANT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 reg[rrr] = reg[RRR] OPERATION CONSTANT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 IC++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 #define CCL_SetExprReg 0x1A /* REG1 = REG2 OP REG3:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 1:00000OPERATIONRrrRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 reg[rrr] = reg[RRR] OPERATION reg[Rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 #define CCL_JumpCondExprConst 0x1B /* Jump conditional according to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 an operation on constant:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 2:OPERATION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 3:CONSTANT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 reg[7] = reg[rrr] OPERATION CONSTANT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 if (!(reg[7]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 IC += 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 #define CCL_JumpCondExprReg 0x1C /* Jump conditional according to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 an operation on register:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 2:OPERATION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 3:RRR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 reg[7] = reg[rrr] OPERATION reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 if (!reg[7])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 IC += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 #define CCL_ReadJumpCondExprConst 0x1D /* Read and jump conditional according
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 to an operation on constant:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 2:OPERATION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 3:CONSTANT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 reg[7] = reg[rrr] OPERATION CONSTANT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 if (!reg[7])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 IC += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 #define CCL_ReadJumpCondExprReg 0x1E /* Read and jump conditional according
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 to an operation on register:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 1:A--D--D--R--E--S--S-rrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 2:OPERATION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 3:RRR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 -----------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 read (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 reg[7] = reg[rrr] OPERATION reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 if (!reg[7])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 IC += ADDRESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 IC += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 #define CCL_Extention 0x1F /* Extended CCL code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 1:ExtendedCOMMNDRrrRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 2:ARGUEMENT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 3:...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 extended_command (rrr,RRR,Rrr,ARGS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 Here after, Extended CCL Instructions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 Bit length of extended command is 14.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 Therefore, the instruction code range is 0..16384(0x3fff).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 /* Read a multibyte characeter.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 A code point is stored into reg[rrr]. A charset ID is stored into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 reg[RRR]. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 #define CCL_ReadMultibyteChar2 0x00 /* Read Multibyte Character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 1:ExtendedCOMMNDRrrRRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 /* Write a multibyte character.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 Write a character whose code point is reg[rrr] and the charset ID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 is reg[RRR]. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 #define CCL_WriteMultibyteChar2 0x01 /* Write Multibyte Character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 1:ExtendedCOMMNDRrrRRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 /* Translate a character whose code point is reg[rrr] and the charset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 ID is reg[RRR] by a translation table whose ID is reg[Rrr].
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 A translated character is set in reg[rrr] (code point) and reg[RRR]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (charset ID). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 #define CCL_TranslateCharacter 0x02 /* Translate a multibyte character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 1:ExtendedCOMMNDRrrRRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 /* Translate a character whose code point is reg[rrr] and the charset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 ID is reg[RRR] by a translation table whose ID is ARGUMENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 A translated character is set in reg[rrr] (code point) and reg[RRR]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 (charset ID). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 #define CCL_TranslateCharacterConstTbl 0x03 /* Translate a multibyte character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 1:ExtendedCOMMNDRrrRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 2:ARGUMENT(Translation Table ID)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 /* Iterate looking up MAPs for reg[rrr] starting from the Nth (N =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 reg[RRR]) MAP until some value is found.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 Each MAP is a Lisp vector whose element is number, nil, t, or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 lambda.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 If the element is nil, ignore the map and proceed to the next map.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 If the element is t or lambda, finish without changing reg[rrr].
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 If the element is a number, set reg[rrr] to the number and finish.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 Detail of the map structure is descibed in the comment for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 CCL_MapMultiple below. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 #define CCL_IterateMultipleMap 0x10 /* Iterate multiple maps
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 1:ExtendedCOMMNDXXXRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 2:NUMBER of MAPs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 3:MAP-ID1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 4:MAP-ID2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 /* Map the code in reg[rrr] by MAPs starting from the Nth (N =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 reg[RRR]) map.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 MAPs are supplied in the succeeding CCL codes as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 When CCL program gives this nested structure of map to this command:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 ((MAP-ID11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 MAP-ID12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 (MAP-ID121 MAP-ID122 MAP-ID123)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 MAP-ID13)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 (MAP-ID21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (MAP-ID211 (MAP-ID2111) MAP-ID212)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 MAP-ID22)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 the compiled CCL codes has this sequence:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 CCL_MapMultiple (CCL code of this command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 16 (total number of MAPs and SEPARATORs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 -7 (1st SEPARATOR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 MAP-ID11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 MAP-ID12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 -3 (2nd SEPARATOR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 MAP-ID121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 MAP-ID122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 MAP-ID123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 MAP-ID13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 -7 (3rd SEPARATOR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 MAP-ID21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 -4 (4th SEPARATOR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 MAP-ID211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 -1 (5th SEPARATOR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 MAP_ID2111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 MAP-ID212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 MAP-ID22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 A value of each SEPARATOR follows this rule:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 MAP-SET := SEPARATOR [(MAP-ID | MAP-SET)]+
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 SEPARATOR := -(number of MAP-IDs and SEPARATORs in the MAP-SET)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (*)....Nest level of MAP-SET must not be over than MAX_MAP_SET_LEVEL.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 When some map fails to map (i.e. it doesn't have a value for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 reg[rrr]), the mapping is treated as identity.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 The mapping is iterated for all maps in each map set (set of maps
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 separated by SEPARATOR) except in the case that lambda is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 encountered. More precisely, the mapping proceeds as below:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 At first, VAL0 is set to reg[rrr], and it is translated by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 first map to VAL1. Then, VAL1 is translated by the next map to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 VAL2. This mapping is iterated until the last map is used. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 result of the mapping is the last value of VAL?.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 But, when VALm is mapped to VALn and VALn is not a number, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 mapping proceed as below:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 If VALn is nil, the lastest map is ignored and the mapping of VALm
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 proceed to the next map.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 In VALn is t, VALm is reverted to reg[rrr] and the mapping of VALm
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 proceed to the next map.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 If VALn is lambda, the whole mapping process terminates, and VALm
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 is the result of this mapping.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 Each map is a Lisp vector of the following format (a) or (b):
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 (a)......[STARTPOINT VAL1 VAL2 ...]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 (b)......[t VAL STARTPOINT ENDPOINT],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 STARTPOINT is an offset to be used for indexing a map,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 ENDPOINT is a maximum index number of a map,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 VAL and VALn is a number, nil, t, or lambda.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 Valid index range of a map of type (a) is:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 STARTPOINT <= index < STARTPOINT + map_size - 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 Valid index range of a map of type (b) is:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 STARTPOINT <= index < ENDPOINT */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 #define CCL_MapMultiple 0x11 /* Mapping by multiple code conversion maps
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 1:ExtendedCOMMNDXXXRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 2:N-2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 3:SEPARATOR_1 (< 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 4:MAP-ID_1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 5:MAP-ID_2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 M:SEPARATOR_x (< 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 M+1:MAP-ID_y
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 N:SEPARATOR_z (< 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 #define MAX_MAP_SET_LEVEL 20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 typedef struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 int rest_length;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 int orig_val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 } tr_stack;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 static tr_stack mapping_stack[MAX_MAP_SET_LEVEL];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 static tr_stack *mapping_stack_pointer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 #define PUSH_MAPPING_STACK(restlen, orig) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 mapping_stack_pointer->rest_length = (restlen); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 mapping_stack_pointer->orig_val = (orig); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 mapping_stack_pointer++; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 #define POP_MAPPING_STACK(restlen, orig) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 mapping_stack_pointer--; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 (restlen) = mapping_stack_pointer->rest_length; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 (orig) = mapping_stack_pointer->orig_val; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 #define CCL_MapSingle 0x12 /* Map by single code conversion map
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 1:ExtendedCOMMNDXXXRRRrrrXXXXX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 2:MAP-ID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 ------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 Map reg[rrr] by MAP-ID.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 If some valid mapping is found,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 set reg[rrr] to the result,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 set reg[RRR] to -1.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 /* CCL arithmetic/logical operators. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 #define CCL_PLUS 0x00 /* X = Y + Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 #define CCL_MINUS 0x01 /* X = Y - Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 #define CCL_MUL 0x02 /* X = Y * Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 #define CCL_DIV 0x03 /* X = Y / Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 #define CCL_MOD 0x04 /* X = Y % Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 #define CCL_AND 0x05 /* X = Y & Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 #define CCL_OR 0x06 /* X = Y | Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 #define CCL_XOR 0x07 /* X = Y ^ Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 #define CCL_LSH 0x08 /* X = Y << Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 #define CCL_RSH 0x09 /* X = Y >> Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 #define CCL_LSH8 0x0A /* X = (Y << 8) | Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 #define CCL_RSH8 0x0B /* X = Y >> 8, r[7] = Y & 0xFF */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 #define CCL_DIVMOD 0x0C /* X = Y / Z, r[7] = Y % Z */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 #define CCL_LS 0x10 /* X = (X < Y) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 #define CCL_GT 0x11 /* X = (X > Y) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 #define CCL_EQ 0x12 /* X = (X == Y) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 #define CCL_LE 0x13 /* X = (X <= Y) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 #define CCL_GE 0x14 /* X = (X >= Y) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 #define CCL_NE 0x15 /* X = (X != Y) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 #define CCL_DECODE_SJIS 0x16 /* X = HIGHER_BYTE (DE-SJIS (Y, Z))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 r[7] = LOWER_BYTE (DE-SJIS (Y, Z)) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 #define CCL_ENCODE_SJIS 0x17 /* X = HIGHER_BYTE (SJIS (Y, Z))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 r[7] = LOWER_BYTE (SJIS (Y, Z) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 /* Suspend CCL program because of reading from empty input buffer or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 writing to full output buffer. When this program is resumed, the
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
648 same I/O command is executed. The `if (1)' is for warning suppression. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 #define CCL_SUSPEND(stat) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 ic--; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 ccl->status = stat; \
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
653 if (1) goto ccl_finish; \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 /* Terminate CCL program because of invalid command. Should not occur
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
657 in the normal case. The `if (1)' is for warning suppression. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 #define CCL_INVALID_CMD \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 ccl->status = CCL_STAT_INVALID_CMD; \
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
661 if (1) goto ccl_error_handler; \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 /* Encode one character CH to multibyte form and write to the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 output buffer. If CH is less than 256, CH is written as is. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 #define CCL_WRITE_CHAR(ch) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 if (!destination) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 ccl->status = CCL_STAT_INVALID_CMD; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 goto ccl_error_handler; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 else \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 Bufbyte work[MAX_EMCHAR_LEN]; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 int len = ( ch < ( conversion_mode == CCL_MODE_ENCODING ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 256 : 128 ) ) ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 simple_set_charptr_emchar (work, ch) : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 non_ascii_set_charptr_emchar (work, ch); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 Dynarr_add_many (destination, work, len); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 /* Write a string at ccl_prog[IC] of length LEN to the current output
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 buffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 #define CCL_WRITE_STRING(len) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 if (!destination) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 ccl->status = CCL_STAT_INVALID_CMD; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 goto ccl_error_handler; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 else \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 Bufbyte work[MAX_EMCHAR_LEN]; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 for (i = 0; i < len; i++) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 int ch = (XINT (ccl_prog[ic + (i / 3)]) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 >> ((2 - (i % 3)) * 8)) & 0xFF; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 int bytes = \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 ( ch < ( conversion_mode == CCL_MODE_ENCODING ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 256 : 128 ) ) ? \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 simple_set_charptr_emchar (work, ch) : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 non_ascii_set_charptr_emchar (work, ch); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 Dynarr_add_many (destination, work, bytes); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 /* Read one byte from the current input buffer into Rth register. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 #define CCL_READ_CHAR(r) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 if (!src && !ccl->last_block) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 ccl->status = CCL_STAT_INVALID_CMD; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 goto ccl_error_handler; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 else if (src < src_end) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 r = *src++; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 else if (ccl->last_block) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 ic = ccl->eof_ic; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 goto ccl_repeat; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 else \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 /* Suspend CCL program because of \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 reading from empty input buffer or \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 writing to full output buffer. \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 When this program is resumed, the \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 same I/O command is executed. */ \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 ic--; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 ccl->status = CCL_STAT_SUSPEND_BY_SRC; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 goto ccl_finish; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 /* Execute CCL code on SRC_BYTES length text at SOURCE. The resulting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 text goes to a place pointed by DESTINATION. The bytes actually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 processed is returned as *CONSUMED. The return value is the length
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 of the resulting text. As a side effect, the contents of CCL registers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 are updated. If SOURCE or DESTINATION is NULL, only operations on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 registers are permitted. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 #ifdef CCL_DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 #define CCL_DEBUG_BACKTRACE_LEN 256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 int ccl_backtrace_table[CCL_BACKTRACE_TABLE];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 int ccl_backtrace_idx;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 struct ccl_prog_stack
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 int ic; /* Instruction Counter. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 /* For the moment, we only support depth 256 of stack. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 static struct ccl_prog_stack ccl_prog_stack_struct[256];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 ccl_driver (struct ccl_program *ccl, CONST unsigned char *source,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 unsigned_char_dynarr *destination, int src_bytes,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 int *consumed, int conversion_mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 int *reg = ccl->reg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 int ic = ccl->ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 int code = -1; /* init to illegal value, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 int field1, field2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 Lisp_Object *ccl_prog = ccl->prog;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 CONST unsigned char *src = source, *src_end = src + src_bytes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 int jump_address = 0; /* shut up the compiler */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 int i, j, op;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 int stack_idx = ccl->stack_idx;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 /* Instruction counter of the current CCL code. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 int this_ic = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 if (ic >= ccl->eof_ic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 ic = CCL_HEADER_MAIN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 #if 0 /* not for XEmacs ? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 if (ccl->buf_magnification ==0) /* We can't produce any bytes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 dst = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 #ifdef CCL_DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 ccl_backtrace_idx = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 for (;;)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 ccl_repeat:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 #ifdef CCL_DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 ccl_backtrace_table[ccl_backtrace_idx++] = ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 if (ccl_backtrace_idx >= CCL_DEBUG_BACKTRACE_LEN)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 ccl_backtrace_idx = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 ccl_backtrace_table[ccl_backtrace_idx] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 /* We can't just signal Qquit, instead break the loop as if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 the whole data is processed. Don't reset Vquit_flag, it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 must be handled later at a safer place. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 if (consumed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 src = source + src_bytes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 ccl->status = CCL_STAT_QUIT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 this_ic = ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 code = XINT (ccl_prog[ic]); ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 field1 = code >> 8;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 field2 = (code & 0xFF) >> 5;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 #define rrr field2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 #define RRR (field1 & 7)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 #define Rrr ((field1 >> 3) & 7)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 #define ADDR field1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 #define EXCMD (field1 >> 6)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 switch (code & 0x1F)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 case CCL_SetRegister: /* 00000000000000000RRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 reg[rrr] = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 case CCL_SetShortConst: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 reg[rrr] = field1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 case CCL_SetConst: /* 00000000000000000000rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 reg[rrr] = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 case CCL_SetArray: /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 j = field1 >> 3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 if ((unsigned int) i < j)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 reg[rrr] = XINT (ccl_prog[ic + i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 ic += j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 case CCL_Jump: /* A--D--D--R--E--S--S-000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 ic += ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 case CCL_JumpCond: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 if (!reg[rrr])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 ic += ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 case CCL_WriteRegisterJump: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 ic += ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 case CCL_WriteRegisterReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 ic += ADDR - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 case CCL_WriteConstJump: /* A--D--D--R--E--S--S-000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 i = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 ic += ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 case CCL_WriteConstReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 i = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 ic += ADDR - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 case CCL_WriteStringJump: /* A--D--D--R--E--S--S-000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 j = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 CCL_WRITE_STRING (j);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 ic += ADDR - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 j = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 if ((unsigned int) i < j)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 i = XINT (ccl_prog[ic + 1 + i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 ic += j + 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 ic += ADDR - (j + 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 case CCL_ReadJump: /* A--D--D--R--E--S--S-rrrYYYYY */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 ic += ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 case CCL_ReadBranch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 /* fall through ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 case CCL_Branch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 if ((unsigned int) reg[rrr] < field1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 ic += XINT (ccl_prog[ic + reg[rrr]]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 ic += XINT (ccl_prog[ic + field1]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 case CCL_ReadRegister: /* CCCCCCCCCCCCCCCCCCCCrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 if (!field1) break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 code = XINT (ccl_prog[ic]); ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 field1 = code >> 8;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 field2 = (code & 0xFF) >> 5;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 case CCL_WriteExprConst: /* 1:00000OPERATION000RRR000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 rrr = 7;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 j = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 op = field1 >> 6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 goto ccl_set_expr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 case CCL_WriteRegister: /* CCCCCCCCCCCCCCCCCCCrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 if (!field1) break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 code = XINT (ccl_prog[ic]); ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 field1 = code >> 8;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 field2 = (code & 0xFF) >> 5;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 case CCL_WriteExprRegister: /* 1:00000OPERATIONRrrRRR000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 rrr = 7;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 j = reg[Rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 op = field1 >> 6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 goto ccl_set_expr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 case CCL_Call: /* CCCCCCCCCCCCCCCCCCCC000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 Lisp_Object slot;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 if (stack_idx >= 256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 || field1 < 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 || field1 >= XVECTOR_LENGTH (Vccl_program_table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 || (slot = XVECTOR_DATA (Vccl_program_table)[field1],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 !CONSP (slot))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 || !VECTORP (XCDR (slot)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 if (stack_idx > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 ccl_prog = ccl_prog_stack_struct[0].ccl_prog;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 ic = ccl_prog_stack_struct[0].ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 ccl->status = CCL_STAT_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 goto ccl_error_handler;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 ccl_prog_stack_struct[stack_idx].ic = ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 stack_idx++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 ccl_prog = XVECTOR_DATA (XCDR (slot));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 ic = CCL_HEADER_MAIN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 case CCL_WriteConstString: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 if (!rrr)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 CCL_WRITE_CHAR (field1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 CCL_WRITE_STRING (field1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 ic += (field1 + 2) / 3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 case CCL_WriteArray: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 if ((unsigned int) i < field1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 j = XINT (ccl_prog[ic + i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 CCL_WRITE_CHAR (j);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 ic += field1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 case CCL_End: /* 0000000000000000000000XXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 if (stack_idx-- > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 ic = ccl_prog_stack_struct[stack_idx].ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 if (src)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 src = src_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 /* ccl->ic should points to this command code again to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 suppress further processing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 ic--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 /* Terminate CCL program successfully. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 ccl->status = CCL_STAT_SUCCESS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 goto ccl_finish;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 case CCL_ExprSelfConst: /* 00000OPERATION000000rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 i = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 op = field1 >> 6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 goto ccl_expr_self;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 case CCL_ExprSelfReg: /* 00000OPERATION000RRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 op = field1 >> 6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 ccl_expr_self:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 switch (op)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 case CCL_PLUS: reg[rrr] += i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 case CCL_MINUS: reg[rrr] -= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 case CCL_MUL: reg[rrr] *= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 case CCL_DIV: reg[rrr] /= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 case CCL_MOD: reg[rrr] %= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 case CCL_AND: reg[rrr] &= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 case CCL_OR: reg[rrr] |= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 case CCL_XOR: reg[rrr] ^= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 case CCL_LSH: reg[rrr] <<= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 case CCL_RSH: reg[rrr] >>= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 case CCL_LSH8: reg[rrr] <<= 8; reg[rrr] |= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 case CCL_RSH8: reg[7] = reg[rrr] & 0xFF; reg[rrr] >>= 8; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 case CCL_DIVMOD: reg[7] = reg[rrr] % i; reg[rrr] /= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 case CCL_LS: reg[rrr] = reg[rrr] < i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 case CCL_GT: reg[rrr] = reg[rrr] > i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 case CCL_EQ: reg[rrr] = reg[rrr] == i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 case CCL_LE: reg[rrr] = reg[rrr] <= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 case CCL_GE: reg[rrr] = reg[rrr] >= i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 case CCL_NE: reg[rrr] = reg[rrr] != i; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 ccl->status = CCL_STAT_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 goto ccl_error_handler;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 case CCL_SetExprConst: /* 00000OPERATION000RRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 j = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 op = field1 >> 6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 jump_address = ++ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 goto ccl_set_expr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 case CCL_SetExprReg: /* 00000OPERATIONRrrRRRrrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 j = reg[Rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 op = field1 >> 6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 jump_address = ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 goto ccl_set_expr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 case CCL_ReadJumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 op = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 jump_address = ic++ + ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 j = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 rrr = 7;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 goto ccl_set_expr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 case CCL_ReadJumpCondExprReg: /* A--D--D--R--E--S--S-rrrXXXXX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 CCL_READ_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 case CCL_JumpCondExprReg:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 op = XINT (ccl_prog[ic]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 jump_address = ic++ + ADDR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 j = reg[XINT (ccl_prog[ic])];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 rrr = 7;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 ccl_set_expr:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 switch (op)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 case CCL_PLUS: reg[rrr] = i + j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 case CCL_MINUS: reg[rrr] = i - j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 case CCL_MUL: reg[rrr] = i * j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 case CCL_DIV: reg[rrr] = i / j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 case CCL_MOD: reg[rrr] = i % j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 case CCL_AND: reg[rrr] = i & j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 case CCL_OR: reg[rrr] = i | j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 case CCL_XOR: reg[rrr] = i ^ j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 case CCL_LSH: reg[rrr] = i << j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 case CCL_RSH: reg[rrr] = i >> j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 case CCL_LSH8: reg[rrr] = (i << 8) | j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 case CCL_RSH8: reg[rrr] = i >> 8; reg[7] = i & 0xFF; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 case CCL_DIVMOD: reg[rrr] = i / j; reg[7] = i % j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 case CCL_LS: reg[rrr] = i < j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 case CCL_GT: reg[rrr] = i > j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 case CCL_EQ: reg[rrr] = i == j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 case CCL_LE: reg[rrr] = i <= j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 case CCL_GE: reg[rrr] = i >= j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 case CCL_NE: reg[rrr] = i != j; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 case CCL_DECODE_SJIS: DECODE_SJIS (i, j, reg[rrr], reg[7]); break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 case CCL_ENCODE_SJIS: ENCODE_SJIS (i, j, reg[rrr], reg[7]); break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 ccl->status = CCL_STAT_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 goto ccl_error_handler;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 code &= 0x1F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 if (code == CCL_WriteExprConst || code == CCL_WriteExprRegister)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 else if (!reg[rrr])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 ic = jump_address;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 case CCL_Extention:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 switch (EXCMD)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 case CCL_ReadMultibyteChar2:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 if (!src)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 CCL_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 do {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 if (src >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 i = *src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 if (i == LEADING_CODE_COMPOSITION)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 if (src >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 if (*src == 0xFF)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 ccl->private_state = COMPOSING_WITH_RULE_HEAD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 ccl->private_state = COMPOSING_NO_RULE_HEAD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 if (ccl->private_state != COMPOSING_NO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 /* composite character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 if (i < 0xA0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 ccl->private_state = COMPOSING_NO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 if (COMPOSING_WITH_RULE_RULE == ccl->private_state)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 ccl->private_state = COMPOSING_WITH_RULE_HEAD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 else if (COMPOSING_WITH_RULE_HEAD == ccl->private_state)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 ccl->private_state = COMPOSING_WITH_RULE_RULE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 if (i == 0xA0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 if (src >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 i = *src++ & 0x7F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 i -= 0x20;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 if (i < 0x80)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 /* ASCII */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 reg[rrr] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 reg[RRR] = LEADING_BYTE_ASCII;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 else if (i <= MAX_LEADING_BYTE_OFFICIAL_1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 if (src >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 reg[rrr] = (*src++ & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 else if (i <= MAX_LEADING_BYTE_OFFICIAL_2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 if ((src + 1) >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 i = (*src++ & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 reg[rrr] = ((i << 7) | (*src & 0x7F));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 else if (i == PRE_LEADING_BYTE_PRIVATE_1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 if ((src + 1) >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 reg[RRR] = *src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 reg[rrr] = (*src++ & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 else if (i == PRE_LEADING_BYTE_PRIVATE_2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 if ((src + 2) >= src_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 goto ccl_read_multibyte_character_suspend;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 reg[RRR] = *src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 i = (*src++ & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 reg[rrr] = ((i << 7) | (*src & 0x7F));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 src++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 /* INVALID CODE. Return a single byte character. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 reg[RRR] = LEADING_BYTE_ASCII;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 reg[rrr] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 } while (1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 ccl_read_multibyte_character_suspend:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 src--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 if (ccl->last_block)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 ic = ccl->eof_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 goto ccl_repeat;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_SRC);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 case CCL_WriteMultibyteChar2:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 i = reg[RRR]; /* charset */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 if (i == LEADING_BYTE_ASCII)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 i = reg[rrr] & 0xFF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 else if (i == CHARSET_COMPOSITION)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 i = MAKE_COMPOSITE_CHAR (reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 else if (XCHARSET_DIMENSION (CHARSET_BY_LEADING_BYTE (i)) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 i = ((i - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 | (reg[rrr] & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 else if (i < MIN_LEADING_BYTE_OFFICIAL_2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 i = ((i - FIELD1_TO_OFFICIAL_LEADING_BYTE) << 14) | reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 i = ((i - FIELD1_TO_PRIVATE_LEADING_BYTE) << 14) | reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 CCL_WRITE_CHAR (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 case CCL_TranslateCharacter:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 i = reg[RRR]; /* charset */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 if (i == LEADING_BYTE_ASCII)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 else if (i == CHARSET_COMPOSITION)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 else if (CHARSET_DIMENSION (i) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 i = ((i - 0x70) << 7) | (reg[rrr] & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 else if (i < MIN_LEADING_BYTE_OFFICIAL_2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 i = ((i - 0x8F) << 14) | (reg[rrr] & 0x3FFF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 i = ((i - 0xE0) << 14) | (reg[rrr] & 0x3FFF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 op = translate_char (GET_TRANSLATION_TABLE (reg[Rrr]),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 i, -1, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 SPLIT_CHAR (op, reg[RRR], i, j);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 if (j != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 i = (i << 7) | j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 reg[rrr] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 case CCL_TranslateCharacterConstTbl:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 op = XINT (ccl_prog[ic]); /* table */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 ic++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 i = reg[RRR]; /* charset */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 if (i == LEADING_BYTE_ASCII)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1295 i = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 else if (i == CHARSET_COMPOSITION)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 else if (CHARSET_DIMENSION (i) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 i = ((i - 0x70) << 7) | (reg[rrr] & 0x7F);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 else if (i < MIN_LEADING_BYTE_OFFICIAL_2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 i = ((i - 0x8F) << 14) | (reg[rrr] & 0x3FFF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 i = ((i - 0xE0) << 14) | (reg[rrr] & 0x3FFF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 op = translate_char (GET_TRANSLATION_TABLE (op), i, -1, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 SPLIT_CHAR (op, reg[RRR], i, j);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 if (j != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 i = (i << 7) | j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 reg[rrr] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 case CCL_IterateMultipleMap:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 Lisp_Object map, content, attrib, value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 int point, size, fin_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 j = XINT (ccl_prog[ic++]); /* number of maps. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 fin_ic = ic + j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 op = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 if ((j > reg[RRR]) && (j >= 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326 ic += reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 ic = fin_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 for (;i < j;i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 size = XVECTOR (Vcode_conversion_map_vector)->size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 point = XINT (ccl_prog[ic++]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 if (point >= size) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 map =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 XVECTOR (Vcode_conversion_map_vector)->contents[point];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 /* Check map varidity. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 if (!CONSP (map)) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 map = XCONS(map)->cdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 if (!VECTORP (map)) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 size = XVECTOR (map)->size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 if (size <= 1) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 content = XVECTOR (map)->contents[0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 /* check map type,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 [STARTPOINT VAL1 VAL2 ...] or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 [t ELELMENT STARTPOINT ENDPOINT] */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 if (NUMBERP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 point = XUINT (content);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 point = op - point + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 if (!((point >= 1) && (point < size))) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 content = XVECTOR (map)->contents[point];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 else if (EQ (content, Qt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 if (size != 4) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 if ((op >= XUINT (XVECTOR (map)->contents[2]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 && (op < XUINT (XVECTOR (map)->contents[3])))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 content = XVECTOR (map)->contents[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 if (NILP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 else if (NUMBERP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 reg[rrr] = XINT(content);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 else if (EQ (content, Qt) || EQ (content, Qlambda))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 else if (CONSP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 attrib = XCONS (content)->car;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 value = XCONS (content)->cdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 if (!NUMBERP (attrib) || !NUMBERP (value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 reg[rrr] = XUINT (value);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 if (i == j)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 ic = fin_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 case CCL_MapMultiple:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 Lisp_Object map, content, attrib, value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409 int point, size, map_vector_size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 int map_set_rest_length, fin_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 map_set_rest_length =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413 XINT (ccl_prog[ic++]); /* number of maps and separators. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 fin_ic = ic + map_set_rest_length;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 if ((map_set_rest_length > reg[RRR]) && (reg[RRR] >= 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417 ic += reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418 i = reg[RRR];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 map_set_rest_length -= i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 ic = fin_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427 mapping_stack_pointer = mapping_stack;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 op = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 PUSH_MAPPING_STACK (0, op);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 map_vector_size = XVECTOR (Vcode_conversion_map_vector)->size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 for (;map_set_rest_length > 0;i++, map_set_rest_length--)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 point = XINT(ccl_prog[ic++]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 if (point < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 point = -point;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438 if (mapping_stack_pointer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 >= &mapping_stack[MAX_MAP_SET_LEVEL])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 CCL_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 PUSH_MAPPING_STACK (map_set_rest_length - point,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 map_set_rest_length = point + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 reg[rrr] = op;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1448 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 if (point >= map_vector_size) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 map = (XVECTOR (Vcode_conversion_map_vector)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 ->contents[point]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 /* Check map varidity. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1455 if (!CONSP (map)) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 map = XCONS (map)->cdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1457 if (!VECTORP (map)) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1458 size = XVECTOR (map)->size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1459 if (size <= 1) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1460
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 content = XVECTOR (map)->contents[0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463 /* check map type,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464 [STARTPOINT VAL1 VAL2 ...] or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 [t ELEMENT STARTPOINT ENDPOINT] */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466 if (NUMBERP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 point = XUINT (content);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 point = op - point + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1470 if (!((point >= 1) && (point < size))) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 content = XVECTOR (map)->contents[point];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 else if (EQ (content, Qt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 if (size != 4) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 if ((op >= XUINT (XVECTOR (map)->contents[2])) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 (op < XUINT (XVECTOR (map)->contents[3])))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 content = XVECTOR (map)->contents[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 if (NILP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 else if (NUMBERP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 op = XINT (content);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491 i += map_set_rest_length;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 else if (CONSP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 attrib = XCONS (content)->car;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 value = XCONS (content)->cdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 if (!NUMBERP (attrib) || !NUMBERP (value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 op = XUINT (value);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 i += map_set_rest_length;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 else if (EQ (content, Qt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 op = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 i += map_set_rest_length;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 else if (EQ (content, Qlambda))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 CCL_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 ic = fin_ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 reg[rrr] = op;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524 case CCL_MapSingle:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526 Lisp_Object map, attrib, value, content;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 int size, point;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 j = XINT (ccl_prog[ic++]); /* map_id */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 op = reg[rrr];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 if (j >= XVECTOR (Vcode_conversion_map_vector)->size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 map = XVECTOR (Vcode_conversion_map_vector)->contents[j];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 if (!CONSP (map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 map = XCONS(map)->cdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 if (!VECTORP (map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 size = XVECTOR (map)->size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 point = XUINT (XVECTOR (map)->contents[0]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 point = op - point + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 reg[RRR] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 if ((size <= 1) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 (!((point >= 1) && (point < size))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 content = XVECTOR (map)->contents[point];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 if (NILP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 else if (NUMBERP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 reg[rrr] = XINT (content);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 else if (EQ (content, Qt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 reg[RRR] = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 else if (CONSP (content))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 attrib = XCONS (content)->car;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 value = XCONS (content)->cdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 if (!NUMBERP (attrib) || !NUMBERP (value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 reg[rrr] = XUINT(value);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 reg[RRR] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 CCL_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 ccl->status = CCL_STAT_INVALID_CMD;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 goto ccl_error_handler;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 ccl_error_handler:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 if (destination)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 /* We can insert an error message only if DESTINATION is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 specified and we still have a room to store the message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 there. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 char msg[256];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 #if 0 /* not for XEmacs ? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 if (!dst)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 dst = destination;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 switch (ccl->status)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 /* Terminate CCL program because of invalid command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 Should not occur in the normal case. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 case CCL_STAT_INVALID_CMD:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 sprintf(msg, "\nCCL: Invalid command %x (ccl_code = %x) at %d.",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 code & 0x1F, code, this_ic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 #ifdef CCL_DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 int i = ccl_backtrace_idx - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 int j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615 Dynarr_add_many (destination, (unsigned char *) msg, strlen (msg));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 for (j = 0; j < CCL_DEBUG_BACKTRACE_LEN; j++, i--)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 if (i < 0) i = CCL_DEBUG_BACKTRACE_LEN - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620 if (ccl_backtrace_table[i] == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 sprintf(msg, " %d", ccl_backtrace_table[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 Dynarr_add_many (destination, (unsigned char *) msg, strlen (msg));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 goto ccl_finish;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 case CCL_STAT_QUIT:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 sprintf(msg, "\nCCL: Quited.");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635 sprintf(msg, "\nCCL: Unknown error type (%d).", ccl->status);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 Dynarr_add_many (destination, (unsigned char *) msg, strlen (msg));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 ccl_finish:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 ccl->ic = ic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 ccl->stack_idx = stack_idx;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 ccl->prog = ccl_prog;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 if (consumed) *consumed = src - source;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 if (destination)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1647 return Dynarr_length (destination);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 /* Setup fields of the structure pointed by CCL appropriately for the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 execution of compiled CCL code in VEC (vector of integer).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 If VEC is nil, we skip setting ups based on VEC. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 setup_ccl_program (struct ccl_program *ccl, Lisp_Object vec)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 if (VECTORP (vec))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 ccl->size = XVECTOR_LENGTH (vec);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 ccl->prog = XVECTOR_DATA (vec);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 ccl->eof_ic = XINT (XVECTOR_DATA (vec)[CCL_HEADER_EOF]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 ccl->buf_magnification = XINT (XVECTOR_DATA (vec)[CCL_HEADER_BUF_MAG]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 ccl->ic = CCL_HEADER_MAIN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 for (i = 0; i < 8; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 ccl->reg[i] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 ccl->last_block = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 ccl->private_state = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 ccl->status = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 ccl->stack_idx = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1675
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676 /* Resolve symbols in the specified CCL code (Lisp vector). This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 function converts symbols of code conversion maps and character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678 translation tables embeded in the CCL code into their ID numbers. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1681 resolve_symbol_ccl_program (Lisp_Object ccl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 int i, veclen;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 Lisp_Object result, contents /*, prop */;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 result = ccl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1687 veclen = XVECTOR_LENGTH (result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1688
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1689 /* Set CCL program's table ID */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 for (i = 0; i < veclen; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692 contents = XVECTOR_DATA (result)[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 if (SYMBOLP (contents))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 if (EQ(result, ccl))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1696 result = Fcopy_sequence (ccl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1697
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1699 prop = Fget (contents, Qtranslation_table_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 if (NUMBERP (prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 XVECTOR_DATA (result)[i] = prop;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 prop = Fget (contents, Qcode_conversion_map_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 if (NUMBERP (prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 XVECTOR_DATA (result)[i] = prop;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 prop = Fget (contents, Qccl_program_idx);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1712 if (NUMBERP (prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 XVECTOR_DATA (result)[i] = prop;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 DEFUN ("ccl-execute", Fccl_execute, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 Execute CCL-PROGRAM with registers initialized by REGISTERS.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 CCL-PROGRAM is a symbol registered by register-ccl-program,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 or a compiled code generated by `ccl-compile' (for backward compatibility,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 in this case, the execution is slower).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 No I/O commands should appear in CCL-PROGRAM.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 REGISTERS is a vector of [R0 R1 ... R7] where RN is an initial value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 of Nth register.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 As side effect, each element of REGISTER holds the value of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 corresponding register after the execution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 (ccl_prog, reg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 struct ccl_program ccl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 Lisp_Object ccl_id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 if (SYMBOLP (ccl_prog) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 !NILP (ccl_id = Fget (ccl_prog, Qccl_program_idx, Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 ccl_prog = XVECTOR_DATA (Vccl_program_table)[XUINT (ccl_id)];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 CHECK_LIST (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 ccl_prog = XCDR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 CHECK_VECTOR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 CHECK_VECTOR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758 ccl_prog = resolve_symbol_ccl_program (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 CHECK_VECTOR (reg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 if (XVECTOR_LENGTH (reg) != 8)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 error ("Invalid length of vector REGISTERS");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 setup_ccl_program (&ccl, ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 for (i = 0; i < 8; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1767 ccl.reg[i] = (INTP (XVECTOR_DATA (reg)[i])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1768 ? XINT (XVECTOR_DATA (reg)[i])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 : 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 ccl_driver (&ccl, (CONST unsigned char *)0, (unsigned_char_dynarr *)0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 0, (int *)0, CCL_MODE_ENCODING);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773 QUIT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 if (ccl.status != CCL_STAT_SUCCESS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 error ("Error in CCL program at %dth code", ccl.ic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 for (i = 0; i < 8; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 XSETINT (XVECTOR_DATA (reg)[i], ccl.reg[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1779 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 DEFUN ("ccl-execute-on-string", Fccl_execute_on_string, 3, 4, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1783 Execute CCL-PROGRAM with initial STATUS on STRING.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785 CCL-PROGRAM is a symbol registered by register-ccl-program,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786 or a compiled code generated by `ccl-compile' (for backward compatibility,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 in this case, the execution is slower).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 Read buffer is set to STRING, and write buffer is allocated automatically.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 If IC is nil, it is initialized to head of the CCL program.\n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 STATUS is a vector of [R0 R1 ... R7 IC], where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 R0..R7 are initial values of corresponding registers,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 IC is the instruction counter specifying from where to start the program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 If R0..R7 are nil, they are initialized to 0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 If IC is nil, it is initialized to head of the CCL program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 If optional 4th arg CONTINUE is non-nil, keep IC on read operation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1799 when read buffer is exausted, else, IC is always set to the end of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800 CCL-PROGRAM on exit.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1802 It returns the contents of write buffer as a string,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1803 and as side effect, STATUS is updated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805 (ccl_prog, status, str, contin))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1806 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 Lisp_Object val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 struct ccl_program ccl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 int i, produced;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 unsigned_char_dynarr *outbuf;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811 struct gcpro gcpro1, gcpro2, gcpro3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812 Lisp_Object ccl_id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814 if (SYMBOLP (ccl_prog) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1815 !NILP (ccl_id = Fget (ccl_prog, Qccl_program_idx, Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817 ccl_prog = XVECTOR (Vccl_program_table)->contents[XUINT (ccl_id)];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1818 CHECK_LIST (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 ccl_prog = XCDR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 CHECK_VECTOR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1824 CHECK_VECTOR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 ccl_prog = resolve_symbol_ccl_program (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 CHECK_VECTOR (status);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 if (XVECTOR_LENGTH (status) != 9)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 signal_simple_error ("Vector should be of length 9", status);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831 CHECK_STRING (str);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 GCPRO3 (ccl_prog, status, str);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834 setup_ccl_program (&ccl, ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 for (i = 0; i < 8; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 if (NILP (XVECTOR_DATA (status)[i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 XSETINT (XVECTOR_DATA (status)[i], 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 if (INTP (XVECTOR_DATA (status)[i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 ccl.reg[i] = XINT (XVECTOR_DATA (status)[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 if (INTP (XVECTOR_DATA (status)[8]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844 i = XINT (XVECTOR_DATA (status)[8]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 if (ccl.ic < i && i < ccl.size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 ccl.ic = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 outbuf = Dynarr_new (unsigned_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 ccl.last_block = NILP (contin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850 produced = ccl_driver (&ccl, XSTRING_DATA (str), outbuf,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 XSTRING_LENGTH (str), (int *)0, CCL_MODE_DECODING);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 for (i = 0; i < 8; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 XVECTOR_DATA (status)[i] = make_int(ccl.reg[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 XSETINT (XVECTOR_DATA (status)[8], ccl.ic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 val = make_string (Dynarr_atp (outbuf, 0), produced);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 Dynarr_free (outbuf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 QUIT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 if (ccl.status != CCL_STAT_SUCCESS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 && ccl.status != CCL_STAT_SUSPEND_BY_SRC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 && ccl.status != CCL_STAT_SUSPEND_BY_DST)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863 error ("Error in CCL program at %dth code", ccl.ic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865 return val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 DEFUN ("register-ccl-program", Fregister_ccl_program, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 Register CCL program PROGRAM of NAME in `ccl-program-table'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 PROGRAM should be a compiled code of CCL program, or nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 Return index number of the registered CCL program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 (name, ccl_prog))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 int len = XVECTOR_LENGTH (Vccl_program_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 CHECK_SYMBOL (name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879 if (!NILP (ccl_prog))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 CHECK_VECTOR (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882 ccl_prog = resolve_symbol_ccl_program (ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885 for (i = 0; i < len; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 Lisp_Object slot = XVECTOR_DATA (Vccl_program_table)[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889 if (!CONSP (slot))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 if (EQ (name, XCAR (slot)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894 XCDR (slot) = ccl_prog;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 return make_int (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 if (i == len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 Lisp_Object new_table = Fmake_vector (make_int (len * 2), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 int j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 for (j = 0; j < len; j++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 XVECTOR_DATA (new_table)[j]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 = XVECTOR_DATA (Vccl_program_table)[j];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 Vccl_program_table = new_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 XVECTOR_DATA (Vccl_program_table)[i] = Fcons (name, ccl_prog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 Fput (name, Qccl_program_idx, make_int (i));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 return make_int (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 /* Register code conversion map.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917 A code conversion map consists of numbers, Qt, Qnil, and Qlambda.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 The first element is start code point.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 The rest elements are mapped numbers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 Symbol t means to map to an original number before mapping.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 Symbol nil means that the corresponding element is empty.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 Symbol lambda menas to terminate mapping here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 DEFUN ("register-code-conversion-map", Fregister_code_conversion_map,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 Sregister_code_conversion_map,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 2, 2, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 "Register SYMBOL as code conversion map MAP.\n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 Return index number of the registered map.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 (symbol, map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931 Lisp_Object symbol, map;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 int len = XVECTOR (Vcode_conversion_map_vector)->size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 Lisp_Object index;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 CHECK_SYMBOL (symbol, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 CHECK_VECTOR (map, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 for (i = 0; i < len; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 Lisp_Object slot = XVECTOR (Vcode_conversion_map_vector)->contents[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 if (!CONSP (slot))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 if (EQ (symbol, XCONS (slot)->car))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 index = make_int (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 XCONS (slot)->cdr = map;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951 Fput (symbol, Qcode_conversion_map, map);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 Fput (symbol, Qcode_conversion_map_id, index);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 return index;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 if (i == len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1958 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959 Lisp_Object new_vector = Fmake_vector (make_int (len * 2), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 int j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1961
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 for (j = 0; j < len; j++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963 XVECTOR (new_vector)->contents[j]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 = XVECTOR (Vcode_conversion_map_vector)->contents[j];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1965 Vcode_conversion_map_vector = new_vector;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 index = make_int (i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 Fput (symbol, Qcode_conversion_map, map);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 Fput (symbol, Qcode_conversion_map_id, index);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 XVECTOR (Vcode_conversion_map_vector)->contents[i] = Fcons (symbol, map);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 return index;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 syms_of_mule_ccl (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 DEFSUBR (Fccl_execute);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 DEFSUBR (Fccl_execute_on_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 DEFSUBR (Fregister_ccl_program);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 DEFSUBR (&Fregister_code_conversion_map);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 vars_of_mule_ccl (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 staticpro (&Vccl_program_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 Vccl_program_table = Fmake_vector (make_int (32), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 Qccl_program = intern ("ccl-program");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 staticpro (&Qccl_program);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 Qccl_program_idx = intern ("ccl-program-idx");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998 staticpro (&Qccl_program_idx);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 Qcode_conversion_map = intern ("code-conversion-map");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 staticpro (&Qcode_conversion_map);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 Qcode_conversion_map_id = intern ("code-conversion-map-id");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 staticpro (&Qcode_conversion_map_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 DEFVAR_LISP ("code-conversion-map-vector", &Vcode_conversion_map_vector /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008 Vector of code conversion maps.*/ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 Vcode_conversion_map_vector = Fmake_vector (make_int (16), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012 DEFVAR_LISP ("font-ccl-encoder-alist", &Vfont_ccl_encoder_alist /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 Alist of fontname patterns vs corresponding CCL program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 Each element looks like (REGEXP . CCL-CODE),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 where CCL-CODE is a compiled CCL program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2016 When a font whose name matches REGEXP is used for displaying a character,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 CCL-CODE is executed to calculate the code point in the font
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018 from the charset number and position code(s) of the character which are set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 in CCL registers R0, R1, and R2 before the execution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2020 The code point in the font is set in CCL registers R1 and R2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2021 when the execution terminated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 If the font is single-byte font, the register R2 is not used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 Vfont_ccl_encoder_alist = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 #endif /* emacs */