magic/doc/html/macro.html

145 lines
5.8 KiB
HTML
Raw Normal View History

<HTML>
<HEAD>
<STYLE type="text/css">
H1 {color: black }
H2 {color: maroon }
H3 {color: #007090 }
A.head:link {color: #0060a0 }
A.head:visited {color: #3040c0 }
A.head:active {color: white }
A.head:hover {color: yellow }
A.red:link {color: red }
A.red:visited {color: maroon }
A.red:active {color: yellow }
</STYLE>
</HEAD>
<TITLE>Magic-8.3 Command Reference</TITLE>
<BODY BACKGROUND=graphics/blpaper.gif>
<H1> <IMG SRC=graphics/magic_title8_3.png ALT="Magic VLSI Layout Tool Version 8.3">
<IMG SRC=graphics/magic_OGL_sm.gif ALIGN="top" ALT="*"> </H1>
<H2>macro</H2>
<HR>
Define or print a key or button macro binding.
<HR>
<H3>Usage:</H3>
<BLOCKQUOTE>
<B>macro</B> [<I>window_type</I>] [<I>option</I>] [<I>key</I> [<I>value</I>]]
<BR><BR>
<BLOCKQUOTE>
where <I>key</I> is the name of a valid key (see below), and
<I>value</I> is a <B>magic</B> command-line command. If
present, <I>window_type</I> must be one of the known valid window
types accepted by the <B>specialopen</B> command (<B>color</B>,
<B>netlist</B>, and <B>wind3d</B>), or a known layout tool
(<B>box</B>, <B>wiring</B>, <B>nettool</B>, or <B>pick</B>). If
omitted, the layout window is assumed by default, unless the command
has been called from inside a window (using the colon or semicolon
escape to the command-line), in which case that window type is
assumed. <P>
In the non-Tcl version of magic, the <I>window_type</I> must be
one of the three valid window types listed above, or <B>layout</B>.
Tool button bindings are hard-coded, fixed, and unknown to the
macro handler. <P>
In the Tcl version of magic, tool types are generated by
procedure and can be modified or overridden. The four tools
listed above are the default tools known to magic. If no window
or tool type is given, then the current tool in the current
active layout window is assumed.<P>
<I>option</I> may be one of the following:
<DL>
<DT> <B>list</B> [<B>-reverse</B>]
<DD> The key bindings are returned in the form of a Tcl list
(Tcl version of magic only). The returned value is a
single list with alternating entries of the macro key and
the macro binding. In Tcl, this list can be treated as a
dictionary type of key:value pairs. With the <B>-reverse</B>
option, the keys and values are reversed, resulting in a
dictionary that can be searched or listed by function.
<DT> <B>help</B>
<DD> Curently, <B>macro help</B> is equivalent to <B>macro</B>
without arguments, and returns a full list of macro names
and their bindings.
<DT> <B>search</B> <I>text</I>
<DD> Return only results which match (all or in part) the string
<I>text</I>. For example, <B>macro search grid</B> will
return all key bindings that include the command <B>grid</B>.
<DT> <B>copy</B> <I>tool_name</I>
<DD> This is a method introduced to allow the interactive creation
of new tools, in the Tcl version of magic. Each tool is defined
specifically by its unique button and key bindings. Because
tools generally keep most of the same default bindings, the
<B>copy</B> option will copy all the existing bindings to the
new tool from the current tool. This can be followed by
switching to the new tool and replacing macros with ones
unique to the tool.
</DL>
</BLOCKQUOTE>
</BLOCKQUOTE>
<H3>Summary:</H3>
<BLOCKQUOTE>
The <B>macro</B> command translates keystrokes typed into
a layout window into <B>magic</B> command-line commands.
When the key <I>key</I> is pressed in a layout window, the
command stored in <I>value</I> is executed relative to that
layout window. The default bindings are specified in the
system <TT>.magic</TT> file, read at startup. These macros
may be arbitrarily rebound using the <B>macro</B> command. <P>
A key <B>macro</B> may be unbound from a command by
passing an empty string ("") for the <I>value</I>. <P>
<I>key</I> is any valid name for a keyboard keypress event.
In its simplest form, this may just be the name of the key,
such as "g" or "X". The space bar key must be quoted in
double-quotes; most other characters may be unquoted.
Control characters may be specified by the two-character
combination of the carat ("^") key followed by a capital
letter, such as "^Z". The use of embedded control characters
is deprecated, as it is incompatible with Tcl syntax. <P>
<I>key</I> may also be specified as any valid X11 name for
a key as defined in the include file <TT>keysymdef.h</TT>
on UNIX systems. This allows specification of function
keys such as "XK_F8" or keypad keys such as "XK_KP_Right". <P>
Buttons are treated just like keys for the purpose of
defining macros. While the official names for buttons
in <TT>keysymdef.h</TT> are "<B>XK_Pointer_Button_1</B>",
etc., the <B>macro</B> command accepts the abbreviated
forms <B>Button1</B>, and so forth. <P>
Finally, key modifiers may be prepended to the key name.
Valid key modifiers are <B>Shift_</B>, <B>Control_</B>,
<B>Alt_</B>, and <B>Meta_</B>, and may be coupled in any
combination. Mouse buttons may also be combined with key
modifiers, so, for example, <B>Shift_Button1</B> is a legal,
unique binding. <P>
</BLOCKQUOTE>
<H3>Implementation Notes:</H3>
<BLOCKQUOTE>
<B>macro</B> is implemented as a built-in window command in <B>magic</B>.
</BLOCKQUOTE>
<H3>See Also:</H3>
<BLOCKQUOTE>
<A HREF=imacro.html><B>imacro</B></A> <BR>
<A HREF=toolchange.html><B>tool</B></A> (Tcl version) <BR>
</BLOCKQUOTE>
<P><IMG SRC=graphics/line1.gif><P>
<TABLE BORDER=0>
<TR>
<TD> <A HREF=commands.html>Return to command index</A>
</TR>
</TABLE>
<P><I>Last updated:</I> March 7, 2020 at 1:06pm <P>
</BODY>
</HTML>