Commits

Ronald Oussoren committed 81afb10

More fixups for a broken checkin

  • Participants
  • Parent commits f8a8a0a
  • Branches pyobjc-ancient

Comments (0)

Files changed (2)

File Modules/objc/proxy-registry.m

+#include "pyobjc.h"
+
+static NSMapTable* python_proxies = NULL;
+static NSMapTable* objc_proxies = NULL;
+
+int PyObjC_InitProxyRegistry(void)
+{
+	python_proxies = NSCreateMapTable(
+			PyObjCUtil_PointerKeyCallBacks,
+			PyObjCUtil_PointerValueCallBacks,
+			500);
+	if (python_proxies == NULL) {
+		PyErr_SetString(PyExc_RuntimeError,
+			"Cannot create NSMapTable for python_proxies");
+		return -1;
+	}
+
+	objc_proxies = NSCreateMapTable(
+			PyObjCUtil_PointerKeyCallBacks,
+			PyObjCUtil_PointerValueCallBacks,
+			500);
+	if (objc_proxies == NULL) {
+		PyErr_SetString(PyExc_RuntimeError,
+			"Cannot create NSMapTable for objc_proxies");
+		return -1;
+	}
+	return 0;
+}
+
+int PyObjC_RegisterPythonProxy(id original, PyObject* proxy)
+{
+	NSMapInsert(python_proxies, original, proxy);
+	return 0;
+}
+
+int PyObjC_RegisterObjCProxy(PyObject* original, id proxy)
+{
+	NSMapInsert(objc_proxies, original, proxy);
+	return 0;
+}
+
+void PyObjC_UnregisterPythonProxy(id original, PyObject* proxy)
+{
+	PyObject* v;
+
+	if (original == nil) return;
+
+	v = NSMapGet(python_proxies, original);
+	if (v == proxy) {
+		NSMapRemove(python_proxies, original);
+	}
+}
+
+void PyObjC_UnregisterObjCProxy(PyObject* original, id proxy)
+{
+	id v;
+
+	if (original == NULL) return;
+
+	v = NSMapGet(objc_proxies, original);
+	if (v == proxy) {
+		NSMapRemove(objc_proxies, original);
+	}
+}
+
+PyObject* PyObjC_FindPythonProxy(id original)
+{
+	PyObject* v;
+	
+	v = NSMapGet(python_proxies, original);
+	Py_XINCREF(v);
+	return v;
+}
+
+id PyObjC_FindObjCProxy(PyObject* original)
+{
+	return NSMapGet(objc_proxies, original);
+}

File setup-lib/di_build_ext.py

         # the extensions.
         compiler_saved = self.compiler
 
-        #runtasks("Generating wrappers & stubs",
-        #    [sys.executable, "Scripts/CodeGenerators/cocoa_generator.py"])
+        runtasks("Generating wrappers & stubs",
+            [sys.executable, "Scripts/CodeGenerators/cocoa_generator.py"])
 
         if not os.path.exists('build/codegen/_Fnd_Classes.inc'):
             # Create a dummy classname list, to enable bootstrapping. Don't