1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. -- Allegro 4.4.2 - Timer routines 
  10. package Allegro.Timers is 
  11.  
  12.     type A_Timer_Handler is 
  13.         access procedure; 
  14.  
  15.     type A_Paramaterized_Timer_Handler is 
  16.         access procedure( param : Address ); 
  17.  
  18.     type A_Rest_Callback is 
  19.         access procedure; 
  20.  
  21.     type Clock_Ticks is private; 
  22.  
  23.     ---------------------------------------------------------------------------- 
  24.  
  25.     function Get_Retrace_Count return Integer; 
  26.  
  27.     function Install_Int( proc   : not null A_Timer_Handler; 
  28.                           millis : Integer ) return Integer; 
  29.  
  30.     function Install_Int_Ex( proc  : not null A_Timer_Handler; 
  31.                              speed : Clock_Ticks ) return Integer; 
  32.  
  33.     function Install_Param_Int( proc   : not null A_Paramaterized_Timer_Handler; 
  34.                                 param  : Address; 
  35.                                 millis : Integer ) return Integer; 
  36.  
  37.     function Install_Param_Int_Ex( proc  : not null A_Paramaterized_Timer_Handler; 
  38.                                    param : Address; 
  39.                                    speed : Clock_Ticks ) return Integer; 
  40.  
  41.     function Install_Timer return Integer; 
  42.  
  43.     procedure Remove_Int( proc : not null A_Timer_Handler ); 
  44.  
  45.     procedure Remove_Param_Int( proc  : not null A_Paramaterized_Timer_Handler; 
  46.                                 param : Address ); 
  47.  
  48.     procedure Remove_Timer; 
  49.  
  50.     procedure Rest( millis : Unsigned_32 ); 
  51.  
  52.     procedure Rest_Callback( millis : Unsigned_32; callback : A_Rest_Callback ); 
  53.  
  54.     function Msec_To_Ticks( x : Natural ) return Clock_Ticks; 
  55.  
  56.     function Secs_To_Ticks( x : Natural ) return Clock_Ticks; 
  57.  
  58.     function Bps_To_Ticks( x : Natural ) return Clock_Ticks; 
  59.  
  60.     function Bpm_To_Ticks( x : Natural ) return Clock_Ticks; 
  61.  
  62. private 
  63.  
  64.     type Clock_Ticks is new Integer; 
  65.  
  66.     ---------------------------------------------------------------------------- 
  67.  
  68.     pragma Convention( C, A_Timer_Handler ); 
  69.     pragma Convention( C, A_Paramaterized_Timer_Handler ); 
  70.     pragma Convention( C, A_Rest_Callback ); 
  71.  
  72.     pragma Import( C, Get_Retrace_Count, "get_retrace_count" ); 
  73.     pragma Import( C, Install_Int, "install_int" ); 
  74.     pragma Import( C, Install_Int_Ex, "install_int_ex" ); 
  75.     pragma Import( C, Install_Param_Int, "install_param_int" ); 
  76.     pragma Import( C, Install_Param_Int_Ex, "install_param_int_ex" ); 
  77.     pragma Import( C, Install_Timer, "install_timer" ); 
  78.     pragma Import( C, Remove_Int, "remove_int" ); 
  79.     pragma Import( C, Remove_Param_Int, "remove_param_int" ); 
  80.     pragma Import( C, Remove_Timer, "remove_timer" ); 
  81.     pragma Import( C, Rest, "rest" ); 
  82.     pragma Import( C, Rest_Callback, "rest_callback" ); 
  83.  
  84. end Allegro.Timers;