Changeset 5585 for data/media/tcl
- Timestamp:
- Jul 25, 2009, 9:47:30 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
data/media/tcl/init.tcl
r5584 r5585 48 48 proc crossexecute {id args} { 49 49 return -code error "Can't execute a command now" 50 } 51 52 53 # running -- 54 # Returns true if the interpreter is still suposed to be running 55 # This dummy procedure will be changed to it's real implementation by Orxonox itself. 56 57 proc running {} { 58 return 1 59 } 60 61 62 # orxonox::while -- 63 # Works like while but breaks the loop if orxonox::running returns false 64 65 proc ::orxonox::while {condition body} { 66 set condition_cmd [list expr $condition] 67 ::tcl::while {1} { 68 if {![uplevel 1 $condition_cmd] || ![::running]} { 69 break 70 } 71 uplevel 1 $body 72 } 73 } 74 75 76 # orxonox::for -- 77 # Works like for but breaks the loop if orxonox::running returns false 78 79 proc ::orxonox::for {start condition step body} { 80 set condition_cmd [list expr $condition] 81 uplevel 1 $start 82 ::tcl::while {1} { 83 if {![uplevel 1 $condition_cmd] || ![::running]} { 84 break 85 } 86 uplevel 1 $body 87 uplevel 1 $step 88 } 50 89 } 51 90 … … 64 103 65 104 cd $::orxonox::mediapath 66 67 68 # change the source command to use files from the media path69 70 #if {[llength [info command ::tcl::source]] == 0} {71 # rename source ::tcl::source72 #}73 #proc source args {74 # global ::orxonox::mediapath75 #76 # set argc [llength $args]77 # if {$argc != 1 && $argc != 3} {78 # error "wrong # args: should be \"source ?-encoding name? fileName\""79 # }80 # if {$argc == 3} {81 # if {[lindex $args 0] != "-encoding"} {82 # error "bad option \"[lindex $args 0]\": must be -encoding"83 # } else {84 # set file [lindex $args 2]85 # }86 # } else {87 # set file [lindex $args 0]88 # }89 # set orxonoxfile [file join $::orxonox::mediapath $file]90 # if {[file readable $orxonoxfile]} {91 # if {$argc == 1} {92 # return [::tcl::source $orxonoxfile]93 # } else {94 # return [::tcl::source [lindex $args 0] [lindex $args 1] $orxonoxfile]95 # }96 # } else {97 # return [::tcl::source $args]98 # }99 #}100 105 101 106 … … 182 187 global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length 183 188 189 tcl::puts "unknown: $args" 184 190 set errorcode [catch {::tcl::unknown $args} result options] 185 191 set resultlist [split $result] 186 192 set success 1 187 193 tcl::puts "errorcode: $errorcode resultlist: $resultlist" 188 194 if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} { 189 195 for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} { 190 196 if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} { 191 197 set success 0 192 tcl::puts "not equal"193 198 break 194 199 } 195 200 } 196 201 } 197 202 tcl::puts "success: $success" 198 203 if {!$success} { 199 204 return -code $errorcode -options $options $result
Note: See TracChangeset
for help on using the changeset viewer.