diff options
| author | Kenichi Handa | 2002-03-01 01:49:30 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-03-01 01:49:30 +0000 |
| commit | ea0ffe21113b62bd672671858912c99e0842370d (patch) | |
| tree | db7cd58be0c0f7792c5579094c98fc2c0a58fdfe | |
| parent | 43d69cebd57d9a40d415f2b4534f05ad343e1a00 (diff) | |
| download | emacs-ea0ffe21113b62bd672671858912c99e0842370d.tar.gz emacs-ea0ffe21113b62bd672671858912c99e0842370d.zip | |
Include "character.h".
(get_next_display_element): Adjusted for the new multibyte form.
(disp_char_vector): Adjusted for the new char table structure.
(decode_mode_spec_coding): Adjusted for the new structure of
coding system.
(decode_mode_spec): Adjusted for the new code-conversion API.
| -rw-r--r-- | src/xdisp.c | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index d06e5e1aecf..43a831b77f9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -176,6 +176,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 176 | #include "termchar.h" | 176 | #include "termchar.h" |
| 177 | #include "dispextern.h" | 177 | #include "dispextern.h" |
| 178 | #include "buffer.h" | 178 | #include "buffer.h" |
| 179 | #include "character.h" | ||
| 179 | #include "charset.h" | 180 | #include "charset.h" |
| 180 | #include "indent.h" | 181 | #include "indent.h" |
| 181 | #include "commands.h" | 182 | #include "commands.h" |
| @@ -4231,9 +4232,9 @@ get_next_display_element (it) | |||
| 4231 | else if ((it->c < ' ' | 4232 | else if ((it->c < ' ' |
| 4232 | && (it->area != TEXT_AREA | 4233 | && (it->area != TEXT_AREA |
| 4233 | || (it->c != '\n' && it->c != '\t'))) | 4234 | || (it->c != '\n' && it->c != '\t'))) |
| 4234 | || (it->c >= 127 | 4235 | || (it->multibyte_p ? CHAR_BYTE8_P (it->c) : it->c >= 127) |
| 4235 | && it->len == 1) | 4236 | || (it->c != '\n' && it->c != '\t' |
| 4236 | || !CHAR_PRINTABLE_P (it->c)) | 4237 | && !CHAR_PRINTABLE_P (it->c))) |
| 4237 | { | 4238 | { |
| 4238 | /* IT->c is a control character which must be displayed | 4239 | /* IT->c is a control character which must be displayed |
| 4239 | either as '\003' or as `^C' where the '\\' and '^' | 4240 | either as '\003' or as `^C' where the '\\' and '^' |
| @@ -4279,24 +4280,28 @@ get_next_display_element (it) | |||
| 4279 | else | 4280 | else |
| 4280 | escape_glyph = FAST_MAKE_GLYPH ('\\', 0); | 4281 | escape_glyph = FAST_MAKE_GLYPH ('\\', 0); |
| 4281 | 4282 | ||
| 4282 | if (SINGLE_BYTE_CHAR_P (it->c)) | 4283 | if (CHAR_BYTE8_P (it->c)) |
| 4283 | str[0] = it->c, len = 1; | 4284 | { |
| 4285 | str[0] = CHAR_TO_BYTE8 (it->c); | ||
| 4286 | len = 1; | ||
| 4287 | } | ||
| 4288 | else if (it->c < 256) | ||
| 4289 | { | ||
| 4290 | str[0] = it->c; | ||
| 4291 | len = 1; | ||
| 4292 | } | ||
| 4284 | else | 4293 | else |
| 4285 | { | 4294 | { |
| 4286 | len = CHAR_STRING_NO_SIGNAL (it->c, str); | 4295 | /* It's an invalid character, which |
| 4287 | if (len < 0) | 4296 | shouldn't happen actually, but due to |
| 4288 | { | 4297 | bugs it may happen. Let's print the char |
| 4289 | /* It's an invalid character, which | 4298 | as is, there's not much meaningful we can |
| 4290 | shouldn't happen actually, but due to | 4299 | do with it. */ |
| 4291 | bugs it may happen. Let's print the char | 4300 | str[0] = it->c; |
| 4292 | as is, there's not much meaningful we can | 4301 | str[1] = it->c >> 8; |
| 4293 | do with it. */ | 4302 | str[2] = it->c >> 16; |
| 4294 | str[0] = it->c; | 4303 | str[3] = it->c >> 24; |
| 4295 | str[1] = it->c >> 8; | 4304 | len = 4; |
| 4296 | str[2] = it->c >> 16; | ||
| 4297 | str[3] = it->c >> 24; | ||
| 4298 | len = 4; | ||
| 4299 | } | ||
| 4300 | } | 4305 | } |
| 4301 | 4306 | ||
| 4302 | for (i = 0; i < len; i++) | 4307 | for (i = 0; i < len; i++) |
| @@ -9235,36 +9240,25 @@ disp_char_vector (dp, c) | |||
| 9235 | struct Lisp_Char_Table *dp; | 9240 | struct Lisp_Char_Table *dp; |
| 9236 | int c; | 9241 | int c; |
| 9237 | { | 9242 | { |
| 9238 | int code[4], i; | ||
| 9239 | Lisp_Object val; | 9243 | Lisp_Object val; |
| 9240 | 9244 | ||
| 9241 | if (SINGLE_BYTE_CHAR_P (c)) | 9245 | if (ASCII_CHAR_P (c)) |
| 9242 | return (dp->contents[c]); | ||
| 9243 | |||
| 9244 | SPLIT_CHAR (c, code[0], code[1], code[2]); | ||
| 9245 | if (code[1] < 32) | ||
| 9246 | code[1] = -1; | ||
| 9247 | else if (code[2] < 32) | ||
| 9248 | code[2] = -1; | ||
| 9249 | |||
| 9250 | /* Here, the possible range of code[0] (== charset ID) is | ||
| 9251 | 128..max_charset. Since the top level char table contains data | ||
| 9252 | for multibyte characters after 256th element, we must increment | ||
| 9253 | code[0] by 128 to get a correct index. */ | ||
| 9254 | code[0] += 128; | ||
| 9255 | code[3] = -1; /* anchor */ | ||
| 9256 | |||
| 9257 | for (i = 0; code[i] >= 0; i++, dp = XCHAR_TABLE (val)) | ||
| 9258 | { | 9246 | { |
| 9259 | val = dp->contents[code[i]]; | 9247 | val = dp->ascii; |
| 9260 | if (!SUB_CHAR_TABLE_P (val)) | 9248 | if (SUB_CHAR_TABLE_P (val)) |
| 9261 | return (NILP (val) ? dp->defalt : val); | 9249 | val = XSUB_CHAR_TABLE (val)->contents[c]; |
| 9262 | } | 9250 | } |
| 9263 | 9251 | else | |
| 9264 | /* Here, val is a sub char table. We return the default value of | 9252 | { |
| 9265 | it. */ | 9253 | Lisp_Object table; |
| 9266 | return (dp->defalt); | 9254 | |
| 9267 | } | 9255 | XSETCHAR_TABLE (table, dp); |
| 9256 | val = char_table_ref (table, c); | ||
| 9257 | } | ||
| 9258 | if (NILP (val)) | ||
| 9259 | val = dp->defalt; | ||
| 9260 | return val; | ||
| 9261 | } | ||
| 9268 | 9262 | ||
| 9269 | 9263 | ||
| 9270 | 9264 | ||
| @@ -13946,7 +13940,7 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) | |||
| 13946 | /* The EOL conversion we are using. */ | 13940 | /* The EOL conversion we are using. */ |
| 13947 | Lisp_Object eoltype; | 13941 | Lisp_Object eoltype; |
| 13948 | 13942 | ||
| 13949 | val = Fget (coding_system, Qcoding_system); | 13943 | val = CODING_SYSTEM_SPEC (coding_system); |
| 13950 | eoltype = Qnil; | 13944 | eoltype = Qnil; |
| 13951 | 13945 | ||
| 13952 | if (!VECTORP (val)) /* Not yet decided. */ | 13946 | if (!VECTORP (val)) /* Not yet decided. */ |
| @@ -13959,12 +13953,14 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) | |||
| 13959 | } | 13953 | } |
| 13960 | else | 13954 | else |
| 13961 | { | 13955 | { |
| 13956 | Lisp_Object attrs; | ||
| 13962 | Lisp_Object eolvalue; | 13957 | Lisp_Object eolvalue; |
| 13963 | 13958 | ||
| 13964 | eolvalue = Fget (coding_system, Qeol_type); | 13959 | attrs = AREF (val, 0); |
| 13960 | eolvalue = AREF (val, 2); | ||
| 13965 | 13961 | ||
| 13966 | if (multibyte) | 13962 | if (multibyte) |
| 13967 | *buf++ = XFASTINT (AREF (val, 1)); | 13963 | *buf++ = XFASTINT (CODING_ATTR_MNEMONIC (attrs)); |
| 13968 | 13964 | ||
| 13969 | if (eol_flag) | 13965 | if (eol_flag) |
| 13970 | { | 13966 | { |
| @@ -13974,10 +13970,10 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) | |||
| 13974 | eoltype = eol_mnemonic_undecided; | 13970 | eoltype = eol_mnemonic_undecided; |
| 13975 | else if (VECTORP (eolvalue)) /* Not yet decided. */ | 13971 | else if (VECTORP (eolvalue)) /* Not yet decided. */ |
| 13976 | eoltype = eol_mnemonic_undecided; | 13972 | eoltype = eol_mnemonic_undecided; |
| 13977 | else /* INTEGERP (eolvalue) -- 0:LF, 1:CRLF, 2:CR */ | 13973 | else /* eolvalue is Qunix, Qdos, or Qmac. */ |
| 13978 | eoltype = (XFASTINT (eolvalue) == 0 | 13974 | eoltype = (EQ (eolvalue, Qunix) |
| 13979 | ? eol_mnemonic_unix | 13975 | ? eol_mnemonic_unix |
| 13980 | : (XFASTINT (eolvalue) == 1 | 13976 | : (EQ (eolvalue, Qdos) == 1 |
| 13981 | ? eol_mnemonic_dos : eol_mnemonic_mac)); | 13977 | ? eol_mnemonic_dos : eol_mnemonic_mac)); |
| 13982 | } | 13978 | } |
| 13983 | } | 13979 | } |
| @@ -14339,8 +14335,10 @@ decode_mode_spec (w, c, field_width, precision, multibyte) | |||
| 14339 | { | 14335 | { |
| 14340 | /* No need to mention EOL here--the terminal never needs | 14336 | /* No need to mention EOL here--the terminal never needs |
| 14341 | to do EOL conversion. */ | 14337 | to do EOL conversion. */ |
| 14342 | p = decode_mode_spec_coding (keyboard_coding.symbol, p, 0); | 14338 | p = decode_mode_spec_coding (CODING_ID_NAME (keyboard_coding.id), |
| 14343 | p = decode_mode_spec_coding (terminal_coding.symbol, p, 0); | 14339 | p, 0); |
| 14340 | p = decode_mode_spec_coding (CODING_ID_NAME (terminal_coding.id), | ||
| 14341 | p, 0); | ||
| 14344 | } | 14342 | } |
| 14345 | p = decode_mode_spec_coding (b->buffer_file_coding_system, | 14343 | p = decode_mode_spec_coding (b->buffer_file_coding_system, |
| 14346 | p, eol_flag); | 14344 | p, eol_flag); |