- In Microsoft Word and other programs, a macro is a saved
sequence of commands or keyboard strokes that can be stored and then recalled
with a single command or keyboard stroke.
- In computers, a macro (for "large"; the opposite of "micro")
is any programming or user interface that, when used, expands into something
larger. The original use for "macro" or "macro definition"
was in computer assembler language before higher-level, easier-to-code languages
became more common. In assembler language, a macro definition defines how
to expand a single language statement or computer instruction into a number
of instructions. The macro statement contains the name of the macro definition
and usually some variable parameter information. Macros were (and are) useful
especially when a sequence of instructions is used a number of times (and
possibly by different programmers working on a project). Some pre-compilers
also use the macro concept. In general, however, in higher-level languages,
any language statement is about as easy to write as an assembler macro statement.
Assembler macros generate instructions inline with the rest of a program.
More elaborate sequences of instructions that are used frequently by more
than one program or programmer are encoded in subroutines that can be
branched to from or assembled into a program.
|