Skip to content

Commit 5fe9d06

Browse files
committed
Update Tcl code to work with both Tcl8 and Tcl9.
1 parent 11cf4db commit 5fe9d06

5 files changed

Lines changed: 36 additions & 35 deletions

File tree

share/axis/tcl/axis.tcl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,26 +1963,26 @@ set metric 0
19631963
set max_speed 1
19641964
set queued_mdi_commands 0
19651965
set max_queued_mdi_commands 10
1966-
trace variable taskfile w update_title
1967-
trace variable machine w update_title
1968-
trace variable taskfile w queue_update_state
1969-
trace variable task_state w queue_update_state
1970-
trace variable task_mode w queue_update_state
1971-
trace variable task_paused w queue_update_state
1972-
trace variable optional_stop w queue_update_state
1973-
trace variable block_delete w queue_update_state
1974-
trace variable interp_pause w queue_update_state
1975-
trace variable interp_state w queue_update_state
1976-
trace variable running_line w queue_update_state
1977-
trace variable highlight_line w queue_update_state
1978-
trace variable spindledir w queue_update_state
1979-
trace variable coord_type w queue_update_state
1980-
trace variable display_type w queue_update_state
1981-
trace variable motion_mode w queue_update_state
1982-
trace variable kinematics_type w queue_update_state
1983-
trace variable on_any_limit w queue_update_state
1984-
trace variable motion_mode w joint_mode_switch
1985-
trace variable queued_mdi_commands w queue_update_state
1966+
trace add variable taskfile write update_title
1967+
trace add variable machine write update_title
1968+
trace add variable taskfile write queue_update_state
1969+
trace add variable task_state write queue_update_state
1970+
trace add variable task_mode write queue_update_state
1971+
trace add variable task_paused write queue_update_state
1972+
trace add variable optional_stop write queue_update_state
1973+
trace add variable block_delete write queue_update_state
1974+
trace add variable interp_pause write queue_update_state
1975+
trace add variable interp_state write queue_update_state
1976+
trace add variable running_line write queue_update_state
1977+
trace add variable highlight_line write queue_update_state
1978+
trace add variable spindledir write queue_update_state
1979+
trace add variable coord_type write queue_update_state
1980+
trace add variable display_type write queue_update_state
1981+
trace add variable motion_mode write queue_update_state
1982+
trace add variable kinematics_type write queue_update_state
1983+
trace add variable on_any_limit write queue_update_state
1984+
trace add variable motion_mode write joint_mode_switch
1985+
trace add variable queued_mdi_commands write queue_update_state
19861986

19871987
set editor_deleted 0
19881988

share/axis/tcl/combobox.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#
2828
# ... and many others over the years.
2929

30-
package require Tk 8.0
30+
package require Tk
3131
package provide combobox 2.2
3232

