summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/cf
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-12-03 23:40:22 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-12-03 23:40:22 (GMT)
commit96cebde909bbb8034af576d8f31f465bbad90374 (patch)
tree305f0e665ac5676a19485cf662920a7db5c19eee /Mac/Modules/cf
parent99899b92b86ee69f0b46b708a465f445059dc793 (diff)
downloadcpython-96cebde909bbb8034af576d8f31f465bbad90374.zip
cpython-96cebde909bbb8034af576d8f31f465bbad90374.tar.gz
cpython-96cebde909bbb8034af576d8f31f465bbad90374.tar.bz2
Added PEP253 support to most Carbon modules. This isn't complete yet:
some of the more compilcated cases (CF, Res) haven't been done yet. Also, various types should inherit from each other (anything with an as_Resource method should be a Resource subtype, the CF types should become one family).
Diffstat (limited to 'Mac/Modules/cf')
-rw-r--r--Mac/Modules/cf/_CFmodule.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c
index 2942082..691378e 100644
--- a/Mac/Modules/cf/_CFmodule.c
+++ b/Mac/Modules/cf/_CFmodule.c
@@ -4325,44 +4325,64 @@ void init_CF(void)
return;
CFTypeRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFTypeRef_Type);
- if (PyDict_SetItemString(d, "CFTypeRefType", (PyObject *)&CFTypeRef_Type) != 0)
- Py_FatalError("can't initialize CFTypeRefType");
+ PyModule_AddObject(m, "CFTypeRef", (PyObject *)&CFTypeRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFTypeRef_Type);
+ PyModule_AddObject(m, "CFTypeRefType", (PyObject *)&CFTypeRef_Type);
CFArrayRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFArrayRef_Type);
- if (PyDict_SetItemString(d, "CFArrayRefType", (PyObject *)&CFArrayRef_Type) != 0)
- Py_FatalError("can't initialize CFArrayRefType");
+ PyModule_AddObject(m, "CFArrayRef", (PyObject *)&CFArrayRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFArrayRef_Type);
+ PyModule_AddObject(m, "CFArrayRefType", (PyObject *)&CFArrayRef_Type);
CFMutableArrayRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableArrayRef_Type);
- if (PyDict_SetItemString(d, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableArrayRefType");
+ PyModule_AddObject(m, "CFMutableArrayRef", (PyObject *)&CFMutableArrayRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableArrayRef_Type);
+ PyModule_AddObject(m, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type);
CFDictionaryRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFDictionaryRef_Type);
- if (PyDict_SetItemString(d, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type) != 0)
- Py_FatalError("can't initialize CFDictionaryRefType");
+ PyModule_AddObject(m, "CFDictionaryRef", (PyObject *)&CFDictionaryRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFDictionaryRef_Type);
+ PyModule_AddObject(m, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type);
CFMutableDictionaryRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableDictionaryRef_Type);
- if (PyDict_SetItemString(d, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableDictionaryRefType");
+ PyModule_AddObject(m, "CFMutableDictionaryRef", (PyObject *)&CFMutableDictionaryRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableDictionaryRef_Type);
+ PyModule_AddObject(m, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type);
CFDataRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFDataRef_Type);
- if (PyDict_SetItemString(d, "CFDataRefType", (PyObject *)&CFDataRef_Type) != 0)
- Py_FatalError("can't initialize CFDataRefType");
+ PyModule_AddObject(m, "CFDataRef", (PyObject *)&CFDataRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFDataRef_Type);
+ PyModule_AddObject(m, "CFDataRefType", (PyObject *)&CFDataRef_Type);
CFMutableDataRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableDataRef_Type);
- if (PyDict_SetItemString(d, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableDataRefType");
+ PyModule_AddObject(m, "CFMutableDataRef", (PyObject *)&CFMutableDataRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableDataRef_Type);
+ PyModule_AddObject(m, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type);
CFStringRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFStringRef_Type);
- if (PyDict_SetItemString(d, "CFStringRefType", (PyObject *)&CFStringRef_Type) != 0)
- Py_FatalError("can't initialize CFStringRefType");
+ PyModule_AddObject(m, "CFStringRef", (PyObject *)&CFStringRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFStringRef_Type);
+ PyModule_AddObject(m, "CFStringRefType", (PyObject *)&CFStringRef_Type);
CFMutableStringRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableStringRef_Type);
- if (PyDict_SetItemString(d, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableStringRefType");
+ PyModule_AddObject(m, "CFMutableStringRef", (PyObject *)&CFMutableStringRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableStringRef_Type);
+ PyModule_AddObject(m, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type);
CFURLRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFURLRef_Type);
- if (PyDict_SetItemString(d, "CFURLRefType", (PyObject *)&CFURLRef_Type) != 0)
- Py_FatalError("can't initialize CFURLRefType");
+ PyModule_AddObject(m, "CFURLRef", (PyObject *)&CFURLRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFURLRef_Type);
+ PyModule_AddObject(m, "CFURLRefType", (PyObject *)&CFURLRef_Type);
#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
_STRINGCONST(kCFPreferencesAnyApplication);