summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-09-29 10:25:54 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-09-29 10:25:54 (GMT)
commit137c34c0274954b2cdd1fd5b490c654528ff30f7 (patch)
treeec540a9b6bba9617af8afcb099fd4908a5bac230 /Include/unicodeobject.h
parent41a64a53a30f2d81de7b4a05e5e8e9b4089f7ca7 (diff)
downloadcpython-137c34c0274954b2cdd1fd5b490c654528ff30f7.zip
cpython-137c34c0274954b2cdd1fd5b490c654528ff30f7.tar.gz
cpython-137c34c0274954b2cdd1fd5b490c654528ff30f7.tar.bz2
Issue #9979: Create function PyUnicode_AsWideCharString().
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 111d7e2..f206895 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -99,8 +99,8 @@ Copyright (c) Corporation for National Research Initiatives.
#endif
/* If the compiler provides a wchar_t type we try to support it
- through the interface functions PyUnicode_FromWideChar() and
- PyUnicode_AsWideChar(). */
+ through the interface functions PyUnicode_FromWideChar(),
+ PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */
#ifdef HAVE_USABLE_WCHAR_T
# ifndef HAVE_WCHAR_H
@@ -156,6 +156,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
# define PyUnicode_AsUnicode PyUnicodeUCS2_AsUnicode
# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS2_AsUnicodeEscapeString
# define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar
+# define PyUnicode_AsWideCharString PyUnicodeUCS2_AsWideCharString
# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist
# define PyUnicode_Compare PyUnicodeUCS2_Compare
# define PyUnicode_CompareWithASCII PyUnicodeUCS2_CompareASCII
@@ -239,6 +240,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
# define PyUnicode_AsUnicode PyUnicodeUCS4_AsUnicode
# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS4_AsUnicodeEscapeString
# define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar
+# define PyUnicode_AsWideCharString PyUnicodeUCS4_AsWideCharString
# define PyUnicode_ClearFreeList PyUnicodeUCS4_ClearFreelist
# define PyUnicode_Compare PyUnicodeUCS4_Compare
# define PyUnicode_CompareWithASCII PyUnicodeUCS4_CompareWithASCII
@@ -570,6 +572,19 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
Py_ssize_t size /* size of buffer */
);
+/* Convert the Unicode object to a wide character string. The output string
+ always ends with a nul character. If size is not NULL, write the number of
+ wide characters (including the nul character) into *size.
+
+ Returns a buffer allocated by PyMem_Alloc() (use PyMem_Free() to free it)
+ on success. On error, returns NULL, *size is undefined and raises a
+ MemoryError. */
+
+PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString(
+ PyUnicodeObject *unicode, /* Unicode object */
+ Py_ssize_t *size /* number of characters of the result */
+ );
+
#endif
/* --- Unicode ordinals --------------------------------------------------- */