[Python-checkins] python/dist/src/Modules _tkinter.c,1.132,1.133

loewis@users.sourceforge.net loewis@users.sourceforge.net
Tue, 26 Nov 2002 14:12:15 -0800


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

Modified Files:
	_tkinter.c 
Log Message:
Avoid including tclInt.h.


Index: _tkinter.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -C2 -d -r1.132 -r1.133
*** _tkinter.c	26 Nov 2002 21:39:48 -0000	1.132
--- _tkinter.c	26 Nov 2002 22:12:12 -0000	1.133
***************
*** 51,59 ****
  #ifdef TK_FRAMEWORK
  #include <Tcl/tcl.h>
- #include <Tcl/tclInt.h>
  #include <Tk/tk.h>
  #else
  #include <tcl.h>
- #include <tclInt.h>
  #include <tk.h>
  #endif
--- 51,57 ----
***************
*** 223,226 ****
--- 221,233 ----
  	Tcl_Interp *interp;
  	int wantobjects;
+ 	/* We cannot include tclInt.h, as this is internal. 
+ 	   So we cache interesting types here. */
+ 	Tcl_ObjType *BooleanType;
+ 	Tcl_ObjType *ByteArrayType;
+ 	Tcl_ObjType *DoubleType;
+ 	Tcl_ObjType *IntType;
+ 	Tcl_ObjType *ListType;
+ 	Tcl_ObjType *ProcBodyType;
+ 	Tcl_ObjType *StringType;
  } TkappObject;
  
***************
*** 536,539 ****
--- 543,554 ----
  	v->wantobjects = wantobjects;
  
+ 	v->BooleanType = Tcl_GetObjType("boolean");
+ 	v->ByteArrayType = Tcl_GetObjType("bytearray");
+ 	v->DoubleType = Tcl_GetObjType("double");
+ 	v->IntType = Tcl_GetObjType("int");
+ 	v->ListType = Tcl_GetObjType("list");
+ 	v->ProcBodyType = Tcl_GetObjType("procbody");
+ 	v->StringType = Tcl_GetObjType("string");
+ 
  #if defined(macintosh)
  	/* This seems to be needed */
***************
*** 754,762 ****
  {
  	PyObject *result = NULL;
  
  	if (value->typePtr == NULL)
  		return PyString_FromStringAndSize(value->bytes, value->length);
  
! 	if (value->typePtr == &tclBooleanType) {
  		result = value->internalRep.longValue ? Py_True : Py_False;
  		Py_INCREF(result);
--- 769,778 ----
  {
  	PyObject *result = NULL;
+ 	TkappObject *app = (TkappObject*)tkapp;
  
  	if (value->typePtr == NULL)
  		return PyString_FromStringAndSize(value->bytes, value->length);
  
! 	if (value->typePtr == app->BooleanType) {
  		result = value->internalRep.longValue ? Py_True : Py_False;
  		Py_INCREF(result);
***************
*** 764,768 ****
  	}
  
! 	if (value->typePtr == &tclByteArrayType) {
  		int size;
  		char *data = Tcl_GetByteArrayFromObj(value, &size);
--- 780,784 ----
  	}
  
! 	if (value->typePtr == app->ByteArrayType) {
  		int size;
  		char *data = Tcl_GetByteArrayFromObj(value, &size);
***************
*** 770,782 ****
  	}
  
! 	if (value->typePtr == &tclDoubleType) {
  		return PyFloat_FromDouble(value->internalRep.doubleValue);
  	}
  
! 	if (value->typePtr == &tclIntType) {
  		return PyInt_FromLong(value->internalRep.longValue);
  	}
  
! 	if (value->typePtr == &tclListType) {
  		int size;
  		int i, status;
--- 786,798 ----
  	}
  
! 	if (value->typePtr == app->DoubleType) {
  		return PyFloat_FromDouble(value->internalRep.doubleValue);
  	}
  
! 	if (value->typePtr == app->IntType) {
  		return PyInt_FromLong(value->internalRep.longValue);
  	}
  
! 	if (value->typePtr == app->ListType) {
  		int size;
  		int i, status;
***************
*** 807,815 ****
  	}
  
! 	if (value->typePtr == &tclProcBodyType) {
  		// fall through: return tcl object
  	}
  
! 	if (value->typePtr == &tclStringType) {
  #ifdef Py_USING_UNICODE
  #ifdef Py_UNICODE_WIDE
--- 823,831 ----
  	}
  
! 	if (value->typePtr == app->ProcBodyType) {
  		// fall through: return tcl object
  	}
  
! 	if (value->typePtr == app->StringType) {
  #ifdef Py_USING_UNICODE
  #ifdef Py_UNICODE_WIDE
***************
*** 2189,2193 ****
  	className = "Tk";
    
! 	if (!PyArg_ParseTuple(args, "|zssi:create",
  			      &screenName, &baseName, &className,
  			      &interactive, &wantobjects))
--- 2205,2209 ----
  	className = "Tk";
    
! 	if (!PyArg_ParseTuple(args, "|zssii:create",
  			      &screenName, &baseName, &className,
  			      &interactive, &wantobjects))