avoid calling Tcl_GetErrorLine() if tcl version < 8.6

This commit is contained in:
stefan schippers 2025-02-11 18:52:24 +01:00
parent 8cad7daed5
commit 2eeeebf715
1 changed files with 15 additions and 0 deletions

View File

@ -1174,12 +1174,27 @@ static int source_tcl_file(char *s)
if(Tcl_EvalFile(interp, s)==TCL_ERROR) {
fprintf(errfp, "Tcl_AppInit() error: can not execute %s, please fix:\n", s);
#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >=6
fprintf(errfp, "Line No: %d\n", Tcl_GetErrorLine(interp));
#endif
fprintf(errfp, "%s", tclresult());
fprintf(errfp, "\n");
#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >=6
my_snprintf(tmp, S(tmp), "tk_messageBox -icon error -type ok -message \
{Tcl_AppInit() err 1: can not execute %s, please fix:\n%s\nLine No: %d\n}",
s, tclresult(), Tcl_GetErrorLine(interp));
#else
my_snprintf(tmp, S(tmp), "tk_messageBox -icon error -type ok -message \
{Tcl_AppInit() err 1: can not execute %s, please fix:\n%s\n}",
s, tclresult());
#endif
if(has_x) {
tcleval( "wm withdraw .");
tcleval( tmp);