13 Asynchronous Devices

Eloquence Statements Used With TIO

Four Eloquence statements and one function are used with TIO--REQUEST, RELEASE, ENABLE, DISABLE, and CURKEY. The REQUEST and RELEASE statements are described fully in page 249 , while ENABLE, DISABLE, and CURKEY are in page 151 . They are briefly described here for your convenience.

The REQUEST and RELEASE Statements

Before an ON INPUT # statement is executed, the program must have exclusive access to the required device.

Successful execution of a REQUEST statement addressing a terminal causes TIO to implicitly execute the OFF INPUT # statement. Syntax of the REQUEST statement is as follows:

REQUEST port number [,return variable]

The REQUEST statement first checks to see if the requested device is a printer or a port. Printers and ports are defined in the user, group, and global configuration files using the PRINTER and PORT statements.

If the return variable is omitted and the device is already reserved by another program, ERROR 131 results. If the requested device is not defined in the user, group, or global configuration file, ERROR 132 results. If the user has no access rights or if there are currently more than 4 ports in use, ERROR 313 - Can't access port results.

If the requested device is a printer, it then checks if it is spooled or not. Spooled printers are indicated by "PIPE" in the PRINTER statement in a configuration file. The word "FILE" in a PRINTER statement indicates a non-spooled printer. If the requested printer is not spooled, the corresponding HP-UX device file is locked, thereby reserving the device for your use. This is not necessary for a spooled printer.

If the requested device is a port, the corresponding HP-UX device file is locked, reserving it for your use. The user must have read and write permission to the port, e.g. crw-rw-rw- 1 root bin 58 0x000005 Aug 29 14:36 /dev/tty0p5

The value returned to the return variable, if present, is based upon the following criteria:

Reserved access to a port or non-spooled printer is relinquished by the RELEASE statement. Note that it is not necessary to RELEASE a spooled printer. This is because a spooled printer is not a directly accessed device. Syntax for the RELEASE statement is as follows:

RELEASE port number

The DISABLE and ENABLE Statements

The DISABLE statement inhibits all interrupts (including ON KEY # interrupts); interrupts are still recorded. When the ENABLE statement is given, interrupts are serviced in sequence. Syntax for these statements is as follows:



The CURKEY Function

CURKEY is a function which returns a number indicating the source of an ON condition interrupt. Syntax for this function is as follows:

CURKEY numeric variable

The values CURKEY returns are shown in the following table:

Summary of Image Symbols
Value Condition
0No interrupts have occurred
1-24Softkeys 1 through 24
25-27Port 11
28-30Port 12
31-33Port 13
34-36Port 14
37-39Port 15
40-42Port 16
43-45Port 17
46-48Port 18
49-51Port 19
52-54Port 20

Three values are allocated for each port. An ON INPUT # interrupt returns the first value (25 for port 11, 28 for port 12, and so on). The second and third values (26 and 27 for port 11, 29 and 30 for port 12, and so on) are reserved for future use.

Eloquence Language Manual - 19 DEC 2002