From 036d8d607882b11ba294e767afe737491ddb8f24 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Tue, 6 Mar 2018 12:40:09 +0100 Subject: [PATCH] Refactoring for clearer names --- index/alire-index-aunit.ads | 3 +++ src/alire-requisites-dependencies.ads | 6 +++--- src/alire-requisites-platform.ads | 10 +++++----- src/alire-requisites.ads | 28 +++++++++++++-------------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/index/alire-index-aunit.ads b/index/alire-index-aunit.ads index 5bb9677f..681cb631 100644 --- a/index/alire-index-aunit.ads +++ b/index/alire-index-aunit.ads @@ -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 diff --git a/src/alire-requisites-dependencies.ads b/src/alire-requisites-dependencies.ads index 77584e9e..276a52c6 100644 --- a/src/alire-requisites-dependencies.ads +++ b/src/alire-requisites-dependencies.ads @@ -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; diff --git a/src/alire-requisites-platform.ads b/src/alire-requisites-platform.ads index 5221fa58..ab56ecea 100644 --- a/src/alire-requisites-platform.ads +++ b/src/alire-requisites-platform.ads @@ -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; diff --git a/src/alire-requisites.ads b/src/alire-requisites.ads index 7fe71854..d7cc4734 100644 --- a/src/alire-requisites.ads +++ b/src/alire-requisites.ads @@ -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;