Commits

Ronald Oussoren committed d2b6d0b

- Updated HTML files
- Update NEWS (after doing the 1.0rc2 upload :-()
- Add wrapper for -getLineDash:count:phase: in NSBezierPath (bug #789209)

Comments (0)

Files changed (3)

 All existing varargs methods should be located and documented. Where possible
 we should provide custom wrappers, otherwise we should document alternatives.
 
+We should further investigate why the call to ``PyType_Ready(&PyTuple_Type)``
+in module.m is necessary. See `bug #77730`__.
+
+.. _: http://sourceforge.net/tracker/index.php?func=detail&aid=777308&group_id=14534&atid=114534
+
 
 Cleanup Examples
 ................

pyobjc/Modules/AppKit/_AppKitMapping_NSBezierPath.m

  * - elementAtIndex:associatedPoints:	       [call, imp]
  * - setAssociatedPoints:atIndex:	       [call]
  * - setLineDash:count:phase:		       [call, imp]
+ * - getLineDash:count:phase:		       [call]
  *
  * Not supported:
  * - getLineDash:count:phase:
 #include <Foundation/Foundation.h>
 #include "pyobjc-api.h"
 
-static PyObject* call_NSBezierPath_appendBezierPathWithGlyphs_count_inFont_(
-		PyObject* method __attribute__((__unused__)), 
-		PyObject* self, PyObject* arguments)
+
+static PyObject* 
+call_NSBezierPath_appendBezierPathWithGlyphs_count_inFont_(
+	PyObject* method, PyObject* self, PyObject* arguments)
 {
 	PyObject* result;
 	struct objc_super super;
 
 	NS_DURING
 		PyObjC_InitSuper(&super, 
-			PyObjCClass_GetClass((PyObject*)(self->ob_type)),
+			PyObjCSelector_GetClass(method),
 			PyObjCObject_GetObject(self));
 
 
 		(void)objc_msgSendSuper(&super,
-			@selector(appendBezierPathWithGlyphs:count:inFont:),
+			PyObjCSelector_GetSelector(method),
 			glyphs,
 			count,
 			fontObj);
 }
 
 static PyObject* call_NSBezierPath_appendBezierPathWithPoints_count_(
-		PyObject* method __attribute__((__unused__)), 
+		PyObject* method, 
 		PyObject* self, PyObject* arguments)
 {
 	PyObject* result;
 
 	NS_DURING
 		PyObjC_InitSuper(&super, 
-			PyObjCClass_GetClass((PyObject*)(self->ob_type)),
+			PyObjCSelector_GetClass(method),
 			PyObjCObject_GetObject(self));
 
 
 		(void)objc_msgSendSuper(&super,
-			@selector(appendBezierPathWithPoints:count:inFont:),
+			PyObjCSelector_GetSelector(method),
 			points,
 			count);
 
 }
 
 static PyObject* call_NSBezierPath_elementAtIndex_associatedPoints_(
-		PyObject* method __attribute__((__unused__)), 
+		PyObject* method, 
 		PyObject* self, PyObject* arguments)
 {
 	PyObject* result;
 
 	NS_DURING
 		PyObjC_InitSuper(&super, 
-			PyObjCClass_GetClass((PyObject*)(self->ob_type)),
+			PyObjCSelector_GetClass(method), 
 			PyObjCObject_GetObject(self));
 
 
 		res = (NSBezierPathElement)objc_msgSendSuper(&super,
-			@selector(elementAtIndex:associatedPoints:),
+			PyObjCSelector_GetSelector(method), 
 			idx,
 			points);
 
 }
 
 static PyObject* call_NSBezierPath_setAssociatedPoints_atIndex_(
-		PyObject* method __attribute__((__unused__)), 
+		PyObject* method, 
 		PyObject* self, PyObject* arguments)
 {
 	PyObject* result;
 
 	NS_DURING
 		PyObjC_InitSuper(&super, 
-			PyObjCClass_GetClass((PyObject*)(self->ob_type)),
+			PyObjCSelector_GetClass(method),
 			PyObjCObject_GetObject(self));
 
 
 		(void)objc_msgSendSuper(&super,
-			@selector(setAssociatedPoints:atIndex:),
+			PyObjCSelector_GetSelector(method),
 			points,
 			idx);
 
 }
 
 static PyObject* call_NSBezierPath_setLineDash_count_phase_(
-		PyObject* method __attribute__((__unused__)), 
+		PyObject* method, 
 		PyObject* self, PyObject* arguments)
 {
 	PyObject* result;
 
 	NS_DURING
 		PyObjC_InitSuper(&super, 
-			PyObjCClass_GetClass((PyObject*)(self->ob_type)),
+			PyObjCSelector_GetClass(method),
 			PyObjCObject_GetObject(self));
 
 
 		objc_msgSendSuper(&super,
-			@selector(setLineDash:count:phase:),
+			PyObjCSelector_GetSelector(method),
 			pattern, count, phase);
 
 		result = Py_None;
 	return result;
 }
 
+static PyObject* call_NSBezierPath_getLineDash_count_phase_(
+		PyObject* method, 
+		PyObject* self, PyObject* arguments)
+{
+	PyObject* result;
+	struct objc_super super;
+	PyObject* v;
+	float* volatile pattern;
+	int countIn, countOut, i;
+	float phase;
+
+	
+	if  (!PyArg_ParseTuple(arguments, "i", &countIn)) {
+		return NULL;
+	}
+
+	if (countIn) {
+		pattern = malloc(countIn * sizeof(float));
+		if (pattern == NULL) {
+			PyErr_NoMemory();
+			return NULL;
+		}
+	} else {
+		pattern = NULL;
+	}
+
+	NS_DURING
+		PyObjC_InitSuper(&super, 
+			PyObjCSelector_GetClass(method),
+			PyObjCObject_GetObject(self));
+
+		countOut = countIn;
+		objc_msgSendSuper(&super,
+			PyObjCSelector_GetSelector(method),
+			pattern, &countOut, &phase);
+
+		result = Py_None; // Dummy
+	NS_HANDLER
+		PyObjCErr_FromObjC(localException);
+		result = NULL;
+	NS_ENDHANDLER
+
+	if (result == NULL) {
+		return NULL;
+	}
+
+	result = PyTuple_New(3);
+	if (result == NULL) {
+		return NULL;
+	}
+
+	if (countIn == 0) {
+		PyTuple_SET_ITEM(result, 0, Py_None);
+		Py_INCREF(Py_None);
+	} else {
+		v = PyTuple_New(countOut);
+		if (v == NULL) {
+			Py_DECREF(result);
+			return NULL;
+		}
+
+		PyTuple_SET_ITEM(result, 0, v);
+
+		for (i = 0; i < countOut; i++) {
+			PyObject* p = PyFloat_FromDouble(pattern[i]);
+			if (p == NULL) {
+				Py_DECREF(result);
+				return NULL;
+			}
+			PyTuple_SET_ITEM(v, i, p);
+		}
+	}
+
+	v = PyInt_FromLong(countOut);
+	if (v == NULL) {
+		Py_DECREF(result);
+		return NULL;
+	}
+	PyTuple_SET_ITEM(result, 1, v);
+
+	v = PyFloat_FromDouble(phase);
+	if (v == NULL) {
+		Py_DECREF(result);
+		return NULL;
+	}
+	PyTuple_SET_ITEM(result, 2, v);
+
+	return result;
+}
+
 
 
 
 
 	Py_DECREF(v);
 	Py_DECREF(seq);
-
 	return res;
 }
 
 
 	if (PyObjC_RegisterMethodMapping(objc_lookUpClass("NSBezierPath"), 
 		@selector(getLineDash:count:phase:),
-		PyObjCUnsupportedMethod_Caller,
+		call_NSBezierPath_getLineDash_count_phase_,
 		PyObjCUnsupportedMethod_IMP) < 0 ) {
 
 		return -1;
 
 An overview of the relevant changes in new, and older, releases.
 
-Version 1.0rc2 (2003-09-04)
+Version 1.0rc2 (2003-09-10)
 ---------------------------
 
 - Fix a number of bugs found in 1.0rc1.