Supported On | UX* WS DOS* IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WAIT causes the computer to wait the number of seconds specified before executing the next statement. Numbers less than 0.001 do not generate a WAIT interval.
WAIT 3
WAIT Seconds/2
Item | Description | Range |
---|---|---|
seconds | numeric expression, rounded to the nearest thousandth | less than 2 147 483.648; .04 minimum allowed for HP BASIC/UX 700; .02 minimum allowed for HP BASIC/WS and HP BASIC/UX 300/400 |
Resolution is limited to 20 milliseconds for HP BASIC/UX 300/400, and 10 milliseconds for HP BASIC/UX 700. Accuracy depends on system load and real time priority, but is generally 40 milliseconds.
WAIT periods are generally accurate to within 1 percent, and are system load dependent, if running in the background.
Supported On | UX WS DOS |
Option Required | TRANS |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WAIT FOR EOR waits until an end-of-record event occurs during a TRANSFER on the specified I/O path.
WAIT FOR EOR @File
WAIT FOR EOR @Device
Item | Description | Range |
---|---|---|
I/O path name | name assigned to a device, a group of devices, a pipe, or a mass storage file | any valid name |
The I/O path may be assigned either to a device, a group of devices, a pipe, or to a mass storage file. If the I/O path is assigned to a BUFFER, an error is reported when the WAIT FOR EOR statement is executed.
The WAIT FOR EOR statement prevents further program execution until an end-of-record event occurs in the TRANSFER whose I/O path name was specified. This allows ON EOR events, which might otherwise be missed, to be serviced. If the system priority prevents the servicing of an ON EOR event, the event will be logged.
The I/O path specified must be involved in an active TRANSFER for the statement to have any effect.
Supported On | UX WS DOS |
Option Required | TRANS |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WAIT FOR EOT waits until the TRANSFER completes on the specified I/O path.
WAIT FOR EOT @File
WAIT FOR EOT @Device
Item | Description | Range |
---|---|---|
I/O path name | name assigned to a device, a group of devices, a pipe, or a mass storage file | any valid name |
The I/O path may be assigned either to a device, a group of devices, a pipe, or to a mass storage file. If the I/O path is assigned to a BUFFER, an error is reported when the WAIT FOR EOT statement is executed.
The WAIT FOR EOT statement prevents further program execution until the specified TRANSFER is completed. This allows ON EOT events, which might otherwise be missed, to be serviced. If the system priority prevents the servicing of an ON EOT event, the event will be logged.
The I/O path specified must be involved in an active TRANSFER for the statement to have any effect.
Supported On | UX WS DOS |
Option Required | GRAPHX |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WHERE returns the current logical position of the graphics pen, and, optionally, pen status information.
WHERE X_pos,Y_pos
WHERE X,Y,Status$
Item | Description | Range |
---|---|---|
x variable name | name of a numeric variable | any valid name |
y variable name | name of a numeric variable | any valid name |
status variable name | name of a string variable whose dimensioned length is at least 3 | any valid name |
The characters in the status string have the following meaning:
Character Position | Value | Meaning |
---|---|---|
1 |
"0" |
Pen is up |
"1" |
Pen is down | |
2 |
comma | (delimiter) |
3 |
"0" |
Current position is outside hard clip limits. |
"1" |
Current position is inside hard clip limits but outside viewport boundary. | |
"2" |
Current position is inside viewport boundary and hard clip limits. |
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | No |
Programmable | Yes |
In an IF ... THEN ... | No |
WHILE defines a loop which is repeated as long as the boolean expression in the WHILE statement evaluates to true (a non-zero value).
330 WHILE Size>=Minimum
340 GOSUB Process
350 Size=Size/Scaling
360 END WHILE
Item | Description | Range |
---|---|---|
boolean expression | numeric expression: evaluated as true if nonzero and false if zero. | -- |
program segment | any number of contiguous program lines not containing the beginning or end of a main program or subprogram, but which may contain properly nested construct(s). | -- |
The WHILE...END WHILE construct allows program execution dependent on the outcome of a relational test performed at the start of the loop. If the condition is true, the program segment between the WHILE and END WHILE statements is executed and a branch is made back to the WHILE statement. The program segment will be repeated until the test is false. When the relational test is false, the program segment is skipped and execution continues with the first program line after the END WHILE statement.
Branching into a WHILE...END WHILE construct (via a GOTO) results in normal execution up to the END WHILE statement, a branch back to the WHILE statement, and then execution as if the construct had been entered normally.
WHILE...END WHILE constructs may be nested within other constructs, provided the inner construct begins and ends before the outer construct can end.
See PRINTALL IS and PRINTER IS.
Supported On | UX WS DOS IN* |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WILDCARDS enables and disables wildcard recognition in various file-related commands.
WILDCARDS DOS
WILDCARDS UX;ESCAPE"\" !
HP BASIC/WS and HP BASIC/UX only
WILDCARDS OFF
Item | Description | Range |
---|---|---|
escape string | string expression | any expression that evaluates to \ , ' , or the null string |
Not all implementations of HP IBASIC support WILDCARDS. Refer to your instrument programming manual for details. HP IBASIC supports only WILDCARDS DOS, while HP BASIC/WS, HP BASIC/UX, AND HP BASIC/DOS support both WILDCARDS UX and WILDCARDS DOS.
Wildcard recognition is disabled at power-up and after SCRATCH A or SCRATCH BIN. To use wildcards, you must explicitly enable them using WILDCARDS.
CAUTION |
---|
The effect of the wildcard characters is different for WILDCARDS DOS than for WILDCARDS UX. This can lead to undesirable consequences, especially with the PURGE statement. To determine the current WILDCARDS state, use SYSTEM$("WILDCARDS"). |
Note that you must specify an escape string with WILDCARDS UX. The backslash character ("\") is recommended for HP-UX compatibility.
Wildcard | Meaning |
---|---|
? | Matches any single character. For example, X?? matches file names containing exactly three characters that begin with the letter X. |
* | Matches any sequence of 0 or more characters. For example, X*Y matches any file names of two or more characters that begin with X and end with Y. |
[list] | Matches any character specified by list. The list may consist of individual characters or a range of characters. The expression *[aeiou]* matches any filename containing at least one lower case vowel. Ranges are specified using a hyphen. For example, *[0-9]* matches any file names containing at least one digit. |
[!list] | Matches any character not specified by list. Note that the ! must be the first character after [ to have the special meaning not; otherwise, it is used for matching like any other character. The list contains the same types of individual characters and ranges as discussed above. For example, *[!0-9]* matches any file names containing at least one non-digit. |
The escape character specified with WILDCARDS UX is used to cancel the special meaning of wildcard characters immediately following it within a file name specification. The escape character itself can be used in a file name by typing it twice.
100 WILDCARDS UX ; ESCAPE "\"
110 PURGE "file_*" deletes files prefixed file_
120 PURGE "file_\*"deletes file named file_
130 PURGE "file_\\"deletes file named file_\
Wildcards can be used only as the rightmost part of a file specifier.
/user/smith/my_dir* allowed
/user/smith/my_dir1/*file allowed
/user/*/my_dir1/file1 not allowed
/user/smith/*/file1 not allowed
Wildcard | Meaning |
---|---|
? | Matches 0 or 1 characters. For example, X?? matches file names of up to 3 characters that begin with the letter X (for example X , Xa , and Xab ). |
* | Matches any sequence of 0 or more characters either before or after a . in a file name. For example, X* matches all file names (with null extensions) of one or more characters that begin with X. Similarly, X*.b* would match Xabc.bat or Xyz.bak . You can use only one asterisk before the period and one asterisk after the period to match file names. |
Here is an example program segment using WILDCARDS DOS:
100 WILDCARDS DOS
110 PURGE "FILE_*" deletes all files prefixed FILE with no extension
120 PURGE "*.DAT" deletes all files with .DAT extension
Wildcards generate matches through file name expansion or file name completion. Expansion means that more than one file name can match the wildcard specification. Completion means that one and only one file name can match the wildcard specification, or an error is generated.
File Name\Expansion | File Name\Completion |
---|---|
CAT | ASSIGN |
PURGE | DICTIONARY IS |
COPY | DUMP DEVICE IS |
LINK | GET |
CHGRP | GFONT IS |
CHOWN | LOAD |
LOAD BIN | LOAD KEY |
PERMIT | LOAD SUB |
PROTECT | MSI |
PRINTALL IS | |
PRINTER IS | |
RENAME | |
RE-SAVE | |
RE-STORE | |
RE-STORE KEY |
Supported On | UX WS DOS |
Option Required | GRAPH |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WINDOW is used to define an anisotropic current unit-of-measure for graphics operations.
WINDOW -5,5,0,100
WINDOW Left,Right,Bottom,Top
Item | Description | Range |
---|---|---|
left edge | numeric expression | -- |
right edge | numeric expression | <>left edge |
bottom edge | numeric expression | -- |
top edge | numeric expression | <> bottom edge |
WINDOW defines the values represented at the hard clip boundaries, or the boundaries defined by the VIEWPORT statement. WINDOW may be used to create non-isotropic (not equal in X and Y) units. The direction of an axis may be reversed by specifying the left edge greater than the right edge, or the bottom edge greater than the top edge. (Also see SHOW.)
For information on scaling with large ranges, when using the WINDOW statement, read the section "Special Considerations about Scaling" in the chapter "Using Graphics Effectively" found in the HP BASIC Programming Guide.
See ASSIGN.
Supported On | UX* WS DOS* |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
WRITEIO writes an integer representation of the register data to the specified hardware register on the specified interface, or into memory. The actual action resulting from this operation depends on the interface and register (or memory address) selected.
WRITEIO 12,0;Set_pctl
WRITEIO Isc,Register;Reg_data
Item | Description | Range |
---|---|---|
select code | numeric expression, rounded to an integer | 1 through 31; -31 through -1; +9826; 9827 |
register number or memory address | numeric expression, rounded to an integer | -231 through +231-1 (hardware-dependent) |
register or memory data | numeric expression, rounded to an integer | -231 through +231-1 |
A positive select code (appropriate for most interfaces), writes a byte of data to the register, and a negative select code writes a word of data to the register.
Using a select code value of 9826 allows you to write directly into memory addresses.
WRITEIO 9826,Mem_address; Data_byte writes a byte of data
WRITEIO -9826,Mem_address; Data_word writes a word of data
The second parameter specified in the WRITEIO statement is the memory address of the byte or word to be written. This parameter is interpreted as a decimal address; for instance, an address of 100 000 is 10^5, not 2^20. The third parameter is also interpreted as a decimal number.
CAUTION |
---|
If you write into memory addresses, you risk:
In order to avoid these problems, you should only write into numeric array variables with WRITEIO. HP cannot be held liable for any damages caused by improper use of this feature. |
For a description of the architecture of the computer, see the Pascal System Designer's Guide. This guide consists of three manuals. To order the Pascal System Designer's Guide call your local area HP Sales Representative.
Using a select code value of 9827 allows you to execute a machine-language JSR ("Jump to SubRoutine") instruction. One parameter must be specified in the WRITEIO statement (D0_data in the example below), which will be written into the processor's D0 register before the JSR instruction is executed. The following program provides a framework for placing a machine-language subroutine in an INTEGER array and then jumping to this subroutine.
10 DATA (INTEGER values of machine-language
20 DATA instructions follow DATA keywords.)
.
.
100 INTEGER Int_array(1:100)
110 READ Int_array(*),D0_data Read instructions and D0 register data.
120 Jsr_addr=READIO(9827,Int_array(1)) Get JSR address.
130 WRITEIO 9827,Jsr_addr;D0_data Put data in D0, then do JSR.
140 PRINT "Returned from subroutine."
.
.
HP BASIC first keeps a copy of processor registers A2 through A6 on the stack. Then the value represented by the expression D0_data is placed in the D0 register, and a machine-language JSR instruction is executed. The value of the expression Jsr_addr is the address of an INTEGER array that contains machine-language instructions. The value of Jsr_addr is forced to an even address before the JSR is executed.
The last instruction in the subroutine should return control to HP BASIC with a RTS ("ReTurn from Subroutine") instruction. HP BASIC will first restore the processor registers A2 through A6 (from the stack) to the state they were in before the JSR was performed (by the WRITEIO statement). Register A7 (the stack pointer) must have the same value at the final RTS as it had when HP BASIC executed the JSR. The other processor registers can be used freely in the assembly routine. HP BASIC then resumes program execution at the line following the WRITEIO statement.
You can write only to your own process' data space.
The WRITEIO 9827 facility is available in HP BASIC/UX 700 when calling machine-language routines; however, Hewlett-Packard is not responsible for the results.
CAUTION |
---|
Using WRITEIO 9827 on HP-PA computers is extremely difficult, and can damage the hardware and software. Hewlett-Packard recommends that you write CSUBs instead to accomplish specialized tasks. See the manual, Developing CSUBs for HP BASIC/UX 7.0, for information about CSUBs. |
If you decide to execute code stored in your variables, there are a few points you should be aware of:
See PA-RISC Procedure Calling Conventions Reference Manual, and PA-RISC 1.1 Architecture and Instruction Set for more information.
If you decide to use WRITEIO 9827, be sure to include the procedure header shown in the following example:
10 ! External procedure header
20 DATA -6080,40 ! BL my_procedure,2 jsr to my_procedure
30 DATA 2048,576 ! no-op branch delay slot
40 DATA 19394,16337 ! LDW -24(0,30), 2 get return address
50 DATA 64,4257 ! LDSID (0,2),1 determine space reg value
60 DATA 1,6176 ! MTSP 1,0 set space register
70 DATA -8128,2 ! BE,N 0(0,2) return to BASIC
80 DATA 2048,576 ! no-op branch delay slot
90 ! my_procedure: (the following is example program)
100 DATA -6080,-16384 ! BV 0(2) just return
110 DATA 2048,576 ! no-op branch delay slot
120 ! The BASIC program to set-up and call the procedure
130 INTEGER A(1:18) ! 14 = my_procedure size (4)
140 READ A(*)
150 B=READIO(9827,A(1)) ! Get the address of the array
160 WRITEIO 9827,B;0. ! Call my_procedure with parameter of 0.0
170 PRINT "done"
180 END
Use of READIO or WRITEIO requires specific knowledge of the Measurement Coprocessor hardware. In general, it is recommended that you use STATUS and CONTROL instead.