Magic Mailing List |
|
From: R. Timothy Edwards (tim AT stravinsky DOT jhuapl.edu) Date: Fri Jun 13 2003 - 12:35:41 EDT
Dear Charles, Okay, okay, this stuff should go in the tutorials, I know. . . The use of ":" prefixing magic commands is everywhere in the tutorials. The original (non-Tcl version) of magic would take this into consideration for all commands, including those read from files. This happens to be just about the only instance in magic where magic's syntax breaks Tcl syntax. The neat trick you showed me is that by using ";" (always an alternative to ":" in magic, but not widely documented), Tcl treats the character as a command-end delimiter, so at the beginning of a line it's effectively a no-op, so it's transparent to Tcl whether stuck on the command line or added to a sourced Tcl file like ".magic". I added the extra processing of units to the "box" command. However, this is a general-purpose routine "cmdParseCoord" and is used throughout magic, so the same syntax applies to "move", "grid", "stretch", etc., but is probably not implemented everywhere it should be (notify me of any omissions you find). The "usage" statement for command "box" is now: Usage: box width [num] box height [num] box size [width height] box position [llx lly] [-edit] box values [llx lly urx ury] [-edit] box move <direction> <distance> box grow <direction> <distance> box shrink <direction> <distance> box [llx lly urx ury] [-edit] (syntax backwardly compatible) The "-edit" flag allows you to specify coordinates in the frame of reference of the edit cell instead of the root cell. The "size", "grow", and "shrink" options are also pretty useful; esp. note that "box grow c 1" (c is for "center") expands the box by 1 unit in all directions. The first five options will return the current value if the value is not indicated. Recently, I also made a change to commands like "move" and "copy" so that they accept all compass directions, not just n-s-e-w. Sometimes I want to copy a cell or paint catecorner to the current position, so, e.g., "copy nw 100" allows me to do that. Finally, another recent change was to add options to the "array" command, to get values of an array. The option "array pitch" is most useful, although currently it doesn't do the transformation from the edit cell to root, so you can get negative values for pitch, or have x and y pitches reversed from what you might expect. Regards, Tim
|
|