Introduction to Macros in GHS (Applies to GHS/BHS)

"Macros" are found in various kinds computer programs. The "mainline application" programs such as word processors, spread sheets and data-base programs often provide something called a "macro" facility. "Macro" literally means "large", and in computer jargon it generally refers to a command which may be made up of a large number of other commands.
Most of the macro facilities found in application programs are built-in versions of what was a common utility a few years ago: the "keyboard macro" program. They function basically by recording keystrokes, allowing you to collect the keystrokes as a named "macro" and "play them back" at a later time by invoking the macro name.
However such "macro" facilities are awkward and of limited use compared to an older tradition in which the macro is an extension of a programming language. Most assembly languages have macros of this type as do a few higher- level languages. Even DOS, which is itself a rudimentary language, has a macro facility known as the "batch file". It is this type of "language-based macro" which BHS implements; and in the following discussion, the term "macro" will be used to mean this kind of macro.
The concept of the macro is very simple: a macro is a collection of commands which, when the macro name is invoked, causes those commands to be executed. This alone is a powerful thing; but its power is vastly increased when "parameter substitution" is performed.

 Previous document Back