lace_opengl_0.1.0_672a6415/private/gl/source/gl-pointers.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
with
     ada.unchecked_Conversion,
     system.Address_to_Access_Conversions;

package body GL.Pointers
is

   type GLvoid_access         is access all GLvoid;
   type GLchar_access         is access all lean.GLchar;
   type GLchar_Pointer_access is access all lean.GLchar_Pointer;
   type chars_ptr_access      is access all C.strings.chars_ptr;

   package Conversions is new system.Address_To_Access_Conversions (GLvoid);



   function to_GLvoid_access (From : in system.Address) return access GLvoid
   is
   begin
      return Conversions.to_Pointer (From);
   end to_GLvoid_access;



   function to_GLvoid_access (From : access C.unsigned_char) return access GLvoid
   is
      type unsigned_Char_access is access all C.unsigned_char;
      function Convert is new ada.unchecked_Conversion (unsigned_Char_access, GLvoid_access);
   begin
      return Convert (unsigned_Char_access (From));
   end to_GLvoid_access;



   function to_GLchar_access (From : in C.Strings.chars_ptr) return access lean.GLchar
   is
      function Convert is new ada.unchecked_Conversion (C.Strings.chars_ptr, GLchar_access);
   begin
      return Convert (From);
   end to_GLchar_access;



   function to_GLchar_Pointer_access (From : access C.Strings.chars_ptr_array) return access lean.GLchar_Pointer
   is
      function Convert is new ada.unchecked_Conversion (chars_ptr_access, GLchar_Pointer_access);
   begin
      return Convert (From (From'First)'unchecked_Access);
   end to_GLchar_Pointer_access;


end GL.Pointers;