1. package Keyboard is 
  2.  
  3.     pragma Pure; 
  4.  
  5.     -- Represents special keys used to modify key presses or mouse clicks 
  6.     type Modifiers_Type is (ALT, CTRL, SHIFT); 
  7.     type Modifiers_Array is array (Modifiers_Type) of Boolean; 
  8.  
  9.     -- A Modifiers_Array value with no modifiers set 
  10.     MODIFIERS_NONE : constant Modifiers_Array := Modifiers_Array'(others=>False); 
  11.  
  12.     -- Returns True if all modifiers in 'l' and 'r' match exactly. 
  13.     function "="( l, r : Modifiers_Array ) return Boolean; 
  14.  
  15.     -- Returns True if no modifiers are set. 
  16.     function None( mods : Modifiers_Array ) return Boolean; 
  17.  
  18.     -- Returns True if only the Alt modifier is set. 
  19.     function Only_Alt( mods : Modifiers_Array ) return Boolean; 
  20.  
  21.     -- Returns True if only the Ctrl modifier is set. 
  22.     function Only_Ctrl( mods : Modifiers_Array ) return Boolean; 
  23.  
  24.     -- Returns True if only the Shift modifier is set. 
  25.     function Only_Shift( mods : Modifiers_Array ) return Boolean; 
  26.  
  27.     ---------------------------------------------------------------------------- 
  28.  
  29.     -- Represents a trinary logic value, where the third value is undefined. 
  30.     type Trillian is (Yes, No, Either); 
  31.  
  32.     -- Returns True if 'l' and 'r' match or if 'r' is Either. 
  33.     function "="( l : Boolean; r : Trillian ) return Boolean; 
  34.  
  35.     -- Returns True if 'l' and 'r' match or if 'l' is Either. 
  36.     function "="( l : Trillian; r : Boolean ) return Boolean; 
  37.  
  38.     ---------------------------------------------------------------------------- 
  39.  
  40.     -- An array of trinary modifier states- on, off, either. A Modifiers_Pattern 
  41.     -- value is used to match a Modifiers_Array by setting definite values for 
  42.     -- the modifiers you want to match, and using the Either value to match 
  43.     -- anything else. 
  44.     type Modifiers_Pattern is array (Modifiers_Type) of Trillian; 
  45.  
  46.     -- All modifiers with a value of Either: this will match any Modifiers_Array. 
  47.     MODIFIERS_ANY : constant Modifiers_Pattern := Modifiers_Pattern'(others=>Either); 
  48.  
  49.     -- Returns True if the pattern in 'r' matches the definite state in 'l'. 
  50.     function "="( l : Modifiers_Array; r : Modifiers_Pattern ) return Boolean; 
  51.  
  52.     -- Returns True if the pattern in 'l' matches the definite state in 'r'. 
  53.     function "="( l : Modifiers_Pattern; r : Modifiers_Array ) return Boolean; 
  54.  
  55. end Keyboard;