diff options
| author | Kenichi Handa | 2004-03-11 08:46:07 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-03-11 08:46:07 +0000 |
| commit | 2170c8f05b193ad12a61022f919f6cb56758e179 (patch) | |
| tree | 9425f3b2fcef2009719282ed2dc41a098187497c /src/coding.c | |
| parent | 3e0a79b7445d3ffaabdc0fbdf4ddf85117f918d5 (diff) | |
| download | emacs-2170c8f05b193ad12a61022f919f6cb56758e179.tar.gz emacs-2170c8f05b193ad12a61022f919f6cb56758e179.zip | |
(get_translation_table): Allow max_lookup to be NULL.
(decode_coding): Call get_translation_table with max_lookup NULL.
(Ffind_coding_systems_region_internal): Likewise.
(Funencodable_char_position, Fcheck_coding_systems_region):
Likewise.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/coding.c b/src/coding.c index 2c12e6b0b5a..5b6955e77ce 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5544,26 +5544,30 @@ get_translation_table (attrs, encodep, max_lookup) | |||
| 5544 | Fcons (standard, Qnil)); | 5544 | Fcons (standard, Qnil)); |
| 5545 | } | 5545 | } |
| 5546 | } | 5546 | } |
| 5547 | *max_lookup = 1; | 5547 | |
| 5548 | if (CHAR_TABLE_P (translation_table) | 5548 | if (max_lookup) |
| 5549 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (translation_table)) > 1) | ||
| 5550 | { | ||
| 5551 | val = XCHAR_TABLE (translation_table)->extras[1]; | ||
| 5552 | if (NATNUMP (val) && *max_lookup < XFASTINT (val)) | ||
| 5553 | *max_lookup = XFASTINT (val); | ||
| 5554 | } | ||
| 5555 | else if (CONSP (translation_table)) | ||
| 5556 | { | 5549 | { |
| 5557 | Lisp_Object tail, val; | 5550 | *max_lookup = 1; |
| 5551 | if (CHAR_TABLE_P (translation_table) | ||
| 5552 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (translation_table)) > 1) | ||
| 5553 | { | ||
| 5554 | val = XCHAR_TABLE (translation_table)->extras[1]; | ||
| 5555 | if (NATNUMP (val) && *max_lookup < XFASTINT (val)) | ||
| 5556 | *max_lookup = XFASTINT (val); | ||
| 5557 | } | ||
| 5558 | else if (CONSP (translation_table)) | ||
| 5559 | { | ||
| 5560 | Lisp_Object tail, val; | ||
| 5558 | 5561 | ||
| 5559 | for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) | 5562 | for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) |
| 5560 | if (CHAR_TABLE_P (XCAR (tail)) | 5563 | if (CHAR_TABLE_P (XCAR (tail)) |
| 5561 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) | 5564 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) |
| 5562 | { | 5565 | { |
| 5563 | val = XCHAR_TABLE (XCAR (tail))->extras[1]; | 5566 | val = XCHAR_TABLE (XCAR (tail))->extras[1]; |
| 5564 | if (NATNUMP (val) && *max_lookup < XFASTINT (val)) | 5567 | if (NATNUMP (val) && *max_lookup < XFASTINT (val)) |
| 5565 | *max_lookup = XFASTINT (val); | 5568 | *max_lookup = XFASTINT (val); |
| 5566 | } | 5569 | } |
| 5570 | } | ||
| 5567 | } | 5571 | } |
| 5568 | return translation_table; | 5572 | return translation_table; |
| 5569 | } | 5573 | } |
| @@ -6002,7 +6006,6 @@ decode_coding (coding) | |||
| 6002 | Lisp_Object undo_list; | 6006 | Lisp_Object undo_list; |
| 6003 | Lisp_Object translation_table; | 6007 | Lisp_Object translation_table; |
| 6004 | int carryover; | 6008 | int carryover; |
| 6005 | int max_lookup; | ||
| 6006 | int i; | 6009 | int i; |
| 6007 | 6010 | ||
| 6008 | if (BUFFERP (coding->src_object) | 6011 | if (BUFFERP (coding->src_object) |
| @@ -6031,7 +6034,7 @@ decode_coding (coding) | |||
| 6031 | ALLOC_CONVERSION_WORK_AREA (coding); | 6034 | ALLOC_CONVERSION_WORK_AREA (coding); |
| 6032 | 6035 | ||
| 6033 | attrs = CODING_ID_ATTRS (coding->id); | 6036 | attrs = CODING_ID_ATTRS (coding->id); |
| 6034 | translation_table = get_translation_table (attrs, 0, &max_lookup); | 6037 | translation_table = get_translation_table (attrs, 0, NULL); |
| 6035 | 6038 | ||
| 6036 | carryover = 0; | 6039 | carryover = 0; |
| 6037 | do | 6040 | do |
| @@ -7354,7 +7357,7 @@ DEFUN ("find-coding-systems-region-internal", | |||
| 7354 | && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) | 7357 | && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) |
| 7355 | { | 7358 | { |
| 7356 | ASET (attrs, coding_attr_trans_tbl, | 7359 | ASET (attrs, coding_attr_trans_tbl, |
| 7357 | get_translation_table (attrs, 1)); | 7360 | get_translation_table (attrs, 1, NULL)); |
| 7358 | coding_attrs_list = Fcons (attrs, coding_attrs_list); | 7361 | coding_attrs_list = Fcons (attrs, coding_attrs_list); |
| 7359 | } | 7362 | } |
| 7360 | } | 7363 | } |
| @@ -7449,7 +7452,7 @@ to the string. */) | |||
| 7449 | return Qnil; | 7452 | return Qnil; |
| 7450 | ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); | 7453 | ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); |
| 7451 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); | 7454 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); |
| 7452 | translation_table = get_translation_table (attrs, 1); | 7455 | translation_table = get_translation_table (attrs, 1, NULL); |
| 7453 | 7456 | ||
| 7454 | if (NILP (string)) | 7457 | if (NILP (string)) |
| 7455 | { | 7458 | { |
| @@ -7592,7 +7595,8 @@ buffer positions. END is ignored. */) | |||
| 7592 | { | 7595 | { |
| 7593 | elt = XCAR (tail); | 7596 | elt = XCAR (tail); |
| 7594 | attrs = AREF (CODING_SYSTEM_SPEC (elt), 0); | 7597 | attrs = AREF (CODING_SYSTEM_SPEC (elt), 0); |
| 7595 | ASET (attrs, coding_attr_trans_tbl, get_translation_table (attrs, 1)); | 7598 | ASET (attrs, coding_attr_trans_tbl, |
| 7599 | get_translation_table (attrs, 1, NULL)); | ||
| 7596 | list = Fcons (Fcons (elt, Fcons (attrs, Qnil)), list); | 7600 | list = Fcons (Fcons (elt, Fcons (attrs, Qnil)), list); |
| 7597 | } | 7601 | } |
| 7598 | 7602 | ||