blob: 60d919e272b88b55aa3c6ffe04b12c50a9c827dd [file] [log] [blame]
Thomas Wouters477c8d52006-05-27 19:21:47 +00001bits shared by the stringobject and unicodeobject implementations (and
2possibly other modules, in a not too distant future).
3
4the stuff in here is included into relevant places; see the individual
5source files for details.
6
7--------------------------------------------------------------------
8the following defines used by the different modules:
9
10STRINGLIB_CHAR
11
12 the type used to hold a character (char or Py_UNICODE)
13
14STRINGLIB_EMPTY
15
Benjamin Peterson23b9ef72010-02-03 02:43:37 +000016 a PyObject representing the empty string, only to be used if
17 STRINGLIB_MUTABLE is 0
Thomas Wouters477c8d52006-05-27 19:21:47 +000018
19int STRINGLIB_CMP(STRINGLIB_CHAR*, STRINGLIB_CHAR*, Py_ssize_t)
20
21 compares two strings. returns 0 if they match, and non-zero if not.
22
23Py_ssize_t STRINGLIB_LEN(PyObject*)
24
25 returns the length of the given string object (which must be of the
26 right type)
27
28PyObject* STRINGLIB_NEW(STRINGLIB_CHAR*, Py_ssize_t)
29
30 creates a new string object
31
32STRINGLIB_CHAR* STRINGLIB_STR(PyObject*)
33
34 returns the pointer to the character data for the given string
35 object (which must be of the right type)
Gregory P. Smith60d241f2007-10-16 06:31:30 +000036
37int STRINGLIB_CHECK_EXACT(PyObject *)
38
Benjamin Peterson23b9ef72010-02-03 02:43:37 +000039 returns true if the object is an instance of our type, not a subclass
Gregory P. Smith60d241f2007-10-16 06:31:30 +000040
41STRINGLIB_MUTABLE
42
Benjamin Peterson23b9ef72010-02-03 02:43:37 +000043 must be 0 or 1 to tell the cpp macros in stringlib code if the object
44 being operated on is mutable or not