ncurses 5.8 - patch 20110326
[ncurses.git] / Ada95 / src / terminal_interface-curses-forms-field_types-user-choice.adb
index d9ed454b0a65129fff5111b31960c67b1f709f6a..3a7e6b5aeb2ed4da82fdca622f7578d9259cb5d0 100644 (file)
@@ -7,7 +7,7 @@
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
--- Copyright (c) 1998 Free Software Foundation, Inc.                        --
+-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc.              --
 --                                                                          --
 -- Permission is hereby granted, free of charge, to any person obtaining a  --
 -- copy of this software and associated documentation files (the            --
 ------------------------------------------------------------------------------
 --  Author:  Juergen Pfeifer, 1996
 --  Version Control:
---  $Revision: 1.10 $
+--  $Revision: 1.17 $
+--  $Date: 2011/03/22 10:53:37 $
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
-with Ada.Unchecked_Conversion;
-with Interfaces.C;
+with System.Address_To_Access_Conversions;
 with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
 
 package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is
 
-   use type Interfaces.C.int;
-
-   function To_Argument_Access is new Ada.Unchecked_Conversion
-     (System.Address, Argument_Access);
+   package Argument_Conversions is
+      new System.Address_To_Access_Conversions (Argument);
 
    function Generic_Next (Fld : Field;
-                          Usr : System.Address) return C_Int
+                          Usr : System.Address) return Curses_Bool
    is
       Result : Boolean;
-      Udf    : User_Defined_Field_Type_With_Choice_Access :=
+      Udf    : constant User_Defined_Field_Type_With_Choice_Access :=
         User_Defined_Field_Type_With_Choice_Access
-        (To_Argument_Access (Usr).Typ);
+        (Argument_Access (Argument_Conversions.To_Pointer (Usr)).Typ);
    begin
       Result := Next (Fld, Udf.all);
-      return C_Int (Boolean'Pos (Result));
+      return Curses_Bool (Boolean'Pos (Result));
    end Generic_Next;
 
    function Generic_Prev (Fld : Field;
-                          Usr : System.Address) return C_Int
+                          Usr : System.Address) return Curses_Bool
    is
       Result : Boolean;
-      Udf    : User_Defined_Field_Type_With_Choice_Access :=
+      Udf    : constant User_Defined_Field_Type_With_Choice_Access :=
         User_Defined_Field_Type_With_Choice_Access
-        (To_Argument_Access (Usr).Typ);
+        (Argument_Access (Argument_Conversions.To_Pointer (Usr)).Typ);
    begin
       Result := Previous (Fld, Udf.all);
-      return C_Int (Boolean'Pos (Result));
+      return Curses_Bool (Boolean'Pos (Result));
    end Generic_Prev;
 
    --  -----------------------------------------------------------------------