diff -r da8e8e28a616 Modules/_tkinter.c --- a/Modules/_tkinter.c Sat Jan 18 00:49:30 2014 -0500 +++ b/Modules/_tkinter.c Sat Jan 18 13:30:48 2014 +0200 @@ -460,6 +460,16 @@ } +/*[clinic input] +output preset file +module _tkinter +class _tkinter.tkapp +class _tkinter.TkttType +class _tkinter.Tcl_Obj +class _tkinter.tktimertoken +[clinic start generated code]*/ +/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ + /**** Tkapp Object ****/ #ifndef WITH_APPINIT @@ -510,8 +520,8 @@ static void DisableEventHook(void); /* Forward */ static TkappObject * -Tkapp_New(char *screenName, char *className, - int interactive, int wantobjects, int wantTk, int sync, char *use) +Tkapp_New(const char *screenName, const char *className, + int interactive, int wantobjects, int wantTk, int sync, const char *use) { TkappObject *v; char *argv0; @@ -1249,16 +1259,21 @@ } +/*[clinic input] +_tkinter.tkapp.eval + + script: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_Eval(PyObject *self, PyObject *args) +_tkinter_tkapp_eval_impl(PyObject *self, const char *script) +/*[clinic end generated code: checksum=7ccf3b9f247ce369a5b73e72e7fe2b463205bc3b]*/ { - char *script; PyObject *res = NULL; int err; - if (!PyArg_ParseTuple(args, "s:eval", &script)) - return NULL; - CHECK_TCL_APPARTMENT; ENTER_TCL @@ -1272,16 +1287,21 @@ return res; } +/*[clinic input] +_tkinter.tkapp.evalfile + + fileName: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_EvalFile(PyObject *self, PyObject *args) +_tkinter_tkapp_evalfile_impl(PyObject *self, const char *fileName) +/*[clinic end generated code: checksum=da0ffab60bc6dc2078c80cef0953186c334eb156]*/ { - char *fileName; PyObject *res = NULL; int err; - if (!PyArg_ParseTuple(args, "s:evalfile", &fileName)) - return NULL; - CHECK_TCL_APPARTMENT; ENTER_TCL @@ -1296,16 +1316,21 @@ return res; } +/*[clinic input] +_tkinter.tkapp.record + + script: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_Record(PyObject *self, PyObject *args) +_tkinter_tkapp_record_impl(PyObject *self, const char *script) +/*[clinic end generated code: checksum=7de77b9feaf1e5af0040af41f75207629923accb]*/ { - char *script; PyObject *res = NULL; int err; - if (!PyArg_ParseTuple(args, "s", &script)) - return NULL; - CHECK_TCL_APPARTMENT; ENTER_TCL @@ -1319,13 +1344,18 @@ return res; } +/*[clinic input] +_tkinter.tkapp.adderrinfo + + msg: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_AddErrorInfo(PyObject *self, PyObject *args) +_tkinter_tkapp_adderrinfo_impl(PyObject *self, const char *msg) +/*[clinic end generated code: checksum=f2cec9946bf8278ff638d0146b13e66e284b23f3]*/ { - char *msg; - - if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg)) - return NULL; CHECK_TCL_APPARTMENT; ENTER_TCL @@ -1357,6 +1387,15 @@ } VarEvent; #endif +/*[python] + +class varname_converter(CConverter): + type = 'const char *' + converter = 'varname_converter' + +[python]*/ +/*[python checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ + static int varname_converter(PyObject *in, void *_out) { @@ -1658,16 +1697,21 @@ return PyBool_FromLong(v); } +/*[clinic input] +_tkinter.tkapp.exprstring + + s: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_ExprString(PyObject *self, PyObject *args) +_tkinter_tkapp_exprstring_impl(PyObject *self, const char *s) +/*[clinic end generated code: checksum=80f8beb6451a990f4881a66af2d5882e794fdbcc]*/ { - char *s; PyObject *res = NULL; int retval; - if (!PyArg_ParseTuple(args, "s:exprstring", &s)) - return NULL; - CHECK_TCL_APPARTMENT; ENTER_TCL @@ -1681,17 +1725,22 @@ return res; } +/*[clinic input] +_tkinter.tkapp.exprlong + + s: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_ExprLong(PyObject *self, PyObject *args) +_tkinter_tkapp_exprlong_impl(PyObject *self, const char *s) +/*[clinic end generated code: checksum=2a505a3937196600905deb4e7995e1d1b55be6bc]*/ { - char *s; PyObject *res = NULL; int retval; long v; - if (!PyArg_ParseTuple(args, "s:exprlong", &s)) - return NULL; - CHECK_TCL_APPARTMENT; ENTER_TCL @@ -1705,16 +1754,22 @@ return res; } +/*[clinic input] +_tkinter.tkapp.exprdouble + + s: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_ExprDouble(PyObject *self, PyObject *args) +_tkinter_tkapp_exprdouble_impl(PyObject *self, const char *s) +/*[clinic end generated code: checksum=050c2390c9658998798cbf2d5599f22a9c8c7dc0]*/ { - char *s; PyObject *res = NULL; double v; int retval; - if (!PyArg_ParseTuple(args, "s:exprdouble", &s)) - return NULL; CHECK_TCL_APPARTMENT; PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0) ENTER_TCL @@ -1729,16 +1784,22 @@ return res; } +/*[clinic input] +_tkinter.tkapp.exprboolean + + s: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_ExprBoolean(PyObject *self, PyObject *args) +_tkinter_tkapp_exprboolean_impl(PyObject *self, const char *s) +/*[clinic end generated code: checksum=5f004bbd693f91b579a730a59654f43369006638]*/ { - char *s; PyObject *res = NULL; int retval; int v; - if (!PyArg_ParseTuple(args, "s:exprboolean", &s)) - return NULL; CHECK_TCL_APPARTMENT; ENTER_TCL retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v); @@ -1961,7 +2022,7 @@ typedef struct CommandEvent{ Tcl_Event ev; Tcl_Interp* interp; - char *name; + const char *name; int create; int *status; ClientData *data; @@ -1984,17 +2045,23 @@ } #endif +/*[clinic input] +_tkinter.tkapp.createcommand + + self: self(type="TkappObject *") + name: str + func: object + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_CreateCommand(PyObject *selfptr, PyObject *args) +_tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, PyObject *func) +/*[clinic end generated code: checksum=1af5a6afcfe428f92268d6e37913771116469004]*/ { - TkappObject *self = (TkappObject*)selfptr; PythonCmd_ClientData *data; - char *cmdName; - PyObject *func; int err; - if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func)) - return NULL; if (!PyCallable_Check(func)) { PyErr_SetString(PyExc_TypeError, "command not callable"); return NULL; @@ -2011,7 +2078,7 @@ return PyErr_NoMemory(); Py_INCREF(self); Py_INCREF(func); - data->self = selfptr; + data->self = (PyObject *) self; data->func = func; #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { @@ -2020,7 +2087,7 @@ ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc; ev->interp = self->interp; ev->create = 1; - ev->name = cmdName; + ev->name = name; ev->data = (ClientData)data; ev->status = &err; ev->done = &cond; @@ -2032,7 +2099,7 @@ { ENTER_TCL err = Tcl_CreateCommand( - Tkapp_Interp(self), cmdName, PythonCmd, + Tkapp_Interp(self), name, PythonCmd, (ClientData)data, PythonCmdDelete) == NULL; LEAVE_TCL } @@ -2047,16 +2114,21 @@ +/*[clinic input] +_tkinter.tkapp.deletecommand + + self: self(type="TkappObject *") + name: str + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args) +_tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name) +/*[clinic end generated code: checksum=a67e8cb5845e0d2d201d5b27b3f3688f5acc0ccd]*/ { - TkappObject *self = (TkappObject*)selfptr; - char *cmdName; int err; - if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName)) - return NULL; - #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { Tcl_Condition cond = NULL; @@ -2065,7 +2137,7 @@ ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc; ev->interp = self->interp; ev->create = 0; - ev->name = cmdName; + ev->name = name; ev->status = &err; ev->done = &cond; Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, @@ -2076,7 +2148,7 @@ #endif { ENTER_TCL - err = Tcl_DeleteCommand(self->interp, cmdName); + err = Tcl_DeleteCommand(self->interp, name); LEAVE_TCL } if (err == -1) { @@ -2157,17 +2229,22 @@ LEAVE_PYTHON } +/*[clinic input] +_tkinter.tkapp.createfilehandler + + file: object + mask: int + func: object + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_CreateFileHandler(PyObject *self, PyObject *args) - /* args is (file, mask, func) */ +_tkinter_tkapp_createfilehandler_impl(PyObject *self, PyObject *file, int mask, PyObject *func) +/*[clinic end generated code: checksum=c2408dac1098c256462baf1d95366d84da355f94]*/ { FileHandler_ClientData *data; - PyObject *file, *func; - int mask, tfile; - - if (!PyArg_ParseTuple(args, "OiO:createfilehandler", - &file, &mask, &func)) - return NULL; + int tfile; CHECK_TCL_APPARTMENT; @@ -2190,15 +2267,20 @@ Py_RETURN_NONE; } +/*[clinic input] +_tkinter.tkapp.deletefilehandler + + file: object + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_DeleteFileHandler(PyObject *self, PyObject *args) +_tkinter_tkapp_deletefilehandler(PyObject *self, PyObject *file) +/*[clinic end generated code: checksum=550b8e721bbc30de74e38c399e4274f59e96c666]*/ { - PyObject *file; int tfile; - if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file)) - return NULL; - CHECK_TCL_APPARTMENT; tfile = PyObject_AsFileDescriptor(file); @@ -2226,14 +2308,20 @@ PyObject *func; } TkttObject; +/*[clinic input] +_tkinter.tktimertoken.deletetimerhandler + + self: self(type="TkttObject *") + +[clinic start generated code]*/ + static PyObject * -Tktt_DeleteTimerHandler(PyObject *self, PyObject *args) +_tkinter_tktimertoken_deletetimerhandler_impl(TkttObject *self) +/*[clinic end generated code: checksum=bd7fe17f328cfa55cf40a6ccfa480d876a14522d]*/ { - TkttObject *v = (TkttObject *)self; + TkttObject *v = self; PyObject *func = v->func; - if (!PyArg_ParseTuple(args, ":deletetimerhandler")) - return NULL; if (v->token != NULL) { Tcl_DeleteTimerHandler(v->token); v->token = NULL; @@ -2246,11 +2334,7 @@ Py_RETURN_NONE; } -static PyMethodDef Tktt_methods[] = -{ - {"deletetimerhandler", Tktt_DeleteTimerHandler, METH_VARARGS}, - {NULL, NULL} -}; +static PyMethodDef Tktt_methods[]; static TkttObject * Tktt_New(PyObject *func) @@ -2301,7 +2385,7 @@ }; static PyType_Spec Tktt_Type_spec = { - "tktimertoken", + "_tkinter.tktimertoken", sizeof(TkttObject), 0, Py_TPFLAGS_DEFAULT, @@ -2339,16 +2423,21 @@ LEAVE_PYTHON } +/*[clinic input] +_tkinter.tkapp.createtimerhandler + + milliseconds: int + func: object + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_CreateTimerHandler(PyObject *self, PyObject *args) +_tkinter_tkapp_createtimerhandler_impl(PyObject *self, int milliseconds, PyObject *func) +/*[clinic end generated code: checksum=3612d4d6266d414a1f3d6555c7f2e8a0d6d2f2f8]*/ { - int milliseconds; - PyObject *func; TkttObject *v; - if (!PyArg_ParseTuple(args, "iO:createtimerhandler", - &milliseconds, &func)) - return NULL; if (!PyCallable_Check(func)) { PyErr_SetString(PyExc_TypeError, "bad argument list"); return NULL; @@ -2368,18 +2457,23 @@ /** Event Loop **/ +/*[clinic input] +_tkinter.tkapp.mainloop + + self: self(type="TkappObject *") + threshold: int = 0 + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_MainLoop(PyObject *selfptr, PyObject *args) +_tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold) +/*[clinic end generated code: checksum=0ba8eabbe57841b091e4c96ab8d3c6bc327a368f]*/ { - int threshold = 0; - TkappObject *self = (TkappObject*)selfptr; #ifdef WITH_THREAD PyThreadState *tstate = PyThreadState_Get(); #endif - if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold)) - return NULL; - CHECK_TCL_APPARTMENT; self->dispatching = 1; @@ -2431,44 +2525,56 @@ Py_RETURN_NONE; } +/*[clinic input] +_tkinter.tkapp.dooneevent + + flags: int = 0 + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_DoOneEvent(PyObject *self, PyObject *args) +_tkinter_tkapp_dooneevent_impl(PyObject *self, int flags) +/*[clinic end generated code: checksum=8756cf9c37f900b02d7e81d314b26b394e511f36]*/ { - int flags = 0; int rv; - if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags)) - return NULL; - ENTER_TCL rv = Tcl_DoOneEvent(flags); LEAVE_TCL return Py_BuildValue("i", rv); } +/*[clinic input] +_tkinter.tkapp.quit +[clinic start generated code]*/ + static PyObject * -Tkapp_Quit(PyObject *self, PyObject *args) +_tkinter_tkapp_quit_impl(PyObject *self) +/*[clinic end generated code: checksum=60be1cc9498cbc586d8a61c1f641b908dd3a7075]*/ { - - if (!PyArg_ParseTuple(args, ":quit")) - return NULL; - quitMainLoop = 1; Py_RETURN_NONE; } +/*[clinic input] +_tkinter.tkapp.interpaddr +[clinic start generated code]*/ + static PyObject * -Tkapp_InterpAddr(PyObject *self, PyObject *args) +_tkinter_tkapp_interpaddr_impl(PyObject *self) +/*[clinic end generated code: checksum=79fe1e4f011d5ecb066048209ab758bfd91bd45a]*/ { - - if (!PyArg_ParseTuple(args, ":interpaddr")) - return NULL; - return PyLong_FromVoidPtr(Tkapp_Interp(self)); } +/*[clinic input] +_tkinter.tkapp.loadtk +[clinic start generated code]*/ + static PyObject * -Tkapp_TkInit(PyObject *self, PyObject *args) +_tkinter_tkapp_loadtk_impl(PyObject *self) +/*[clinic end generated code: checksum=9fed9a6dded64d8156c324b403fa6ccd6b0d594b]*/ { Tcl_Interp *interp = Tkapp_Interp(self); const char * _tk_exists = NULL; @@ -2515,25 +2621,41 @@ Py_RETURN_NONE; } +/*[clinic input] +_tkinter.tkapp.wantobjects + + self: self(type="TkappObject *") + [ + value: int + ] + / + +[clinic start generated code]*/ + static PyObject * -Tkapp_WantObjects(PyObject *self, PyObject *args) +_tkinter_tkapp_wantobjects_impl(TkappObject *self, int group_right_1, int value) +/*[clinic end generated code: checksum=5688ef1f675b716ee917e440351133a5a742a87c]*/ { - - int wantobjects = -1; - if (!PyArg_ParseTuple(args, "|i:wantobjects", &wantobjects)) - return NULL; - if (wantobjects == -1) - return PyBool_FromLong(((TkappObject*)self)->wantobjects); - ((TkappObject*)self)->wantobjects = wantobjects; + if (!group_right_1) + return PyBool_FromLong(self->wantobjects); + + self->wantobjects = value; Py_RETURN_NONE; } +/*[clinic input] +_tkinter.tkapp.willdispatch + + self: self(type="TkappObject *") + +[clinic start generated code]*/ + static PyObject * -Tkapp_WillDispatch(PyObject *self, PyObject *args) +_tkinter_tkapp_willdispatch_impl(TkappObject *self) +/*[clinic end generated code: checksum=0e3f46d2446421557ec1f891c2ea302f01822c19]*/ { - - ((TkappObject*)self)->dispatching = 1; + self->dispatching = 1; Py_RETURN_NONE; } @@ -2541,45 +2663,7 @@ /**** Tkapp Method List ****/ -static PyMethodDef Tkapp_methods[] = -{ - {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, - {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, - {"call", Tkapp_Call, METH_VARARGS}, - {"eval", Tkapp_Eval, METH_VARARGS}, - {"evalfile", Tkapp_EvalFile, METH_VARARGS}, - {"record", Tkapp_Record, METH_VARARGS}, - {"adderrorinfo", Tkapp_AddErrorInfo, METH_VARARGS}, - {"setvar", Tkapp_SetVar, METH_VARARGS}, - {"globalsetvar", Tkapp_GlobalSetVar, METH_VARARGS}, - {"getvar", Tkapp_GetVar, METH_VARARGS}, - {"globalgetvar", Tkapp_GlobalGetVar, METH_VARARGS}, - {"unsetvar", Tkapp_UnsetVar, METH_VARARGS}, - {"globalunsetvar", Tkapp_GlobalUnsetVar, METH_VARARGS}, - {"getint", Tkapp_GetInt, METH_VARARGS}, - {"getdouble", Tkapp_GetDouble, METH_VARARGS}, - {"getboolean", Tkapp_GetBoolean, METH_VARARGS}, - {"exprstring", Tkapp_ExprString, METH_VARARGS}, - {"exprlong", Tkapp_ExprLong, METH_VARARGS}, - {"exprdouble", Tkapp_ExprDouble, METH_VARARGS}, - {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS}, - {"splitlist", Tkapp_SplitList, METH_VARARGS}, - {"split", Tkapp_Split, METH_VARARGS}, - {"createcommand", Tkapp_CreateCommand, METH_VARARGS}, - {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS}, -#ifdef HAVE_CREATEFILEHANDLER - {"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS}, - {"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS}, -#endif - {"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS}, - {"mainloop", Tkapp_MainLoop, METH_VARARGS}, - {"dooneevent", Tkapp_DoOneEvent, METH_VARARGS}, - {"quit", Tkapp_Quit, METH_VARARGS}, - {"interpaddr", Tkapp_InterpAddr, METH_VARARGS}, - {"loadtk", Tkapp_TkInit, METH_NOARGS}, - {NULL, NULL} -}; - +static PyMethodDef Tkapp_methods[]; /**** Tkapp Type Methods ****/ @@ -2605,7 +2689,7 @@ static PyType_Spec Tkapp_Type_spec = { - "tkapp", + "_tkinter.tkapp", sizeof(TkappObject), 0, Py_TPFLAGS_DEFAULT, @@ -2697,14 +2781,19 @@ return 1; } +/*[clinic input] +_tkinter._flatten + + item: object + / + +[clinic start generated code]*/ + static PyObject * -Tkinter_Flatten(PyObject* self, PyObject* args) +_tkinter__flatten(PyModuleDef *module, PyObject *item) +/*[clinic end generated code: checksum=9505049ec74c3480f41333a38e06d71276d62414]*/ { FlattenContext context; - PyObject* item; - - if (!PyArg_ParseTuple(args, "O:_flatten", &item)) - return NULL; context.maxsize = PySequence_Size(item); if (context.maxsize < 0) @@ -2727,38 +2816,51 @@ return context.tuple; } +/*[clinic input] +_tkinter.create + + screenName: str(nullable=True) = NULL + baseName: str = NULL + className: str = "Tk" + interactive: int(c_default="0") = False + wantobjects: int(c_default="0") = False + wantTk: int(c_default="1") = True + if false, then Tk_Init() doesn't get called + sync: int(c_default="0") = False + if true, then pass -sync to wish + use: str(nullable=True) = NULL + if not None, then pass -use to wish + / + +[clinic start generated code]*/ + static PyObject * -Tkinter_Create(PyObject *self, PyObject *args) +_tkinter_create_impl(PyModuleDef *module, const char *screenName, const char *baseName, const char *className, int interactive, int wantobjects, int wantTk, int sync, const char *use) +/*[clinic end generated code: checksum=1c7f02cd80bff35281064fe54c17157886deabcf]*/ { - char *screenName = NULL; - char *baseName = NULL; /* XXX this is not used anymore; - try getting rid of it. */ - char *className = NULL; - int interactive = 0; - int wantobjects = 0; - int wantTk = 1; /* If false, then Tk_Init() doesn't get called */ - int sync = 0; /* pass -sync to wish */ - char *use = NULL; /* pass -use to wish */ - - className = "Tk"; - - if (!PyArg_ParseTuple(args, "|zssiiiiz:create", - &screenName, &baseName, &className, - &interactive, &wantobjects, &wantTk, - &sync, &use)) - return NULL; + /* XXX baseName is not used anymore; + * try getting rid of it. */ return (PyObject *) Tkapp_New(screenName, className, interactive, wantobjects, wantTk, sync, use); } +/*[clinic input] +_tkinter.setbusywaitinterval + + new_val: int + / + +Set the busy-wait interval in milliseconds between successive calls to Tcl_DoOneEvent in a threaded Python interpreter. + +It should be set to a divisor of the maximum time between frames in an animation. +[clinic start generated code]*/ + static PyObject * -Tkinter_setbusywaitinterval(PyObject *self, PyObject *args) +_tkinter_setbusywaitinterval_impl(PyModuleDef *module, int new_val) +/*[clinic end generated code: checksum=0b9d7ef7940461ea1280e362a79202478147943f]*/ { - int new_val; - if (!PyArg_ParseTuple(args, "i:setbusywaitinterval", &new_val)) - return NULL; if (new_val < 0) { PyErr_SetString(PyExc_ValueError, "busywaitinterval must be >= 0"); @@ -2768,34 +2870,72 @@ Py_RETURN_NONE; } -static char setbusywaitinterval_doc[] = -"setbusywaitinterval(n) -> None\n\ -\n\ -Set the busy-wait interval in milliseconds between successive\n\ -calls to Tcl_DoOneEvent in a threaded Python interpreter.\n\ -It should be set to a divisor of the maximum time between\n\ -frames in an animation."; - -static PyObject * -Tkinter_getbusywaitinterval(PyObject *self, PyObject *args) +/*[clinic input] +_tkinter.getbusywaitinterval -> int + +Return the current busy-wait interval between successive calls to Tcl_DoOneEvent in a threaded Python interpreter. +[clinic start generated code]*/ + +static int +_tkinter_getbusywaitinterval_impl(PyModuleDef *module) +/*[clinic end generated code: checksum=9d09eee026e969713369a07bf4ac41613034e6db]*/ { - return PyLong_FromLong(Tkinter_busywaitinterval); + return Tkinter_busywaitinterval; } -static char getbusywaitinterval_doc[] = -"getbusywaitinterval() -> int\n\ -\n\ -Return the current busy-wait interval between successive\n\ -calls to Tcl_DoOneEvent in a threaded Python interpreter."; +#include "_tkinter.clinic.c" + +static PyMethodDef Tktt_methods[] = +{ + _TKINTER_TKTIMERTOKEN_DELETETIMERHANDLER_METHODDEF + {NULL, NULL} +}; + +static PyMethodDef Tkapp_methods[] = +{ + _TKINTER_TKAPP_WILLDISPATCH_METHODDEF + _TKINTER_TKAPP_WANTOBJECTS_METHODDEF + {"call", Tkapp_Call, METH_VARARGS}, + _TKINTER_TKAPP_EVAL_METHODDEF + _TKINTER_TKAPP_EVALFILE_METHODDEF + _TKINTER_TKAPP_RECORD_METHODDEF + _TKINTER_TKAPP_ADDERRINFO_METHODDEF + {"setvar", Tkapp_SetVar, METH_VARARGS}, + {"globalsetvar", Tkapp_GlobalSetVar, METH_VARARGS}, + {"getvar", Tkapp_GetVar, METH_VARARGS}, + {"globalgetvar", Tkapp_GlobalGetVar, METH_VARARGS}, + {"unsetvar", Tkapp_UnsetVar, METH_VARARGS}, + {"globalunsetvar", Tkapp_GlobalUnsetVar, METH_VARARGS}, + {"getint", Tkapp_GetInt, METH_VARARGS}, + {"getdouble", Tkapp_GetDouble, METH_VARARGS}, + {"getboolean", Tkapp_GetBoolean, METH_VARARGS}, + _TKINTER_TKAPP_EXPRSTRING_METHODDEF + _TKINTER_TKAPP_EXPRLONG_METHODDEF + _TKINTER_TKAPP_EXPRDOUBLE_METHODDEF + _TKINTER_TKAPP_EXPRBOOLEAN_METHODDEF + {"splitlist", Tkapp_SplitList, METH_VARARGS}, + {"split", Tkapp_Split, METH_VARARGS}, + _TKINTER_TKAPP_CREATECOMMAND_METHODDEF + _TKINTER_TKAPP_DELETECOMMAND_METHODDEF +#ifdef HAVE_CREATEFILEHANDLER + _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF + _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF +#endif + _TKINTER_TKAPP_CREATETIMERHANDLER_METHODDEF + _TKINTER_TKAPP_MAINLOOP_METHODDEF + _TKINTER_TKAPP_DOONEEVENT_METHODDEF + _TKINTER_TKAPP_QUIT_METHODDEF + _TKINTER_TKAPP_INTERPADDR_METHODDEF + _TKINTER_TKAPP_LOADTK_METHODDEF + {NULL, NULL} +}; static PyMethodDef moduleMethods[] = { - {"_flatten", Tkinter_Flatten, METH_VARARGS}, - {"create", Tkinter_Create, METH_VARARGS}, - {"setbusywaitinterval",Tkinter_setbusywaitinterval, METH_VARARGS, - setbusywaitinterval_doc}, - {"getbusywaitinterval",(PyCFunction)Tkinter_getbusywaitinterval, - METH_NOARGS, getbusywaitinterval_doc}, + _TKINTER__FLATTEN_METHODDEF + _TKINTER_CREATE_METHODDEF + _TKINTER_SETBUSYWAITINTERVAL_METHODDEF + _TKINTER_GETBUSYWAITINTERVAL_METHODDEF {NULL, NULL} }; diff -r da8e8e28a616 Modules/_tkinter.clinic.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Modules/_tkinter.clinic.c Sat Jan 18 13:30:48 2014 +0200 @@ -0,0 +1,571 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(_tkinter_tkapp_eval__doc__, +"eval(script)"); + +#define _TKINTER_TKAPP_EVAL_METHODDEF \ + {"eval", (PyCFunction)_tkinter_tkapp_eval, METH_VARARGS, _tkinter_tkapp_eval__doc__}, + +static PyObject * +_tkinter_tkapp_eval_impl(PyObject *self, const char *script); + +static PyObject * +_tkinter_tkapp_eval(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *script; + + if (!PyArg_ParseTuple(args, + "s:eval", + &script)) + goto exit; + return_value = _tkinter_tkapp_eval_impl(self, script); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_evalfile__doc__, +"evalfile(fileName)"); + +#define _TKINTER_TKAPP_EVALFILE_METHODDEF \ + {"evalfile", (PyCFunction)_tkinter_tkapp_evalfile, METH_VARARGS, _tkinter_tkapp_evalfile__doc__}, + +static PyObject * +_tkinter_tkapp_evalfile_impl(PyObject *self, const char *fileName); + +static PyObject * +_tkinter_tkapp_evalfile(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *fileName; + + if (!PyArg_ParseTuple(args, + "s:evalfile", + &fileName)) + goto exit; + return_value = _tkinter_tkapp_evalfile_impl(self, fileName); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_record__doc__, +"record(script)"); + +#define _TKINTER_TKAPP_RECORD_METHODDEF \ + {"record", (PyCFunction)_tkinter_tkapp_record, METH_VARARGS, _tkinter_tkapp_record__doc__}, + +static PyObject * +_tkinter_tkapp_record_impl(PyObject *self, const char *script); + +static PyObject * +_tkinter_tkapp_record(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *script; + + if (!PyArg_ParseTuple(args, + "s:record", + &script)) + goto exit; + return_value = _tkinter_tkapp_record_impl(self, script); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_adderrinfo__doc__, +"adderrinfo(msg)"); + +#define _TKINTER_TKAPP_ADDERRINFO_METHODDEF \ + {"adderrinfo", (PyCFunction)_tkinter_tkapp_adderrinfo, METH_VARARGS, _tkinter_tkapp_adderrinfo__doc__}, + +static PyObject * +_tkinter_tkapp_adderrinfo_impl(PyObject *self, const char *msg); + +static PyObject * +_tkinter_tkapp_adderrinfo(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *msg; + + if (!PyArg_ParseTuple(args, + "s:adderrinfo", + &msg)) + goto exit; + return_value = _tkinter_tkapp_adderrinfo_impl(self, msg); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_exprstring__doc__, +"exprstring(s)"); + +#define _TKINTER_TKAPP_EXPRSTRING_METHODDEF \ + {"exprstring", (PyCFunction)_tkinter_tkapp_exprstring, METH_VARARGS, _tkinter_tkapp_exprstring__doc__}, + +static PyObject * +_tkinter_tkapp_exprstring_impl(PyObject *self, const char *s); + +static PyObject * +_tkinter_tkapp_exprstring(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *s; + + if (!PyArg_ParseTuple(args, + "s:exprstring", + &s)) + goto exit; + return_value = _tkinter_tkapp_exprstring_impl(self, s); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_exprlong__doc__, +"exprlong(s)"); + +#define _TKINTER_TKAPP_EXPRLONG_METHODDEF \ + {"exprlong", (PyCFunction)_tkinter_tkapp_exprlong, METH_VARARGS, _tkinter_tkapp_exprlong__doc__}, + +static PyObject * +_tkinter_tkapp_exprlong_impl(PyObject *self, const char *s); + +static PyObject * +_tkinter_tkapp_exprlong(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *s; + + if (!PyArg_ParseTuple(args, + "s:exprlong", + &s)) + goto exit; + return_value = _tkinter_tkapp_exprlong_impl(self, s); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_exprdouble__doc__, +"exprdouble(s)"); + +#define _TKINTER_TKAPP_EXPRDOUBLE_METHODDEF \ + {"exprdouble", (PyCFunction)_tkinter_tkapp_exprdouble, METH_VARARGS, _tkinter_tkapp_exprdouble__doc__}, + +static PyObject * +_tkinter_tkapp_exprdouble_impl(PyObject *self, const char *s); + +static PyObject * +_tkinter_tkapp_exprdouble(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *s; + + if (!PyArg_ParseTuple(args, + "s:exprdouble", + &s)) + goto exit; + return_value = _tkinter_tkapp_exprdouble_impl(self, s); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_exprboolean__doc__, +"exprboolean(s)"); + +#define _TKINTER_TKAPP_EXPRBOOLEAN_METHODDEF \ + {"exprboolean", (PyCFunction)_tkinter_tkapp_exprboolean, METH_VARARGS, _tkinter_tkapp_exprboolean__doc__}, + +static PyObject * +_tkinter_tkapp_exprboolean_impl(PyObject *self, const char *s); + +static PyObject * +_tkinter_tkapp_exprboolean(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *s; + + if (!PyArg_ParseTuple(args, + "s:exprboolean", + &s)) + goto exit; + return_value = _tkinter_tkapp_exprboolean_impl(self, s); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_createcommand__doc__, +"createcommand(name, func)"); + +#define _TKINTER_TKAPP_CREATECOMMAND_METHODDEF \ + {"createcommand", (PyCFunction)_tkinter_tkapp_createcommand, METH_VARARGS, _tkinter_tkapp_createcommand__doc__}, + +static PyObject * +_tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, PyObject *func); + +static PyObject * +_tkinter_tkapp_createcommand(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *name; + PyObject *func; + + if (!PyArg_ParseTuple(args, + "sO:createcommand", + &name, &func)) + goto exit; + return_value = _tkinter_tkapp_createcommand_impl((TkappObject *)self, name, func); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_deletecommand__doc__, +"deletecommand(name)"); + +#define _TKINTER_TKAPP_DELETECOMMAND_METHODDEF \ + {"deletecommand", (PyCFunction)_tkinter_tkapp_deletecommand, METH_VARARGS, _tkinter_tkapp_deletecommand__doc__}, + +static PyObject * +_tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name); + +static PyObject * +_tkinter_tkapp_deletecommand(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + const char *name; + + if (!PyArg_ParseTuple(args, + "s:deletecommand", + &name)) + goto exit; + return_value = _tkinter_tkapp_deletecommand_impl((TkappObject *)self, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_createfilehandler__doc__, +"createfilehandler(file, mask, func)"); + +#define _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF \ + {"createfilehandler", (PyCFunction)_tkinter_tkapp_createfilehandler, METH_VARARGS, _tkinter_tkapp_createfilehandler__doc__}, + +static PyObject * +_tkinter_tkapp_createfilehandler_impl(PyObject *self, PyObject *file, int mask, PyObject *func); + +static PyObject * +_tkinter_tkapp_createfilehandler(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + PyObject *file; + int mask; + PyObject *func; + + if (!PyArg_ParseTuple(args, + "OiO:createfilehandler", + &file, &mask, &func)) + goto exit; + return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_deletefilehandler__doc__, +"deletefilehandler(file)"); + +#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF \ + {"deletefilehandler", (PyCFunction)_tkinter_tkapp_deletefilehandler, METH_O, _tkinter_tkapp_deletefilehandler__doc__}, + +PyDoc_STRVAR(_tkinter_tktimertoken_deletetimerhandler__doc__, +"deletetimerhandler()"); + +#define _TKINTER_TKTIMERTOKEN_DELETETIMERHANDLER_METHODDEF \ + {"deletetimerhandler", (PyCFunction)_tkinter_tktimertoken_deletetimerhandler, METH_NOARGS, _tkinter_tktimertoken_deletetimerhandler__doc__}, + +static PyObject * +_tkinter_tktimertoken_deletetimerhandler_impl(TkttObject *self); + +static PyObject * +_tkinter_tktimertoken_deletetimerhandler(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return _tkinter_tktimertoken_deletetimerhandler_impl((TkttObject *)self); +} + +PyDoc_STRVAR(_tkinter_tkapp_createtimerhandler__doc__, +"createtimerhandler(milliseconds, func)"); + +#define _TKINTER_TKAPP_CREATETIMERHANDLER_METHODDEF \ + {"createtimerhandler", (PyCFunction)_tkinter_tkapp_createtimerhandler, METH_VARARGS, _tkinter_tkapp_createtimerhandler__doc__}, + +static PyObject * +_tkinter_tkapp_createtimerhandler_impl(PyObject *self, int milliseconds, PyObject *func); + +static PyObject * +_tkinter_tkapp_createtimerhandler(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + int milliseconds; + PyObject *func; + + if (!PyArg_ParseTuple(args, + "iO:createtimerhandler", + &milliseconds, &func)) + goto exit; + return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_mainloop__doc__, +"mainloop(threshold=0)"); + +#define _TKINTER_TKAPP_MAINLOOP_METHODDEF \ + {"mainloop", (PyCFunction)_tkinter_tkapp_mainloop, METH_VARARGS, _tkinter_tkapp_mainloop__doc__}, + +static PyObject * +_tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold); + +static PyObject * +_tkinter_tkapp_mainloop(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + int threshold = 0; + + if (!PyArg_ParseTuple(args, + "|i:mainloop", + &threshold)) + goto exit; + return_value = _tkinter_tkapp_mainloop_impl((TkappObject *)self, threshold); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_dooneevent__doc__, +"dooneevent(flags=0)"); + +#define _TKINTER_TKAPP_DOONEEVENT_METHODDEF \ + {"dooneevent", (PyCFunction)_tkinter_tkapp_dooneevent, METH_VARARGS, _tkinter_tkapp_dooneevent__doc__}, + +static PyObject * +_tkinter_tkapp_dooneevent_impl(PyObject *self, int flags); + +static PyObject * +_tkinter_tkapp_dooneevent(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + int flags = 0; + + if (!PyArg_ParseTuple(args, + "|i:dooneevent", + &flags)) + goto exit; + return_value = _tkinter_tkapp_dooneevent_impl(self, flags); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_quit__doc__, +"quit()"); + +#define _TKINTER_TKAPP_QUIT_METHODDEF \ + {"quit", (PyCFunction)_tkinter_tkapp_quit, METH_NOARGS, _tkinter_tkapp_quit__doc__}, + +static PyObject * +_tkinter_tkapp_quit_impl(PyObject *self); + +static PyObject * +_tkinter_tkapp_quit(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return _tkinter_tkapp_quit_impl(self); +} + +PyDoc_STRVAR(_tkinter_tkapp_interpaddr__doc__, +"interpaddr()"); + +#define _TKINTER_TKAPP_INTERPADDR_METHODDEF \ + {"interpaddr", (PyCFunction)_tkinter_tkapp_interpaddr, METH_NOARGS, _tkinter_tkapp_interpaddr__doc__}, + +static PyObject * +_tkinter_tkapp_interpaddr_impl(PyObject *self); + +static PyObject * +_tkinter_tkapp_interpaddr(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return _tkinter_tkapp_interpaddr_impl(self); +} + +PyDoc_STRVAR(_tkinter_tkapp_loadtk__doc__, +"loadtk()"); + +#define _TKINTER_TKAPP_LOADTK_METHODDEF \ + {"loadtk", (PyCFunction)_tkinter_tkapp_loadtk, METH_NOARGS, _tkinter_tkapp_loadtk__doc__}, + +static PyObject * +_tkinter_tkapp_loadtk_impl(PyObject *self); + +static PyObject * +_tkinter_tkapp_loadtk(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return _tkinter_tkapp_loadtk_impl(self); +} + +PyDoc_STRVAR(_tkinter_tkapp_wantobjects__doc__, +"wantobjects([value])"); + +#define _TKINTER_TKAPP_WANTOBJECTS_METHODDEF \ + {"wantobjects", (PyCFunction)_tkinter_tkapp_wantobjects, METH_VARARGS, _tkinter_tkapp_wantobjects__doc__}, + +static PyObject * +_tkinter_tkapp_wantobjects_impl(TkappObject *self, int group_right_1, int value); + +static PyObject * +_tkinter_tkapp_wantobjects(PyObject *self, PyObject *args) +{ + PyObject *return_value = NULL; + int group_right_1 = 0; + int value = 0; + + switch (PyTuple_GET_SIZE(args)) { + case 0: + break; + case 1: + if (!PyArg_ParseTuple(args, "i:wantobjects", &value)) + return NULL; + group_right_1 = 1; + break; + default: + PyErr_SetString(PyExc_TypeError, "_tkinter.tkapp.wantobjects requires 0 to 1 arguments"); + return NULL; + } + return_value = _tkinter_tkapp_wantobjects_impl((TkappObject *)self, group_right_1, value); + + return return_value; +} + +PyDoc_STRVAR(_tkinter_tkapp_willdispatch__doc__, +"willdispatch()"); + +#define _TKINTER_TKAPP_WILLDISPATCH_METHODDEF \ + {"willdispatch", (PyCFunction)_tkinter_tkapp_willdispatch, METH_NOARGS, _tkinter_tkapp_willdispatch__doc__}, + +static PyObject * +_tkinter_tkapp_willdispatch_impl(TkappObject *self); + +static PyObject * +_tkinter_tkapp_willdispatch(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return _tkinter_tkapp_willdispatch_impl((TkappObject *)self); +} + +PyDoc_STRVAR(_tkinter__flatten__doc__, +"_flatten(item)"); + +#define _TKINTER__FLATTEN_METHODDEF \ + {"_flatten", (PyCFunction)_tkinter__flatten, METH_O, _tkinter__flatten__doc__}, + +PyDoc_STRVAR(_tkinter_create__doc__, +"create(screenName=None, baseName=None, className=\'Tk\', interactive=False, wantobjects=False, wantTk=True, sync=False, use=None)\n" +"\n" +"\n" +" wantTk\n" +" if false, then Tk_Init() doesn\'t get called\n" +" sync\n" +" if true, then pass -sync to wish\n" +" use\n" +" if not None, then pass -use to wish"); + +#define _TKINTER_CREATE_METHODDEF \ + {"create", (PyCFunction)_tkinter_create, METH_VARARGS, _tkinter_create__doc__}, + +static PyObject * +_tkinter_create_impl(PyModuleDef *module, const char *screenName, const char *baseName, const char *className, int interactive, int wantobjects, int wantTk, int sync, const char *use); + +static PyObject * +_tkinter_create(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + const char *screenName = NULL; + const char *baseName = NULL; + const char *className = "Tk"; + int interactive = 0; + int wantobjects = 0; + int wantTk = 1; + int sync = 0; + const char *use = NULL; + + if (!PyArg_ParseTuple(args, + "|zssiiiiz:create", + &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use)) + goto exit; + return_value = _tkinter_create_impl(module, screenName, baseName, className, interactive, wantobjects, wantTk, sync, use); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_setbusywaitinterval__doc__, +"setbusywaitinterval(new_val)\n" +"Set the busy-wait interval in milliseconds between successive calls to Tcl_DoOneEvent in a threaded Python interpreter.\n" +"\n" +"It should be set to a divisor of the maximum time between frames in an animation."); + +#define _TKINTER_SETBUSYWAITINTERVAL_METHODDEF \ + {"setbusywaitinterval", (PyCFunction)_tkinter_setbusywaitinterval, METH_VARARGS, _tkinter_setbusywaitinterval__doc__}, + +static PyObject * +_tkinter_setbusywaitinterval_impl(PyModuleDef *module, int new_val); + +static PyObject * +_tkinter_setbusywaitinterval(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int new_val; + + if (!PyArg_ParseTuple(args, + "i:setbusywaitinterval", + &new_val)) + goto exit; + return_value = _tkinter_setbusywaitinterval_impl(module, new_val); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tkinter_getbusywaitinterval__doc__, +"getbusywaitinterval()\n" +"Return the current busy-wait interval between successive calls to Tcl_DoOneEvent in a threaded Python interpreter."); + +#define _TKINTER_GETBUSYWAITINTERVAL_METHODDEF \ + {"getbusywaitinterval", (PyCFunction)_tkinter_getbusywaitinterval, METH_NOARGS, _tkinter_getbusywaitinterval__doc__}, + +static int +_tkinter_getbusywaitinterval_impl(PyModuleDef *module); + +static PyObject * +_tkinter_getbusywaitinterval(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = _tkinter_getbusywaitinterval_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} +/*[clinic end generated code: checksum=9dff83b0750b2f69149b65b748142027a38c4ab5]*/