summaryrefslogtreecommitdiff
path: root/src/fltk-widget_callback_conversions.adb
blob: 29f920e1ef432d0eee3af5e19fa2c1d828362a6b (plain)
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


--  Programmed by Jedidiah Barber
--  Released into the public domain


with

    Ada.Unchecked_Conversion,
    FLTK.Widgets;

use type

    FLTK.Widgets.Widget_Callback;


package body FLTK.Widget_Callback_Conversions is


    function To_Access
           (Addy : in Storage.Integer_Address)
        return FLTK.Widgets.Widget_Callback
    is
        function Raw is new Ada.Unchecked_Conversion
            (Storage.Integer_Address, FLTK.Widgets.Widget_Callback);
    begin
        if Addy = Null_Pointer then
            return null;
        else
            return Raw (Addy);
        end if;
    end To_Access;


    function To_Address
           (Call : in FLTK.Widgets.Widget_Callback)
        return Storage.Integer_Address
    is
        function Raw is new Ada.Unchecked_Conversion
            (FLTK.Widgets.Widget_Callback, Storage.Integer_Address);
    begin
        if Call = null then
            return Null_Pointer;
        else
            return Raw (Call);
        end if;
    end To_Address;


end FLTK.Widget_Callback_Conversions;