[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

OpenVMS/Hanzi RTL Chinese Screen Management (SMG$) Manual


Previous Contents

This example generates line drawing characters in a single column.


SMG$DRAW_LINE

The Draw a Line routine draws a horizontal or vertical line.

Format

SMG$DRAW_LINE display-id ,start-row ,start-column ,end-row ,end-column [,rendition-set] [,rendition-complement]


RETURNS


OpenVMS usage cond_value
type longword (unsigned)
access write only
mechanism by value


Arguments

display-id


OpenVMS usage identifier
type longword (unsigned)
access read only
mechanism by reference

Specifies the virtual display on which the line is to be drawn. The display-id argument is the address of an unsigned longword that contains the display identifier.

Display-id is returned by SMG$CREATE_VIRTUAL_DISPLAY.

start-row


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the row at which to begin drawing the line. The start-row argument is the address of a signed longword that contains the row number at which to begin drawing the line.

start-column


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the column at which to begin drawing the line. The start-column argument is the address of a signed longword that contains the column number at which to begin drawing the line.

In the case that the line is horizontal and the start-column begins on the right portion of a Chinese character, the left portion of the character will become an undefined character. If the line is vertical and the start-column is on the left or right portion of a Chinese characters for each row, the remaining portions of the characters becomes undefined characters.

end-row


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the row at which the drawn line ends. The end-row argument is the address of a signed longword that contains the row number at which the drawn line ends.

end-column


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the column at which the drawn line ends. The end-column argument is the address of a signed longword that contains the column number at which the drawn line ends.

In case that the line is horizontal and the end-column ends on the left portion of a Chinese character, the right portion of the character will become an undefined character. If the line is vertical and the end-column is on the left or right portion of a Chinese characters for each row, the remaining portions of the characters will become undefined characters.

rendition-set


OpenVMS usage mask_longword
type longword (unsigned)
access read only
mechanism by reference

Attribute specifier. The optional rendition-set argument is the address of a longword bit mask in which each attribute set causes the corresponding attribute to be set in the display. The following attributes can be specified using the rendition-set argument:
SMG$M_BLINK Displays blinking characters.
SMG$M_BOLD Displays characters in higher-than-normal intensity.
SMG$M_REVERSE Displays characters in reverse video, that is, using the opposite of the default rendition of the virtual display.
SMG$M_UNDERLINE Displays underlined characters.
SMG$M_INVISIBLE Specifies invisible characters; that is, the characters exist in the virtual display but do not appear on the pasteboard.
SMG$M_USER1 through SMG$M_USER8 Displays user-defined attributes.

The display-id argument must be specified when you use the rendition-set argument.

rendition-complement


OpenVMS usage mask_longword
type longword (unsigned)
access read only
mechanism by reference

Attribute complement specifier. The optional rendition-complement argument is the address of a longword bit mask in which each attribute set causes the corresponding attribute to be complemented in the display. All of the attributes that can be specified with the rendition-set argument can be complemented with the rendition-complement argument. The display-id argument must be specified when you use the rendition-complement argument.

The optional arguments rendition-set and rendition-complement let the user control the attributes of the virtual display. The rendition-set argument sets certain virtual display attributes, while rendition-complement complements these attributes. If the same bit is specified in both the rendition-set and rendition-complement parameters, rendition-set is evaluated first, followed by rendition-complement. By using these two parameters together, the user can control each virtual display attribute in a single procedure call. On a single-attribute basis, the user can cause the following transformations:

Set Complement Action
0 0 Attribute set to default
1 0 Attribute on
0 1 Attribute set to complement of default setting
1 1 Attribute off

Description

SMG$DRAW_LINE draws a line from a specified starting row and column to a specified ending row and column. Note that this routine does not change the virtual cursor position. You can draw only horizontal or vertical lines. The characters used to draw the line depend on the type of terminal. If possible, SMG$ uses the terminal's line-drawing character set. If that is not available, SMG$ uses the characters +, -, and | to draw the line.

In case that the Chinese language character set is used, and the drawn line is on the left or right portion of the Chinese characters, the remaining portions of the characters will become undefined characters.


Condition Values Returned

SS$_NORMAL Normal successful completion.
SMG$_INVCOL Invalid column number. The specified column is outside the virtual display.
SMG$_INVROW Invalid row number. The specified row is outside the virtual display
SMG$_DIALINNOT Diagonal line not allowed.
SMG$_WRONUMARG Wrong number of arguments.
SMG$_INVDIS_ID Invalid display-id.

Example


C+
C This DEC Fortran example program demonstrates the use of SMG$DRAW_LINE.
C-

        INTEGER SMG$CREATE_VIRTUAL_DISPLAY, SMG$CREATE_PASTEBOARD
        INTEGER SMG$PASTE_VIRTUAL_DISPLAY, SMG$DRAW_LINE
        INTEGER DISPLAY1, PASTE1, ROWS, COLUMNS, BORDER, STATUS
C+
C First, create the virtual display using SMG$CREATE_VIRTUAL_DISPLAY.
C To give it a border, set BORDER = 1. No border would be BORDER = 0.
C-

        ROWS = 7
        COLUMNS = 50
        BORDER = 1

        STATUS = SMG$CREATE_VIRTUAL_DISPLAY
     1                                (ROWS, COLUMNS, DISPLAY1, BORDER)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Call SMG$CREATE_PASTEBOARD to create the pasteboard.
C-

        STATUS = SMG$CREATE_PASTEBOARD (PASTE1)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Draw a vertical line using SMG$DRAW_LINE.
C Start at row 2, column 20. End at row 6.
C-

        STATUS = SMG$DRAW_LINE (DISPLAY1, 2, 20, 6, 20)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Now, use SMG$DRAW_LINE to draw a vertical line.
C Start at row 6, column 40. End at row 2.
C This is similar to the line drawn above, but we are drawing the
C line in the reverse direction.
C-

        STATUS = SMG$DRAW_LINE (DISPLAY1, 6, 40, 2, 40)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Draw a horizontal line now, again calling SMG$DRAW_LINE.
C Start at row 4, column 8. End at column 50.
C-

        STATUS = SMG$DRAW_LINE (DISPLAY1, 4, 8, 4, 50)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Paste the virtual display using SMG$PASTE_VIRTUAL_DISPLAY.
C-

        STATUS = SMG$PASTE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 4, 15)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

        END

      

