DEFINITION MODULE DoRawTbl;

(*======================================================================*)
(*                        Helper version v0.07                          *)
(*======================================================================*)
(*           Copyright © 1989 Mike Cargal, All Rights Reserved          *)
(*======================================================================*)
(*      Version: 0.07           Author : Mike Cargal                    *)
(*      Date   : 20-Jun-89      Changes: Original                       *)
(*======================================================================*)


FROM InputEvents IMPORT IEQualifierSet;
FROM Intuition   IMPORT WindowPtr;

TYPE
  RawEnt = RECORD
    Cd   : CARDINAL;
    Qual : IEQualifierSet;
  END;
 
  RawTbl    = ARRAY [0..255] OF RawEnt;
  RawTblPtr = POINTER TO RawTbl;
  
PROCEDURE BuildRawTbl() : RawTblPtr;

  (*-------------------------------------------------------------\
   |                                                             |
   | Using current Key Map, generate table of Raw Key Codes      |
   |  and Qualifiers indexed by the character they generate      |
   |  (if the key combination produces a single character).      |
   |                                                             |
   | Then use code like the following to translate back to       |
   |  Raw key codes.                                             |
   |                                                             |
   | i : CHAR                                                    |
   |                                                             |
   |     ieCode      := MyRawTbl^[CARDINAL(i)].Cd                |
   |     ieQualifier := MyRawTbl^[CARDINAL(i)].Qual              |
   |                                                             |
   | These values can be used to feed raw key events into the    |
   |  input device.                                              |
   |                                                             |
   | NOTE:  This routine and the RawTbl structure could be       |
   |  modified to do better validation, since it is possible     |
   |  to translate a CHAR for which *NO* Raw Key code/Qualifier  |
   |  exists.  The current implementation would generate a       |
   |  Raw Key code 0 with no Qualifier (this is valid, but       |
   |  is probably not what you intended).                        |
   |                                                             |
   \-------------------------------------------------------------*)


END DoRawTbl.