added "" to all string/enum values
This commit is contained in:
56
ca
56
ca
@@ -1,7 +1,10 @@
|
||||
#!/usr/bin/tclsh
|
||||
# $Id: ca,v 1.8 2003/04/10 12:53:36 zimoch Exp $
|
||||
# $Id: ca,v 1.9 2003/04/10 14:10:21 zimoch Exp $
|
||||
# $Source: /cvs/G/EPICS/App/scripts/ca,v $
|
||||
# $Log: ca,v $
|
||||
# Revision 1.9 2003/04/10 14:10:21 zimoch
|
||||
# added "" to all string/enum values
|
||||
#
|
||||
# Revision 1.8 2003/04/10 12:53:36 zimoch
|
||||
# added -hex flag
|
||||
#
|
||||
@@ -21,8 +24,8 @@
|
||||
|
||||
regsub -all {\$} {ca* by Dirk Zimoch
|
||||
$Source: /cvs/G/EPICS/App/scripts/ca,v $
|
||||
$Revision: 1.8 $
|
||||
$Date: 2003/04/10 12:53:36 $} {} version
|
||||
$Revision: 1.9 $
|
||||
$Date: 2003/04/10 14:10:21 $} {} version
|
||||
|
||||
set auto_path [concat $env(SLSBASE)/lib/tcl $auto_path]
|
||||
package require Epics
|
||||
@@ -99,27 +102,34 @@ proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} {
|
||||
set sevr $SEVR
|
||||
set time $TIME
|
||||
}
|
||||
if {[lsearch $flags -hex] != -1 &&
|
||||
[lsearch {DBF_CHAR DBF_SHORT DBF_LONG} $TYPE] != -1} {
|
||||
foreach val $value {
|
||||
lappend formatted [format "0x%x" $val]
|
||||
}
|
||||
set value [list $formatted]
|
||||
} elseif [info exists PREC] {
|
||||
foreach val $value {
|
||||
if {$PREC < 0} {
|
||||
lappend formatted [format "%.[expr -$PREC]e" $val]
|
||||
} else {
|
||||
lappend formatted [format "%.${PREC}f" $val]
|
||||
}
|
||||
}
|
||||
set value [list $formatted]
|
||||
} elseif {$SIZE == 1 && [llength $value] != 1} {
|
||||
set value \"$value\"
|
||||
} else {
|
||||
if {$SIZE == 1} {
|
||||
set value [list $value]
|
||||
}
|
||||
|
||||
foreach val $value {
|
||||
if [info exists PREC] {
|
||||
if {$PREC < 0} {
|
||||
set val [format "%.[expr -$PREC]e" $val]
|
||||
} else {
|
||||
set val [format "%.${PREC}f" $val]
|
||||
}
|
||||
}
|
||||
if {[lsearch $flags -hex] != -1} {
|
||||
if [catch {
|
||||
set val [format "0x%x" [expr int($val)]]
|
||||
} message] {
|
||||
puts stderr "error $message"
|
||||
}
|
||||
}
|
||||
if {$TYPE == "DBF_STRING" || $TYPE == "DBF_ENUM"} {
|
||||
set val \"$val\"
|
||||
}
|
||||
lappend formatted $val
|
||||
}
|
||||
if {$SIZE > 1} {
|
||||
set formatted \{[join $formatted]\}
|
||||
} else {
|
||||
set formatted [lindex $formatted 0]
|
||||
}
|
||||
if {[lsearch $flags -stat] != -1 || $sevr != "NO_ALARM"} {
|
||||
set status " (SEVR:$sevr STAT:$stat)"
|
||||
} else {
|
||||
@@ -145,7 +155,7 @@ proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} {
|
||||
"-nostat" {set status ""}
|
||||
}
|
||||
}
|
||||
return [concat $time $channel $value $EGU $status]
|
||||
return [concat $time $channel $formatted $EGU $status]
|
||||
}
|
||||
|
||||
proc monitor {channel io value stat sevr time} {
|
||||
|
||||
Reference in New Issue
Block a user