%( **************************************************************** Copyright (c) 1992, Carnegie Mellon University All Rights Reserved Permission is hereby granted to use, copy, modify, and distribute this software provided that the above copyright notice appears in all copies and that any distribution be for noncommercial purposes. Carnegie Mellon University disclaims all warranties with regard to this software. In no event shall Carnegie Mellon University be liable for any special, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data, or profits arising out of or in connection with the use or performance of this software. **************************************************************** )% MODULE IPNCP_Term ( LANGUAGE (BLISS32), IDENT = 'V1.0', LIST (ASSEMBLY, NOBINARY, NOEXPAND)) = BEGIN !++ ! IPNCP_Term.B32 ! ! Copyright (c) 1989 Carnegie Mellon University ! ! Description: ! ! Generally deal with terminal specifics. ! ! Written By: ! ! Bruce Miller 06-Sep-1989 CMU Network Development ! Most stuff taken from Telnet_Term.B32 ! ! Modifications: ! !-- LIBRARY 'SYS$LIBRARY:STARLET'; LIBRARY 'IPNCP'; GLOBAL TT_Channel : WORD UNSIGNED, ! Special events concerning the terminal. TT_MBX_Chan : WORD UNSIGNED, TT_MBX_Buffer : VECTOR [256, BYTE, UNSIGNED], TT_MBX_IOSB : $BBLOCK [8]; OWN Pasteboard_Id, Display_Id, KeyBoard_Id, Key_Table_Id, preserve_screen : INITIAL(1); ! Don't clear screen on startup. GLOBAL ROUTINE IPNCP_SMG_Init = !++ ! Description: ! ! Initialize the terminal related stuff (yeah, that's right. stuff.) !-- BEGIN EXTERNAL ROUTINE LIB$ASN_WTH_MBX : BLISS ADDRESSING_MODE (GENERAL), SMG$CREATE_PASTEBOARD : BLISS ADDRESSING_MODE (GENERAL), SMG$CREATE_VIRTUAL_KEYBOARD : BLISS ADDRESSING_MODE (GENERAL), SMG$CREATE_KEY_TABLE : BLISS ADDRESSING_MODE (GENERAL); LOCAL Status; Status = LIB$ASN_WTH_MBX ( %ASCID 'SYS$COMMAND', %REF ( %ALLOCATION (TT_MBX_Buffer)), %REF ( %ALLOCATION (TT_MBX_Buffer)), TT_Channel, TT_MBX_Chan); IF NOT .Status THEN Signal (.Status); Status = SMG$CREATE_PASTEBOARD ( Pasteboard_Id, ! We use this to get information about displ. 0, ! Output device. default is 'SYS$OUTPUT' 0, ! height of the screen. 0, ! width of the screen. preserve_screen ! Should we clear the screen? ); IF NOT .Status THEN Signal (.Status); ! Status = SMG$CREATE_VIRTUAL_DISPLAY ( ! 0, ! number-of-rows ! 0, ! number-of-columns ! Display_Id, ! display-id ! 0, ! display-attributes ! 0, ! video-attributes ! 0 ! character-set ! ); ! IF NOT .Status THEN Signal (.Status); Status = SMG$CREATE_VIRTUAL_KEYBOARD (KeyBoard_Id); IF NOT .Status THEN Signal (.Status); Status = SMG$CREATE_KEY_TABLE (Key_Table_Id); IF NOT .Status THEN Signal (.Status); SS$_NORMAL END; !++ ! A useful formatted printing routine. ! !-- GLOBAL ROUTINE IPNCP_TT_FAO (Control_string) = !++ ! Functional Description: ! ! Format and write the formatted string to SYS$COMMAND: ! Usually called through the macro PRINTTT in IPNCP.REQ !-- BEGIN BUILTIN AP; LOCAL Out_Buffer : VECTOR[256, BYTE], Out_Desc : BLOCK[8, BYTE], Status; Out_Desc[DSC$B_CLASS] = DSC$K_CLASS_Z; Out_Desc[DSC$B_DTYPE] = DSC$K_DTYPE_Z; Out_Desc[DSC$W_LENGTH] = %ALLOCATION (Out_Buffer); Out_Desc[DSC$A_POINTER] = Out_Buffer; Status = $FAOL ( CTRSTR = .Control_String, OUTLEN = Out_Desc[DSC$W_LENGTH], OUTBUF = Out_Desc, PRMLST = .AP+8); IF NOT .Status THEN RETURN .Status; Status = $QIOW ( FUNC = IO$_WRITEVBLK, CHAN = .TT_Channel, P1 = Out_Buffer, P2 = .Out_Desc [DSC$W_LENGTH]); .Status END; GLOBAL ROUTINE IPNCP_GET_Input (Get_Str_A, Prompt_Str_A, Out_Len_A) = !++ ! Functional Description: ! ! This routine is used to get input for cli$dcl_parse. ! The format of the arguements must be the same as ! LIB$GET_INPUT. ! ! I like SMG 'cause it gives us command recall. ! And eventually, we might wanna use SMG for output. !-- BEGIN BIND Get_Str = .Get_Str_A : $BBLOCK, Prompt_Str = .Prompt_Str_A : $BBLOCK, Out_Len = .Out_Len_A : WORD UNSIGNED; EXTERNAL ROUTINE SMG$READ_COMPOSED_LINE : BLISS ADDRESSING_MODE (GENERAL); EXTERNAL LITERAL SMG$_EOF; LOCAL Status; Status = SMG$READ_COMPOSED_LINE ( %REF (.KeyBoard_Id), %REF (.Key_Table_Id), Get_Str, Prompt_Str, Out_Len); IF .Status EQL SMG$_EOF THEN RETURN (RMS$_EOF); IF NOT .Status THEN Signal (.Status); SS$_NORMAL END; END ELUDOM