[Orxonox-commit 850] r2215 - media/tcl

landauf at orxonox.net landauf at orxonox.net
Tue Jul 28 17:37:28 CEST 2009


Author: landauf
Date: 2009-07-28 17:37:28 +0200 (Tue, 28 Jul 2009)
New Revision: 2215

Modified:
   media/tcl/init.tcl
Log:
even more compatible compatibility mode (tcl8.4 seems incompatible to compatibility)

Modified: media/tcl/init.tcl
===================================================================
--- media/tcl/init.tcl	2009-07-28 14:54:36 UTC (rev 2214)
+++ media/tcl/init.tcl	2009-07-28 15:37:28 UTC (rev 2215)
@@ -210,37 +210,60 @@
         }
 
         # define the modified version of unknown
-        proc unknown args {
-            global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length
+        # we implement two versions, because tcl8.4 complains if this fork is moved inside [unknown]
+        if {[info tclversion] >= 8.5} {
+            # version >= 8.5
+            proc unknown args {
+                global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length
 
-            set cmd [concat ::tcl::unknown $args]
-            if {[info tclversion] < 8.5} {
-                set errorcode [catch {eval $cmd} result]
-            } else {
+                set cmd [concat ::tcl::unknown $args]
                 set errorcode [catch {eval $cmd} result options]
-            }
-            set resultlist [split $result]
-            set success 1
+                set resultlist [split $result]
+                set success 1
 
-            if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} {
-                for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} {
-                    if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} {
-                        set success 0
-                        break
+                if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} {
+                    for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} {
+                        if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} {
+                            set success 0
+                            break
+                        }
                     }
+                } else {
+                    set success 0
                 }
-            } else {
-                set success 0
+
+                if {!$success} {
+                    return -code $errorcode -options $options $result
+                } else {
+                    return [query $args]
+                }
             }
+        } else {
+            # version < 8.5
+            proc unknown args {
+                global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length
 
-            if {!$success} {
-                if {[info tclversion] < 8.5} {
+                set cmd [concat ::tcl::unknown $args]
+                set errorcode [catch {eval $cmd} result]
+                set resultlist [split $result]
+                set success 1
+
+                if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} {
+                    for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} {
+                        if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} {
+                            set success 0
+                            break
+                        }
+                    }
+                } else {
+                    set success 0
+                }
+
+                if {!$success} {
                     return -code $errorcode $result
                 } else {
-                    return -code $errorcode -options $options $result
+                    return [query $args]
                 }
-            } else {
-                return [query $args]
             }
         }
 




More information about the Orxonox-commit mailing list