summaryrefslogtreecommitdiff
path: root/devel/py-icu/files/patch-icu-4.6
diff options
context:
space:
mode:
Diffstat (limited to 'devel/py-icu/files/patch-icu-4.6')
-rw-r--r--devel/py-icu/files/patch-icu-4.6163
1 files changed, 163 insertions, 0 deletions
diff --git a/devel/py-icu/files/patch-icu-4.6 b/devel/py-icu/files/patch-icu-4.6
new file mode 100644
index 000000000000..547d81d61b86
--- /dev/null
+++ b/devel/py-icu/files/patch-icu-4.6
@@ -0,0 +1,163 @@
+--- ./common.cpp.orig 2010-12-16 17:23:58.891824000 +0100
++++ ./common.cpp 2010-12-16 17:25:58.722360225 +0100
+@@ -1133,9 +1133,14 @@
+
+ int isUnicodeString(PyObject *arg)
+ {
++#if U_ICU_VERSION_HEX < 0x04060000
+ return (PyObject_TypeCheck(arg, &UObjectType) &&
+ (((t_uobject *) arg)->object->getDynamicClassID() ==
+ UnicodeString::getStaticClassID()));
++#else
++ return (PyObject_TypeCheck(arg, &UObjectType) &&
++ dynamic_cast<UnicodeString *>(((t_uobject *) arg)->object) != NULL);
++#endif
+ }
+
+ int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status)
+--- ./common.h.orig 2010-03-29 20:04:02.000000000 +0200
++++ ./common.h 2010-12-16 18:59:09.154326449 +0100
+@@ -117,6 +117,34 @@
+ #include <unicode/selfmt.h>
+ #endif
+
++#if U_ICU_VERSION_HEX >= 0x04060000
++#include <typeinfo>
++#endif
++
++#if U_ICU_VERSION_HEX < 0x04060000
++typedef UClassID classid;
++#else
++typedef const char *classid;
++#endif
++
++enum {
++ UObject_ID,
++ Replaceable_ID,
++ MeasureUnit_ID,
++ Measure_ID,
++ StringEnumeration_ID,
++ ForwardCharacterIterator_ID,
++ CharacterIterator_ID,
++ BreakIterator_ID,
++ Format_ID,
++ MeasureFormat_ID,
++ DateFormat_ID,
++ Calendar_ID,
++ Collator_ID,
++ UnicodeMatcher_ID,
++ SearchIterator_ID
++};
++
+ U_NAMESPACE_USE
+
+ /* lifted from ustrenum.h */
+@@ -138,24 +166,6 @@
+ extern PyObject *PyExc_ICUError;
+ extern PyObject *PyExc_InvalidArgsError;
+
+-enum {
+- UObject_ID,
+- Replaceable_ID,
+- MeasureUnit_ID,
+- Measure_ID,
+- StringEnumeration_ID,
+- ForwardCharacterIterator_ID,
+- CharacterIterator_ID,
+- BreakIterator_ID,
+- Format_ID,
+- MeasureFormat_ID,
+- DateFormat_ID,
+- Calendar_ID,
+- Collator_ID,
+- UnicodeMatcher_ID,
+- SearchIterator_ID
+-};
+-
+ void _init_common(PyObject *m);
+
+ class ICUException {
+@@ -214,14 +224,14 @@
+ int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
+ UnicodeString fromUChar32(UChar32 c);
+
+-int isInstance(PyObject *arg, UClassID id, PyTypeObject *type);
+-void registerType(PyTypeObject *type, UClassID id);
++int isInstance(PyObject *arg, classid id, PyTypeObject *type);
++void registerType(PyTypeObject *type, classid id);
+
+ Formattable *toFormattable(PyObject *arg);
+ Formattable *toFormattableArray(PyObject *arg, int *len,
+- UClassID id, PyTypeObject *type);
++ classid id, PyTypeObject *type);
+
+-UObject **pl2cpa(PyObject *arg, int *len, UClassID id, PyTypeObject *type);
++UObject **pl2cpa(PyObject *arg, int *len, classid id, PyTypeObject *type);
+ PyObject *cpa2pl(UObject **array, int len, PyObject *(*wrap)(UObject *, int));
+
+ PyObject *PyErr_SetArgsError(PyObject *self, char *name, PyObject *args);
+--- ./macros.h.orig 2010-04-18 01:49:23.000000000 +0200
++++ ./macros.h 2010-12-16 19:01:11.229839485 +0100
+@@ -271,12 +271,20 @@
+ /* tp_itemsize */ 0, \
+ };
+
++#if U_ICU_VERSION_HEX < 0x04060000
+ #define TYPE_CLASSID(name) \
+ name::getStaticClassID(), &name##Type
+
+ #define TYPE_ID(name) \
+ (UClassID) (name##_ID), &name##Type
++#else
++#define TYPE_CLASSID(className) \
++ typeid(className).name(), &className##Type
++#define TYPE_ID(className) \
++ typeid(className).name(), &className##Type
++#endif
+
++#if U_ICU_VERSION_HEX < 0x04060000
+ #define INSTALL_TYPE(name, module) \
+ if (PyType_Ready(&name##Type) == 0) \
+ { \
+@@ -284,6 +292,16 @@
+ PyModule_AddObject(module, #name, (PyObject *) &name##Type); \
+ registerType(&name##Type, (UClassID) name##_ID); \
+ }
++#else
++#define INSTALL_TYPE(className, module) \
++ if (PyType_Ready(&className##Type) == 0) \
++ { \
++ Py_INCREF(&className##Type); \
++ PyModule_AddObject(module, #className, \
++ (PyObject *) &className##Type); \
++ registerType(&className##Type, typeid(className).name()); \
++ }
++#endif
+
+ #define INSTALL_STRUCT(name, module) \
+ if (PyType_Ready(&name##Type) == 0) \
+@@ -292,6 +310,16 @@
+ PyModule_AddObject(module, #name, (PyObject *) &name##Type); \
+ }
+
++#if U_ICU_VERSION_HEX >= 0x04060000
++#define REGISTER_TYPE(className, module) \
++ if (PyType_Ready(&className##Type) == 0) \
++ { \
++ Py_INCREF(&className##Type); \
++ PyModule_AddObject(module, #className, \
++ (PyObject *) &className##Type); \
++ registerType(&className##Type, typeid(className).name()); \
++ }
++#else
+ #define REGISTER_TYPE(name, module) \
+ if (PyType_Ready(&name##Type) == 0) \
+ { \
+@@ -299,6 +327,7 @@
+ PyModule_AddObject(module, #name, (PyObject *) &name##Type); \
+ registerType(&name##Type, name::getStaticClassID()); \
+ }
++#endif
+
+ #define INSTALL_CONSTANTS_TYPE(name, module) \
+ if (PyType_Ready(&name##Type) == 0) \