[Python-checkins] python/dist/src/Modules _tkinter.c,1.156,1.157

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 03 May 2003 02:45:15 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv7009/Modules

Modified Files:
	_tkinter.c 
Log Message:
Implement tcl object __cmp__.


Index: _tkinter.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -C2 -d -r1.156 -r1.157
*** _tkinter.c	1 May 2003 05:47:00 -0000	1.156
--- _tkinter.c	3 May 2003 09:45:12 -0000	1.157
***************
*** 811,814 ****
--- 811,825 ----
  }
  
+ static int
+ PyTclObject_cmp(PyTclObject *self, PyTclObject *other)
+ {
+ 	int res;
+ 	res = strcmp(Tcl_GetString(self->value),
+ 		     Tcl_GetString(other->value));
+ 	if (res < 0) return -1;
+ 	if (res > 0) return 1;
+ 	return 0;
+ }
+ 
  PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type");
  
***************
*** 844,848 ****
  	0,			/*tp_getattr*/
  	0,			/*tp_setattr*/
! 	0,			/*tp_compare*/
  	(reprfunc)PyTclObject_repr,	/*tp_repr*/
  	0,			/*tp_as_number*/
--- 855,859 ----
  	0,			/*tp_getattr*/
  	0,			/*tp_setattr*/
! 	(cmpfunc)PyTclObject_cmp,	/*tp_compare*/
  	(reprfunc)PyTclObject_repr,	/*tp_repr*/
  	0,			/*tp_as_number*/