diff options
author | dgp <dgp@users.sourceforge.net> | 2020-09-15 18:04:02 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2020-09-15 18:04:02 (GMT) |
commit | 163d31e623394ea08605580b140ef1a5f14a0573 (patch) | |
tree | 30378ff4653a9894ccf072e5a2c622afd288bd0e /generic/tclTest.c | |
parent | e36bada6ec8d9679acbb7b2b73f38d3d643d5dd7 (diff) | |
parent | 93124d77a6848e2118547a4f477abd8e26493252 (diff) | |
download | tcl-163d31e623394ea08605580b140ef1a5f14a0573.zip tcl-163d31e623394ea08605580b140ef1a5f14a0573.tar.gz tcl-163d31e623394ea08605580b140ef1a5f14a0573.tar.bz2 |
merge 8.7
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r-- | generic/tclTest.c | 300 |
1 files changed, 175 insertions, 125 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 499ef93..91d486e 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -20,7 +20,11 @@ # define USE_TCL_STUBS #endif #include "tclInt.h" -#include "tclTomMath.h" +#ifdef TCL_WITH_EXTERNAL_TOMMATH +# include "tommath.h" +#else +# include "tclTomMath.h" +#endif #include "tclOO.h" #include <math.h> @@ -308,7 +312,7 @@ static Tcl_FSNormalizePathProc TestReportNormalizePath; static Tcl_FSPathInFilesystemProc TestReportInFilesystem; static Tcl_FSFreeInternalRepProc TestReportFreeInternalRep; static Tcl_FSDupInternalRepProc TestReportDupInternalRep; - +static Tcl_CmdProc TestServiceModeCmd; static Tcl_FSStatProc SimpleStat; static Tcl_FSAccessProc SimpleAccess; static Tcl_FSOpenFileChannelProc SimpleOpenFileChannel; @@ -446,9 +450,11 @@ Tcltest_Init( if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) { return TCL_ERROR; } +#ifndef TCL_WITH_EXTERNAL_TOMMATH if (Tcl_TomMath_InitStubs(interp, "8.5-") == NULL) { return TCL_ERROR; } +#endif if (Tcl_OOInitStubs(interp) == NULL) { return TCL_ERROR; } @@ -567,6 +573,8 @@ Tcltest_Init( NULL, NULL); Tcl_CreateObjCommand(interp, "testsaveresult", TestsaveresultCmd, NULL, NULL); + Tcl_CreateCommand(interp, "testservicemode", TestServiceModeCmd, + NULL, NULL); Tcl_CreateCommand(interp, "testsetassocdata", TestsetassocdataCmd, NULL, NULL); Tcl_CreateCommand(interp, "testsetnoerr", TestsetCmd, @@ -719,7 +727,7 @@ Tcltest_SafeInit( static int TestasyncCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -929,7 +937,7 @@ AsyncThreadProc( static int TestbumpinterpepochObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -964,7 +972,7 @@ TestbumpinterpepochObjCmd( static int TestcmdinfoCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1091,7 +1099,7 @@ CmdDelProc2( static int TestcmdtokenCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1154,7 +1162,7 @@ TestcmdtokenCmd( static int TestcmdtraceCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1251,7 +1259,7 @@ CmdTraceProc( char *command, /* The command being traced (after * substitutions). */ TCL_UNUSED(Tcl_CmdProc *) /*cmdProc*/, - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), int argc, /* Number of arguments. */ const char *argv[]) /* Argument strings. */ { @@ -1269,12 +1277,12 @@ CmdTraceProc( static void CmdTraceDeleteProc( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int) /*level*/, TCL_UNUSED(char *) /*command*/, TCL_UNUSED(Tcl_CmdProc *), - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) { @@ -1289,7 +1297,7 @@ CmdTraceDeleteProc( static int ObjTraceProc( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Tcl interpreter */ TCL_UNUSED(int) /*level*/, const char *command, @@ -1346,7 +1354,7 @@ ObjTraceDeleteProc( static int TestcreatecommandCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1376,7 +1384,7 @@ TestcreatecommandCmd( static int CreatedCommandProc( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) @@ -1398,7 +1406,7 @@ CreatedCommandProc( static int CreatedCommandProc2( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) @@ -1436,7 +1444,7 @@ CreatedCommandProc2( static int TestdcallCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1500,21 +1508,21 @@ DelCallbackProc( static int TestdelCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { DelCmd *dPtr; - Tcl_Interp *slave; + Tcl_Interp *child; if (argc != 4) { Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; } - slave = Tcl_GetSlave(interp, argv[1]); - if (slave == NULL) { + child = Tcl_GetChild(interp, argv[1]); + if (child == NULL) { return TCL_ERROR; } @@ -1523,7 +1531,7 @@ TestdelCmd( dPtr->deleteCmd = (char *)ckalloc(strlen(argv[3]) + 1); strcpy(dPtr->deleteCmd, argv[3]); - Tcl_CreateCommand(slave, argv[2], DelCmdProc, dPtr, + Tcl_CreateCommand(child, argv[2], DelCmdProc, dPtr, DelDeleteProc); return TCL_OK; } @@ -1575,7 +1583,7 @@ DelDeleteProc( static int TestdelassocdataCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1612,7 +1620,7 @@ TestdelassocdataCmd( static int TestdoubledigitsObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj* const objv[]) /* Parameter vector */ @@ -1699,7 +1707,7 @@ TestdoubledigitsObjCmd( static int TestdstringCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1825,7 +1833,7 @@ static void SpecialFree( static int TestencodingObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1985,7 +1993,7 @@ EncodingFreeProc( static int TestevalexObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2030,7 +2038,7 @@ TestevalexObjCmd( static int TestevalobjvObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2079,7 +2087,7 @@ TestevalobjvObjCmd( static int TesteventObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const objv[]) /* Parameter vector */ @@ -2258,7 +2266,7 @@ TesteventDeleteProc( static int TestexithandlerCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2334,7 +2342,7 @@ ExitProcEven( static int TestexprlongCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2377,7 +2385,7 @@ TestexprlongCmd( static int TestexprlongobjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument objects. */ @@ -2419,7 +2427,7 @@ TestexprlongobjCmd( static int TestexprdoubleCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2463,7 +2471,7 @@ TestexprdoubleCmd( static int TestexprdoubleobjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument objects. */ @@ -2505,7 +2513,7 @@ TestexprdoubleobjCmd( static int TestexprstringCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2537,7 +2545,7 @@ TestexprstringCmd( static int TestfilelinkCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -2604,7 +2612,7 @@ TestfilelinkCmd( static int TestgetassocdataCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2642,7 +2650,7 @@ TestgetassocdataCmd( static int TestgetplatformCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2682,23 +2690,23 @@ TestgetplatformCmd( static int TestinterpdeleteCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - Tcl_Interp *slaveToDelete; + Tcl_Interp *childToDelete; if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " path\"", NULL); return TCL_ERROR; } - slaveToDelete = Tcl_GetSlave(interp, argv[1]); - if (slaveToDelete == NULL) { + childToDelete = Tcl_GetChild(interp, argv[1]); + if (childToDelete == NULL) { return TCL_ERROR; } - Tcl_DeleteInterp(slaveToDelete); + Tcl_DeleteInterp(childToDelete); return TCL_OK; } @@ -2722,7 +2730,7 @@ TestinterpdeleteCmd( static int TestlinkCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -3190,7 +3198,7 @@ TestlinkCmd( static int TestlinkarrayCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3308,7 +3316,7 @@ TestlinkarrayCmd( static int TestlocaleCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3394,7 +3402,7 @@ CleanupTestSetassocdataTests( static int TestparserObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3450,7 +3458,7 @@ TestparserObjCmd( static int TestexprparserObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3597,7 +3605,7 @@ PrintParse( static int TestparsevarObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3638,7 +3646,7 @@ TestparsevarObjCmd( static int TestparsevarnameObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3701,7 +3709,7 @@ TestparsevarnameObjCmd( static int TestpreferstableObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int) /*objc*/, TCL_UNUSED(Tcl_Obj *const *) /*objv*/) @@ -3731,7 +3739,7 @@ TestpreferstableObjCmd( static int TestprintObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3772,7 +3780,7 @@ TestprintObjCmd( static int TestregexpObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4095,7 +4103,7 @@ TestregexpXflags( static int TestreturnObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(int) /*objc*/, TCL_UNUSED(Tcl_Obj *const *) /*objv*/) @@ -4123,7 +4131,7 @@ TestreturnObjCmd( static int TestsetassocdataCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4174,7 +4182,7 @@ TestsetassocdataCmd( static int TestsetplatformCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4223,7 +4231,7 @@ TestsetplatformCmd( static int TeststaticpkgCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4274,7 +4282,7 @@ StaticInitProc( static int TesttranslatefilenameCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4315,7 +4323,7 @@ TesttranslatefilenameCmd( static int TestupvarCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4367,7 +4375,7 @@ TestupvarCmd( static int TestseterrorcodeCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4419,7 +4427,7 @@ TestseterrorcodeCmd( static int TestsetobjerrorcodeCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -4447,7 +4455,7 @@ TestsetobjerrorcodeCmd( static int TestfeventCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4519,7 +4527,7 @@ TestfeventCmd( static int TestpanicCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4538,7 +4546,7 @@ TestpanicCmd( static int TestfileCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ Tcl_Obj *const argv[]) /* The argument objects. */ @@ -4620,7 +4628,7 @@ TestfileCmd( static int TestgetvarfullnameCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -4694,7 +4702,7 @@ TestgetvarfullnameCmd( static int GetTimesObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* The current interpreter. */ TCL_UNUSED(int) /*cobjc*/, TCL_UNUSED(Tcl_Obj *const *) /*cobjv*/) @@ -4873,7 +4881,7 @@ GetTimesObjCmd( static int NoopCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) @@ -4900,7 +4908,7 @@ NoopCmd( static int NoopObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(int) /*objc*/, TCL_UNUSED(Tcl_Obj *const *) /*objv*/) @@ -4925,7 +4933,7 @@ NoopObjCmd( static int TeststringbytesObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -4965,7 +4973,7 @@ TeststringbytesObjCmd( static int TestpurebytesobjObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5012,7 +5020,7 @@ TestpurebytesobjObjCmd( static int TestsetbytearraylengthObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5056,7 +5064,7 @@ TestsetbytearraylengthObjCmd( static int TestbytestringObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5178,7 +5186,7 @@ Testset2Cmd( static int TestsaveresultCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp,/* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5309,7 +5317,7 @@ TestsaveresultFree( static int TestmainthreadCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp,/* Current interpreter. */ int argc, /* Number of arguments. */ TCL_UNUSED(const char **) /*argv*/) @@ -5370,7 +5378,7 @@ MainLoop(void) static int TestsetmainloopCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) @@ -5399,7 +5407,7 @@ TestsetmainloopCmd( static int TestexitmainloopCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) @@ -5427,7 +5435,7 @@ TestexitmainloopCmd( static int TestChannelCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Interpreter for result. */ int argc, /* Count of additional args. */ const char **argv) /* Additional arg strings. */ @@ -5894,7 +5902,7 @@ TestChannelCmd( static int TestChannelEventCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -6106,7 +6114,7 @@ TestChannelEventCmd( static int TestSocketCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Interpreter for result. */ int argc, /* Count of additional args. */ const char **argv) /* Additional arg strings. */ @@ -6158,6 +6166,54 @@ TestSocketCmd( /* *---------------------------------------------------------------------- * + * TestServiceModeCmd -- + * + * This procedure implements the "testservicemode" command which gets or + * sets the current Tcl ServiceMode. There are several tests which open + * a file and assign various handlers to it. For these tests to be + * deterministic it is important that file events not be processed until + * all of the handlers are in place. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * May change the ServiceMode setting. + * + *---------------------------------------------------------------------- + */ + +static int +TestServiceModeCmd( + TCL_UNUSED(void *), + Tcl_Interp *interp, /* Current interpreter. */ + int argc, /* Number of arguments. */ + const char **argv) /* Argument strings. */ +{ + int newmode, oldmode; + if (argc > 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?newmode?\"", NULL); + return TCL_ERROR; + } + oldmode = (Tcl_GetServiceMode() != TCL_SERVICE_NONE); + if (argc == 2) { + if (Tcl_GetInt(interp, argv[1], &newmode) == TCL_ERROR) { + return TCL_ERROR; + } + if (newmode == 0) { + Tcl_SetServiceMode(TCL_SERVICE_NONE); + } else { + Tcl_SetServiceMode(TCL_SERVICE_ALL); + } + } + Tcl_SetObjResult(interp, Tcl_NewIntObj(oldmode)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TestWrongNumArgsObjCmd -- * * Test the Tcl_WrongNumArgs function. @@ -6173,7 +6229,7 @@ TestSocketCmd( static int TestWrongNumArgsObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -6229,7 +6285,7 @@ TestWrongNumArgsObjCmd( static int TestGetIndexFromObjStructObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -6283,7 +6339,7 @@ TestGetIndexFromObjStructObjCmd( static int TestFilesystemObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -6625,7 +6681,7 @@ TestReportNormalizePath( static int SimplePathInFilesystem( Tcl_Obj *pathPtr, - TCL_UNUSED(ClientData *)) + TCL_UNUSED(void **)) { const char *str = Tcl_GetString(pathPtr); @@ -6654,7 +6710,7 @@ SimplePathInFilesystem( static int TestSimpleFilesystemObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -6825,39 +6881,43 @@ TestUtfNextCmd( char *bytes; const char *result, *first; char buffer[32]; - static const char tobetested[] = "\xFF\xFE\xF4\xF2\xF0\xEF\xE8\xE3\xE2\xE1\xE0\xC2\xC1\xC0\x82"; + static const char tobetested[] = "A\xA0\xC0\xC1\xC2\xD0\xE0\xE8\xF2\xF7\xF8\xFE\xFF"; const char *p = tobetested; - if (objc != 3 || strcmp(Tcl_GetString(objv[1]), "-bytestring")) { - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes"); - return TCL_ERROR; - } - bytes = Tcl_GetStringFromObj(objv[1], &numBytes); - } else { - bytes = (char *) Tcl_GetBytesFromObj(interp, objv[2], &numBytes); - if (bytes == NULL) { - return TCL_ERROR; - } + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes"); + return TCL_ERROR; } + bytes = Tcl_GetStringFromObj(objv[1], &numBytes); - if (numBytes > (int)sizeof(buffer)-2) { - Tcl_AppendResult(interp, "\"testutfnext\" can only handle 30 bytes", NULL); + if (numBytes > (int)sizeof(buffer) - 4) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "\"testutfnext\" can only handle %d bytes", + (int)sizeof(buffer) - 4)); return TCL_ERROR; } memcpy(buffer + 1, bytes, numBytes); - buffer[0] = buffer[numBytes + 1] = '\x00'; + buffer[0] = buffer[numBytes + 1] = buffer[numBytes + 2] = buffer[numBytes + 3] = '\xA0'; - first = result = TclUtfNext(buffer + 1); + first = result = Tcl_UtfNext(buffer + 1); while ((buffer[0] = *p++) != '\0') { /* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */ - result = TclUtfNext(buffer + 1); + result = Tcl_UtfNext(buffer + 1); if (first != result) { Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL); return TCL_ERROR; } } + p = tobetested; + while ((buffer[numBytes + 1] = *p++) != '\0') { + /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */ + result = Tcl_UtfNext(buffer + 1); + if (first != result) { + first = buffer; + break; + } + } Tcl_SetObjResult(interp, Tcl_NewIntObj(first - buffer - 1)); @@ -6879,17 +6939,13 @@ TestUtfPrevCmd( int numBytes, offset; char *bytes; const char *result; - Tcl_Obj *copy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?"); return TCL_ERROR; } - bytes = (char *) Tcl_GetBytesFromObj(interp, objv[1], &numBytes); - if (bytes == NULL) { - return TCL_ERROR; - } + bytes = Tcl_GetStringFromObj(objv[1], &numBytes); if (objc == 3) { if (TCL_OK != Tcl_GetIntForIndex(interp, objv[2], numBytes, &offset)) { @@ -6904,14 +6960,8 @@ TestUtfPrevCmd( } else { offset = numBytes; } - copy = Tcl_DuplicateObj(objv[1]); - bytes = (char *) Tcl_SetByteArrayLength(copy, numBytes+1); - bytes[numBytes] = '\0'; - result = TclUtfPrev(bytes + offset, bytes); Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes)); - - Tcl_DecrRefCount(copy); return TCL_OK; } @@ -6921,7 +6971,7 @@ TestUtfPrevCmd( static int TestNumUtfCharsCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -6950,7 +7000,7 @@ TestNumUtfCharsCmd( static int TestFindFirstCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -6972,7 +7022,7 @@ TestFindFirstCmd( static int TestFindLastCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -7014,7 +7064,7 @@ TestFindLastCmd( static int TestcpuidCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const * objv) /* Parameter vector */ @@ -7050,7 +7100,7 @@ TestcpuidCmd( static int TestHashSystemHashCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -7126,7 +7176,7 @@ TestHashSystemHashCmd( */ static int TestgetintCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int argc, const char **argv) @@ -7153,7 +7203,7 @@ TestgetintCmd( */ static int TestlongsizeCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int argc, TCL_UNUSED(const char **) /*argv*/) @@ -7195,7 +7245,7 @@ NREUnwind_callback( static int TestNREUnwind( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int) /*objc*/, TCL_UNUSED(Tcl_Obj *const *) /*objv*/) @@ -7213,7 +7263,7 @@ TestNREUnwind( static int TestNRELevels( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(int) /*objc*/, TCL_UNUSED(Tcl_Obj *const *) /*objv*/) @@ -7269,7 +7319,7 @@ TestNRELevels( static int TestconcatobjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) @@ -7565,7 +7615,7 @@ TestconcatobjCmd( static int TestgetencpathObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -7598,7 +7648,7 @@ TestgetencpathObjCmd( static int TestsetencpathObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -7632,7 +7682,7 @@ TestsetencpathObjCmd( static int TestparseargsCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -7871,7 +7921,7 @@ InterpCompiledVarResolver( static int TestInterpResolverCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -7887,7 +7937,7 @@ TestInterpResolverCmd( return TCL_ERROR; } if (objc == 3) { - interp = Tcl_GetSlave(interp, Tcl_GetString(objv[2])); + interp = Tcl_GetChild(interp, Tcl_GetString(objv[2])); if (interp == NULL) { Tcl_AppendResult(interp, "provided interpreter not found", NULL); return TCL_ERROR; |