Mercurial > emacs
comparison src/coding.c @ 50487:db1e3303096f
(coding_system_accept_latin_extra_p): New function.
(find_safe_codings): Pay attention to characters registered in
latin-extra-code-table.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Tue, 08 Apr 2003 11:27:28 +0000 |
| parents | b67e5e5b8fc4 |
| children | 43076e9d9aaa |
comparison
equal
deleted
inserted
replaced
| 50486:b67e5e5b8fc4 | 50487:db1e3303096f |
|---|---|
| 6395 SBYTES (string) + 1, | 6395 SBYTES (string) + 1, |
| 6396 !NILP (highest), | 6396 !NILP (highest), |
| 6397 STRING_MULTIBYTE (string)); | 6397 STRING_MULTIBYTE (string)); |
| 6398 } | 6398 } |
| 6399 | 6399 |
| 6400 static int coding_system_accept_latin_extra_p P_ ((Lisp_Object)); | |
| 6401 | |
| 6402 static int | |
| 6403 coding_system_accept_latin_extra_p (coding_system) | |
| 6404 Lisp_Object coding_system; | |
| 6405 { | |
| 6406 Lisp_Object coding_spec, coding_type, flags; | |
| 6407 | |
| 6408 coding_spec = Fget (coding_system, Qcoding_system); | |
| 6409 if (! VECTORP (coding_spec) | |
| 6410 || ASIZE (coding_spec) != 5) | |
| 6411 return 0; | |
| 6412 coding_type = AREF (coding_spec, 0); | |
| 6413 if (! EQ (coding_type, make_number (2))) | |
| 6414 return 0; | |
| 6415 flags = AREF (coding_spec, 4); | |
| 6416 return (VECTORP (flags) | |
| 6417 && ! NILP (AREF (flags, CODING_FLAG_ISO_LATIN_EXTRA))); | |
| 6418 } | |
| 6419 | |
| 6400 /* Subroutine for Fsafe_coding_systems_region_internal. | 6420 /* Subroutine for Fsafe_coding_systems_region_internal. |
| 6401 | 6421 |
| 6402 Return a list of coding systems that safely encode the multibyte | 6422 Return a list of coding systems that safely encode the multibyte |
| 6403 text between P and PEND. SAFE_CODINGS, if non-nil, is a list of | 6423 text between P and PEND. SAFE_CODINGS, if non-nil, is a list of |
| 6404 possible coding systems. If it is nil, it means that we have not | 6424 possible coding systems. If it is nil, it means that we have not |
| 6442 Faset (work_table, ch, Qt); | 6462 Faset (work_table, ch, Qt); |
| 6443 | 6463 |
| 6444 for (prev = tail = safe_codings; CONSP (tail); tail = XCDR (tail)) | 6464 for (prev = tail = safe_codings; CONSP (tail); tail = XCDR (tail)) |
| 6445 { | 6465 { |
| 6446 val = XCAR (tail); | 6466 val = XCAR (tail); |
| 6447 if (NILP (Faref (XCDR (val), ch))) | 6467 if (NILP (Faref (XCDR (val), ch)) |
| 6468 && !(SINGLE_BYTE_CHAR_P (c) | |
| 6469 && VECTORP (Vlatin_extra_code_table) | |
| 6470 && ! NILP (AREF (Vlatin_extra_code_table, c)) | |
| 6471 && coding_system_accept_latin_extra_p (XCAR (val)))) | |
| 6448 { | 6472 { |
| 6449 /* Exclued this coding system from SAFE_CODINGS. */ | 6473 /* Exclued this coding system from SAFE_CODINGS. */ |
| 6450 if (EQ (tail, safe_codings)) | 6474 if (EQ (tail, safe_codings)) |
| 6451 safe_codings = XCDR (safe_codings); | 6475 safe_codings = XCDR (safe_codings); |
| 6452 else | 6476 else |
