From 0bea9e9b587805dae5f1f309c12f2391c824805c Mon Sep 17 00:00:00 2001 From: tomo Date: Wed, 26 Jan 2000 09:26:16 +0000 Subject: [PATCH] (char_encode_shift_jis): Modify for `charset_code_point'. (char_encode_iso2022): Likewise. --- src/text-coding.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/text-coding.c b/src/text-coding.c index 5d77048..a9a085a 100644 --- a/src/text-coding.c +++ b/src/text-coding.c @@ -1,6 +1,7 @@ /* Code conversion functions. Copyright (C) 1991, 1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 1999,2000 MORIOKA Tomohiko This file is part of XEmacs. @@ -3067,13 +3068,12 @@ char_encode_shift_jis (struct encoding_stream *str, Emchar ch, Lisp_Object charset; unsigned int c1, c2, s1, s2; #ifdef UTF2000 - Lisp_Object value = charset_code_point (Vcharset_latin_jisx0201, ch); - Lisp_Object ret = Fcar (value); + int code_point = charset_code_point (Vcharset_latin_jisx0201, ch); - if (INTP (ret)) + if (code_point >= 0) { charset = Vcharset_latin_jisx0201; - c1 = XINT (ret); + c1 = code_point; c2 = 0; } else @@ -4876,31 +4876,25 @@ char_encode_iso2022 (struct encoding_stream *str, Emchar ch, reg = -1; for (i = 0; i < 4; i++) { - Lisp_Object code_point; + int code_point; if ((CHARSETP (charset = str->iso2022.charset[i]) - && !EQ (code_point = charset_code_point (charset, ch), Qnil)) + && ((code_point = charset_code_point (charset, ch)) >= 0)) || (CHARSETP (charset = CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i)) - && !EQ (code_point = charset_code_point (charset, ch), Qnil))) + && ((code_point = charset_code_point (charset, ch)) >= 0))) { - Lisp_Object ret = Fcar (code_point); - - if (INTP (ret)) + if (XCHARSET_DIMENSION (charset) == 1) { - byte1 = XINT (ret); - ret = Fcar (Fcdr (code_point)); - if (INTP (ret)) - byte2 = XINT (ret); - else - byte2 = 0; + byte1 = code_point; + byte2 = 0; } - else + else /* if (XCHARSET_DIMENSION (charset) == 2) */ { - byte1 = 0; - byte2 = 0; + byte1 = code_point >> 8; + byte2 = code_point & 255; } reg = i; break; -- 1.7.10.4