home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boston 2
/
boston-2.iso
/
DOS
/
HILFEN
/
MODEM
/
COMAND28
/
REMAP.DOC
< prev
next >
Wrap
Text File
|
1993-12-01
|
23KB
|
825 lines
COM-AND Remap Script
-------------------------------------------
COM-AND Remap Script
Script based compiler for COM-AND remapping
-------------------------------------------
COM-AND is distributed freely and may be copied by anyone for
any number of machines, for purposes of evaluation. The author
offers COM-AND and its accessory programs as a package, as
"shareware". If you USE the program a registration of $50.00 is
required. The author may be reached:
CABER Software
R. (Scott) McGinnis
P.O. Box 3607 Mdse Mart
Chicago, IL 60654-0607
PLINK, GEnie id: TARTAN
CIS id: 73147,2665
Version 1.2: 910711
COM-AND Remap Script
Table of Contents
-----------------
I. Introduction .............................................. page 1
A. What is COM-AND ......................................... page 1
B. Terminal Emulation ...................................... page 1
C. The REMAP Script ........................................ page 1
II. Running REMAP.CMD .......................................... page 2
III. REMAP source files ......................................... page 3
A. Comments ................................................ page 3
B. Section names ........................................... page 3
C. Redefinitions ........................................... page 3
D. Remapped keys within redefinitions ...................... page 5
IV. DOORWAY Remaps ............................................. page 6
V. Program Requirements ....................................... page 7
VI. Program and Author Information ............................ page 8
Appendices
----------
A. File structures ............................................ page 9
B. Syntax ..................................................... page 10
C. Tokens ..................................................... page 11
D. Sample file ................................................ page 12
E. Unusual Remaps ............................................. page 13
Version 1.2: 910711
COM-AND Remap Script Page 1
I. Introduction
A. What is COM-AND?
COM-AND for the IBM PC and compatibles is a communications program
that may be used by itself, or with several integrated accessory
programs (which themselves may be used independently of COM-AND).
COM-AND provides standard comm program functions: a dialing
directory, macros, disc logging, binary and ASCII file transfers,
scripted execution and so on.
B. Terminal Emulation
COM-AND also supports terminal emulation through 'display emula-
tion', 'translation', and 'keyboard remapping' functions. These
functions are independent... VT100 display emulation may be com-
bined with the VT100 keyboard remap supplied, or the display
emulation may be combined with a different remap (one constructed
to a different set of preferences).
C. The REMAP script
The script REMAP.CMD is a compiler of sorts. It defines 'codes'
for each key COM-AND can detect (it can't detect all keys) and a
simple syntax for redefinition. REMAP.CMD also allows several
redefinitions to be combined in one source file; each set of
definitions being given a name.
This document discusses the function of the REMAP.CMD script,
and the syntax used in source files given to REMAP.CMD.
Version 1.2: 910711
COM-AND Remap Script Page 2
II. Running REMAP.CMD
The REMAP script is invoked through COM-AND's script processor (F2).
When invoked, REMAP opens a window offering a menu of choices. The
choices are:
1) Compile source into a new remap file (COM-AND.RMP)
Compilation of a source file produces a new COM-AND.RMP file
for use by COM-AND. The source file name is requested; when
the source file is opened it is scanned once for 'sections'.
If the source file contains one or more 'sections' (i.e. NAME
commands) the section names will be listed in a new window, and
one must be selected.
When a source file contains no sections, or when a section has
been selected, a new window is opened and the compilation begins.
Lines of text are displayed within the new window as they are
processed. Press ESC to pause the compilation.
2) Syntax check a source file
REMAP allows a syntax check as well as compile. A syntax check
results in no change to the current COM-AND.RMP.
3) Search for files (Alt-F)
REMAP allows you to search for files using the Alt-F file
directory function of COM-AND.
4) Edit a file (you supply the editor)
REMAP allows you to invoke an editor on a source file (the syntax
for the invocation is assumed - you may wish to change it). When
you exit the editor, you are returned to COM-AND and REMAP.
5) Turn remap on (using current COM-AND.RMP map file)
6) Turn remap off
Version 1.2: 910711
COM-AND Remap Script Page 3
III. REMAP source files
REMAP expects an ASCII file as source for the compilation. ASCII
files are prepared by text editors (e.g. EDLIN). Word processors
usually do not emit ASCII files... if you wish to use a word pro-
cessor to prepare a source file for REMAP, be sure that it gives
you ASCII output (often called non-document format).
[NOTE: The REMAP script allows you to invoke a text editor or word
processor from within the script itself. Modify the first line of
the script to declare the complete program name (e.g. C:\PE.EXE).
If you leave it blank, REMAP will query for a program name.]
Lines of source to REMAP.CMD are limited in length to 80 characters.
Source files contain three types of lines:
A. Comments
Comment lines are blank, or begin with ";" or "*". They are
ignored by the compiler.
B. Section names
The source file may (optionally) be divided into several sections
through the inclusion of "NAME = ..." command lines. REMAP scans
the file before compilation; if section names are found, a window
is opened and you are asked to select a section to compile.
C. Redefinitions
All other lines of a source file are redefinitions. A redefin-
ition command declares that a given key is to be redefined as
another key or keys. For example:
A = B ; redefines the 'A' key as 'B'
0x1a = AltX ; Redefines control-z (0x1a) as Alt-X
0x80 = F2 "remap.cmd!"
The last example requires some explanation... 0x80 is 80 hex.
to get an 80 hex using the keyboard, press and hold the ALT key
while typing 1 2 8 on the numeric pad (128 decimal is 80 hex).
Version 1.2: 910711
COM-AND Remap Script Page 4
III. REMAP source files (continued)
C. Redefinitions (continued)
The last example declares that when you type 80 hex (alt-1-2-8),
COM-AND will see F2, then the string "remap.cmd" then a carriage
return (the "!" at the end is a carriage return).
You may declare a string using the usual conventions for macro
strings or may declare the keystrokes individually. For example,
0x80 = A B C CR ; and
0x80 = "ABC!" ; and
0x80 = "AB" CR ; and
0x80 = "AB^M"
are equivalent strings. The "CR" in the first example is a
carriage return token defined by REMAP. The "!" in the second
example is transformed to a carriage return (to declare a "!"
itself, type "!!"). The "^M" in the fourth line is 'control-M",
another way to say carriage return (to declare "^" by itself,
enter it as "^^").
The left side of the equals must be a token defined by the remap
script; the tokens are listed in the appendices below.
The redefinition may be any one token or character or group of
characters and characters. Blanks (" "), commas (",") and
semi-colons (";") must be declared within quotes; REMAP treats
those characters as delimiters.
Version 1.2: 910711
COM-AND Remap Script Page 5
III. REMAP source files (continued)
D. Remapped keys within redefinitions
The remapping routines of COM-AND perform remapping on remaps
themselves, with one exception. Any redefinition more than one
ASCII key or one function key in length will ITSELF be subject
to remapping. For example:
^PgDn = PgDn ; Remap COM-AND's download ftn to ^PgDn
PgDn = ^PgDn "1!" ; Automatically select WXMODEM on PgDn
The second remap (the remap of the PgDn key) translates to the
sequence: PgDn (COM-AND's download select window), "1" and CR.
The ^PgDn is remapped itself to invoke PgDn when executed.
This is particularly important to recognize when remapping COM-
AND defined keys (such as PgDn, PgUp, F10, etc). The new sequence
assigned to the key will probably be more than one keystroke (one
ASCII key or one function key) in length and if so, is subject to
remapping itself. Be aware!
The original function that has been remapped may be assigned to
another key (usually one not used by COM-AND or the remap). To
avoid remapping of the remap the assignment MUST be limited to
a single key (one ASCII key or one function key).
The example above demonstrates: the first line, '^PgDn = PgDn',
declares that Control-PgDn will function as the original COM-AND
download protocol select window. As it is one keystroke (PgDn)
in length, it is not remapped itself. The second line, 'PgDn =
^PgDn "1!"' declares that the PgDn key itself will invoke the
download selection window, and select item #1.
One last note, had the second line above been written 'PgDn =
PgDn "1!"', the remap would be circular... and if allowed would
loop indefinitely. The REMAP script prohibits simple circular
definitions.
Version 1.2: 910711
COM-AND Remap Script Page 6
IV. DOORWAY Remaps
Considerable interest was expressed to the author about COM-AND 2.7's
use with the DOORWAY utility (and similar facilities). DOORWAY is
a communications program for the PC making certain programs (not
graphics mode) or DOS available to a remote caller. The host display
is transmitted to the remote caller in ANSI format, and received key-
strokes from the remote caller are made to appear (to the program, or
DOS) as if typed from the local keyboard.
The one problem with DOORWAY and DOORWAY-like functions is the set
of non-ANSI keys (e.g. F1-F10, Alt'd keys and so on). On the remote
caller's PC, in COM-AND, function and Alt'd keys invoke special func-
tions - how to send them to the DOORWAY host?
A simple (but tedious) remap can be made to redefine COM-AND function
and Alt'd keys to sequences that are transmitted. However, when the
remap is enabled, all special functions in COM-AND (tied to those
function and Alt'd keys) are disabled.
No matter... with COM-AND version 2.7 this remap was used, and used
successfully, with DOORWAY. One key was reserved for a remap that
toggled the remapping itself... making it very usable. [In one case,
the Alt-equal key was remapped to invoke a script that turned remap
ON if it was OFF, and OFF it is was ON. All other function and Alt'd
keys were transformed into the two byte sequence required by
DOORWAY when the remap was enabled.]
With version 2.8, the Alt-hyphen combination toggles 'remote' mode.
In remote mode, function and Alt'd keys are transmitted to a DOORWAY
or DOORWAY-like utility. Alt-hyphen serves as a toggle, making it
the one key that is NOT transmitted. Should Alt-hyphen itself be
needed by the application, it may be transmitted through a script.
Remapping is needed to meet many needs. However, innovations in the
use of COM-AND generally come from its user-base. As the author be-
comes acquainted with the real world needs of his customers, COM-AND
is extended and improved.
Version 1.2: 910711
COM-AND Remap Script Page 7
V. Program requirements
This program can only function on an IBM PC or DOS compatible
machine. COM-AND does direct to screen buffer fetches and stores
(unless BIOS screen updates are directed using the /C switch or the
Alt-O options menu).
COM-AND is TopView aware even without the /C switch or Alt-O option.
COM-AND supports MDA, CGA, EGA and Hercules. COM-AND uses a Micro-
soft Mouse if one is available...
COM-AND disk I/O is done through the 'Handle' oriented I/O routines
added to DOS 2.0. Therefore DOS 2.0 is a minimum requirement.
COM-AND (Version 2.8) requires 256K for itself. You need 384K to
take advantage of the DOS Gateway and to load accessories.
Version 1.2: 910711
COM-AND Remap Script Page 8
VI. Author information
COM-AND was written using Microsoft Macro-Assembler. The author
likes assembler. Assembly language is an entirely appropriate
vehicle for some of the program, and a not-inappropriate vehicle
for the rest of it. Everything, in moderation...
The author of this program is R. Scott McGinnis of Chicago, IL.
PLINK and GEnie ID: TARTAN. Comment and suggestions (and criticism
in moderation) are welcomed:
CABER Software
R. (Scott) McGinnis
P.O. Box 3607 Mdse Mart
Chicago, IL 60654-0607
I thank my wife, Elizabeth, who I love dearly.
This script (Version 1.2) may be distributed freely (but it isn't a
whole lot of use without COM-AND). Any improvements that are sug-
gested to the author will get attention... errors reported to the
author will be corrected. COM-AND is shareware. If COM-AND is USED
after a reasonable period of evaluation, a registration of $50.00 is
required.
Most of the hardware names and software names in this document are
trademarks or trade names of specific manufacturers.
Version 1.2: 910711
COM-AND Remap Script Page 9
A. File structures
COM-AND.RMP ; 768 bytes maximum
Entries are structured:
byte 0 1 2 ...
+---------+---------+---/ /---+---/ /---+---/ /---+
! Key ! Length ! Redefinition for length !
+---------+---------+---/ /---+---/ /---+---/ /---+
where 'key' refers to an ASCII key value
or as:
byte 0 1 2 3 ...
+---------+---------+---------+---/ /---+---/ /---+---/ /---+
! 0 ! Key ! Length ! Redefinition for length !
+---------+---------+---------+---/ /---+---/ /---+---/ /---+
where '0/key' refers to an extended scancode as defined by BIOS.
The table size is taken by the files size. Optionally, 0,0
in an entry's first two bytes end the table.
Version 1.2: 910711 Appendices
COM-AND Remap Script Page 10
B. Syntax
REMAP.CMD defines a simple language for remapping. Special keys
(such as F1) are given 'names' (Function key F1 is 'F1'). A simple
syntax is defined to redefine any key COM-AND can detect (it cannot
detect all keys or key-combinations). REMAP.CMD expects to be given
a source file prepared with a text editor (like a script). It com-
piles the source file into COM-AND.RMP.
Lines of source in REMAP.CMD are limited to 80 characters. The
script REMAP.CMD defines lines with three types of syntax.
. Comments: Comment lines are blank, or begin with ";" or "*"
. Sections: The source file can be divided into up to 15 sections
and separately compiled) with the in-line command:
NAME = <name for display>
. Remaps: Within a section, a remapping has the syntax:
<token> = <newkey>
The list of defined tokens is given below. The <new-
key(s)> operand has the form:
(<token>!<char>!<str>!<num>) [(" "!"," <newkey>] [";"]
where "(...)" indicates a mandatory choice, "!"
indicates 'or', and "[...]" indicates an optional
choice. The final optional semi-colon allows in-line
comments following. For example:
F10 = F10
0x80 = F2 "remap.cmd!" ; Alt-1-2-8 (80 hex) invokes it
<Char> denotes a single character (with exception of
";", " " and ",").
<Str> denotes a double-quote delimited string. Within
strings, ^^ -> ^, !! -> !, `x -> x, and the rules
for macro strings otherwise apply.
<Num> denotes a hex numeric (e.g. 0x80).
Version 1.2: 910711 Appendices
COM-AND Remap Script Page 11
C. Tokens
Tokens defined in REMAP.CMD are:
------------------------------------------------
Normal Shifted
--------------------------------------- --------
F1 CurL CR (any single SF1
F2 CurR BS key: e.g. A, SF2
F3 CurUp BELL case being SF3
F4 CurDn INS significant) SF4
F5 End DEL SF5
F6 Home TAB (any single SF6
F7 PgDn key in quotes: SF7
F8 PgUp e.g. "A", case SF8
F9 Tab significant) SF9
F10 Esc SF10
(decimal/hex numerics) RevTab
-----------------------------------------------
Control
-----------------------------------------------
CF1 ^F1 ^A ^K ^U ^PrtSc
CF2 ^F2 ^B ^L ^V ^CurL
CF3 ^F3 ^C ^M ^W ^CurR
CF4 ^F4 ^D ^N ^X ^End
CF5 ^F5 ^E ^O ^Y ^Home
CF6 ^F6 ^F ^P ^Z ^PgDn
CF7 ^F7 ^G ^Q ^@ ^PgUp
CF8 ^F8 ^H ^R ^[
CF9 ^F9 ^I ^S ^\
CF10 ^F10 ^J ^T ^]
-----------------------------------------------
Alt'd
-----------------------------------------------
AF1 AltF1 AltA AltK AltU Alt0 (not numeric pad)
AF2 AltF2 AltB AltL AltV Alt1
AF3 AltF3 AltC AltM AltW Alt2
AF4 AltF4 AltD AltN AltX Alt3
AF5 AltF5 AltE AltO AltY Alt4
AF6 AltF6 AltF AltP AltZ Alt5
AF7 AltF7 AltG AltQ Alt6
AF8 AltF8 AltH AltR Alt7
AF9 AltF9 AltI AltS Alt- Alt8
AF10 AltF10 AltJ AltT AltEq Alt9
-----------------------------------------------
Other
-----------------------------------------------
FUNCTN (operand only... produces 0/0x80 for COM-AND TV950)
NULL (Equivalent to Alt_NumericKeyPad_0)
Version 1.2: 910711 Appendices
COM-AND Remap Script Page 12
D. Sample file
A sample source file, REMAPS.TXT, is supplied with this document.
It contains several sections, with appropriate names, for terminals
COM-AND supports (or would like to support!). One section of the
file is presented here as an example:
name = VT100
;
; VT100 definitions
;
DEL = 0x7f ; Character delete
CurUp = ESC [ 0x41 ; Cursor up
CurDn = ESC [ 0x42 ; Cursor down
CurL = ESC [ 0x44 ; Cursor left
CurR = ESC [ 0x43 ; Cursor right
Home = ESC [ 0x48 ; Home cursor
End = ESC [ 0x4b ; Erase to end of line
^PgDn = ESC [ 0x48 ESC [ " " 0x4A ; Clear screen
^PgUp = ESC [ 0x4D ; Delete line
^Home = ESC [ 0x4c ; Insert line
AF1 = ESC O q ; Keypad application mode 1
AF2 = ESC O r ; Keypad application mode 2
AF3 = ESC O s ; Keypad application mode 3
AF4 = ESC O t ; Keypad application mode 4
AF5 = ESC O u ; Keypad application mode 5
AF6 = ESC O v ; Keypad application mode 6
AF7 = ESC O w ; Keypad application mode 7
AF8 = ESC O x ; Keypad application mode 8
AF9 = ESC O y ; Keypad application mode 9
AF10 = ESC O p ; Keypad application mode 0
CF10 = AF10 ; COM-AND uses AF10 as shell
SF1 = ESC O 0x50 ; Program function 1 (PF1)
SF2 = ESC O 0x51 ; Program function 2 (PF2)
SF3 = ESC O 0x53 ; Program function 3 (PF3)
SF4 = ESC O 0x54 ; Program function 4 (PF4)
SF5 = ESC O 0x6d ; Keypad application mode dash
SF6 = ESC O 0x6c ; Keypad application mode comma
SF7 = ESC O 0x4d ; Keypad application mode enter
SF8 = ESC O 0x6e ; Keypad application mode period
Version 1.2: 910711 Appendices
COM-AND Remap Script Page 13
E. Unusual Remaps
Keyboard remapping is not necessarily limited to terminal emulation.
Remaps may be used to replace COM-AND function keys with new (perhaps
different) functions altogether.
A remap may define a string that will be executed by COM-AND (similar
to the way a macro key might be used). The string may be text to
transmit, or any other function key. For example:
F10 = 255 "HELP" CR
This remap says in effect: When the F10 key is pressed, COM-AND will
see the character with value 255, the characters "H" "E" "L" and "P",
and a CR. 255 as an ASCII character is documented in COM-AND.DOC
under Alt-M Macros. The character 255 in COM-AND has the same
function as F2 (run a script), but does not pop up a window and
search the drive for all files *.CMD and *.ENF. "HELP" would be
interpreted by the 255 function as a script name (either HELP.,
HELP.CMD or HELP.ENF on the default or COM-AND= subdirectory). The
CR causes the 255 function to execute the script named HELP.
So... one might write one's own help window (see the help screens in
FILEMGR or LEARN), call it HELP.CMD, put it in the COM-AND= subdir,
and never see the author's idea of a HELP summary again. It might be
paginated, indexed, what-have-you.
Another use for the '255' key is the execution of single script
statements. The remap:
AltX = 255 ".BYE"
remaps the Alt-X key to the subsequent characters. however, when
Alt-X is pressed, instead of a script being executed named BYE, the
script statement BYE is executed. The initial "." signals a script
statement is to be executed, instead of a script file name. [By the
way, this remap avoids the carrier test and query on termination...]
Version 1.2: 910711 Appendices