Mercurial > emacs
annotate src/ccl.c @ 89475:d6468503c001
(utf-16-be): Make it an alias of utf-16be-with-signature.
(utf-16-le): Make it an alias of utf-16be-with-signature.
(utf-16-be-with-signature, utf-16-le-with-signature): Remove these
coding system aliases.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sun, 22 Jun 2003 23:27:03 +0000 |
parents | 0888fb1bda3f |
children | 2f877ed80fa6 |
rev | line source |
---|---|
17052 | 1 /* CCL (Code Conversion Language) interpreter. |
18341
33e78cc7f058
Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents:
17828
diff
changeset
|
2 Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. |
37765
0a94387bba65
Add copyright notice for FSF.
Gerd Moellmann <gerd@gnu.org>
parents:
37734
diff
changeset
|
3 Copyright (C) 2001 Free Software Foundation, Inc. |
18341
33e78cc7f058
Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents:
17828
diff
changeset
|
4 Licensed to the Free Software Foundation. |
88361 | 5 Copyright (C) 2001, 2002 |
6 National Institute of Advanced Industrial Science and Technology (AIST) | |
7 Registration Number H13PRO009 | |
17052 | 8 |
17071 | 9 This file is part of GNU Emacs. |
10 | |
11 GNU Emacs is free software; you can redistribute it and/or modify | |
12 it under the terms of the GNU General Public License as published by | |
13 the Free Software Foundation; either version 2, or (at your option) | |
14 any later version. | |
17052 | 15 |
17071 | 16 GNU Emacs is distributed in the hope that it will be useful, |
17 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 GNU General Public License for more details. | |
17052 | 20 |
17071 | 21 You should have received a copy of the GNU General Public License |
22 along with GNU Emacs; see the file COPYING. If not, write to | |
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 Boston, MA 02111-1307, USA. */ | |
17052 | 25 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25662
diff
changeset
|
26 #include <config.h> |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25662
diff
changeset
|
27 |
17052 | 28 #include <stdio.h> |
29 | |
30 #include "lisp.h" | |
88361 | 31 #include "character.h" |
17052 | 32 #include "charset.h" |
33 #include "ccl.h" | |
34 #include "coding.h" | |
35 | |
88361 | 36 Lisp_Object Qccl, Qcclp; |
37 | |
22718 | 38 /* This contains all code conversion map available to CCL. */ |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
39 Lisp_Object Vcode_conversion_map_vector; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
40 |
17052 | 41 /* Alist of fontname patterns vs corresponding CCL program. */ |
42 Lisp_Object Vfont_ccl_encoder_alist; | |
43 | |
21551 | 44 /* This symbol is a property which assocates with ccl program vector. |
45 Ex: (get 'ccl-big5-encoder 'ccl-program) returns ccl program vector. */ | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
46 Lisp_Object Qccl_program; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
47 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
48 /* These symbols are properties which associate with code conversion |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
49 map and their ID respectively. */ |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
50 Lisp_Object Qcode_conversion_map; |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
51 Lisp_Object Qcode_conversion_map_id; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
52 |
21551 | 53 /* Symbols of ccl program have this property, a value of the property |
54 is an index for Vccl_protram_table. */ | |
55 Lisp_Object Qccl_program_idx; | |
56 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
57 /* Table of registered CCL programs. Each element is a vector of |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
58 NAME, CCL_PROG, and RESOLVEDP where NAME (symbol) is the name of |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
59 the program, CCL_PROG (vector) is the compiled code of the program, |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
60 RESOLVEDP (t or nil) is the flag to tell if symbols in CCL_PROG is |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
61 already resolved to index numbers or not. */ |
17052 | 62 Lisp_Object Vccl_program_table; |
63 | |
88925
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
64 /* Vector of registered hash tables for translation. */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
65 Lisp_Object Vtranslation_hash_table_vector; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
66 |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
67 /* Return a hash table of id number ID. */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
68 #define GET_HASH_TABLE(id) \ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
69 (XHASH_TABLE (XCDR(XVECTOR(Vtranslation_hash_table_vector)->contents[(id)]))) |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
70 /* Copied from fns.c. */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
71 #define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1) |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
72 |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
73 extern int charset_unicode; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
74 |
17052 | 75 /* CCL (Code Conversion Language) is a simple language which has |
76 operations on one input buffer, one output buffer, and 7 registers. | |
77 The syntax of CCL is described in `ccl.el'. Emacs Lisp function | |
78 `ccl-compile' compiles a CCL program and produces a CCL code which | |
79 is a vector of integers. The structure of this vector is as | |
80 follows: The 1st element: buffer-magnification, a factor for the | |
81 size of output buffer compared with the size of input buffer. The | |
82 2nd element: address of CCL code to be executed when encountered | |
83 with end of input stream. The 3rd and the remaining elements: CCL | |
84 codes. */ | |
85 | |
86 /* Header of CCL compiled code */ | |
87 #define CCL_HEADER_BUF_MAG 0 | |
88 #define CCL_HEADER_EOF 1 | |
89 #define CCL_HEADER_MAIN 2 | |
90 | |
91 /* CCL code is a sequence of 28-bit non-negative integers (i.e. the | |
92 MSB is always 0), each contains CCL command and/or arguments in the | |
93 following format: | |
94 | |
95 |----------------- integer (28-bit) ------------------| | |
96 |------- 17-bit ------|- 3-bit --|- 3-bit --|- 5-bit -| | |
97 |--constant argument--|-register-|-register-|-command-| | |
98 ccccccccccccccccc RRR rrr XXXXX | |
99 or | |
100 |------- relative address -------|-register-|-command-| | |
101 cccccccccccccccccccc rrr XXXXX | |
102 or | |
103 |------------- constant or other args ----------------| | |
104 cccccccccccccccccccccccccccc | |
105 | |
106 where, `cc...c' is a non-negative integer indicating constant value | |
107 (the left most `c' is always 0) or an absolute jump address, `RRR' | |
108 and `rrr' are CCL register number, `XXXXX' is one of the following | |
109 CCL commands. */ | |
110 | |
111 /* CCL commands | |
112 | |
113 Each comment fields shows one or more lines for command syntax and | |
114 the following lines for semantics of the command. In semantics, IC | |
115 stands for Instruction Counter. */ | |
116 | |
117 #define CCL_SetRegister 0x00 /* Set register a register value: | |
118 1:00000000000000000RRRrrrXXXXX | |
119 ------------------------------ | |
120 reg[rrr] = reg[RRR]; | |
121 */ | |
122 | |
123 #define CCL_SetShortConst 0x01 /* Set register a short constant value: | |
124 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
125 ------------------------------ | |
126 reg[rrr] = CCCCCCCCCCCCCCCCCCC; | |
127 */ | |
128 | |
129 #define CCL_SetConst 0x02 /* Set register a constant value: | |
130 1:00000000000000000000rrrXXXXX | |
131 2:CONSTANT | |
132 ------------------------------ | |
133 reg[rrr] = CONSTANT; | |
134 IC++; | |
135 */ | |
136 | |
137 #define CCL_SetArray 0x03 /* Set register an element of array: | |
138 1:CCCCCCCCCCCCCCCCCRRRrrrXXXXX | |
139 2:ELEMENT[0] | |
140 3:ELEMENT[1] | |
141 ... | |
142 ------------------------------ | |
143 if (0 <= reg[RRR] < CC..C) | |
144 reg[rrr] = ELEMENT[reg[RRR]]; | |
145 IC += CC..C; | |
146 */ | |
147 | |
148 #define CCL_Jump 0x04 /* Jump: | |
149 1:A--D--D--R--E--S--S-000XXXXX | |
150 ------------------------------ | |
151 IC += ADDRESS; | |
152 */ | |
153 | |
154 /* Note: If CC..C is greater than 0, the second code is omitted. */ | |
155 | |
156 #define CCL_JumpCond 0x05 /* Jump conditional: | |
157 1:A--D--D--R--E--S--S-rrrXXXXX | |
158 ------------------------------ | |
159 if (!reg[rrr]) | |
160 IC += ADDRESS; | |
161 */ | |
162 | |
163 | |
164 #define CCL_WriteRegisterJump 0x06 /* Write register and jump: | |
165 1:A--D--D--R--E--S--S-rrrXXXXX | |
166 ------------------------------ | |
167 write (reg[rrr]); | |
168 IC += ADDRESS; | |
169 */ | |
170 | |
171 #define CCL_WriteRegisterReadJump 0x07 /* Write register, read, and jump: | |
172 1:A--D--D--R--E--S--S-rrrXXXXX | |
173 2:A--D--D--R--E--S--S-rrrYYYYY | |
174 ----------------------------- | |
175 write (reg[rrr]); | |
176 IC++; | |
177 read (reg[rrr]); | |
178 IC += ADDRESS; | |
179 */ | |
180 /* Note: If read is suspended, the resumed execution starts from the | |
181 second code (YYYYY == CCL_ReadJump). */ | |
182 | |
183 #define CCL_WriteConstJump 0x08 /* Write constant and jump: | |
184 1:A--D--D--R--E--S--S-000XXXXX | |
185 2:CONST | |
186 ------------------------------ | |
187 write (CONST); | |
188 IC += ADDRESS; | |
189 */ | |
190 | |
191 #define CCL_WriteConstReadJump 0x09 /* Write constant, read, and jump: | |
192 1:A--D--D--R--E--S--S-rrrXXXXX | |
193 2:CONST | |
194 3:A--D--D--R--E--S--S-rrrYYYYY | |
195 ----------------------------- | |
196 write (CONST); | |
197 IC += 2; | |
198 read (reg[rrr]); | |
199 IC += ADDRESS; | |
200 */ | |
201 /* Note: If read is suspended, the resumed execution starts from the | |
202 second code (YYYYY == CCL_ReadJump). */ | |
203 | |
204 #define CCL_WriteStringJump 0x0A /* Write string and jump: | |
205 1:A--D--D--R--E--S--S-000XXXXX | |
206 2:LENGTH | |
207 3:0000STRIN[0]STRIN[1]STRIN[2] | |
208 ... | |
209 ------------------------------ | |
210 write_string (STRING, LENGTH); | |
211 IC += ADDRESS; | |
212 */ | |
213 | |
214 #define CCL_WriteArrayReadJump 0x0B /* Write an array element, read, and jump: | |
215 1:A--D--D--R--E--S--S-rrrXXXXX | |
216 2:LENGTH | |
217 3:ELEMENET[0] | |
218 4:ELEMENET[1] | |
219 ... | |
220 N:A--D--D--R--E--S--S-rrrYYYYY | |
221 ------------------------------ | |
222 if (0 <= reg[rrr] < LENGTH) | |
223 write (ELEMENT[reg[rrr]]); | |
224 IC += LENGTH + 2; (... pointing at N+1) | |
225 read (reg[rrr]); | |
226 IC += ADDRESS; | |
227 */ | |
228 /* Note: If read is suspended, the resumed execution starts from the | |
17323
15fa68d983e7
(ccl_driver): Fix bug of the case CCL_WriteArrayReadJump.
Kenichi Handa <handa@m17n.org>
parents:
17122
diff
changeset
|
229 Nth code (YYYYY == CCL_ReadJump). */ |
17052 | 230 |
231 #define CCL_ReadJump 0x0C /* Read and jump: | |
232 1:A--D--D--R--E--S--S-rrrYYYYY | |
233 ----------------------------- | |
234 read (reg[rrr]); | |
235 IC += ADDRESS; | |
236 */ | |
237 | |
238 #define CCL_Branch 0x0D /* Jump by branch table: | |
239 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
240 2:A--D--D--R--E-S-S[0]000XXXXX | |
241 3:A--D--D--R--E-S-S[1]000XXXXX | |
242 ... | |
243 ------------------------------ | |
244 if (0 <= reg[rrr] < CC..C) | |
245 IC += ADDRESS[reg[rrr]]; | |
246 else | |
247 IC += ADDRESS[CC..C]; | |
248 */ | |
249 | |
250 #define CCL_ReadRegister 0x0E /* Read bytes into registers: | |
251 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
252 2:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
253 ... | |
254 ------------------------------ | |
255 while (CCC--) | |
256 read (reg[rrr]); | |
257 */ | |
258 | |
259 #define CCL_WriteExprConst 0x0F /* write result of expression: | |
260 1:00000OPERATION000RRR000XXXXX | |
261 2:CONSTANT | |
262 ------------------------------ | |
263 write (reg[RRR] OPERATION CONSTANT); | |
264 IC++; | |
265 */ | |
266 | |
267 /* Note: If the Nth read is suspended, the resumed execution starts | |
268 from the Nth code. */ | |
269 | |
270 #define CCL_ReadBranch 0x10 /* Read one byte into a register, | |
271 and jump by branch table: | |
272 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
273 2:A--D--D--R--E-S-S[0]000XXXXX | |
274 3:A--D--D--R--E-S-S[1]000XXXXX | |
275 ... | |
276 ------------------------------ | |
277 read (read[rrr]); | |
278 if (0 <= reg[rrr] < CC..C) | |
279 IC += ADDRESS[reg[rrr]]; | |
280 else | |
281 IC += ADDRESS[CC..C]; | |
282 */ | |
283 | |
284 #define CCL_WriteRegister 0x11 /* Write registers: | |
285 1:CCCCCCCCCCCCCCCCCCCrrrXXXXX | |
286 2:CCCCCCCCCCCCCCCCCCCrrrXXXXX | |
287 ... | |
288 ------------------------------ | |
289 while (CCC--) | |
290 write (reg[rrr]); | |
291 ... | |
292 */ | |
293 | |
294 /* Note: If the Nth write is suspended, the resumed execution | |
295 starts from the Nth code. */ | |
296 | |
297 #define CCL_WriteExprRegister 0x12 /* Write result of expression | |
298 1:00000OPERATIONRrrRRR000XXXXX | |
299 ------------------------------ | |
300 write (reg[RRR] OPERATION reg[Rrr]); | |
301 */ | |
302 | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
303 #define CCL_Call 0x13 /* Call the CCL program whose ID is |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
304 CC..C or cc..c. |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
305 1:CCCCCCCCCCCCCCCCCCCCFFFXXXXX |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
306 [2:00000000cccccccccccccccccccc] |
17052 | 307 ------------------------------ |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
308 if (FFF) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
309 call (cc..c) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
310 IC++; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
311 else |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
312 call (CC..C) |
17052 | 313 */ |
314 | |
315 #define CCL_WriteConstString 0x14 /* Write a constant or a string: | |
316 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
317 [2:0000STRIN[0]STRIN[1]STRIN[2]] | |
318 [...] | |
319 ----------------------------- | |
320 if (!rrr) | |
321 write (CC..C) | |
322 else | |
323 write_string (STRING, CC..C); | |
324 IC += (CC..C + 2) / 3; | |
325 */ | |
326 | |
327 #define CCL_WriteArray 0x15 /* Write an element of array: | |
328 1:CCCCCCCCCCCCCCCCCCCCrrrXXXXX | |
329 2:ELEMENT[0] | |
330 3:ELEMENT[1] | |
331 ... | |
332 ------------------------------ | |
333 if (0 <= reg[rrr] < CC..C) | |
334 write (ELEMENT[reg[rrr]]); | |
335 IC += CC..C; | |
336 */ | |
337 | |
338 #define CCL_End 0x16 /* Terminate: | |
339 1:00000000000000000000000XXXXX | |
340 ------------------------------ | |
341 terminate (); | |
342 */ | |
343 | |
344 /* The following two codes execute an assignment arithmetic/logical | |
345 operation. The form of the operation is like REG OP= OPERAND. */ | |
346 | |
347 #define CCL_ExprSelfConst 0x17 /* REG OP= constant: | |
348 1:00000OPERATION000000rrrXXXXX | |
349 2:CONSTANT | |
350 ------------------------------ | |
351 reg[rrr] OPERATION= CONSTANT; | |
352 */ | |
353 | |
354 #define CCL_ExprSelfReg 0x18 /* REG1 OP= REG2: | |
355 1:00000OPERATION000RRRrrrXXXXX | |
356 ------------------------------ | |
357 reg[rrr] OPERATION= reg[RRR]; | |
358 */ | |
359 | |
360 /* The following codes execute an arithmetic/logical operation. The | |
361 form of the operation is like REG_X = REG_Y OP OPERAND2. */ | |
362 | |
363 #define CCL_SetExprConst 0x19 /* REG_X = REG_Y OP constant: | |
364 1:00000OPERATION000RRRrrrXXXXX | |
365 2:CONSTANT | |
366 ------------------------------ | |
367 reg[rrr] = reg[RRR] OPERATION CONSTANT; | |
368 IC++; | |
369 */ | |
370 | |
371 #define CCL_SetExprReg 0x1A /* REG1 = REG2 OP REG3: | |
372 1:00000OPERATIONRrrRRRrrrXXXXX | |
373 ------------------------------ | |
374 reg[rrr] = reg[RRR] OPERATION reg[Rrr]; | |
375 */ | |
376 | |
377 #define CCL_JumpCondExprConst 0x1B /* Jump conditional according to | |
378 an operation on constant: | |
379 1:A--D--D--R--E--S--S-rrrXXXXX | |
380 2:OPERATION | |
381 3:CONSTANT | |
382 ----------------------------- | |
383 reg[7] = reg[rrr] OPERATION CONSTANT; | |
384 if (!(reg[7])) | |
385 IC += ADDRESS; | |
386 else | |
387 IC += 2 | |
388 */ | |
389 | |
390 #define CCL_JumpCondExprReg 0x1C /* Jump conditional according to | |
391 an operation on register: | |
392 1:A--D--D--R--E--S--S-rrrXXXXX | |
393 2:OPERATION | |
394 3:RRR | |
395 ----------------------------- | |
396 reg[7] = reg[rrr] OPERATION reg[RRR]; | |
397 if (!reg[7]) | |
398 IC += ADDRESS; | |
399 else | |
400 IC += 2; | |
401 */ | |
402 | |
403 #define CCL_ReadJumpCondExprConst 0x1D /* Read and jump conditional according | |
404 to an operation on constant: | |
405 1:A--D--D--R--E--S--S-rrrXXXXX | |
406 2:OPERATION | |
407 3:CONSTANT | |
408 ----------------------------- | |
409 read (reg[rrr]); | |
410 reg[7] = reg[rrr] OPERATION CONSTANT; | |
411 if (!reg[7]) | |
412 IC += ADDRESS; | |
413 else | |
414 IC += 2; | |
415 */ | |
416 | |
417 #define CCL_ReadJumpCondExprReg 0x1E /* Read and jump conditional according | |
418 to an operation on register: | |
419 1:A--D--D--R--E--S--S-rrrXXXXX | |
420 2:OPERATION | |
421 3:RRR | |
422 ----------------------------- | |
423 read (reg[rrr]); | |
424 reg[7] = reg[rrr] OPERATION reg[RRR]; | |
425 if (!reg[7]) | |
426 IC += ADDRESS; | |
427 else | |
428 IC += 2; | |
429 */ | |
430 | |
35328
f4c8b11d4d36
(CCL_Extension): Fix typo (originally CCL_Extention). Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
35322
diff
changeset
|
431 #define CCL_Extension 0x1F /* Extended CCL code |
17052 | 432 1:ExtendedCOMMNDRrrRRRrrrXXXXX |
433 2:ARGUEMENT | |
434 3:... | |
435 ------------------------------ | |
436 extended_command (rrr,RRR,Rrr,ARGS) | |
437 */ | |
438 | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
439 /* |
21551 | 440 Here after, Extended CCL Instructions. |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
441 Bit length of extended command is 14. |
21551 | 442 Therefore, the instruction code range is 0..16384(0x3fff). |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
443 */ |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
444 |
21551 | 445 /* Read a multibyte characeter. |
446 A code point is stored into reg[rrr]. A charset ID is stored into | |
447 reg[RRR]. */ | |
448 | |
449 #define CCL_ReadMultibyteChar2 0x00 /* Read Multibyte Character | |
450 1:ExtendedCOMMNDRrrRRRrrrXXXXX */ | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
451 |
21551 | 452 /* Write a multibyte character. |
453 Write a character whose code point is reg[rrr] and the charset ID | |
454 is reg[RRR]. */ | |
455 | |
456 #define CCL_WriteMultibyteChar2 0x01 /* Write Multibyte Character | |
457 1:ExtendedCOMMNDRrrRRRrrrXXXXX */ | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
458 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
459 /* Translate a character whose code point is reg[rrr] and the charset |
22186
fc4aaf1b1772
Change term "character translation table" to "translation table".
Kenichi Handa <handa@m17n.org>
parents:
22122
diff
changeset
|
460 ID is reg[RRR] by a translation table whose ID is reg[Rrr]. |
21551 | 461 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
462 A translated character is set in reg[rrr] (code point) and reg[RRR] |
21551 | 463 (charset ID). */ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
464 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
465 #define CCL_TranslateCharacter 0x02 /* Translate a multibyte character |
21551 | 466 1:ExtendedCOMMNDRrrRRRrrrXXXXX */ |
467 | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
468 /* Translate a character whose code point is reg[rrr] and the charset |
22186
fc4aaf1b1772
Change term "character translation table" to "translation table".
Kenichi Handa <handa@m17n.org>
parents:
22122
diff
changeset
|
469 ID is reg[RRR] by a translation table whose ID is ARGUMENT. |
21551 | 470 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
471 A translated character is set in reg[rrr] (code point) and reg[RRR] |
21551 | 472 (charset ID). */ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
473 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
474 #define CCL_TranslateCharacterConstTbl 0x03 /* Translate a multibyte character |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
475 1:ExtendedCOMMNDRrrRRRrrrXXXXX |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
476 2:ARGUMENT(Translation Table ID) |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
477 */ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
478 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
479 /* Iterate looking up MAPs for reg[rrr] starting from the Nth (N = |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
480 reg[RRR]) MAP until some value is found. |
21551 | 481 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
482 Each MAP is a Lisp vector whose element is number, nil, t, or |
21551 | 483 lambda. |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
484 If the element is nil, ignore the map and proceed to the next map. |
21551 | 485 If the element is t or lambda, finish without changing reg[rrr]. |
486 If the element is a number, set reg[rrr] to the number and finish. | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
487 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
488 Detail of the map structure is descibed in the comment for |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
489 CCL_MapMultiple below. */ |
21551 | 490 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
491 #define CCL_IterateMultipleMap 0x10 /* Iterate multiple maps |
21551 | 492 1:ExtendedCOMMNDXXXRRRrrrXXXXX |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
493 2:NUMBER of MAPs |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
494 3:MAP-ID1 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
495 4:MAP-ID2 |
21551 | 496 ... |
497 */ | |
498 | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
499 /* Map the code in reg[rrr] by MAPs starting from the Nth (N = |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
500 reg[RRR]) map. |
21551 | 501 |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
502 MAPs are supplied in the succeeding CCL codes as follows: |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
503 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
504 When CCL program gives this nested structure of map to this command: |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
505 ((MAP-ID11 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
506 MAP-ID12 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
507 (MAP-ID121 MAP-ID122 MAP-ID123) |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
508 MAP-ID13) |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
509 (MAP-ID21 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
510 (MAP-ID211 (MAP-ID2111) MAP-ID212) |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
511 MAP-ID22)), |
21551 | 512 the compiled CCL codes has this sequence: |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
513 CCL_MapMultiple (CCL code of this command) |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
514 16 (total number of MAPs and SEPARATORs) |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
515 -7 (1st SEPARATOR) |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
516 MAP-ID11 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
517 MAP-ID12 |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
518 -3 (2nd SEPARATOR) |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
519 MAP-ID121 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
520 MAP-ID122 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
521 MAP-ID123 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
522 MAP-ID13 |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
523 -7 (3rd SEPARATOR) |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
524 MAP-ID21 |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
525 -4 (4th SEPARATOR) |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
526 MAP-ID211 |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
527 -1 (5th SEPARATOR) |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
528 MAP_ID2111 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
529 MAP-ID212 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
530 MAP-ID22 |
21551 | 531 |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
532 A value of each SEPARATOR follows this rule: |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
533 MAP-SET := SEPARATOR [(MAP-ID | MAP-SET)]+ |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
534 SEPARATOR := -(number of MAP-IDs and SEPARATORs in the MAP-SET) |
21551 | 535 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
536 (*)....Nest level of MAP-SET must not be over than MAX_MAP_SET_LEVEL. |
21551 | 537 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
538 When some map fails to map (i.e. it doesn't have a value for |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
539 reg[rrr]), the mapping is treated as identity. |
21551 | 540 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
541 The mapping is iterated for all maps in each map set (set of maps |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
542 separated by SEPARATOR) except in the case that lambda is |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
543 encountered. More precisely, the mapping proceeds as below: |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
544 |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
545 At first, VAL0 is set to reg[rrr], and it is translated by the |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
546 first map to VAL1. Then, VAL1 is translated by the next map to |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
547 VAL2. This mapping is iterated until the last map is used. The |
31551 | 548 result of the mapping is the last value of VAL?. When the mapping |
549 process reached to the end of the map set, it moves to the next | |
550 map set. If the next does not exit, the mapping process terminates, | |
551 and regard the last value as a result. | |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
552 |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
553 But, when VALm is mapped to VALn and VALn is not a number, the |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
554 mapping proceed as below: |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
555 |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
556 If VALn is nil, the lastest map is ignored and the mapping of VALm |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
557 proceed to the next map. |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
558 |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
559 In VALn is t, VALm is reverted to reg[rrr] and the mapping of VALm |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
560 proceed to the next map. |
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
561 |
31551 | 562 If VALn is lambda, move to the next map set like reaching to the |
563 end of the current map set. | |
564 | |
565 If VALn is a symbol, call the CCL program refered by it. | |
566 Then, use reg[rrr] as a mapped value except for -1, -2 and -3. | |
567 Such special values are regarded as nil, t, and lambda respectively. | |
21551 | 568 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
569 Each map is a Lisp vector of the following format (a) or (b): |
21551 | 570 (a)......[STARTPOINT VAL1 VAL2 ...] |
571 (b)......[t VAL STARTPOINT ENDPOINT], | |
572 where | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
573 STARTPOINT is an offset to be used for indexing a map, |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
574 ENDPOINT is a maximum index number of a map, |
21551 | 575 VAL and VALn is a number, nil, t, or lambda. |
576 | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
577 Valid index range of a map of type (a) is: |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
578 STARTPOINT <= index < STARTPOINT + map_size - 1 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
579 Valid index range of a map of type (b) is: |
22525
3dade37fd85d
Comment for CCL_MapMultiple modified..
Kenichi Handa <handa@m17n.org>
parents:
22186
diff
changeset
|
580 STARTPOINT <= index < ENDPOINT */ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
581 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
582 #define CCL_MapMultiple 0x11 /* Mapping by multiple code conversion maps |
21551 | 583 1:ExtendedCOMMNDXXXRRRrrrXXXXX |
584 2:N-2 | |
585 3:SEPARATOR_1 (< 0) | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
586 4:MAP-ID_1 |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
587 5:MAP-ID_2 |
21551 | 588 ... |
589 M:SEPARATOR_x (< 0) | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
590 M+1:MAP-ID_y |
21551 | 591 ... |
592 N:SEPARATOR_z (< 0) | |
593 */ | |
594 | |
31551 | 595 #define MAX_MAP_SET_LEVEL 30 |
21551 | 596 |
597 typedef struct | |
598 { | |
599 int rest_length; | |
600 int orig_val; | |
601 } tr_stack; | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
602 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
603 static tr_stack mapping_stack[MAX_MAP_SET_LEVEL]; |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
604 static tr_stack *mapping_stack_pointer; |
21551 | 605 |
31551 | 606 /* If this variable is non-zero, it indicates the stack_idx |
607 of immediately called by CCL_MapMultiple. */ | |
34157
f8e2b3c8da1b
(stack_idx_of_map_multiple): Don't use C initializier.
Kenichi Handa <handa@m17n.org>
parents:
31702
diff
changeset
|
608 static int stack_idx_of_map_multiple; |
31551 | 609 |
610 #define PUSH_MAPPING_STACK(restlen, orig) \ | |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
611 do \ |
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
612 { \ |
31551 | 613 mapping_stack_pointer->rest_length = (restlen); \ |
614 mapping_stack_pointer->orig_val = (orig); \ | |
615 mapping_stack_pointer++; \ | |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
616 } \ |
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
617 while (0) |
31551 | 618 |
619 #define POP_MAPPING_STACK(restlen, orig) \ | |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
620 do \ |
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
621 { \ |
31551 | 622 mapping_stack_pointer--; \ |
623 (restlen) = mapping_stack_pointer->rest_length; \ | |
624 (orig) = mapping_stack_pointer->orig_val; \ | |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
625 } \ |
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
626 while (0) |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
627 |
31551 | 628 #define CCL_CALL_FOR_MAP_INSTRUCTION(symbol, ret_ic) \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
629 do \ |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
630 { \ |
31551 | 631 struct ccl_program called_ccl; \ |
632 if (stack_idx >= 256 \ | |
633 || (setup_ccl_program (&called_ccl, (symbol)) != 0)) \ | |
634 { \ | |
635 if (stack_idx > 0) \ | |
636 { \ | |
637 ccl_prog = ccl_prog_stack_struct[0].ccl_prog; \ | |
638 ic = ccl_prog_stack_struct[0].ic; \ | |
639 } \ | |
640 CCL_INVALID_CMD; \ | |
641 } \ | |
642 ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; \ | |
643 ccl_prog_stack_struct[stack_idx].ic = (ret_ic); \ | |
644 stack_idx++; \ | |
645 ccl_prog = called_ccl.prog; \ | |
646 ic = CCL_HEADER_MAIN; \ | |
647 goto ccl_repeat; \ | |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
648 } \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
649 while (0) |
21551 | 650 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
651 #define CCL_MapSingle 0x12 /* Map by single code conversion map |
21551 | 652 1:ExtendedCOMMNDXXXRRRrrrXXXXX |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
653 2:MAP-ID |
21551 | 654 ------------------------------ |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
655 Map reg[rrr] by MAP-ID. |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
656 If some valid mapping is found, |
21551 | 657 set reg[rrr] to the result, |
658 else | |
659 set reg[RRR] to -1. | |
660 */ | |
17052 | 661 |
88925
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
662 #define CCL_LookupIntConstTbl 0x13 /* Lookup multibyte character by |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
663 integer key. Afterwards R7 set |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
664 to 1 iff lookup succeeded. |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
665 1:ExtendedCOMMNDRrrRRRXXXXXXXX |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
666 2:ARGUMENT(Hash table ID) */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
667 |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
668 #define CCL_LookupCharConstTbl 0x14 /* Lookup integer by multibyte |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
669 character key. Afterwards R7 set |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
670 to 1 iff lookup succeeded. |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
671 1:ExtendedCOMMNDRrrRRRrrrXXXXX |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
672 2:ARGUMENT(Hash table ID) */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
673 |
17052 | 674 /* CCL arithmetic/logical operators. */ |
675 #define CCL_PLUS 0x00 /* X = Y + Z */ | |
676 #define CCL_MINUS 0x01 /* X = Y - Z */ | |
677 #define CCL_MUL 0x02 /* X = Y * Z */ | |
678 #define CCL_DIV 0x03 /* X = Y / Z */ | |
679 #define CCL_MOD 0x04 /* X = Y % Z */ | |
680 #define CCL_AND 0x05 /* X = Y & Z */ | |
681 #define CCL_OR 0x06 /* X = Y | Z */ | |
682 #define CCL_XOR 0x07 /* X = Y ^ Z */ | |
683 #define CCL_LSH 0x08 /* X = Y << Z */ | |
684 #define CCL_RSH 0x09 /* X = Y >> Z */ | |
685 #define CCL_LSH8 0x0A /* X = (Y << 8) | Z */ | |
686 #define CCL_RSH8 0x0B /* X = Y >> 8, r[7] = Y & 0xFF */ | |
687 #define CCL_DIVMOD 0x0C /* X = Y / Z, r[7] = Y % Z */ | |
688 #define CCL_LS 0x10 /* X = (X < Y) */ | |
689 #define CCL_GT 0x11 /* X = (X > Y) */ | |
690 #define CCL_EQ 0x12 /* X = (X == Y) */ | |
691 #define CCL_LE 0x13 /* X = (X <= Y) */ | |
692 #define CCL_GE 0x14 /* X = (X >= Y) */ | |
693 #define CCL_NE 0x15 /* X = (X != Y) */ | |
694 | |
23428
49c7e979c16c
(CCL_DECODE_SJIS, CCL_ENCODE_SJIS): Swap the definitions.
Kenichi Handa <handa@m17n.org>
parents:
23303
diff
changeset
|
695 #define CCL_DECODE_SJIS 0x16 /* X = HIGHER_BYTE (DE-SJIS (Y, Z)) |
49c7e979c16c
(CCL_DECODE_SJIS, CCL_ENCODE_SJIS): Swap the definitions.
Kenichi Handa <handa@m17n.org>
parents:
23303
diff
changeset
|
696 r[7] = LOWER_BYTE (DE-SJIS (Y, Z)) */ |
49c7e979c16c
(CCL_DECODE_SJIS, CCL_ENCODE_SJIS): Swap the definitions.
Kenichi Handa <handa@m17n.org>
parents:
23303
diff
changeset
|
697 #define CCL_ENCODE_SJIS 0x17 /* X = HIGHER_BYTE (SJIS (Y, Z)) |
17052 | 698 r[7] = LOWER_BYTE (SJIS (Y, Z) */ |
699 | |
700 /* Terminate CCL program successfully. */ | |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
701 #define CCL_SUCCESS \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
702 do \ |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
703 { \ |
17052 | 704 ccl->status = CCL_STAT_SUCCESS; \ |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
705 goto ccl_finish; \ |
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
706 } \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
707 while(0) |
17052 | 708 |
709 /* Suspend CCL program because of reading from empty input buffer or | |
710 writing to full output buffer. When this program is resumed, the | |
711 same I/O command is executed. */ | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
712 #define CCL_SUSPEND(stat) \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
713 do \ |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
714 { \ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
715 ic--; \ |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
716 ccl->status = stat; \ |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
717 goto ccl_finish; \ |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
718 } \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
719 while (0) |
17052 | 720 |
721 /* Terminate CCL program because of invalid command. Should not occur | |
722 in the normal case. */ | |
723 #define CCL_INVALID_CMD \ | |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
724 do \ |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
725 { \ |
17052 | 726 ccl->status = CCL_STAT_INVALID_CMD; \ |
727 goto ccl_error_handler; \ | |
35498
add3de5a4293
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
Kenichi Handa <handa@m17n.org>
parents:
35495
diff
changeset
|
728 } \ |
40940
174ef035d156
Change macros to use do-while block instead of if-else.
Pavel Janík <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
729 while(0) |
17052 | 730 |
731 /* Encode one character CH to multibyte form and write to the current | |
17323
15fa68d983e7
(ccl_driver): Fix bug of the case CCL_WriteArrayReadJump.
Kenichi Handa <handa@m17n.org>
parents:
17122
diff
changeset
|
732 output buffer. If CH is less than 256, CH is written as is. */ |
88361 | 733 #define CCL_WRITE_CHAR(ch) \ |
734 do { \ | |
735 if (! dst) \ | |
736 CCL_INVALID_CMD; \ | |
737 else if (dst < dst_end) \ | |
738 *dst++ = (ch); \ | |
739 else \ | |
740 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ | |
36411
120891909abe
(CCL_WRITE_MULTIBYTE_CHAR): New macro.
Kenichi Handa <handa@m17n.org>
parents:
36102
diff
changeset
|
741 } while (0) |
120891909abe
(CCL_WRITE_MULTIBYTE_CHAR): New macro.
Kenichi Handa <handa@m17n.org>
parents:
36102
diff
changeset
|
742 |
17052 | 743 /* Write a string at ccl_prog[IC] of length LEN to the current output |
744 buffer. */ | |
745 #define CCL_WRITE_STRING(len) \ | |
746 do { \ | |
88361 | 747 int i; \ |
17052 | 748 if (!dst) \ |
749 CCL_INVALID_CMD; \ | |
88361 | 750 else if (dst + len <= dst_end) \ |
17052 | 751 for (i = 0; i < len; i++) \ |
752 *dst++ = ((XFASTINT (ccl_prog[ic + (i / 3)])) \ | |
753 >> ((2 - (i % 3)) * 8)) & 0xFF; \ | |
754 else \ | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
755 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ |
17052 | 756 } while (0) |
757 | |
88361 | 758 /* Read one byte from the current input buffer into Rth register. */ |
759 #define CCL_READ_CHAR(r) \ | |
760 do { \ | |
761 if (! src) \ | |
762 CCL_INVALID_CMD; \ | |
763 else if (src < src_end) \ | |
764 r = *src++; \ | |
765 else if (ccl->last_block) \ | |
766 { \ | |
767 ic = ccl->eof_ic; \ | |
768 goto ccl_repeat; \ | |
769 } \ | |
770 else \ | |
771 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_SRC); \ | |
772 } while (0) | |
17052 | 773 |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
774 /* Decode CODE by a charset whose id is ID. If ID is 0, return CODE |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
775 as is for backward compatibility. Assume that we can use the |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
776 variable `charset'. */ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
777 |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
778 #define CCL_DECODE_CHAR(id, code) \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
779 ((id) == 0 ? (code) \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
780 : (charset = CHARSET_FROM_ID ((id)), DECODE_CHAR (charset, (code)))) |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
781 |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
782 |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
783 /* Encode character C by some of charsets in CHARSET_LIST. Set ID to |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
784 the id of the used charset, ENCODED to the resulf of encoding. |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
785 Assume that we can use the variable `charset'. */ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
786 |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
787 #define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
788 do { \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
789 unsigned code; \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
790 \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
791 charset = char_charset ((c), (charset_list), &code); \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
792 if (! charset && ! NILP (charset_list)) \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
793 charset = char_charset ((c), Qnil, &code); \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
794 if (charset) \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
795 { \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
796 (id) = CHARSET_ID (charset); \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
797 (encoded) = code; \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
798 } \ |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
799 } while (0) |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
800 |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
801 |
17052 | 802 |
88361 | 803 /* Execute CCL code on characters at SOURCE (length SRC_SIZE). The |
804 resulting text goes to a place pointed by DESTINATION, the length | |
805 of which should not exceed DST_SIZE. As a side effect, how many | |
806 characters are consumed and produced are recorded in CCL->consumed | |
807 and CCL->produced, and the contents of CCL registers are updated. | |
808 If SOURCE or DESTINATION is NULL, only operations on registers are | |
809 permitted. */ | |
17052 | 810 |
811 #ifdef CCL_DEBUG | |
812 #define CCL_DEBUG_BACKTRACE_LEN 256 | |
813 int ccl_backtrace_table[CCL_BACKTRACE_TABLE]; | |
814 int ccl_backtrace_idx; | |
815 #endif | |
816 | |
817 struct ccl_prog_stack | |
818 { | |
17828
db443ea8cb36
(struct ccl_prog_stack): Declear the member ccl_prog as
Kenichi Handa <handa@m17n.org>
parents:
17728
diff
changeset
|
819 Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */ |
17052 | 820 int ic; /* Instruction Counter. */ |
821 }; | |
822 | |
24688
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
823 /* For the moment, we only support depth 256 of stack. */ |
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
824 static struct ccl_prog_stack ccl_prog_stack_struct[256]; |
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
825 |
88361 | 826 void |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
827 ccl_driver (ccl, source, destination, src_size, dst_size, charset_list) |
17052 | 828 struct ccl_program *ccl; |
88361 | 829 int *source, *destination; |
830 int src_size, dst_size; | |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
831 Lisp_Object charset_list; |
17052 | 832 { |
833 register int *reg = ccl->reg; | |
834 register int ic = ccl->ic; | |
37734
3d05b438e278
(ccl_driver): Don't copy remaining bytes in case
Gerd Moellmann <gerd@gnu.org>
parents:
36565
diff
changeset
|
835 register int code = 0, field1, field2; |
17370
6db43d8c9dfc
(ccl_driver): Fix Lisp_Object/integer confusion.
Karl Heuer <kwzh@gnu.org>
parents:
17323
diff
changeset
|
836 register Lisp_Object *ccl_prog = ccl->prog; |
88361 | 837 int *src = source, *src_end = src + src_size; |
838 int *dst = destination, *dst_end = dst + dst_size; | |
17052 | 839 int jump_address; |
37734
3d05b438e278
(ccl_driver): Don't copy remaining bytes in case
Gerd Moellmann <gerd@gnu.org>
parents:
36565
diff
changeset
|
840 int i = 0, j, op; |
24688
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
841 int stack_idx = ccl->stack_idx; |
23303
fb38954a02d3
(ccl_driver): Report correct CCL program counter on error.
Kenichi Handa <handa@m17n.org>
parents:
23280
diff
changeset
|
842 /* Instruction counter of the current CCL code. */ |
37734
3d05b438e278
(ccl_driver): Don't copy remaining bytes in case
Gerd Moellmann <gerd@gnu.org>
parents:
36565
diff
changeset
|
843 int this_ic = 0; |
88361 | 844 struct charset *charset; |
17052 | 845 |
846 if (ic >= ccl->eof_ic) | |
847 ic = CCL_HEADER_MAIN; | |
848 | |
88361 | 849 if (ccl->buf_magnification == 0) /* We can't read/produce any bytes. */ |
23280
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
850 dst = NULL; |
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
851 |
31551 | 852 /* Set mapping stack pointer. */ |
853 mapping_stack_pointer = mapping_stack; | |
854 | |
17052 | 855 #ifdef CCL_DEBUG |
856 ccl_backtrace_idx = 0; | |
857 #endif | |
858 | |
859 for (;;) | |
860 { | |
23068
ae33b925b20f
If eof is encounterd while processing the
Kenichi Handa <handa@m17n.org>
parents:
22718
diff
changeset
|
861 ccl_repeat: |
17052 | 862 #ifdef CCL_DEBUG |
863 ccl_backtrace_table[ccl_backtrace_idx++] = ic; | |
864 if (ccl_backtrace_idx >= CCL_DEBUG_BACKTRACE_LEN) | |
865 ccl_backtrace_idx = 0; | |
866 ccl_backtrace_table[ccl_backtrace_idx] = 0; | |
867 #endif | |
868 | |
869 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) | |
870 { | |
871 /* We can't just signal Qquit, instead break the loop as if | |
872 the whole data is processed. Don't reset Vquit_flag, it | |
873 must be handled later at a safer place. */ | |
88361 | 874 if (src) |
875 src = source + src_size; | |
17052 | 876 ccl->status = CCL_STAT_QUIT; |
877 break; | |
878 } | |
879 | |
23303
fb38954a02d3
(ccl_driver): Report correct CCL program counter on error.
Kenichi Handa <handa@m17n.org>
parents:
23280
diff
changeset
|
880 this_ic = ic; |
17052 | 881 code = XINT (ccl_prog[ic]); ic++; |
882 field1 = code >> 8; | |
883 field2 = (code & 0xFF) >> 5; | |
884 | |
885 #define rrr field2 | |
886 #define RRR (field1 & 7) | |
887 #define Rrr ((field1 >> 3) & 7) | |
888 #define ADDR field1 | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
889 #define EXCMD (field1 >> 6) |
17052 | 890 |
891 switch (code & 0x1F) | |
892 { | |
893 case CCL_SetRegister: /* 00000000000000000RRRrrrXXXXX */ | |
894 reg[rrr] = reg[RRR]; | |
895 break; | |
896 | |
897 case CCL_SetShortConst: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ | |
898 reg[rrr] = field1; | |
899 break; | |
900 | |
901 case CCL_SetConst: /* 00000000000000000000rrrXXXXX */ | |
902 reg[rrr] = XINT (ccl_prog[ic]); | |
903 ic++; | |
904 break; | |
905 | |
906 case CCL_SetArray: /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */ | |
907 i = reg[RRR]; | |
908 j = field1 >> 3; | |
909 if ((unsigned int) i < j) | |
910 reg[rrr] = XINT (ccl_prog[ic + i]); | |
911 ic += j; | |
912 break; | |
913 | |
914 case CCL_Jump: /* A--D--D--R--E--S--S-000XXXXX */ | |
915 ic += ADDR; | |
916 break; | |
917 | |
918 case CCL_JumpCond: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
919 if (!reg[rrr]) | |
920 ic += ADDR; | |
921 break; | |
922 | |
923 case CCL_WriteRegisterJump: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
924 i = reg[rrr]; | |
925 CCL_WRITE_CHAR (i); | |
926 ic += ADDR; | |
927 break; | |
928 | |
929 case CCL_WriteRegisterReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
930 i = reg[rrr]; | |
931 CCL_WRITE_CHAR (i); | |
932 ic++; | |
933 CCL_READ_CHAR (reg[rrr]); | |
934 ic += ADDR - 1; | |
935 break; | |
936 | |
937 case CCL_WriteConstJump: /* A--D--D--R--E--S--S-000XXXXX */ | |
938 i = XINT (ccl_prog[ic]); | |
939 CCL_WRITE_CHAR (i); | |
940 ic += ADDR; | |
941 break; | |
942 | |
943 case CCL_WriteConstReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
944 i = XINT (ccl_prog[ic]); | |
945 CCL_WRITE_CHAR (i); | |
946 ic++; | |
947 CCL_READ_CHAR (reg[rrr]); | |
948 ic += ADDR - 1; | |
949 break; | |
950 | |
951 case CCL_WriteStringJump: /* A--D--D--R--E--S--S-000XXXXX */ | |
952 j = XINT (ccl_prog[ic]); | |
953 ic++; | |
954 CCL_WRITE_STRING (j); | |
955 ic += ADDR - 1; | |
956 break; | |
957 | |
958 case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
959 i = reg[rrr]; | |
18613
614b916ff5bf
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18341
diff
changeset
|
960 j = XINT (ccl_prog[ic]); |
17052 | 961 if ((unsigned int) i < j) |
962 { | |
17323
15fa68d983e7
(ccl_driver): Fix bug of the case CCL_WriteArrayReadJump.
Kenichi Handa <handa@m17n.org>
parents:
17122
diff
changeset
|
963 i = XINT (ccl_prog[ic + 1 + i]); |
17052 | 964 CCL_WRITE_CHAR (i); |
965 } | |
17323
15fa68d983e7
(ccl_driver): Fix bug of the case CCL_WriteArrayReadJump.
Kenichi Handa <handa@m17n.org>
parents:
17122
diff
changeset
|
966 ic += j + 2; |
17052 | 967 CCL_READ_CHAR (reg[rrr]); |
968 ic += ADDR - (j + 2); | |
969 break; | |
970 | |
971 case CCL_ReadJump: /* A--D--D--R--E--S--S-rrrYYYYY */ | |
972 CCL_READ_CHAR (reg[rrr]); | |
973 ic += ADDR; | |
974 break; | |
975 | |
976 case CCL_ReadBranch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ | |
977 CCL_READ_CHAR (reg[rrr]); | |
978 /* fall through ... */ | |
979 case CCL_Branch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ | |
980 if ((unsigned int) reg[rrr] < field1) | |
981 ic += XINT (ccl_prog[ic + reg[rrr]]); | |
982 else | |
983 ic += XINT (ccl_prog[ic + field1]); | |
984 break; | |
985 | |
986 case CCL_ReadRegister: /* CCCCCCCCCCCCCCCCCCCCrrXXXXX */ | |
987 while (1) | |
988 { | |
989 CCL_READ_CHAR (reg[rrr]); | |
990 if (!field1) break; | |
991 code = XINT (ccl_prog[ic]); ic++; | |
992 field1 = code >> 8; | |
993 field2 = (code & 0xFF) >> 5; | |
994 } | |
995 break; | |
996 | |
997 case CCL_WriteExprConst: /* 1:00000OPERATION000RRR000XXXXX */ | |
998 rrr = 7; | |
999 i = reg[RRR]; | |
1000 j = XINT (ccl_prog[ic]); | |
1001 op = field1 >> 6; | |
27566
d96c50f3e37e
(ccl_driver) <CCL_WriteExprRegister>: Set jump_address
Kenichi Handa <handa@m17n.org>
parents:
26842
diff
changeset
|
1002 jump_address = ic + 1; |
17052 | 1003 goto ccl_set_expr; |
1004 | |
1005 case CCL_WriteRegister: /* CCCCCCCCCCCCCCCCCCCrrrXXXXX */ | |
1006 while (1) | |
1007 { | |
1008 i = reg[rrr]; | |
1009 CCL_WRITE_CHAR (i); | |
1010 if (!field1) break; | |
1011 code = XINT (ccl_prog[ic]); ic++; | |
1012 field1 = code >> 8; | |
1013 field2 = (code & 0xFF) >> 5; | |
1014 } | |
1015 break; | |
1016 | |
1017 case CCL_WriteExprRegister: /* 1:00000OPERATIONRrrRRR000XXXXX */ | |
1018 rrr = 7; | |
1019 i = reg[RRR]; | |
1020 j = reg[Rrr]; | |
1021 op = field1 >> 6; | |
27566
d96c50f3e37e
(ccl_driver) <CCL_WriteExprRegister>: Set jump_address
Kenichi Handa <handa@m17n.org>
parents:
26842
diff
changeset
|
1022 jump_address = ic; |
17052 | 1023 goto ccl_set_expr; |
1024 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1025 case CCL_Call: /* 1:CCCCCCCCCCCCCCCCCCCCFFFXXXXX */ |
17052 | 1026 { |
1027 Lisp_Object slot; | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1028 int prog_id; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1029 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1030 /* If FFF is nonzero, the CCL program ID is in the |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1031 following code. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1032 if (rrr) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1033 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1034 prog_id = XINT (ccl_prog[ic]); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1035 ic++; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1036 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1037 else |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1038 prog_id = field1; |
17052 | 1039 |
1040 if (stack_idx >= 256 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1041 || prog_id < 0 |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1042 || prog_id >= ASIZE (Vccl_program_table) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1043 || (slot = AREF (Vccl_program_table, prog_id), !VECTORP (slot)) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1044 || !VECTORP (AREF (slot, 1))) |
17052 | 1045 { |
1046 if (stack_idx > 0) | |
1047 { | |
1048 ccl_prog = ccl_prog_stack_struct[0].ccl_prog; | |
1049 ic = ccl_prog_stack_struct[0].ic; | |
1050 } | |
1051 CCL_INVALID_CMD; | |
1052 } | |
1053 | |
1054 ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; | |
1055 ccl_prog_stack_struct[stack_idx].ic = ic; | |
1056 stack_idx++; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1057 ccl_prog = XVECTOR (AREF (slot, 1))->contents; |
17052 | 1058 ic = CCL_HEADER_MAIN; |
1059 } | |
1060 break; | |
1061 | |
1062 case CCL_WriteConstString: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ | |
1063 if (!rrr) | |
1064 CCL_WRITE_CHAR (field1); | |
1065 else | |
1066 { | |
1067 CCL_WRITE_STRING (field1); | |
1068 ic += (field1 + 2) / 3; | |
1069 } | |
1070 break; | |
1071 | |
1072 case CCL_WriteArray: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ | |
1073 i = reg[rrr]; | |
1074 if ((unsigned int) i < field1) | |
1075 { | |
1076 j = XINT (ccl_prog[ic + i]); | |
1077 CCL_WRITE_CHAR (j); | |
1078 } | |
1079 ic += field1; | |
1080 break; | |
1081 | |
1082 case CCL_End: /* 0000000000000000000000XXXXX */ | |
29847
c6b0046bb943
(ccl_driver) <CCL_End>: Decrement stack_idx only when it is greater
Kenichi Handa <handa@m17n.org>
parents:
29724
diff
changeset
|
1083 if (stack_idx > 0) |
17052 | 1084 { |
29847
c6b0046bb943
(ccl_driver) <CCL_End>: Decrement stack_idx only when it is greater
Kenichi Handa <handa@m17n.org>
parents:
29724
diff
changeset
|
1085 stack_idx--; |
17052 | 1086 ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog; |
1087 ic = ccl_prog_stack_struct[stack_idx].ic; | |
1088 break; | |
1089 } | |
23884
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1090 if (src) |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1091 src = src_end; |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1092 /* ccl->ic should points to this command code again to |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1093 suppress further processing. */ |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1094 ic--; |
17052 | 1095 CCL_SUCCESS; |
1096 | |
1097 case CCL_ExprSelfConst: /* 00000OPERATION000000rrrXXXXX */ | |
1098 i = XINT (ccl_prog[ic]); | |
1099 ic++; | |
1100 op = field1 >> 6; | |
1101 goto ccl_expr_self; | |
1102 | |
1103 case CCL_ExprSelfReg: /* 00000OPERATION000RRRrrrXXXXX */ | |
1104 i = reg[RRR]; | |
1105 op = field1 >> 6; | |
1106 | |
1107 ccl_expr_self: | |
1108 switch (op) | |
1109 { | |
1110 case CCL_PLUS: reg[rrr] += i; break; | |
1111 case CCL_MINUS: reg[rrr] -= i; break; | |
1112 case CCL_MUL: reg[rrr] *= i; break; | |
1113 case CCL_DIV: reg[rrr] /= i; break; | |
1114 case CCL_MOD: reg[rrr] %= i; break; | |
1115 case CCL_AND: reg[rrr] &= i; break; | |
1116 case CCL_OR: reg[rrr] |= i; break; | |
1117 case CCL_XOR: reg[rrr] ^= i; break; | |
1118 case CCL_LSH: reg[rrr] <<= i; break; | |
1119 case CCL_RSH: reg[rrr] >>= i; break; | |
1120 case CCL_LSH8: reg[rrr] <<= 8; reg[rrr] |= i; break; | |
1121 case CCL_RSH8: reg[7] = reg[rrr] & 0xFF; reg[rrr] >>= 8; break; | |
1122 case CCL_DIVMOD: reg[7] = reg[rrr] % i; reg[rrr] /= i; break; | |
1123 case CCL_LS: reg[rrr] = reg[rrr] < i; break; | |
1124 case CCL_GT: reg[rrr] = reg[rrr] > i; break; | |
1125 case CCL_EQ: reg[rrr] = reg[rrr] == i; break; | |
1126 case CCL_LE: reg[rrr] = reg[rrr] <= i; break; | |
1127 case CCL_GE: reg[rrr] = reg[rrr] >= i; break; | |
1128 case CCL_NE: reg[rrr] = reg[rrr] != i; break; | |
1129 default: CCL_INVALID_CMD; | |
1130 } | |
1131 break; | |
1132 | |
1133 case CCL_SetExprConst: /* 00000OPERATION000RRRrrrXXXXX */ | |
1134 i = reg[RRR]; | |
1135 j = XINT (ccl_prog[ic]); | |
1136 op = field1 >> 6; | |
1137 jump_address = ++ic; | |
1138 goto ccl_set_expr; | |
1139 | |
1140 case CCL_SetExprReg: /* 00000OPERATIONRrrRRRrrrXXXXX */ | |
1141 i = reg[RRR]; | |
1142 j = reg[Rrr]; | |
1143 op = field1 >> 6; | |
1144 jump_address = ic; | |
1145 goto ccl_set_expr; | |
1146 | |
1147 case CCL_ReadJumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
1148 CCL_READ_CHAR (reg[rrr]); | |
1149 case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
1150 i = reg[rrr]; | |
1151 op = XINT (ccl_prog[ic]); | |
1152 jump_address = ic++ + ADDR; | |
1153 j = XINT (ccl_prog[ic]); | |
1154 ic++; | |
1155 rrr = 7; | |
1156 goto ccl_set_expr; | |
1157 | |
1158 case CCL_ReadJumpCondExprReg: /* A--D--D--R--E--S--S-rrrXXXXX */ | |
1159 CCL_READ_CHAR (reg[rrr]); | |
1160 case CCL_JumpCondExprReg: | |
1161 i = reg[rrr]; | |
1162 op = XINT (ccl_prog[ic]); | |
1163 jump_address = ic++ + ADDR; | |
1164 j = reg[XINT (ccl_prog[ic])]; | |
1165 ic++; | |
1166 rrr = 7; | |
1167 | |
1168 ccl_set_expr: | |
1169 switch (op) | |
1170 { | |
1171 case CCL_PLUS: reg[rrr] = i + j; break; | |
1172 case CCL_MINUS: reg[rrr] = i - j; break; | |
1173 case CCL_MUL: reg[rrr] = i * j; break; | |
1174 case CCL_DIV: reg[rrr] = i / j; break; | |
1175 case CCL_MOD: reg[rrr] = i % j; break; | |
1176 case CCL_AND: reg[rrr] = i & j; break; | |
1177 case CCL_OR: reg[rrr] = i | j; break; | |
1178 case CCL_XOR: reg[rrr] = i ^ j;; break; | |
1179 case CCL_LSH: reg[rrr] = i << j; break; | |
1180 case CCL_RSH: reg[rrr] = i >> j; break; | |
1181 case CCL_LSH8: reg[rrr] = (i << 8) | j; break; | |
1182 case CCL_RSH8: reg[rrr] = i >> 8; reg[7] = i & 0xFF; break; | |
1183 case CCL_DIVMOD: reg[rrr] = i / j; reg[7] = i % j; break; | |
1184 case CCL_LS: reg[rrr] = i < j; break; | |
1185 case CCL_GT: reg[rrr] = i > j; break; | |
1186 case CCL_EQ: reg[rrr] = i == j; break; | |
1187 case CCL_LE: reg[rrr] = i <= j; break; | |
1188 case CCL_GE: reg[rrr] = i >= j; break; | |
1189 case CCL_NE: reg[rrr] = i != j; break; | |
88361 | 1190 case CCL_DECODE_SJIS: |
1191 { | |
1192 i = (i << 8) | j; | |
1193 SJIS_TO_JIS (i); | |
1194 reg[rrr] = i >> 8; | |
1195 reg[7] = i & 0xFF; | |
1196 break; | |
1197 } | |
1198 case CCL_ENCODE_SJIS: | |
1199 { | |
1200 i = (i << 8) | j; | |
1201 JIS_TO_SJIS (i); | |
1202 reg[rrr] = i >> 8; | |
1203 reg[7] = i & 0xFF; | |
1204 break; | |
1205 } | |
17052 | 1206 default: CCL_INVALID_CMD; |
1207 } | |
1208 code &= 0x1F; | |
1209 if (code == CCL_WriteExprConst || code == CCL_WriteExprRegister) | |
1210 { | |
1211 i = reg[rrr]; | |
1212 CCL_WRITE_CHAR (i); | |
27566
d96c50f3e37e
(ccl_driver) <CCL_WriteExprRegister>: Set jump_address
Kenichi Handa <handa@m17n.org>
parents:
26842
diff
changeset
|
1213 ic = jump_address; |
17052 | 1214 } |
1215 else if (!reg[rrr]) | |
1216 ic = jump_address; | |
1217 break; | |
1218 | |
35328
f4c8b11d4d36
(CCL_Extension): Fix typo (originally CCL_Extention). Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
35322
diff
changeset
|
1219 case CCL_Extension: |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1220 switch (EXCMD) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1221 { |
21551 | 1222 case CCL_ReadMultibyteChar2: |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1223 if (!src) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1224 CCL_INVALID_CMD; |
88361 | 1225 CCL_READ_CHAR (i); |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1226 CCL_ENCODE_CHAR (i, charset_list, reg[RRR], reg[rrr]); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1227 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1228 |
21551 | 1229 case CCL_WriteMultibyteChar2: |
88361 | 1230 if (! dst) |
1231 CCL_INVALID_CMD; | |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1232 i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]); |
88361 | 1233 CCL_WRITE_CHAR (i); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1234 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1235 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1236 case CCL_TranslateCharacter: |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1237 i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]); |
88361 | 1238 op = translate_char (GET_TRANSLATION_TABLE (reg[Rrr]), i); |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1239 CCL_ENCODE_CHAR (op, charset_list, reg[RRR], reg[rrr]); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1240 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1241 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1242 case CCL_TranslateCharacterConstTbl: |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1243 op = XINT (ccl_prog[ic]); /* table */ |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1244 ic++; |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1245 i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]); |
88361 | 1246 op = translate_char (GET_TRANSLATION_TABLE (op), i); |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1247 CCL_ENCODE_CHAR (op, charset_list, reg[RRR], reg[rrr]); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1248 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1249 |
88925
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1250 case CCL_LookupIntConstTbl: |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1251 op = XINT (ccl_prog[ic]); /* table */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1252 ic++; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1253 { |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1254 struct Lisp_Hash_Table *h = GET_HASH_TABLE (op); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1255 |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1256 op = hash_lookup (h, make_number (reg[RRR]), NULL); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1257 if (op >= 0) |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1258 { |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1259 Lisp_Object opl; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1260 opl = HASH_VALUE (h, op); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1261 if (!CHARACTERP (opl)) |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1262 CCL_INVALID_CMD; |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1263 reg[RRR] = charset_unicode; |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1264 reg[rrr] = op; |
88925
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1265 reg[7] = 1; /* r7 true for success */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1266 } |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1267 else |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1268 reg[7] = 0; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1269 } |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1270 break; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1271 |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1272 case CCL_LookupCharConstTbl: |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1273 op = XINT (ccl_prog[ic]); /* table */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1274 ic++; |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1275 i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]); |
88925
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1276 { |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1277 struct Lisp_Hash_Table *h = GET_HASH_TABLE (op); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1278 |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1279 op = hash_lookup (h, make_number (i), NULL); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1280 if (op >= 0) |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1281 { |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1282 Lisp_Object opl; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1283 opl = HASH_VALUE (h, op); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1284 if (!INTEGERP (opl)) |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1285 CCL_INVALID_CMD; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1286 reg[RRR] = XINT (opl); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1287 reg[7] = 1; /* r7 true for success */ |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1288 } |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1289 else |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1290 reg[7] = 0; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1291 } |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1292 break; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
1293 |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1294 case CCL_IterateMultipleMap: |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1295 { |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1296 Lisp_Object map, content, attrib, value; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1297 int point, size, fin_ic; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1298 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1299 j = XINT (ccl_prog[ic++]); /* number of maps. */ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1300 fin_ic = ic + j; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1301 op = reg[rrr]; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1302 if ((j > reg[RRR]) && (j >= 0)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1303 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1304 ic += reg[RRR]; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1305 i = reg[RRR]; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1306 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1307 else |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1308 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1309 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1310 ic = fin_ic; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1311 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1312 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1313 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1314 for (;i < j;i++) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1315 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1316 |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1317 size = ASIZE (Vcode_conversion_map_vector); |
21518
1b0d88d6fb42
(ccl_driver, syms_of_ccl): Fix mixing of Lisp_Object and
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
1318 point = XINT (ccl_prog[ic++]); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1319 if (point >= size) continue; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1320 map = AREF (Vcode_conversion_map_vector, point); |
21551 | 1321 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1322 /* Check map varidity. */ |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1323 if (!CONSP (map)) continue; |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1324 map = XCDR (map); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1325 if (!VECTORP (map)) continue; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1326 size = ASIZE (map); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1327 if (size <= 1) continue; |
21551 | 1328 |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1329 content = AREF (map, 0); |
21551 | 1330 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1331 /* check map type, |
21551 | 1332 [STARTPOINT VAL1 VAL2 ...] or |
1333 [t ELELMENT STARTPOINT ENDPOINT] */ | |
1334 if (NUMBERP (content)) | |
1335 { | |
1336 point = XUINT (content); | |
1337 point = op - point + 1; | |
1338 if (!((point >= 1) && (point < size))) continue; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1339 content = AREF (map, point); |
21551 | 1340 } |
1341 else if (EQ (content, Qt)) | |
1342 { | |
1343 if (size != 4) continue; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1344 if ((op >= XUINT (AREF (map, 2))) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1345 && (op < XUINT (AREF (map, 3)))) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1346 content = AREF (map, 1); |
21551 | 1347 else |
1348 continue; | |
1349 } | |
1350 else | |
1351 continue; | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1352 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1353 if (NILP (content)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1354 continue; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1355 else if (NUMBERP (content)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1356 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1357 reg[RRR] = i; |
21551 | 1358 reg[rrr] = XINT(content); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1359 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1360 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1361 else if (EQ (content, Qt) || EQ (content, Qlambda)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1362 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1363 reg[RRR] = i; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1364 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1365 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1366 else if (CONSP (content)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1367 { |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1368 attrib = XCAR (content); |
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1369 value = XCDR (content); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1370 if (!NUMBERP (attrib) || !NUMBERP (value)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1371 continue; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1372 reg[RRR] = i; |
21551 | 1373 reg[rrr] = XUINT (value); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1374 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1375 } |
31551 | 1376 else if (SYMBOLP (content)) |
1377 CCL_CALL_FOR_MAP_INSTRUCTION (content, fin_ic); | |
1378 else | |
1379 CCL_INVALID_CMD; | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1380 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1381 if (i == j) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1382 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1383 ic = fin_ic; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1384 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1385 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1386 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1387 case CCL_MapMultiple: |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1388 { |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1389 Lisp_Object map, content, attrib, value; |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1390 int point, size, map_vector_size; |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1391 int map_set_rest_length, fin_ic; |
31551 | 1392 int current_ic = this_ic; |
1393 | |
1394 /* inhibit recursive call on MapMultiple. */ | |
1395 if (stack_idx_of_map_multiple > 0) | |
1396 { | |
1397 if (stack_idx_of_map_multiple <= stack_idx) | |
1398 { | |
1399 stack_idx_of_map_multiple = 0; | |
1400 mapping_stack_pointer = mapping_stack; | |
1401 CCL_INVALID_CMD; | |
1402 } | |
1403 } | |
1404 else | |
1405 mapping_stack_pointer = mapping_stack; | |
1406 stack_idx_of_map_multiple = 0; | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1407 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1408 map_set_rest_length = |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1409 XINT (ccl_prog[ic++]); /* number of maps and separators. */ |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1410 fin_ic = ic + map_set_rest_length; |
31551 | 1411 op = reg[rrr]; |
1412 | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1413 if ((map_set_rest_length > reg[RRR]) && (reg[RRR] >= 0)) |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1414 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1415 ic += reg[RRR]; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1416 i = reg[RRR]; |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1417 map_set_rest_length -= i; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1418 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1419 else |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1420 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1421 ic = fin_ic; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1422 reg[RRR] = -1; |
31551 | 1423 mapping_stack_pointer = mapping_stack; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1424 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1425 } |
31551 | 1426 |
1427 if (mapping_stack_pointer <= (mapping_stack + 1)) | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1428 { |
31551 | 1429 /* Set up initial state. */ |
1430 mapping_stack_pointer = mapping_stack; | |
1431 PUSH_MAPPING_STACK (0, op); | |
1432 reg[RRR] = -1; | |
1433 } | |
1434 else | |
1435 { | |
1436 /* Recover after calling other ccl program. */ | |
1437 int orig_op; | |
21551 | 1438 |
31551 | 1439 POP_MAPPING_STACK (map_set_rest_length, orig_op); |
1440 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]); | |
1441 switch (op) | |
21551 | 1442 { |
31551 | 1443 case -1: |
1444 /* Regard it as Qnil. */ | |
1445 op = orig_op; | |
1446 i++; | |
1447 ic++; | |
1448 map_set_rest_length--; | |
1449 break; | |
1450 case -2: | |
1451 /* Regard it as Qt. */ | |
1452 op = reg[rrr]; | |
1453 i++; | |
1454 ic++; | |
1455 map_set_rest_length--; | |
1456 break; | |
1457 case -3: | |
1458 /* Regard it as Qlambda. */ | |
1459 op = orig_op; | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1460 i += map_set_rest_length; |
31551 | 1461 ic += map_set_rest_length; |
1462 map_set_rest_length = 0; | |
1463 break; | |
1464 default: | |
1465 /* Regard it as normal mapping. */ | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1466 i += map_set_rest_length; |
31551 | 1467 ic += map_set_rest_length; |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1468 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]); |
21551 | 1469 break; |
1470 } | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1471 } |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1472 map_vector_size = ASIZE (Vcode_conversion_map_vector); |
31551 | 1473 |
1474 do { | |
1475 for (;map_set_rest_length > 0;i++, ic++, map_set_rest_length--) | |
1476 { | |
1477 point = XINT(ccl_prog[ic]); | |
1478 if (point < 0) | |
1479 { | |
1480 /* +1 is for including separator. */ | |
1481 point = -point + 1; | |
1482 if (mapping_stack_pointer | |
1483 >= &mapping_stack[MAX_MAP_SET_LEVEL]) | |
1484 CCL_INVALID_CMD; | |
1485 PUSH_MAPPING_STACK (map_set_rest_length - point, | |
1486 reg[rrr]); | |
1487 map_set_rest_length = point; | |
1488 reg[rrr] = op; | |
1489 continue; | |
1490 } | |
1491 | |
1492 if (point >= map_vector_size) continue; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1493 map = AREF (Vcode_conversion_map_vector, point); |
31551 | 1494 |
1495 /* Check map varidity. */ | |
1496 if (!CONSP (map)) continue; | |
1497 map = XCDR (map); | |
1498 if (!VECTORP (map)) continue; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1499 size = ASIZE (map); |
31551 | 1500 if (size <= 1) continue; |
1501 | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1502 content = AREF (map, 0); |
31551 | 1503 |
1504 /* check map type, | |
1505 [STARTPOINT VAL1 VAL2 ...] or | |
1506 [t ELEMENT STARTPOINT ENDPOINT] */ | |
1507 if (NUMBERP (content)) | |
1508 { | |
1509 point = XUINT (content); | |
1510 point = op - point + 1; | |
1511 if (!((point >= 1) && (point < size))) continue; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1512 content = AREF (map, point); |
31551 | 1513 } |
1514 else if (EQ (content, Qt)) | |
1515 { | |
1516 if (size != 4) continue; | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1517 if ((op >= XUINT (AREF (map, 2))) && |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1518 (op < XUINT (AREF (map, 3)))) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1519 content = AREF (map, 1); |
31551 | 1520 else |
1521 continue; | |
1522 } | |
1523 else | |
1524 continue; | |
1525 | |
1526 if (NILP (content)) | |
1527 continue; | |
1528 | |
1529 reg[RRR] = i; | |
1530 if (NUMBERP (content)) | |
1531 { | |
1532 op = XINT (content); | |
1533 i += map_set_rest_length - 1; | |
1534 ic += map_set_rest_length - 1; | |
1535 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]); | |
1536 map_set_rest_length++; | |
1537 } | |
1538 else if (CONSP (content)) | |
1539 { | |
1540 attrib = XCAR (content); | |
1541 value = XCDR (content); | |
1542 if (!NUMBERP (attrib) || !NUMBERP (value)) | |
1543 continue; | |
1544 op = XUINT (value); | |
1545 i += map_set_rest_length - 1; | |
1546 ic += map_set_rest_length - 1; | |
1547 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]); | |
1548 map_set_rest_length++; | |
1549 } | |
1550 else if (EQ (content, Qt)) | |
1551 { | |
1552 op = reg[rrr]; | |
1553 } | |
1554 else if (EQ (content, Qlambda)) | |
1555 { | |
1556 i += map_set_rest_length; | |
1557 ic += map_set_rest_length; | |
1558 break; | |
1559 } | |
1560 else if (SYMBOLP (content)) | |
1561 { | |
1562 if (mapping_stack_pointer | |
1563 >= &mapping_stack[MAX_MAP_SET_LEVEL]) | |
1564 CCL_INVALID_CMD; | |
1565 PUSH_MAPPING_STACK (map_set_rest_length, reg[rrr]); | |
1566 PUSH_MAPPING_STACK (map_set_rest_length, op); | |
1567 stack_idx_of_map_multiple = stack_idx + 1; | |
1568 CCL_CALL_FOR_MAP_INSTRUCTION (content, current_ic); | |
1569 } | |
1570 else | |
1571 CCL_INVALID_CMD; | |
1572 } | |
1573 if (mapping_stack_pointer <= (mapping_stack + 1)) | |
1574 break; | |
1575 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]); | |
1576 i += map_set_rest_length; | |
1577 ic += map_set_rest_length; | |
1578 POP_MAPPING_STACK (map_set_rest_length, reg[rrr]); | |
1579 } while (1); | |
1580 | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1581 ic = fin_ic; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1582 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1583 reg[rrr] = op; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1584 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1585 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1586 case CCL_MapSingle: |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1587 { |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1588 Lisp_Object map, attrib, value, content; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1589 int size, point; |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1590 j = XINT (ccl_prog[ic++]); /* map_id */ |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1591 op = reg[rrr]; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1592 if (j >= ASIZE (Vcode_conversion_map_vector)) |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1593 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1594 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1595 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1596 } |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1597 map = AREF (Vcode_conversion_map_vector, j); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1598 if (!CONSP (map)) |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1599 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1600 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1601 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1602 } |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1603 map = XCDR (map); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
1604 if (!VECTORP (map)) |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1605 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1606 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1607 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1608 } |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1609 size = ASIZE (map); |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1610 point = XUINT (AREF (map, 0)); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1611 point = op - point + 1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1612 reg[RRR] = 0; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1613 if ((size <= 1) || |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1614 (!((point >= 1) && (point < size)))) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1615 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1616 else |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1617 { |
27877
fe0206a9f10c
(ccl_driver) [CCL_MapMultiple]: When the mapped value is
Kenichi Handa <handa@m17n.org>
parents:
27650
diff
changeset
|
1618 reg[RRR] = 0; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1619 content = AREF (map, point); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1620 if (NILP (content)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1621 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1622 else if (NUMBERP (content)) |
21551 | 1623 reg[rrr] = XINT (content); |
27877
fe0206a9f10c
(ccl_driver) [CCL_MapMultiple]: When the mapped value is
Kenichi Handa <handa@m17n.org>
parents:
27650
diff
changeset
|
1624 else if (EQ (content, Qt)); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1625 else if (CONSP (content)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1626 { |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1627 attrib = XCAR (content); |
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1628 value = XCDR (content); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1629 if (!NUMBERP (attrib) || !NUMBERP (value)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1630 continue; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1631 reg[rrr] = XUINT(value); |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1632 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1633 } |
31551 | 1634 else if (SYMBOLP (content)) |
1635 CCL_CALL_FOR_MAP_INSTRUCTION (content, ic); | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1636 else |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1637 reg[RRR] = -1; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1638 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1639 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1640 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1641 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1642 default: |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1643 CCL_INVALID_CMD; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1644 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1645 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1646 |
17052 | 1647 default: |
1648 CCL_INVALID_CMD; | |
1649 } | |
1650 } | |
1651 | |
1652 ccl_error_handler: | |
35535
0542807f1a5f
(ccl_driver): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
35529
diff
changeset
|
1653 /* The suppress_error member is set when e.g. a CCL-based coding |
0542807f1a5f
(ccl_driver): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
35529
diff
changeset
|
1654 system is used for terminal output. */ |
0542807f1a5f
(ccl_driver): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
35529
diff
changeset
|
1655 if (!ccl->suppress_error && destination) |
17052 | 1656 { |
1657 /* We can insert an error message only if DESTINATION is | |
1658 specified and we still have a room to store the message | |
1659 there. */ | |
1660 char msg[256]; | |
1661 int msglen; | |
1662 | |
23280
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1663 if (!dst) |
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1664 dst = destination; |
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1665 |
17052 | 1666 switch (ccl->status) |
1667 { | |
1668 case CCL_STAT_INVALID_CMD: | |
1669 sprintf(msg, "\nCCL: Invalid command %x (ccl_code = %x) at %d.", | |
23303
fb38954a02d3
(ccl_driver): Report correct CCL program counter on error.
Kenichi Handa <handa@m17n.org>
parents:
23280
diff
changeset
|
1670 code & 0x1F, code, this_ic); |
17052 | 1671 #ifdef CCL_DEBUG |
1672 { | |
1673 int i = ccl_backtrace_idx - 1; | |
1674 int j; | |
1675 | |
1676 msglen = strlen (msg); | |
23280
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1677 if (dst + msglen <= (dst_bytes ? dst_end : src)) |
17052 | 1678 { |
1679 bcopy (msg, dst, msglen); | |
1680 dst += msglen; | |
1681 } | |
1682 | |
1683 for (j = 0; j < CCL_DEBUG_BACKTRACE_LEN; j++, i--) | |
1684 { | |
1685 if (i < 0) i = CCL_DEBUG_BACKTRACE_LEN - 1; | |
1686 if (ccl_backtrace_table[i] == 0) | |
1687 break; | |
1688 sprintf(msg, " %d", ccl_backtrace_table[i]); | |
1689 msglen = strlen (msg); | |
23280
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1690 if (dst + msglen > (dst_bytes ? dst_end : src)) |
17052 | 1691 break; |
1692 bcopy (msg, dst, msglen); | |
1693 dst += msglen; | |
1694 } | |
23280
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1695 goto ccl_finish; |
17052 | 1696 } |
17323
15fa68d983e7
(ccl_driver): Fix bug of the case CCL_WriteArrayReadJump.
Kenichi Handa <handa@m17n.org>
parents:
17122
diff
changeset
|
1697 #endif |
23280
b4656367043f
(CCL_WRITE_CHAR): Don't use bcopy.
Kenichi Handa <handa@m17n.org>
parents:
23072
diff
changeset
|
1698 break; |
17052 | 1699 |
1700 case CCL_STAT_QUIT: | |
1701 sprintf(msg, "\nCCL: Quited."); | |
1702 break; | |
1703 | |
1704 default: | |
1705 sprintf(msg, "\nCCL: Unknown error type (%d).", ccl->status); | |
1706 } | |
1707 | |
1708 msglen = strlen (msg); | |
88361 | 1709 if (dst + msglen <= dst_end) |
35883
aedc87e25ce2
(CCL_WRITE_CHAR): Check if CH is valid or not. If
Kenichi Handa <handa@m17n.org>
parents:
35535
diff
changeset
|
1710 { |
88361 | 1711 for (i = 0; i < msglen; i++) |
1712 *dst++ = msg[i]; | |
35883
aedc87e25ce2
(CCL_WRITE_CHAR): Check if CH is valid or not. If
Kenichi Handa <handa@m17n.org>
parents:
35535
diff
changeset
|
1713 } |
17052 | 1714 } |
1715 | |
1716 ccl_finish: | |
1717 ccl->ic = ic; | |
24688
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
1718 ccl->stack_idx = stack_idx; |
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
1719 ccl->prog = ccl_prog; |
88361 | 1720 ccl->consumed = src - source; |
1721 ccl->produced = dst - destination; | |
17052 | 1722 } |
1723 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1724 /* Resolve symbols in the specified CCL code (Lisp vector). This |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1725 function converts symbols of code conversion maps and character |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1726 translation tables embeded in the CCL code into their ID numbers. |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1727 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1728 The return value is a vector (CCL itself or a new vector in which |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1729 all symbols are resolved), Qt if resolving of some symbol failed, |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1730 or nil if CCL contains invalid data. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1731 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1732 static Lisp_Object |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1733 resolve_symbol_ccl_program (ccl) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1734 Lisp_Object ccl; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1735 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1736 int i, veclen, unresolved = 0; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1737 Lisp_Object result, contents, val; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1738 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1739 result = ccl; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1740 veclen = ASIZE (result); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1741 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1742 for (i = 0; i < veclen; i++) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1743 { |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1744 contents = AREF (result, i); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1745 if (INTEGERP (contents)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1746 continue; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1747 else if (CONSP (contents) |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1748 && SYMBOLP (XCAR (contents)) |
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1749 && SYMBOLP (XCDR (contents))) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1750 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1751 /* This is the new style for embedding symbols. The form is |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1752 (SYMBOL . PROPERTY). (get SYMBOL PROPERTY) should give |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1753 an index number. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1754 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1755 if (EQ (result, ccl)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1756 result = Fcopy_sequence (ccl); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1757 |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
1758 val = Fget (XCAR (contents), XCDR (contents)); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1759 if (NATNUMP (val)) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1760 AREF (result, i) = val; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1761 else |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1762 unresolved = 1; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1763 continue; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1764 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1765 else if (SYMBOLP (contents)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1766 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1767 /* This is the old style for embedding symbols. This style |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1768 may lead to a bug if, for instance, a translation table |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1769 and a code conversion map have the same name. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1770 if (EQ (result, ccl)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1771 result = Fcopy_sequence (ccl); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1772 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1773 val = Fget (contents, Qtranslation_table_id); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1774 if (NATNUMP (val)) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1775 AREF (result, i) = val; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1776 else |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1777 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1778 val = Fget (contents, Qcode_conversion_map_id); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1779 if (NATNUMP (val)) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1780 AREF (result, i) = val; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1781 else |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1782 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1783 val = Fget (contents, Qccl_program_idx); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1784 if (NATNUMP (val)) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1785 AREF (result, i) = val; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1786 else |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1787 unresolved = 1; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1788 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1789 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1790 continue; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1791 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1792 return Qnil; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1793 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1794 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1795 return (unresolved ? Qt : result); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1796 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1797 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1798 /* Return the compiled code (vector) of CCL program CCL_PROG. |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1799 CCL_PROG is a name (symbol) of the program or already compiled |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1800 code. If necessary, resolve symbols in the compiled code to index |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1801 numbers. If we failed to get the compiled code or to resolve |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1802 symbols, return Qnil. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1803 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1804 static Lisp_Object |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1805 ccl_get_compiled_code (ccl_prog) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1806 Lisp_Object ccl_prog; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1807 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1808 Lisp_Object val, slot; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1809 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1810 if (VECTORP (ccl_prog)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1811 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1812 val = resolve_symbol_ccl_program (ccl_prog); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1813 return (VECTORP (val) ? val : Qnil); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1814 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1815 if (!SYMBOLP (ccl_prog)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1816 return Qnil; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1817 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1818 val = Fget (ccl_prog, Qccl_program_idx); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1819 if (! NATNUMP (val) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1820 || XINT (val) >= ASIZE (Vccl_program_table)) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1821 return Qnil; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1822 slot = AREF (Vccl_program_table, XINT (val)); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1823 if (! VECTORP (slot) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1824 || ASIZE (slot) != 3 |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1825 || ! VECTORP (AREF (slot, 1))) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1826 return Qnil; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1827 if (NILP (AREF (slot, 2))) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1828 { |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1829 val = resolve_symbol_ccl_program (AREF (slot, 1)); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1830 if (! VECTORP (val)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1831 return Qnil; |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1832 AREF (slot, 1) = val; |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1833 AREF (slot, 2) = Qt; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1834 } |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1835 return AREF (slot, 1); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1836 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1837 |
17052 | 1838 /* Setup fields of the structure pointed by CCL appropriately for the |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1839 execution of CCL program CCL_PROG. CCL_PROG is the name (symbol) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1840 of the CCL program or the already compiled code (vector). |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1841 Return 0 if we succeed this setup, else return -1. |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1842 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1843 If CCL_PROG is nil, we just reset the structure pointed by CCL. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1844 int |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1845 setup_ccl_program (ccl, ccl_prog) |
17052 | 1846 struct ccl_program *ccl; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1847 Lisp_Object ccl_prog; |
17052 | 1848 { |
1849 int i; | |
1850 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1851 if (! NILP (ccl_prog)) |
23884
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1852 { |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1853 struct Lisp_Vector *vp; |
23884
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1854 |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1855 ccl_prog = ccl_get_compiled_code (ccl_prog); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1856 if (! VECTORP (ccl_prog)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1857 return -1; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1858 vp = XVECTOR (ccl_prog); |
23884
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1859 ccl->size = vp->size; |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1860 ccl->prog = vp->contents; |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1861 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]); |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1862 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]); |
179bcb86f12f
(CCL_SUCCESS): Don't set ccl->ic.
Kenichi Handa <handa@m17n.org>
parents:
23768
diff
changeset
|
1863 } |
17052 | 1864 ccl->ic = CCL_HEADER_MAIN; |
1865 for (i = 0; i < 8; i++) | |
1866 ccl->reg[i] = 0; | |
1867 ccl->last_block = 0; | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
1868 ccl->private_state = 0; |
17052 | 1869 ccl->status = 0; |
24688
7b170d2184a4
(ccl_prog_stack_struct): Declare it as static.
Kenichi Handa <handa@m17n.org>
parents:
24567
diff
changeset
|
1870 ccl->stack_idx = 0; |
35529
c0bf5507a0bb
(ccl_driver): If ccl->suppress_error is nonzeor, don't
Kenichi Handa <handa@m17n.org>
parents:
35498
diff
changeset
|
1871 ccl->suppress_error = 0; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1872 return 0; |
17052 | 1873 } |
1874 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1875 DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1876 doc: /* Return t if OBJECT is a CCL program name or a compiled CCL program code. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1877 See the documentation of `define-ccl-program' for the detail of CCL program. */) |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1878 (object) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1879 Lisp_Object object; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1880 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1881 Lisp_Object val; |
21551 | 1882 |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1883 if (VECTORP (object)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1884 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1885 val = resolve_symbol_ccl_program (object); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1886 return (VECTORP (val) ? Qt : Qnil); |
21551 | 1887 } |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1888 if (!SYMBOLP (object)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1889 return Qnil; |
21551 | 1890 |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1891 val = Fget (object, Qccl_program_idx); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1892 return ((! NATNUMP (val) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1893 || XINT (val) >= ASIZE (Vccl_program_table)) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1894 ? Qnil : Qt); |
21551 | 1895 } |
1896 | |
17052 | 1897 DEFUN ("ccl-execute", Fccl_execute, Sccl_execute, 2, 2, 0, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1898 doc: /* Execute CCL-PROGRAM with registers initialized by REGISTERS. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1899 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1900 CCL-PROGRAM is a CCL program name (symbol) |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1901 or compiled code generated by `ccl-compile' (for backward compatibility. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1902 In the latter case, the execution overhead is bigger than in the former). |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1903 No I/O commands should appear in CCL-PROGRAM. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1904 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1905 REGISTERS is a vector of [R0 R1 ... R7] where RN is an initial value |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1906 for the Nth register. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1907 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1908 As side effect, each element of REGISTERS holds the value of |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1909 the corresponding register after the execution. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1910 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1911 See the documentation of `define-ccl-program' for a definition of CCL |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1912 programs. */) |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1913 (ccl_prog, reg) |
17052 | 1914 Lisp_Object ccl_prog, reg; |
1915 { | |
1916 struct ccl_program ccl; | |
1917 int i; | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1918 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1919 if (setup_ccl_program (&ccl, ccl_prog) < 0) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1920 error ("Invalid CCL program"); |
17052 | 1921 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1922 CHECK_VECTOR (reg); |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1923 if (ASIZE (reg) != 8) |
30105
d9e5b40d33c5
(Fccl_execute): Typo fixed.
Kenichi Handa <handa@m17n.org>
parents:
29847
diff
changeset
|
1924 error ("Length of vector REGISTERS is not 8"); |
21551 | 1925 |
17052 | 1926 for (i = 0; i < 8; i++) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1927 ccl.reg[i] = (INTEGERP (AREF (reg, i)) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1928 ? XINT (AREF (reg, i)) |
17052 | 1929 : 0); |
1930 | |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
1931 ccl_driver (&ccl, NULL, NULL, 0, 0, Qnil); |
17052 | 1932 QUIT; |
1933 if (ccl.status != CCL_STAT_SUCCESS) | |
1934 error ("Error in CCL program at %dth code", ccl.ic); | |
1935 | |
1936 for (i = 0; i < 8; i++) | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1937 XSETINT (AREF (reg, i), ccl.reg[i]); |
17052 | 1938 return Qnil; |
1939 } | |
1940 | |
1941 DEFUN ("ccl-execute-on-string", Fccl_execute_on_string, Sccl_execute_on_string, | |
20934
eebcbb4b56bd
(Fccl_execute_on_string): Add new arg UNIBYTE-P.
Kenichi Handa <handa@m17n.org>
parents:
20722
diff
changeset
|
1942 3, 5, 0, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1943 doc: /* Execute CCL-PROGRAM with initial STATUS on STRING. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1944 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1945 CCL-PROGRAM is a symbol registered by register-ccl-program, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1946 or a compiled code generated by `ccl-compile' (for backward compatibility, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1947 in this case, the execution is slower). |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1948 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1949 Read buffer is set to STRING, and write buffer is allocated automatically. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1950 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1951 STATUS is a vector of [R0 R1 ... R7 IC], where |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1952 R0..R7 are initial values of corresponding registers, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1953 IC is the instruction counter specifying from where to start the program. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1954 If R0..R7 are nil, they are initialized to 0. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1955 If IC is nil, it is initialized to head of the CCL program. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1956 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1957 If optional 4th arg CONTINUE is non-nil, keep IC on read operation |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1958 when read buffer is exausted, else, IC is always set to the end of |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1959 CCL-PROGRAM on exit. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1960 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1961 It returns the contents of write buffer as a string, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1962 and as side effect, STATUS is updated. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1963 If the optional 5th arg UNIBYTE-P is non-nil, the returned string |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1964 is a unibyte string. By default it is a multibyte string. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1965 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1966 See the documentation of `define-ccl-program' for the detail of CCL program. */) |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
1967 (ccl_prog, status, str, contin, unibyte_p) |
20934
eebcbb4b56bd
(Fccl_execute_on_string): Add new arg UNIBYTE-P.
Kenichi Handa <handa@m17n.org>
parents:
20722
diff
changeset
|
1968 Lisp_Object ccl_prog, status, str, contin, unibyte_p; |
17052 | 1969 { |
1970 Lisp_Object val; | |
1971 struct ccl_program ccl; | |
88361 | 1972 int i; |
17052 | 1973 int outbufsize; |
88361 | 1974 unsigned char *outbuf, *outp; |
1975 int str_chars, str_bytes; | |
1976 #define CCL_EXECUTE_BUF_SIZE 1024 | |
1977 int source[CCL_EXECUTE_BUF_SIZE], destination[CCL_EXECUTE_BUF_SIZE]; | |
1978 int consumed_chars, consumed_bytes, produced_chars; | |
17052 | 1979 |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1980 if (setup_ccl_program (&ccl, ccl_prog) < 0) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1981 error ("Invalid CCL program"); |
21551 | 1982 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1983 CHECK_VECTOR (status); |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1984 if (ASIZE (status) != 9) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1985 error ("Length of vector STATUS is not 9"); |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1986 CHECK_STRING (str); |
88361 | 1987 str_chars = XSTRING (str)->size; |
1988 str_bytes = STRING_BYTES (XSTRING (str)); | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
1989 |
17052 | 1990 for (i = 0; i < 8; i++) |
1991 { | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1992 if (NILP (AREF (status, i))) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1993 XSETINT (AREF (status, i), 0); |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1994 if (INTEGERP (AREF (status, i))) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1995 ccl.reg[i] = XINT (AREF (status, i)); |
17052 | 1996 } |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1997 if (INTEGERP (AREF (status, i))) |
17052 | 1998 { |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
1999 i = XFASTINT (AREF (status, 8)); |
17052 | 2000 if (ccl.ic < i && i < ccl.size) |
2001 ccl.ic = i; | |
2002 } | |
88361 | 2003 |
2004 outbufsize = (ccl.buf_magnification | |
2005 ? str_bytes * ccl.buf_magnification + 256 | |
2006 : str_bytes + 256); | |
2007 outp = outbuf = (unsigned char *) xmalloc (outbufsize); | |
2008 | |
2009 consumed_chars = consumed_bytes = 0; | |
2010 produced_chars = 0; | |
2011 while (consumed_bytes < str_bytes) | |
2012 { | |
88899
9bc86c0d4a67
(Fccl_execute_on_string): Add `const' to local variables.
Kenichi Handa <handa@m17n.org>
parents:
88361
diff
changeset
|
2013 const unsigned char *p = XSTRING (str)->data + consumed_bytes; |
9bc86c0d4a67
(Fccl_execute_on_string): Add `const' to local variables.
Kenichi Handa <handa@m17n.org>
parents:
88361
diff
changeset
|
2014 const unsigned char *endp = XSTRING (str)->data + str_bytes; |
88361 | 2015 int i = 0; |
2016 int *src, src_size; | |
2017 | |
2018 if (endp - p == str_chars - consumed_chars) | |
2019 while (i < CCL_EXECUTE_BUF_SIZE && p < endp) | |
2020 source[i++] = *p++; | |
2021 else | |
2022 while (i < CCL_EXECUTE_BUF_SIZE && p < endp) | |
2023 source[i++] = STRING_CHAR_ADVANCE (p); | |
2024 consumed_chars += i; | |
2025 consumed_bytes = p - XSTRING (str)->data; | |
17052 | 2026 |
88361 | 2027 if (consumed_bytes == str_bytes) |
2028 ccl.last_block = NILP (contin); | |
2029 src = source; | |
2030 src_size = i; | |
2031 while (1) | |
2032 { | |
89370
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
2033 ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE, |
0888fb1bda3f
(CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros.
Kenichi Handa <handa@m17n.org>
parents:
88925
diff
changeset
|
2034 Qnil); |
88361 | 2035 if (ccl.status != CCL_STAT_SUSPEND_BY_DST) |
2036 break; | |
2037 produced_chars += ccl.produced; | |
2038 if (NILP (unibyte_p)) | |
2039 { | |
2040 if (outp - outbuf + MAX_MULTIBYTE_LENGTH * ccl.produced | |
2041 > outbufsize) | |
2042 { | |
2043 int offset = outp - outbuf; | |
2044 outbufsize += MAX_MULTIBYTE_LENGTH * ccl.produced; | |
2045 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); | |
2046 outp = outbuf + offset; | |
2047 } | |
2048 for (i = 0; i < ccl.produced; i++) | |
2049 CHAR_STRING_ADVANCE (destination[i], outp); | |
2050 } | |
2051 else | |
2052 { | |
2053 if (outp - outbuf + ccl.produced > outbufsize) | |
2054 { | |
2055 int offset = outp - outbuf; | |
2056 outbufsize += ccl.produced; | |
2057 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); | |
2058 outp = outbuf + offset; | |
2059 } | |
2060 for (i = 0; i < ccl.produced; i++) | |
2061 *outp++ = destination[i]; | |
2062 } | |
2063 src += ccl.consumed; | |
2064 src_size -= ccl.consumed; | |
2065 } | |
31702
ef25c62becab
(Fccl_execute_on_string): Make multibyte string correctly.
Kenichi Handa <handa@m17n.org>
parents:
31551
diff
changeset
|
2066 |
88361 | 2067 if (ccl.status != CCL_STAT_SUSPEND_BY_SRC) |
2068 break; | |
2069 } | |
2070 | |
17052 | 2071 if (ccl.status != CCL_STAT_SUCCESS |
31702
ef25c62becab
(Fccl_execute_on_string): Make multibyte string correctly.
Kenichi Handa <handa@m17n.org>
parents:
31551
diff
changeset
|
2072 && ccl.status != CCL_STAT_SUSPEND_BY_SRC) |
17052 | 2073 error ("Error in CCL program at %dth code", ccl.ic); |
88361 | 2074 |
2075 for (i = 0; i < 8; i++) | |
2076 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]); | |
2077 XSETINT (XVECTOR (status)->contents[8], ccl.ic); | |
2078 | |
2079 if (NILP (unibyte_p)) | |
2080 val = make_multibyte_string ((char *) outbuf, produced_chars, | |
2081 outp - outbuf); | |
2082 else | |
2083 val = make_unibyte_string ((char *) outbuf, produced_chars); | |
2084 xfree (outbuf); | |
17052 | 2085 |
2086 return val; | |
2087 } | |
2088 | |
2089 DEFUN ("register-ccl-program", Fregister_ccl_program, Sregister_ccl_program, | |
2090 2, 2, 0, | |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2091 doc: /* Register CCL program CCL_PROG as NAME in `ccl-program-table'. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2092 CCL_PROG should be a compiled CCL program (vector), or nil. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2093 If it is nil, just reserve NAME as a CCL program name. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2094 Return index number of the registered CCL program. */) |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2095 (name, ccl_prog) |
17052 | 2096 Lisp_Object name, ccl_prog; |
2097 { | |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2098 int len = ASIZE (Vccl_program_table); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2099 int idx; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2100 Lisp_Object resolved; |
17052 | 2101 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
2102 CHECK_SYMBOL (name); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2103 resolved = Qnil; |
17052 | 2104 if (!NILP (ccl_prog)) |
21551 | 2105 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
2106 CHECK_VECTOR (ccl_prog); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2107 resolved = resolve_symbol_ccl_program (ccl_prog); |
35322
ac015053a9a1
(Fregister_ccl_program): Handle the return value of
Kenichi Handa <handa@m17n.org>
parents:
34982
diff
changeset
|
2108 if (NILP (resolved)) |
ac015053a9a1
(Fregister_ccl_program): Handle the return value of
Kenichi Handa <handa@m17n.org>
parents:
34982
diff
changeset
|
2109 error ("Error in CCL program"); |
ac015053a9a1
(Fregister_ccl_program): Handle the return value of
Kenichi Handa <handa@m17n.org>
parents:
34982
diff
changeset
|
2110 if (VECTORP (resolved)) |
17052 | 2111 { |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2112 ccl_prog = resolved; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2113 resolved = Qt; |
17052 | 2114 } |
35322
ac015053a9a1
(Fregister_ccl_program): Handle the return value of
Kenichi Handa <handa@m17n.org>
parents:
34982
diff
changeset
|
2115 else |
ac015053a9a1
(Fregister_ccl_program): Handle the return value of
Kenichi Handa <handa@m17n.org>
parents:
34982
diff
changeset
|
2116 resolved = Qnil; |
17052 | 2117 } |
2118 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2119 for (idx = 0; idx < len; idx++) |
17052 | 2120 { |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2121 Lisp_Object slot; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2122 |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2123 slot = AREF (Vccl_program_table, idx); |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2124 if (!VECTORP (slot)) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2125 /* This is the first unsed slot. Register NAME here. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2126 break; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2127 |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2128 if (EQ (name, AREF (slot, 0))) |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2129 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2130 /* Update this slot. */ |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2131 AREF (slot, 1) = ccl_prog; |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2132 AREF (slot, 2) = resolved; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2133 return make_number (idx); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2134 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2135 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2136 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2137 if (idx == len) |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2138 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2139 /* Extend the table. */ |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2140 Lisp_Object new_table; |
17052 | 2141 int j; |
2142 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2143 new_table = Fmake_vector (make_number (len * 2), Qnil); |
17052 | 2144 for (j = 0; j < len; j++) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2145 AREF (new_table, j) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2146 = AREF (Vccl_program_table, j); |
17052 | 2147 Vccl_program_table = new_table; |
2148 } | |
2149 | |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2150 { |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2151 Lisp_Object elt; |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2152 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2153 elt = Fmake_vector (make_number (3), Qnil); |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2154 AREF (elt, 0) = name; |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2155 AREF (elt, 1) = ccl_prog; |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2156 AREF (elt, 2) = resolved; |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2157 AREF (Vccl_program_table, idx) = elt; |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2158 } |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2159 |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2160 Fput (name, Qccl_program_idx, make_number (idx)); |
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2161 return make_number (idx); |
17052 | 2162 } |
2163 | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2164 /* Register code conversion map. |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2165 A code conversion map consists of numbers, Qt, Qnil, and Qlambda. |
36467 | 2166 The first element is the start code point. |
2167 The other elements are mapped numbers. | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2168 Symbol t means to map to an original number before mapping. |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2169 Symbol nil means that the corresponding element is empty. |
36467 | 2170 Symbol lambda means to terminate mapping here. |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2171 */ |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2172 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2173 DEFUN ("register-code-conversion-map", Fregister_code_conversion_map, |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2174 Sregister_code_conversion_map, |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2175 2, 2, 0, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2176 doc: /* Register SYMBOL as code conversion map MAP. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2177 Return index number of the registered map. */) |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2178 (symbol, map) |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2179 Lisp_Object symbol, map; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2180 { |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2181 int len = ASIZE (Vcode_conversion_map_vector); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2182 int i; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2183 Lisp_Object index; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2184 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
2185 CHECK_SYMBOL (symbol); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
2186 CHECK_VECTOR (map); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2187 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2188 for (i = 0; i < len; i++) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2189 { |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2190 Lisp_Object slot = AREF (Vcode_conversion_map_vector, i); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2191 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2192 if (!CONSP (slot)) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2193 break; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2194 |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25066
diff
changeset
|
2195 if (EQ (symbol, XCAR (slot))) |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2196 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2197 index = make_number (i); |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37765
diff
changeset
|
2198 XSETCDR (slot, map); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2199 Fput (symbol, Qcode_conversion_map, map); |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2200 Fput (symbol, Qcode_conversion_map_id, index); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2201 return index; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2202 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2203 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2204 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2205 if (i == len) |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2206 { |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2207 Lisp_Object new_vector = Fmake_vector (make_number (len * 2), Qnil); |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2208 int j; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2209 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2210 for (j = 0; j < len; j++) |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2211 AREF (new_vector, j) |
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2212 = AREF (Vcode_conversion_map_vector, j); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2213 Vcode_conversion_map_vector = new_vector; |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2214 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2215 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2216 index = make_number (i); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2217 Fput (symbol, Qcode_conversion_map, map); |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2218 Fput (symbol, Qcode_conversion_map_id, index); |
41622
2c3898d7bbef
Use AREF and ASIZE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40940
diff
changeset
|
2219 AREF (Vcode_conversion_map_vector, i) = Fcons (symbol, map); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2220 return index; |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2221 } |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2222 |
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2223 |
21514 | 2224 void |
17052 | 2225 syms_of_ccl () |
2226 { | |
2227 staticpro (&Vccl_program_table); | |
18749
d961aeafceba
(Fregister_ccl_program): Convert Fmake_vector argument to Lisp_Integer.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
2228 Vccl_program_table = Fmake_vector (make_number (32), Qnil); |
17052 | 2229 |
88361 | 2230 Qccl = intern ("ccl"); |
2231 staticpro (&Qccl); | |
2232 | |
2233 Qcclp = intern ("cclp"); | |
2234 staticpro (&Qcclp); | |
2235 | |
21551 | 2236 Qccl_program = intern ("ccl-program"); |
2237 staticpro (&Qccl_program); | |
2238 | |
2239 Qccl_program_idx = intern ("ccl-program-idx"); | |
2240 staticpro (&Qccl_program_idx); | |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2241 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2242 Qcode_conversion_map = intern ("code-conversion-map"); |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2243 staticpro (&Qcode_conversion_map); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2244 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2245 Qcode_conversion_map_id = intern ("code-conversion-map-id"); |
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2246 staticpro (&Qcode_conversion_map_id); |
21551 | 2247 |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2248 DEFVAR_LISP ("code-conversion-map-vector", &Vcode_conversion_map_vector, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2249 doc: /* Vector of code conversion maps. */); |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2250 Vcode_conversion_map_vector = Fmake_vector (make_number (16), Qnil); |
20722
cce3ef478c64
(Vccl_translation_table_vector, Qccl_program,
Kenichi Handa <handa@m17n.org>
parents:
20613
diff
changeset
|
2251 |
17052 | 2252 DEFVAR_LISP ("font-ccl-encoder-alist", &Vfont_ccl_encoder_alist, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2253 doc: /* Alist of fontname patterns vs corresponding CCL program. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2254 Each element looks like (REGEXP . CCL-CODE), |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2255 where CCL-CODE is a compiled CCL program. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2256 When a font whose name matches REGEXP is used for displaying a character, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2257 CCL-CODE is executed to calculate the code point in the font |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2258 from the charset number and position code(s) of the character which are set |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2259 in CCL registers R0, R1, and R2 before the execution. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2260 The code point in the font is set in CCL registers R1 and R2 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2261 when the execution terminated. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39973
diff
changeset
|
2262 If the font is single-byte font, the register R2 is not used. */); |
17052 | 2263 Vfont_ccl_encoder_alist = Qnil; |
2264 | |
88925
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2265 DEFVAR_LISP ("translation-hash-table-vector", &Vtranslation_hash_table_vector, |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2266 doc: /* Vector containing all translation hash tables ever defined. |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2267 Comprises pairs (SYMBOL . TABLE) where SYMBOL and TABLE were set up by calls |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2268 to `define-translation-hash-table'. The vector is indexed by the table id |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2269 used by CCL. */); |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2270 Vtranslation_hash_table_vector = Qnil; |
aa33304a3bb8
Remove `emacs' conditional. Include hash table stuff
Dave Love <fx@gnu.org>
parents:
88899
diff
changeset
|
2271 |
25066
8b8e54912f5c
(ccl_driver) <CCL_Call>: Now CCL program ID to call may be
Kenichi Handa <handa@m17n.org>
parents:
24688
diff
changeset
|
2272 defsubr (&Sccl_program_p); |
17052 | 2273 defsubr (&Sccl_execute); |
2274 defsubr (&Sccl_execute_on_string); | |
2275 defsubr (&Sregister_ccl_program); | |
22122
dfae9bc3731d
Change term translation to code conversion, then change
Kenichi Handa <handa@m17n.org>
parents:
21665
diff
changeset
|
2276 defsubr (&Sregister_code_conversion_map); |
17052 | 2277 } |