269 |
# Reads in settings from ~/ascdata/ascend-config if that is available. |
# Reads in settings from ~/ascdata/ascend-config if that is available. |
270 |
#------------------------------------------------------------------------ |
#------------------------------------------------------------------------ |
271 |
proc Util_do_Read {} { |
proc Util_do_Read {} { |
272 |
global env |
global env ascOrgEnv |
273 |
set configread 0 |
set configread 0 |
274 |
|
|
275 |
if {!$configread && [file exists ~/ascdata/ascend-config] && |
if {!$configread && [file exists ~/ascdata/ascend-config] && |
291 |
# save ~/ascdata/ascend-config. overwrite whatever there. |
# save ~/ascdata/ascend-config. overwrite whatever there. |
292 |
#------------------------------------------------------------------------ |
#------------------------------------------------------------------------ |
293 |
proc Util_do_Save {} { |
proc Util_do_Save {} { |
294 |
global ascUtilVect ascGlobalVect |
global ascUtilVect ascGlobalVect ascOrgEnv |
295 |
|
|
296 |
if {$ascGlobalVect(saveoptions) == 0} { |
if {$ascGlobalVect(saveoptions) == 0} { |
297 |
puts stdout "cannot write ascend configure file" |
puts stdout "cannot write ascend configure file" |
315 |
foreach s $subs { |
foreach s $subs { |
316 |
set varname [Util_Get_Var $s] |
set varname [Util_Get_Var $s] |
317 |
set aname [lindex [split $varname (] 0] |
set aname [lindex [split $varname (] 0] |
318 |
|
set aindex [lindex [split $varname "()"] 1] |
319 |
global $varname |
global $varname |
320 |
# we don't save environment vars |
# we save environment vars unconditionally now; they ar be ignored on read if set by user |
321 |
|
# or wrapper script. |
322 |
if {[string range $varname 0 2] !="env"} { |
if {[string range $varname 0 2] !="env"} { |
323 |
puts $conffile " global $aname" |
puts $conffile " global $aname" |
324 |
puts $conffile " set $varname {[.util.box.main_frm.val_frm.$s get]}" |
puts $conffile " set $varname {[.util.box.main_frm.val_frm.$s get]}" |
325 |
|
} else { |
326 |
|
puts $conffile " global $aname ascOrgEnv" |
327 |
|
puts $conffile " if {\[info exists ascOrgEnv($aindex)\] && \$ascOrgEnv($aindex) != \"\"} {" |
328 |
|
puts $conffile " puts \"Ignoring ascend-config value of $varname in favor of environment.\"" |
329 |
|
puts $conffile " } else {" |
330 |
|
puts $conffile " puts \"Setting $varname from ascend-config.\"" |
331 |
|
puts $conffile " set $varname {[.util.box.main_frm.val_frm.$s get]}" |
332 |
|
puts $conffile " }" |
333 |
} |
} |
334 |
} |
} |
335 |
close $conffile |
close $conffile |