summaryrefslogtreecommitdiff
path: root/src/fltk-static_callback_conversions.adb
blob: ceb0e6206722f50e76d639890f21d666cb66aab6 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176


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


with

    Ada.Unchecked_Conversion,
    FLTK.Static;

use type

    FLTK.Static.Awake_Handler,
    FLTK.Static.Timeout_Handler,
    FLTK.Static.Idle_Handler,
    FLTK.Static.Clipboard_Notify_Handler,
    FLTK.Static.File_Handler;


package body FLTK.Static_Callback_Conversions is


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


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


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


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


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


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


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


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


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


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


end FLTK.Static_Callback_Conversions;