Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 1 | bits shared by the stringobject and unicodeobject implementations (and |
| 2 | possibly other modules, in a not too distant future). |
| 3 | |
| 4 | the stuff in here is included into relevant places; see the individual |
| 5 | source files for details. |
| 6 | |
| 7 | -------------------------------------------------------------------- |
| 8 | the following defines used by the different modules: |
| 9 | |
| 10 | STRINGLIB_CHAR |
| 11 | |
| 12 | the type used to hold a character (char or Py_UNICODE) |
| 13 | |
| 14 | STRINGLIB_EMPTY |
| 15 | |
| 16 | a PyObject representing the empty string |
| 17 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 18 | Py_ssize_t STRINGLIB_LEN(PyObject*) |
| 19 | |
| 20 | returns the length of the given string object (which must be of the |
| 21 | right type) |
| 22 | |
| 23 | PyObject* STRINGLIB_NEW(STRINGLIB_CHAR*, Py_ssize_t) |
| 24 | |
| 25 | creates a new string object |
| 26 | |
| 27 | STRINGLIB_CHAR* STRINGLIB_STR(PyObject*) |
| 28 | |
| 29 | returns the pointer to the character data for the given string |
| 30 | object (which must be of the right type) |
Gregory P. Smith | 60d241f | 2007-10-16 06:31:30 +0000 | [diff] [blame] | 31 | |
| 32 | int STRINGLIB_CHECK_EXACT(PyObject *) |
| 33 | |
| 34 | returns true if the object is an instance of our type, not a subclass. |
| 35 | |
| 36 | STRINGLIB_MUTABLE |
| 37 | |
| 38 | Must be 0 or 1 to tell the cpp macros in stringlib code if the object |
| 39 | being operated on is mutable or not. |