CBL_GET_SCR_LINE_DRAW

Syntax:

call "CBL_GET_SCR_LINE_DRAW" using     function-code
                                       line-draw-table
                             returning status-code

Parameters

function-code
Call prototype (see Key): cblt-x1-compx
Picture: pic x comp-x.
Contains one of the following:

0: Request for single-byte line drawing table

1: Request for double-byte line drawing table

2: Request for a single single-byte line drawing code

3: Request for a single double-byte line drawing code

line-draw-table
Group predefined as cblt-get-scr-line-draw-buffer containing:
01   cblt-get-scr-line-draw-buffer        typedef.
  03 cblte-gsld-draw-code                 cblt-x1-compx.  *> pic x comp-x.
  03 cblte-gsld-dbcs-draw-char            cblt-x2-compx.  *> various pic x(2) Occurs n times
  03 cblte-gsld-draw-char 
     redefines cblte-gsld-dbcs-draw-char  cblt-x1-compx.  *> Occurs n times
status-code
See Library Routines - Key.

On Entry:

With function-code = 2 or 3
cblte-gsld-draw-code
The offset (shape description) of the character required.

On Exit:

cblte-gsld-draw-code
Byte filled in by the run-time system to determine any mapping that has taken place in the table as follows:
For bits 0 through 2, line types are mapped to the first available of single, double, extended or ASCII character.
bit 7 - 3 Reserved (set to 0)
bit 2 Extended lines not supported - mapped
bit 1 Double lines not supported - mapped
bit 0 Single lines not supported - mapped
With function-code = 0
cblte-gsld-draw-char
The single-byte line drawing table. Bytes in the table are arranged as follows:
bits 6 and 7 The North line.
bits 4 and 5 The South line
bits 2 and 3 The West line
bits 0 and 1 The East line
  • The bit pairs are combined and used as an index into the table.
  • Non-valid combinations will map to a space.
  • For a valid combination any two of the bit pairs must each have at least one bit set.
  • You must specify at least 2 bit pairs.
With function-code = 1
cblte-gsld-dbcs-draw-char
The double-byte line drawing table. Bytes in the table are arranged as follows:
bits 6 and 7 The North line.
bits 4 and 5 The South line
bits 2 and 3 The West line
bits 0 and 1 The East line
With function-code = 2
cblte-gsld-draw-char
The requested single single-byte line drawing code.
With function-code = 3
cblte-gsld-dbcs-draw-char
The requested single double-byte line drawing code.

Comments:

When requesting a single line drawing character (function-code = 2 or 3), the cblte-gsld-draw-code parameter is used to tell the run-time system which character you require. The cblte-gsld-draw-code parameter for a given cblte-gsld-drawing shape can be calculated by splitting a byte into four bit-pairs. Each bit-pair defines the type of line that you want to appear in one of the four directions:

Bits Direction
7 and 6 North
5 and 4 South
3 and 2 West
1 and 0 East

Each bit-pair can have one of the following values:

00 In the given direction, there is no line
01 There is a single-thickness line
10 There is a double-thickness line
11 There is an extended-type line.

The extended line type is available only for systems which have additional types of line drawing, such as dotted lines. If a system has more than one additional type, only one can be used at a time.

For example, if you wished to find out the screen handler's character code for a line which would define the bottom-left of a box with single thickness sides and a double thickness bottom, you would make the following calculations:

Bit-pairs:

North: 01 (single)
South: 00 (blank)
West: 00 (blank)
East: 10 (double)

This gives the binary value of 01000010 or a decimal value of 66. Therefore, you would move 66 to cblte-gsld-draw-code before calling CBL_GET_SCR_LINE_DRAW in order to obtain the correct character for this shape.

If you use function-code = 0 or 1 to obtain the full line drawing table, a given character can be located in the table using the bit-pair algorithm described above, which yields a numeric value for a given shape. However, by default, COBOL subscripts begin at one, not zero. Therefore, if you use the following construct to obtain the full line drawing table:

  03 cblte-gsld-draw-char    pic x occurs 256 times.

you need to add 1 to the result of the bit-pair algorithm to locate the correct character (and, therefore, need a subscript which is larger than one byte).

However, you can use the following construct to obtain the table:

With function-code = 0:

  03 
filler  pic x.
  03 cblte-gsld-draw-char    pic x occurs 255 times.

With function-code = 1:

  03 filler  pic x(2).
  03 cblte-gsld-dbcs-draw-char  pic x(2) occurs 255 times.

You must ensure that the NOBOUND Compiler directive is set to enable you to use subscripts 0 to 255, which map directly onto the result from the bit-pair algorithm.