summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-browsers-textline.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-widgets-groups-browsers-textline.adb
parent17473af7e8ed13e0a9399a69442f9839e5d83aef (diff)
Internal_FLTK_Error raises are now pragma Asserts
Diffstat (limited to 'src/fltk-widgets-groups-browsers-textline.adb')
-rw-r--r--src/fltk-widgets-groups-browsers-textline.adb54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/fltk-widgets-groups-browsers-textline.adb b/src/fltk-widgets-groups-browsers-textline.adb
index 1e8988e..8c68420 100644
--- a/src/fltk-widgets-groups-browsers-textline.adb
+++ b/src/fltk-widgets-groups-browsers-textline.adb
@@ -6,6 +6,7 @@
with
+ Ada.Assertions,
Ada.Unchecked_Deallocation,
FLTK.Images,
Interfaces.C.Strings;
@@ -19,6 +20,11 @@ use type
package body FLTK.Widgets.Groups.Browsers.Textline is
+ package Chk renames Ada.Assertions;
+
+
+
+
------------------------
-- Functions From C --
------------------------
@@ -594,9 +600,11 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
else
raise Browser_Load_Error with Interfaces.C.Strings.Value (Msg);
end if;
- elsif Code /= 1 then
- raise Internal_FLTK_Error;
+ else
+ pragma Assert (Code = 1);
end if;
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Load;
@@ -765,11 +773,10 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
Interfaces.C.int (Line),
Boolean'Pos (State));
begin
- if Code not in 0 .. 1 then
- raise Internal_FLTK_Error;
- else
- return Boolean'Val (Code);
- end if;
+ pragma Assert (Code in 0 .. 1);
+ return Boolean'Val (Code);
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Set_Select;
@@ -783,9 +790,9 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
Interfaces.C.int (Line),
Boolean'Pos (State));
begin
- if Code not in 0 .. 1 then
- raise Internal_FLTK_Error;
- end if;
+ pragma Assert (Code in 0 .. 1);
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Set_Select;
@@ -798,11 +805,10 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
(This.Void_Ptr,
Interfaces.C.int (Line));
begin
- if Code not in 0 .. 1 then
- raise Internal_FLTK_Error;
- else
- return Boolean'Val (Code);
- end if;
+ pragma Assert (Code in 0 .. 1);
+ return Boolean'Val (Code);
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Is_Selected;
@@ -842,11 +848,10 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
(This.Void_Ptr,
Interfaces.C.int (Line));
begin
- if Code not in 0 .. 1 then
- raise Internal_FLTK_Error;
- else
- return Boolean'Val (Code);
- end if;
+ pragma Assert (Code in 0 .. 1);
+ return Boolean'Val (Code);
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Is_Displayed;
@@ -1084,11 +1089,10 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
pragma Import (Ada, my_item_selected);
Code : Interfaces.C.int := my_item_selected (This.Void_Ptr, Cursor_To_Address (Item));
begin
- if Code not in 0 .. 1 then
- raise Internal_FLTK_Error;
- else
- return Boolean'Val (Code);
- end if;
+ pragma Assert (Code in 0 .. 1);
+ return Boolean'Val (Code);
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Item_Selected;