|
Variable Formats and Types
Each GPP variable has a format. The format defined how a variable is formatted for output, specifying things like the number of digits used after the decimal point, and whether leading zeros are used or not.
Variable format has no effect on the internal value of the variable. All numeric variables are stored as double-precision floating point numbers. In most cases, when variables are used in expressions, the internal value is used regardless of the format. There are several specific cases when the format is considered (For example, when comparing variables), and these cases will be explicitly identified and explained in this document.
There are 19 predefined GPP formats, as listed below. Their names suggest their intended use, but any variable can be assigned any format.
CHARACTER
COORDINATES
ANGLES
FEED
SPINDLE
DWELL
SEQUENCING
TOOL
USER_1
USER_2
USER_3
USER_4
USER_5
USER_6
USER_7
USER_8
USER_9
USER_10
REAL
There are 2 predefined GPP formats that are used only in the INTERACTION statement (refer to INTERACTION section)
BOOLEAN
MULTI_CHOICE
Variable formats also define the variable type, which may be numeric or string. Numeric variables contain floating point values (double precision), whereas string variables contain text character strings. The maximum length of strings that can be held in variables is 256 characters. Attempting to store a longer string will result in a runtime error.
Note: There are no pure integer variables in GPP. While a format may be defined to print no decimal point and no fractions (so the printed output is rounded to an integer value), the internal representation cannot be limited to integer values only.
The variable format uniquely defines the variable type. The CHARACTER format is the only format for string variables. All other formats define numeric variables.
Each system variables has a default format, suitable for its use (For example, the X_CURPOS variable uses the COORDINATES format, while TOOL_ANGLE uses the ANGLES format). However, the GPP developer can assign a different format for each system variable. The full list of system variables and their default formats is given in the "GPP Theory of Operation" document.
User-defined variables, including Interaction variables and arrays, are assigned a format when they are defined in the GPP program declaration part. Note that it is not possible to define a separate format to an individual array member - all members of an array share the same format.
|