From 0a295dc6a12b98b8e2e9c99eb84d02bdf9ea2730 Mon Sep 17 00:00:00 2001 From: mescalinum Date: Sat, 12 Sep 2009 20:35:08 +0000 Subject: make code Tcl 8.4 compatible svn path=/trunk/externals/tclpd/; revision=12320 --- tcl_setup.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tcl_setup.cxx b/tcl_setup.cxx index c66b929..a1c66bb 100644 --- a/tcl_setup.cxx +++ b/tcl_setup.cxx @@ -59,6 +59,10 @@ void tclpd_interp_error(int result) { post(" (see stderr for details)"); fprintf(stderr, "------------------- Tcl error: -------------------\n"); + + // Tcl_GetReturnOptions and Tcl_DictObjGet only available in Tcl >= 8.5 + +#if ((TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || (TCL_MAJOR_VERSION > 8)) Tcl_Obj* dict = Tcl_GetReturnOptions(tcl_for_pd, result); Tcl_Obj* errorInfo = NULL; Tcl_Obj* errorInfoK = Tcl_NewStringObj("-errorinfo", -1); @@ -66,5 +70,9 @@ void tclpd_interp_error(int result) { Tcl_DictObjGet(tcl_for_pd, dict, errorInfoK, &errorInfo); Tcl_DecrRefCount(errorInfoK); fprintf(stderr, "%s\n", Tcl_GetStringFromObj(errorInfo, 0)); +#else + fprintf(stderr, "Backtrace not available in Tcl < 8.5. Please upgrade Tcl.\n"); +#endif + fprintf(stderr, "--------------------------------------------------\n"); } -- cgit v1.2.1