diff options
author | dgp <dgp@users.sourceforge.net> | 2012-12-07 17:03:39 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-12-07 17:03:39 (GMT) |
commit | cee1ce03b712770dc55c7c3b4b65c5026546d53f (patch) | |
tree | 1ee266486ce929bb8eb15a56a0042ea99ef5cc1d | |
parent | a4a99b73219c5f30bd18f6349427c834691b2c46 (diff) | |
download | tcl-cee1ce03b712770dc55c7c3b4b65c5026546d53f.zip tcl-cee1ce03b712770dc55c7c3b4b65c5026546d53f.tar.gz tcl-cee1ce03b712770dc55c7c3b4b65c5026546d53f.tar.bz2 |
Source compat, rather than stubs compat demo.
-rw-r--r-- | unix/dltest/pkgb.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c index 1a362ef..9884a64 100644 --- a/unix/dltest/pkgb.c +++ b/unix/dltest/pkgb.c @@ -99,8 +99,19 @@ Pkgb_UnsafeObjCmd( } #if (TCL_MAJOR_VERSION > 8) -# define Tcl_GetDefaultEncodingDir ((const char *(*)(void)) \ - ((&(tclStubsPtr->tcl_PkgProvideEx))[341])) +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 @@ -110,10 +121,6 @@ Pkgb_DemoObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - if(!Tcl_GetDefaultEncodingDir) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("not supported", -1)); - return TCL_ERROR; - } Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetDefaultEncodingDir(), -1)); return TCL_OK; } |