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
ad9c5698
Kaydet (Commit)
ad9c5698
authored
Ock 16, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
delta encoding of upper/lower/title makes a glorious return (#12736)
üst
da05f454
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
+20
-9
unicodectype.c
Objects/unicodectype.c
+13
-9
unicodetype_db.h
Objects/unicodetype_db.h
+0
-0
makeunicodedata.py
Tools/unicode/makeunicodedata.py
+7
-0
No files found.
Objects/unicodectype.c
Dosyayı görüntüle @
ad9c5698
...
@@ -27,9 +27,13 @@
...
@@ -27,9 +27,13 @@
#define EXTENDED_CASE_MASK 0x4000
#define EXTENDED_CASE_MASK 0x4000
typedef
struct
{
typedef
struct
{
const
Py_UCS4
upper
;
/*
const
Py_UCS4
lower
;
These are either deltas to the character or offsets in
const
Py_UCS4
title
;
_PyUnicode_ExtendedCase.
*/
const
int
upper
;
const
int
lower
;
const
int
title
;
const
unsigned
char
decimal
;
const
unsigned
char
decimal
;
const
unsigned
char
digit
;
const
unsigned
char
digit
;
const
unsigned
short
flags
;
const
unsigned
short
flags
;
...
@@ -60,7 +64,7 @@ Py_UCS4 _PyUnicode_ToTitlecase(register Py_UCS4 ch)
...
@@ -60,7 +64,7 @@ Py_UCS4 _PyUnicode_ToTitlecase(register Py_UCS4 ch)
{
{
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
return
c
type
->
title
?
ctype
->
title
:
ch
;
return
c
h
+
ctype
->
title
;
}
}
/* Returns 1 for Unicode characters having the category 'Lt', 0
/* Returns 1 for Unicode characters having the category 'Lt', 0
...
@@ -186,7 +190,7 @@ Py_UCS4 _PyUnicode_ToUppercase(Py_UCS4 ch)
...
@@ -186,7 +190,7 @@ Py_UCS4 _PyUnicode_ToUppercase(Py_UCS4 ch)
if
(
ctype
->
flags
&
EXTENDED_CASE_MASK
)
if
(
ctype
->
flags
&
EXTENDED_CASE_MASK
)
return
_PyUnicode_ExtendedCase
[
ctype
->
upper
&
0xFFFF
];
return
_PyUnicode_ExtendedCase
[
ctype
->
upper
&
0xFFFF
];
return
c
type
->
upper
?
ctype
->
upper
:
ch
;
return
c
h
+
ctype
->
upper
;
}
}
/* Returns the lowercase Unicode characters corresponding to ch or just
/* Returns the lowercase Unicode characters corresponding to ch or just
...
@@ -198,7 +202,7 @@ Py_UCS4 _PyUnicode_ToLowercase(Py_UCS4 ch)
...
@@ -198,7 +202,7 @@ Py_UCS4 _PyUnicode_ToLowercase(Py_UCS4 ch)
if
(
ctype
->
flags
&
EXTENDED_CASE_MASK
)
if
(
ctype
->
flags
&
EXTENDED_CASE_MASK
)
return
_PyUnicode_ExtendedCase
[
ctype
->
lower
&
0xFFFF
];
return
_PyUnicode_ExtendedCase
[
ctype
->
lower
&
0xFFFF
];
return
c
type
->
lower
?
ctype
->
lower
:
ch
;
return
c
h
+
ctype
->
lower
;
}
}
int
_PyUnicode_ToLowerFull
(
Py_UCS4
ch
,
Py_UCS4
*
res
)
int
_PyUnicode_ToLowerFull
(
Py_UCS4
ch
,
Py_UCS4
*
res
)
...
@@ -213,7 +217,7 @@ int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res)
...
@@ -213,7 +217,7 @@ int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res)
res
[
i
]
=
_PyUnicode_ExtendedCase
[
index
+
i
];
res
[
i
]
=
_PyUnicode_ExtendedCase
[
index
+
i
];
return
n
;
return
n
;
}
}
res
[
0
]
=
c
type
->
lower
?
ctype
->
lower
:
ch
;
res
[
0
]
=
c
h
+
ctype
->
lower
;
return
1
;
return
1
;
}
}
...
@@ -229,7 +233,7 @@ int _PyUnicode_ToTitleFull(Py_UCS4 ch, Py_UCS4 *res)
...
@@ -229,7 +233,7 @@ int _PyUnicode_ToTitleFull(Py_UCS4 ch, Py_UCS4 *res)
res
[
i
]
=
_PyUnicode_ExtendedCase
[
index
+
i
];
res
[
i
]
=
_PyUnicode_ExtendedCase
[
index
+
i
];
return
n
;
return
n
;
}
}
res
[
0
]
=
c
type
->
title
?
ctype
->
title
:
ch
;
res
[
0
]
=
c
h
+
ctype
->
title
;
return
1
;
return
1
;
}
}
...
@@ -245,7 +249,7 @@ int _PyUnicode_ToUpperFull(Py_UCS4 ch, Py_UCS4 *res)
...
@@ -245,7 +249,7 @@ int _PyUnicode_ToUpperFull(Py_UCS4 ch, Py_UCS4 *res)
res
[
i
]
=
_PyUnicode_ExtendedCase
[
index
+
i
];
res
[
i
]
=
_PyUnicode_ExtendedCase
[
index
+
i
];
return
n
;
return
n
;
}
}
res
[
0
]
=
c
type
->
upper
?
ctype
->
upper
:
ch
;
res
[
0
]
=
c
h
+
ctype
->
upper
;
return
1
;
return
1
;
}
}
...
...
Objects/unicodetype_db.h
Dosyayı görüntüle @
ad9c5698
This diff is collapsed.
Click to expand it.
Tools/unicode/makeunicodedata.py
Dosyayı görüntüle @
ad9c5698
...
@@ -443,6 +443,13 @@ def makeunicodetype(unicode, trace):
...
@@ -443,6 +443,13 @@ def makeunicodetype(unicode, trace):
if
sc
is
None
:
if
sc
is
None
:
if
upper
==
lower
==
title
:
if
upper
==
lower
==
title
:
upper
=
lower
=
title
=
0
upper
=
lower
=
title
=
0
else
:
upper
=
upper
-
char
lower
=
lower
-
char
title
=
title
-
char
assert
(
abs
(
upper
)
<=
2147483647
and
abs
(
lower
)
<=
2147483647
and
abs
(
title
)
<=
2147483647
)
else
:
else
:
# This happens either when some character maps to more than one
# This happens either when some character maps to more than one
# character in uppercase, lowercase, or titlecase or the
# character in uppercase, lowercase, or titlecase or the
...
...
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