Refactoring for clearer names

This commit is contained in:
Alejandro R Mosteo
2018-03-06 12:40:09 +01:00
parent 64a19e7bf4
commit 036d8d6078
4 changed files with 25 additions and 22 deletions
+3
View File
@@ -13,6 +13,9 @@ package Alire.Index.AUnit is
Prj_Desc,
Git (Prj_Repo, "b66a41ceb35bfc81b9345655c5f46317a57de3b4"),
Properties =>
GPR_Scenario ("RUNTIME",
"full" or "zfp" or "ravenscar" or "ravenscar-cert" or "cert") and
GPR_File ("aunit.gpr") and
GPR_File ("test/aunit_tests.gpr") and
+3 -3
View File
@@ -7,9 +7,9 @@ package Alire.Requisites.Dependencies with Preelaborate is
-- This is checked against a special property that encapsulates the check of
-- actual packages available once the platform is known
package Typed is new Typed_Requisites (Properties.Dependencies.Availability_Checker);
package Matched is new For_Property (Properties.Dependencies.Availability_Checker);
type Requisite is new Typed.Requisite with private;
type Requisite is new Matched.Requisite with private;
function New_Requisite (On : Conditional.Dependencies) return Tree;
@@ -21,7 +21,7 @@ package Alire.Requisites.Dependencies with Preelaborate is
private
type Requisite is new Typed.Requisite with record
type Requisite is new Matched.Requisite with record
Deps : Conditional.Dependencies;
end record;
+5 -5
View File
@@ -5,19 +5,19 @@ package Alire.Requisites.Platform with Preelaborate is
package Plat renames Properties.Platform;
package Compilers is new Typed_Value_Requisites (Plat.Compilers, "Compiler");
package Compilers is new Requisites.For_Value_Property (Plat.Compilers, "Compiler");
function Compiler_Is (V : Platforms.Compilers) return Tree renames Compilers.New_Equality;
package Distributions is new Typed_Value_Requisites (Plat.Distributions, "Distribution");
package Distributions is new Requisites.For_Value_Property (Plat.Distributions, "Distribution");
function Distribution_Is (V : Platforms.Distributions) return Tree renames Distributions.New_Equality;
package Systems is new Typed_Value_Requisites (Plat.Operating_Systems, "OS");
package Systems is new Requisites.For_Value_Property (Plat.Operating_Systems, "OS");
function System_Is (V : Platforms.Operating_Systems) return Tree renames Systems.New_Equality;
package Versions is new Typed_Value_Requisites (Plat.Versions, "Version");
package Versions is new Requisites.For_Value_Property (Plat.Versions, "Version");
function Version_Is (V : Platforms.Versions) return Tree renames Versions.New_Equality;
package Word_Sizes is new Typed_Value_Requisites (Plat.Word_Sizes, "Arquitecture width");
package Word_Sizes is new Requisites.For_Value_Property (Plat.Word_Sizes, "Arquitecture width");
function Word_Size_Is (V : Platforms.Word_Sizes) return Tree renames Word_Sizes.New_Equality;
end Alire.Requisites.Platform;
+14 -14
View File
@@ -42,51 +42,51 @@ package Alire.Requisites with Preelaborate is
function No_Requisites return Trees.Tree is (Trees.Empty_Tree);
-- Function instead of constant to keep Preelaborate
----------------------
-- Typed_Requisites --
----------------------
------------------
-- For_Property --
------------------
-- Using these we get free matching of properties to requisites
-- It is in essence a work around MI
generic
type Compatible_Property (<>) is new Property with private;
package Typed_Requisites is
type Matching_Property (<>) is new Property with private;
package For_Property is
type Requisite is abstract new Requisites.Requisite with null record;
not overriding
function Is_Satisfied (R : Requisite; P : Compatible_Property) return Boolean is abstract;
function Is_Satisfied (R : Requisite; P : Matching_Property) return Boolean is abstract;
-- This is the important function to override by Requisite implementations
-- The remainder methods are utilities that do not require modifications by the client.
overriding function Is_Applicable (R : Requisite; P : Property'Class) return Boolean is
(P in Compatible_Property);
(P in Matching_Property);
-- Convenience for the evaluator to determine which properties might satisfy a requisite
overriding
function Satisfies (R : Requisite; P : Property'Class) return Boolean is
(if R.Is_Applicable (P)
then Requisite'Class (R).Is_Satisfied (Compatible_Property (P))
then Requisite'Class (R).Is_Satisfied (Matching_Property (P))
else False);
end Typed_Requisites;
end For_Property;
--------------
-- EXTRAS --
--------------
-- This following requisite is a typed_requisite for equality with the property
-- This following requisite is a matching requisite for value properties
-- Concevably, this could be expanded to offer >=, <, <=...
generic
with package Values is new Properties.Values (<>);
-- The property that encapsulates the requiiste value
-- The property that encapsulates the requisite value
Name : String; -- used for image "Name is Mixed_Case (Image (Value))"
package Typed_Value_Requisites is
package For_Value_Property is
package Value_Requisites is new Typed_Requisites (Values.Property);
package Value_Requisites is new For_Property (Values.Property);
type Equality is new Value_Requisites.Requisite with private;
@@ -117,6 +117,6 @@ package Alire.Requisites with Preelaborate is
overriding function Image (R : Equality) return String is
(Name & " is " & Mix (Values.Image (R.Value)));
end Typed_Value_Requisites;
end For_Value_Property;
end Alire.Requisites;