diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-12 21:20:21 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-12 21:20:21 (GMT) |
commit | 1a1118fa21d731504dac09ed2e6d6238601f5c84 (patch) | |
tree | 582b351a98fe27e820ca3d6d0281519c1a11dbcf /generic/tkConsole.c | |
parent | d72c843661bf5789ff40389b8b71707d92437397 (diff) | |
download | tk-1a1118fa21d731504dac09ed2e6d6238601f5c84.zip tk-1a1118fa21d731504dac09ed2e6d6238601f5c84.tar.gz tk-1a1118fa21d731504dac09ed2e6d6238601f5c84.tar.bz2 |
More -1 -> TCL_INDEX_NONE. More TCL_UNUSED(
Diffstat (limited to 'generic/tkConsole.c')
-rw-r--r-- | generic/tkConsole.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 0c12c43..88aacd4 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -43,22 +43,22 @@ typedef struct ChannelData { * Prototypes for local procedures defined in this file: */ -static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp); -static int Console2Close(ClientData instanceData, Tcl_Interp *interp, int flags); -static void ConsoleDeleteProc(ClientData clientData); -static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr); -static int ConsoleHandle(ClientData instanceData, int direction, - ClientData *handlePtr); -static int ConsoleInput(ClientData instanceData, char *buf, int toRead, +static int ConsoleClose(void *instanceData, Tcl_Interp *interp); +static int Console2Close(void *instanceData, Tcl_Interp *interp, int flags); +static void ConsoleDeleteProc(void *clientData); +static void ConsoleEventProc(void *clientData, XEvent *eventPtr); +static int ConsoleHandle(void *instanceData, int direction, + void **handlePtr); +static int ConsoleInput(void *instanceData, char *buf, int toRead, int *errorCode); -static int ConsoleObjCmd(ClientData clientData, Tcl_Interp *interp, +static int ConsoleObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ConsoleOutput(ClientData instanceData, const char *buf, +static int ConsoleOutput(void *instanceData, const char *buf, int toWrite, int *errorCode); -static void ConsoleWatch(ClientData instanceData, int mask); -static void DeleteConsoleInterp(ClientData clientData); -static void InterpDeleteProc(ClientData clientData, Tcl_Interp *interp); -static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, +static void ConsoleWatch(void *instanceData, int mask); +static void DeleteConsoleInterp(void *clientData); +static void InterpDeleteProc(void *clientData, Tcl_Interp *interp); +static int InterpreterObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* @@ -444,7 +444,7 @@ Tk_CreateConsoleWindow( Tcl_Preserve(consoleInterp); result = Tcl_EvalEx(consoleInterp, "source $tk_library/console.tcl", - -1, TCL_EVAL_GLOBAL); + TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); @@ -493,7 +493,7 @@ Tk_CreateConsoleWindow( static int ConsoleOutput( - ClientData instanceData, /* Indicates which device to use. */ + void *instanceData, /* Indicates which device to use. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ @@ -517,19 +517,18 @@ ConsoleOutput( * Assumption is utf-8 Tcl_Encoding is reliably present. */ - (void)Tcl_ExternalToUtfDString(utf8, buf, toWrite, &ds); - const char *bytes = Tcl_DStringValue(&ds); - int numBytes = Tcl_DStringLength(&ds); - Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", -1); + const char *bytes = Tcl_ExternalToUtfDString(utf8, buf, (Tcl_Size)toWrite, &ds); + Tcl_Size numBytes = Tcl_DStringLength(&ds); + Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", TCL_INDEX_NONE); Tcl_FreeEncoding(utf8); if (data->type == TCL_STDERR) { Tcl_ListObjAppendElement(NULL, cmd, - Tcl_NewStringObj("stderr", -1)); + Tcl_NewStringObj("stderr", TCL_INDEX_NONE)); } else { Tcl_ListObjAppendElement(NULL, cmd, - Tcl_NewStringObj("stdout", -1)); + Tcl_NewStringObj("stdout", TCL_INDEX_NONE)); } Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj(bytes, numBytes)); @@ -588,7 +587,7 @@ ConsoleInput( static int ConsoleClose( - ClientData instanceData, + void *instanceData, TCL_UNUSED(Tcl_Interp *)) { ChannelData *data = (ChannelData *)instanceData; @@ -609,7 +608,7 @@ ConsoleClose( static int Console2Close( - ClientData instanceData, /* Unused. */ + void *instanceData, /* Unused. */ Tcl_Interp *interp, /* Unused. */ int flags) { @@ -693,7 +692,7 @@ ConsoleHandle( static int ConsoleObjCmd( - ClientData clientData, /* Access to the console interp */ + void *clientData, /* Access to the console interp */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -728,21 +727,21 @@ ConsoleObjCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } - cmd = Tcl_NewStringObj("wm withdraw .", -1); + cmd = Tcl_NewStringObj("wm withdraw .", TCL_INDEX_NONE); break; case CON_SHOW: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } - cmd = Tcl_NewStringObj("wm deiconify .", -1); + cmd = Tcl_NewStringObj("wm deiconify .", TCL_INDEX_NONE); break; case CON_TITLE: if (objc > 3) { Tcl_WrongNumArgs(interp, 2, objv, "?title?"); return TCL_ERROR; } - cmd = Tcl_NewStringObj("wm title .", -1); + cmd = Tcl_NewStringObj("wm title .", TCL_INDEX_NONE); if (objc == 3) { Tcl_ListObjAppendElement(NULL, cmd, objv[2]); } @@ -761,7 +760,7 @@ ConsoleObjCmd( Tcl_Release(consoleInterp); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no active console interp", -1)); + "no active console interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NONE", NULL); result = TCL_ERROR; } @@ -785,7 +784,7 @@ ConsoleObjCmd( static int InterpreterObjCmd( - ClientData clientData, /* */ + void *clientData, /* */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -812,7 +811,7 @@ InterpreterObjCmd( if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no active parent interp", -1)); + "no active parent interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL); return TCL_ERROR; } @@ -859,7 +858,7 @@ InterpreterObjCmd( static void DeleteConsoleInterp( - ClientData clientData) + void *clientData) { Tcl_Interp *interp = (Tcl_Interp *)clientData; @@ -885,7 +884,7 @@ DeleteConsoleInterp( static void InterpDeleteProc( - ClientData clientData, + void *clientData, Tcl_Interp *interp) { ConsoleInfo *info = (ConsoleInfo *)clientData; @@ -918,7 +917,7 @@ InterpDeleteProc( static void ConsoleDeleteProc( - ClientData clientData) + void *clientData) { ConsoleInfo *info = (ConsoleInfo *)clientData; @@ -951,7 +950,7 @@ ConsoleDeleteProc( static void ConsoleEventProc( - ClientData clientData, + void *clientData, XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { @@ -959,7 +958,7 @@ ConsoleEventProc( Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { - Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); + Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } if (info->refCount-- <= 1) { |