diff options
author | fvogel <fvogelnew1@free.fr> | 2017-03-26 12:21:15 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2017-03-26 12:21:15 (GMT) |
commit | a114992fdcaf328a70d2a75d6bb59cda0c1ddf2d (patch) | |
tree | 1bef36e29a3111cb7f466b311b4240eef3e0ccd9 /generic/tkTest.c | |
parent | 5234049f9b7cab7c95ba9fc0ddaea86a860cc5ac (diff) | |
parent | ab9f98cc8e92cbe59655b280a6a8fffc1bcff60e (diff) | |
download | tk-a114992fdcaf328a70d2a75d6bb59cda0c1ddf2d.zip tk-a114992fdcaf328a70d2a75d6bb59cda0c1ddf2d.tar.gz tk-a114992fdcaf328a70d2a75d6bb59cda0c1ddf2d.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r-- | generic/tkTest.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c index bd7b948..483fc0d 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -192,6 +192,9 @@ static void CustomOptionFree(ClientData clientData, static int TestpropObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); +static int TestprintfObjCmd(ClientData dummy, + Tcl_Interp *interp, int objc, + Tcl_Obj * const objv[]); #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestwrapperObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, @@ -266,6 +269,7 @@ Tktest_Init( (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd, (ClientData) Tk_MainWindow(interp), NULL); + Tcl_CreateObjCommand(interp, "testprintf", TestprintfObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testphotostringmatch", @@ -1902,6 +1906,60 @@ TestpropObjCmd( return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * TestpropObjCmd -- + * + * This function implements the "testprop" command. It fetches and prints + * the value of a property on a window. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestprintfObjCmd( + ClientData clientData, /* Not used */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument strings. */ +{ + char buffer[256]; + Tcl_WideInt wideInt; +#ifdef _WIN32 + __int64 longLongInt; +#else + long long longLongInt; +#endif + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "wideint"); + return TCL_ERROR; + } + if (Tcl_GetWideIntFromObj(interp, objv[1], &wideInt) != TCL_OK) { + return TCL_ERROR; + } + longLongInt = wideInt; + + /* Just add a lot of arguments to sprintf. Reason: on AMD64, the first + * 4 or 6 arguments (we assume 8, just in case) might be put in registers, + * which still woudn't tell if the assumed size is correct: We want this + * test-case to fail if the 64-bit value is printed as truncated to 32-bit. + */ + sprintf(buffer, "%s%s%s%s%s%s%s%s%" TCL_LL_MODIFIER "d %" + TCL_LL_MODIFIER "u", "", "", "", "", "", "", "", "", + (Tcl_WideInt)longLongInt, (Tcl_WideUInt)longLongInt); + Tcl_AppendResult(interp, buffer, NULL); + return TCL_OK; +} + #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) /* *---------------------------------------------------------------------- |