1#!/usr/local/bin/tclsh 2 3# 4# tclx_compat.tcl 5# $Id: tclx_compat.tcl,v 1.2 1996/10/07 18:33:44 johnh Exp $ 6# 7 8proc getclock {} { 9 return [clock seconds] 10} 11 12proc fmtclock {seconds format} { 13 return [clock format $seconds -format $format] 14} 15 16# csubstr 17proc cindex {s i} { 18} 19proc clength {s} { 20} 21 22# random in Tcl---courtesy of Don Libes, slightly hacked since then. 23proc random {args} { 24 global _ran 25 26 if [llength $args]>1 { 27 set _ran [lindex $args 1] 28 } else { 29 set period 233280 30 if [info exists _ran] { 31 set _ran [expr ($_ran*9301 + 49297) % $period] 32 } else { 33 set _ran [expr [clock seconds] % $period] 34 } 35 return [expr int($args*($_ran/double($period)))] 36 } 37} 38 39# system 40# from the Tcl test suite 41proc unlink {fn} { 42 global tcl_platform 43 if {$tcl_platform(platform) == "macintosh"} { 44 catch {rm -f $name} 45 } else { 46 catch {exec rm -f $name} 47 } 48} 49 50proc frename {a b} { 51 global tcl_platform 52 if {$tcl_platform(platform) == "macintosh"} { 53 catch {mv -f $a $b} 54 } else { 55 catch {exec mv -f $a $b} 56 } 57} 58 59