The output generated by this FORTRAN example is shown in Figure SMG-17.

Figure SMG-17 Output Generated by FORTRAN Program Calling SMG$DRAW_LINE



SMG$DRAW_RECTANGLE

The Draw a Rectangle routine draws a rectangle.

Format

SMG$DRAW_RECTANGLE display-id ,start-row ,start-column ,end-row ,end-column [,rendition-set] [,rendition-complement]


RETURNS


OpenVMS usage cond_value
type longword (unsigned)
access write only
mechanism by value


Arguments

display-id


OpenVMS usage identifier
type longword (unsigned)
access read only
mechanism by reference

Specifies the virtual display on which the rectangle is to be drawn. The display-id argument is the address of an unsigned longword that contains the display identifier.

Display-id is returned by SMG$CREATE_VIRTUAL_DISPLAY.

start-row


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the row number of the top left-hand corner of the rectangle. The start-row argument is the address of a signed longword that contains the row number of the top left-hand corner of the rectangle.

start-column


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the column number of the top left-hand corner of the rectangle. The start-column argument is the address of a signed longword that contains the column number of the top left-hand corner of the rectangle.

In case that the start-column is on the left or right portion of a Chinese characters for each row, the remaining portions of the characters will become undefined characters.

end-row


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the row number of the bottom right-hand corner of the rectangle. The end-row argument is the address of a signed longword that contains the row number of the bottom right-hand corner of the rectangle.

end-column


OpenVMS usage longword_signed
type longword (signed)
access read only
mechanism by reference

Specifies the column number of the bottom right-hand corner of the rectangle. The end-column argument is the address of a signed longword that contains the column number of the bottom right-hand corner of the rectangle.

In case that the end-column is on the left or right portion of a Chinese characters for each row, the remaining portions of the characters will become undefined characters.

rendition-set


OpenVMS usage mask_longword
type longword (unsigned)
access read only
mechanism by reference

