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
8235f1c8
Kaydet (Commit)
8235f1c8
authored
Tem 10, 2000
tarafından
Peter Schneider-Kamp
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ANSI-fication
üst
f1ca898d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
84 deletions
+24
-84
stropmodule.c
Modules/stropmodule.c
+24
-84
No files found.
Modules/stropmodule.c
Dosyayı görüntüle @
8235f1c8
...
@@ -38,10 +38,7 @@ this module directly.";
...
@@ -38,10 +38,7 @@ this module directly.";
static
PyObject
*
static
PyObject
*
split_whitespace
(
s
,
len
,
maxsplit
)
split_whitespace
(
char
*
s
,
int
len
,
int
maxsplit
)
char
*
s
;
int
len
;
int
maxsplit
;
{
{
int
i
=
0
,
j
,
err
;
int
i
=
0
,
j
,
err
;
int
countsplit
=
0
;
int
countsplit
=
0
;
...
@@ -107,9 +104,7 @@ is a separator. Maxsplit defaults to 0.\n\
...
@@ -107,9 +104,7 @@ is a separator. Maxsplit defaults to 0.\n\
(split and splitfields are synonymous)"
;
(split and splitfields are synonymous)"
;
static
PyObject
*
static
PyObject
*
strop_splitfields
(
self
,
args
)
strop_splitfields
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
int
len
,
n
,
i
,
j
,
err
;
int
len
,
n
,
i
,
j
,
err
;
int
splitcount
,
maxsplit
;
int
splitcount
,
maxsplit
;
...
@@ -178,9 +173,7 @@ space.\n\
...
@@ -178,9 +173,7 @@ space.\n\
(join and joinfields are synonymous)"
;
(join and joinfields are synonymous)"
;
static
PyObject
*
static
PyObject
*
strop_joinfields
(
self
,
args
)
strop_joinfields
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
PyObject
*
seq
;
PyObject
*
seq
;
char
*
sep
=
NULL
;
char
*
sep
=
NULL
;
...
@@ -310,9 +303,7 @@ arguments start and end are interpreted as in slice notation.\n\
...
@@ -310,9 +303,7 @@ arguments start and end are interpreted as in slice notation.\n\
Return -1 on failure."
;
Return -1 on failure."
;
static
PyObject
*
static
PyObject
*
strop_find
(
self
,
args
)
strop_find
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
sub
;
char
*
s
,
*
sub
;
int
len
,
n
,
i
=
0
,
last
=
INT_MAX
;
int
len
,
n
,
i
=
0
,
last
=
INT_MAX
;
...
@@ -354,9 +345,7 @@ arguments start and end are interpreted as in slice notation.\n\
...
@@ -354,9 +345,7 @@ arguments start and end are interpreted as in slice notation.\n\
Return -1 on failure."
;
Return -1 on failure."
;
static
PyObject
*
static
PyObject
*
strop_rfind
(
self
,
args
)
strop_rfind
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
sub
;
char
*
s
,
*
sub
;
int
len
,
n
,
j
;
int
len
,
n
,
j
;
...
@@ -389,9 +378,7 @@ strop_rfind(self, args)
...
@@ -389,9 +378,7 @@ strop_rfind(self, args)
static
PyObject
*
static
PyObject
*
do_strip
(
args
,
striptype
)
do_strip
(
PyObject
*
args
,
int
striptype
)
PyObject
*
args
;
int
striptype
;
{
{
char
*
s
;
char
*
s
;
int
len
,
i
,
j
;
int
len
,
i
,
j
;
...
@@ -431,9 +418,7 @@ Return a copy of the string s with leading and trailing\n\
...
@@ -431,9 +418,7 @@ Return a copy of the string s with leading and trailing\n\
whitespace removed."
;
whitespace removed."
;
static
PyObject
*
static
PyObject
*
strop_strip
(
self
,
args
)
strop_strip
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
return
do_strip
(
args
,
BOTHSTRIP
);
return
do_strip
(
args
,
BOTHSTRIP
);
}
}
...
@@ -445,9 +430,7 @@ static char lstrip__doc__[] =
...
@@ -445,9 +430,7 @@ static char lstrip__doc__[] =
Return a copy of the string s with leading whitespace removed."
;
Return a copy of the string s with leading whitespace removed."
;
static
PyObject
*
static
PyObject
*
strop_lstrip
(
self
,
args
)
strop_lstrip
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
return
do_strip
(
args
,
LEFTSTRIP
);
return
do_strip
(
args
,
LEFTSTRIP
);
}
}
...
@@ -459,9 +442,7 @@ static char rstrip__doc__[] =
...
@@ -459,9 +442,7 @@ static char rstrip__doc__[] =
Return a copy of the string s with trailing whitespace removed."
;
Return a copy of the string s with trailing whitespace removed."
;
static
PyObject
*
static
PyObject
*
strop_rstrip
(
self
,
args
)
strop_rstrip
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
return
do_strip
(
args
,
RIGHTSTRIP
);
return
do_strip
(
args
,
RIGHTSTRIP
);
}
}
...
@@ -473,9 +454,7 @@ static char lower__doc__[] =
...
@@ -473,9 +454,7 @@ static char lower__doc__[] =
Return a copy of the string s converted to lowercase."
;
Return a copy of the string s converted to lowercase."
;
static
PyObject
*
static
PyObject
*
strop_lower
(
self
,
args
)
strop_lower
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
s_new
;
char
*
s
,
*
s_new
;
int
i
,
n
;
int
i
,
n
;
...
@@ -513,9 +492,7 @@ static char upper__doc__[] =
...
@@ -513,9 +492,7 @@ static char upper__doc__[] =
Return a copy of the string s converted to uppercase."
;
Return a copy of the string s converted to uppercase."
;
static
PyObject
*
static
PyObject
*
strop_upper
(
self
,
args
)
strop_upper
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
s_new
;
char
*
s
,
*
s_new
;
int
i
,
n
;
int
i
,
n
;
...
@@ -554,9 +531,7 @@ Return a copy of the string s with only its first character\n\
...
@@ -554,9 +531,7 @@ Return a copy of the string s with only its first character\n\
capitalized."
;
capitalized."
;
static
PyObject
*
static
PyObject
*
strop_capitalize
(
self
,
args
)
strop_capitalize
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
s_new
;
char
*
s
,
*
s_new
;
int
i
,
n
;
int
i
,
n
;
...
@@ -606,9 +581,7 @@ The column number is reset to zero after each newline occurring in the\n\
...
@@ -606,9 +581,7 @@ The column number is reset to zero after each newline occurring in the\n\
string. This doesn't understand other non-printing characters."
;
string. This doesn't understand other non-printing characters."
;
static
PyObject
*
static
PyObject
*
strop_expandtabs
(
self
,
args
)
strop_expandtabs
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
PyObject
*
args
;
{
{
/* Original by Fredrik Lundh */
/* Original by Fredrik Lundh */
char
*
e
;
char
*
e
;
...
@@ -678,9 +651,7 @@ s[start:end]. Optional arguments start and end are\n\
...
@@ -678,9 +651,7 @@ s[start:end]. Optional arguments start and end are\n\
interpreted as in slice notation."
;
interpreted as in slice notation."
;
static
PyObject
*
static
PyObject
*
strop_count
(
self
,
args
)
strop_count
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
sub
;
char
*
s
,
*
sub
;
int
len
,
n
;
int
len
,
n
;
...
@@ -723,9 +694,7 @@ Return a copy of the string s with upper case characters\n\
...
@@ -723,9 +694,7 @@ Return a copy of the string s with upper case characters\n\
converted to lowercase and vice versa."
;
converted to lowercase and vice versa."
;
static
PyObject
*
static
PyObject
*
strop_swapcase
(
self
,
args
)
strop_swapcase
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
s_new
;
char
*
s
,
*
s_new
;
int
i
,
n
;
int
i
,
n
;
...
@@ -773,9 +742,7 @@ is chosen from the leading characters of s, 0 for octal, 0x or\n\
...
@@ -773,9 +742,7 @@ is chosen from the leading characters of s, 0 for octal, 0x or\n\
accepted."
;
accepted."
;
static
PyObject
*
static
PyObject
*
strop_atoi
(
self
,
args
)
strop_atoi
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
end
;
char
*
s
,
*
end
;
int
base
=
10
;
int
base
=
10
;
...
@@ -828,9 +795,7 @@ octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n\
...
@@ -828,9 +795,7 @@ octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n\
unless base is 0."
;
unless base is 0."
;
static
PyObject
*
static
PyObject
*
strop_atol
(
self
,
args
)
strop_atol
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
s
,
*
end
;
char
*
s
,
*
end
;
int
base
=
10
;
int
base
=
10
;
...
@@ -874,9 +839,7 @@ static char atof__doc__[] =
...
@@ -874,9 +839,7 @@ static char atof__doc__[] =
Return the floating point number represented by the string s."
;
Return the floating point number represented by the string s."
;
static
PyObject
*
static
PyObject
*
strop_atof
(
self
,
args
)
strop_atof
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
extern
double
strtod
(
const
char
*
,
char
**
);
extern
double
strtod
(
const
char
*
,
char
**
);
char
*
s
,
*
end
;
char
*
s
,
*
end
;
...
@@ -919,9 +882,7 @@ suitable for use in string.translate. The strings frm and to\n\
...
@@ -919,9 +882,7 @@ suitable for use in string.translate. The strings frm and to\n\
must be of the same length."
;
must be of the same length."
;
static
PyObject
*
static
PyObject
*
strop_maketrans
(
self
,
args
)
strop_maketrans
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
unsigned
char
*
c
,
*
from
=
NULL
,
*
to
=
NULL
;
unsigned
char
*
c
,
*
from
=
NULL
,
*
to
=
NULL
;
int
i
,
fromlen
=
0
,
tolen
=
0
;
int
i
,
fromlen
=
0
,
tolen
=
0
;
...
@@ -958,9 +919,7 @@ remaining characters have been mapped through the given\n\
...
@@ -958,9 +919,7 @@ remaining characters have been mapped through the given\n\
translation table, which must be a string of length 256."
;
translation table, which must be a string of length 256."
;
static
PyObject
*
static
PyObject
*
strop_translate
(
self
,
args
)
strop_translate
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
PyObject
*
args
;
{
{
register
char
*
input
,
*
table
,
*
output
;
register
char
*
input
,
*
table
,
*
output
;
register
int
i
,
c
,
changed
=
0
;
register
int
i
,
c
,
changed
=
0
;
...
@@ -1038,11 +997,7 @@ strop_translate(self, args)
...
@@ -1038,11 +997,7 @@ strop_translate(self, args)
found, or -1 if not found. If len of PAT is greater than length of
found, or -1 if not found. If len of PAT is greater than length of
MEM, the function returns -1.
MEM, the function returns -1.
*/
*/
static
int
mymemfind
(
mem
,
len
,
pat
,
pat_len
)
static
int
mymemfind
(
char
*
mem
,
int
len
,
char
*
pat
,
int
pat_len
)
char
*
mem
;
int
len
;
char
*
pat
;
int
pat_len
;
{
{
register
int
ii
;
register
int
ii
;
...
@@ -1066,11 +1021,7 @@ static int mymemfind(mem, len, pat, pat_len)
...
@@ -1066,11 +1021,7 @@ static int mymemfind(mem, len, pat, pat_len)
meaning mem=1111 and pat==11 returns 2.
meaning mem=1111 and pat==11 returns 2.
mem=11111 and pat==11 also return 2.
mem=11111 and pat==11 also return 2.
*/
*/
static
int
mymemcnt
(
mem
,
len
,
pat
,
pat_len
)
static
int
mymemcnt
(
char
*
mem
,
int
len
,
char
*
pat
,
int
pat_len
)
char
*
mem
;
int
len
;
char
*
pat
;
int
pat_len
;
{
{
register
int
offset
=
0
;
register
int
offset
=
0
;
int
nfound
=
0
;
int
nfound
=
0
;
...
@@ -1105,16 +1056,7 @@ static int mymemcnt(mem, len, pat, pat_len)
...
@@ -1105,16 +1056,7 @@ static int mymemcnt(mem, len, pat, pat_len)
the new string allocated locally, or
the new string allocated locally, or
NULL if an error occurred.
NULL if an error occurred.
*/
*/
static
char
*
mymemreplace
(
str
,
len
,
pat
,
pat_len
,
sub
,
sub_len
,
count
,
out_len
)
static
char
*
mymemreplace
(
char
*
str
,
int
len
,
char
*
pat
,
int
pat_len
,
char
*
sub
,
int
sub_len
,
int
count
,
int
*
out_len
)
char
*
str
;
int
len
;
/* input string */
char
*
pat
;
int
pat_len
;
/* pattern string to find */
char
*
sub
;
int
sub_len
;
/* substitution string */
int
count
;
/* number of replacements, 0 == all */
int
*
out_len
;
{
{
char
*
out_s
;
char
*
out_s
;
char
*
new_s
;
char
*
new_s
;
...
@@ -1175,9 +1117,7 @@ old replaced by new. If the optional argument maxsplit is\n\
...
@@ -1175,9 +1117,7 @@ old replaced by new. If the optional argument maxsplit is\n\
given, only the first maxsplit occurrences are replaced."
;
given, only the first maxsplit occurrences are replaced."
;
static
PyObject
*
static
PyObject
*
strop_replace
(
self
,
args
)
strop_replace
(
PyObject
*
self
,
PyObject
*
args
)
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
{
char
*
str
,
*
pat
,
*
sub
,
*
new_s
;
char
*
str
,
*
pat
,
*
sub
,
*
new_s
;
int
len
,
pat_len
,
sub_len
,
out_len
;
int
len
,
pat_len
,
sub_len
,
out_len
;
...
...
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