3333
namespace eval ::combobox {

tcl/bin/pickconfig.tcl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ proc initialize_config {} {
100100
exit
101101
destroy .
102102
} else {
103-
if {[catch {open ~/.linuxcncrc} programin]} {
103+
if {[catch {open $::env(HOME)/.linuxcncrc} programin]} {
104104
return
105105
} else {
106106
set rcstring [read $programin]
@@ -660,7 +660,7 @@ proc prompt_copy configname {
660660
set ncfiles [file normalize [file join $::myconfigs_node ../nc_files]]
661661
file mkdir [file join $::myconfigs_node]
662662

663-
set obsoletedir [file normalize [file join ~ emc2]]
663+
set obsoletedir [file normalize [file join $::env(HOME) emc2]]
664664
if [file isdir $obsoletedir] {
665665
tk_messageBox -title "Copy Configuration Notice" \
666666
-message "A directory named:\n \
@@ -891,20 +891,20 @@ while {1} {
891891
# test for ~/.linuxcncrc file and modify if needed.
892892
# or make this file and add the var.
893893

894-
if {[file exists ~/.linuxcncrc]} {
894+
if {[file exists $::env(HOME)/.linuxcncrc]} {
895895
if {$::inifile == $::last_ini} {
896896
exit
897897
} else {
898-
if {[catch {open ~/.linuxcncrc} programin]} {
898+
if {[catch {open $::env(HOME)/.linuxcncrc} programin]} {
899899
return
900900
} else {
901901
set rcstring [read $programin]
902902
catch {close $programin}
903903
}
904904
set ret [setVal $rcstring PICKCONFIG LAST_CONFIG $::inifile ]
905905
catch {file copy -force $name $name.bak}
906-
if {[catch {open ~/.linuxcncrc w} fileout]} {
907-
puts stdout [msgcat::mc "can't save %s" ~/.linuxcncrc ]
906+
if {[catch {open $::env(HOME)/.linuxcncrc w} fileout]} {
907+
puts stdout [msgcat::mc "can't save %s" $::env(HOME)/.linuxcncrc ]
908908
exit
909909
}
910910
puts $fileout $ret
@@ -914,8 +914,8 @@ while {1} {
914914
}
915915
set newfilestring "# .linuxcncrc is a startup configuration file for LinuxCNC. \n# format is INI like. \n# \[SECTION_NAME\] \n# VARNAME = varvalue \n# where section name is the name of the system writing to this file \n\n# written by pickconfig.tcl \n\[PICKCONFIG\]\nLAST_CONFIG = $::inifile\n"
916916

917-
if {[catch {open ~/.linuxcncrc w+} fileout]} {
918-
puts stderr [msgcat::mc "can't save %s" ~/.linuxcncrc ]
917+
if {[catch {open $::env(HOME)/.linuxcncrc w+} fileout]} {
918+
puts stderr [msgcat::mc "can't save %s" $::env(HOME)/.linuxcncrc ]
919919
exit
920920
}
921921

tcl/linuxcnc.tcl.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace eval linuxcnc {
3232
variable REALTIME @REALTIME@
3333
variable RTS @RTS@
3434
variable CONFIG_DIR {}
35+
variable _dir
3536
foreach _dir [split {@LINUXCNC_CONFIG_PATH@} :] {
3637
lappend CONFIG_DIR [file normalize $_dir]
3738
}
@@ -47,7 +48,7 @@ if {[string first $::linuxcnc::BIN_DIR: $env(PATH)] != 0} {
4748
}
4849

4950
proc linuxcnc::image_search i {
50-
set paths "$linuxcnc::IMAGEDIR $linuxcnc::HOME $linuxcnc::HOME/etc/linuxcnc /etc/linuxcnc ."
51+
set paths "$::linuxcnc::IMAGEDIR $::linuxcnc::HOME $::linuxcnc::HOME/etc/linuxcnc /etc/linuxcnc ."
5152
foreach f $paths {
5253
if [file exists $f/$i] {
5354
return [image create photo -file $f/$i]

tcl/tooledit.tcl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ if {"" == [info command "_"]} {
6262

6363

6464
proc ::tooledit::init { {columns ""} } {
65-
if [file readable ~/.tooleditrc] {
66-
if [catch {source ~/.tooleditrc} msg] {
67-
puts stderr "[_ "Problem reading ~/.tooleditrc"]:\n$msg"
65+
if [file readable $::env(HOME)/.tooleditrc] {
66+
if [catch {source $::env(HOME)/.tooleditrc} msg] {
67+
puts stderr "[_ "Problem reading $::env(HOME)/.tooleditrc"]:\n$msg"
6868
}
6969
if [info exists geometry] {
7070
set ::te(top,restore,geometry) $geometry
@@ -961,7 +961,7 @@ proc ::tooledit::bye {} {
961961

962962
catch {after cancel $::te(afterid)}
963963

964-
if ![file exists ~/.tooleditrc] {
964+
if ![file exists $::env(HOME)/.tooleditrc] {
965965
# first time use presumed, instruct for configuring columns
966966
set used ""
967967
foreach item $::te(items) {
@@ -1001,7 +1001,7 @@ proc ::tooledit::bye {} {
10011001
}
10021002

10031003
if [winfo exists $::te(top)] {
1004-
set fd [open ~/.tooleditrc w]
1004+
set fd [open $::env(HOME)/.tooleditrc w]
10051005
set time [clock format [clock seconds] -format %Y%m%d.%H.%M.%S]
10061006
puts $fd "# $time [format [_ "Created by %s"] [file normalize $::argv0]]"
10071007
puts $fd "\n# [_ "Saved geometry (updated on program termination)"]:"

0 commit comments

Comments
 (0)