On this page
- Availability and ownership
- Import and instantiate
- Contract and lifecycle reading
- API 001
- API 002
- API 003
- API 004
- API 005
- API 006
- API 007
- API 008
- API 009
- API 010
- API 011
- API 012
- API 013
- API 014
- API 015
- API 016
- API 017
- API 018
- API 019
- API 020
- API 021
- API 022
- API 023
- API 024
- API 025
- API 026
- API 027
- API 028
- API 029
- API 030
- API 031
- API 032
- API 033
- API 034
- API 035
- API 036
- API 037
- API 038
- API 039
- API 040
- API 041
- API 042
- API 043
- API 044
- API 045
- API 046
- API 047
- API 048
- API 049
- API 050
- API 051
- API 052
- API 053
- API 054
- API 055
- API 056
- API 057
- API 058
- API 059
- API 060
- API 061
- API 062
- API 063
- API 064
- API 065
- API 066
- API 067
- API 068
- API 069
- API 070
- API 071
- API 072
- API 073
- API 074
- API 075
- API 076
- API 077
- API 078
- API 079
- API 080
- API 081
- API 082
- API 083
- API 084
- API 085
- API 086
- API 087
- API 088
- API 089
- API 090
- API 091
- API 092
- API 093
- API 094
- API 095
- API 096
Verada.Scanning
The values that T'Value, T'Valid_Value and Text_IO's numeric Get read from strings, with proved scanners.
Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.
Availability and ownership
Each kind of value (integers, reals, fixed-point values, enumeration values, characters) has a query, Is_..., and a value function, ..._Value, whose precondition is the query and whose postcondition gives the value. The compiler rewrites T'Value (S), T'Wide_Value (S) and T'Wide_Wide_Value (S) into a call of the value function for T's bounds, and T'Valid_Value (S) into a call of the query, so a program names the attributes and does not need to import the unit. A program may also call the functions itself. The scanners' bodies are proved against the ghost models in the specification (Run, Scaled, Integer_Count, Integer_Model); a real's value is the run time's correctly rounded reading of the literal, and a fixed-point value's its exact count of the type's small.
Import and instantiate
with Verada.Scanning;import Verada.Scanning;
A program normally reaches the unit through the attributes; see the family guide's example.
Contract and lifecycle reading
A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume.
API 001
Big (declaration) — The integer type with the widest range: every integer and modular type's values are in it, so it holds every value an integer string can have.
Declared interface:
subtype Big is Long_Long_Long_Integer;API 002
Base_Range (declaration) — The bases a based literal may have.
Declared interface:
subtype Base_Range is Integer range 2 .. 16;API 003
Widened (declaration) — S's characters as code points, from 1.
Declared interface:
function Widened (S : String) return Wide_Wide_String
with Global => null,
Post => Widened'Result'First = 1 and then Widened'Result'Length = S'Length
and then S'Length < Verada.Storage.Length_Bound
and then (for all I in 1 .. S'Length =>
Widened'Result (I) = Wide_Wide_Character'Val (Character'Pos (S (I - 1 + S'First))));API 004
Widened (declaration) — A Wide_String's characters as code points, from 1.
Declared interface:
function Widened (S : Wide_String) return Wide_Wide_String
with Global => null,
Post => Widened'Result'First = 1 and then Widened'Result'Length = S'Length
and then S'Length < Verada.Storage.Length_Bound
and then (for all I in 1 .. S'Length =>
Widened'Result (I) = Wide_Wide_Character'Val (Wide_Character'Pos (S (I - 1 + S'First))));API 005
Widened (declaration) — A Wide_Wide_String's characters, from 1.
Declared interface:
function Widened (S : Wide_Wide_String) return Wide_Wide_String
with Global => null,
Post => Widened'Result'First = 1 and then Widened'Result'Length = S'Length
and then S'Length < Verada.Storage.Length_Bound
and then (for all I in 1 .. S'Length => Widened'Result (I) = S (I - 1 + S'First));API 006
Wide (declaration) — S's characters as a Wide_String (for 'Wide_Image).
Declared interface:
function Wide (S : String) return Wide_String is
(Wide_String'(for I in 1 .. S'Length => Wide_Character'Val (Character'Pos (S (I - 1 + S'First)))))
with Post => Wide'Result'First = 1 and then Wide'Result'Length = S'Length;API 007
From_One (declaration) — A string the scanners read: empty, or indexed from 1 (and, as every string in memory is, shorter than Length_Bound).
Declared interface:
function From_One (S : Wide_Wide_String) return Boolean is
((S'Length = 0 or else S'First = 1) and then S'Length < Verada.Storage.Length_Bound);API 008
Leading_Blanks (declaration) — How many of S's characters are spaces before the first that is not.
Declared interface:
function Leading_Blanks (S : Wide_Wide_String) return Natural
with Global => null,
Pre => From_One (S),
Post => Leading_Blanks'Result <= S'Length
and then (for all K in 1 .. Leading_Blanks'Result => S (K) = ' ')
and then (Leading_Blanks'Result = S'Length or else S (Leading_Blanks'Result + 1) /= ' ');API 009
Trailing_Blanks (declaration) — How many are spaces after the last that is not (S'Length when all are).
Declared interface:
function Trailing_Blanks (S : Wide_Wide_String) return Natural
with Global => null,
Pre => From_One (S),
Post => Trailing_Blanks'Result <= S'Length
and then (for all K in 1 .. Trailing_Blanks'Result => S (S'Length - Trailing_Blanks'Result + K) = ' ')
and then (Trailing_Blanks'Result = S'Length or else S (S'Length - Trailing_Blanks'Result) /= ' ');API 010
Value_Last (declaration) — The last character of the value: the last that is not a space.
Declared interface:
function Value_Last (S : Wide_Wide_String) return Natural is (S'Length - Trailing_Blanks (S))
with Pre => From_One (S);API 011
Signed (declaration) — Whether the value has a sign: its first character, after the spaces.
Declared interface:
function Signed (S : Wide_Wide_String) return Boolean is
(Leading_Blanks (S) < Value_Last (S) and then S (Leading_Blanks (S) + 1) in '+' | '-')
with Pre => From_One (S);API 012
Minus (declaration) — Whether that sign is a minus.
Declared interface:
function Minus (S : Wide_Wide_String) return Boolean is
(Signed (S) and then S (Leading_Blanks (S) + 1) = '-')
with Pre => From_One (S);API 013
Literal_After (declaration) — The characters before the literal: the spaces, and the sign.
Declared interface:
function Literal_After (S : Wide_Wide_String) return Natural is
(Leading_Blanks (S) + (if Signed (S) then 1 else 0))
with Pre => From_One (S);API 014
Digit_Value (declaration) — A digit's value, 16 for a character that is not one.
Declared interface:
function Digit_Value (C : Wide_Wide_Character) return Natural is
(if C in '0' .. '9' then Wide_Wide_Character'Pos (C) - 48
elsif C in 'A' .. 'F' then Wide_Wide_Character'Pos (C) - 55
elsif C in 'a' .. 'f' then Wide_Wide_Character'Pos (C) - 87
else 16)
with Post => Digit_Value'Result <= 16;API 015
Is_Digit (declaration) — Whether C is a digit of the base.
Declared interface:
function Is_Digit (C : Wide_Wide_Character; Base : Base_Range) return Boolean is (Digit_Value (C) < Base);API 016
Is_Run (declaration) — S (After + 1 .. Last) are digits of the base with single underscores between them.
Declared interface:
function Is_Run (S : Wide_Wide_String; After, Last : Natural; Base : Base_Range) return Boolean is
(After < Last and then Is_Digit (S (After + 1), Base) and then Is_Digit (S (Last), Base)
and then (for all I in After + 1 .. Last =>
Is_Digit (S (I), Base)
or else (S (I) = '_' and then I > After + 1 and then I < Last
and then Is_Digit (S (I - 1), Base) and then Is_Digit (S (I + 1), Base))))
with Pre => From_One (S) and then Last <= S'Length;API 017
Find (declaration) — The first of S (After + 1 .. Last) that is C1 or C2, 0 when none is.
Declared interface:
function Find (S : Wide_Wide_String; After, Last : Natural; C1, C2 : Wide_Wide_Character) return Natural
with Global => null,
Pre => From_One (S) and then Last <= S'Length and then After <= S'Length,
Post => (if Find'Result = 0 then (for all I in After + 1 .. Last => S (I) /= C1 and then S (I) /= C2)
else Find'Result in After + 1 .. Last and then (S (Find'Result) = C1 or else S (Find'Result) = C2)
and then (for all I in After + 1 .. Find'Result - 1 => S (I) /= C1 and then S (I) /= C2));API 018
Saturated (declaration) — Values are counted negatively, so that Big'First's magnitude has a value too: a count is a value's negation, or Saturated once it is beyond Big's range. Saturated is not a limit on the values read: no type has a value beyond Big's.
Declared interface:
Saturated : constant Big := 1;API 019
Step (declaration) — A count, then one more digit.
Declared interface:
function Step (N : Big; Base : Base_Range; D : Natural) return Big is
(if N > 0 or else N < (Big'First + Big (D)) / Big (Base) then Saturated else N * Big (Base) - Big (D))
with Pre => D <= 16,
Post => Step'Result = Saturated or else Step'Result <= 0;API 020
Run (declaration) — The count of S (After + 1 .. Last)'s digits, the underscores skipped.
Declared interface:
function Run (S : Wide_Wide_String; After, Last : Natural; Base : Base_Range) return Big is
(if Last <= After then 0
elsif S (Last) = '_' then Run (S, After, Last - 1, Base)
else Step (Run (S, After, Last - 1, Base), Base, Digit_Value (S (Last))))
with Ghost,
Pre => From_One (S) and then Last <= S'Length,
Post => Run'Result = Saturated or else Run'Result <= 0,
Subprogram_Variant => (Decreases => Last);API 021
Scaled (declaration) — A count times Base ** E.
Declared interface:
function Scaled (N : Big; Base : Base_Range; E : Big) return Big is
(if E <= 0 or else N = 0 or else N = Saturated then N else Scaled (Step (N, Base, 0), Base, E - 1))
with Ghost,
Post => (if N = Saturated or else N <= 0 then Scaled'Result = Saturated or else Scaled'Result <= 0),
Subprogram_Variant => (Decreases => E);API 022
Hash_1 (declaration) — Where an integer literal's first '#' is (0 for a decimal one).
Declared interface:
function Hash_1 (S : Wide_Wide_String) return Natural is (Find (S, Literal_After (S), Value_Last (S), '#', '#'))
with Pre => From_One (S);API 023
Hash_2 (declaration) — Its second '#' (0 for none).
Declared interface:
function Hash_2 (S : Wide_Wide_String) return Natural is
(if Hash_1 (S) = 0 then 0 else Find (S, Hash_1 (S), Value_Last (S), '#', '#'))
with Pre => From_One (S);API 024
Mantissa_Last (declaration) — The last character before the exponent: the second '#', or the last before an 'E'.
Declared interface:
function Mantissa_Last (S : Wide_Wide_String) return Natural is
(if Hash_1 (S) /= 0 then Hash_2 (S)
elsif Find (S, Literal_After (S), Value_Last (S), 'E', 'e') = 0 then Value_Last (S)
else Find (S, Literal_After (S), Value_Last (S), 'E', 'e') - 1)
with Pre => From_One (S),
Post => Mantissa_Last'Result <= Value_Last (S);API 025
Base_Count (declaration) — The base, 10 for a decimal literal (its value, which may not be a base, for a based one).
Declared interface:
function Base_Count (S : Wide_Wide_String) return Big is
(if Hash_1 (S) = 0 then -10 else Run (S, Literal_After (S), Hash_1 (S) - 1, 10))
with Ghost, Pre => From_One (S);API 026
Base_Number (declaration) — A based literal's base, as written (Base_Count's value).
Declared interface:
function Base_Number (S : Wide_Wide_String) return Big
with Global => null,
Pre => From_One (S) and then Hash_1 (S) /= 0,
Post => Base_Number'Result = Base_Count (S);API 027
Base_Of (declaration) — The base of the literal's digits: a based literal's when it is one of 2 .. 16, else 10.
Declared interface:
function Base_Of (S : Wide_Wide_String) return Base_Range is
(if Hash_1 (S) /= 0 and then Base_Number (S) in -16 .. -2 then Base_Range (-Base_Number (S)) else 10)
with Pre => From_One (S);API 028
Has_Exponent (declaration) — Whether the literal has an exponent, and where its digits start.
Declared interface:
function Has_Exponent (S : Wide_Wide_String) return Boolean is (Mantissa_Last (S) < Value_Last (S))
with Pre => From_One (S);API 029
Exponent_After (declaration) — The characters before the exponent's digits: the mantissa, the 'E', and the exponent's sign.
Declared interface:
function Exponent_After (S : Wide_Wide_String) return Natural is
(Mantissa_Last (S) + 1
+ (if Mantissa_Last (S) < Value_Last (S) - 1 and then S (Mantissa_Last (S) + 2) in '+' | '-' then 1 else 0))
with Pre => From_One (S) and then Has_Exponent (S);API 030
Exponent_Form (declaration) — An exponent, 'E' or 'e', a sign (not a minus unless Negative_Allowed) and digits.
Declared interface:
function Exponent_Form (S : Wide_Wide_String; Negative_Allowed : Boolean) return Boolean is
(not Has_Exponent (S)
or else (S (Mantissa_Last (S) + 1) in 'E' | 'e'
and then (Negative_Allowed or else S (Exponent_After (S)) /= '-')
and then Is_Run (S, Exponent_After (S), Value_Last (S), 10)))
with Pre => From_One (S);API 031
Integer_Syntax (declaration) — The syntax of an integer literal, after the spaces and the sign.
Declared interface:
function Integer_Syntax (S : Wide_Wide_String) return Boolean is
(Literal_After (S) < Value_Last (S)
and then (if Hash_1 (S) = 0 then Is_Run (S, Literal_After (S), Mantissa_Last (S), 10)
else Hash_1 (S) - 1 > Literal_After (S)
and then Is_Run (S, Literal_After (S), Hash_1 (S) - 1, 10)
and then Hash_2 (S) - 1 > Hash_1 (S)
and then Base_Number (S) in -16 .. -2
and then Is_Run (S, Hash_1 (S), Hash_2 (S) - 1, Base_Of (S)))
and then Exponent_Form (S, Negative_Allowed => False))
with Pre => From_One (S);API 032
Digits_After (declaration) — Where the mantissa's digits are: after the sign, or between the '#'s.
Declared interface:
function Digits_After (S : Wide_Wide_String) return Natural is
(if Hash_1 (S) = 0 then Literal_After (S) else Hash_1 (S))
with Pre => From_One (S);API 033
Digits_Last (declaration) — The mantissa's last digit: before the 'E', or before the second '#'.
Declared interface:
function Digits_Last (S : Wide_Wide_String) return Natural is
(if Hash_1 (S) = 0 then Mantissa_Last (S) else Natural'Max (Hash_2 (S) - 1, 0))
with Pre => From_One (S),
Post => Digits_Last'Result <= S'Length;API 034
Mantissa_Count (declaration) — The count of the mantissa's digits.
Declared interface:
function Mantissa_Count (S : Wide_Wide_String) return Big is
(Run (S, Digits_After (S), Digits_Last (S), Base_Of (S)))
with Ghost, Pre => From_One (S);API 035
Exponent_Value (declaration) — The exponent's value (Big'Last for any beyond Big's range).
Declared interface:
function Exponent_Value (S : Wide_Wide_String) return Big is
(if not Has_Exponent (S) then 0
-- (an exponent of 2 ** 127 or more makes any value but 0 one beyond every type's)
elsif Run (S, Exponent_After (S), Value_Last (S), 10) = Saturated
or else Run (S, Exponent_After (S), Value_Last (S), 10) = Big'First
then Big'Last
else -Run (S, Exponent_After (S), Value_Last (S), 10))
with Ghost, Pre => From_One (S);API 036
Integer_Count (declaration) — The integer's magnitude, counted (negated), or Saturated.
Declared interface:
function Integer_Count (S : Wide_Wide_String) return Big is
(Scaled (Mantissa_Count (S), Base_Of (S), Exponent_Value (S)))
with Ghost, Pre => From_One (S);API 037
Integer_Form (declaration) — The integer S has the syntax of, and whose value is in Big's range.
Declared interface:
function Integer_Form (S : Wide_Wide_String) return Boolean is
(Integer_Syntax (S)
and then Integer_Count (S) /= Saturated
and then (Minus (S) or else Integer_Count (S) /= Big'First))
with Ghost, Pre => From_One (S);API 038
Integer_Model (declaration) — Its value.
Declared interface:
function Integer_Model (S : Wide_Wide_String) return Big is
(if Minus (S) then Integer_Count (S) elsif Integer_Count (S) in Big'First + 1 .. 0 then -Integer_Count (S) else 0)
with Ghost, Pre => From_One (S);API 039
Is_Integer_From_One (declaration) — Whether S, from 1, is an integer in First .. Last (a modular type's has no minus sign).
Declared interface:
function Is_Integer_From_One (S : Wide_Wide_String; First, Last : Big; Modular : Boolean) return Boolean
with Global => null,
Pre => From_One (S),
Post => Is_Integer_From_One'Result
= (Integer_Form (S) and then Integer_Model (S) in First .. Last and then (if Modular then not Minus (S)));API 040
Integer_From_One (declaration) — Its value.
Declared interface:
function Integer_From_One (S : Wide_Wide_String; First, Last : Big; Modular : Boolean) return Big
with Global => null,
Pre => From_One (S) and then Is_Integer_From_One (S, First, Last, Modular),
Post => Integer_From_One'Result = Integer_Model (S) and then Integer_From_One'Result in First .. Last;API 041
Is_Integer (declaration) — Whether S is an integer in First .. Last (a modular type's has no minus sign) whether S is an integer in First .. Last (a modular type's has no minus sign).
Declared interface:
function Is_Integer (S : String; First, Last : Big; Modular : Boolean := False) return Boolean is
(Is_Integer_From_One (Widened (S), First, Last, Modular));API 042
Is_Integer (declaration) — (of a Wide_String).
Declared interface:
function Is_Integer (S : Wide_String; First, Last : Big; Modular : Boolean := False) return Boolean is
(Is_Integer_From_One (Widened (S), First, Last, Modular));API 043
Is_Integer (declaration) — (of a Wide_Wide_String).
Declared interface:
function Is_Integer (S : Wide_Wide_String; First, Last : Big; Modular : Boolean := False) return Boolean is
(Is_Integer_From_One (Widened (S), First, Last, Modular));API 044
Integer_Value (declaration) — Its value.
Declared interface:
function Integer_Value (S : String; First, Last : Big; Modular : Boolean := False) return Big is
(Integer_From_One (Widened (S), First, Last, Modular))
with Pre => Is_Integer (S, First, Last, Modular);API 045
Integer_Value (declaration) — (of a Wide_String).
Declared interface:
function Integer_Value (S : Wide_String; First, Last : Big; Modular : Boolean := False) return Big is
(Integer_From_One (Widened (S), First, Last, Modular))
with Pre => Is_Integer (S, First, Last, Modular);API 046
Integer_Value (declaration) — (of a Wide_Wide_String).
Declared interface:
function Integer_Value (S : Wide_Wide_String; First, Last : Big; Modular : Boolean := False) return Big is
(Integer_From_One (Widened (S), First, Last, Modular))
with Pre => Is_Integer (S, First, Last, Modular);API 047
Name_Ends (declaration) — Enumeration values. Sema passes a table of the type's images, in the order of their positions: Names holds them one after another, and Ends (P) is where the one at position P ends. An identifier's image is in upper case, a character literal's as written.
Declared interface:
type Name_Ends is array (Natural range <>) of Natural;API 048
Well_Formed (declaration) — Whether a table is one: Names from 1, and Ends from 0, never decreasing, within Names.
Declared interface:
function Well_Formed (Names : Wide_Wide_String; Ends : Name_Ends) return Boolean is
(From_One (Names) and then Ends'Length > 0 and then Ends'First = 0
and then (for all P in Ends'Range => Ends (P) <= Names'Length)
and then (for all P in Ends'Range => (if P > 0 then Ends (P - 1) <= Ends (P))));API 049
Image_After (declaration) — The characters before the image at position P.
Declared interface:
function Image_After (Names : Wide_Wide_String; Ends : Name_Ends; P : Natural) return Natural is
(if P = 0 then 0 else Ends (P - 1))
with Pre => Well_Formed (Names, Ends) and then P in Ends'Range;API 050
Upper (declaration) — A character's upper case (CPython's, where it is one character).
Declared interface:
function Upper (C : Wide_Wide_Character) return Wide_Wide_Character is
(if C in 'a' .. 'z' then Wide_Wide_Character'Val (Wide_Wide_Character'Pos (C) - 32)
elsif Wide_Wide_Character'Pos (C) in 128 .. 16#10FFFF#
then Wide_Wide_Character'Val (Verada.Strings.Unicode.Upper_Code (Wide_Wide_Character'Pos (C)))
else C);API 051
Matches (declaration) — Whether S, its spaces aside, is the image at position P: an identifier in any case, a character literal as written (the image's characters, Names (Image_After (Names, Ends, P) + 1 .. Ends (P)), compared with S's after its spaces, as many as S has before its trailing spaces).
Declared interface:
function Matches (S, Names : Wide_Wide_String; Ends : Name_Ends; P : Natural) return Boolean
with Global => null,
Pre => From_One (S) and then Well_Formed (Names, Ends) and then P in Ends'Range;API 052
Match_Position (declaration) — The first position whose image S is, -1 for none.
Declared interface:
function Match_Position (S, Names : Wide_Wide_String; Ends : Name_Ends) return Integer
with Global => null,
Pre => From_One (S) and then Well_Formed (Names, Ends),
Post => (if Match_Position'Result = -1 then (for all P in Ends'Range => not Matches (S, Names, Ends, P))
else Match_Position'Result in Ends'Range
and then Matches (S, Names, Ends, Match_Position'Result)
and then (for all P in 0 .. Match_Position'Result - 1 => not Matches (S, Names, Ends, P)));API 053
Is_Enumeration_From_One (declaration) — Whether S, from 1, is the image of a value at a position in First .. Last.
Declared interface:
function Is_Enumeration_From_One (S, Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Boolean is
(Match_Position (S, Names, Ends) /= -1 and then Big (Match_Position (S, Names, Ends)) in First .. Last)
with Pre => From_One (S) and then Well_Formed (Names, Ends);API 054
Is_Enumeration (declaration) — Whether S is the image of a value at a position in First .. Last.
Declared interface:
function Is_Enumeration (S : String; Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Boolean is
(Is_Enumeration_From_One (Widened (S), Names, Ends, First, Last))
with Pre => Well_Formed (Names, Ends);API 055
Is_Enumeration (declaration) — (of a Wide_String).
Declared interface:
function Is_Enumeration (S : Wide_String; Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Boolean is
(Is_Enumeration_From_One (Widened (S), Names, Ends, First, Last))
with Pre => Well_Formed (Names, Ends);API 056
Is_Enumeration (declaration) — (of a Wide_Wide_String).
Declared interface:
function Is_Enumeration (S : Wide_Wide_String; Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Boolean is
(Is_Enumeration_From_One (Widened (S), Names, Ends, First, Last))
with Pre => Well_Formed (Names, Ends);API 057
Enumeration_Value (declaration) — The position of the value whose image S is.
Declared interface:
function Enumeration_Value (S : String; Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Big is
(Big (Match_Position (Widened (S), Names, Ends)))
with Pre => Well_Formed (Names, Ends) and then Is_Enumeration (S, Names, Ends, First, Last),
Post => Enumeration_Value'Result in First .. Last;API 058
Enumeration_Value (declaration) — (of a Wide_String).
Declared interface:
function Enumeration_Value (S : Wide_String; Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Big is
(Big (Match_Position (Widened (S), Names, Ends)))
with Pre => Well_Formed (Names, Ends) and then Is_Enumeration (S, Names, Ends, First, Last),
Post => Enumeration_Value'Result in First .. Last;API 059
Enumeration_Value (declaration) — (of a Wide_Wide_String).
Declared interface:
function Enumeration_Value (S : Wide_Wide_String; Names : Wide_Wide_String; Ends : Name_Ends; First, Last : Big) return Big is
(Big (Match_Position (Widened (S), Names, Ends)))
with Pre => Well_Formed (Names, Ends) and then Is_Enumeration (S, Names, Ends, First, Last),
Post => Enumeration_Value'Result in First .. Last;API 060
Control_Names (declaration) — The control characters' names, by Name_Position.
Declared interface:
Control_Names : constant Wide_Wide_String :=
"NULSOHSTXETXEOTENQACKBELBSHTLFVTFFCRSOSIDLEDC1DC2DC3DC4NAKSYNETBCANEMSUBESCFSGSRSUSDELRESERVED_128RESERVED_129BPHNBHRESERVED_132NELSSAESAHTSHTJVTSPLDPLURISS2SS3DCSPU1PU2STSCCHMWSPAEPASOSRESERVED_153SCICSISTOSCPMAPC";API 061
Control_Ends (declaration) — Where each control character's name ends in Control_Names.
Declared interface:
Control_Ends : constant Name_Ends :=
[3, 6, 9, 12, 15, 18, 21, 24, 26, 28, 30, 32, 34, 36, 38, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 69, 72, 75, 77,
79, 81, 83, 86, 98, 110, 113, 116, 128, 131, 134, 137, 140, 143, 146, 149, 152, 154, 157, 160, 163, 166, 169,
172, 175, 177, 180, 183, 186, 198, 201, 204, 206, 209, 211, 214];API 062
Name_Position (declaration) — The character a control name names.
Declared interface:
function Name_Position (P : Natural) return Big is
(if P < 32 then Big (P) elsif P = 32 then 127 else 128 + Big (P - 33))
with Pre => P <= 64;API 063
Is_Quoted (declaration) — A character literal.
Declared interface:
function Is_Quoted (S : Wide_Wide_String) return Boolean is
(Value_Last (S) - Leading_Blanks (S) = 3 and then S (Leading_Blanks (S) + 1) = ''' and then S (Value_Last (S)) = ''')
with Pre => From_One (S);API 064
Is_Hex_Form (declaration) — The hexadecimal form: [", digits, "].
Declared interface:
function Is_Hex_Form (S : Wide_Wide_String) return Boolean is
(Value_Last (S) - Leading_Blanks (S) >= 5
and then S (Leading_Blanks (S) + 1) = '[' and then S (Leading_Blanks (S) + 2) = '"'
and then S (Value_Last (S) - 1) = '"' and then S (Value_Last (S)) = ']'
and then (for all I in Leading_Blanks (S) + 3 .. Value_Last (S) - 2 => Is_Digit (S (I), 16)))
with Pre => From_One (S);API 065
Hex_Count (declaration) — Its digits' count.
Declared interface:
function Hex_Count (S : Wide_Wide_String) return Big
with Global => null,
Pre => From_One (S) and then Is_Hex_Form (S),
Post => Hex_Count'Result = Run (S, Leading_Blanks (S) + 2, Value_Last (S) - 2, 16);API 066
Character_Position (declaration) — The position of the character S names, -1 for none.
Declared interface:
function Character_Position (S : Wide_Wide_String) return Big is
(if Is_Quoted (S) then Big (Wide_Wide_Character'Pos (S (Leading_Blanks (S) + 2)))
elsif Is_Hex_Form (S) then (if Hex_Count (S) = Saturated or else Hex_Count (S) = Big'First then -1 else -Hex_Count (S))
elsif Match_Position (S, Control_Names, Control_Ends) in 0 .. 64
then Name_Position (Match_Position (S, Control_Names, Control_Ends))
else -1)
with Pre => From_One (S);API 067
Is_Character (declaration) — Whether S names a character at a position in First .. Last.
Declared interface:
function Is_Character (S : String; First, Last : Big) return Boolean is
(Character_Position (Widened (S)) /= -1 and then Character_Position (Widened (S)) in First .. Last);API 068
Is_Character (declaration) — (of a Wide_String).
Declared interface:
function Is_Character (S : Wide_String; First, Last : Big) return Boolean is
(Character_Position (Widened (S)) /= -1 and then Character_Position (Widened (S)) in First .. Last);API 069
Is_Character (declaration) — (of a Wide_Wide_String).
Declared interface:
function Is_Character (S : Wide_Wide_String; First, Last : Big) return Boolean is
(Character_Position (Widened (S)) /= -1 and then Character_Position (Widened (S)) in First .. Last);API 070
Character_Value (declaration) — The position of the character S names.
Declared interface:
function Character_Value (S : String; First, Last : Big) return Big is (Character_Position (Widened (S)))
with Pre => Is_Character (S, First, Last), Post => Character_Value'Result in First .. Last;API 071
Character_Value (declaration) — (of a Wide_String).
Declared interface:
function Character_Value (S : Wide_String; First, Last : Big) return Big is (Character_Position (Widened (S)))
with Pre => Is_Character (S, First, Last), Post => Character_Value'Result in First .. Last;API 072
Character_Value (declaration) — (of a Wide_Wide_String).
Declared interface:
function Character_Value (S : Wide_Wide_String; First, Last : Big) return Big is (Character_Position (Widened (S)))
with Pre => Is_Character (S, First, Last), Post => Character_Value'Result in First .. Last;API 073
Point (declaration) — The point in the mantissa, 0 for none.
Declared interface:
function Point (S : Wide_Wide_String) return Natural is
(if Hash_1 (S) = 0 then Find (S, Literal_After (S), Mantissa_Last (S), '.', '.')
elsif Hash_2 (S) > Hash_1 (S) then Find (S, Hash_1 (S), Hash_2 (S) - 1, '.', '.')
else 0)
with Pre => From_One (S);API 074
Is_Mantissa (declaration) — A numeral of the base, or two with a point between them, S (After + 1 .. Last).
Declared interface:
function Is_Mantissa (S : Wide_Wide_String; After, Last : Natural; Base : Base_Range) return Boolean is
(if Point (S) = 0 then Is_Run (S, After, Last, Base)
else Point (S) - 1 > After and then Point (S) < Last
and then Is_Run (S, After, Point (S) - 1, Base) and then Is_Run (S, Point (S), Last, Base))
with Pre => From_One (S) and then Last <= S'Length;API 075
Real_Syntax (declaration) — The syntax of a real (or integer) literal, after the spaces and the sign.
Declared interface:
function Real_Syntax (S : Wide_Wide_String) return Boolean is
(Literal_After (S) < Value_Last (S)
and then (if Hash_1 (S) = 0 then Is_Mantissa (S, Literal_After (S), Mantissa_Last (S), 10)
else Hash_1 (S) - 1 > Literal_After (S)
and then Is_Run (S, Literal_After (S), Hash_1 (S) - 1, 10)
and then Hash_2 (S) - 1 > Hash_1 (S)
and then Base_Number (S) in -16 .. -2
and then Is_Mantissa (S, Hash_1 (S), Hash_2 (S) - 1, Base_Range (-Base_Number (S))))
and then Exponent_Form (S, Negative_Allowed => True))
with Pre => From_One (S);API 076
Narrowed (declaration) — S as Latin-1 (a character beyond it as '?': a literal has none).
Declared interface:
function Narrowed (S : Wide_Wide_String) return String is
(String'(for I in 1 .. S'Length =>
(if Wide_Wide_Character'Pos (S (I - 1 + S'First)) <= 255
then Character'Val (Wide_Wide_Character'Pos (S (I - 1 + S'First))) else '?')));API 077
Literal_Finite (declaration) — The run time's reading of a real literal: whether its value is within the type's range (a single's, or a double's).
Declared interface:
function Literal_Finite (Literal : String; Single : Boolean) return Boolean
with Import, Convention => Ada, External_Name => "verada_rt_literal_finite", Global => null;API 078
Literal_Double (declaration) — The literal's value, correctly rounded to a double.
Declared interface:
function Literal_Double (Literal : String) return Long_Float
with Import, Convention => Ada, External_Name => "verada_rt_literal_double", Global => null,
Pre => Literal_Finite (Literal, False);API 079
Literal_Single (declaration) — The literal's value, correctly rounded to a single.
Declared interface:
function Literal_Single (Literal : String) return Float
with Import, Convention => Ada, External_Name => "verada_rt_literal_single", Global => null,
Pre => Literal_Finite (Literal, True);API 080
Literal_Value (declaration) — The value of a literal, rounded to a single or a double.
Declared interface:
function Literal_Value (Literal : String; Single : Boolean) return Long_Float is
(if Single then Long_Float (Literal_Single (Literal)) else Literal_Double (Literal))
with Pre => Literal_Finite (Literal, Single);API 081
Is_Real_From_One (declaration) — Whether S, from 1, is a real in First .. Last (of a type of single precision, or double).
Declared interface:
function Is_Real_From_One (S : Wide_Wide_String; First, Last : Long_Float; Single : Boolean) return Boolean is
(Real_Syntax (S) and then Literal_Finite (Narrowed (S), Single)
and then Literal_Value (Narrowed (S), Single) in First .. Last)
with Pre => From_One (S);API 082
Is_Real (declaration) — Whether S is a real in First .. Last (of a type of single precision, or double).
Declared interface:
function Is_Real (S : String; First, Last : Long_Float; Single : Boolean := False) return Boolean is
(Is_Real_From_One (Widened (S), First, Last, Single));API 083
Is_Real (declaration) — (of a Wide_String).
Declared interface:
function Is_Real (S : Wide_String; First, Last : Long_Float; Single : Boolean := False) return Boolean is
(Is_Real_From_One (Widened (S), First, Last, Single));API 084
Is_Real (declaration) — (of a Wide_Wide_String).
Declared interface:
function Is_Real (S : Wide_Wide_String; First, Last : Long_Float; Single : Boolean := False) return Boolean is
(Is_Real_From_One (Widened (S), First, Last, Single));API 085
Real_Value (declaration) — Its value.
Declared interface:
function Real_Value (S : String; First, Last : Long_Float; Single : Boolean := False) return Long_Float is
(Literal_Value (Narrowed (Widened (S)), Single))
with Pre => Is_Real (S, First, Last, Single),
Post => Real_Value'Result in First .. Last;API 086
Real_Value (declaration) — (of a Wide_String).
Declared interface:
function Real_Value (S : Wide_String; First, Last : Long_Float; Single : Boolean := False) return Long_Float is
(Literal_Value (Narrowed (Widened (S)), Single))
with Pre => Is_Real (S, First, Last, Single),
Post => Real_Value'Result in First .. Last;API 087
Real_Value (declaration) — (of a Wide_Wide_String).
Declared interface:
function Real_Value (S : Wide_Wide_String; First, Last : Long_Float; Single : Boolean := False) return Long_Float is
(Literal_Value (Narrowed (Widened (S)), Single))
with Pre => Is_Real (S, First, Last, Single),
Post => Real_Value'Result in First .. Last;API 088
Literal_Smalls_Fit (declaration) — The run time's count of smalls in a literal, exactly: whether it is in First .. Last.
Declared interface:
function Literal_Smalls_Fit (Literal : String; Num, Den : Big; First, Last : Integer) return Boolean
with Import, Convention => Ada, External_Name => "verada_rt_literal_smalls_fit", Global => null;API 089
Literal_Smalls (declaration) — The count.
Declared interface:
function Literal_Smalls (Literal : String; Num, Den : Big; First, Last : Integer) return Integer
with Import, Convention => Ada, External_Name => "verada_rt_literal_smalls", Global => null,
Pre => Literal_Smalls_Fit (Literal, Num, Den, First, Last),
Post => Literal_Smalls'Result in First .. Last;API 090
Is_Fixed_From_One (declaration) — Whether S, from 1, is a fixed-point value of First .. Last smalls.
Declared interface:
function Is_Fixed_From_One (S : Wide_Wide_String; First, Last : Integer; Num, Den : Big) return Boolean is
(Real_Syntax (S) and then Literal_Smalls_Fit (Narrowed (S), Num, Den, First, Last))
with Pre => From_One (S);API 091
Is_Fixed (declaration) — Whether S is a fixed-point value of First .. Last smalls.
Declared interface:
function Is_Fixed (S : String; First, Last : Integer; Num, Den : Big) return Boolean is
(Is_Fixed_From_One (Widened (S), First, Last, Num, Den));API 092
Is_Fixed (declaration) — (of a Wide_String).
Declared interface:
function Is_Fixed (S : Wide_String; First, Last : Integer; Num, Den : Big) return Boolean is
(Is_Fixed_From_One (Widened (S), First, Last, Num, Den));API 093
Is_Fixed (declaration) — (of a Wide_Wide_String).
Declared interface:
function Is_Fixed (S : Wide_Wide_String; First, Last : Integer; Num, Den : Big) return Boolean is
(Is_Fixed_From_One (Widened (S), First, Last, Num, Den));API 094
Fixed_Value (declaration) — Its count of smalls.
Declared interface:
function Fixed_Value (S : String; First, Last : Integer; Num, Den : Big) return Integer is
(Literal_Smalls (Narrowed (Widened (S)), Num, Den, First, Last))
with Pre => Is_Fixed (S, First, Last, Num, Den),
Post => Fixed_Value'Result in First .. Last;API 095
Fixed_Value (declaration) — (of a Wide_String).
Declared interface:
function Fixed_Value (S : Wide_String; First, Last : Integer; Num, Den : Big) return Integer is
(Literal_Smalls (Narrowed (Widened (S)), Num, Den, First, Last))
with Pre => Is_Fixed (S, First, Last, Num, Den),
Post => Fixed_Value'Result in First .. Last;API 096
Fixed_Value (declaration) — (of a Wide_Wide_String).
Declared interface:
function Fixed_Value (S : Wide_Wide_String; First, Last : Integer; Num, Den : Big) return Integer is
(Literal_Smalls (Narrowed (Widened (S)), Num, Den, First, Last))
with Pre => Is_Fixed (S, First, Last, Num, Den),
Post => Fixed_Value'Result in First .. Last;