# Author: Ferdi Franceschini (ffr@ansto.gov.au) # Parses a subset of DMC2280 commands and returns the corresponding command # which is defined in dmc2280Server.tcl # dmc2280 has two letter commands as follows #parses CM exp, _CM, {TP,TD}, CM=exp, CM, CM # axis=ABCDEFGH, num=01234567 proc parse {cmdst args} { # CM exp, handles MG if {[string length $args] > 0} {return "$cmdst $args"} # _CM, {TP,TD} get an axis property or position set num [scan $cmdst {_%2s%1[ABCDEFGH]} cmd an]; if {$num == 2} {return "dmget $cmd $an"} set num [scan $cmdst {%2s%1[ABCDEFGH]} cmd axis]; if {$num == 2 && [string first $cmd "TD TP"] != -1} { return "dmget $cmd $axis"; } # CM=exp # Try # set line "DPB=(_TPB - 7818915)*(25000/8192) + 0" # parse $line set cmdlst [split $cmdst =]; if {[llength $cmdlst] == 2} { set num [scan [lindex $cmdlst 0] {%2s%1[ABCDEFGH0-7]} cmd axis]; return "dmset $cmd $axis [lindex $cmdlst 1]"; } # CM set num [scan $cmdst {%2s%1[ABCDEFGH0-7]} cmd par]; if {$num == 2} {return "dmcall $cmd $par"} set num [scan $cmdst {_%2s%1[ABCDEFGH0-7]} cmd par]; if {$num == 2} {return "dmcall $cmd $par"} return $cmdst; }