summaryrefslogtreecommitdiff
path: root/src/fltk-draw.adb
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-09 23:53:32 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-09 23:53:32 +1300
commit53aa8144851913994b963ed611cca8885b8f9a9e (patch)
tree1b2a262cedb353b4aff00e14b200918ac17b11ab /src/fltk-draw.adb
parent17473af7e8ed13e0a9399a69442f9839e5d83aef (diff)
Internal_FLTK_Error raises are now pragma Asserts
Diffstat (limited to 'src/fltk-draw.adb')
-rw-r--r--src/fltk-draw.adb35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/fltk-draw.adb b/src/fltk-draw.adb
index 42b3d26..79d34ff 100644
--- a/src/fltk-draw.adb
+++ b/src/fltk-draw.adb
@@ -6,6 +6,7 @@
with
+ Ada.Assertions,
Ada.Unchecked_Deallocation,
Interfaces.C.Strings;
@@ -18,6 +19,15 @@ use type
package body FLTK.Draw is
+ package Chk renames Ada.Assertions;
+
+
+
+
+ ------------------------
+ -- Functions From C --
+ ------------------------
+
procedure fl_draw_reset_spot;
pragma Import (C, fl_draw_reset_spot, "fl_draw_reset_spot");
pragma Inline (fl_draw_reset_spot);
@@ -670,11 +680,12 @@ package body FLTK.Draw is
begin
if Result = 1 then
return True;
- elsif Result = 0 then
- return False;
else
- raise Internal_FLTK_Error;
+ pragma Assert (Result = 0);
+ return False;
end if;
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Can_Do_Alpha_Blending;
@@ -1214,10 +1225,10 @@ package body FLTK.Draw is
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.int (Alpha));
- if Buffer /= Storage.To_Integer (Result (Result'First)'Address) then
- raise Internal_FLTK_Error;
- end if;
+ pragma Assert (Buffer = Storage.To_Integer (Result (Result'First)'Address));
return Result;
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Read_Image;
@@ -1239,9 +1250,11 @@ package body FLTK.Draw is
begin
if Ret_Val = 0 then
raise Draw_Error;
- elsif Ret_Val /= 1 then
- raise Internal_FLTK_Error;
+ else
+ pragma Assert (Ret_Val = 1);
end if;
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Add_Symbol;
procedure Draw_Text
@@ -1406,9 +1419,11 @@ package body FLTK.Draw is
begin
if Ret_Val = 0 then
raise Draw_Error;
- elsif Ret_Val /= 1 then
- raise Internal_FLTK_Error;
+ else
+ pragma Assert (Ret_Val = 1);
end if;
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Draw_Symbol;