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 | c46c79caa21b2d9c1c990e418d10329254651a51 (patch) | |
tree | 1ee266486ce929bb8eb15a56a0042ea99ef5cc1d | |
parent | 2adea0d04ed81999f4c9a17f387a02c92203843a (diff) | |
download | tcl-c46c79caa21b2d9c1c990e418d10329254651a51.zip tcl-c46c79caa21b2d9c1c990e418d10329254651a51.tar.gz tcl-c46c79caa21b2d9c1c990e418d10329254651a51.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; } |