94 |
o BIG5 |
o BIG5 |
95 |
|
|
96 |
A coding system to encode character sets: ASCII and Big5. Widely |
A coding system to encode character sets: ASCII and Big5. Widely |
97 |
used by Chinese (mainly in Taiwan and Hong Kong). Details are |
used for Chinese (mainly in Taiwan and Hong Kong). Details are |
98 |
described in section 8. In this file, when we write "big5" (all |
described in section 8. In this file, when we write "big5" (all |
99 |
lowercase), we mean the coding system, and when we write "Big5" |
lowercase), we mean the coding system, and when we write "Big5" |
100 |
(capitalized), we mean the character set. |
(capitalized), we mean the character set. |
108 |
|
|
109 |
o Raw-text |
o Raw-text |
110 |
|
|
111 |
A coding system for a text containing raw eight-bit data. Emacs |
A coding system for text containing raw eight-bit data. Emacs |
112 |
treats each byte of source text as a character (except for |
treats each byte of source text as a character (except for |
113 |
end-of-line conversion). |
end-of-line conversion). |
114 |
|
|
587 |
(XSTRING (AREF (CODING_ID_ATTRS ((coding)->id), coding_attr_ccl_valids)) \ |
(XSTRING (AREF (CODING_ID_ATTRS ((coding)->id), coding_attr_ccl_valids)) \ |
588 |
->data) |
->data) |
589 |
|
|
590 |
/* Index for each coding category in `coding_category_table' */ |
/* Index for each coding category in `coding_categories' */ |
591 |
|
|
592 |
enum coding_category |
enum coding_category |
593 |
{ |
{ |
2049 |
|
|
2050 |
/* The following note describes the coding system ISO2022 briefly. |
/* The following note describes the coding system ISO2022 briefly. |
2051 |
Since the intention of this note is to help understand the |
Since the intention of this note is to help understand the |
2052 |
functions in this file, some parts are NOT ACCURATE or OVERLY |
functions in this file, some parts are NOT ACCURATE or are OVERLY |
2053 |
SIMPLIFIED. For thorough understanding, please refer to the |
SIMPLIFIED. For thorough understanding, please refer to the |
2054 |
original document of ISO2022. |
original document of ISO2022. This is equivalent to the standard |
2055 |
|
ECMA-35, obtainable from <URL:http://www.ecma.ch/> (*). |
2056 |
|
|
2057 |
ISO2022 provides many mechanisms to encode several character sets |
ISO2022 provides many mechanisms to encode several character sets |
2058 |
in 7-bit and 8-bit environments. For 7-bite environments, all text |
in 7-bit and 8-bit environments. For 7-bit environments, all text |
2059 |
is encoded using bytes less than 128. This may make the encoded |
is encoded using bytes less than 128. This may make the encoded |
2060 |
text a little bit longer, but the text passes more easily through |
text a little bit longer, but the text passes more easily through |
2061 |
several gateways, some of which strip off MSB (Most Signigant Bit). |
several types of gateway, some of which strip off the MSB (Most |
2062 |
|
Significant Bit). |
2063 |
|
|
2064 |
There are two kinds of character sets: control character set and |
There are two kinds of character sets: control character sets and |
2065 |
graphic character set. The former contains control characters such |
graphic character sets. The former contain control characters such |
2066 |
as `newline' and `escape' to provide control functions (control |
as `newline' and `escape' to provide control functions (control |
2067 |
functions are also provided by escape sequences). The latter |
functions are also provided by escape sequences). The latter |
2068 |
contains graphic characters such as 'A' and '-'. Emacs recognizes |
contain graphic characters such as 'A' and '-'. Emacs recognizes |
2069 |
two control character sets and many graphic character sets. |
two control character sets and many graphic character sets. |
2070 |
|
|
2071 |
Graphic character sets are classified into one of the following |
Graphic character sets are classified into one of the following |
2077 |
- DIMENSION2_CHARS96 |
- DIMENSION2_CHARS96 |
2078 |
|
|
2079 |
In addition, each character set is assigned an identification tag, |
In addition, each character set is assigned an identification tag, |
2080 |
unique for each set, called "final character" (denoted as <F> |
unique for each set, called the "final character" (denoted as <F> |
2081 |
hereafter). The <F> of each character set is decided by ECMA(*) |
hereafter). The <F> of each character set is decided by ECMA(*) |
2082 |
when it is registered in ISO. The code range of <F> is 0x30..0x7F |
when it is registered in ISO. The code range of <F> is 0x30..0x7F |
2083 |
(0x30..0x3F are for private use only). |
(0x30..0x3F are for private use only). |
2084 |
|
|
2085 |
Note (*): ECMA = European Computer Manufacturers Association |
Note (*): ECMA = European Computer Manufacturers Association |
2086 |
|
|
2087 |
Here are examples of graphic character set [NAME(<F>)]: |
Here are examples of graphic character sets [NAME(<F>)]: |
2088 |
o DIMENSION1_CHARS94 -- ASCII('B'), right-half-of-JISX0201('I'), ... |
o DIMENSION1_CHARS94 -- ASCII('B'), right-half-of-JISX0201('I'), ... |
2089 |
o DIMENSION1_CHARS96 -- right-half-of-ISO8859-1('A'), ... |
o DIMENSION1_CHARS96 -- right-half-of-ISO8859-1('A'), ... |
2090 |
o DIMENSION2_CHARS94 -- GB2312('A'), JISX0208('B'), ... |
o DIMENSION2_CHARS94 -- GB2312('A'), JISX0208('B'), ... |
2177 |
Note (**): If <F> is '@', 'A', or 'B', the intermediate character |
Note (**): If <F> is '@', 'A', or 'B', the intermediate character |
2178 |
'(' must be omitted. We refer to this as "short-form" hereafter. |
'(' must be omitted. We refer to this as "short-form" hereafter. |
2179 |
|
|
2180 |
Now you may notice that there are a lot of ways for encoding the |
Now you may notice that there are a lot of ways of encoding the |
2181 |
same multilingual text in ISO2022. Actually, there exist many |
same multilingual text in ISO2022. Actually, there exist many |
2182 |
coding systems such as Compound Text (used in X11's inter client |
coding systems such as Compound Text (used in X11's inter client |
2183 |
communication, ISO-2022-JP (used in Japanese internet), ISO-2022-KR |
communication, ISO-2022-JP (used in Japanese Internet), ISO-2022-KR |
2184 |
(used in Korean internet), EUC (Extended UNIX Code, used in Asian |
(used in Korean Internet), EUC (Extended UNIX Code, used in Asian |
2185 |
localized platforms), and all of these are variants of ISO2022. |
localized platforms), and all of these are variants of ISO2022. |
2186 |
|
|
2187 |
In addition to the above, Emacs handles two more kinds of escape |
In addition to the above, Emacs handles two more kinds of escape |
2203 |
o ESC '3' -- start relative composition with alternate chars (**) |
o ESC '3' -- start relative composition with alternate chars (**) |
2204 |
o ESC '4' -- start rule-base composition with alternate chars (**) |
o ESC '4' -- start rule-base composition with alternate chars (**) |
2205 |
Since these are not standard escape sequences of any ISO standard, |
Since these are not standard escape sequences of any ISO standard, |
2206 |
the use of them for these meaning is restricted to Emacs only. |
the use of them with these meanings is restricted to Emacs only. |
2207 |
|
|
2208 |
(*) This form is used only in Emacs 20.5 and the older versions, |
(*) This form is used only in Emacs 20.7 and older versions, |
2209 |
but the newer versions can safely decode it. |
but newer versions can safely decode it. |
2210 |
(**) This form is used only in Emacs 21.1 and the newer versions, |
(**) This form is used only in Emacs 21.1 and newer versions, |
2211 |
and the older versions can't decode it. |
and older versions can't decode it. |
2212 |
|
|
2213 |
Here's a list of examples usages of these composition escape |
Here's a list of example usages of these composition escape |
2214 |
sequences (categorized by `enum composition_method'). |
sequences (categorized by `enum composition_method'). |
2215 |
|
|
2216 |
COMPOSITION_RELATIVE: |
COMPOSITION_RELATIVE: |
2217 |
ESC 0 CHAR [ CHAR ] ESC 1 |
ESC 0 CHAR [ CHAR ] ESC 1 |
2218 |
COMPOSITOIN_WITH_RULE: |
COMPOSITION_WITH_RULE: |
2219 |
ESC 2 CHAR [ RULE CHAR ] ESC 1 |
ESC 2 CHAR [ RULE CHAR ] ESC 1 |
2220 |
COMPOSITION_WITH_ALTCHARS: |
COMPOSITION_WITH_ALTCHARS: |
2221 |
ESC 3 ALTCHAR [ ALTCHAR ] ESC 0 CHAR [ CHAR ] ESC 1 |
ESC 3 ALTCHAR [ ALTCHAR ] ESC 0 CHAR [ CHAR ] ESC 1 |
4537 |
|
|
4538 |
/*** 7. C library functions ***/ |
/*** 7. C library functions ***/ |
4539 |
|
|
|
/* In Emacs Lisp, coding system is represented by a Lisp symbol which |
|
|
has a property `coding-system'. The value of this property is a |
|
|
vector of length 5 (called as coding-vector). Among elements of |
|
|
this vector, the first (element[0]) and the fifth (element[4]) |
|
|
carry important information for decoding/encoding. Before |
|
|
decoding/encoding, this information should be set in fields of a |
|
|
structure of type `coding_system'. |
|
|
|
|
|
A value of property `coding-system' can be a symbol of another |
|
|
subsidiary coding-system. In that case, Emacs gets coding-vector |
|
|
from that symbol. |
|
|
|
|
|
`element[0]' contains information to be set in `coding->type'. The |
|
|
value and its meaning is as follows: |
|
|
|
|
|
0 -- coding_type_emacs_mule |
|
|
1 -- coding_type_sjis |
|
|
2 -- coding_type_iso_2022 |
|
|
3 -- coding_type_big5 |
|
|
4 -- coding_type_ccl encoder/decoder written in CCL |
|
|
nil -- coding_type_no_conversion |
|
|
t -- coding_type_undecided (automatic conversion on decoding, |
|
|
no-conversion on encoding) |
|
|
|
|
|
`element[4]' contains information to be set in `coding->flags' and |
|
|
`coding->spec'. The meaning varies by `coding->type'. |
|
|
|
|
|
If `coding->type' is `coding_type_iso_2022', element[4] is a vector |
|
|
of length 32 (of which the first 13 sub-elements are used now). |
|
|
Meanings of these sub-elements are: |
|
|
|
|
|
sub-element[N] where N is 0 through 3: to be set in `coding->spec.iso_2022' |
|
|
If the value is an integer of valid charset, the charset is |
|
|
assumed to be designated to graphic register N initially. |
|
|
|
|
|
If the value is minus, it is a minus value of charset which |
|
|
reserves graphic register N, which means that the charset is |
|
|
not designated initially but should be designated to graphic |
|
|
register N just before encoding a character in that charset. |
|
|
|
|
|
If the value is nil, graphic register N is never used on |
|
|
encoding. |
|
|
|
|
|
sub-element[N] where N is 4 through 11: to be set in `coding->flags' |
|
|
Each value takes t or nil. See the section ISO2022 of |
|
|
`coding.h' for more information. |
|
|
|
|
|
If `coding->type' is `coding_type_big5', element[4] is t to denote |
|
|
BIG5-ETen or nil to denote BIG5-HKU. |
|
|
|
|
|
If `coding->type' takes the other value, element[4] is ignored. |
|
|
|
|
|
Emacs Lisp's coding system also carries information about format of |
|
|
end-of-line in a value of property `eol-type'. If the value is |
|
|
integer, 0 means eol_lf, 1 means eol_crlf, and 2 means eol_cr. If |
|
|
it is not integer, it should be a vector of subsidiary coding |
|
|
systems of which property `eol-type' has one of above values. |
|
|
|
|
|
*/ |
|
|
|
|
4540 |
/* Setup coding context CODING from information about CODING_SYSTEM. |
/* Setup coding context CODING from information about CODING_SYSTEM. |
4541 |
If CODING_SYSTEM is nil, `no-conversion' is assumed. If |
If CODING_SYSTEM is nil, `no-conversion' is assumed. If |
4542 |
CODING_SYSTEM is invalid, signal an error. */ |
CODING_SYSTEM is invalid, signal an error. */ |