]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/src/terminal_interface-curses-forms-field_types.adb
ncurses 5.0
[ncurses.git] / Ada95 / src / terminal_interface-curses-forms-field_types.adb
similarity index 92%
rename from Ada95/ada_include/terminal_interface-curses-forms-field_types.adb
rename to Ada95/src/terminal_interface-curses-forms-field_types.adb
index 60e1ff38b8cf78be96e16576130e7b9db6d158ad..dccaf9d21479bbb8dfcae08e878f29e12aa209a5 100644 (file)
 -- sale, use or other dealings in this Software without prior written       --
 -- authorization.                                                           --
 ------------------------------------------------------------------------------
---  Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996
+--  Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1996
 --  Version Control:
---  $Revision: 1.8 $
---  Binding Version 00.93
+--  $Revision: 1.12 $
+--  Binding Version 01.00
 ------------------------------------------------------------------------------
 with Interfaces.C;
 with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
 with Ada.Unchecked_Deallocation;
 with Ada.Unchecked_Conversion;
-with Terminal_Interface.Curses.Forms.Field_Types.User;
-with Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
 --  |
 --  |=====================================================================
 --  | man page form_fieldtype.3x
@@ -95,11 +93,20 @@ package body Terminal_Interface.Curses.Forms.Field_Types is
 
    function Make_Arg (Args : System.Address) return System.Address
    is
-      function Getarg (Arg : System.Address := Args)
-        return System.Address;
-      pragma Import (C, Getarg, "_nc_ada_getvarg");
+      --  Actually args is a double indirected pointer to the arguments
+      --  of a C variable argument list. In theory it is now quite
+      --  complicated to write portable routine that reads the arguments,
+      --  because one has to know the growth direction of the stack and
+      --  the sizes of the individual arguments.
+      --  Fortunately we are only interested in the first argument (#0),
+      --  we know its size and for the first arg we don't care about
+      --  into which stack direction we have to proceed. We simply
+      --  resolve the double indirection and thats it.
+      type V is access all System.Address;
+      function To_Access is new Ada.Unchecked_Conversion (System.Address,
+                                                          V);
    begin
-      return Getarg;
+      return To_Access (To_Access (Args).all).all;
    end Make_Arg;
 
    function Copy_Arg (Usr : System.Address) return System.Address