HP OpenVMS Systems Documentation
HP BASIC for OpenVMS
CDD/Repository supports F_floating, D_floating, and G_floating data types. 1 These correspond to the BASIC SINGLE, DOUBLE, and GFLOAT data types, respectively. As with fixed-point data types, CDD/Repository also allows the specification of scale and base for floating-point data types. If a CDD/Repository data definition contains a floating-point field that specifies a SCALE or BASE, HP BASIC signals the informational message "CDD/Repository specifies SCALE for <name>. Not supported" or the error message "CDD/Repository attributes for <name> are other than base 10." For example:
define record floats description is /*Test of floating-point data types*/. basicfloat structure. my_single datatype is f_floating scale 3. my_double datatype is d_floating base 16. my_gfloat datatype is g_floating. end basicfloat structure. end floats.
1 %INCLUDE %FROM %CDD "CDD$TOP.BASIC.FLOATS" C1 ! Test of floating-point data types C1 RECORD BASICFLOAT ! UNSPECIFIED C1 GROUP MY_SINGLE ! F_FLOATING C1 SINGLE SINGLE_VALUE C1 END GROUP C1 DOUBLE MY_DOUBLE ! D_FLOATING C1 GFLOAT MY_GFLOAT ! G_FLOATING C1 END RECORD ................1 %BASIC-I-CDDATTSCA, 1: CDD specifies SCALE for BASICFLOAT::MY_SINGLE. Not supported %BASIC-E-CDDATTBAS, 1: CDD attributes for BASICFLOAT::MY_DOUBLE are other than base 10
In addition, CDD/Repository supports complex floating-point numbers, but HP BASIC does not support them. Complex floating-point numbers consist of a real and an imaginary part. Each part requires the same amount of storage as a simple floating-point number. Therefore, each complex floating-point number requires twice as much storage as a simple floating-point number.
If a CDD/Repository data definition containing complex numbers is extracted, HP BASIC signals the informational message "Datatype in CDD/Repository not supported, substituted group for <field-name>," and creates a group to contain the field. As before, HP BASIC uses the data type and _VALUE to create the group name, but because each complex number contains both a real and an imaginary part, HP BASIC adds an "_R" to the name of the real part and an "_I" to the name of the imaginary part. This is shown in the following CDD/Repository data definition and corresponding HP BASIC RECORD statement:
define record CDD$top.basic.complex description is /* test complex data types */. complex structure. my_s_complex_1 datatype f_floating_complex. my_d_complex_1 datatype d_floating_complex. my_g_complex_1 datatype g_floating_complex. end complex structure. end complex.
1 %INCLUDE %FROM %CDD "CDD$TOP.BASIC.COMPLEX" C1 ! test complex data types C1 RECORD COMPLEX ! UNSPECIFIED C1 GROUP MY_S_COMPLEX_1 ! F_FLOATING_COMPLEX C1 SINGLE SINGLE_R_VALUE C1 SINGLE SINGLE_I_VALUE C1 END GROUP C1 GROUP MY_D_COMPLEX_1 ! D_FLOATING_COMPLEX C1 DOUBLE DOUBLE_R_VALUE C1 DOUBLE DOUBLE_I_VALUE C1 END GROUP C1 GROUP MY_G_COMPLEX_1 ! G_FLOATING_COMPLEX C1 GFLOAT GFLOAT_R_VALUE C1 GFLOAT GFLOAT_I_VALUE C1 END GROUP C1 END RECORD ................1 %BASIC-I-CDDSUBGRO, 1: data type in CDD/Repository not supported, substituted group for: COMPLEX::MY_S_COMPLEX_1. %BASIC-I-CDDSUBGRO, 1: data type in CDD/Repository not supported, substituted group for: COMPLEX::MY_D_COMPLEX_1. %BASIC-I-CDDSUBGRO, 1: data type in CDD/Repository not supported, substituted group for: COMPLEX::MY_G_COMPLEX_1.
CDD/Repository supports the following forms of decimal string data types:
HP BASIC supports only the PACKED DECIMAL decimal string data type, which corresponds to the HP BASIC DECIMAL data type. For all other decimal string data types, HP BASIC creates a group with the same name as the CDD/Repository subordinate field, and creates a string record component to contain the field. For example:
define record CDD$top.basic.decimalstring description is /* test decimal string data types */. decimalstring structure. my_packed_decimal datatype is packed decimal size is 5 digits 2 fractions. my_zoned_numeric datatype is zoned numeric size is 6 digits 2 fractions. my_unsigned_numeric datatype is unsigned numeric size is 8 digits 4 fractions. my_lef_sep_numeric datatype is left separate numeric size is 10 digits 3 fractions. my_left_ovpnch_numeric datatype is left overpunched numeric size is 5 digits 2 fractions. my_right_sep_numeric datatype is right separate numeric size is 3 digits 1 fractions. my_right_ovpnch_numeric datatype is right overpunched numeric size is 4 digits 2 fractions. end decimalstring structure. end decimalstring.
1 %INCLUDE %FROM %CDD "CDD$TOP.BASIC.DECIMALSTRING" C1 ! test decimal string data types C1 RECORD DECIMALSTRING ! UNSPECIFIED C1 DECIMAL(5 ,2 ) MY_PACKED_DECIMAL ! PACKED DECIMAL C1 GROUP MY_ZONED_NUMERIC ! ZONED NUMERIC C1 STRING STRING_VALUE = 6 C1 END GROUP C1 GROUP MY_UNSIGNED_NUMERIC ! UNSIGNED NUMERIC C1 STRING STRING_VALUE = 8 C1 END GROUP C1 GROUP MY_LEF_SEP_NUMERIC ! NUMERIC LEFT ! SEPARATE C1 STRING STRING_VALUE = 11 C1 END GROUP C1 GROUP MY_LEFT_OVPNCH_NUMERIC ! NUMERIC LEFT ! OVERPUNCHED C1 STRING STRING_VALUE = 5 C1 END GROUP C1 GROUP MY_RIGHT_SEP_NUMERIC ! NUMERIC RIGHT ! SEPARATE C1 STRING STRING_VALUE = 4 C1 END GROUP C1 GROUP MY_RIGHT_OVPNCH_NUMERIC ! NUMERIC RIGHT ! OVERPUNCHED C1 STRING STRING_VALUE = 4 C1 END GROUP C1 END RECORD %BASIC-I-CDDSUBGRO, data type in CDD/Repository not supported, substituted group for: DECIMALSTRING::MY_ZONED_NUMERIC. %BASIC-I-CDDSUBGRO, data type in CDD/Repository not supported, substituted group for: DECIMALSTRING::MY_UNSIGNED_NUMERIC. %BASIC-I-CDDSUBGRO, data type in CDD/Repository not supported, substituted group for: DECIMALSTRING::MY_LEF_SEP_NUMERIC. %BASIC-I-CDDSUBGRO, data type in CDD/Repository not supported, substituted group for: DECIMALSTRING::MY_LEFT_OVPNCH_NUMERIC. %BASIC-I-CDDSUBGRO, data type in CDD/Repository not supported, substituted group for: DECIMALSTRING::MY_RIGHT_SEP_NUMERIC. %BASIC-I-CDDSUBGRO, data type in CDD/Repository not supported, substituted group for: DECIMALSTRING::MY_RIGHT_OVPNCH_NUMERIC.
CDD/Repository supports the following additional data types:
HP BASIC does not support these data types. HP BASIC translates these data types by signaling the informational message "Datatype in CDD/Repository not supported, substituted group for: <field name>", and creates a group to contain the field. See Table 21-2 for a description of how HP BASIC translates these data types.
If you extract a CDD/Repository definition that contains a BIT field, the field must be a multiple of 8 bits (1 byte). This means that the following field must be aligned on a byte boundary. If the following field is not aligned on a byte boundary, HP BASIC signals the error "Field <name> from CDD/Repository has bit offset or length."
This chapter explains the BASIC language exceptions for using standard
DECwindows Motif Bindings. For more information about programming
DECwindows Motif, see the DECwindows Motif Guide to Application Programming.
22.1 Overview of DECwindows Motif Concepts
This section introduces DECwindows Motif concepts. DECwindows Motif is an X Window System type of operating environment. DECwindows Motif is used on a workstation, where several windows can be displayed with different applications on each window.
To program in the DECwindows Motif environment, DECwindows Motif
bindings are used to help write programs that create and manage the
different resources needed to control the windowing environment.
22.2 Using DECwindows Motif Bindings with BASIC
The DECwindows Motif bindings consist of constant definitions, global variable declarations, record structures, and function prototypes. The bindings include everything that is needed to do windows programming using the DECwindows Motif Application Programming Interface (API).
The BASIC implementation of the DECwindows Motif bindings allow you to write to either the C version or the non-C version of the bindings. In either case, you will want to refer to the VMS DECwindows User Interface Language Reference Manual before you start programming. For information about using non-C bindings, see the DECwindows Motif for OpenVMS Guide to Non-C Bindings.
BASIC$HELLOMOTIF.BAS, and BASIC$HELLOBURGER.BAS supplied on the kit as examples of using the BASIC language for windows programming.
The DECW$MOTIF.BAS Motif bindings file includes the file DECW$MOTIF_DEFS.BAS, which contains data type aliases. This makes separate compilation of Motif application subroutines simpler. To separately compile a Motif application routine, add both of the following:
DECW$EXAMPLES contains two examples of DECwindows Motif applications in BASIC: BASIC$HELLOMOTIF.BAS and BASIC$MOTIFBURGER.BAS. SYS$LIBRARY:DECW$MOTIF.BAS, which contains the DECwindows Motif declarations, is required to build the programs. The steps to build and run the HELLOMOTIF example are:
$ COPY DECW$EXAMPLES:BASIC$HELLOMOTIF.* *.*
$ UIL/MOTIF BASIC$HELLOMOTIF.UIL
$ BASIC BASIC$HELLOMOTIF $ LINK BASIC$HELLOMOTIF,SYS$INPUT/OPTIONS SYS$LIBRARY:DECW$DXMLIBSHR.EXE/SHARE SYS$LIBRARY:DECW$XMLIBSHR.EXE/SHARE SYS$LIBRARY:DECW$XTSHR.EXE/SHARE ^Z $
$ BASIC BASIC$HELLOMOTIF $ LINK BASIC$HELLOMOTIF,SYS$INPUT/OPTIONS SYS$LIBRARY:DECW$DXMLIBSHR12.EXE/SHARE SYS$LIBRARY:DECW$MRMLIBSHR12.EXE/SHARE SYS$LIBRARY:DECW$XMLIBSHR12.EXE/SHARE SYS$LIBRARY:DECW$XTLIBSHRR5.EXE/SHARE ^Z $
$ SET DISPLAY/CREATE/NODE=xxxx
$ RUN BASIC$HELLOMOTIF
The .UID file must be kept in the same directory as the .EXE file when run. This program looks in the current directory for the UID file.
All strings passed between DECwindows Motif and your program must be null terminated. For example:
"A string" + "0"C
When passing a string argument to a DECwindows Motif routine, the address of the string is required. For static strings, the address of the string can easily be obtained with the LOC function. For example:
COMMON (c1) STRING hierarchy_file_name = 21 hierarchy_file_name = "BASIC$HELLOMOTIF.UID" + "0"C DECLARE LONG hierarchy_file_name_array(1) hierarchy_file_name_array(0) = LOC (hierarchy_file_name)
Because dynamic strings are described by a descriptor, a different means is needed to get the address of the string text. The following helper function will get the address of dynamic strings as well as static strings:
FUNCTION LONG ADDRESS_OF_STRING (STRING str_arg BY REF) OPTION TYPE=EXPLICIT, INACTIVE=SETUP END FUNCTION (LOC (str_arg))
Example of passing a dynamic string to a DECwindows Motif routine:
DECLARE STRING temp_string temp_string = "A string value" + "0"C list_test = DXmCvtFCtoCS (ADDRESS_OF_STRING (temp_string), & byte_count, istatus)
This appendix describes compile-time and compiler command errors, their
causes, and the user action required to correct them.
A.1 Compile-Time Errors
HP BASIC diagnoses compile-time errors and does the following:
HP BASIC repeats this procedure for each error diagnosed during compilation. The error message format for compile-time errors is:
%BASIC--<l>--<mnemonic>, <n>: <message>
<l>Is a letter indicating the severity of the error. The severity indicator can be one of the following:
- I ---- indicating information
- W ---- indicating a warning
- E ---- indicating an error
- F ---- indicating a severe error
<mnemonic>Is a 3- to 9-character string that identifies the error. Error messages in this appendix are alphabetized by this mnemonic.
<n>:Is the nth error within the line's picture.
<message>Is the text of the error message.
Diagnostic on source line 1, listing line 1, BASIC line 10 10 DECLARE REAL BYTE A, A ........................1.......2 %BASIC--E--CONDATSPC, 1: conflicting data type specifications %BASIC--E--ILLMULDEF, 2: illegal multiple definition of name A
This display tells you that two errors were detected on line 10; HP BASIC displays the line containing the error, then prints a picture showing you where the errors were detected. In the example, the picture shows a 1 under the keyword BYTE and a 2 under the second occurrence of variable A. The following line shows you:
In this case, the error message tells you that there are two contradictory data-type keywords in the statement. The next line shows you the same type of information for the second error; in this case, the compiler detected multiple declarations of variable A.
If a compilation causes an error of severity I or W, the compilation continues and produces an object module. If a compilation causes an error of severity E, the compilation continues but produces no object module. If a compilation causes an error of severity F, the compilation aborts immediately.
The following is an alphabetized list of compilation error messages:
ACTARGMUS, actual argument must be specified
Explanation: ERROR ---- A DEF function reference contains a null argument, for example, FNA(1,,2).
User Action: Specify all arguments when referencing a DEF function.
ALLOCSML, allocated area may be too small for section
Explanation: WARNING---A MAP or COMMON with the same name exists in more than one program module, and the first one encountered by the compiler is smaller than the subsequent ones.
User Action: HP BASIC first allocates MAP and COMMON areas in the main program, then MAP and COMMON areas in subprograms, in the order in which they were loaded. Thus, you can avoid this error by loading modules with the largest MAP or COMMON first. However, it is better practice to make MAP and COMMON areas equal in size.
AMBRECCOM, ambiguous RECORD component
Explanation: ERROR---The program contains an ambiguous RECORD component reference, for example, A::D when both A::B::D and A::C::D exist.
User Action: Remove the ambiguity by fully specifying the record component.
AMPCONILL, & continuation is illegal after %INCLUDE directive
Explanation: ERROR---A program contains a %INCLUDE directive followed by an ampersand continuation to another statement. For example, the following is illegal:
2300 %INCLUDE %FROM %CDD "CDD$TOP.PERSONNEL.EMPLOYEE" & GOTO 3000
Ampersand continuation of the %INCLUDE directive is legal, however.
User Action: Recode to eliminate the line continuation or use backslash continuation.
AMPCONREP, & continuation is illegal after %REPORT directive
Explanation: ERROR---A program contains a %REPORT directive followed by an ampersand continuation to another statement. For example, the following is illegal:
2300 %REPORT %DEPENDENCY "CDD$TOP.PERSONNEL.EMPLOYEE.COURSE_FORM" & GOTO 3000
Ampersand continuation of the %REPORT directive itself is legal,
User Action: Recode to eliminate the line continuation or use backslash continuation.
ANSDEFMUS, ANSI DEF must be defined before reference
Explanation: ERROR---A program compiled with the /ANSI_STANDARD qualifier contains a reference to a DEF function before the function definition.
User Action: Renumber the line containing the function definition so that the definition precedes all references to the function.
ANSILNREQ, a line number is required on first line for ANSI
Explanation: ERROR---When you specify the /ANSI qualifier, a program must have a line number on the first line for the ANSI qualifier.
User Action: Supply a line number on the first line.
ANSKEYSPC, keywords must be delimited by spaces in /ANSI
Explanation: ERROR---A program compiled with the /ANSI_STANDARD qualifier contains a line where two elements (two keywords, a keyword and a line number, or a keyword and a string constant) are not separated by at least one space. For example, PRINT"Hello".
User Action: Delimit all keywords, line numbers, and string constants with at least one space.
ANSLINDIG, ANSI line number may not exceed 4 digits
Explanation: ERROR---A program compiled with the /ANSI_STANDARD qualifier contains a line number with more than 4 digits, that is, a number greater than 9999.
User Action: Renumber the program lines so that no line number exceeds 9999.
ANSLINNUM, ANSI line numbers must begin in column 1
Explanation: ERROR---A program compiled with the /ANSI_STANDARD qualifier contains a line number preceded by one or more spaces or tabs.
User Action: Remove any spaces and tabs that precede the line number.
ANSREQREA, ANSI requires REAL default type
Explanation: ERROR---The /ANSI_STANDARD qualifier conflicts with the /TYPE_DEFAULT qualifier.
User Action: Do not specify a default data type other than REAL. REAL is the default.
ANSREQSCA, ANSI requires SCALE 0
Explanation: ERROR---The /ANSI_STANDARD qualifier conflicts with the /SCALE qualifier.
User Action: Do not specify a scale factor.
ANSREQSET, ANSI requires SETUP
Explanation: ERROR---The /ANSI_STANDARD qualifier conflicts with the /NOSETUP qualifier.
User Action: Do not specify /NOSETUP.
ANYDIMNOT, dimension checking not allowed on ANY
Explanation: ERROR---Both a data type of ANY and a DIM clause were specified in an EXTERNAL statement.
User Action: Remove the DIM clause from the EXTERNAL statement. ANY implies either scalar or array.
ANYNOTALL, ANY not allowed on EXTERNAL PICTURE
Explanation: ERROR---An attempt was made to specify the ANY keyword on an EXTERNAL PICTURE declaration. This is not allowed because the ANY data type should be used for calling non-BASIC procedures only.
User Action: Remove the ANY keyword from the EXTERNAL PICTURE declaration.
APPMISNUM, append file missing line number on first line
Explanation: ERROR---An attempt was made to append a source file that does not contain a line number on the first line.
User Action: Put a line number on the first line of the appended file.
APPNOTALL, append not allowed on programs without line numbers
Explanation: ERROR---The APPEND command cannot be used on a program without line numbers.
User Action: Use an include file.
ARESTYMUS, area style must be "HOLLOW", "SOLID",
"PATTERN", or "HATCH"
Explanation: ERROR---You specified an invalid value in the SET AREA STYLE statement.
User Action: Specify one of the values listed in the message.
AREREQTHR, AREA output requires at least 3 X,Y points
Explanation: ERROR---An AREA graphic output statement specifies less than 3 points.
User Action: Specify at least 3 points in the AREA graphic output statement.
ARGERR, illegal argument for command
Explanation: ERROR---An argument was entered for a command that does not take an argument, or an invalid argument was entered for a command, for example, SCALE A or LIST A.
User Action: Reenter the command with the proper arguments.
ARRMUSHAV, array must have 1 dimension
Explanation: ERROR---An array with multiple dimensions is specified where a one-dimensional array is required.
User Action: Specify an array that has 1 dimension.
ARRMUSELE, array must have at least 4 elements
Explanation: ERROR---You specified an array with less than four elements. This statement requires an array with at least four elements in it.
User Action: Supply an array declared as having at least 4 elements.
ARRNAMREQ, array names only allowed
Explanation: ERROR---The type of variable name required must be an array name.
User Action: Change the variable name to an array name.
ARRNOTALL, array <name> not allowed in DEF declaration
Explanation: ERROR---The parameter list for a DEF function definition contained an entire array.
User Action: Remove the array specification. Passing an entire array as a parameter to a DEF function is not allowed.
ARRTOOBIG, named array <array-name> is too large
Explanation: ERROR---An array must occupy fewer than (2^16 ---- 1) bytes of storage.
User Action: Reduce the size of the array. If the array is within a record, the maximum size of the array is 65,535 bytes.
ATROVRVAR, attributes of overlaid variable <name> don't match
Explanation: ERROR---A variable name appears in more than one overlaid MAP; however, the attributes specified for the variable are inconsistent.
User Action: If the same variable name appears in multiple overlaid MAPs, the attributes (for example, data type) must be identical.
ATRPRIREF, attributes of prior reference to <name> don't match
Explanation: WARNING---A variable or array is referenced before the MAP that declares it. The attributes of the referenced variable do not match those of the declaration.
User Action: Make sure that the variable or array has the same attributes in both the reference and the declaration.
ATTGTRZER, graphics attribute value must be greater than zero
Explanation: ERROR---You specified a negative value when a positive value is required.
User Action: Supply a value greater than zero.
BADFMTSTR, invalid PRINT USING format string
Explanation: ERROR---The PRINT USING format string specified is not valid.
User Action: Supply a valid PRINT USING format string.
BADLOGIC, internal logic error detected
Explanation: ERROR---An internal logic error was detected.
User Action: This error should never occur. Please submit a Software Performance Report with a machine-readable copy of the source program.
BADNO, qualifier <name> does not accept 'NO'
Explanation: ERROR---A qualifier that does not allow a NO prefix was entered. For example, NODOUBLE.
User Action: Select the proper qualifier.
BADPROGNM, error in program name
Explanation: ERROR---The program name is longer than 39 characters or contains invalid characters.
User Action: Change the program name to be less than or equal to 39 characters and make sure that it contains only letters, digits, dollar signs, and underscores.
BADVALUE, <text> is an invalid keyword value
Explanation: FATAL---The command supplied an invalid value for a keyword.
User Action: Supply a valid value.
BASICHLB, BASIC's HELP library is not installed on this system
Explanation: INFORMATION---A HELP command was entered and the HP BASIC HELP library was not available.
User Action: See your system manager.
BIFREQNUM, built in function requires numeric expression
Explanation: ERROR---A reference to an HP BASIC built-in function contains a string instead of a numeric expression.
User Action: Supply a numeric expression.
BIFREQSTR, built in function requires string expression
Explanation: ERROR---The program specifies a numeric expression for a built-in function that requires a string argument.
User Action: Supply a string expression for the built-in function.
BLTFUNNOT, built in function not supported
Explanation: ERROR---The program contains a reference to a built-in function not supported by this version of HP BASIC.
User Action: Remove the function reference.
BOTBOUSPE, bottom boundary must be less than the top boundary
Explanation: ERROR---In a statement that specifies a viewport or windowsize, you specified a bottom boundary that is greater than or equal to the corresponding top boundary.
User Action: Correct the bottom boundary so that it is less than the top boundary.