Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
28c63f7f
Kaydet (Commit)
28c63f7f
authored
Eki 28, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
CJK codecs: less magical macros, semicolon is now explicit
üst
14c9fea6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
36 deletions
+42
-36
_codecs_cn.c
Modules/cjkcodecs/_codecs_cn.c
+14
-13
_codecs_hk.c
Modules/cjkcodecs/_codecs_hk.c
+1
-1
_codecs_iso2022.c
Modules/cjkcodecs/_codecs_iso2022.c
+0
-0
_codecs_jp.c
Modules/cjkcodecs/_codecs_jp.c
+11
-10
_codecs_kr.c
Modules/cjkcodecs/_codecs_kr.c
+8
-7
_codecs_tw.c
Modules/cjkcodecs/_codecs_tw.c
+2
-2
cjkcodecs.h
Modules/cjkcodecs/cjkcodecs.h
+5
-2
emu_jisx0213_2000.h
Modules/cjkcodecs/emu_jisx0213_2000.h
+1
-1
No files found.
Modules/cjkcodecs/_codecs_cn.c
Dosyayı görüntüle @
28c63f7f
...
...
@@ -40,14 +40,15 @@
OUTCHAR(decoded); \
}
#define GBK_ENCODE(code, assi) \
if ((code) == 0x2014) { \
(assi) = 0xa1aa; \
} else if ((code) == 0x2015) { \
(assi) = 0xa844; \
} else if ((code) == 0x00b7) { \
(assi) = 0xa1a4; \
#define GBK_ENCODE(code, assi)
\
if ((code) == 0x2014) {
\
(assi) = 0xa1aa;
\
} else if ((code) == 0x2015) {
\
(assi) = 0xa844;
\
} else if ((code) == 0x00b7) {
\
(assi) = 0xa1a4;
\
} else if ((code) != 0x30fb && TRYMAP_ENC(gbcommon, assi, code)) { \
; \
}
/*
...
...
@@ -98,7 +99,7 @@ DECODER(gb2312)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
TRYMAP_DEC
(
gb2312
,
decoded
,
c
^
0x80
,
INBYTE2
^
0x80
))
{
OUTCHAR
(
decoded
);
NEXT_IN
(
2
);
...
...
@@ -159,7 +160,7 @@ DECODER(gbk)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
GBK_DECODE
(
c
,
INBYTE2
,
writer
)
else
...
...
@@ -267,7 +268,7 @@ DECODER(gb18030)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
c2
>=
0x30
&&
c2
<=
0x39
)
{
/* 4 bytes seq */
...
...
@@ -275,7 +276,7 @@ DECODER(gb18030)
unsigned
char
c3
,
c4
;
Py_UCS4
lseq
;
REQUIRE_INBUF
(
4
)
REQUIRE_INBUF
(
4
)
;
c3
=
INBYTE3
;
c4
=
INBYTE4
;
if
(
c
<
0x81
||
c3
<
0x81
||
c4
<
0x30
||
c4
>
0x39
)
...
...
@@ -405,7 +406,7 @@ DECODER(hz)
if
(
c
==
'~'
)
{
unsigned
char
c2
=
INBYTE2
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
c2
==
'~'
)
{
OUTCHAR
(
'~'
);
NEXT_IN
(
2
);
...
...
@@ -431,7 +432,7 @@ DECODER(hz)
NEXT_IN
(
1
);
}
else
{
/* GB mode */
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
TRYMAP_DEC
(
gb2312
,
decoded
,
c
,
INBYTE2
))
{
OUTCHAR
(
decoded
);
NEXT_IN
(
2
);
...
...
Modules/cjkcodecs/_codecs_hk.c
Dosyayı görüntüle @
28c63f7f
...
...
@@ -119,7 +119,7 @@ DECODER(big5hkscs)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
0xc6
>
c
||
c
>
0xc8
||
(
c
<
0xc7
&&
INBYTE2
<
0xa1
))
{
if
(
TRYMAP_DEC
(
big5
,
decoded
,
c
,
INBYTE2
))
{
...
...
Modules/cjkcodecs/_codecs_iso2022.c
Dosyayı görüntüle @
28c63f7f
This diff is collapsed.
Click to expand it.
Modules/cjkcodecs/_codecs_jp.c
Dosyayı görüntüle @
28c63f7f
...
...
@@ -107,7 +107,7 @@ DECODER(cp932)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
TRYMAP_DEC
(
cp932ext
,
decoded
,
c
,
c2
))
...
...
@@ -254,7 +254,7 @@ DECODER(euc_jis_2004)
/* JIS X 0201 half-width katakana */
unsigned
char
c2
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
c2
>=
0xa1
&&
c2
<=
0xdf
)
{
OUTCHAR
(
0xfec0
+
c2
);
...
...
@@ -266,7 +266,7 @@ DECODER(euc_jis_2004)
else
if
(
c
==
0x8f
)
{
unsigned
char
c2
,
c3
;
REQUIRE_INBUF
(
3
)
REQUIRE_INBUF
(
3
)
;
c2
=
INBYTE2
^
0x80
;
c3
=
INBYTE3
^
0x80
;
...
...
@@ -288,7 +288,7 @@ DECODER(euc_jis_2004)
else
{
unsigned
char
c2
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c
^=
0x80
;
c2
=
INBYTE2
^
0x80
;
...
...
@@ -395,7 +395,7 @@ DECODER(euc_jp)
/* JIS X 0201 half-width katakana */
unsigned
char
c2
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
c2
>=
0xa1
&&
c2
<=
0xdf
)
{
OUTCHAR
(
0xfec0
+
c2
);
...
...
@@ -407,7 +407,7 @@ DECODER(euc_jp)
else
if
(
c
==
0x8f
)
{
unsigned
char
c2
,
c3
;
REQUIRE_INBUF
(
3
)
REQUIRE_INBUF
(
3
)
;
c2
=
INBYTE2
;
c3
=
INBYTE3
;
/* JIS X 0212 */
...
...
@@ -421,7 +421,7 @@ DECODER(euc_jp)
else
{
unsigned
char
c2
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
/* JIS X 0208 */
#ifndef STRICT_BUILD
...
...
@@ -521,7 +521,7 @@ DECODER(shift_jis)
else
if
((
c
>=
0x81
&&
c
<=
0x9f
)
||
(
c
>=
0xe0
&&
c
<=
0xea
)){
unsigned
char
c1
,
c2
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
c2
<
0x40
||
(
c2
>
0x7e
&&
c2
<
0x80
)
||
c2
>
0xfc
)
return
1
;
...
...
@@ -638,7 +638,8 @@ ENCODER(shift_jis_2004)
c1
=
code
>>
8
;
c2
=
(
code
&
0xff
)
-
0x21
;
if
(
c1
&
0x80
)
{
/* Plane 2 */
if
(
c1
&
0x80
)
{
/* Plane 2 */
if
(
c1
>=
0xee
)
c1
-=
0x87
;
else
if
(
c1
>=
0xac
||
c1
==
0xa8
)
...
...
@@ -673,7 +674,7 @@ DECODER(shift_jis_2004)
unsigned
char
c1
,
c2
;
Py_UCS4
code
,
decoded
;
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
c2
<
0x40
||
(
c2
>
0x7e
&&
c2
<
0x80
)
||
c2
>
0xfc
)
return
1
;
...
...
Modules/cjkcodecs/_codecs_kr.c
Dosyayı görüntüle @
28c63f7f
...
...
@@ -58,9 +58,10 @@ ENCODER(euc_kr)
OUTBYTE2
((
code
&
0xFF
)
|
0x80
);
NEXT
(
1
,
2
);
}
else
{
/* Mapping is found in CP949 extension,
* but we encode it in KS X 1001:1998 Annex 3,
* make-up sequence for EUC-KR. */
else
{
/* Mapping is found in CP949 extension,
but we encode it in KS X 1001:1998 Annex 3,
make-up sequence for EUC-KR. */
REQUIRE_OUTBUF
(
8
);
...
...
@@ -115,14 +116,14 @@ DECODER(euc_kr)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
c
==
EUCKR_JAMO_FIRSTBYTE
&&
INBYTE2
==
EUCKR_JAMO_FILLER
)
{
/* KS X 1001:1998 Annex 3 make-up sequence */
DBCHAR
cho
,
jung
,
jong
;
REQUIRE_INBUF
(
8
)
REQUIRE_INBUF
(
8
)
;
if
((
*
inbuf
)[
2
]
!=
EUCKR_JAMO_FIRSTBYTE
||
(
*
inbuf
)[
4
]
!=
EUCKR_JAMO_FIRSTBYTE
||
(
*
inbuf
)[
6
]
!=
EUCKR_JAMO_FIRSTBYTE
)
...
...
@@ -212,7 +213,7 @@ DECODER(cp949)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
TRYMAP_DEC
(
ksx1001
,
decoded
,
c
^
0x80
,
INBYTE2
^
0x80
))
OUTCHAR
(
decoded
);
else
if
(
TRYMAP_DEC
(
cp949ext
,
decoded
,
c
,
INBYTE2
))
...
...
@@ -369,7 +370,7 @@ DECODER(johab)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
c2
=
INBYTE2
;
if
(
c
<
0xd8
)
{
...
...
Modules/cjkcodecs/_codecs_tw.c
Dosyayı görüntüle @
28c63f7f
...
...
@@ -54,7 +54,7 @@ DECODER(big5)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
TRYMAP_DEC
(
big5
,
decoded
,
c
,
INBYTE2
))
{
OUTCHAR
(
decoded
);
NEXT_IN
(
2
);
...
...
@@ -113,7 +113,7 @@ DECODER(cp950)
continue
;
}
REQUIRE_INBUF
(
2
)
REQUIRE_INBUF
(
2
)
;
if
(
TRYMAP_DEC
(
cp950ext
,
decoded
,
c
,
INBYTE2
))
OUTCHAR
(
decoded
);
...
...
Modules/cjkcodecs/cjkcodecs.h
Dosyayı görüntüle @
28c63f7f
...
...
@@ -113,8 +113,11 @@ static const struct dbcs_map *mapping_list;
} while (0)
#define REQUIRE_INBUF(n) \
if (inleft < (n)) \
return MBERR_TOOFEW;
do { \
if (inleft < (n)) \
return MBERR_TOOFEW; \
} while (0)
#define REQUIRE_OUTBUF(n) \
do { \
if (outleft < (n)) \
...
...
Modules/cjkcodecs/emu_jisx0213_2000.h
Dosyayı görüntüle @
28c63f7f
...
...
@@ -2,7 +2,7 @@
* standards. */
#ifndef EMULATE_JISX0213_2000_ENCODE_INVALID
#define EMULATE_JISX0213_2000_ENCODE_INVALID 1
#
define EMULATE_JISX0213_2000_ENCODE_INVALID 1
#endif
#define EMULATE_JISX0213_2000_ENCODE_BMP(assi, c) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment