-- necessarily required in a case like this where the result is not
-- a machine number, but it is certainly a desirable behavior.
+ procedure Bad_Based_Value;
+ pragma No_Return (Bad_Based_Value);
+ -- Raise exception for bad based value
+
procedure Scanf;
-- Scans integer literal value starting at current character position.
-- For each digit encountered, Uval is multiplied by 10.0, and the new
-- return P points past the last character. On entry, the current
-- character is known to be a digit, so a numeral is definitely present.
+ ---------------------
+ -- Bad_Based_Value --
+ ---------------------
+
+ procedure Bad_Based_Value is
+ begin
+ raise Constraint_Error with
+ "invalid based literal for 'Value";
+ end Bad_Based_Value;
+
-----------
-- Scanf --
-----------
-- Any other initial character is an error
else
- raise Constraint_Error;
+ raise Constraint_Error with
+ "invalid character in 'Value string";
end if;
-- Deal with based case
loop
if P > Max then
- raise Constraint_Error;
+ Bad_Based_Value;
elsif Str (P) in Digs then
Digit := Character'Pos (Str (P)) - Character'Pos ('0');
Character'Pos (Str (P)) - (Character'Pos ('a') - 10);
else
- raise Constraint_Error;
+ Bad_Based_Value;
end if;
-- Save up trailing zeroes after the decimal point
P := P + 1;
if P > Max then
- raise Constraint_Error;
+ Bad_Based_Value;
elsif Str (P) = '_' then
Scan_Underscore (Str, P, Ptr, Max, True);
After_Point := 1;
if P > Max then
- raise Constraint_Error;
+ Bad_Based_Value;
end if;
end if;
-- Here is where we check for a bad based number
if Bad_Base then
- raise Constraint_Error;
+ Bad_Based_Value;
-- If OK, then deal with initial minus sign, note that this processing
-- is done even if Uval is zero, so that -0.0 is correctly interpreted.