2001/10/02
CHAPTER 4 HP-GL/2 - 9
4.
COMMAND SYNTAX
An HP-GL and HP-GL/2 command can consist of up to four items: a mnemonic, a parameter field, a
separator and a terminator.
4.1.
Mnemonic
The two-letter mnemonic is the name of the command and should help remind you of its function.
4.2.
Parameters
Some commands have parameters following the instruction mnemonic. Multiple parameters must have
separators between them. Parameters are shown in italics. Optional parameters are surrounded by square
brackets. Parameters that can be repeated are followed by "...".
•
Integer - integers are allowed in the range -2
30
and 2
30
- 1. Real numbers specified for a parameter that should
be an integer are rounded to the nearest integer.
•
Clamped integer - integers are allowed in the range -32768 and 32767. Parameters outside this range are
converted (clamped) to the nearest integer within the range, for example 40,000 will be clamped to 32767.
Non-integers are converted to the nearest integer.
•
Real number - real numbers whose integer part is in the range -230 to 230 - 1. Accuracy to at least 6
significant digits is guaranteed. If a number outside the range is specified the entire command is ignored.
The decimal point can be omitted when the number has no fractional part.
•
Clamped real number - real numbers whose integer part is in the range -32768 to 32767. Parameters outside
this range are converted (clamped) to the nearest real number within the range. The decimal point can be
omitted when the number has no fractional part.
Text parameters are referred to as labels and can consist of any sequence of characters.
4.3.
Separators
If an HP-GL/2 instruction accepts more than one parameter, you must put spaces or a comma between the
parameters to separate them.
4.4.
Terminator
Most commands are terminated implicitly by the first letter of the next instruction mnemonic. A semi-colon
may be used to explicitly terminate a command. However, the final command issued before quitting HP-
GL/2 mode must be terminated with a semi-colon. Since a terminator is almost always optional it is shown
surrounded by square brackets.