1. package Keyboard is 
  2.  
  3.     pragma Pure; 
  4.  
  5.     type Modifiers_Type is (ALT, CTRL, SHIFT); 
  6.     type Modifiers_Array is array (Modifiers_Type) of Boolean; 
  7.  
  8.     MODIFIERS_NONE : constant Modifiers_Array := Modifiers_Array'(others=>False); 
  9.  
  10.     function "="( l, r : Modifiers_Array ) return Boolean; 
  11.  
  12.     function None( mods : Modifiers_Array ) return Boolean; 
  13.  
  14.     -- Returns True if only the Alt modifier is set. 
  15.     function Only_Alt( mods : Modifiers_Array ) return Boolean; 
  16.  
  17.     -- Returns True if only the Ctrl modifier is set. 
  18.     function Only_Ctrl( mods : Modifiers_Array ) return Boolean; 
  19.  
  20.     -- Returns True if only the Shift modifier is set. 
  21.     function Only_Shift( mods : Modifiers_Array ) return Boolean; 
  22.  
  23.     ---------------------------------------------------------------------------- 
  24.  
  25.     -- Represents a trinary logic value, where the third value is undefined. 
  26.     type Trillian is (Yes, No, Either); 
  27.  
  28.     -- Returns True if 'l' and 'r' match or if 'r' is Either. 
  29.     function "="( l : Boolean; r : Trillian ) return Boolean; 
  30.  
  31.     -- Returns True if 'l' and 'r' match or if 'l' is Either. 
  32.     function "="( l : Trillian; r : Boolean ) return Boolean; 
  33.  
  34.     ---------------------------------------------------------------------------- 
  35.  
  36.     type Modifiers_Pattern is array (Modifiers_Type) of Trillian; 
  37.  
  38.     MODIFIERS_ANY : constant Modifiers_Pattern := Modifiers_Pattern'(others=>Either); 
  39.  
  40.     function "="( l : Modifiers_Array; r : Modifiers_Pattern ) return Boolean; 
  41.  
  42.     function "="( l : Modifiers_Pattern; r : Modifiers_Array ) return Boolean; 
  43.  
  44. end Keyboard;