develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #118225] Re: Bleadperl v5.19.0-57-g6d5abc6 breaksSREZIC/Tk-804.031.tar.gz

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
May 28, 2013 18:47
Subject:
Re: [perl #118225] Re: Bleadperl v5.19.0-57-g6d5abc6 breaksSREZIC/Tk-804.031.tar.gz
Message ID:
20130528184712.GP3729@plum.flirble.org
On Tue, May 28, 2013 at 11:32:31AM -0700, slaven@rezic.de wrote:

> Commit c6441755d78aaa29725c8c2ff91b244f7a25d967 in
> git://github.com/eserte/perl-tk seems to fix it. Unfortunately I don't
> know why the "#undef bool" was ever done, the changelogs are quite
> sparse here... maybe some misbehaving compilers?

Having cloned the history from gitpan, I'm going to have a guess that it's
due to this:

diff --git a/pTk/mTk/generic/tkEntry.c b/pTk/mTk/generic/tkEntry.c
index b3507d8..ca3b006 100644
--- a/pTk/mTk/generic/tkEntry.c
+++ b/pTk/mTk/generic/tkEntry.c


 static int
 EntryValidate(entryPtr, cmd, string)
-     register Entry *entryPtr; /* Entry that needs validation. */
-     register LangCallback *cmd;       /* Validation command (NULL-terminated
+     register Entry *entryPtr;  /* Entry that needs validation. */
+     register LangCallback *cmd;        /* Validation command (NULL-terminated
                                 * string). */
      char *string;
 {
-    int code;
-    Arg result;
+    register Tcl_Interp *interp = entryPtr->interp;
+    int code, bool;
 
     code = LangDoCallback(entryPtr->interp, cmd, 1, 1, "%s", string);
 
+    /*
+     * We accept TCL_OK and TCL_RETURN as valid return codes from the
+     * command callback.
+     */
     if (code != TCL_OK && code != TCL_RETURN) {
-       Tcl_AddErrorInfo(entryPtr->interp,
-                "\n\t(in validation command executed by entry)");
-       Tcl_BackgroundError(entryPtr->interp);
+       Tcl_AddErrorInfo(interp, "\n\t(in validation command executed by ");
+       Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->tkwin));
+       Tcl_AddErrorInfo(interp, ")");
+       Tcl_BackgroundError(interp);
        return TCL_ERROR;
     }
 
-    result = Tcl_ResultArg(entryPtr->interp);
-
-    if (Tcl_GetBoolean(entryPtr->interp,  result, &code) != TCL_OK) {
-       Tcl_AddErrorInfo(entryPtr->interp,
-                "\nValid Tcl Boolean not returned by validation command");
-       Tcl_BackgroundError(entryPtr->interp);
-       Tcl_SetResult(entryPtr->interp, (char *) NULL, TCL_STATIC);
+    /*
+     * The command callback should return an acceptable Tcl boolean.
+     */
+    if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp),
+                             &bool) != TCL_OK) {



which adds a local variable named bool. I guess that this is imported code
from upstream Tk.

Having a #define for bool would not be compatible with that code.

That code is still present today. It's wrapped with #ifndef _LANG
which seems to have been added by you in

commit 1c1516490f0fe5d017db57a3c2ca11251b16e1c3
Author: Slaven Rezic <slaven@rezic.de>
Date:   Tue Dec 4 13:03:29 2007 -0800

    import Tk 804.027_502 from CPAN
    
    git-cpan-module:   Tk
    git-cpan-version:  804.027_502
    git-cpan-authorid: SREZIC
    git-cpan-file:     authors/id/S/SR/SREZIC/Tk-804.027_502.tar.gz


I don't know the significance of _LANG, but if there's a platform where it
isn't defined, that code is no longer going to compile, thanks to that
variable named "bool".

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About