aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-03-23 13:10:56 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-03-23 13:10:56 +1300
commit620c9cedb6880f28a2b3657a5d55d120bf83e9ba (patch)
tree237cae636dffff5809ac2aef52fabc36a8254209 /test
parentf2352c6df585d817b3613145ec81446f917dcc21 (diff)
Improved project files, constant variables now constant
Diffstat (limited to 'test')
-rw-r--r--test/animated.adb2
-rw-r--r--test/ask.adb10
-rw-r--r--test/bitmap.adb2
-rw-r--r--test/button.adb4
-rw-r--r--test/buttons.adb1
-rw-r--r--test/clock.adb8
-rw-r--r--test/color_chooser.adb7
-rw-r--r--test/compare.adb10
-rw-r--r--test/dirlist.adb11
-rw-r--r--test/filename.adb40
-rw-r--r--test/pixmap.adb8
11 files changed, 71 insertions, 32 deletions
diff --git a/test/animated.adb b/test/animated.adb
index 42d2a49..4a5b570 100644
--- a/test/animated.adb
+++ b/test/animated.adb
@@ -130,7 +130,7 @@ is
Frame_Image_Data : constant Image_Data_Array := Make_Image_Data;
-- This syntax requires Ada 2022, but it allows all overt heap usage to be avoided
- Frame_Images : array (Positive range <>) of RGB.RGB_Image :=
+ Frame_Images : constant array (Positive range <>) of RGB.RGB_Image :=
(for Index in Frame_Image_Data'Range =>
RGB.Forge.Create (Frame_Image_Data (Index), Dimension, Dimension, Channels));
diff --git a/test/ask.adb b/test/ask.adb
index cb12fff..81ab104 100644
--- a/test/ask.adb
+++ b/test/ask.adb
@@ -16,7 +16,6 @@ with
FLTK.Widgets.Boxes,
FLTK.Widgets.Buttons,
FLTK.Widgets.Buttons.Enter,
- FLTK.Widgets.Inputs.Text,
FLTK.Widgets.Groups.Windows.Double;
use type
@@ -38,7 +37,6 @@ is
package BX renames FLTK.Widgets.Boxes;
package BTN renames FLTK.Widgets.Buttons;
package ENT renames FLTK.Widgets.Buttons.Enter;
- package INP renames FLTK.Widgets.Inputs.Text;
package WD renames FLTK.Widgets.Groups.Windows.Double;
@@ -54,7 +52,7 @@ is
procedure Rename_Me
(Item : in out FLTK.Widgets.Widget'Class)
is
- Input : String := AK.Text_Input ("Input:", Item.Get_Label);
+ Input : constant String := AK.Text_Input ("Input:", Item.Get_Label);
begin
Update_Input_Text (Item, Input);
end Rename_Me;
@@ -63,7 +61,7 @@ is
procedure Rename_Me_Pwd
(Item : in out FLTK.Widgets.Widget'Class)
is
- Input : String := AK.Password ("Input PWD:", Item.Get_Label);
+ Input : constant String := AK.Password ("Input PWD:", Item.Get_Label);
begin
Update_Input_Text (Item, Input);
end Rename_Me_Pwd;
@@ -72,7 +70,7 @@ is
procedure Window_Callback
(Item : in out FLTK.Widgets.Widget'Class)
is
- Hotspot : Boolean := AK.Get_Message_Hotspot;
+ Hotspot : constant Boolean := AK.Get_Message_Hotspot;
Reply : AK.Choice_Result;
begin
AK.Set_Message_Hotspot (False);
@@ -91,7 +89,7 @@ is
Stop : Boolean := False;
procedure Timer_Callback is
- Message_Icon : BX.Box_Reference := AK.Get_Message_Icon;
+ Message_Icon : constant BX.Box_Reference := AK.Get_Message_Icon;
My_Color : FLTK.Color;
begin
if Stop then
diff --git a/test/bitmap.adb b/test/bitmap.adb
index 86c1406..04f4793 100644
--- a/test/bitmap.adb
+++ b/test/bitmap.adb
@@ -117,7 +117,7 @@ is
procedure Button_Callback
- (Item : in out FLTK.Widgets.Widget'Class)
+ (Ignore : in out FLTK.Widgets.Widget'Class)
is
New_Align : FLTK.Alignment;
begin
diff --git a/test/button.adb b/test/button.adb
index 9ca6102..1cd6557 100644
--- a/test/button.adb
+++ b/test/button.adb
@@ -29,7 +29,7 @@ is
procedure Beep_Callback
- (This : in out Wdg.Widget'Class) is
+ (Ignore : in out Wdg.Widget'Class) is
begin
Ask.Beep;
end Beep_Callback;
@@ -39,7 +39,7 @@ is
procedure Exit_Callback
- (This : in out Wdg.Widget'Class) is
+ (Ignore : in out Wdg.Widget'Class) is
begin
ACom.Set_Exit_Status (ACom.Success);
The_Window.Hide;
diff --git a/test/buttons.adb b/test/buttons.adb
index e93da8e..a502f44 100644
--- a/test/buttons.adb
+++ b/test/buttons.adb
@@ -9,7 +9,6 @@
with
- FLTK.Tooltips,
FLTK.Widgets.Buttons.Enter,
FLTK.Widgets.Buttons.Light.Check,
FLTK.Widgets.Buttons.Light.Round,
diff --git a/test/clock.adb b/test/clock.adb
index b4d8f40..e550941 100644
--- a/test/clock.adb
+++ b/test/clock.adb
@@ -23,11 +23,11 @@ is
package WD renames FLTK.Widgets.Groups.Windows.Double;
- Window_One : WD.Double_Window := WD.Forge.Create (220, 220, "Fl_Clock");
- Clock_One : CL.Updated_Clock := CL.Forge.Create (Window_One, 0, 0, 220, 220);
+ Window_One : WD.Double_Window := WD.Forge.Create (220, 220, "Fl_Clock");
+ Clock_One : constant CL.Updated_Clock := CL.Forge.Create (Window_One, 0, 0, 220, 220);
- Window_Two : WD.Double_Window := WD.Forge.Create (220, 220, "Fl_Round_Clock");
- Clock_Two : CR.Round_Clock := CR.Forge.Create (Window_Two, 0, 0, 220, 220);
+ Window_Two : WD.Double_Window := WD.Forge.Create (220, 220, "Fl_Round_Clock");
+ Clock_Two : constant CR.Round_Clock := CR.Forge.Create (Window_Two, 0, 0, 220, 220);
begin
diff --git a/test/color_chooser.adb b/test/color_chooser.adb
index 09003b9..b77283c 100644
--- a/test/color_chooser.adb
+++ b/test/color_chooser.adb
@@ -66,7 +66,8 @@ is
Image_Width, Image_Height : constant Natural := 100;
- The_Image_Data : FLTK.Color_Component_Array := Make_Image_Data (Image_Width, Image_Height);
+ The_Image_Data : constant FLTK.Color_Component_Array :=
+ Make_Image_Data (Image_Width, Image_Height);
type Pens is new Bx.Box with null record;
@@ -108,7 +109,7 @@ is
procedure Callback_One
- (This : in out FLTK.Widgets.Widget'Class) is
+ (Ignore : in out FLTK.Widgets.Widget'Class) is
begin
My_Color := Ask.Show_Colormap (My_Color);
The_Box.Set_Background_Color (My_Color);
@@ -118,7 +119,7 @@ is
procedure Callback_Two
- (This : in out FLTK.Widgets.Widget'Class)
+ (Ignore : in out FLTK.Widgets.Widget'Class)
is
R, G, B : FLTK.Color_Component;
begin
diff --git a/test/compare.adb b/test/compare.adb
index 2273414..a631416 100644
--- a/test/compare.adb
+++ b/test/compare.adb
@@ -15,11 +15,11 @@ procedure Compare is
package TIO renames Ada.Text_IO;
package FFN renames FLTK.Filenames;
- Aardvark : String := "aardvark";
- Zebra : String := "Zebra";
- Two : String := "item_2";
- Ten : String := "item_10";
- Cap_Ten : String := "Item_10";
+ Aardvark : constant String := "aardvark";
+ Zebra : constant String := "Zebra";
+ Two : constant String := "item_2";
+ Ten : constant String := "item_10";
+ Cap_Ten : constant String := "Item_10";
begin
diff --git a/test/dirlist.adb b/test/dirlist.adb
index 1a07515..a7c159a 100644
--- a/test/dirlist.adb
+++ b/test/dirlist.adb
@@ -39,7 +39,7 @@ begin
end if;
declare
- Name : Fil.Path_String := Fil.Expand (ACom.Argument (1));
+ Name : constant Fil.Path_String := Fil.Expand (ACom.Argument (1));
begin
if not Fil.Is_Directory (Name) then
TIO.Put_Line ("Error: " & Name & " is not a valid directory.");
@@ -48,7 +48,7 @@ begin
end if;
declare
- The_List : Fil.File_List := Fil.Get_Listing (Name, Fil.Alpha_Sort'Access);
+ The_List : constant Fil.File_List := Fil.Get_Listing (Name, Fil.Alpha_Sort'Access);
begin
TIO.Put_Line ("Alphabetical Sort:");
for Index in 1 .. The_List.Length loop
@@ -58,7 +58,7 @@ begin
end;
declare
- The_List : Fil.File_List := Fil.Get_Listing (Name, Fil.Case_Alpha_Sort'Access);
+ The_List : constant Fil.File_List := Fil.Get_Listing (Name, Fil.Case_Alpha_Sort'Access);
begin
TIO.Put_Line ("Case Insensitive Alphabetical Sort:");
for Index in 1 .. The_List.Length loop
@@ -68,7 +68,7 @@ begin
end;
declare
- The_List : Fil.File_List := Fil.Get_Listing (Name, Fil.Numeric_Sort'Access);
+ The_List : constant Fil.File_List := Fil.Get_Listing (Name, Fil.Numeric_Sort'Access);
begin
TIO.Put_Line ("Numeric Sort:");
for Index in 1 .. The_List.Length loop
@@ -78,7 +78,8 @@ begin
end;
declare
- The_List : Fil.File_List := Fil.Get_Listing (Name, Fil.Case_Numeric_Sort'Access);
+ The_List : constant Fil.File_List :=
+ Fil.Get_Listing (Name, Fil.Case_Numeric_Sort'Access);
begin
TIO.Put_Line ("Case Insensitive Numeric Sort:");
for Index in 1 .. The_List.Length loop
diff --git a/test/filename.adb b/test/filename.adb
new file mode 100644
index 0000000..937fba4
--- /dev/null
+++ b/test/filename.adb
@@ -0,0 +1,40 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Released into the public domain
+
+
+with
+
+ Ada.Command_Line,
+ Ada.Text_IO,
+ FLTK.Filenames;
+
+
+procedure Filename is
+
+ package ACom renames Ada.Command_Line;
+ package TIO renames Ada.Text_IO;
+ package Fil renames FLTK.Filenames;
+
+begin
+
+ TIO.Put_Line ("Test program for FLTK filename absolute and expand functions.");
+ TIO.New_Line;
+ TIO.Put ("Input: ");
+
+ if ACom.Argument_Count /= 1 then
+ TIO.Put_Line ("Error: Need exactly one filename argument.");
+ ACom.Set_Exit_Status (ACom.Failure);
+ return;
+ end if;
+
+ TIO.Put_Line (ACom.Argument (1));
+ TIO.New_Line;
+
+ TIO.Put_Line ("Absolute: " & Fil.Absolute (ACom.Argument (1)));
+ TIO.Put_Line ("Expanded: " & Fil.Expand (ACom.Argument (1)));
+
+end Filename;
+
+
diff --git a/test/pixmap.adb b/test/pixmap.adb
index 0ca3982..a9cf6b7 100644
--- a/test/pixmap.adb
+++ b/test/pixmap.adb
@@ -34,15 +34,15 @@ is
package WD renames FLTK.Widgets.Groups.Windows.Double;
- Porsche_Header : Pix.Header := (64, 64, 4, 1);
+ Porsche_Header : constant Pix.Header := (64, 64, 4, 1);
- Porsche_Colors : Pix.Color_Definition_Array :=
+ Porsche_Colors : constant Pix.Color_Definition_Array :=
((Name => +" ", Kind => Pix.Colorful, Value => +"#background"),
(Name => +".", Kind => Pix.Colorful, Value => +"#000000000000"),
(Name => +"X", Kind => Pix.Colorful, Value => +"#ffd100"),
(Name => +"o", Kind => Pix.Colorful, Value => +"#FFFF00000000"));
- Porsche_Data : Pix.Pixmap_Data :=
+ Porsche_Data : constant Pix.Pixmap_Data :=
(" ",
" .......................... ",
" ..................................... ",
@@ -126,7 +126,7 @@ is
procedure Button_Callback
- (Item : in out FLTK.Widgets.Widget'Class)
+ (Ignore : in out FLTK.Widgets.Widget'Class)
is
New_Align : FLTK.Alignment;
begin