diff options
author | dgp <dgp@users.sourceforge.net> | 2012-12-07 19:26:49 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-12-07 19:26:49 (GMT) |
commit | 64a4cb5635ebcaa6a114e48d9cf23d37fc4e9017 (patch) | |
tree | a26ad2430da36dea249328e02a574fdc36e3a386 /unix | |
parent | cd4ea3194fc39818bd06e1ffec598e4230befcf5 (diff) | |
parent | f21757bb59b183ee82e709542e8d741db5648e9a (diff) | |
download | tcl-64a4cb5635ebcaa6a114e48d9cf23d37fc4e9017.zip tcl-64a4cb5635ebcaa6a114e48d9cf23d37fc4e9017.tar.gz tcl-64a4cb5635ebcaa6a114e48d9cf23d37fc4e9017.tar.bz2 |
merge trunk
Diffstat (limited to 'unix')
-rw-r--r-- | unix/dltest/pkgb.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c index fe0d365..9884a64 100644 --- a/unix/dltest/pkgb.c +++ b/unix/dltest/pkgb.c @@ -30,6 +30,8 @@ static int Pkgb_SubObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int Pkgb_UnsafeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int Pkgb_DemoObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* *---------------------------------------------------------------------- @@ -93,7 +95,33 @@ Pkgb_UnsafeObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1)); + return Tcl_EvalEx(interp, "list unsafe command invoked", -1, TCL_EVAL_GLOBAL); +} + +#if (TCL_MAJOR_VERSION > 8) +const char *Tcl_GetDefaultEncodingDir(void) +{ + int numDirs; + Tcl_Obj *first, *searchPath = Tcl_GetEncodingSearchPath(); + + Tcl_ListObjLength(NULL, searchPath, &numDirs); + if (numDirs == 0) { + return NULL; + } + Tcl_ListObjIndex(NULL, searchPath, 0, &first); + + return Tcl_GetString(first); +} +#endif + +static int +Pkgb_DemoObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetDefaultEncodingDir(), -1)); return TCL_OK; } @@ -121,16 +149,16 @@ Pkgb_Init( { int code; - if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, "8.5-9.1", 0) == NULL) { return TCL_ERROR; } - code = Tcl_PkgProvide(interp, "Pkgb", "2.3"); + code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL); if (code != TCL_OK) { return code; } Tcl_CreateObjCommand(interp, "pkgb_sub", Pkgb_SubObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "pkgb_unsafe", Pkgb_UnsafeObjCmd, NULL, - NULL); + Tcl_CreateObjCommand(interp, "pkgb_unsafe", Pkgb_UnsafeObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "pkgb_demo", Pkgb_DemoObjCmd, NULL, NULL); return TCL_OK; } @@ -158,10 +186,10 @@ Pkgb_SafeInit( { int code; - if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, "8.5-9.1", 0) == NULL) { return TCL_ERROR; } - code = Tcl_PkgProvide(interp, "Pkgb", "2.3"); + code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL); if (code != TCL_OK) { return code; } |