comparison src/mule-coding.c @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents cca96a509cfe
children 9ad43877534d
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
477 Return the name of the given coding system. 477 Return the name of the given coding system.
478 */ 478 */
479 (coding_system)) 479 (coding_system))
480 { 480 {
481 coding_system = Fget_coding_system (coding_system); 481 coding_system = Fget_coding_system (coding_system);
482 return (XCODING_SYSTEM_NAME (coding_system)); 482 return XCODING_SYSTEM_NAME (coding_system);
483 } 483 }
484 484
485 static struct Lisp_Coding_System * 485 static struct Lisp_Coding_System *
486 allocate_coding_system (int type, Lisp_Object name) 486 allocate_coding_system (int type, Lisp_Object name)
487 { 487 {
2931 } 2931 }
2932 2932
2933 2933
2934 DEFUN ("decode-big5-char", Fdecode_big5_char, 1, 1, 0, /* 2934 DEFUN ("decode-big5-char", Fdecode_big5_char, 1, 1, 0, /*
2935 Decode a Big5 character CODE of BIG5 coding-system. 2935 Decode a Big5 character CODE of BIG5 coding-system.
2936 CODE is the character code in BIG5. 2936 CODE is the character code in BIG5, a cons of two integers.
2937 Return the corresponding character. 2937 Return the corresponding character.
2938 */ 2938 */
2939 (code)) 2939 (code))
2940 { 2940 {
2941 unsigned char c1, c2, b1, b2; 2941 unsigned char c1, c2, b1, b2;
2942 Lisp_Object charset;
2943 2942
2944 CHECK_CONS (code); 2943 CHECK_CONS (code);
2945 CHECK_INT (XCAR (code)); 2944 CHECK_INT (XCAR (code));
2946 CHECK_INT (XCDR (code)); 2945 CHECK_INT (XCDR (code));
2947 b1 = XINT (XCAR (code)); 2946 b1 = XINT (XCAR (code));
2948 b2 = XINT (XCDR (code)); 2947 b2 = XINT (XCDR (code));
2949 if (BYTE_BIG5_TWO_BYTE_1_P (b1) && 2948 if (BYTE_BIG5_TWO_BYTE_1_P (b1) &&
2950 BYTE_BIG5_TWO_BYTE_2_P (b2)) 2949 BYTE_BIG5_TWO_BYTE_2_P (b2))
2951 { 2950 {
2952 DECODE_BIG5 (b1, b2, XCHARSET_LEADING_BYTE (charset), c1, c2); 2951 int leading_byte;
2952 Lisp_Object charset;
2953 DECODE_BIG5 (b1, b2, leading_byte, c1, c2);
2954 charset = CHARSET_BY_LEADING_BYTE (leading_byte);
2953 return make_char (MAKE_CHAR (charset, c1 & 0x7F, c2 & 0x7F)); 2955 return make_char (MAKE_CHAR (charset, c1 & 0x7F, c2 & 0x7F));
2954 } 2956 }
2955 else 2957 else
2956 return Qnil; 2958 return Qnil;
2957 } 2959 }
3434 return 0; /* bad final byte */ 3436 return 0; /* bad final byte */
3435 3437
3436 if (iso->esc >= ISO_ESC_2_8 && 3438 if (iso->esc >= ISO_ESC_2_8 &&
3437 iso->esc <= ISO_ESC_2_15) 3439 iso->esc <= ISO_ESC_2_15)
3438 { 3440 {
3439 if (iso->esc >= ISO_ESC_2_12) 3441 type = ((iso->esc >= ISO_ESC_2_12) ?
3440 type = CHARSET_TYPE_96; 3442 CHARSET_TYPE_96 : CHARSET_TYPE_94);
3441 else
3442 type = CHARSET_TYPE_94;
3443 reg = (iso->esc - ISO_ESC_2_8) & 3; 3443 reg = (iso->esc - ISO_ESC_2_8) & 3;
3444 } 3444 }
3445 else if (iso->esc >= ISO_ESC_2_4_8 && 3445 else if (iso->esc >= ISO_ESC_2_4_8 &&
3446 iso->esc <= ISO_ESC_2_4_15) 3446 iso->esc <= ISO_ESC_2_4_15)
3447 { 3447 {
3448 if (iso->esc >= ISO_ESC_2_4_12) 3448 type = ((iso->esc >= ISO_ESC_2_4_12) ?
3449 type = CHARSET_TYPE_96X96; 3449 CHARSET_TYPE_96X96 : CHARSET_TYPE_94X94);
3450 else
3451 type = CHARSET_TYPE_94X94;
3452 reg = (iso->esc - ISO_ESC_2_4_8) & 3; 3450 reg = (iso->esc - ISO_ESC_2_4_8) & 3;
3453 } 3451 }
3454 3452
3455 cs = CHARSET_BY_ATTRIBUTES (type, c, 3453 cs = CHARSET_BY_ATTRIBUTES (type, c,
3456 *flags & CODING_STATE_R2L ? 3454 *flags & CODING_STATE_R2L ?
4064 Lisp_Object charset; 4062 Lisp_Object charset;
4065 int half; 4063 int half;
4066 4064
4067 /* flags for handling composite chars. We do a little switcharoo 4065 /* flags for handling composite chars. We do a little switcharoo
4068 on the source while we're outputting the composite char. */ 4066 on the source while we're outputting the composite char. */
4069 unsigned int saved_n; 4067 unsigned int saved_n = 0;
4070 CONST unsigned char *saved_src; 4068 CONST unsigned char *saved_src = NULL;
4071 int in_composite = 0; 4069 int in_composite = 0;
4072 4070
4073 CODING_STREAM_DECOMPOSE (str, flags, ch); 4071 CODING_STREAM_DECOMPOSE (str, flags, ch);
4074 eol = CODING_SYSTEM_EOL_TYPE (str->codesys); 4072 eol = CODING_SYSTEM_EOL_TYPE (str->codesys);
4075 char_boundary = str->iso2022.current_char_boundary; 4073 char_boundary = str->iso2022.current_char_boundary;