1 SUB SMG_OPEN(STRING Paint_character, LONG Clear_screen_flag) !---------------------------------------------------------------& ! & ! SMG_OPEN & ! & ! Creation Date: 3-July-1985 & ! Author: Ken Messer & ! Purpose: Set up a pasteboard, a virtual & ! keyboard, a virtual display, & ! and an error message virtual & ! display. Load the SMG common. & ! & ! Modification history & ! & ! Date Description of change(s) & ! & !---------------------------------------------------------------& ! & ! Copyright (c) 1985 - Ken Messer, Allied Electronics, Inc., & ! 401 E. 8th St., Ft. Worth, TX 76102 & ! & ! This software may be copied and distributed freely to anyone & ! for non-commerical use provided that this copyright notice is & ! included. & !---------------------------------------------------------------& OPTION TYPE = INTEGER, SIZE = INTEGER LONG %include "SMG$LIBRARY:SMG.DFN" DECLARE LONG Return_status, & PB_rows, & PB_cols DECLARE LONG CONSTANT True = -1, & False = 0 EXTERNAL LONG FUNCTION SMG$Create_pasteboard, & SMG$Create_virtual_display, & SMG$Create_virtual_keyboard, & SMG$Set_keypad_mode, & SMG$Paste_virtual_display EXTERNAL LONG CONSTANT SS$_Normal, & SMG$M_Reverse, & IO$M_Nofiltr, & IO$M_Trmnoecho, & IO$M_Noecho EXTERNAL STRING FUNCTION Get_Error_Message(LONG) !---------------------------------------------------------------& ! & ! M a i n P r o g r a m L o g i c & ! & !---------------------------------------------------------------& ! The following are used in the input routines: ! 1) paint_char - a display character to mark the input field ! 2) del_seq - the "delete sequence" to write when the user hits ! the delete key - BSP + paint char + BSP ! 3) input function modifiers - these are used for different phases ! of input ! 4) Input_display_attr - used to set the input display field to ! reverse video Paint_char = paint_character Del_seq = CHR$(8) + Paint_char + CHR$(8) Number_virtual_displays = 1 Input_function_modifier1 = (IO$M_Nofiltr OR IO$M_Trmnoecho) Input_function_modifier2 = (Input_function_modifier1 OR IO$M_Noecho) Input_display_attr = (Input_display_attr OR SMG$M_Reverse) ! set up terminator set for SMG$Read_string ! all ASCII characters 0-31 plus 127 (delete) ! 7 bit characters only Term_set_mask(0) = -1 ! set all bits Term_set_mask(1),Term_set_mask(2) = 0 ! set no bits Term_set_mask(3) = O"20000000000"L ! set bit 31 only Term_set_mask_size = 16 Term_set_mask_loc = LOC(Term_set_mask(0)) ! set up pasteboard - defaults to screen size (80 X 24) ! clear screen if user wants to do so SELECT Clear_screen_flag CASE False Return_status = SMG$Create_pasteboard(Pasteboard_id(0),"TT",PB_rows,PB_cols,1) CASE ELSE Return_status = SMG$Create_pasteboard(Pasteboard_id(0),"TT",PB_rows,PB_cols,) END SELECT IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF Number_pasteboards = 1 Current_pasteboard_id = Pasteboard_id(0) ! set up error line virtual display - one row Return_status = SMG$Create_virtual_display(1,PB_cols,Err_display_id,,,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF ! set up one virtual display to match the pasteboard ! any other virtual displays needed must be set up separately ! by the user program Return_status = SMG$Create_virtual_display(PB_rows,PB_cols,Display_id(0),,,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF ! set up a virtual keyboard - asscociate it with TT: Return_status = SMG$Create_virtual_keyboard(Keyboard_id(0),"TT",,,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF Current_keyboard_id = Keyboard_id(0) ! set keypad to numeric mode (it starts out in keypad mode for some ! dumb reason) Return_status = SMG$Set_keypad_mode(Keyboard_id(0),0) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF ! paste the virtual display - user program can unpaste it if desired Return_status = SMG$Paste_virtual_display(Display_id(0),Current_pasteboard_id,1,1,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF SUBEXIT END SUB