Document revision date: 19 July 1999 | |
Previous | Contents | Index |
The Terminate a Subprocess routine deletes a subprocess that was created with the SMG$CREATE_SUBPROCESS routine.
SMG$DELETE_SUBPROCESS display-id
OpenVMS usage: cond_value type: longword (unsigned) access: write only mechanism: by value
display-id
OpenVMS usage: identifier type: longword (unsigned) access: read only mechanism: by reference
Identifier of the virtual display associated with the subprocess being deleted. The display-id argument is the address of an unsigned longword that contains this virtual display identifier.
SMG$DELETE_SUBPROCESS deletes a subprocess that was created by a call to SMG$CREATE_SUBPROCESS. Because the Screen Management Facility provides its own exit handlers, do not invoke SMG$DELETE_SUBPROCESS from within your own exit handler. For more information, see Section 4.4.
SS$_NORMAL Normal successful completion. SS$_xxxx Any status returned by $DELPRC. SMG$_INVDIS_ID Invalid display-id. SMG$_NOSUBEXI No subprocess exists. LIB$_xxxx Any status returned by LIB$FREE_VM.
The Delete a Viewport routine deletes the specified viewport from any pasteboards to which it is pasted.
SMG$DELETE_VIEWPORT display-id
OpenVMS usage: cond_value type: longword (unsigned) access: write only mechanism: by value
display-id
OpenVMS usage: identifier type: longword (unsigned) access: read only mechanism: by reference
Identifier of the virtual display associated with the viewport to be deleted. The display-id argument is the address of an unsigned longword containing the display identifier.
SMG$DELETE_VIEWPORT deletes a viewport. The viewport is automatically "unpasted" from any pasteboards to which it is pasted. However, the virtual display associated with the deleted viewport has not been deleted. To view this virtual display, you must paste it to the pasteboard with the SMG$PASTE_VIRTUAL_DISPLAY routine. To delete this virtual display, use the SMG$DELETE_VIRTUAL_DISPLAY routine.
SS$_NORMAL Normal successful completion. SMG$_INVDIS_ID Invalid display-id. SMG$_NO_WINASSOC No viewport associated with the virtual display. SMG$_WRONUMARG Wrong number of arguments.
The Delete Virtual Display routine deletes a virtual display.
SMG$DELETE_VIRTUAL_DISPLAY display-id
OpenVMS usage: cond_value type: longword (unsigned) access: write only mechanism: by value
display-id
OpenVMS usage: identifier type: longword (unsigned) access: read only mechanism: by reference
Specifies the virtual display to be deleted. The display-id argument is the address of an unsigned longword that contains the display identifier.The display identifier display-id is returned by SMG$CREATE_VIRTUAL_DISPLAY.
SMG$DELETE_VIRTUAL_DISPLAY deletes a virtual display and removes it from any pasteboard on which it is pasted. It also deallocates any buffer space associated with the virtual display.
SS$_NORMAL Normal successful completion. SMG$_INVDIS_ID Invalid display-id. SMG$_NOTPASTED The specified virtual display is not pasted to the specified pasteboard. SMG$_WILUSERMS Pasteboard is not a video terminal. SMG$_WRONUMARG Wrong number of arguments.
Any condition values returned by LIB$FREE_VM.
The Delete Virtual Keyboard routine deletes a virtual keyboard.
SMG$DELETE_VIRTUAL_KEYBOARD keyboard-id
OpenVMS usage: cond_value type: longword (unsigned) access: write only mechanism: by value
keyboard-id
OpenVMS usage: identifier type: longword (unsigned) access: read only mechanism: by reference
Specifies the virtual keyboard to be deleted. The keyboard-id argument is the address of an unsigned longword that contains the keyboard identifier.The keyboard identifier is returned by SMG$CREATE_VIRTUAL_KEYBOARD.
SMG$DELETE_VIRTUAL_KEYBOARD deletes a virtual keyboard. Any terminal attributes specified when the keyboard was created are reset to their previous values and the keypad mode (numeric or application) is reset to its original state. In addition, the channel is deassigned and, if the virtual keyboard was a file, the file is closed.Because SMG$ provides its own exit handlers, this routine should not be called from your own exit handler. For more information, see Section 4.4.
SS$_NORMAL Normal successful completion. SMG$_INVKBD_ID Invalid keyboard-id. SMG$_WRONUMARG Wrong number of arguments.
The Delete Terminal Table routine terminates access to a private TERMTABLE.EXE and frees the associated virtual address space.
SMG$DEL_TERM_TABLE
OpenVMS usage: cond_value type: longword (unsigned) access: write only mechanism: by value
None.
SMG$DEL_TERM_TABLE terminates access to a private TERMTABLE.EXE. Calling this routine is optional. This routine is useful in the case where a calling program might need to reuse the virtual address space used by a private TERMTABLE. This routine should be used only when you perform direct (non-SMG$) I/O to terminals.
SS$_NORMAL Normal successful completion.
The Disable Broadcast Trapping routine disables trapping of broadcast messages for the specified terminal.
SMG$DISABLE_BROADCAST_TRAPPING pasteboard-id
OpenVMS usage: cond_value type: longword (unsigned) access: write only mechanism: by value
pasteboard-id
OpenVMS usage: identifier type: longword (unsigned) access: read only mechanism: by reference
Specifies the pasteboard for the terminal to be affected. The pasteboard-id argument is the address of an unsigned longword that contains the pasteboard identifier.
SMG$DISABLE_BROADCAST_TRAPPING disables trapping of broadcast messages for the specified terminal. SMG$DISABLE_BROADCAST_TRAPPING deassigns the mailbox set with SMG$SET_BROADCAST_TRAPPING, resets the terminal characteristics, and therefore allows the user to call LIB$SPAWN. This routine must be used to disable any broadcast trapping set with the routine SMG$SET_BROADCAST_TRAPPING.When you disable broadcast trapping, any broadcast messages that have been queued to the terminal are lost. If you enable broadcast trapping with SMG$SET_BROADCAST_TRAPPING but do not disable it with SMG$DISABLE_BROADCAST_TRAPPING before the image exits, any messages that have been broadcast to the terminal are lost when the image exits.
Note that if both broadcast trapping and the trapping of unsolicited input are enabled, then both SMG$DISABLE_BROADCAST_TRAPPING and SMG$DISABLE_UNSOLICITED_INPUT must be invoked to deassign the mailbox.
SS$_NORMAL Normal successful completion. SMG$_WRONUMARG Wrong number of arguments.
Any condition value returned by $QIOW.
10 !+ !This VAX BASIC program creates three virtual displays on !one pasteboard. ! !The first virtual display contains instructions for the user, !the second shows trapped unsolicited input, and the third !lists trapped broadcast messages. The program sits in an !infinite loop until the user types a Ctrl/Z. ! !When the program traps unsolicited input, both broadcast message !and unsolicited input trapping are disabled, and a subprocess !is spawned which executes the trapped user input. ! !When control returns to the main process, broadcast trapping and !the trapping of unsolicited input are both reenabled. If the !unsolicited input which is trapped is a Ctrl/Z, the program exits. !- OPTION TYPE = EXPLICIT !+ !Declaration of all routines called by the main program. !- %INCLUDE "LIB$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "SMG$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" !+ !Declaration of the two AST routines: !GET_MSG is called when a broadcast message is trapped !GET_INPUT is called when there is unsolicited input !GET_INPUT is the routine which spawns the subprocess !- EXTERNAL INTEGER GET_MSG EXTERNAL INTEGER GET_INPUT DECLARE LONG pb_id, ret_status, display_id, display2_id, display3_id, & key_id, key_tab_id, counter !+ !Create a MAP area for variables which must be shared between the !main program and the AST routines. !- MAP (params) LONG disp_info(2), LONG keyboard_info(4), LONG done_flag DECLARE STRING CONSTANT top_label = "User Input" DECLARE STRING CONSTANT ins_label = "Instructions" DECLARE STRING CONSTANT msg_label = "Messages" DECLARE STRING CONSTANT instr_0 = "Type commands to fill INPUT display." DECLARE STRING CONSTANT instr_1 = "Type Ctrl/T to fill MESSAGES display." DECLARE STRING CONSTANT instr_2 = "Type Ctrl/Z to exit." DECLARE LONG CONSTANT advance = 1 %INCLUDE "$SMGDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "$SMGMSG" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" !+ !The done_flag variable is clear (0) unless the user input was !a Ctrl/Z. In that case, the program exits. !- done_flag = 0 !+ !Create the pasteboard and the virtual keyboard !- ret_status = SMG$CREATE_PASTEBOARD (pb_id) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !This is one of the values which must be stored in the MAP area. !- disp_info(0) = pb_id ret_status = SMG$CREATE_VIRTUAL_KEYBOARD (key_id) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$CREATE_KEY_TABLE (key_tab_id) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !Create the three virtual displays !- ret_status = SMG$CREATE_VIRTUAL_DISPLAY(3 BY REF, 75 BY REF, & display3_id, SMG$M_BORDER BY REF, SMG$M_REVERSE BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$CREATE_VIRTUAL_DISPLAY(6 BY REF, 75 BY REF, & display_id, SMG$M_BORDER BY REF, SMG$M_REVERSE BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$CREATE_VIRTUAL_DISPLAY(6 BY REF, 75 BY REF, & display2_id, SMG$M_BORDER BY REF, SMG$M_REVERSE BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !The disp_info and keyboard_info arrays are required in the MAP. !- disp_info(1) = display2_id keyboard_info(0) = key_id keyboard_info(1) = key_tab_id keyboard_info(2) = display_id keyboard_info(4) = pb_id !+ !Put Label borders around the three virtual displays. !- ret_status = SMG$LABEL_BORDER (display3_id, ins_label,,, & SMG$M_BOLD BY REF, SMG$M_REVERSE BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$LABEL_BORDER (display_id, top_label,,, & SMG$M_BOLD BY REF,) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$LABEL_BORDER (display2_id, msg_label,,, & SMG$M_BOLD BY REF,) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !Fill the INSTRUCTIONS virtual display with user instructions. !- ret_status = SMG$PUT_LINE(display3_id, instr_0, & advance,,, smg$m_wrap_char) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$PUT_LINE(display3_id, instr_1, & advance,,, smg$m_wrap_char) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$PUT_LINE(display3_id, instr_2, & advance,,, smg$m_wrap_char) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !Paste the virtual displays to the screen. !- ret_status = SMG$PASTE_VIRTUAL_DISPLAY(display3_id, pb_id, & 2 BY REF, 4 BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$PASTE_VIRTUAL_DISPLAY(display_id, pb_id, & 8 BY REF, 4 BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF ret_status = SMG$PASTE_VIRTUAL_DISPLAY(display2_id, pb_id, & 18 BY REF, 4 BY REF) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !Enable the trapping of unsolicited input. GET_INPUT is the !AST procedure that is called when unsolicited input is !received. This AST has one parameter, passed as null. !- ret_status = SMG$ENABLE_UNSOLICITED_INPUT(pb_id, LOC(GET_INPUT)) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !Enable the trapping of broadcast messages. GET_MSG is the !AST which is called when broadcast messages are received. !This AST outputs the trapped message into the MESSAGES display. !- ret_status = SMG$SET_BROADCAST_TRAPPING(pb_id, LOC(GET_MSG)) IF (ret_status AND 1%) = 0% THEN CALL LIB$STOP(ret_status BY VALUE) END IF !+ !This loop continually executes until done_flag is set to 1. !Done_flag is set to 1 when the user input is a Ctrl/Z. !If done_flag is 1, delete the pasteboard and exit the program. !- Infinite_loop: IF done_flag = 0 THEN GOTO infinite_loop ELSE ret_status = SMG$DELETE_PASTEBOARD (pb_id) GOTO all_done END IF All_done: END 20 !+ !Start of AST routine GET_INPUT. This AST is called whenever there !is unsolicited input. The unsolicited input is displayed in the !INPUT virtual display, and if this input is not Ctrl/Z, a subprocess !is spawned and the input command is executed. While this spawned !subprocess is executing, broadcast and unsolicited input trapping !are disabled. !- SUB GET_INPUT (paste_id, param, nl_1, nl_2, nl_3, nl_4) MAP (params) LONG disp_info(2), LONG keyboard_info(4), LONG done_flag DECLARE LONG z_status, status2, keybd_id, keybd_tab_id, disp_id, & pastebd, new_display, spawn_status DECLARE WORD msg2_len DECLARE STRING msg2 DECLARE LONG CONSTANT next_line = 1 %INCLUDE "SMG$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "LIB$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "$SMGMSG" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" EXTERNAL INTEGER GET_MSG EXTERNAL INTEGER GET_INPUT !+ !Assign to the local variables the values that were stored from !the main program using the MAP area. !- keybd_id = keyboard_info(0) keybd_tab_id = keyboard_info(1) disp_id = keyboard_info(2) pastebd = keyboard_info(3) !+ !SMG$ENABLE_UNSOLICITED_INPUT does not read the input, it simply !signals the specified AST when there is unsolicited input present. !You must use SMG$READ_COMPOSED_LINE to actually read the input. ! !At this time, we check to see if the unsolicited input was a Ctrl/Z. !If so, we skip over the program lines that spawn the subprocess and !get ready to exit the program. !- status2 = SMG$READ_COMPOSED_LINE (keybd_id, keybd_tab_id, msg2,, & msg2_len, disp_id) IF (status2 = SMG$_EOF) THEN GOTO Control_Z END IF IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF !+ !In order to spawn a subprocess, we must first disable !unsolicited input trapping and broadcast trapping. !- status2 = SMG$DISABLE_UNSOLICITED_INPUT (pastebd) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF status2 = SMG$DISABLE_BROADCAST_TRAPPING (pastebd) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF !+ !Save the current screen so that it will not be destroyed when !the subprocess is executing. !- status2 = SMG$SAVE_PHYSICAL_SCREEN (pastebd, new_display) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF !+ !Call LIB$SPAWN to create the subprocess, and pass the unsolicited !input as the command line. !- spawn_status = LIB$SPAWN (msg2) !+ !Restore the saved screen image. !- status2 = SMG$RESTORE_PHYSICAL_SCREEN (pastebd, new_display) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF !+ !Reenable broadcast trapping and unsolicited input trapping. !- status2 = SMG$ENABLE_UNSOLICITED_INPUT (pastebd, LOC(GET_INPUT)) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF status2 = SMG$SET_BROADCAST_TRAPPING (pastebd, LOC(GET_MSG)) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF !+ !Skip the steps which are performed if the unsolicited input !was a Ctrl/Z. !- GOTO Out_of_sub Control_Z: !+ !We should disable unsolicited input and broadcast trapping !before we leave the program. !- status2 = SMG$DISABLE_UNSOLICITED_INPUT (pastebd) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF status2 = SMG$DISABLE_BROADCAST_TRAPPING (pastebd) IF (status2 AND 1%) = 0% THEN CALL LIB$STOP (status2 BY VALUE) END IF !+ !Set the done_flag to 1 so that the main program knows we have !to exit. !- done_flag = 1 Out_of_sub: END SUB 30 !+ !Start of AST routine GET_MSG. This AST is called whenever there !is a broadcast message. This routine prints the message in the !MESSAGES virtual display. !- SUB GET_MSG (paste_id, nl_1, nl_2, nl_3, nl_4) DECLARE LONG status1, pasteboard, second_disp DECLARE WORD msg_len DECLARE STRING msg DECLARE LONG CONSTANT forward = 1 MAP (params) LONG disp_info(2), LONG keyboard_info(4) %INCLUDE "SMG$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "LIB$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "$SMGDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" %INCLUDE "$SMGMSG" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET" !+ !Assign values to the local variables according to the values stored !in the MAP area. !- pasteboard = disp_info(0) second_disp = disp_info(1) !+ !Print the trapped message in the MESSAGES display. If there are no !more messages, go back to the infinite loop in the main program. !- WHILE 1 status1 = SMG$GET_BROADCAST_MESSAGE (pasteboard, msg, msg_len) IF (status1 = SMG$_NO_MORMSG) THEN GOTO Exitloop END IF IF (status1 AND 1%) = 0% THEN CALL LIB$STOP (status1 BY VALUE) END IF status1 = SMG$PUT_LINE (second_disp, msg, & forward,,, SMG$M_WRAP_CHAR) IF (status1 AND 1%) = 0% THEN CALL LIB$STOP (status1 BY VALUE) END IF NEXT Exitloop: END SUB |
To run the example program, use the following commands.
$ BASIC TRAPPING $ LINK TRAPPING $ RUN TRAPPINGThe output for this program is shown in the following figures. In Figure SMG-14, the program is waiting for either unsolicited input or broadcast messages.
Figure SMG-14 Output Generated Before Any Input or Messages Are Trapped
The output generated after the user presses Ctrl/T is shown in Figure SMG-15.
Figure SMG-15 Output Generated After a Broadcast Message Is Trapped
If the user types a command, that command is displayed in the INPUT display, and a subprocess is spawned. The output generated after the user types the MAIL command is shown in Figure SMG-16.
Figure SMG-16 Output Generated After a Call to LIB$SPAWN
Once the subprocess completes execution, control is returned to the main process. At this point, the screen is repainted and the program continues to wait for broadcast messages or unsolicited input. The user must press Ctrl/Z to exit the program.
Previous | Next | Contents | Index |
privacy and legal statement | ||
5935PRO_015.HTML |