Attribute specifier. The optional rendition-set argument is the address of a longword bit mask in which each attribute set causes the corresponding attribute to be set in the display. The following attributes can be specified using the rendition-set argument:
SMG$M_BLINK Displays blinking characters.
SMG$M_BOLD Displays characters in higher-than-normal intensity.
SMG$M_REVERSE Displays characters in reverse video, that is, using the opposite of the default rendition of the virtual display.
SMG$M_UNDERLINE Displays underlined characters.
SMG$M_INVISIBLE Specifies invisible characters; that is, the characters exist in the virtual display but do not appear on the pasteboard.
SMG$M_USER1 through
SMG$M_USER8
Displays user-defined attributes.

The display-id argument must be specified when you use the rendition-set argument.

rendition-complement


OpenVMS usage mask_longword
type longword (unsigned)
access read only
mechanism by reference

Attribute complement specifier. The optional rendition-complement argument is the address of a longword bit mask in which each attribute set causes the corresponding attribute to be complemented in the display. All of the attributes that can be specified with the rendition-set argument can be complemented with the rendition-complement argument. The display-id argument must be specified when you use the rendition-complement argument.

The optional arguments rendition-set and rendition-complement let the user control the attributes of the virtual display. The rendition-set argument sets certain virtual display attributes, while rendition-complement complements these attributes. If the same bit is specified in both the rendition-set and rendition-complement parameters, rendition-set is evaluated first, followed by rendition-complement. By using these two parameters together, the user can control each virtual display attribute in a single procedure call. On a single-attribute basis, the user can cause the following transformations:

Set Complement Action
0 0 Attribute set to default
1 0 Attribute on
0 1 Attribute set to complement of default setting
1 1 Attribute off

Description

SMG$DRAW_RECTANGLE draws a rectangle in a virtual display, given the position of the upper left-hand corner and the lower right-hand corner. Note that this routine does not change the virtual cursor position. The characters used to draw the lines making up the rectangle depend on the type of terminal. If possible, SMG$ uses the terminal's line-drawing character set. If that is not available, SMG$ uses the characters +, -, and | to draw the lines.

In case that the Chinese language character set is used, and the drawn rectangle is on the left or right portion of a Chinese characters for each row, the remaining portions of the characters will become undefined characters.


Condition Values Returned

SS$_NORMAL Normal successful completion.
SMG$_INVCOL Invalid column number. The specified column is outside the virtual display.
SMG$_INVROW Invalid row number. The specified row is outside the virtual display.
SMG$_WRONUMARG Wrong number of arguments.
SMG$_INVDIS_ID Invalid display-id.

Example



C+
C This DEC Fortran example program demonstrates the use of
C SMG$DRAW_RECTANGLE.
C
C This routine creates a virtual display and uses SMG$DRAW_RECTANGLE
C to draw a rectangle inside the bordered virtual display.
C-

C+
C Include the SMG definitions. In particular, we want SMG$M_BORDER.
C-

        INCLUDE '($SMGDEF)'
        INTEGER SMG$CREATE_VIRTUAL_DISPLAY, SMG$CREATE_PASTEBOARD
        INTEGER SMG$PASTE_VIRTUAL_DISPLAY, SMG$DRAW_RECTANGLE
        INTEGER DISPLAY1, PASTE1, ROWS, COLUMNS, STATUS

C+
C Create a virtual display with a border by calling
C SMG$CREATE_VIRTUAL_DISPLAY.
C-

        ROWS = 7
        COLUMNS = 50

        STATUS = SMG$CREATE_VIRTUAL_DISPLAY
     1                    (ROWS, COLUMNS, DISPLAY1, SMG$M_BORDER)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Use SMG$CREATE_PASTEBOARD to create the pasteboard.
C-

        STATUS = SMG$CREATE_PASTEBOARD (PASTE1)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Using SMG$DRAW_RECTANGLE, draw a rectangle inside the bordered region.
C-

        STATUS = SMG$DRAW_RECTANGLE (DISPLAY1, 2, 10, 6, 20)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

C+
C Paste the virtual display by calling SMG$PASTE_VIRTUAL_DISPLAY.
C-

        STATUS = SMG$PASTE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 4, 15)
        IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

        END

      

The output generated by this FORTRAN example is shown in Figure SMG-18.

Figure SMG-18 Output Generated by FORTRAN Program Calling SMG$DRAW_RECTANGLE



Previous Next Contents