-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency on compare_to_case
- Loading branch information
Showing
7 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule compare_to_case
deleted from
7934e3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package Alire.Utils.Comparisons with Preelaborate is | ||
|
||
type Result is (Left, Equal, Right); | ||
|
||
type Bool_Result is (Left, Right, None, Both); | ||
|
||
------------- | ||
-- Compare -- | ||
------------- | ||
|
||
generic | ||
type Comparable (<>) is limited private; | ||
with function "<" (L, R : Comparable) return Boolean is <>; | ||
function Compare (L, R : Comparable) return Result | ||
with Post => Compare'Result = | ||
(if L < R | ||
then Left | ||
else (if R < L | ||
then Right | ||
else Equal)); | ||
|
||
--------------- | ||
-- Which_One -- | ||
--------------- | ||
|
||
function Which_One (L, R : Boolean) return Bool_Result | ||
is (if L and then not R then | ||
Left | ||
elsif R and then not L then | ||
Right | ||
elsif L then | ||
Both | ||
else | ||
None); | ||
|
||
private | ||
|
||
------------- | ||
-- Compare -- | ||
------------- | ||
|
||
function Compare (L, R : Comparable) return Result | ||
is (if L < R then | ||
Left | ||
elsif R < L then | ||
Right | ||
else | ||
Equal); | ||
|
||
end Alire.Utils.Comparisons; |