@@ -51,8 +51,8 @@ Copyright (C) 1994 Steen Lumholt.
5151
5252#define TKMAJORMINOR (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION)
5353
54- #if TKMAJORMINOR < 8000
55- #error "Tk older than 8.0 not supported"
54+ #if TKMAJORMINOR < 8002
55+ #error "Tk older than 8.2 not supported"
5656#endif
5757
5858#if defined(macintosh )
@@ -498,12 +498,6 @@ Tkapp_New(char *screenName, char *baseName, char *className, int interactive)
498498
499499/** Tcl Eval **/
500500
501- #if TKMAJORMINOR >= 8001
502- #define USING_OBJECTS
503- #endif
504-
505- #ifdef USING_OBJECTS
506-
507501static Tcl_Obj *
508502AsObj (PyObject * value )
509503{
@@ -530,16 +524,6 @@ AsObj(PyObject *value)
530524 }
531525#ifdef Py_USING_UNICODE
532526 else if (PyUnicode_Check (value )) {
533- #if TKMAJORMINOR <= 8001
534- /* In Tcl 8.1 we must use UTF-8 */
535- PyObject * utf8 = PyUnicode_AsUTF8String (value );
536- if (!utf8 )
537- return 0 ;
538- result = Tcl_NewStringObj (PyString_AS_STRING (utf8 ),
539- PyString_GET_SIZE (utf8 ));
540- Py_DECREF (utf8 );
541- return result ;
542- #else /* TKMAJORMINOR > 8001 */
543527 /* In Tcl 8.2 and later, use Tcl_NewUnicodeObj() */
544528 if (sizeof (Py_UNICODE ) != sizeof (Tcl_UniChar )) {
545529 /* XXX Should really test this at compile time */
@@ -549,7 +533,6 @@ AsObj(PyObject *value)
549533 }
550534 return Tcl_NewUnicodeObj (PyUnicode_AS_UNICODE (value ),
551535 PyUnicode_GET_SIZE (value ));
552- #endif /* TKMAJORMINOR > 8001 */
553536 }
554537#endif
555538 else {
@@ -663,124 +646,6 @@ Tkapp_Call(PyObject *self, PyObject *args)
663646 return res ;
664647}
665648
666- #else /* !USING_OBJECTS */
667-
668- static PyObject *
669- Tkapp_Call (PyObject * self , PyObject * args )
670- {
671- /* This is copied from Merge() */
672- PyObject * tmp = NULL ;
673- char * argvStore [ARGSZ ];
674- char * * argv = NULL ;
675- int fvStore [ARGSZ ];
676- int * fv = NULL ;
677- int argc = 0 , fvc = 0 , i ;
678- PyObject * res = NULL ; /* except this has a different type */
679- Tcl_CmdInfo info ; /* and this is added */
680- Tcl_Interp * interp = Tkapp_Interp (self ); /* and this too */
681-
682- if (!(tmp = PyList_New (0 )))
683- return NULL ;
684-
685- argv = argvStore ;
686- fv = fvStore ;
687-
688- if (args == NULL )
689- argc = 0 ;
690-
691- else if (!PyTuple_Check (args )) {
692- argc = 1 ;
693- fv [0 ] = 0 ;
694- if (!(argv [0 ] = AsString (args , tmp )))
695- goto finally ;
696- }
697- else {
698- argc = PyTuple_Size (args );
699-
700- if (argc > ARGSZ ) {
701- argv = (char * * )ckalloc (argc * sizeof (char * ));
702- fv = (int * )ckalloc (argc * sizeof (int ));
703- if (argv == NULL || fv == NULL ) {
704- PyErr_NoMemory ();
705- goto finally ;
706- }
707- }
708-
709- for (i = 0 ; i < argc ; i ++ ) {
710- PyObject * v = PyTuple_GetItem (args , i );
711- if (PyTuple_Check (v )) {
712- fv [i ] = 1 ;
713- if (!(argv [i ] = Merge (v )))
714- goto finally ;
715- fvc ++ ;
716- }
717- else if (v == Py_None ) {
718- argc = i ;
719- break ;
720- }
721- else {
722- fv [i ] = 0 ;
723- if (!(argv [i ] = AsString (v , tmp )))
724- goto finally ;
725- fvc ++ ;
726- }
727- }
728- }
729- /* End code copied from Merge() */
730-
731- /* All this to avoid a call to Tcl_Merge() and the corresponding call
732- to Tcl_SplitList() inside Tcl_Eval()... It can save a bundle! */
733- if (Py_VerboseFlag >= 2 ) {
734- for (i = 0 ; i < argc ; i ++ )
735- PySys_WriteStderr ("%s " , argv [i ]);
736- }
737- ENTER_TCL
738- info .proc = NULL ;
739- if (argc < 1 ||
740- !Tcl_GetCommandInfo (interp , argv [0 ], & info ) ||
741- info .proc == NULL )
742- {
743- char * cmd ;
744- cmd = Tcl_Merge (argc , argv );
745- i = Tcl_Eval (interp , cmd );
746- ckfree (cmd );
747- }
748- else {
749- Tcl_ResetResult (interp );
750- i = (* info .proc )(info .clientData , interp , argc , argv );
751- }
752- ENTER_OVERLAP
753- if (info .proc == NULL && Py_VerboseFlag >= 2 )
754- PySys_WriteStderr ("... use TclEval ");
755- if (i == TCL_ERROR ) {
756- if (Py_VerboseFlag >= 2 )
757- PySys_WriteStderr ("... error: '%s'\n" ,
758- Tcl_GetStringResult (interp ));
759- Tkinter_Error (self );
760- }
761- else {
762- if (Py_VerboseFlag >= 2 )
763- PySys_WriteStderr ("-> '%s'\n" , Tcl_GetStringResult (interp ));
764- res = PyString_FromString (Tcl_GetStringResult (interp ));
765- }
766- LEAVE_OVERLAP_TCL
767-
768- /* Copied from Merge() again */
769- finally :
770- for (i = 0 ; i < fvc ; i ++ )
771- if (fv [i ]) {
772- ckfree (argv [i ]);
773- }
774- if (argv != argvStore )
775- ckfree (FREECAST argv );
776- if (fv != fvStore )
777- ckfree (FREECAST fv );
778-
779- Py_DECREF (tmp );
780- return res ;
781- }
782-
783- #endif /* !USING_OBJECTS */
784649
785650static PyObject *
786651Tkapp_GlobalCall (PyObject * self , PyObject * args )
0 commit comments