Oberon || Library || Module Index || Search Engine || Definition || Module
(* function keys *) CONST f0 = 0; CONST f1 = 1; CONST f2 = 2; CONST f3 = 3; CONST f4 = 4; CONST f5 = 5; CONST f6 = 6; CONST f7 = 7; CONST f8 = 8; CONST f9 = 9; CONST f10 = 10; CONST f11 = 11; CONST f12 = 12; CONST f13 = 13; CONST f14 = 14; CONST f15 = 15; CONST f16 = 16; CONST f17 = 17; CONST f18 = 18; CONST f19 = 19; CONST f20 = 20; CONST cursorup = 21; CONST cursordown = 22; CONST cursorleft = 23; CONST cursorright = 24; CONST insert = 25; CONST delete = 26; CONST home = 27; CONST end = 28; CONST previous = 29; CONST next = 30; CONST functionkeys = 31;
TYPE FunctionKeySet = ARRAY functionkeys+1 DIV Sets.setsize OF SET; TYPE Key = POINTER TO KeyRec; TYPE KeyRec = RECORD (PersistentObjects.ObjectRec) END; TYPE SimpleKey = POINTER TO SimpleKeyRec; TYPE SimpleKeyRec = RECORD (KeyRec) char: CHAR; END; TYPE FunctionKey = POINTER TO FunctionKeyRec; TYPE FunctionKeyRec = RECORD (KeyRec) code: INTEGER; END; TYPE ReadProc = PROCEDURE(s: Streams.Stream; VAR key: Key): BOOLEAN; TYPE Interface = POINTER TO InterfaceRec; TYPE InterfaceRec = RECORD (Objects.ObjectRec) read: ReadProc; END; PROCEDURE Init(s: Streams.Stream; available: FunctionKeySet; if: Interface); PROCEDURE Read(s: Streams.Stream; VAR key: Key): BOOLEAN; PROCEDURE Available(s: Streams.Stream; VAR keys: FunctionKeySet);
SimpleKey is a key, which transmits a single character when pressed, (i.e. it's ASCII code).
FunctionKey is a key which transmits a sequence of characters.
Every function key is assigned a number. TermKeys predefines numbers for a small set of keys. Implementations are free to add their own numbers for additional keys.
Init has to be called by the underlying terminal implementation with the set of available function keys in available and the interface procedure for reading in if.
Read reads a key from the terminal. On success, Read returns TRUE. FALSE is returned in case of errors or if the interface has not yet been initialized by the underlying terminal implementation.
Available returns the set of available function keys.
Oberon || Library || Module Index || Search Engine || Definition || Module