The following macro prints a Fortran array slice. This macro, like others shown in this chapter, relies heavily on Tcl and uses unique CLI commands sparingly.
After invoking this macro, the CLI prints a two-dimensional slice (i1:i2:i3, j1:j2:j3) of a Fortran array to a numeric field whose width is specified by the
width argument. This width doesn’t include a leading minus sign (-).
All but one line is standard Tcl. This line uses the dprint command to obtain the value of one array element. This element’s value is then captured into a variable. The CLI
capture command allows a value that is normally printed to be sent to a variable. For information on the difference between values being displayed and values being returned, see
“About CLI Output”.