Mercurial > cpython-lru_cache-weakref
annotate Modules/_tkinter.c @ 3930:52c19ee83a6b legacy-trunk
Guido's 1.4b2 fixes: Py_GetProgramName, Py_GetPrefix and Py_GetExecPrefix.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Fri, 02 Aug 1996 15:16:16 +0000 |
| parents | 584936890f86 |
| children | 3d1e4b76f745 |
| rev | line source |
|---|---|
| 3703 | 1 /*********************************************************** |
| 2 Copyright (C) 1994 Steen Lumholt. | |
| 3 Copyright 1994-1995 by Stichting Mathematisch Centrum, Amsterdam, | |
| 4 The Netherlands. | |
| 5 | |
| 6 All Rights Reserved | |
| 7 | |
| 8 Permission to use, copy, modify, and distribute this software and its | |
| 9 documentation for any purpose and without fee is hereby granted, | |
| 10 provided that the above copyright notice appear in all copies and that | |
| 11 both that copyright notice and this permission notice appear in | |
| 12 supporting documentation, and that the names of Stichting Mathematisch | |
| 13 Centrum or CWI not be used in advertising or publicity pertaining to | |
| 14 distribution of the software without specific, written prior permission. | |
| 15 | |
| 16 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO | |
| 17 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 18 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE | |
| 19 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
| 21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
| 22 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 23 | |
| 24 ******************************************************************/ | |
| 25 | |
| 26 /* _tkinter.c -- Interface to libtk.a and libtcl.a. */ | |
| 1664 | 27 |
| 3120 | 28 #include "Python.h" |
| 29 | |
| 1664 | 30 #include <tcl.h> |
| 31 #include <tk.h> | |
| 32 | |
|
3899
584936890f86
getprogramname --> Py_GetProgramName
Guido van Rossum <guido@python.org>
parents:
3703
diff
changeset
|
33 extern char *Py_GetProgramName (); |
| 1713 | 34 |
| 3120 | 35 /* Internal declarations from tkInt.h. */ |
| 36 #if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 | |
| 37 extern int Tk_GetNumMainWindows(); | |
| 38 #else | |
| 1664 | 39 extern int tk_NumMainWindows; |
| 3120 | 40 #define Tk_GetNumMainWindows() (tk_NumMainWindows) |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
41 #define NEED_TKCREATEMAINWINDOW 1 |
| 3120 | 42 #endif |
| 43 | |
| 44 #if TK_MAJOR_VERSION < 4 | |
| 1713 | 45 extern struct { Tk_Window win; } *tkMainWindowList; |
| 3120 | 46 #endif |
| 1664 | 47 |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
48 #ifdef macintosh |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
49 |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
50 /* |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
51 ** Additional cruft needed by Tcl/Tk on the Mac. |
| 3703 | 52 ** This is for Tcl 7.5 and Tk 4.1 (final releases). |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
53 */ |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
54 |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
55 #include <Events.h> /* For EventRecord */ |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
56 |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
57 typedef int (*TclMacConvertEventPtr) Py_PROTO((EventRecord *eventPtr)); |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
58 void TclMacSetEventProc Py_PROTO((TclMacConvertEventPtr procPtr)); |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
59 int TkMacConvertEvent Py_PROTO((EventRecord *eventPtr)); |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
60 |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
61 staticforward int PyMacConvertEvent Py_PROTO((EventRecord *eventPtr)); |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
62 |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
63 #endif /* macintosh */ |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
64 |
| 1664 | 65 /**** Tkapp Object Declaration ****/ |
| 66 | |
| 67 staticforward PyTypeObject Tkapp_Type; | |
| 68 | |
| 69 typedef struct | |
| 70 { | |
| 71 PyObject_HEAD | |
| 72 Tcl_Interp *interp; | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
73 #ifdef NEED_TKCREATEMAINWINDOW |
| 1664 | 74 Tk_Window tkwin; |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
75 #endif |
| 1664 | 76 } |
| 77 TkappObject; | |
| 78 | |
| 79 #define Tkapp_Check(v) ((v)->ob_type == &Tkapp_Type) | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
80 #ifdef NEED_TKCREATEMAINWINDOW |
| 1664 | 81 #define Tkapp_Tkwin(v) (((TkappObject *) (v))->tkwin) |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
82 #endif |
| 1664 | 83 #define Tkapp_Interp(v) (((TkappObject *) (v))->interp) |
| 84 #define Tkapp_Result(v) (((TkappObject *) (v))->interp->result) | |
| 85 | |
| 86 #define DEBUG_REFCNT(v) (printf ("DEBUG: id=%p, refcnt=%i\n", \ | |
| 87 (void *) v, ((PyObject *) v)->ob_refcnt)) | |
| 88 | |
| 89 /**** Error Handling ****/ | |
| 90 | |
| 91 static PyObject *Tkinter_TclError; | |
| 1713 | 92 static int quitMainLoop = 0; |
| 1664 | 93 static int errorInCmd = 0; |
| 94 static PyObject *excInCmd; | |
| 95 static PyObject *valInCmd; | |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
96 static PyObject *trbInCmd; |
| 1664 | 97 |
| 98 static PyObject * | |
| 99 Tkinter_Error (v) | |
| 100 PyObject *v; | |
| 101 { | |
| 102 PyErr_SetString (Tkinter_TclError, Tkapp_Result (v)); | |
| 103 return NULL; | |
| 104 } | |
| 105 | |
| 106 int | |
| 107 PythonCmd_Error (interp) | |
| 108 Tcl_Interp *interp; | |
| 109 { | |
| 110 errorInCmd = 1; | |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
111 PyErr_Fetch (&excInCmd, &valInCmd, &trbInCmd); |
| 1664 | 112 return TCL_ERROR; |
| 113 } | |
| 114 | |
| 115 /**** Utils ****/ | |
| 116 | |
| 117 static char * | |
| 118 AsString (value, tmp) | |
| 119 PyObject *value; | |
| 120 PyObject *tmp; | |
| 121 { | |
| 122 if (PyString_Check (value)) | |
| 123 return PyString_AsString (value); | |
| 124 else | |
| 125 { | |
| 126 PyObject *v; | |
| 127 | |
|
2150
448435bfeadc
Made some more things static, and other cleanup for new naming scheme
Guido van Rossum <guido@python.org>
parents:
2123
diff
changeset
|
128 v = PyObject_Str (value); |
| 1664 | 129 PyList_Append (tmp, v); |
| 130 Py_DECREF (v); | |
| 131 return PyString_AsString (v); | |
| 132 } | |
| 133 } | |
| 134 | |
| 135 #define ARGSZ 64 | |
| 136 | |
| 137 static char * | |
| 138 Merge (args) | |
| 139 PyObject *args; | |
| 140 { | |
| 141 PyObject *tmp; | |
| 142 char *argvStore[ARGSZ]; | |
| 143 char **argv; | |
| 144 int fvStore[ARGSZ]; | |
| 145 int *fv; | |
| 146 int argc; | |
| 147 char *res; | |
| 148 int i; | |
| 149 | |
| 150 tmp = PyList_New (0); | |
| 151 argv = argvStore; | |
| 152 fv = fvStore; | |
| 153 | |
| 3703 | 154 if (args == NULL) |
| 155 { | |
| 156 argc = 0; | |
| 157 } | |
| 158 else if (!PyTuple_Check (args)) | |
| 1664 | 159 { |
| 160 argc = 1; | |
| 161 fv[0] = 0; | |
| 162 argv[0] = AsString (args, tmp); | |
| 163 } | |
| 164 else | |
| 165 { | |
| 166 PyObject *v; | |
| 167 | |
| 168 if (PyTuple_Size (args) > ARGSZ) | |
| 169 { | |
|
2505
e920e6c27208
add casts to malloc() calls
Guido van Rossum <guido@python.org>
parents:
2300
diff
changeset
|
170 argv = (char **) malloc (PyTuple_Size (args) * sizeof (char *)); |
|
e920e6c27208
add casts to malloc() calls
Guido van Rossum <guido@python.org>
parents:
2300
diff
changeset
|
171 fv = (int *) malloc (PyTuple_Size (args) * sizeof (int)); |
| 1664 | 172 if (argv == NULL || fv == NULL) |
| 173 PyErr_NoMemory (); | |
| 174 } | |
| 175 | |
| 176 argc = PyTuple_Size (args); | |
| 177 for (i = 0; i < argc; i++) | |
| 178 { | |
| 179 v = PyTuple_GetItem (args, i); | |
| 180 if (PyTuple_Check (v)) | |
| 181 { | |
| 182 fv[i] = 1; | |
| 183 argv[i] = Merge (v); | |
| 184 } | |
| 185 else if (v == Py_None) | |
| 186 { | |
| 187 argc = i; | |
| 188 break; | |
| 189 } | |
| 190 else | |
| 191 { | |
| 192 fv[i] = 0; | |
| 193 argv[i] = AsString (v, tmp); | |
| 194 } | |
| 195 } | |
| 196 } | |
| 197 | |
| 198 res = Tcl_Merge (argc, argv); | |
| 199 | |
| 200 Py_DECREF (tmp); | |
| 201 for (i = 0; i < argc; i++) | |
| 202 if (fv[i]) free (argv[i]); | |
| 203 if (argv != argvStore) | |
| 204 free (argv); | |
| 205 if (fv != fvStore) | |
| 206 free (fv); | |
| 207 | |
| 208 return res; | |
| 209 } | |
| 210 | |
| 211 static PyObject * | |
| 212 Split (self, list) | |
| 213 PyObject *self; | |
| 214 char *list; | |
| 215 { | |
| 216 int argc; | |
| 217 char **argv; | |
| 218 PyObject *v; | |
| 219 | |
| 220 if (list == NULL) | |
| 221 { | |
| 222 Py_INCREF (Py_None); | |
| 223 return Py_None; | |
| 224 } | |
| 225 | |
| 226 if (Tcl_SplitList (Tkapp_Interp (self), list, &argc, &argv) == TCL_ERROR) | |
| 227 return Tkinter_Error (self); | |
| 228 | |
| 229 if (argc == 0) | |
| 230 v = PyString_FromString (""); | |
| 231 else if (argc == 1) | |
| 232 v = PyString_FromString (argv[0]); | |
| 233 else | |
| 234 { | |
| 235 int i; | |
| 236 | |
| 237 v = PyTuple_New (argc); | |
| 238 for (i = 0; i < argc; i++) | |
| 239 PyTuple_SetItem (v, i, Split (self, argv[i])); | |
| 240 } | |
| 241 | |
| 242 free (argv); | |
| 243 return v; | |
| 244 } | |
| 245 | |
| 246 /**** Tkapp Object ****/ | |
| 247 | |
| 248 #ifndef WITH_APPINIT | |
| 249 int | |
| 250 Tcl_AppInit (interp) | |
| 251 Tcl_Interp *interp; | |
| 252 { | |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
253 Tk_Window main; |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
254 |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
255 main = Tk_MainWindow(interp); |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
256 if (Tcl_Init (interp) == TCL_ERROR) { |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
257 fprintf(stderr, "Tcl_Init error: %s\n", interp->result); |
| 1664 | 258 return TCL_ERROR; |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
259 } |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
260 if (Tk_Init (interp) == TCL_ERROR) { |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
261 fprintf(stderr, "Tk_Init error: %s\n", interp->result); |
| 1664 | 262 return TCL_ERROR; |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
263 } |
| 1664 | 264 return TCL_OK; |
| 265 } | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
266 |
| 1664 | 267 #endif /* !WITH_APPINIT */ |
| 268 | |
| 269 /* Initialize the Tk application; see the `main' function in | |
| 270 `tkMain.c'. */ | |
| 271 static TkappObject * | |
| 272 Tkapp_New (screenName, baseName, className, interactive) | |
| 273 char *screenName; | |
| 274 char *baseName; | |
| 275 char *className; | |
| 276 int interactive; | |
| 277 { | |
| 278 TkappObject *v; | |
| 279 | |
| 280 v = PyObject_NEW (TkappObject, &Tkapp_Type); | |
| 281 if (v == NULL) | |
| 282 return NULL; | |
| 283 | |
| 284 v->interp = Tcl_CreateInterp (); | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
285 |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
286 #ifdef NEED_TKCREATEMAINWINDOW |
| 1664 | 287 v->tkwin = Tk_CreateMainWindow (v->interp, screenName, |
| 288 baseName, className); | |
| 289 if (v->tkwin == NULL) | |
| 290 return (TkappObject *) Tkinter_Error ((PyObject *) v); | |
| 291 | |
| 292 Tk_GeometryRequest (v->tkwin, 200, 200); | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
293 #endif |
| 1664 | 294 |
| 295 if (screenName != NULL) | |
| 296 Tcl_SetVar2 (v->interp, "env", "DISPLAY", screenName, TCL_GLOBAL_ONLY); | |
| 297 | |
| 298 if (interactive) | |
| 299 Tcl_SetVar (v->interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY); | |
| 300 else | |
| 301 Tcl_SetVar (v->interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); | |
| 302 | |
| 303 if (Tcl_AppInit (v->interp) != TCL_OK) | |
| 3703 | 304 return (TkappObject *) Tkinter_Error (v); |
| 1664 | 305 |
| 306 return v; | |
| 307 } | |
| 308 | |
| 309 /** Tcl Eval **/ | |
| 310 | |
| 311 static PyObject * | |
| 312 Tkapp_Call (self, args) | |
| 313 PyObject *self; | |
| 314 PyObject *args; | |
| 315 { | |
| 316 char *cmd; | |
| 317 | |
| 318 cmd = Merge (args); | |
| 319 if (Tcl_Eval (Tkapp_Interp (self), cmd) == TCL_ERROR) | |
| 320 { | |
| 321 free (cmd); | |
| 322 return Tkinter_Error (self); | |
| 323 } | |
| 324 | |
| 325 free (cmd); | |
| 326 return PyString_FromString (Tkapp_Result (self)); | |
| 327 } | |
| 328 | |
| 329 static PyObject * | |
| 330 Tkapp_GlobalCall (self, args) | |
| 331 PyObject *self; | |
| 332 PyObject *args; | |
| 333 { | |
| 334 char *cmd; | |
| 335 | |
| 336 cmd = Merge (args); | |
| 337 if (Tcl_GlobalEval (Tkapp_Interp (self), cmd) == TCL_ERROR) | |
| 338 { | |
| 339 free (cmd); | |
| 340 return Tkinter_Error (self); | |
| 341 } | |
| 342 | |
| 343 free (cmd); | |
| 344 return PyString_FromString (Tkapp_Result (self)); | |
| 345 } | |
| 346 | |
| 347 static PyObject * | |
| 348 Tkapp_Eval (self, args) | |
| 349 PyObject *self; | |
| 350 PyObject *args; | |
| 351 { | |
| 352 char *script; | |
| 353 | |
| 354 if (!PyArg_Parse (args, "s", &script)) | |
| 355 return NULL; | |
| 356 | |
| 357 if (Tcl_Eval (Tkapp_Interp (self), script) == TCL_ERROR) | |
| 358 return Tkinter_Error (self); | |
| 359 | |
| 360 return PyString_FromString (Tkapp_Result (self)); | |
| 361 } | |
| 362 | |
| 363 static PyObject * | |
| 364 Tkapp_GlobalEval (self, args) | |
| 365 PyObject *self; | |
| 366 PyObject *args; | |
| 367 { | |
| 368 char *script; | |
| 369 | |
| 370 if (!PyArg_Parse (args, "s", &script)) | |
| 371 return NULL; | |
| 372 | |
| 373 if (Tcl_GlobalEval (Tkapp_Interp (self), script) == TCL_ERROR) | |
| 374 return Tkinter_Error (self); | |
| 375 | |
| 376 return PyString_FromString (Tkapp_Result (self)); | |
| 377 } | |
| 378 | |
| 379 static PyObject * | |
| 380 Tkapp_EvalFile (self, args) | |
| 381 PyObject *self; | |
| 382 PyObject *args; | |
| 383 { | |
| 384 char *fileName; | |
| 385 | |
| 386 if (!PyArg_Parse (args, "s", &fileName)) | |
| 387 return NULL; | |
| 388 | |
| 389 if (Tcl_EvalFile (Tkapp_Interp (self), fileName) == TCL_ERROR) | |
| 390 return Tkinter_Error (self); | |
| 391 | |
| 392 return PyString_FromString (Tkapp_Result (self)); | |
| 393 } | |
| 394 | |
| 395 static PyObject * | |
| 396 Tkapp_Record (self, args) | |
| 397 PyObject *self; | |
| 398 PyObject *args; | |
| 399 { | |
| 400 char *script; | |
| 401 | |
| 402 if (!PyArg_Parse (args, "s", &script)) | |
| 403 return NULL; | |
| 404 | |
| 405 if (Tcl_RecordAndEval (Tkapp_Interp (self), | |
| 406 script, TCL_NO_EVAL) == TCL_ERROR) | |
| 407 return Tkinter_Error (self); | |
| 408 | |
| 409 return PyString_FromString (Tkapp_Result (self)); | |
| 410 } | |
| 411 | |
| 412 static PyObject * | |
| 413 Tkapp_AddErrorInfo (self, args) | |
| 414 PyObject *self; | |
| 415 PyObject *args; | |
| 416 { | |
| 417 char *msg; | |
| 418 | |
| 419 if (!PyArg_Parse (args, "s", &msg)) | |
| 420 return NULL; | |
| 421 Tcl_AddErrorInfo (Tkapp_Interp (self), msg); | |
| 422 | |
| 423 Py_INCREF(Py_None); | |
| 424 return Py_None; | |
| 425 } | |
| 426 | |
| 427 /** Tcl Variable **/ | |
| 428 | |
| 429 static PyObject * | |
| 430 SetVar (self, args, flags) | |
| 431 PyObject *self; | |
| 432 PyObject *args; | |
| 433 int flags; | |
| 434 { | |
| 435 char *name1, *name2, *ok; | |
| 436 PyObject *newValue; | |
| 437 PyObject *tmp; | |
| 438 | |
| 439 tmp = PyList_New (0); | |
| 440 | |
| 441 if (PyArg_Parse (args, "(sO)", &name1, &newValue)) | |
| 442 ok = Tcl_SetVar (Tkapp_Interp (self), name1, | |
| 443 AsString (newValue, tmp), flags); /* XXX Merge? */ | |
| 444 else if (PyArg_Parse (args, "(ssO)", &name1, &name2, &newValue)) | |
| 445 ok = Tcl_SetVar2 (Tkapp_Interp (self), name1, name2, | |
| 446 AsString (newValue, tmp), flags); | |
| 447 else | |
| 448 { | |
| 449 Py_DECREF (tmp); | |
| 450 return NULL; | |
| 451 } | |
| 452 Py_DECREF (tmp); | |
| 453 | |
| 454 if (!ok) | |
| 455 return Tkinter_Error (self); | |
| 456 | |
| 457 Py_INCREF (Py_None); | |
| 458 return Py_None; | |
| 459 } | |
| 460 | |
| 461 static PyObject * | |
| 462 Tkapp_SetVar (self, args) | |
| 463 PyObject *self; | |
| 464 PyObject *args; | |
| 465 { | |
| 466 return SetVar (self, args, TCL_LEAVE_ERR_MSG); | |
| 467 } | |
| 468 | |
| 469 static PyObject * | |
| 470 Tkapp_GlobalSetVar (self, args) | |
| 471 PyObject *self; | |
| 472 PyObject *args; | |
| 473 { | |
| 474 return SetVar (self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); | |
| 475 } | |
| 476 | |
| 477 static PyObject * | |
| 478 GetVar (self, args, flags) | |
| 479 PyObject *self; | |
| 480 PyObject *args; | |
| 481 int flags; | |
| 482 { | |
| 483 char *name1, *name2, *s; | |
| 484 | |
| 485 if (PyArg_Parse (args, "s", &name1)) | |
| 486 s = Tcl_GetVar (Tkapp_Interp (self), name1, flags); | |
| 487 else if (PyArg_Parse (args, "(ss)", &name1, &name2)) | |
| 488 s = Tcl_GetVar2 (Tkapp_Interp (self), name1, name2, flags); | |
| 489 else | |
| 490 return NULL; | |
| 491 | |
| 492 if (s == NULL) | |
| 493 return Tkinter_Error (self); | |
| 494 | |
| 495 return PyString_FromString (s); | |
| 496 } | |
| 497 | |
| 498 static PyObject * | |
| 499 Tkapp_GetVar (self, args) | |
| 500 PyObject *self; | |
| 501 PyObject *args; | |
| 502 { | |
| 503 return GetVar (self, args, TCL_LEAVE_ERR_MSG); | |
| 504 } | |
| 505 | |
| 506 static PyObject * | |
| 507 Tkapp_GlobalGetVar (self, args) | |
| 508 PyObject *self; | |
| 509 PyObject *args; | |
| 510 { | |
| 511 return GetVar (self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); | |
| 512 } | |
| 513 | |
| 514 static PyObject * | |
| 515 UnsetVar (self, args, flags) | |
| 516 PyObject *self; | |
| 517 PyObject *args; | |
| 518 int flags; | |
| 519 { | |
| 520 char *name1, *name2; | |
| 521 int code; | |
| 522 | |
| 523 if (PyArg_Parse (args, "s", &name1)) | |
| 524 code = Tcl_UnsetVar (Tkapp_Interp (self), name1, flags); | |
| 525 else if (PyArg_Parse (args, "(ss)", &name1, &name2)) | |
| 526 code = Tcl_UnsetVar2 (Tkapp_Interp (self), name1, name2, flags); | |
| 527 else | |
| 528 return NULL; | |
| 529 | |
| 530 if (code == TCL_ERROR) | |
| 531 return Tkinter_Error (self); | |
| 532 | |
| 533 Py_INCREF (Py_None); | |
| 534 return Py_None; | |
| 535 } | |
| 536 | |
| 537 static PyObject * | |
| 538 Tkapp_UnsetVar (self, args) | |
| 539 PyObject *self; | |
| 540 PyObject *args; | |
| 541 { | |
| 542 return UnsetVar (self, args, TCL_LEAVE_ERR_MSG); | |
| 543 } | |
| 544 | |
| 545 static PyObject * | |
| 546 Tkapp_GlobalUnsetVar (self, args) | |
| 547 PyObject *self; | |
| 548 PyObject *args; | |
| 549 { | |
| 550 return UnsetVar (self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); | |
| 551 } | |
| 552 | |
| 553 /** Tcl to Python **/ | |
| 554 | |
| 555 static PyObject * | |
| 556 Tkapp_GetInt (self, args) | |
| 557 PyObject *self; | |
| 558 PyObject *args; | |
| 559 { | |
| 560 char *s; | |
| 561 int v; | |
| 562 | |
| 563 if (!PyArg_Parse (args, "s", &s)) | |
| 564 return NULL; | |
| 565 if (Tcl_GetInt (Tkapp_Interp (self), s, &v) == TCL_ERROR) | |
| 566 return Tkinter_Error (self); | |
| 567 return Py_BuildValue ("i", v); | |
| 568 } | |
| 569 | |
| 570 static PyObject * | |
| 571 Tkapp_GetDouble (self, args) | |
| 572 PyObject *self; | |
| 573 PyObject *args; | |
| 574 { | |
| 575 char *s; | |
| 576 double v; | |
| 577 | |
| 578 if (!PyArg_Parse (args, "s", &s)) | |
| 579 return NULL; | |
| 580 if (Tcl_GetDouble (Tkapp_Interp (self), s, &v) == TCL_ERROR) | |
| 581 return Tkinter_Error (self); | |
| 582 return Py_BuildValue ("d", v); | |
| 583 } | |
| 584 | |
| 585 static PyObject * | |
| 586 Tkapp_GetBoolean (self, args) | |
| 587 PyObject *self; | |
| 588 PyObject *args; | |
| 589 { | |
| 590 char *s; | |
| 591 int v; | |
| 592 | |
| 593 if (!PyArg_Parse (args, "s", &s)) | |
| 594 return NULL; | |
| 595 if (Tcl_GetBoolean (Tkapp_Interp (self), s, &v) == TCL_ERROR) | |
| 596 return Tkinter_Error (self); | |
| 597 return Py_BuildValue ("i", v); | |
| 598 } | |
| 599 | |
| 600 static PyObject * | |
| 601 Tkapp_ExprString (self, args) | |
| 602 PyObject *self; | |
| 603 PyObject *args; | |
| 604 { | |
| 605 char *s; | |
| 606 | |
| 607 if (!PyArg_Parse (args, "s", &s)) | |
| 608 return NULL; | |
| 609 if (Tcl_ExprString (Tkapp_Interp (self), s) == TCL_ERROR) | |
| 610 return Tkinter_Error (self); | |
| 611 return Py_BuildValue ("s", Tkapp_Result (self)); | |
| 612 } | |
| 613 | |
| 614 static PyObject * | |
| 615 Tkapp_ExprLong (self, args) | |
| 616 PyObject *self; | |
| 617 PyObject *args; | |
| 618 { | |
| 619 char *s; | |
| 620 long v; | |
| 621 | |
| 622 if (!PyArg_Parse (args, "s", &s)) | |
| 623 return NULL; | |
| 624 if (Tcl_ExprLong (Tkapp_Interp (self), s, &v) == TCL_ERROR) | |
| 625 return Tkinter_Error (self); | |
| 626 return Py_BuildValue ("l", v); | |
| 627 } | |
| 628 | |
| 629 static PyObject * | |
| 630 Tkapp_ExprDouble (self, args) | |
| 631 PyObject *self; | |
| 632 PyObject *args; | |
| 633 { | |
| 634 char *s; | |
| 635 double v; | |
| 636 | |
| 637 if (!PyArg_Parse (args, "s", &s)) | |
| 638 return NULL; | |
| 639 if (Tcl_ExprDouble (Tkapp_Interp (self), s, &v) == TCL_ERROR) | |
| 640 return Tkinter_Error (self); | |
| 641 return Py_BuildValue ("d", v); | |
| 642 } | |
| 643 | |
| 644 static PyObject * | |
| 645 Tkapp_ExprBoolean (self, args) | |
| 646 PyObject *self; | |
| 647 PyObject *args; | |
| 648 { | |
| 649 char *s; | |
| 650 int v; | |
| 651 | |
| 652 if (!PyArg_Parse (args, "s", &s)) | |
| 653 return NULL; | |
| 654 if (Tcl_ExprBoolean (Tkapp_Interp (self), s, &v) == TCL_ERROR) | |
| 655 return Tkinter_Error (self); | |
| 656 return Py_BuildValue ("i", v); | |
| 657 } | |
| 658 | |
| 659 static PyObject * | |
| 660 Tkapp_SplitList (self, args) | |
| 661 PyObject *self; | |
| 662 PyObject *args; | |
| 663 { | |
| 664 char *list; | |
| 665 int argc; | |
| 666 char **argv; | |
| 667 PyObject *v; | |
| 668 int i; | |
| 669 | |
| 670 if (!PyArg_Parse (args, "s", &list)) | |
| 671 return NULL; | |
| 672 | |
| 673 if (Tcl_SplitList (Tkapp_Interp (self), list, &argc, &argv) == TCL_ERROR) | |
| 674 return Tkinter_Error (self); | |
| 675 | |
| 676 v = PyTuple_New (argc); | |
| 677 for (i = 0; i < argc; i++) | |
| 678 PyTuple_SetItem (v, i, PyString_FromString (argv[i])); | |
| 679 | |
| 680 free (argv); | |
| 681 return v; | |
| 682 } | |
| 683 | |
| 684 static PyObject * | |
| 685 Tkapp_Split (self, args) | |
| 686 PyObject *self; | |
| 687 PyObject *args; | |
| 688 { | |
| 689 char *list; | |
| 690 | |
| 691 if (!PyArg_Parse (args, "s", &list)) | |
| 692 return NULL; | |
| 693 return Split (self, list); | |
| 694 } | |
| 695 | |
| 696 static PyObject * | |
| 697 Tkapp_Merge (self, args) | |
| 698 PyObject *self; | |
| 699 PyObject *args; | |
| 700 { | |
| 701 char *s; | |
| 702 PyObject *v; | |
| 703 | |
| 704 s = Merge (args); | |
| 705 v = PyString_FromString (s); | |
| 706 free (s); | |
| 707 return v; | |
| 708 } | |
| 709 | |
| 710 /** Tcl Command **/ | |
| 711 | |
| 712 /* This is the Tcl command that acts as a wrapper for Python | |
| 713 function or method. */ | |
| 714 static int | |
| 715 PythonCmd (clientData, interp, argc, argv) | |
| 716 ClientData clientData; /* Is (self, func) */ | |
| 717 Tcl_Interp *interp; | |
| 718 int argc; | |
| 719 char *argv[]; | |
| 720 { | |
| 721 PyObject *self, *func, *arg, *res, *tmp; | |
| 722 int i; | |
| 723 | |
| 724 self = PyTuple_GetItem ((PyObject *) clientData, 0); | |
| 725 func = PyTuple_GetItem ((PyObject *) clientData, 1); | |
| 726 | |
| 727 /* Create argument list (argv1, ..., argvN) */ | |
| 728 arg = PyTuple_New (argc - 1); | |
| 729 for (i = 0; i < (argc - 1); i++) | |
| 730 PyTuple_SetItem (arg, i, PyString_FromString (argv[i + 1])); | |
| 731 | |
| 732 res = PyEval_CallObject (func, arg); | |
| 733 Py_DECREF (arg); | |
| 1713 | 734 |
| 1664 | 735 if (res == NULL) |
| 736 return PythonCmd_Error (interp); | |
| 737 | |
| 738 tmp = PyList_New (0); | |
| 739 Tcl_SetResult (Tkapp_Interp (self), AsString (res, tmp), TCL_VOLATILE); | |
| 740 Py_DECREF (res); | |
| 741 Py_DECREF (tmp); | |
| 742 | |
| 743 return TCL_OK; | |
| 744 } | |
| 745 | |
| 746 static void | |
| 747 PythonCmdDelete (clientData) | |
| 748 ClientData clientData; /* Is (self, func) */ | |
| 749 { | |
| 750 Py_DECREF ((PyObject *) clientData); | |
| 751 } | |
| 752 | |
| 753 static PyObject * | |
| 754 Tkapp_CreateCommand (self, args) | |
| 755 PyObject *self; | |
| 756 PyObject *args; | |
| 757 { | |
| 758 char *cmdName; | |
| 759 PyObject *data; | |
| 760 PyObject *func; | |
| 761 | |
| 762 /* Args is: (cmdName, func) */ | |
| 763 if (!PyTuple_Check (args) | |
| 764 || !(PyTuple_Size (args) == 2) | |
| 765 || !PyString_Check (PyTuple_GetItem (args, 0)) | |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
766 || !PyCallable_Check (PyTuple_GetItem (args, 1))) |
| 1664 | 767 { |
| 768 PyErr_SetString (PyExc_TypeError, "bad argument list"); | |
| 769 return NULL; | |
| 770 } | |
| 771 | |
| 772 cmdName = PyString_AsString (PyTuple_GetItem (args, 0)); | |
| 773 func = PyTuple_GetItem (args, 1); | |
| 774 | |
| 775 data = PyTuple_New (2); /* ClientData is: (self, func) */ | |
| 776 | |
| 777 Py_INCREF (self); | |
| 778 PyTuple_SetItem (data, 0, self); | |
| 779 | |
| 780 Py_INCREF (func); | |
| 781 PyTuple_SetItem (data, 1, func); | |
| 782 | |
| 783 Tcl_CreateCommand (Tkapp_Interp (self), cmdName, PythonCmd, | |
| 784 (ClientData) data, PythonCmdDelete); | |
| 785 | |
| 786 Py_INCREF (Py_None); | |
| 787 return Py_None; | |
| 788 } | |
| 789 | |
| 790 static PyObject * | |
| 791 Tkapp_DeleteCommand (self, args) | |
| 792 PyObject *self; | |
| 793 PyObject *args; | |
| 794 { | |
| 795 char *cmdName; | |
| 796 | |
| 797 if (!PyArg_Parse (args, "s", &cmdName)) | |
| 798 return NULL; | |
| 799 if (Tcl_DeleteCommand (Tkapp_Interp (self), cmdName) == -1) | |
| 800 { | |
| 801 PyErr_SetString (Tkinter_TclError, "can't delete Tcl command"); | |
| 802 return NULL; | |
| 803 } | |
| 804 Py_INCREF (Py_None); | |
| 805 return Py_None; | |
| 806 } | |
| 807 | |
| 808 /** File Handler **/ | |
| 809 | |
|
2123
fd5ab7e828fc
cosmetic changes so these modules will work with the strict new naming scheme
Guido van Rossum <guido@python.org>
parents:
2121
diff
changeset
|
810 static void |
| 1664 | 811 FileHandler (clientData, mask) |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
812 ClientData clientData; /* Is: (func, file) */ |
| 1664 | 813 int mask; |
| 814 { | |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
815 PyObject *func, *file, *arg, *res; |
| 1664 | 816 |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
817 func = PyTuple_GetItem ((PyObject *) clientData, 0); |
|
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
818 file = PyTuple_GetItem ((PyObject *) clientData, 1); |
| 1664 | 819 |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
820 arg = Py_BuildValue ("(Oi)", file, (long) mask); |
| 1664 | 821 res = PyEval_CallObject (func, arg); |
| 822 Py_DECREF (arg); | |
| 823 if (res == NULL) | |
| 824 { | |
| 825 errorInCmd = 1; | |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
826 PyErr_Fetch (&excInCmd, &valInCmd, &trbInCmd); |
| 1664 | 827 } |
|
1771
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
828 Py_XDECREF (res); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
829 } |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
830 |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
831 static int |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
832 GetFileNo (file) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
833 PyObject *file; /* Either an int >= 0 or an object with a |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
834 .fileno() method that returns an int >= 0 */ |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
835 { |
|
2123
fd5ab7e828fc
cosmetic changes so these modules will work with the strict new naming scheme
Guido van Rossum <guido@python.org>
parents:
2121
diff
changeset
|
836 PyObject *meth, *args, *res; |
|
1771
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
837 int id; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
838 if (PyInt_Check(file)) { |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
839 id = PyInt_AsLong(file); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
840 if (id < 0) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
841 PyErr_SetString(PyExc_ValueError, "invalid file id"); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
842 return id; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
843 } |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
844 meth = PyObject_GetAttrString(file, "fileno"); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
845 if (meth == NULL) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
846 return -1; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
847 args = PyTuple_New(0); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
848 if (args == NULL) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
849 return -1; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
850 res = PyEval_CallObject(meth, args); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
851 Py_DECREF(args); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
852 Py_DECREF(meth); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
853 if (res == NULL) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
854 return -1; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
855 if (PyInt_Check(res)) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
856 id = PyInt_AsLong(res); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
857 else |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
858 id = -1; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
859 if (id < 0) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
860 PyErr_SetString(PyExc_ValueError, |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
861 "invalid fileno() return value"); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
862 Py_DECREF(res); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
863 return id; |
| 1664 | 864 } |
| 865 | |
| 866 static PyObject * | |
| 867 Tkapp_CreateFileHandler (self, args) | |
| 868 PyObject *self; | |
| 869 PyObject *args; /* Is (file, mask, func) */ | |
| 870 { | |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
871 PyObject *file, *func, *data; |
|
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
872 int mask, id; |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
873 #if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
874 Tcl_File tfile; |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
875 #endif |
| 1664 | 876 |
| 877 if (!PyArg_Parse (args, "(OiO)", &file, &mask, &func)) | |
| 878 return NULL; | |
|
1771
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
879 id = GetFileNo (file); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
880 if (id < 0) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
881 return NULL; |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
882 if (!PyCallable_Check(func)) |
| 1664 | 883 { |
| 884 PyErr_SetString (PyExc_TypeError, "bad argument list"); | |
| 885 return NULL; | |
| 886 } | |
| 887 | |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
888 /* ClientData is: (func, file) */ |
|
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
889 data = Py_BuildValue ("(OO)", func, file); |
|
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
890 |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
891 #if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 |
| 3703 | 892 #ifdef NT |
| 893 /* We assume this is a socket... */ | |
| 894 tfile = Tcl_GetFile((ClientData)id, TCL_WIN_SOCKET); | |
| 895 #else | |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
896 tfile = Tcl_GetFile((ClientData)id, TCL_UNIX_FD); |
| 3703 | 897 #endif |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
898 /* Oughtta check for null Tcl_File object... */ |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
899 Tcl_CreateFileHandler (tfile, mask, FileHandler, (ClientData) data); |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
900 #else |
| 3703 | 901 Tk_CreateFileHandler (id, mask, FileHandler, (ClientData) data); |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
902 #endif |
| 1664 | 903 /* XXX fileHandlerDict */ |
|
1690
93e036786b17
* tkintermodule.c (Tkapp_New): Remove #ifdef WITH_APPINIT.
Guido van Rossum <guido@python.org>
parents:
1664
diff
changeset
|
904 |
| 1664 | 905 Py_INCREF (Py_None); |
| 906 return Py_None; | |
| 907 } | |
| 908 | |
| 909 static PyObject * | |
| 910 Tkapp_DeleteFileHandler (self, args) | |
| 911 PyObject *self; | |
| 912 PyObject *args; /* Args: file */ | |
| 913 { | |
|
1771
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
914 PyObject *file; |
| 1664 | 915 int id; |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
916 #if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
917 Tcl_File tfile; |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
918 #endif |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
919 |
|
1771
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
920 if (!PyArg_Parse (args, "O", &file)) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
921 return NULL; |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
922 id = GetFileNo (file); |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
923 if (id < 0) |
|
51c2e5a9f39c
* tkintermodule.c (*FileHandler): generalize to arbitrary file ids
Guido van Rossum <guido@python.org>
parents:
1756
diff
changeset
|
924 return NULL; |
| 1664 | 925 |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
926 #if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 |
| 3703 | 927 #ifdef NT |
| 928 /* We assume this is a socket... */ | |
| 929 tfile = Tcl_GetFile((ClientData)id, TCL_WIN_SOCKET); | |
| 930 #else | |
| 931 tfile = Tcl_GetFile((ClientData)id, TCL_UNIX_FD); | |
| 932 #endif | |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
933 /* Oughtta check for null Tcl_File object... */ |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
934 Tcl_DeleteFileHandler(tfile); |
|
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
935 #else |
| 3703 | 936 Tk_DeleteFileHandler (id); |
|
3554
24279bafa828
Patch from the net for 4.1 file handler changes.
Guido van Rossum <guido@python.org>
parents:
3553
diff
changeset
|
937 #endif |
| 1664 | 938 /* XXX fileHandlerDict */ |
| 939 Py_INCREF (Py_None); | |
| 940 return Py_None; | |
| 941 } | |
| 942 | |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
943 /**** Tktt Object (timer token) ****/ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
944 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
945 staticforward PyTypeObject Tktt_Type; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
946 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
947 typedef struct |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
948 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
949 PyObject_HEAD |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
950 Tk_TimerToken token; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
951 PyObject *func; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
952 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
953 TkttObject; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
954 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
955 static PyObject * |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
956 Tktt_DeleteTimerHandler (self, args) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
957 PyObject *self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
958 PyObject *args; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
959 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
960 TkttObject *v = (TkttObject *) self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
961 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
962 if (!PyArg_Parse (args, "")) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
963 return NULL; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
964 if (v->func != NULL) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
965 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
966 Tk_DeleteTimerHandler (v->token); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
967 PyMem_DEL (v->func); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
968 v->func = NULL; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
969 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
970 Py_INCREF (Py_None); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
971 return Py_None; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
972 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
973 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
974 static PyMethodDef Tktt_methods[] = |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
975 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
976 {"deletetimerhandler", Tktt_DeleteTimerHandler}, |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
977 {NULL, NULL} |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
978 }; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
979 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
980 static TkttObject * |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
981 Tktt_New (token, func) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
982 Tk_TimerToken token; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
983 PyObject *func; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
984 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
985 TkttObject *v; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
986 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
987 v = PyObject_NEW (TkttObject, &Tktt_Type); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
988 if (v == NULL) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
989 return NULL; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
990 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
991 v->token = token; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
992 v->func = func; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
993 Py_INCREF (v->func); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
994 return v; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
995 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
996 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
997 static void |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
998 Tktt_Dealloc (self) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
999 PyObject *self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1000 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1001 PyMem_DEL (self); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1002 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1003 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1004 static int |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1005 Tktt_Print (self, fp, flags) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1006 PyObject *self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1007 FILE *fp; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1008 int flags; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1009 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1010 TkttObject *v = (TkttObject *) self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1011 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1012 fprintf(fp, "<tktimertoken at 0x%x%s>", v, |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1013 v->func == NULL ? ", handler deleted" : ""); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1014 return 0; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1015 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1016 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1017 static PyObject * |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1018 Tktt_GetAttr (self, name) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1019 PyObject *self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1020 char *name; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1021 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1022 return Py_FindMethod (Tktt_methods, self, name); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1023 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1024 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1025 static PyTypeObject Tktt_Type = |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1026 { |
|
2123
fd5ab7e828fc
cosmetic changes so these modules will work with the strict new naming scheme
Guido van Rossum <guido@python.org>
parents:
2121
diff
changeset
|
1027 PyObject_HEAD_INIT (&PyType_Type) |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1028 0, /*ob_size */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1029 "tktimertoken", /*tp_name */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1030 sizeof (TkttObject), /*tp_basicsize */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1031 0, /*tp_itemsize */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1032 Tktt_Dealloc, /*tp_dealloc */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1033 Tktt_Print, /*tp_print */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1034 Tktt_GetAttr, /*tp_getattr */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1035 0, /*tp_setattr */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1036 0, /*tp_compare */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1037 0, /*tp_repr */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1038 0, /*tp_as_number */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1039 0, /*tp_as_sequence */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1040 0, /*tp_as_mapping */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1041 0, /*tp_hash */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1042 }; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1043 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1044 /** Timer Handler **/ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1045 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1046 static void |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1047 TimerHandler (clientData) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1048 ClientData clientData; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1049 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1050 PyObject *func = (PyObject *) clientData; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1051 PyObject *arg, *res; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1052 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1053 arg = PyTuple_New (0); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1054 res = PyEval_CallObject (func, arg); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1055 Py_DECREF (arg); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1056 if (res == NULL) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1057 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1058 errorInCmd = 1; |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1059 PyErr_Fetch (&excInCmd, &valInCmd, &trbInCmd); |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1060 } |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1061 else |
|
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1062 Py_DECREF (res); |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1063 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1064 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1065 static PyObject * |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1066 Tkapp_CreateTimerHandler (self, args) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1067 PyObject *self; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1068 PyObject *args; /* Is (milliseconds, func) */ |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1069 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1070 int milliseconds; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1071 PyObject *func; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1072 Tk_TimerToken token; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1073 |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1074 if (!PyArg_Parse (args, "(iO)", &milliseconds, &func)) |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1075 return NULL; |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1076 if (!PyCallable_Check(func)) |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1077 { |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1078 PyErr_SetString (PyExc_TypeError, "bad argument list"); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1079 return NULL; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1080 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1081 token = Tk_CreateTimerHandler(milliseconds, TimerHandler, (ClientData) func); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1082 return (PyObject *) Tktt_New (token, func); |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1083 } |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1084 |
| 1664 | 1085 /** Event Loop **/ |
| 1086 | |
| 1087 static PyObject * | |
| 1088 Tkapp_MainLoop (self, args) | |
| 1089 PyObject *self; | |
| 1090 PyObject *args; | |
| 1091 { | |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1092 int threshold = 0; |
|
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1093 |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1094 if (!PyArg_ParseTuple (args, "|i", &threshold)) |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1095 return NULL; |
| 1664 | 1096 |
| 1097 quitMainLoop = 0; | |
| 3120 | 1098 while (Tk_GetNumMainWindows() > threshold && !quitMainLoop && !errorInCmd) |
| 1664 | 1099 { |
| 1100 if (PyOS_InterruptOccurred ()) | |
| 1101 { | |
| 1102 PyErr_SetNone (PyExc_KeyboardInterrupt); | |
| 1103 return NULL; | |
| 1104 } | |
| 1105 Tk_DoOneEvent (0); | |
| 1106 } | |
|
3134
2677fbb117d6
clear quitMainLoop when we fall through the main loop
Guido van Rossum <guido@python.org>
parents:
3120
diff
changeset
|
1107 quitMainLoop = 0; |
| 1664 | 1108 |
| 1109 if (errorInCmd) | |
| 1110 { | |
| 1111 errorInCmd = 0; | |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1112 PyErr_Restore (excInCmd, valInCmd, trbInCmd); |
|
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1113 excInCmd = valInCmd = trbInCmd = NULL; |
| 1664 | 1114 return NULL; |
| 1115 } | |
| 1116 Py_INCREF (Py_None); | |
| 1117 return Py_None; | |
| 1118 } | |
| 1119 | |
| 1120 static PyObject * | |
|
2121
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1121 Tkapp_DoOneEvent (self, args) |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1122 PyObject *self; |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1123 PyObject *args; |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1124 { |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1125 int flags = TK_ALL_EVENTS; |
|
2121
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1126 int rv; |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1127 |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1128 if (!PyArg_ParseTuple (args, "|i", &flags)) |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1129 return NULL; |
|
2121
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1130 rv = Tk_DoOneEvent(flags); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1131 return Py_BuildValue ("i", rv); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1132 } |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1133 |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1134 static PyObject * |
| 1664 | 1135 Tkapp_Quit (self, args) |
| 1136 PyObject *self; | |
| 1137 PyObject *args; | |
| 1138 { | |
| 1139 | |
| 1140 if (!PyArg_Parse (args, "")) | |
| 1141 return NULL; | |
| 1142 quitMainLoop = 1; | |
| 1143 Py_INCREF (Py_None); | |
| 1144 return Py_None; | |
| 1145 } | |
| 1146 | |
| 1147 /**** Tkapp Method List ****/ | |
| 1148 | |
| 1149 static PyMethodDef Tkapp_methods[] = | |
| 1150 { | |
| 1151 {"call", Tkapp_Call}, | |
| 1152 {"globalcall", Tkapp_GlobalCall}, | |
| 1153 {"eval", Tkapp_Eval}, | |
| 1154 {"globaleval", Tkapp_GlobalEval}, | |
| 1155 {"evalfile", Tkapp_EvalFile}, | |
| 1156 {"record", Tkapp_Record}, | |
| 1157 {"adderrorinfo", Tkapp_AddErrorInfo}, | |
| 1158 {"setvar", Tkapp_SetVar}, | |
| 1159 {"globalsetvar", Tkapp_GlobalSetVar}, | |
| 1160 {"getvar", Tkapp_GetVar}, | |
| 1161 {"globalgetvar", Tkapp_GlobalGetVar}, | |
| 1162 {"unsetvar", Tkapp_UnsetVar}, | |
| 1163 {"globalunsetvar", Tkapp_GlobalUnsetVar}, | |
| 1164 {"getint", Tkapp_GetInt}, | |
| 1165 {"getdouble", Tkapp_GetDouble}, | |
| 1166 {"getboolean", Tkapp_GetBoolean}, | |
| 1167 {"exprstring", Tkapp_ExprString}, | |
| 1168 {"exprlong", Tkapp_ExprLong}, | |
| 1169 {"exprdouble", Tkapp_ExprDouble}, | |
| 1170 {"exprboolean", Tkapp_ExprBoolean}, | |
| 1171 {"splitlist", Tkapp_SplitList}, | |
| 1172 {"split", Tkapp_Split}, | |
| 1173 {"merge", Tkapp_Merge}, | |
| 1174 {"createcommand", Tkapp_CreateCommand}, | |
| 1175 {"deletecommand", Tkapp_DeleteCommand}, | |
| 1176 {"createfilehandler", Tkapp_CreateFileHandler}, | |
| 1177 {"deletefilehandler", Tkapp_DeleteFileHandler}, | |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1178 {"createtimerhandler", Tkapp_CreateTimerHandler}, |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1179 {"mainloop", Tkapp_MainLoop, 1}, |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1180 {"dooneevent", Tkapp_DoOneEvent, 1}, |
| 1664 | 1181 {"quit", Tkapp_Quit}, |
| 1182 {NULL, NULL} | |
| 1183 }; | |
| 1184 | |
| 1185 /**** Tkapp Type Methods ****/ | |
| 1186 | |
| 1187 static void | |
| 1188 Tkapp_Dealloc (self) | |
| 1189 PyObject *self; | |
| 1190 { | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1191 #ifdef NEED_TKCREATEMAINWINDOW |
| 1664 | 1192 Tk_DestroyWindow (Tkapp_Tkwin (self)); |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1193 #endif |
| 1664 | 1194 Tcl_DeleteInterp (Tkapp_Interp (self)); |
| 1195 PyMem_DEL (self); | |
| 1196 } | |
| 1197 | |
| 1198 static PyObject * | |
| 1199 Tkapp_GetAttr (self, name) | |
| 1200 PyObject *self; | |
| 1201 char *name; | |
| 1202 { | |
| 1203 return Py_FindMethod (Tkapp_methods, self, name); | |
| 1204 } | |
| 1205 | |
| 1206 static PyTypeObject Tkapp_Type = | |
| 1207 { | |
|
2123
fd5ab7e828fc
cosmetic changes so these modules will work with the strict new naming scheme
Guido van Rossum <guido@python.org>
parents:
2121
diff
changeset
|
1208 PyObject_HEAD_INIT (&PyType_Type) |
| 1664 | 1209 0, /*ob_size */ |
| 1210 "tkapp", /*tp_name */ | |
| 1211 sizeof (TkappObject), /*tp_basicsize */ | |
| 1212 0, /*tp_itemsize */ | |
| 1213 Tkapp_Dealloc, /*tp_dealloc */ | |
| 1214 0, /*tp_print */ | |
| 1215 Tkapp_GetAttr, /*tp_getattr */ | |
| 1216 0, /*tp_setattr */ | |
| 1217 0, /*tp_compare */ | |
| 1218 0, /*tp_repr */ | |
| 1219 0, /*tp_as_number */ | |
| 1220 0, /*tp_as_sequence */ | |
| 1221 0, /*tp_as_mapping */ | |
| 1222 0, /*tp_hash */ | |
| 1223 }; | |
| 1224 | |
| 1225 /**** Tkinter Module ****/ | |
| 1226 | |
| 1227 static PyObject * | |
| 1228 Tkinter_Create (self, args) | |
| 1229 PyObject *self; | |
| 1230 PyObject *args; | |
| 1231 { | |
| 1232 char *screenName = NULL; | |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1233 char *baseName = NULL; |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1234 char *className = NULL; |
| 1664 | 1235 int interactive = 0; |
| 1236 | |
|
3899
584936890f86
getprogramname --> Py_GetProgramName
Guido van Rossum <guido@python.org>
parents:
3703
diff
changeset
|
1237 baseName = strrchr (Py_GetProgramName (), '/'); |
| 1664 | 1238 if (baseName != NULL) |
| 1239 baseName++; | |
| 1240 else | |
|
3899
584936890f86
getprogramname --> Py_GetProgramName
Guido van Rossum <guido@python.org>
parents:
3703
diff
changeset
|
1241 baseName = Py_GetProgramName (); |
| 1664 | 1242 className = "Tk"; |
| 1243 | |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1244 if (!PyArg_ParseTuple (args, "|zssi", |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1245 &screenName, &baseName, &className, &interactive)) |
| 1664 | 1246 return NULL; |
| 1247 | |
| 1248 return (PyObject *) Tkapp_New (screenName, baseName, className, | |
| 1249 interactive); | |
| 1250 } | |
| 1251 | |
| 1252 static PyMethodDef moduleMethods[] = | |
| 1253 { | |
|
2858
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1254 {"create", Tkinter_Create, 1}, |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1255 {"createfilehandler", Tkapp_CreateFileHandler, 0}, |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1256 {"deletefilehandler", Tkapp_DeleteFileHandler, 0}, |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1257 {"createtimerhandler", Tkapp_CreateTimerHandler, 0}, |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1258 {"mainloop", Tkapp_MainLoop, 1}, |
|
eb1ed4d84629
use getnewargs where it makes sense
Guido van Rossum <guido@python.org>
parents:
2505
diff
changeset
|
1259 {"dooneevent", Tkapp_DoOneEvent, 1}, |
|
2009
392db1881190
added timer and file callbacks and global mainloop and quit fns
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1260 {"quit", Tkapp_Quit}, |
| 1664 | 1261 {NULL, NULL} |
| 1262 }; | |
| 1263 | |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1264 #undef WITH_READLINE /* XXX */ |
| 1664 | 1265 #ifdef WITH_READLINE |
| 1266 static int | |
| 1267 EventHook () | |
| 1268 { | |
| 1269 if (errorInCmd) /* XXX Reset tty */ | |
| 1270 { | |
| 1271 errorInCmd = 0; | |
|
2055
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1272 PyErr_Restore (excInCmd, valInCmd, trbInCmd); |
|
cf31eab6ab5a
Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents:
2009
diff
changeset
|
1273 excInCmd = valInCmd = trbInCmd = NULL; |
| 1664 | 1274 PyErr_Print (); |
| 1275 } | |
| 3120 | 1276 if (Tk_GetNumMainWindows() > 0) |
|
1756
f533791acc77
* tkintermodule.c: OK, I've fixed the "tty" problem. You're right
Guido van Rossum <guido@python.org>
parents:
1713
diff
changeset
|
1277 Tk_DoOneEvent (TK_DONT_WAIT); |
| 1664 | 1278 return 0; |
| 1279 } | |
| 1280 #endif /* WITH_READLINE */ | |
| 1281 | |
| 1282 static void | |
| 1713 | 1283 Tkinter_Cleanup () |
| 1284 { | |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1285 /* This segfault with Tk 4.0 beta and seems unnecessary there as well */ |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1286 #if TK_MAJOR_VERSION < 4 |
| 1713 | 1287 /* XXX rl_deprep_terminal is static, damned! */ |
| 1288 while (tkMainWindowList != 0) | |
| 1289 Tk_DestroyWindow (tkMainWindowList->win); | |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1290 #endif |
| 1713 | 1291 } |
| 1292 | |
| 1664 | 1293 void |
|
3386
6f5feb3b4829
get rid of bogus name for init_tkinter()
Guido van Rossum <guido@python.org>
parents:
3262
diff
changeset
|
1294 init_tkinter () |
| 1664 | 1295 { |
| 1713 | 1296 static inited = 0; |
| 1297 | |
| 1664 | 1298 #ifdef WITH_READLINE |
| 1299 extern int (*rl_event_hook) (); | |
| 1300 #endif /* WITH_READLINE */ | |
| 1301 PyObject *m, *d, *v; | |
| 1302 | |
|
3231
1acc04478dc3
Renamed module tkinter to _tkinter, moved source to _tkinter.c
Jack Jansen <jack.jansen@cwi.nl>
parents:
3134
diff
changeset
|
1303 m = Py_InitModule ("_tkinter", moduleMethods); |
| 1664 | 1304 |
| 1305 d = PyModule_GetDict (m); | |
| 1306 Tkinter_TclError = Py_BuildValue ("s", "TclError"); | |
| 1307 PyDict_SetItemString (d, "TclError", Tkinter_TclError); | |
| 1308 | |
| 1309 v = Py_BuildValue ("i", TK_READABLE); | |
| 1310 PyDict_SetItemString (d, "READABLE", v); | |
| 1311 v = Py_BuildValue ("i", TK_WRITABLE); | |
| 1312 PyDict_SetItemString (d, "WRITABLE", v); | |
| 1313 v = Py_BuildValue ("i", TK_EXCEPTION); | |
| 1314 PyDict_SetItemString (d, "EXCEPTION", v); | |
|
2121
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1315 v = Py_BuildValue ("i", TK_X_EVENTS); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1316 PyDict_SetItemString (d, "X_EVENTS", v); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1317 v = Py_BuildValue ("i", TK_FILE_EVENTS); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1318 PyDict_SetItemString (d, "FILE_EVENTS", v); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1319 v = Py_BuildValue ("i", TK_TIMER_EVENTS); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1320 PyDict_SetItemString (d, "TIMER_EVENTS", v); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1321 v = Py_BuildValue ("i", TK_IDLE_EVENTS); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1322 PyDict_SetItemString (d, "IDLE_EVENTS", v); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1323 v = Py_BuildValue ("i", TK_ALL_EVENTS); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1324 PyDict_SetItemString (d, "ALL_EVENTS", v); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1325 v = Py_BuildValue ("i", TK_DONT_WAIT); |
|
86d9e91405c8
added interface to Tk_DoOneEvent (R Lindsay Todd)
Guido van Rossum <guido@python.org>
parents:
2055
diff
changeset
|
1326 PyDict_SetItemString (d, "DONT_WAIT", v); |
|
2300
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1327 v = Py_BuildValue ("s", TK_VERSION); |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1328 PyDict_SetItemString (d, "TK_VERSION", v); |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1329 v = Py_BuildValue ("s", TCL_VERSION); |
|
d2049a1d3cc5
use PyCallable_Check; export TK_VERSION and TCL_VERSION strings;
Guido van Rossum <guido@python.org>
parents:
2150
diff
changeset
|
1330 PyDict_SetItemString (d, "TCL_VERSION", v); |
| 1664 | 1331 |
| 1332 #ifdef WITH_READLINE | |
| 1333 rl_event_hook = EventHook; | |
| 1334 #endif /* WITH_READLINE */ | |
| 1335 | |
| 1713 | 1336 if (!inited) |
| 1337 { | |
| 1338 inited = 1; | |
|
1867
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1771
diff
changeset
|
1339 if (Py_AtExit (Tkinter_Cleanup) != 0) |
|
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1771
diff
changeset
|
1340 fprintf(stderr, |
|
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1771
diff
changeset
|
1341 "Tkinter: warning: cleanup procedure not registered\n"); |
| 1713 | 1342 } |
| 1343 | |
| 1664 | 1344 if (PyErr_Occurred ()) |
|
3231
1acc04478dc3
Renamed module tkinter to _tkinter, moved source to _tkinter.c
Jack Jansen <jack.jansen@cwi.nl>
parents:
3134
diff
changeset
|
1345 Py_FatalError ("can't initialize module _tkinter"); |
|
3240
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1346 #ifdef macintosh |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1347 TclMacSetEventProc(PyMacConvertEvent); |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1348 #if GENERATINGCFM |
|
3240
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1349 mac_addlibresources(); |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1350 #endif /* GENERATINGCFM */ |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1351 #endif /* macintosh */ |
| 1664 | 1352 } |
| 3120 | 1353 |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1354 |
| 3120 | 1355 #ifdef macintosh |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1356 |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1357 /* |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1358 ** Anyone who embeds Tcl/Tk on the Mac must define panic(). |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1359 */ |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1360 |
| 3120 | 1361 void |
| 1362 panic(char * format, ...) | |
| 1363 { | |
| 1364 va_list varg; | |
| 1365 | |
| 1366 va_start(varg, format); | |
| 1367 | |
| 1368 vfprintf(stderr, format, varg); | |
| 1369 (void) fflush(stderr); | |
| 1370 | |
| 1371 va_end(varg); | |
| 1372 | |
| 1373 Py_FatalError("Tcl/Tk panic"); | |
| 1374 } | |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1375 |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1376 /* |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1377 ** Pass events to SIOUX before passing them to Tk. |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1378 */ |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1379 |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1380 static int |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1381 PyMacConvertEvent(eventPtr) |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1382 EventRecord *eventPtr; |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1383 { |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1384 if (SIOUXHandleOneEvent(eventPtr)) |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1385 return 0; /* Nothing happened to the Tcl event queue */ |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1386 return TkMacConvertEvent(eventPtr); |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1387 } |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1388 |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1389 #if GENERATINGCFM |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1390 |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1391 /* |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1392 ** Additional Mac specific code for dealing with shared libraries. |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1393 */ |
|
3262
bfb63b45ff0f
Initialize GUSI on the mac.
Jack Jansen <jack.jansen@cwi.nl>
parents:
3240
diff
changeset
|
1394 |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1395 #include <Resources.h> |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1396 #include <CodeFragments.h> |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1397 |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1398 static int loaded_from_shlib = 0; |
|
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1399 static FSSpec library_fss; |
| 3120 | 1400 |
|
3240
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1401 /* |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1402 ** If this module is dynamically loaded the following routine should |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1403 ** be the init routine. It takes care of adding the shared library to |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1404 ** the resource-file chain, so that the tk routines can find their |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1405 ** resources. |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1406 */ |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1407 OSErr pascal |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1408 init_tkinter_shlib(InitBlockPtr data) |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1409 { |
|
3553
1d035e211209
Add __sinit() call according to Jack.
Guido van Rossum <guido@python.org>
parents:
3414
diff
changeset
|
1410 __sinit(); /* Sez Jack */ |
|
3240
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1411 if ( data == nil ) return noErr; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1412 if ( data->fragLocator.where == kOnDiskFlat ) { |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1413 library_fss = *data->fragLocator.u.onDisk.fileSpec; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1414 loaded_from_shlib = 1; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1415 } else if ( data->fragLocator.where == kOnDiskSegmented ) { |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1416 library_fss = *data->fragLocator.u.inSegs.fileSpec; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1417 loaded_from_shlib = 1; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1418 } |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1419 return noErr; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1420 } |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1421 |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1422 /* |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1423 ** Insert the library resources into the search path. Put them after |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1424 ** the resources from the application. Again, we ignore errors. |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1425 */ |
|
3413
2fe7d489654e
Changes to make it work with Tcl/Tk beta 1.
Guido van Rossum <guido@python.org>
parents:
3386
diff
changeset
|
1426 static |
|
3240
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1427 mac_addlibresources() |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1428 { |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1429 if ( !loaded_from_shlib ) |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1430 return; |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1431 (void)FSpOpenResFile(&library_fss, fsRdPerm); |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1432 } |
|
f7fd85b32a7d
Fix to load needed resources on a mac
Jack Jansen <jack.jansen@cwi.nl>
parents:
3231
diff
changeset
|
1433 |
|
3414
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1434 #endif /* GENERATINGCFM */ |
|
098cbd6d196e
Changes needed to build with Tcl/Tk beta 2!
Guido van Rossum <guido@python.org>
parents:
3413
diff
changeset
|
1435 #endif /* macintosh */ |
