 |
OpenVMS/Hangul RTL Korean Screen Management (SMG$)
Manual
Any condition values returned by LIB$COPY_R_DX.
Any condition values returned by $GET (except RMS$_EOF).
Any condition values returned by $QIOW.
Examples
#1 |
1 OPTION TYPE=EXPLICIT
!+
! This VAX BASIC program demonstrates the use of
! SMG$READ_STRING to read either a string,
! a control key, or a keypad key.
!
DECLARE LONG KB_ID, RET_STATUS, STR_LEN, TERM_CODE, MODIFIER, I, &
TIMER
DECLARE STRING DATA_STR, TERM_SET
EXTERNAL LONG CONSTANT IO$M_TIMED
EXTERNAL LONG CONSTANT IO$M_NOECHO
EXTERNAL LONG CONSTANT IO$M_NOFILTR
EXTERNAL SUB LIB$SIGNAL( LONG BY VALUE )
EXTERNAL SUB LIB$STOP( LONG BY VALUE )
EXTERNAL LONG CONSTANT SS$_TIMEOUT
EXTERNAL LONG FUNCTION SMG$CREATE_VIRTUAL_KEYBOARD( LONG, STRING )
EXTERNAL LONG FUNCTION SMG$DELETE_VIRTUAL_KEYBOARD( LONG )
EXTERNAL LONG FUNCTION SMG$READ_STRING( LONG, STRING, STRING, &
LONG, LONG, LONG, STRING, LONG, LONG )
%INCLUDE "$SMGDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"
!+
! Prompt the user for the timer value. A value of 0 will cause
! the type-ahead buffer to be read.
!-
INPUT "Enter timer value (0 to read type-ahead buffer): ";TIMER
!+
! Tell SMG to use the timer value
!-
MODIFIER = IO$M_TIMED
!+
! Establish a SMG connection to SYS$INPUT. Signal any unexpected
! errors.
!-
RET_STATUS = SMG$CREATE_VIRTUAL_KEYBOARD( KB_ID, "SYS$INPUT:" )
IF (RET_STATUS AND 1%) = 0% THEN
CALL LIB$SIGNAL( RET_STATUS )
END IF
!+
! Tell SMG to use any keystroke except a letter or number
! as a terminator to the input and perform the read.
! Signal any error except SS$_TIMEOUT
!-
TERM_SET = STRING$( 4%, -1% ) + STRING$(12%, 0%)
RET_STATUS = SMG$READ_STRING( KB_ID, DATA_STR, , , &
MODIFIER, TIMER, TERM_SET, &
STR_LEN, TERM_CODE )
IF (RET_STATUS <> SS$_TIMEOUT) AND ((RET_STATUS AND 1%) = 0%) THEN
CALL LIB$SIGNAL( RET_STATUS )
END IF
!+
! All the data should come back as a terminator code, since any
! character can be a terminator.
!-
PRINT "data string = ";LEFT(DATA_STR, STR_LEN)
PRINT "term_code = ";TERM_CODE
SELECT TERM_CODE
CASE 0 TO 31
PRINT "You typed a control character"
CASE 32 TO 127
PRINT "You typed: ";CHR$(TERM_CODE)
CASE SMG$K_TRM_PF1 TO SMG$K_TRM_PERIOD
PRINT "You typed one of the keypad keys"
CASE SMG$K_TRM_UP TO SMG$K_TRM_RIGHT
PRINT "You typed one of the cursor positioning keys"
CASE SMG$K_TRM_F6 TO SMG$K_TRM_F20
PRINT "You typed one of the function keys"
CASE SMG$K_TRM_E1 TO SMG$K_TRM_E6
PRINT "You typed one of the editing keys"
CASE SMG$K_TRM_TIMEOUT
PRINT "You did not type a key fast enough"
CASE ELSE
PRINT "I'm not sure what key you typed"
END SELECT
!+
! Close the connection to SYS$INPUT, and signal any errors.
!-
RET_STATUS = SMG$DELETE_VIRTUAL_KEYBOARD( KB_ID )
IF (RET_STATUS AND 1%) = 0% THEN
CALL LIB$SIGNAL( RET_STATUS )
END IF
END
|
This BASIC example program demonstrates the use of SMG$READ_STRING. One
sample of the output generated by this program is as follows:
$ RUN READ_STRING
Enter timer value (0 to read type-ahead buffer): ? 5
d
data string = d
term_code = 13
You typed a control character
|
#2 |
C+
C This DEC Fortran example program demonstrates how to use
C SMG$READ_STRING.
C
C This routine creates a virtual display and writes it to the pasteboard.
C Data is placed in the virtual display using SMG$PUT_CHARS.
C-
C+
C Include the SMG definitions. In particular, we want SMG$M_BORDER.
C-
IMPLICIT INTEGER (A-Z)
INCLUDE '($SMGDEF)'
CHARACTER*20 TEXT
C+
C Create a virtual display with a border using 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 Create a virtual keyboard by calling SMG$CREATE_VIRTUAL_KEYBOARD.
C-
STATUS = SMG$CREATE_VIRTUAL_KEYBOARD ( KEYBOARD1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Use SMG$PASTE_VIRTUAL_DISPLAY to paste the virtual display
C at row 3, column 9.
C-
STATUS = SMG$PASTE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 3, 9 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Read a string from the virtual pasteboard using SMG$READ_STRING.
C-
STATUS = SMG$READ_STRING ( KEYBOARD1,
1 TEXT, 'prompt', 20, , , , , , DISPLAY1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
END
|
The output generated by this FORTRAN program before the call to
SMG$READ_STRING is shown in Figure SMG-38. The program is waiting for
input. The cursor immediately follows the word "prompt."
Figure SMG-38 Output Generated Before the Call to
SMG$READ_STRING
The output generated after the call to SMG$READ_STRING is shown in
Figure SMG-39.
Figure SMG-39 Output Generated After the Call to
SMG$READ_STRING
SMG$REMOVE_LINE
The Remove a Line from a Virtual Display routine removes a line from a
specified virtual display that was drawn with the SMG$DRAW_LINE or
SMG$DRAW_RECTANGLE routines.
Format
SMG$REMOVE_LINE display-id ,start-row ,start-column ,end-row ,end-column
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 from which the line is to be removed. 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 removing the line. The
start-row argument is the address of a signed longword
that contains the row number.
start-column
OpenVMS usage |
longword_signed |
type |
longword (signed) |
access |
read only |
mechanism |
by reference |
Specifies the column at which to begin removing the line. The
start-column argument is the address of a signed
longword that contains the column number.
In the case that the line is horizontal and the
start-column begins on the right portion of a
Korean 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
Korean characters for each row, the remaining portions of the
characters become undefined characters.
end-row
OpenVMS usage |
longword_signed |
type |
longword (signed) |
access |
read only |
mechanism |
by reference |
Specifies the row at which the line to be removed ends. The
end-row argument is the address of a signed longword
that contains the row number.
end-column
OpenVMS usage |
longword_signed |
type |
longword (signed) |
access |
read only |
mechanism |
by reference |
Specifies the column at which the line to be removed ends. The
end-column argument is the address of a signed
longword that contains the column number.
In case that the line is horizontal and the end-column
ends on the left portion of a Korean 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 Korean characters for each row, the remaining
portions of the characters will become undefined characters.
Description
SMG$REMOVE_LINE removes a line drawn with SMG$DRAW_LINE or
SMG$DRAW_RECTANGLE from a specified starting row and column to a
specified ending row and column.
This routine erases the line you specify but preserves the line-drawing
characters at any line intersection. (The line-drawing characters are
the terminal's line-drawing character set. If that is not available,
the characters +, - , and | are used.)
In case that the Korean language character set is used, and the
drawn line is on the left or right portion of the Korean
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$REPAINT_SCREEN
The Repaint Current Pasteboard routine repaints the specified
pasteboard after non-SMG$ I/O has occurred.
Format
SMG$REPAINT_SCREEN pasteboard-id
RETURNS
OpenVMS usage |
cond_value |
type |
longword (unsigned) |
access |
write only |
mechanism |
by value |
ARGUMENT
pasteboard-id
OpenVMS usage |
identifier |
type |
longword (unsigned) |
access |
read only |
mechanism |
by reference |
Specifies the pasteboard to be repainted. The
pasteboard-id argument is the address of an unsigned
longword that contains the pasteboard identifier.
Description
SMG$REPAINT_SCREEN repaints the specified pasteboard. It is intended to
be used when some outside agent (for example, a broadcast message) has
disrupted the pasteboard.
Condition Values Returned
SS$_NORMAL
|
Normal successful completion.
|
SMG$_INVPAS_ID
|
Invalid
pasteboard-id.
|
SMG$_WRONUMARG
|
Wrong number of arguments.
|
Example
|
C+
C This DEC Fortran example program demonstrates
C the use of SMG$REPAINT_SCREEN.
C-
IMPLICIT INTEGER (A-Z)
C+
C Create the virtual display by calling
C SMG$CREATE_VIRTUAL_DISPLAY. To create
C a border, we set BORDER = 1. No border
C would be BORDER = 0.
C-
INCLUDE '($SMGDEF)'
ROWS = 3
COLUMNS = 50
BORDER = 1
STATUS = SMG$CREATE_VIRTUAL_DISPLAY
1 (ROWS, COLUMNS, DISPLAY1, BORDER)
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Create the pasteboard using SMG$CREATE_PASTEBOARD.
C-
STATUS = SMG$CREATE_PASTEBOARD (PASTE1)
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Put data in the virtual display by calling SMG$PUT_CHARS.
C-
STATUS = SMG$PUT_CHARS ( DISPLAY1,
1 ' This virtual display has 3 rows and 50 columns.', 1, 1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
STATUS = SMG$PUT_CHARS ( DISPLAY1,
1 ' This is a bordered virtual display.', 2, 1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
STATUS = SMG$PUT_CHARS ( DISPLAY1,
1 ' SMG$PUT_CHARS puts data in this virtual display.', 3, 1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Call SMG$PASTE_VIRTUAL_DISPLAY to paste the virtual display.
C-
STATUS = SMG$PASTE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 4, 15 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Mess up the screen with some FORTRAN output.
C-
WRITE (6,*) 'Mess up the screen.'
WRITE (6,*) 'More mess.'
C+
C Call SMG$REPAINT_SCREEN to repaint the screen.
C-
STATUS = SMG$REPAINT_SCREEN ( PASTE1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
END
|
The output generated by this FORTRAN program before the call to
SMG$REPAINT_SCREEN is shown in Figure SMG-40.
Figure SMG-40 Output Generated by FORTRAN Program Calling
SMG$REPAINT_SCREEN
The output generated after the call to SMG$REPAINT_SCREEN is shown in
Figure SMG-41.
Figure SMG-41 Output Generated by FORTRAN Program Calling
SMG$REPAINT_SCREEN
SMG$REPASTE_VIRTUAL_DISPLAY
The Repaste Virtual Display routine moves a virtual display to a new
position on the pasteboard. The pasting order is not preserved.
Format
SMG$REPASTE_VIRTUAL_DISPLAY display-id ,pasteboard-id ,pasteboard-row
,pasteboard-column [,top-display-id]
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 to be repasted. 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.
pasteboard-id
OpenVMS usage |
identifier |
type |
longword (unsigned) |
access |
read only |
mechanism |
by reference |
Specifies the pasteboard on which the display is repasted. The
pasteboard-id argument is the address of an unsigned
longword that contains the pasteboard identifier.
pasteboard-row
OpenVMS usage |
longword_signed |
type |
longword (signed) |
access |
read only |
mechanism |
by reference |
Specifies the pasteboard row that is to contain row 1 of the specified
virtual display. The pasteboard-row argument is the
address of a signed longword that contains the pasteboard row.
pasteboard-column
OpenVMS usage |
longword_signed |
type |
longword (signed) |
access |
read only |
mechanism |
by reference |
Specifies the pasteboard column that is to contain column 1 of the
specified virtual display. The pasteboard-column
argument is the address of a signed longword that contains the
pasteboard column.
top-display-id
OpenVMS usage |
identifier |
type |
longword (unsigned) |
access |
read only |
mechanism |
by reference |
Optional identifier of the virtual display under which
display-id will be pasted. The
top-display-id argument is the address of an unsigned
longword containing the identifier of this virtual display. Note that
the virtual display specified by top-display-id must
already be pasted.
Description
SMG$REPASTE_VIRTUAL_DISPLAY lets you move a virtual display to a new
position on its pasteboard. This routine calls
SMG$UNPASTE_VIRTUAL_DISPLAY and SMG$PASTE_VIRTUAL_DISPLAY. Note that
this changes the pasting order. The unpasting and repasting operations
use the SMG$BEGIN_PASTEBOARD_UPDATE and SMG$END_PASTEBOARD_UPDATE
routines; thus, there is no effect on the screen until the repasting
operation is complete.
Note that this routine may cause the virtual display to be at the top
of the pasting order. To move a virtual display without changing its
pasting order, use SMG$MOVE_VIRTUAL_DISPLAY. If the optional argument
top-display-id is specified,
SMG$REPASTE_VIRTUAL_DISPLAY pastes the virtual display being repasted
under the virtual display specified by top-display-id.
In this case, the virtual display specified by
top-display-id must already be pasted.
Condition Values Returned
SS$_NORMAL
|
Normal successful completion.
|
SMG$_INVDIS_ID
|
Invalid
display-id.
|
SMG$_INVPAS_ID
|
Invalid
pasteboard-id.
|
SMG$_WRONUMARG
|
Wrong number of arguments.
|
Example
|
C+
C This DEC Fortran example program demonstrates the use of
C SMG$REPASTE_VIRTUAL_DISPLAY and SMG$MOVE_VIRTUAL_DISPLAY.
C-
IMPLICIT INTEGER (A-Z)
C+
C Include the SMG definitions. In particular, we want SMG$M_BORDER.
C-
INCLUDE '($SMGDEF)'
C+
C Create a virtual display with a border by calling
C SMG$CREATE_VIRTUAL_DISPLAY.
C-
ROWS = 3
COLUMNS = 50
STATUS = SMG$CREATE_VIRTUAL_DISPLAY
1 (ROWS, COLUMNS, DISPLAY1, SMG$M_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 Put data in the virtual display using SMG$PUT_CHARS.
C-
STATUS = SMG$PUT_CHARS ( DISPLAY1,
1 ' This virtual display has 3 rows and 50 columns.', 1, 1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
STATUS = SMG$PUT_CHARS ( DISPLAY1,
1 ' This is a bordered virtual display.', 2, 1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
STATUS = SMG$PUT_CHARS ( DISPLAY1,
1 ' SMG$PUT_CHARS puts data in this virtual display.', 3, 1 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Call SMG$PASTE_VIRTUAL_DISPLAY to paste the virtual display.
C-
STATUS = SMG$PASTE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 4, 15 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Move the virtual display by calling SMG$MOVE_VIRTUAL_DISPLAY.
C-
STATUS = SMG$MOVE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 10, 5 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
C+
C Call SMG$REPASTE_VIRTUAL_DISPLAY to repaste the
C original virtual display as it was.
C-
STATUS = SMG$REPASTE_VIRTUAL_DISPLAY ( DISPLAY1, PASTE1, 4, 15 )
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
END
|
The output generated by this FORTRAN program before the call to
SMG$MOVE_VIRTUAL_DISPLAY is shown in Figure SMG-42.
Figure SMG-42 Output Before the Call to
SMG$MOVE_VIRTUAL_DISPLAY
After the call to SMG$MOVE_VIRTUAL_DISPLAY, the output is that shown in
Figure SMG-43.
Figure SMG-43 Output Displayed After the Call to
SMG$MOVE_VIRTUAL_DISPLAY
Figure SMG-44 shows the final output displayed after the call to
SMG$REPASTE_VIRTUAL_DISPLAY.
Figure SMG-44 Output Displayed After the Call to
SMG$REPASTE_VIRTUAL_DISPLAY
|