Caché MultiValue Terminal Independence
Terminal Input
Go to:

The KEYS command
The KEYS command allows the user to see what characters are returned from the keyboard after depressing a particular key. The input will therefore be 100% binary and all characters will be interpreted by the KEYS command. Because of the manner of executing this command, there cannot be a "quit program" keystroke. Instead, the command will terminate after 10 seconds of inactivity.
This KEYS command is very useful when "debugging" a terminal definition. For example, to see what keystroke function key 3 generates, issue the KEYS command, depress function key 3, and then wait 10 seconds for the KEYS program to terminate. The following example shows that, on this terminal, pressing F3 generates an escape character followed by ASCII "O" and then ASCII "R".
This program terminates after 10 seconds of inactivity.
Key: ESC           0x1B  27
Key: O             0x4F  79
Key: R             0x52  82
Key: Timeout
Keyboard Independence
jBASE provides a pair of supplied subroutines called CommandInit and CommandNext. These subroutines are supplied in the dev/mv/samples directory supplied with Caché. Also included in the dev/mv/samples directory is the CommandInclude file, which is a replacement for the jCmdKeys.h file used in jBASE keyboard independence. This source defines values such as cmd_cursor_up which a jBASE application will probably be using. The values specified in Caché are different from jBASE, but the end result is the same. This mechanism is available for all emulations, not just jBASE.
For jBASE releases 4.1 and higher, these subroutines were renamed JBASECommandInit and JBASECommandNext, so depending upon which release of jBASE you are porting from, you might need to rename these subroutines in our dev/mv/samples directory.
To use these samples, you can copy them to your own source file and compile and catalog them. The following selection shows an example of creating a MultiValue file called COMMANDBP which points directly to the samples themselves. This is used to compile and catalog the source code directly from the dev/mv/samples directory, and then run a small example program to show the installation has worked. The example can also be copied to a local file and run from there.
New record.
0001= F
0002= C:\InterSystems\CacheSysBuild282\dev\mv\samples
0003= C:\InterSystems\CacheSysBuild282\dev\mv\samples
Bottom at line 3.
"COMMANDBP" filed in file "VOC".
USER:BASIC COMMANDBP CommandInit CommandNext CommandExample
[B0] Compilation completed.
[B0] Compilation completed.
[B0] Compilation completed.
USER:CATALOG COMMANDBP CommandInit CommandNext CommandExample
[243] 'CommandInit' Cataloged Local.
[243] 'CommandNext' Cataloged Local.
[243] 'CommandExample' Cataloged Local.
Function key 2 pressed
Function key 3 pressed
cmd returned was '2'
Timeout after 5 seconds
Alpha character returned, value = 'x'