Support pre-8.5 TCL's by providing our own lreverse in ltrace.exp
authorPetr Machata <pmachata@redhat.com>
Wed, 6 Nov 2013 11:10:18 +0000 (12:10 +0100)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:23 +0000 (20:38 +0900)
testsuite/lib/ltrace.exp

index 494b3c8..abb32f6 100644 (file)
@@ -38,6 +38,18 @@ set LTRACE_OPTIONS {}
 set LTRACE_ARGS {}
 set LTRACE_TEMP_FILES {}
 
+# Pre-8.5 TCL doesn't have lreverse.  The following is taken from:
+#  http://www2.tcl.tk/17188
+
+if {[info command lreverse] == ""} {
+    proc lreverse l {
+        set r {}
+        set i [llength $l]
+        while {[incr i -1]} {lappend r [lindex $l $i]}
+        lappend r [lindex $l 0]
+    }
+}
+
 # ltrace_compile SOURCE DEST TYPE OPTIONS 
 #
 # Compile PUT(program under test) by native compiler.   ltrace_compile runs