Publication 1746-PM001A-US-P
6-8
Writing Programs Using the BASIC Development Language
Macros
There are three types of macros used with the BASIC Development Software. They
are:
•
keystroke macros
temporarily or permanently record a series of keystrokes
and replace them with a single keystroke. Keystroke macros are described in
Chapter 4.
•
programming macros
streamline programming and make your programs
more readable and understandable. The BASIC Development Software comes
with a file called
INCLUDE.BDL,
which contains close to 100 programming
macros. These programming macros are listed and described in detail in
Appendix A. The 1771-DB/B backplane calls are in the INCLUDBB.BDL
file. These backplane calls are listed and described in detail in Appendix A.
Beginning a program with the statement
{$I INCLUDE.BDL}
allows you to use
any of them by simply typing in its macro call, such as
foreground_green()
.
When your program is translated, the 1747–PBASE Translator goes to the
INCLUDE.BDL file to find the BASIC subroutine that corresponds to that
macro call.
•
user-created programming macros
support your programming needs.
While the programming macros described above already exist in the BASIC
Development Software, these are created by you. They are created using a
$MACRO
translator directive described in the next section.
Creating Your Own
Programming Macro
The Macro directive is a translator directive that allows the user to define BASIC
statements as a macro that can be used in the program.
A programming macro must be defined before it can be called, or else a syntax error
results. The maximum number and size of macros defined in a source file is limited
only by the amount of memory available on your personal computer at translation
time. Programming macros
cannot be nested
.
Labels can be defined and used within a macro; however, these labels can be
referenced only from within the body of the macro. The translator assigns a unique
line number for each label in the macro when the program is translated.
The macro call is a string of up to 30 ASCII characters. The character set is defined
to be [0..9, A..Z, a..z,_]. The macro call cannot contain any tabs or spaces, and
must begin with a letter.
Syntax:
{$MACRO [macrocall(%1,%2...%n)]}
{$ENDM}
The variables %1, %2... above refer to parameter values that are passed to the
programming macro. The maximum number of passed parameters, %n, is limited
to 20. The
{$ENDM}
directive marks the end of the macro definition.
Содержание 1747-PBASE
Страница 1: ...BASIC Development Software Catalog Numbers 1747 PBASE Programming Manual ...
Страница 8: ...Publication 1746 PM001A US P Table of Contents vi ...
Страница 34: ...Publication 1746 PM001A US P 2 14 Getting Familiar with Your Development Software ...
Страница 72: ...Publication 1746 PM001A US P 5 8 Manipulating Files ...
Страница 88: ...Publication 1746 PM001A US P 6 16 Writing Programs Using the BASIC Development Language ...
Страница 143: ......