annotate Objects/stringlib/stringdefs.h @ 53437:4e5ad566bfbb legacy-trunk

Issue #4129: more int -> Py_ssize_t documentation.
author Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
date Sat, 25 Apr 2009 20:58:35 +0000
parents c5e0d9beebf9
children 4bdd847b57c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
1 #ifndef STRINGLIB_STRINGDEFS_H
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
2 #define STRINGLIB_STRINGDEFS_H
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
3
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
4 /* this is sort of a hack. there's at least one place (formatting
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
5 floats) where some stringlib code takes a different path if it's
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
6 compiled as unicode. */
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
7 #define STRINGLIB_IS_UNICODE 0
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
8
53312
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
9 /* _tolower and _toupper are defined by SUSv2, but they're not ISO C */
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
10 /* This needs to be cleaned up. See issue 5793. */
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
11 #ifndef _tolower
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
12 #define _tolower tolower
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
13 #endif
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
14 #ifndef _toupper
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
15 #define _toupper toupper
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
16 #endif
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
17
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
18 #define STRINGLIB_OBJECT PyStringObject
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
19 #define STRINGLIB_CHAR char
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
20 #define STRINGLIB_TYPE_NAME "string"
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
21 #define STRINGLIB_PARSE_CODE "S"
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
22 #define STRINGLIB_EMPTY nullstring
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
23 #define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
24 #define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
53312
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
25 #define STRINGLIB_TOUPPER(x) _toupper(Py_CHARMASK(x))
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
26 #define STRINGLIB_TOLOWER(x) _tolower(Py_CHARMASK(x))
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
27 #define STRINGLIB_FILL memset
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
28 #define STRINGLIB_STR PyString_AS_STRING
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
29 #define STRINGLIB_LEN PyString_GET_SIZE
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
30 #define STRINGLIB_NEW PyString_FromStringAndSize
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
31 #define STRINGLIB_RESIZE _PyString_Resize
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
32 #define STRINGLIB_CHECK PyString_Check
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
33 #define STRINGLIB_CMP memcmp
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
34 #define STRINGLIB_TOSTR PyObject_Str
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47294
diff changeset
35 #define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping
53312
c5e0d9beebf9 Backport of some of the work in r71665 to trunk. This reworks much of
Eric Smith <eric@trueblade.com>
parents: 47527
diff changeset
36 #define STRINGLIB_GROUPING_LOCALE _PyString_InsertThousandsGroupingLocale
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
37
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
38 #endif /* !STRINGLIB_STRINGDEFS_H */