TSK() Function - Device Alias List

Syntax

TSK(int{,ERR=lineref})

Description

For BBj-specific information, see TSK() Function - BBj.

The TSK() function returns strings corresponding to the ALIAS entries in the current PRO/5 configuration. TSK(0) returns the first ALIAS, TSK(1) the second, and so on. Each string contains five information fields. The first byte of the string is the ALIAS type:

$00$ = terminal
$01$ = printer
$02$ = ghost
$03$ = graphics device
$04$ = GUI device

The second byte contains a binary value representing the number of currently active OPENs for that ALIAS by the current task. For the second byte, if the alias line has a LOCK= mode set, the high order bit is set. Next, is the ALIAS name as a variable number of ASCII characters terminated by a $00$. Then, the device type (such as "doscon" or "ansi") as a variable length sequence of characters terminated by a $00$. Next is the physical name of the device terminated by a $00$. The last field is the mode data from the configuration file terminated by a $00$. All of the information from the configuration file is available in the TSK() function, but the order is different from the configuration file.

The range of values for int depends on the number of ALIASes in the PRO/5 configuration.

Examples

1000 LET A$=TSK(0)
1010 IF A$(1,1)=$00$ THEN PRINT "This is a terminal"

In a PRO/5 configuration file, the ALIAS line for terminal T0 is:

ALIAS T0 /dev/con doscon driver=pcvga.drv,mode=3,DMA

In the above example, A$ has the value indicated in the table below:

Byte

Length

Description

Value

1

1

terminal

$00$

2

1

one open

$01$

3

3

ALIAS name

"T0"+$00$

6

7

device name

"doscon"+$00$

13

9

physical name

"/dev/con"+$00$

22

28

modes

"driver="...+$00$

A template to access this structure is as follows:

type:u(1),opens:u(1),alias:c(2*=0),device:c(10*=0),phys:c(10*=0),modes:c(80*=0)

The second byte returned has the high bit ($80) set if the associated lock file already exists.

See Also

Functions - Alphabetical Listing