[Python-checkins] CVS: python/dist/src/Mac/Modules/list listsupport.py,1.12,1.13 _Listmodule.c,1.4,1.5

Just van Rossum jvr@users.sourceforge.net
2001年11月05日 03:12:14 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/list
In directory usw-pr-cvs1:/tmp/cvs-serv5850
Modified Files:
	listsupport.py _Listmodule.c 
Log Message:
added acces to the cellSize field, rewrote setattr code
Index: listsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listsupport.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** listsupport.py	2001年11月05日 08:27:57	1.12
--- listsupport.py	2001年11月05日 11:12:12	1.13
***************
*** 138,146 ****
 
 getattrHookCode = """{
- 	/* XXXX Should we HLock() here?? */
 	if ( strcmp(name, "listFlags") == 0 )
 		return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
 	if ( strcmp(name, "selFlags") == 0 )
 		return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
 }"""
 
--- 138,147 ----
 
 getattrHookCode = """{
 	if ( strcmp(name, "listFlags") == 0 )
 		return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
 	if ( strcmp(name, "selFlags") == 0 )
 		return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
+ 	if ( strcmp(name, "cellSize") == 0 )
+ 		return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);
 }"""
 
***************
*** 150,166 ****
 {
 	long intval;
! 		
! 	if ( value == NULL || !PyInt_Check(value) )
 		return -1;
- 	intval = PyInt_AsLong(value);
- 	if (strcmp(name, "listFlags") == 0 ) {
- 		SetListFlags(self->ob_itself, intval);
- 		return 0;
- 	}
- 	if (strcmp(name, "selFlags") == 0 ) {
- 		SetListSelectionFlags(self->ob_itself, intval);
- 		return 0;
 	}
! 	return -1;
 }
 """
--- 151,170 ----
 {
 	long intval;
! 	int err = 0;
! 	
! 	if ( value == NULL ) {
! 		PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute");
 		return -1;
 	}
! 	if (strcmp(name, "listFlags") == 0 )
! 		err = PyArg_Parse(value, "B", &(*self->ob_itself)->listFlags);
! 	else if (strcmp(name, "selFlags") == 0 )
! 		err = PyArg_Parse(value, "B", &(*self->ob_itself)->selFlags);
! 	else if (strcmp(name, "cellSize") == 0 )
! 		err = PyArg_Parse(value, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize);
! 	else
! 		PyErr_SetString(PyExc_AttributeError, "No such attribute");
! 	if (err) return 0;
! 	else return -1;
 }
 """
Index: _Listmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/_Listmodule.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** _Listmodule.c	2001年11月05日 08:27:57	1.4
--- _Listmodule.c	2001年11月05日 11:12:12	1.5
***************
*** 608,616 ****
 {
 	{
- 		/* XXXX Should we HLock() here?? */
 		if ( strcmp(name, "listFlags") == 0 )
 			return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
 		if ( strcmp(name, "selFlags") == 0 )
 			return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
 	}
 	return Py_FindMethodInChain(&ListObj_chain, (PyObject *)self, name);
--- 608,617 ----
 {
 	{
 		if ( strcmp(name, "listFlags") == 0 )
 			return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
 		if ( strcmp(name, "selFlags") == 0 )
 			return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
+ 		if ( strcmp(name, "cellSize") == 0 )
+ 			return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);
 	}
 	return Py_FindMethodInChain(&ListObj_chain, (PyObject *)self, name);
***************
*** 621,637 ****
 {
 	long intval;
! 		
! 	if ( value == NULL || !PyInt_Check(value) )
 		return -1;
- 	intval = PyInt_AsLong(value);
- 	if (strcmp(name, "listFlags") == 0 ) {
- 		SetListFlags(self->ob_itself, intval);
- 		return 0;
- 	}
- 	if (strcmp(name, "selFlags") == 0 ) {
- 		SetListSelectionFlags(self->ob_itself, intval);
- 		return 0;
 	}
! 	return -1;
 }
 
--- 622,641 ----
 {
 	long intval;
! 	int err = 0;
! 	
! 	if ( value == NULL ) {
! 		PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute");
 		return -1;
 	}
! 	if (strcmp(name, "listFlags") == 0 )
! 		err = PyArg_Parse(value, "B", &(*self->ob_itself)->listFlags);
! 	else if (strcmp(name, "selFlags") == 0 )
! 		err = PyArg_Parse(value, "B", &(*self->ob_itself)->selFlags);
! 	else if (strcmp(name, "cellSize") == 0 )
! 		err = PyArg_Parse(value, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize);
! 	else
! 		PyErr_SetString(PyExc_AttributeError, "No such attribute");
! 	if (err) return 0;
! 	else return -1;
 }
 

AltStyle によって変換されたページ (->オリジナル) /