PSI sics-cvs-psi-2006
This commit is contained in:
@@ -32,6 +32,7 @@ proc writeFloatVar {alias var} {
|
||||
clientput [format "ERROR: failed to read %s, %s" $var $val]
|
||||
return
|
||||
} else {
|
||||
set val [string trim $val]
|
||||
set ret [catch {expr $val * 1.0} val]
|
||||
if { $ret == 0} {
|
||||
nxscript putfloat $alias [expr $val * 1.0 ]
|
||||
@@ -40,14 +41,36 @@ proc writeFloatVar {alias var} {
|
||||
}
|
||||
}
|
||||
}
|
||||
#==========================================================================
|
||||
proc writeIntVar {alias var} {
|
||||
set ret [catch {set val [SplitReply [$var]]} val]
|
||||
if { $ret != 0} {
|
||||
clientput [format "ERROR: failed to read %s, %s" $var $val]
|
||||
return
|
||||
} else {
|
||||
set val [string trim $val]
|
||||
set ret [catch {expr $val * 1.0} val]
|
||||
if { $ret == 0} {
|
||||
nxscript putint $alias [expr int($val * 1.0) ]
|
||||
} else {
|
||||
clientput "ERROR: bad value $val when reading $var"
|
||||
}
|
||||
}
|
||||
}
|
||||
#=========================================================================
|
||||
proc writeTextVar {alias var} {
|
||||
set ret [catch {set val [SplitReply [$var]]} val]
|
||||
set ret [catch {$var} val]
|
||||
if { $ret != 0} {
|
||||
clientput [format "ERROR: failed to read %s" $var]
|
||||
return
|
||||
} else {
|
||||
nxscript puttext $alias $val
|
||||
set index [string first = $val]
|
||||
if {$index >= 0} {
|
||||
set txt [string trim [string range $val [expr $index + 1] end]]
|
||||
nxscript puttext $alias $txt
|
||||
} else {
|
||||
clientput [format "ERROR: failed to read %s" $var]
|
||||
}
|
||||
}
|
||||
}
|
||||
#========================================================================
|
||||
@@ -57,7 +80,7 @@ proc writeTextAttribute {attName var} {
|
||||
clientput [format "ERROR: failed to read %s" $var]
|
||||
return
|
||||
} else {
|
||||
nxscript putglobal $attName $val
|
||||
nxscript putglobal $attName [string trim $val]
|
||||
}
|
||||
}
|
||||
#=======================================================================
|
||||
|
||||
Reference in New Issue
Block a user