2
This file is part of the Free Pascal run time library.
4
A file in Amiga system run time library.
5
Copyright (c) 1998-2003 by Nils Sjoholm
6
member of the Amiga RTL development team.
8
See the file COPYING.FPC, included in this distribution,
9
for details about the copyright.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
**********************************************************************}
18
keymap.resource definitions and console.device key map definitions
24
Added the defines use_amiga_smartlink and
25
use_auto_openlib. Implemented autoopening
29
Changed integer > smallint,
33
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
36
{$I useamigasmartlink.inc}
37
{$ifdef use_amiga_smartlink}
39
{$endif use_amiga_smartlink}
45
uses exec, inputevent;
51
km_LoKeyMapTypes : Pointer;
52
km_LoKeyMap : Pointer;
53
km_LoCapsable : Pointer;
54
km_LoRepeatable : Pointer;
55
km_HiKeyMapTypes : Pointer;
56
km_HiKeyMap : Pointer;
57
km_HiCapsable : Pointer;
58
km_HiRepeatable : Pointer;
62
pKeymapNode = ^tKeyMapNode;
64
kn_Node : tNode; { including name of keymap }
68
{ the structure of keymap.resource }
70
pKeyMapResource = ^tKeyMapResource;
71
tKeyMapResource = record
73
kr_List : tList; { a list of KeyMapNodes }
82
KC_VANILLA = 7; { note that SHIFT+ALT+CTRL is VANILLA }
92
KCB_DEAD = 5; { may be dead or modified by dead key: }
93
KCF_DEAD = $20; { use dead prefix bytes }
102
{ Dead Prefix Bytes }
109
DP_2DINDEXMASK = $0f; { mask for index for 1st of two dead keys }
110
DP_2DFACSHIFT = 4; { shift for factor for 1st of two dead keys }
112
VAR KeymapBase : pLibrary;
115
KEYMAPNAME : PChar = 'keymap.library';
117
FUNCTION AskKeyMapDefault : pKeyMap;
118
FUNCTION MapANSI(thestring : pCHAR; count : LONGINT; buffer : pCHAR; length : LONGINT; keyMap : pKeyMap) : LONGINT;
119
FUNCTION MapRawKey(event : pInputEvent; buffer : pCHAR; length : LONGINT; keyMap : pKeyMap) : smallint;
120
PROCEDURE SetKeyMapDefault(keyMap : pKeyMap);
126
FUNCTION AskKeyMapDefault : pKeyMap;
130
MOVEA.L KeymapBase,A6
137
FUNCTION MapANSI(thestring : pCHAR; count : LONGINT; buffer : pCHAR; length : LONGINT; keyMap : pKeyMap) : LONGINT;
146
MOVEA.L KeymapBase,A6
153
FUNCTION MapRawKey(event : pInputEvent; buffer : pCHAR; length : LONGINT; keyMap : pKeyMap) : smallint;
161
MOVEA.L KeymapBase,A6
168
PROCEDURE SetKeyMapDefault(keyMap : pKeyMap);
173
MOVEA.L KeymapBase,A6
179
{$I useautoopenlib.inc}
180
{$ifdef use_auto_openlib}
181
{$Info Compiling autoopening of keymap.library}
184
keymap_exit : Pointer;
186
procedure ClosekeymapLibrary;
188
ExitProc := keymap_exit;
189
if KeymapBase <> nil then begin
190
CloseLibrary(KeymapBase);
196
{ Change VERSION and LIBVERSION to proper values }
198
VERSION : string[2] = '0';
199
LIBVERSION : longword = 0;
203
KeymapBase := OpenLibrary(KEYMAPNAME,LIBVERSION);
204
if KeymapBase <> nil then begin
205
keymap_exit := ExitProc;
206
ExitProc := @ClosekeymapLibrary
208
MessageBox('FPC Pascal Error',
209
'Can''t open keymap.library version ' + VERSION + #10 +
210
'Deallocating resources and closing down',
216
{$Warning No autoopening of keymap.library compiled}
217
{$Info Make sure you open keymap.library yourself}
218
{$endif use_auto_openlib}
221
END. (* UNIT KEYMAP *)