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