summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-08-22 17:03:25 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2011-08-22 17:03:25 (GMT)
commit8c9375bb5996417f737e63f5080fc8b6eb886a77 (patch)
tree3b6bf8c1b1984a0c952768631b41e7b36f65642b /Doc/c-api
parent3d1706fa83be3d60562098a9e86eb1f8f778a35c (diff)
downloadcpython-8c9375bb5996417f737e63f5080fc8b6eb886a77.zip
cpython-8c9375bb5996417f737e63f5080fc8b6eb886a77.tar.gz
cpython-8c9375bb5996417f737e63f5080fc8b6eb886a77.tar.bz2
#10542: Add 4 macros to work with surrogates: Py_UNICODE_IS_SURROGATE, Py_UNICODE_IS_HIGH_SURROGATE, Py_UNICODE_IS_LOW_SURROGATE, Py_UNICODE_JOIN_SURROGATES.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/unicode.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index a69757b..e635514 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -195,6 +195,27 @@ These APIs can be used for fast direct character conversions:
possible. This macro does not raise exceptions.
+These APIs can be used to work with surrogates:
+
+.. c:macro:: Py_UNICODE_IS_SURROGATE(ch)
+
+ Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``).
+
+.. c:macro:: Py_UNICODE_IS_HIGH_SURROGATE(ch)
+
+ Check if *ch* is an high surrogate (``0xD800 <= ch <= 0xDBFF``).
+
+.. c:macro:: Py_UNICODE_IS_LOW_SURROGATE(ch)
+
+ Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``).
+
+.. c:macro:: Py_UNICODE_JOIN_SURROGATES(high, low)
+
+ Join two surrogate characters and return a single Py_UCS4 value.
+ *high* and *low* are respectively the leading and trailing surrogates in a
+ surrogate pair.
+
+
Plain Py_UNICODE
""""""""""""""""