annotate Objects/stringlib/ctype.h @ 70817:dd775b1561ba

Fix markup.
author Georg Brandl <georg@python.org>
date Tue, 14 Jun 2011 21:09:55 +0200
parents 5ca1948a8fd6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43576
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
1 /* NOTE: this API is -ONLY- for use with single byte character strings. */
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
2 /* Do not use it with Unicode. */
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
3
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
4 #include "bytes_methods.h"
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
5
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
6 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
7 stringlib_isspace(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
8 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
9 return _Py_bytes_isspace(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
10 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
11
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
12 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
13 stringlib_isalpha(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
14 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
15 return _Py_bytes_isalpha(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
16 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
17
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
18 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
19 stringlib_isalnum(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
20 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
21 return _Py_bytes_isalnum(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
22 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
23
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
24 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
25 stringlib_isdigit(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
26 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
27 return _Py_bytes_isdigit(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
28 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
29
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
30 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
31 stringlib_islower(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
32 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
33 return _Py_bytes_islower(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
34 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
35
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
36 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
37 stringlib_isupper(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
38 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
39 return _Py_bytes_isupper(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
40 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
41
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
42 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
43 stringlib_istitle(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
44 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
45 return _Py_bytes_istitle(STRINGLIB_STR(self), STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
46 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
47
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
48
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
49 /* functions that return a new object partially translated by ctype funcs: */
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
50
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
51 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
52 stringlib_lower(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
53 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
54 PyObject* newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
55 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
56 if (!newobj)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
57 return NULL;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
58 _Py_bytes_lower(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
59 STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
60 return newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
61 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
62
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
63 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
64 stringlib_upper(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
65 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
66 PyObject* newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
67 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
68 if (!newobj)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
69 return NULL;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
70 _Py_bytes_upper(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
71 STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
72 return newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
73 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
74
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
75 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
76 stringlib_title(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
77 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
78 PyObject* newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
79 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
80 if (!newobj)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
81 return NULL;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
82 _Py_bytes_title(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
83 STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
84 return newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
85 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
86
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
87 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
88 stringlib_capitalize(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
89 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
90 PyObject* newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
91 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
92 if (!newobj)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
93 return NULL;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
94 _Py_bytes_capitalize(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
95 STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
96 return newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
97 }
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
98
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
99 static PyObject*
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
100 stringlib_swapcase(PyObject *self)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
101 {
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
102 PyObject* newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
103 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
104 if (!newobj)
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
105 return NULL;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
106 _Py_bytes_swapcase(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
107 STRINGLIB_LEN(self));
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
108 return newobj;
697cc31a83f6 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff changeset
109 }