60 |
all variants of ISO2022. Details are described in section 3. |
all variants of ISO2022. Details are described in section 3. |
61 |
|
|
62 |
2. SJIS (or Shift-JIS or MS-Kanji-Code) |
2. SJIS (or Shift-JIS or MS-Kanji-Code) |
63 |
|
|
64 |
A coding system to encode character sets: ASCII, JISX0201, and |
A coding system to encode character sets: ASCII, JISX0201, and |
65 |
JISX0208. Widely used for PC's in Japan. Details are described in |
JISX0208. Widely used for PC's in Japan. Details are described in |
66 |
section 4. |
section 4. |
503 |
struct coding_system *coding; |
struct coding_system *coding; |
504 |
{ |
{ |
505 |
Lisp_Object coding_spec, plist, safe_chars; |
Lisp_Object coding_spec, plist, safe_chars; |
506 |
|
|
507 |
coding_spec = Fget (coding->symbol, Qcoding_system); |
coding_spec = Fget (coding->symbol, Qcoding_system); |
508 |
plist = XVECTOR (coding_spec)->contents[3]; |
plist = XVECTOR (coding_spec)->contents[3]; |
509 |
safe_chars = Fplist_get (XVECTOR (coding_spec)->contents[3], Qsafe_chars); |
safe_chars = Fplist_get (XVECTOR (coding_spec)->contents[3], Qsafe_chars); |
889 |
CODING_ADD_COMPOSITION_START (coding, coding->produced_char, method); |
CODING_ADD_COMPOSITION_START (coding, coding->produced_char, method); |
890 |
for (i = 0; i < ncomponent; i++) |
for (i = 0; i < ncomponent; i++) |
891 |
CODING_ADD_COMPOSITION_COMPONENT (coding, component[i]); |
CODING_ADD_COMPOSITION_COMPONENT (coding, component[i]); |
892 |
CODING_ADD_COMPOSITION_END (coding, coding->produced_char + nchars); |
CODING_ADD_COMPOSITION_END (coding, coding->produced_char + nchars); |
893 |
if (buf < bufp) |
if (buf < bufp) |
894 |
{ |
{ |
895 |
unsigned char *p = buf; |
unsigned char *p = buf; |
1055 |
coding->cmp_data_start = 0; \ |
coding->cmp_data_start = 0; \ |
1056 |
} \ |
} \ |
1057 |
} while (0) |
} while (0) |
1058 |
|
|
1059 |
|
|
1060 |
static void encode_eol P_ ((struct coding_system *, unsigned char *, |
static void encode_eol P_ ((struct coding_system *, unsigned char *, |
1061 |
unsigned char *, int, int)); |
unsigned char *, int, int)); |
1433 |
mask_found |= CODING_CATEGORY_MASK_ISO_SHIFT; |
mask_found |= CODING_CATEGORY_MASK_ISO_SHIFT; |
1434 |
} |
} |
1435 |
break; |
break; |
1436 |
|
|
1437 |
case ISO_CODE_SI: |
case ISO_CODE_SI: |
1438 |
if (inhibit_iso_escape_detection) |
if (inhibit_iso_escape_detection) |
1439 |
break; |
break; |
1665 |
|
|
1666 |
#define DECODE_COMPOSITION_END(c1) \ |
#define DECODE_COMPOSITION_END(c1) \ |
1667 |
do { \ |
do { \ |
1668 |
if (! COMPOSING (coding)) \ |
if (! COMPOSING_P (coding)) \ |
1669 |
{ \ |
{ \ |
1670 |
*dst++ = ISO_CODE_ESC; \ |
*dst++ = ISO_CODE_ESC; \ |
1671 |
*dst++ = c1; \ |
*dst++ = c1; \ |
2439 |
ONE_MORE_CHAR (c); |
ONE_MORE_CHAR (c); |
2440 |
if (c == '\n') |
if (c == '\n') |
2441 |
break; |
break; |
2442 |
|
|
2443 |
charset = CHAR_CHARSET (c); |
charset = CHAR_CHARSET (c); |
2444 |
reg = CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset); |
reg = CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset); |
2445 |
if (reg != CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION && r[reg] < 0) |
if (reg != CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION && r[reg] < 0) |
2609 |
*dst++ = ISO_CODE_CR; |
*dst++ = ISO_CODE_CR; |
2610 |
CODING_SPEC_ISO_BOL (coding) = 1; |
CODING_SPEC_ISO_BOL (coding) = 1; |
2611 |
} |
} |
2612 |
else |
else |
2613 |
{ |
{ |
2614 |
if (coding->flags & CODING_FLAG_ISO_RESET_AT_CNTL) |
if (coding->flags & CODING_FLAG_ISO_RESET_AT_CNTL) |
2615 |
ENCODE_RESET_PLANE_AND_REGISTER; |
ENCODE_RESET_PLANE_AND_REGISTER; |
3032 |
|
|
3033 |
src_base = src; |
src_base = src; |
3034 |
ONE_MORE_CHAR (c); |
ONE_MORE_CHAR (c); |
3035 |
|
|
3036 |
/* Now encode the character C. */ |
/* Now encode the character C. */ |
3037 |
if (SINGLE_BYTE_CHAR_P (c)) |
if (SINGLE_BYTE_CHAR_P (c)) |
3038 |
{ |
{ |
3357 |
|
|
3358 |
If the value is nil, graphic register N is never used on |
If the value is nil, graphic register N is never used on |
3359 |
encoding. |
encoding. |
3360 |
|
|
3361 |
sub-element[N] where N is 4 through 11: to be set in `coding->flags' |
sub-element[N] where N is 4 through 11: to be set in `coding->flags' |
3362 |
Each value takes t or nil. See the section ISO2022 of |
Each value takes t or nil. See the section ISO2022 of |
3363 |
`coding.h' for more information. |
`coding.h' for more information. |
3481 |
} |
} |
3482 |
else |
else |
3483 |
goto label_invalid_coding_system; |
goto label_invalid_coding_system; |
3484 |
|
|
3485 |
/* If the coding system has non-nil `composition' property, enable |
/* If the coding system has non-nil `composition' property, enable |
3486 |
composition handling. */ |
composition handling. */ |
3487 |
val = Fplist_get (plist, Qcomposition); |
val = Fplist_get (plist, Qcomposition); |
3621 |
} |
} |
3622 |
else |
else |
3623 |
CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1; |
CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1; |
3624 |
|
|
3625 |
CODING_SPEC_ISO_DESIGNATION (coding, i) |
CODING_SPEC_ISO_DESIGNATION (coding, i) |
3626 |
= CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i); |
= CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i); |
3627 |
} |
} |
3994 |
| CODING_CATEGORY_MASK_UTF_16_LE); |
| CODING_CATEGORY_MASK_UTF_16_LE); |
3995 |
|
|
3996 |
/* Or, if C is a special latin extra code, |
/* Or, if C is a special latin extra code, |
3997 |
or is an ISO2022 specific control code of C1 (SS2 or SS3), |
or is an ISO2022 specific control code of C1 (SS2 or SS3), |
3998 |
or is an ISO2022 control-sequence-introducer (CSI), |
or is an ISO2022 control-sequence-introducer (CSI), |
3999 |
we should also consider the possibility of ISO2022 codings. */ |
we should also consider the possibility of ISO2022 codings. */ |
4000 |
if ((VECTORP (Vlatin_extra_code_table) |
if ((VECTORP (Vlatin_extra_code_table) |
5101 |
break; |
break; |
5102 |
if (coding->flags & CODING_FLAG_ISO_DESIGNATE_AT_BOL) |
if (coding->flags & CODING_FLAG_ISO_DESIGNATE_AT_BOL) |
5103 |
{ |
{ |
5104 |
unsigned char *bol = begp; |
unsigned char *bol = begp; |
5105 |
while (begp < endp && *begp < 0x80) |
while (begp < endp && *begp < 0x80) |
5106 |
{ |
{ |
5107 |
begp++; |
begp++; |
5599 |
coding->symbol = XVECTOR (eol_type)->contents[CODING_EOL_LF]; |
coding->symbol = XVECTOR (eol_type)->contents[CODING_EOL_LF]; |
5600 |
else |
else |
5601 |
coding->symbol = saved_coding_symbol; |
coding->symbol = saved_coding_symbol; |
5602 |
|
|
5603 |
continue; |
continue; |
5604 |
} |
} |
5605 |
if (len_byte <= 0) |
if (len_byte <= 0) |
5617 |
if (multibyte_p) |
if (multibyte_p) |
5618 |
{ |
{ |
5619 |
unsigned char *start = dst; |
unsigned char *start = dst; |
5620 |
|
|
5621 |
inserted += len_byte; |
inserted += len_byte; |
5622 |
while (len_byte--) |
while (len_byte--) |
5623 |
{ |
{ |
5700 |
inserted_byte = str_to_multibyte (GPT_ADDR, GAP_SIZE, inserted_byte); |
inserted_byte = str_to_multibyte (GPT_ADDR, GAP_SIZE, inserted_byte); |
5701 |
} |
} |
5702 |
|
|
5703 |
/* If we shrank the conversion area, adjust it now. */ |
/* If we shrank the conversion area, adjust it now. */ |
5704 |
if (total_skip > 0) |
if (total_skip > 0) |
5705 |
{ |
{ |
5706 |
if (tail_skip > 0) |
if (tail_skip > 0) |
5942 |
} |
} |
5943 |
produced += num_eol; |
produced += num_eol; |
5944 |
produced_char += num_eol; |
produced_char += num_eol; |
5945 |
} |
} |
5946 |
/* Suppress eol-format conversion in the further conversion. */ |
/* Suppress eol-format conversion in the further conversion. */ |
5947 |
coding->eol_type = CODING_EOL_LF; |
coding->eol_type = CODING_EOL_LF; |
5948 |
|
|
6212 |
} |
} |
6213 |
} |
} |
6214 |
return (highest ? XCAR (val) : val); |
return (highest ? XCAR (val) : val); |
6215 |
} |
} |
6216 |
|
|
6217 |
DEFUN ("detect-coding-region", Fdetect_coding_region, Sdetect_coding_region, |
DEFUN ("detect-coding-region", Fdetect_coding_region, Sdetect_coding_region, |
6218 |
2, 3, 0, |
2, 3, 0, |
6408 |
for (p = p1; p < p1end && ASCII_BYTE_P (*p); p++); |
for (p = p1; p < p1end && ASCII_BYTE_P (*p); p++); |
6409 |
if (p == p1end) |
if (p == p1end) |
6410 |
{ |
{ |
6411 |
for (p = p2; p < p2end && ASCII_BYTE_P (*p); p++); |
for (p = p2; p < p2end && ASCII_BYTE_P (*p); p++); |
6412 |
if (p == p2end) |
if (p == p2end) |
6413 |
return Qt; |
return Qt; |
6414 |
} |
} |
6940 |
{ |
{ |
6941 |
int i; |
int i; |
6942 |
|
|
6943 |
/* Emacs' internal format specific initialize routine. */ |
/* Emacs' internal format specific initialize routine. */ |
6944 |
for (i = 0; i <= 0x20; i++) |
for (i = 0; i <= 0x20; i++) |
6945 |
emacs_code_class[i] = EMACS_control_code; |
emacs_code_class[i] = EMACS_control_code; |
6946 |
emacs_code_class[0x0A] = EMACS_linefeed_code; |
emacs_code_class[0x0A] = EMACS_linefeed_code; |