.TITLE TERM "FTS Terminal-related routines" .IDENT /v1.0/ ;+ ; Facility: ; FTS_TERM.MAR - Generally deal with terminal specifics ; ; Abstract: ; ; Author: ; Bruce R. Miller, MILLER@TGV.COM ; TGV, Inc. ; 603 Mission St. ; Santa Cruz, CA 95060 ; (408) 427-4366 ; ; Date: ; 6-MAY-1991 ; ; Functional Description: ; ; Acknowledgements: ; Most stuff taken from CMU/Tek's Telnet_Term.B32 ; ; Copyright (c) 1991 Bruce R. Miller ; All rights reserved. ; ; Redistribution and use in source and binary forms are permitted ; provided that the above copyright notice and this paragraph are ; duplicated in all such forms and that any documentation, ; advertising materials, and other materials related to such ; distribution and use acknowledge that the software was developed ; by Bruce R. Miller. ; THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR ; IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ; WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ; ; Modifications: ; ; 9-SEP-1991 Ehud Gavron [edit by BRM] ; Removed associated mailbox from terminal channel to allow spawning. ; ;- .link "sys$system:sys.stb"/SELECTIVE_SEARCH .library "sys$Library:lib.mlb" $ssdef $rmsdef $smgdef TT_Channel: .BLKW 1 ; Special events concerning the terminal. */ TT_MBX_Chan: .WORD 1 TT_MBX_IOSB: .LONG 2; TT_MBX_Buffer: .BLKB 256 TT_MBX_Buffer_size: .LONG . - TT_MBX_Buffer Pasteboard_Id: .LONG 0 Display_Id: .LONG 0 KeyBoard_Id: .LONG 0 Key_Table_Id: .LONG 0 preserve_screen: .LONG 1 ; Don't clear screen on startup. Input_Device: .ASCID /SYS$COMMAND/ BUFSIZE = 512 ;++ ; Description: ; Initialize the terminal related stuff (yeah, that's right. stuff.) ;-- .entry FTS_SMG_Init,^m ; Assign a channel to the terminal CLRL -(SP) CLRL -(SP) PUSHAL TT_Channel PUSHAL Input_Device CALLS #4,G^SYS$ASSIGN BLBC R0,110$ ; Create the display CLRL -(SP) ; terminal type PUSHAL preserve_screen ; Should we clear the screen? CLRL -(SP) ; width of the screen. CLRL -(SP) ; height of the screen. CLRL -(SP) ; Output device. default is 'SYS$OUTPUT'. PUSHAL Pasteboard_Id ; We use this to get info about the display. CALLS #6,G^SMG$CREATE_PASTEBOARD BLBC R0,110$ ; Get a keybord for input PUSHAL KeyBoard_Id CALLS #1,G^SMG$CREATE_VIRTUAL_KEYBOARD BLBC R0,110$ ; Set it up PUSHAL Key_Table_Id CALLS #1,G^SMG$CREATE_KEY_TABLE BLBC R0,110$ 100$: RET 110$: ; Signal all errors PUSHL R0 CALLS #1,G^LIB$SIGNAL BRB 100$ ;++ ; FTS_Get_Input - Read from the input device ; ; 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. ; ; Input: ; 4(AP) - addr of descriptor of input string ; 8(AP) - addr of prompt string descriptor ; 12(AP) - address of long to store length in ; ;-- .entry FTS_Get_Input,^m PUSHL 12(AP) ; length ptr PUSHL 8(AP) ; Prompt string descriptor addr PUSHL 4(AP) ; Input string descriptor addr PUSHAL Key_Table_Id PUSHAL KeyBoard_Id CALLS #5,G^SMG$READ_COMPOSED_LINE CMPL R0,#SMG$_EOF BNEQ 20$ MOVL #RMS$_EOF,R0 BRB 100$ 20$: BLBS R0,100$ PUSHL R0 CALLS #1,G^LIB$SIGNAL 100$: ; That's all RET .entry Print_String,^m ; Format the string SUBL #BUFSIZE,SP PUSHL SP ; outbuf desc.pointer PUSHL #BUFSIZE ; outbuf desc.size MOVAL -(SP),R3 ; retlen pointer PUSHAL 8(AP) ; prmlst PUSHAL 4(R3) ; outbuf PUSHL R3 ; outlen PUSHL 4(AP) ; cstr CALLS #4,G^SYS$FAOL POPL R3 ; Get outlen MOVZWL R3,(SP) ; Fixup descriptor BLBC R0,100$ ; If failed exit error 40$: ; Send data PUSHL SP ; address of buffer descriptor CALLS #1,G^LIB$PUT_OUTPUT ; Print the message 100$: RET .END