[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19348] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python/BPy_IntegrationType.cpp: Removed the declaration of an undefined static function, to suppress a compiler warning.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Mar 21 13:09:58 CET 2009


Revision: 19348
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19348
Author:   kjym3
Date:     2009-03-21 13:09:58 +0100 (Sat, 21 Mar 2009)

Log Message:
-----------
Removed the declaration of an undefined static function, to suppress a compiler warning.
Also made minor changes to make IntegrationType a subclass of the built-in int type.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp	2009-03-21 06:55:30 UTC (rev 19347)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp	2009-03-21 12:09:58 UTC (rev 19348)
@@ -8,14 +8,8 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 
-/*---------------  Python API function prototypes for IntegrationType instance  -----------*/
-static int IntegrationType___init__(BPy_IntegrationType *self, PyObject *args, PyObject *kwds);
+static PyObject *BPy_IntegrationType_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
 
-/*----------------------IntegrationType instance definitions ----------------------------*/
-static PyMethodDef BPy_IntegrationType_methods[] = {
-	{NULL, NULL, 0, NULL}
-};
-
 /*-----------------------BPy_IntegrationType type definition ------------------------------*/
 
 PyTypeObject IntegrationType_Type = {
@@ -74,7 +68,7 @@
 	NULL,                       /* iternextfunc tp_iternext; */
 
   /*** Attribute descriptor and subclassing stuff ***/
-	BPy_IntegrationType_methods,	/* struct PyMethodDef *tp_methods; */
+	NULL,							/* struct PyMethodDef *tp_methods; */
 	NULL,                       	/* struct PyMemberDef *tp_members; */
 	NULL,         					/* struct PyGetSetDef *tp_getset; */
 	&PyInt_Type,							/* struct _typeobject *tp_base; */
@@ -84,7 +78,7 @@
 	0,                          	/* long tp_dictoffset; */
 	NULL,                       	/* initproc tp_init; */
 	NULL,							/* allocfunc tp_alloc; */
-	PyType_GenericNew,			/* newfunc tp_new; */
+	BPy_IntegrationType_new,		/* newfunc tp_new; */
 	
 	/*  Low-level free-memory routine */
 	NULL,                       /* freefunc tp_free;  */
@@ -102,17 +96,28 @@
 };
 
 static PyObject *
-BPy_IntegrationType_FromIntegrationType(IntegrationType t)
+BPy_IntegrationType_FromIntegrationType(int t)
 {
 	BPy_IntegrationType *obj;
 
 	obj = PyObject_New(BPy_IntegrationType, &IntegrationType_Type);
 	if (!obj)
 		return NULL;
-	((PyIntObject *)obj)->ob_ival = (long)t;
+	((PyIntObject *)obj)->ob_ival = t;
 	return (PyObject *)obj;
 }
 
+static PyObject *
+BPy_IntegrationType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+	int x = 0;
+	static char *kwlist[] = {"x", 0};
+
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist, &x))
+		return NULL;
+	return BPy_IntegrationType_FromIntegrationType(x);
+}
+
 //-------------------MODULE INITIALIZATION--------------------------------
 PyMODINIT_FUNC IntegrationType_Init( PyObject *module )
 {	





More information about the Bf-blender-cvs mailing list