::tclinterpTop, Main, Index
CommandsTop, Main, Index
array2list [::tclinterp]Top, Main, Index
Create list from doubleArray object
Parameters
array | DoubleArray object. |
length | Number of elements in doubleArray. |
Return value
list
proc ::tclinterp::array2list {array length} { # Create list from doubleArray object # array - doubleArray object # length - number of elements in doubleArray # Returns: list for {set i 0} {$i<$length} {incr i} { lappend list [::tclinterp::doubleArray_getitem $array $i] } return $list }
arrays2lists [::tclinterp]Top, Main, Index
Create lists from doubleArray objects, and set these lists to variables
Parameters
varNames | List of variables names. |
arrays | List of doubleArray. |
lengths | List of doubleArray lengths. |
Return value
variables with lists are set in caller's scope
proc ::tclinterp::arrays2lists {varNames arrays lengths} { # Create lists from doubleArray objects, and set these lists to variables # varNames - list of variables names # arrays - list of doubleArray # lengths - list of doubleArray lengths # Returns: variables with lists are set in caller's scope if {[llength $varNames]!=[llength $arrays]} { error "Length of varName list '[llength $varNames]' must be equal to length of array list '[llength $arrays]'" } elseif {[llength $varNames]!=[llength $lengths]} { error "Length of varName list '[llength $varNames]' must be equal to length of lengths list '[llength $lengths]'" } foreach varName $varNames array $arrays length $lengths { uplevel 1 [list set $varName [::tclinterp::array2list $array $length]] } return }
deleteArrays [::tclinterp]Top, Main, Index
Deletes doubleArray objects
Parameters
args | List of arrays objects. |
proc ::tclinterp::deleteArrays {args} { # Deletes doubleArray objects # args - list of arrays objects foreach arg $args { ::tclinterp::delete_doubleArray $arg } return }
deleteDoubleps [::tclinterp]Top, Main, Index
Deletes doublep objects
Parameters
args | List of doublep objects. |
proc ::tclinterp::deleteDoubleps {args} { # Deletes doublep objects # args - list of doublep objects foreach arg $args { ::tclinterp::delete_doublep $arg } return }
duplListCheck [::tclinterp]Top, Main, Index
Checks if list contains duplicates.
Parameters
list | List to check. |
Return value
false if there are no duplicates and true if there are.
proc ::tclinterp::duplListCheck {list} { # Checks if list contains duplicates. # list - list to check # Returns: false if there are no duplicates and true if there are. set flag false set new {} foreach item $list { if {[lsearch $new $item] < 0} { lappend new $item } else { set flag true break } } return $flag }
list2array [::tclinterp]Top, Main, Index
Create and initialize doubleArray object from the list
Parameters
list | List of values. |
Return value
array object
proc ::tclinterp::list2array {list} { # Create and initialize doubleArray object from the list # list - list of values # Returns: array object set length [llength $list] set a [::tclinterp::new_doubleArray $length] for {set i 0} {$i<$length} {incr i} { set iElem [@ $list $i] try { ::tclinterp::doubleArray_setitem $a $i $iElem } on error {errmsg erropts} { if {[dget $erropts -errorcode]=="SWIG TypeError"} { error "List must contains only double elements, but get '$iElem'" } else { error "Array creation failed with message '$errmsg' and opts '$erropts'" } } } return $a }
lists2arrays [::tclinterp]Top, Main, Index
Create and initialize doubleArray objects from lists, and set these objects to variables
Parameters
varNames | List of variables names. |
lists | List of lists. |
Return value
variables with doubleArray objects are set in caller's scope
proc ::tclinterp::lists2arrays {varNames lists} { # Create and initialize doubleArray objects from lists, and set these objects to variables # varNames - list of variables names # lists - list of lists # Returns: variables with doubleArray objects are set in caller's scope if {[llength $varNames]!=[llength $lists]} { error "Length of varName list '[llength $varNames]' must be equal to length of lists list '[llength $lists]'" } foreach varName $varNames list $lists { uplevel 1 [list set $varName [::tclinterp::list2array $list]] } return }
newArrays [::tclinterp]Top, Main, Index
Creates doubleArray objects, and set these objects to variables
Parameters
varNames | List of variables names. |
lengths | List of doubleArray's lengths. |
Return value
variables with doubleArray objects are set in caller's scope
proc ::tclinterp::newArrays {varNames lengths} { # Creates doubleArray objects, and set these objects to variables # varNames - list of variables names # lengths - list of doubleArray's lengths # Returns: variables with doubleArray objects are set in caller's scope if {[llength $varNames]!=[llength $lengths]} { error "Length of varName list '[llength $varNames]' must be equal to length of lengths list '[llength $lengths]'" } foreach varName $varNames length $lengths { uplevel 1 [list set $varName [::tclinterp::new_doubleArray $length]] } return }
newDoubleps [::tclinterp]Top, Main, Index
Creates doubleps objects, and set these objects to variables
Parameters
varNames | List of variables names. |
Return value
variables with doubleps objects are set in caller's scope
proc ::tclinterp::newDoubleps {varNames} { # Creates doubleps objects, and set these objects to variables # varNames - list of variables names # Returns: variables with doubleps objects are set in caller's scope foreach varName $varNames { uplevel 1 [list set $varName [::tclinterp::new_doublep]] } return }