mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Close #17693: Rewrite CJK decoders to use the _PyUnicodeWriter API instead of
the legacy Py_UNICODE API. Add also a new _PyUnicodeWriter_WriteChar() function.
This commit is contained in:
parent
d8a5cc91e6
commit
a0dd0213cc
15 changed files with 401 additions and 440 deletions
|
@ -10,15 +10,24 @@
|
|||
JISX0201_R_ENCODE(c, assi) \
|
||||
else JISX0201_K_ENCODE(c, assi)
|
||||
|
||||
#define JISX0201_R_DECODE(c, assi) \
|
||||
#define JISX0201_R_DECODE_CHAR(c, assi) \
|
||||
if ((c) < 0x5c) (assi) = (c); \
|
||||
else if ((c) == 0x5c) (assi) = 0x00a5; \
|
||||
else if ((c) < 0x7e) (assi) = (c); \
|
||||
else if ((c) == 0x7e) (assi) = 0x203e; \
|
||||
else if ((c) == 0x7f) (assi) = 0x7f;
|
||||
#define JISX0201_K_DECODE(c, assi) \
|
||||
#define JISX0201_R_DECODE(c, writer) \
|
||||
if ((c) < 0x5c) OUTCHAR(c); \
|
||||
else if ((c) == 0x5c) OUTCHAR(0x00a5); \
|
||||
else if ((c) < 0x7e) OUTCHAR(c); \
|
||||
else if ((c) == 0x7e) OUTCHAR(0x203e); \
|
||||
else if ((c) == 0x7f) OUTCHAR(0x7f);
|
||||
#define JISX0201_K_DECODE(c, writer) \
|
||||
if ((c) >= 0xa1 && (c) <= 0xdf) \
|
||||
(assi) = 0xfec0 + (c);
|
||||
#define JISX0201_DECODE(c, assi) \
|
||||
JISX0201_R_DECODE(c, assi) \
|
||||
else JISX0201_K_DECODE(c, assi)
|
||||
OUTCHAR(0xfec0 + (c));
|
||||
#define JISX0201_K_DECODE_CHAR(c, assi) \
|
||||
if ((c) >= 0xa1 && (c) <= 0xdf) \
|
||||
(assi) = 0xfec0 + (c);
|
||||
#define JISX0201_DECODE(c, writer) \
|
||||
JISX0201_R_DECODE(c, writer) \
|
||||
else JISX0201_K_DECODE(c, writer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue