rostamia@umbc3.UMD.EDU (Dr. Rouben Rostamian ) (01/04/88)
I would like to be able to redefine some typing keys on a LK201 (vt220, that is) keyboard in a command procedure. The DCL dictionary says that you may define the keys on the numeric keypad, some of the function keys, and the keys on the editing keypad with the exception of the up-arrow and down-arrow keys. Now, some application progams do define the up-arrow and down-arrow keys somehow, although not in DCL. Questions: 1. Does anyone know how to define the up-arrow and down-arow keys in DCL? 2. Does anyone know how to define some of the typing keys in DCL? For example, something equivalent to the silly definition $ define/key/terminate pf1 "show users" with the typing key "A", for instance, substituted for pf1. 3. Does anyone know how to use INQUIRE or READ to enter only one character with one keystroke, without having to press Return? For example, $ inquire/terminate char "Press any key" should assign char = "Q" if the Q key is pressed at the inquire prompt, without a need to type Return. Of course, the example above will not work, because /terminate is not a valid qualifier for Inquire. Hints, comments, suggestions, and flames :-) are appreciated. Rouben Rostamian
cfchiesa@bsu-cs.UUCP (Christopher F. Chiesa) (01/04/88)
In article <676@umbc3.UMD.EDU>, rostamia@umbc3.UMD.EDU (Dr. Rouben Rostamian ) writes: > > 1. Does anyone know how to define the up-arrow and down-arow keys in > DCL? > > 2. Does anyone know how to define some of the typing keys in DCL? > For example, something equivalent to the silly definition > $ define/key/terminate pf1 "show users" > with the typing key "A", for instance, substituted for pf1. > > 3. Does anyone know how to use INQUIRE or READ to enter only one > character with one keystroke, without having to press Return? Your three questions are all really aspects of the same thing. If you could perform (3) in DCL, you could write a command procedure to perform selected commands at the press of whatever key you wished, effectively implementing (1) and/or (2). Personally I'd avoid (2), unless you were absolutely certain you'd never want to type, say, the letter "A", for any purpose OTHER than to invoke your defined command! How would DCL know whether you were typing the defined key "A" meaning "show users," as opposed to a letter "A" that happened to appear as part of some other command? On the face of it (I haven't medi- tated on it or anything) this seems like an unwise thing to do. However, as far as I know, there is currently no way to perform any of these functions in DCL; in one sense, it just comes down to what the folks at DEC choose to include in DCL's input-handling capabilities. ALL computer keyboard input is based on reading characters one at a time and storing them someplace in memory; in DCL and other line-input environments, however, this takes place "internally," and there don't seem to be any "hooks" provided for the DCL user to access this input mode directly. It CAN be accessed from a VMS programming language, by use of the $QIO system service or (for example) an easier-to-use SMG$ get-single-character routine. Programs which allow you to "define keys" simply read individual characters this way and do their own processing. In DCL, READ and INQUIRE perform strictly line-oriented input; character-by- character input is hidden from us, and the RETURN character is required to terminate line input. DEFINE/KEY acts at an intermediate level, allowing us to specify SOME alternative input processing, but flexibility is limited, and ultimately NONE of these commands supports character-level terminal input. In my job at BSU's "computing services help desk," I've encountered this question many times, and it seems strange to me that character-level input ISN'T available in DCL. It seems as though it should be an almost ridiculously simple modification to VMS, one which ought not adversely affect compatibility with previous versions. I'd be interested in hearing DEC's rationale, if anyone familiar with it would care to respond. Chris Chiesa Senior, CS Dept. Ball State University Muncie, IN
LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) (01/05/88)
I would like to be able to redefine some typing keys on a LK201 (vt220, that is) keyboard in a command procedure. The DCL dictionary says that you may define the keys on the numeric keypad, some of the function keys, and the keys on the editing keypad with the exception of the up-arrow and down-arrow keys. Now, some application progams do define the up-arrow and down-arrow keys somehow, although not in DCL. You also can't (really) re-define F6-F10. It's worth understanding the back- ground: DCL (or any program) reads input through the terminal driver. The terminal driver, as usually used, supplies special semantics to certain keys; for example, the DELETE key isn't delivered to the program, but rather it deletes the preceding character. There are many modes of operation for the terminal driver, which allow control over what special meanings, if any, it assigns to some of the keys. If a program wishes to see a key "as it stands", it needs to set the terminal driver into the appropriate mode. Now, DCL ALSO assigns special meanings to some of the keys, with DEFINE/KEY. DCL will happily allow you to assign any meaning you like to any key, inclu- ding the left and right arrow keys and F6 to F10 - and, should it ever RECEIVE the code for one of those keys from the terminal driver, it will use your definitions; however, these keys are normally interpreted by the terminal driver, and DCL will never see them. The same is true for applications; they get around this by disabling the appropriate features in the terminal driver. You can't get the same fine-grained control from DCL, but you can get some of it. In particular, if you disable line editing (SET TERM/NOLINE), the terminal driver will no longer process the right and left arrow keys, and will instead deliver them to DCL. Disabling F6-F10 in the driver is harder; the only way I know of to do it is to define the terminal as a VT100, rather than a VT200 or VT300. The up and down arrow keys add yet another layer of complication. The ter- minal driver supports ONE line of recall, which it lets you get at with either the up or down arrow keys. Programs that do nothing special get this one line of recall - MAIL prior to V4.4, for example. Programs can, however, provide more lines of recall; the easiest way is with SMG$READ_COMPOSED_LINE. This function works by telling the terminal driver NOT to do any recall, but to just pass the up- and down-arrow keys through. DCL is one of the programs that does this (though it doesn't use SMG): It provides 20 lines of recall on its own. SET TERM/NOLINE does NOT disable DCL's special handling of the arrow keys. In fact, I know of no way to tell DCL to pass the up- and down- arrow keys to the user. Questions: 1. Does anyone know how to define the up-arrow and down-arow keys in DCL? You can't. 2. Does anyone know how to define some of the typing keys in DCL? For example, something equivalent to the silly definition $ define/key/terminate pf1 "show users" with the typing key "A", for instance, substituted for pf1. Again, this isn't possible. The basic feeling seems to be that it would be very confusing for users if random "normal" keys suddenly became "active". As it is now, there is a clear distinction between "normal" keys and "action" keys. Note that to do this, DCL would have to do single character input (rather expensive), or the terminal driver would have to be changed to allow "normal" keys to be terminators or to trigger AST's. 3. Does anyone know how to use INQUIRE or READ to enter only one character with one keystroke, without having to press Return? For example, $ inquire/terminate char "Press any key" Again, this can't be done with any standard DCL function - though it would be easy to write a program in almost any language that did this. (Any language that can issue QIO's, or already has a function to do single-character input, will let you get the character; LIB$SET_SYMBOL will let you make it available to the DCL procedure.) Really, DCL is not the right language to be writing the kinds of applications you seem to be thinking of in! -- Jerry
rrk@byuvax.bitnet (01/07/88)
$ SET TERMINAL/NOLINE should give you all function keys (f6-f20) $ SET TERMINAL/PASTHRU should give you arrow keys Sure it doesn't make DCL very fun, but for the very reason that you lost the editing functions.