ad_decode argsWhat it does:
this procedure is analogus to sql decode procedure. first parameter is the value we want to decode. this parameter is followed by a list of pairs where first element in the pair is convert from value and second element is convert to value. last value is default value, which will be returned in the case convert from values matches the given value to be decodedDefined in: /web/philip/packages/acs-core/utilities-procs.tcl
Source code:
set num_args [llength $args] set input_value [lindex $args 0] set counter 1 while { $counter < [expr $num_args - 2] } { lappend from_list [lindex $args $counter] incr counter lappend to_list [lindex $args $counter] incr counter } set default_value [lindex $args $counter] if { $counter < 2 } { return $default_value } set index [lsearch -exact $from_list $input_value] if { $index < 0 } { return $default_value } else { return [lindex $to_list $index] }