diff options
| author | Kenichi Handa | 2004-03-11 05:54:58 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-03-11 05:54:58 +0000 |
| commit | e6a54062d36cd81aa26fe64c54173b62b1517c32 (patch) | |
| tree | 3bac394fb239fb65ecfde6c72627923e1c90c6d0 /src/coding.c | |
| parent | 502ed9fb33e143500519b8ef02c3dc41503906fc (diff) | |
| download | emacs-e6a54062d36cd81aa26fe64c54173b62b1517c32.tar.gz emacs-e6a54062d36cd81aa26fe64c54173b62b1517c32.zip | |
(get_translation_table): Declare it as Lisp_Object.
(LOOKUP_TRANSLATION_TABLE): New macro.
(produce_chars): Use LOOKUP_TRANSLATION_TABLE instead of
CHAR_TABLE_REF.
(consume_chars): Likewise.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c index e4d2fda89cf..ef66395b843 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5507,7 +5507,7 @@ decode_eol (coding) | |||
| 5507 | attribute vector ATTRS for encoding (ENCODEP is nonzero) or | 5507 | attribute vector ATTRS for encoding (ENCODEP is nonzero) or |
| 5508 | decoding (ENCODEP is zero). */ | 5508 | decoding (ENCODEP is zero). */ |
| 5509 | 5509 | ||
| 5510 | static INLINE | 5510 | static Lisp_Object |
| 5511 | get_translation_table (attrs, encodep) | 5511 | get_translation_table (attrs, encodep) |
| 5512 | { | 5512 | { |
| 5513 | Lisp_Object standard, translation_table; | 5513 | Lisp_Object standard, translation_table; |
| @@ -5541,6 +5541,30 @@ get_translation_table (attrs, encodep) | |||
| 5541 | return translation_table; | 5541 | return translation_table; |
| 5542 | } | 5542 | } |
| 5543 | 5543 | ||
| 5544 | #define LOOKUP_TRANSLATION_TABLE(table, c, trans) \ | ||
| 5545 | do { \ | ||
| 5546 | if (CHAR_TABLE_P (table)) \ | ||
| 5547 | { \ | ||
| 5548 | trans = CHAR_TABLE_REF (table, c); \ | ||
| 5549 | if (CHARACTERP (trans)) \ | ||
| 5550 | c = XFASTINT (trans), trans = Qnil; \ | ||
| 5551 | } \ | ||
| 5552 | else \ | ||
| 5553 | { \ | ||
| 5554 | Lisp_Object tail = table; \ | ||
| 5555 | \ | ||
| 5556 | for (; CONSP (tail); tail = XCDR (tail)) \ | ||
| 5557 | if (CHAR_TABLE_P (XCAR (tail))) \ | ||
| 5558 | { \ | ||
| 5559 | trans = CHAR_TABLE_REF (table, c); \ | ||
| 5560 | if (CHARACTERP (trans)) \ | ||
| 5561 | c = XFASTINT (trans), trans = Qnil; \ | ||
| 5562 | else if (! NILP (trans)) \ | ||
| 5563 | break; \ | ||
| 5564 | } \ | ||
| 5565 | } \ | ||
| 5566 | } while (0) | ||
| 5567 | |||
| 5544 | 5568 | ||
| 5545 | static Lisp_Object | 5569 | static Lisp_Object |
| 5546 | get_translation (val, buf, buf_end, last_block, from_nchars, to_nchars) | 5570 | get_translation (val, buf, buf_end, last_block, from_nchars, to_nchars) |
| @@ -5621,8 +5645,9 @@ produce_chars (coding, translation_table, last_block) | |||
| 5621 | int from_nchars = 1, to_nchars = 1; | 5645 | int from_nchars = 1, to_nchars = 1; |
| 5622 | Lisp_Object trans = Qnil; | 5646 | Lisp_Object trans = Qnil; |
| 5623 | 5647 | ||
| 5624 | if (! NILP (translation_table) | 5648 | if (! NILP (translation_table)) |
| 5625 | && ! NILP (trans = CHAR_TABLE_REF (translation_table, c))) | 5649 | LOOKUP_TRANSLATION_TABLE (translation_table, c, trans); |
| 5650 | if (! NILP (trans)) | ||
| 5626 | { | 5651 | { |
| 5627 | trans = get_translation (trans, buf, buf_end, last_block, | 5652 | trans = get_translation (trans, buf, buf_end, last_block, |
| 5628 | &from_nchars, &to_nchars); | 5653 | &from_nchars, &to_nchars); |
| @@ -6264,8 +6289,10 @@ consume_chars (coding, translation_table) | |||
| 6264 | } | 6289 | } |
| 6265 | } | 6290 | } |
| 6266 | 6291 | ||
| 6267 | if (NILP (translation_table) | 6292 | trans = Qnil; |
| 6268 | || NILP (trans = CHAR_TABLE_REF (translation_table, c))) | 6293 | if (! NILP (translation_table)) |
| 6294 | LOOKUP_TRANSLATION_TABLE (translation_table, c, trans); | ||
| 6295 | if (NILP (trans)) | ||
| 6269 | *buf++ = c; | 6296 | *buf++ = c; |
| 6270 | else | 6297 | else |
| 6271 | { | 6298 | { |