summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c285
1 files changed, 0 insertions, 285 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index bfd5c88..82f0b1a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3731,22 +3731,6 @@ PyUnicode_AsDecodedUnicode(PyObject *unicode,
}
PyObject *
-PyUnicode_Encode(const Py_UNICODE *s,
- Py_ssize_t size,
- const char *encoding,
- const char *errors)
-{
- PyObject *v, *unicode;
-
- unicode = PyUnicode_FromWideChar(s, size);
- if (unicode == NULL)
- return NULL;
- v = PyUnicode_AsEncodedString(unicode, encoding, errors);
- Py_DECREF(unicode);
- return v;
-}
-
-PyObject *
PyUnicode_AsEncodedObject(PyObject *unicode,
const char *encoding,
const char *errors)
@@ -5047,22 +5031,6 @@ encode_char:
return NULL;
return v;
}
-PyObject *
-PyUnicode_EncodeUTF7(const Py_UNICODE *s,
- Py_ssize_t size,
- int base64SetO,
- int base64WhiteSpace,
- const char *errors)
-{
- PyObject *result;
- PyObject *tmp = PyUnicode_FromWideChar(s, size);
- if (tmp == NULL)
- return NULL;
- result = _PyUnicode_EncodeUTF7(tmp, base64SetO,
- base64WhiteSpace, errors);
- Py_DECREF(tmp);
- return result;
-}
#undef IS_BASE64
#undef FROM_BASE64
@@ -5706,21 +5674,6 @@ _PyUnicode_AsUTF8String(PyObject *unicode, const char *errors)
PyObject *
-PyUnicode_EncodeUTF8(const Py_UNICODE *s,
- Py_ssize_t size,
- const char *errors)
-{
- PyObject *v, *unicode;
-
- unicode = PyUnicode_FromWideChar(s, size);
- if (unicode == NULL)
- return NULL;
- v = _PyUnicode_AsUTF8String(unicode, errors);
- Py_DECREF(unicode);
- return v;
-}
-
-PyObject *
PyUnicode_AsUTF8String(PyObject *unicode)
{
return _PyUnicode_AsUTF8String(unicode, NULL);
@@ -6030,21 +5983,6 @@ _PyUnicode_EncodeUTF32(PyObject *str,
}
PyObject *
-PyUnicode_EncodeUTF32(const Py_UNICODE *s,
- Py_ssize_t size,
- const char *errors,
- int byteorder)
-{
- PyObject *result;
- PyObject *tmp = PyUnicode_FromWideChar(s, size);
- if (tmp == NULL)
- return NULL;
- result = _PyUnicode_EncodeUTF32(tmp, errors, byteorder);
- Py_DECREF(tmp);
- return result;
-}
-
-PyObject *
PyUnicode_AsUTF32String(PyObject *unicode)
{
return _PyUnicode_EncodeUTF32(unicode, NULL, 0);
@@ -6383,21 +6321,6 @@ _PyUnicode_EncodeUTF16(PyObject *str,
}
PyObject *
-PyUnicode_EncodeUTF16(const Py_UNICODE *s,
- Py_ssize_t size,
- const char *errors,
- int byteorder)
-{
- PyObject *result;
- PyObject *tmp = PyUnicode_FromWideChar(s, size);
- if (tmp == NULL)
- return NULL;
- result = _PyUnicode_EncodeUTF16(tmp, errors, byteorder);
- Py_DECREF(tmp);
- return result;
-}
-
-PyObject *
PyUnicode_AsUTF16String(PyObject *unicode)
{
return _PyUnicode_EncodeUTF16(unicode, NULL, 0);
@@ -6773,21 +6696,6 @@ PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
return repr;
}
-PyObject *
-PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s,
- Py_ssize_t size)
-{
- PyObject *result;
- PyObject *tmp = PyUnicode_FromWideChar(s, size);
- if (tmp == NULL) {
- return NULL;
- }
-
- result = PyUnicode_AsUnicodeEscapeString(tmp);
- Py_DECREF(tmp);
- return result;
-}
-
/* --- Raw Unicode Escape Codec ------------------------------------------- */
PyObject *
@@ -6988,19 +6896,6 @@ PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
return repr;
}
-PyObject *
-PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
- Py_ssize_t size)
-{
- PyObject *result;
- PyObject *tmp = PyUnicode_FromWideChar(s, size);
- if (tmp == NULL)
- return NULL;
- result = PyUnicode_AsRawUnicodeEscapeString(tmp);
- Py_DECREF(tmp);
- return result;
-}
-
/* --- Latin-1 Codec ------------------------------------------------------ */
PyObject *
@@ -7285,21 +7180,6 @@ unicode_encode_ucs1(PyObject *unicode,
return NULL;
}
-/* Deprecated */
-PyObject *
-PyUnicode_EncodeLatin1(const Py_UNICODE *p,
- Py_ssize_t size,
- const char *errors)
-{
- PyObject *result;
- PyObject *unicode = PyUnicode_FromWideChar(p, size);
- if (unicode == NULL)
- return NULL;
- result = unicode_encode_ucs1(unicode, errors, 256);
- Py_DECREF(unicode);
- return result;
-}
-
PyObject *
_PyUnicode_AsLatin1String(PyObject *unicode, const char *errors)
{
@@ -7426,21 +7306,6 @@ PyUnicode_DecodeASCII(const char *s,
return NULL;
}
-/* Deprecated */
-PyObject *
-PyUnicode_EncodeASCII(const Py_UNICODE *p,
- Py_ssize_t size,
- const char *errors)
-{
- PyObject *result;
- PyObject *unicode = PyUnicode_FromWideChar(p, size);
- if (unicode == NULL)
- return NULL;
- result = unicode_encode_ucs1(unicode, errors, 128);
- Py_DECREF(unicode);
- return result;
-}
-
PyObject *
_PyUnicode_AsASCIIString(PyObject *unicode, const char *errors)
{
@@ -8169,20 +8034,6 @@ encode_code_page(int code_page,
}
PyObject *
-PyUnicode_EncodeMBCS(const Py_UNICODE *p,
- Py_ssize_t size,
- const char *errors)
-{
- PyObject *unicode, *res;
- unicode = PyUnicode_FromWideChar(p, size);
- if (unicode == NULL)
- return NULL;
- res = encode_code_page(CP_ACP, unicode, errors);
- Py_DECREF(unicode);
- return res;
-}
-
-PyObject *
PyUnicode_EncodeCodePage(int code_page,
PyObject *unicode,
const char *errors)
@@ -9008,22 +8859,6 @@ _PyUnicode_EncodeCharmap(PyObject *unicode,
return NULL;
}
-/* Deprecated */
-PyObject *
-PyUnicode_EncodeCharmap(const Py_UNICODE *p,
- Py_ssize_t size,
- PyObject *mapping,
- const char *errors)
-{
- PyObject *result;
- PyObject *unicode = PyUnicode_FromWideChar(p, size);
- if (unicode == NULL)
- return NULL;
- result = _PyUnicode_EncodeCharmap(unicode, mapping, errors);
- Py_DECREF(unicode);
- return result;
-}
-
PyObject *
PyUnicode_AsCharmapString(PyObject *unicode,
PyObject *mapping)
@@ -9448,22 +9283,6 @@ _PyUnicode_TranslateCharmap(PyObject *input,
return NULL;
}
-/* Deprecated. Use PyUnicode_Translate instead. */
-PyObject *
-PyUnicode_TranslateCharmap(const Py_UNICODE *p,
- Py_ssize_t size,
- PyObject *mapping,
- const char *errors)
-{
- PyObject *result;
- PyObject *unicode = PyUnicode_FromWideChar(p, size);
- if (!unicode)
- return NULL;
- result = _PyUnicode_TranslateCharmap(unicode, mapping, errors);
- Py_DECREF(unicode);
- return result;
-}
-
PyObject *
PyUnicode_Translate(PyObject *str,
PyObject *mapping,
@@ -9523,110 +9342,6 @@ _PyUnicode_TransformDecimalAndSpaceToASCII(PyObject *unicode)
return result;
}
-PyObject *
-PyUnicode_TransformDecimalToASCII(Py_UNICODE *s,
- Py_ssize_t length)
-{
- PyObject *decimal;
- Py_ssize_t i;
- Py_UCS4 maxchar;
- enum PyUnicode_Kind kind;
- const void *data;
-
- maxchar = 127;
- for (i = 0; i < length; i++) {
- Py_UCS4 ch = s[i];
- if (ch > 127) {
- int decimal = Py_UNICODE_TODECIMAL(ch);
- if (decimal >= 0)
- ch = '0' + decimal;
- maxchar = Py_MAX(maxchar, ch);
- }
- }
-
- /* Copy to a new string */
- decimal = PyUnicode_New(length, maxchar);
- if (decimal == NULL)
- return decimal;
- kind = PyUnicode_KIND(decimal);
- data = PyUnicode_DATA(decimal);
- /* Iterate over code points */
- for (i = 0; i < length; i++) {
- Py_UCS4 ch = s[i];
- if (ch > 127) {
- int decimal = Py_UNICODE_TODECIMAL(ch);
- if (decimal >= 0)
- ch = '0' + decimal;
- }
- PyUnicode_WRITE(kind, data, i, ch);
- }
- return unicode_result(decimal);
-}
-/* --- Decimal Encoder ---------------------------------------------------- */
-
-int
-PyUnicode_EncodeDecimal(Py_UNICODE *s,
- Py_ssize_t length,
- char *output,
- const char *errors)
-{
- PyObject *unicode;
- Py_ssize_t i;
- enum PyUnicode_Kind kind;
- const void *data;
-
- if (output == NULL) {
- PyErr_BadArgument();
- return -1;
- }
-
- unicode = PyUnicode_FromWideChar(s, length);
- if (unicode == NULL)
- return -1;
-
- kind = PyUnicode_KIND(unicode);
- data = PyUnicode_DATA(unicode);
-
- for (i=0; i < length; ) {
- PyObject *exc;
- Py_UCS4 ch;
- int decimal;
- Py_ssize_t startpos;
-
- ch = PyUnicode_READ(kind, data, i);
-
- if (Py_UNICODE_ISSPACE(ch)) {
- *output++ = ' ';
- i++;
- continue;
- }
- decimal = Py_UNICODE_TODECIMAL(ch);
- if (decimal >= 0) {
- *output++ = '0' + decimal;
- i++;
- continue;
- }
- if (0 < ch && ch < 256) {
- *output++ = (char)ch;
- i++;
- continue;
- }
-
- startpos = i;
- exc = NULL;
- raise_encode_exception(&exc, "decimal", unicode,
- startpos, startpos+1,
- "invalid decimal Unicode string");
- Py_XDECREF(exc);
- Py_DECREF(unicode);
- return -1;
- }
- /* 0-terminate the output string */
- *output++ = '\0';
- Py_DECREF(unicode);
- return 0;
-}
-
/* --- Helpers ------------------------------------------------------------ */
/* helper macro to fixup start/end slice values */