tcl driver support

Name

tcl driver support -- tcl driver support functions.

Synopsis

package require VMUSBDriverSupport

::VMUSBDriverSupport::convertVmUSB name

::VMUSBDriverSupport::convertVmUSBReadoutList name

::VMUSBDriverSupport::validInt value ?low ?high??

::VMUSBDriverSupport::validReal value ?low ?high??

::VMUSBDriverSupport::valideEnum value set

::VMUSBDriverSupport::validBool value

::VMUSBDriverSupport::validList value ?fewest ?most ?checker ?args????

::VMUSBDriverSupport::validIntList value ?fewest ?most ?low ?high????

::VMUSBDriverSupport::validBoolList value ?fewest ?most???

DESCRIPTION

This package provides utiltities that are of use/interest to Tcl device driver modules for the VM-USB readout framework. The attempt is to centralize/factor common code out of driver modules that is commonly used.

COMMANDS

::VMUSBDriverSupport::convertVmUSB name

Converts a swig CVMUSB object identifier into a usable CVMUSB object. Once converted the driver can invoke methods on that object. name is the object passed in to the driver. The return value will be the name of the new object.

::VMUSBDriverSupport::convertVmUSBReadoutList name

Converts a CVMUSBReadoutList swig object identifier into an object. Once converted, the object methods can be directl invoked. name is the name passed in to the method by the framework. the return value is the name of the object.

::VMUSBDriverSupport::validInt value ?low ?high??

Provides type checking and optional range checking for integer data. This is most often called to validate an integer driver option.

Throws an error if value is not a valid integer. Additionally, if low is not empty, an error is thrown if $value < $low. Similarly if high is not empty an error is thrown if $value > $high.

::VMUSBDriverSupport::validReal value ?low ?high??

Provides type and optional range checking for real parameters.

If value is not valid real number this proc throws an error. Furthermore if low is not blank, an error is thrown if $value < $low. Similarly if high is not blank, an error is thrown if $value > $high.

::VMUSBDriverSupport::valideEnum value set

Throw an error if value is not one of the strings in the Tcl list set

::VMUSBDriverSupport::validBool value

Throws an error if value is not recognizable as a boolean by Tcl. http://www.tcl.tk/man/tcl8.5/TclLib/GetInt.htm describes the set of values that are recognized as valid booleans.

::VMUSBDriverSupport::validList value ?fewest ?most ?checker ?args????

Throws an error if value is not a valid Tcl list. Futhermore if fewest is not blank, an error is thrown if [llength $value] < $fewest. Similarly, if most is not blank, an error is thrown if [llength $value] > $most.

checker is a script which if not blank is called for each element of value. checker is called as follows: $checker $element {*}$args where element is an element of the list. The intent of this is to provide support for type/range checking each element of the list.

One sample use of this proc is: ::::VMUSBDriverSupport::validList $value 32 32 ::::VMUSBDriverSupport::validInt 0 4095 which ensures that value is a valid list that contains exactly 32 integer elements in the range [0..4095].

::VMUSBDriverSupport::validIntList value ?fewest ?most ?low ?high????

This is a convenience procedure that uses validList and validInt to determine if value is a valid list of integer values with optional range constraints.

::VMUSBDriverSupport::validBoolList value ?fewest ?most???

This is a convenience procedure that uses validList and validBool to determine if value is a valid list of boolean values.