Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hplabs!ucbvax!XEROX.COM!"James_A._Gray.OsbuSouth" From: "James_A._Gray.OsbuSouth"@XEROX.COM Newsgroups: comp.os.vms Subject: Re: How to get multi-level command history to work? Message-ID: <870625-035641-3204@Xerox> Date: Thu, 25-Jun-87 06:56:17 EDT Article-I.D.: Xerox.870625-035641-3204 Posted: Thu Jun 25 06:56:17 1987 Date-Received: Sat, 27-Jun-87 04:26:56 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 60 Here's a new question, which I'm surprised hasn't been discussed here already. The version 4 terminal driver provides for recall of the previous command line, and DCL somehow extends this to the last 20 lines. More recently, DEBUG and CMS (and probably others) have also acquired the same functionality. The obvious question is, how can I make my own interactive applications interact with the terminal driver to provide deeper command history? I am sure that there are undocumented terminal driver qio's which implement this, and I could go off and wade through the fiche, but surely someone out there knows, and I'm sure many people would be interested to hear how. The answer to this question is to use SMG$READ_COMPOSED_LINE. The following sample program (FORTRAN) shows what needs to be done to use this feature in a program which does not use the SMG routines for screen I/O. Note that it defines a 30 line recall buffer. Jim PROGRAM SMG C PARAMETER 1 RECALL_SIZE = 30 C CHARACTER 1 RECEIVED_TEXT*132 C INTEGER 1 KEYBOARD_ID, 1 KEY_TABLE_ID, 1 RECEIVED_STRING_LENGTH, 1 SMG$CREATE_KEY_TABLE, 1 SMG$CREATE_VIRTUAL_KEYBOARD, 1 SMG$DELETE_VIRTUAL_KEYBOARD, 1 SMG$READ_COMPOSED_LINE, 1 STATUS C EXTERNAL 1 SMG$_EOF C 10 FORMAT (' Echo input: ',A) C STATUS = SMG$CREATE_VIRTUAL_KEYBOARD (KEYBOARD_ID, , , , RECALL_SIZE) IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS)) STATUS = SMG$CREATE_KEY_TABLE (KEY_TABLE_ID) IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS)) 1000 STATUS = SMG$READ_COMPOSED_LINE (KEYBOARD_ID, KEY_TABLE_ID, 1 RECEIVED_TEXT, 'SMG Demo> ', RECEIVED_STRING_LENGTH) IF (STATUS .EQ. %LOC(SMG$_EOF)) GOTO 9000 IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS)) WRITE (UNIT=*, FMT=10) RECEIVED_TEXT(1:RECEIVED_STRING_LENGTH) GOTO 1000 C 9000 STATUS = SMG$DELETE_VIRTUAL_KEYBOARD (KEYBOARD_ID) IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS)) CALL EXIT C END