From cee1ce03b712770dc55c7c3b4b65c5026546d53f Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 7 Dec 2012 17:03:39 +0000 Subject: Source compat, rather than stubs compat demo. --- unix/dltest/pkgb.c | 19 +++++++++++++------ 1 file 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; } -- cgit v0.12