summaryrefslogtreecommitdiff
path: root/gcc/ada/s-valuns.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/s-valuns.adb')
-rw-r--r--gcc/ada/s-valuns.adb50
1 files changed, 29 insertions, 21 deletions
diff --git a/gcc/ada/s-valuns.adb b/gcc/ada/s-valuns.adb
index 885db28f3c7..d9d7940a356 100644
--- a/gcc/ada/s-valuns.adb
+++ b/gcc/ada/s-valuns.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,11 +36,11 @@ with System.Val_Util; use System.Val_Util;
package body System.Val_Uns is
- -------------------
- -- Scan_Unsigned --
- -------------------
+ -----------------------
+ -- Scan_Raw_Unsigned --
+ -----------------------
- function Scan_Unsigned
+ function Scan_Raw_Unsigned
(Str : String;
Ptr : access Integer;
Max : Integer) return Unsigned
@@ -54,17 +54,9 @@ package body System.Val_Uns is
Expon : Integer;
-- Exponent value
- Minus : Boolean := False;
- -- Set to True if minus sign is present, otherwise to False. Note that
- -- a minus sign is permissible for the singular case of -0, and in any
- -- case the pointer is left pointing past a negative integer literal.
-
Overflow : Boolean := False;
-- Set True if overflow is detected at any point
- Start : Positive;
- -- Save location of first non-blank character
-
Base_Char : Character;
-- Base character (# or :) in based case
@@ -75,13 +67,6 @@ package body System.Val_Uns is
-- Digit value
begin
- Scan_Sign (Str, Ptr, Max, Minus, Start);
-
- if Str (Ptr.all) not in '0' .. '9' then
- Ptr.all := Start;
- raise Constraint_Error;
- end if;
-
P := Ptr.all;
Uval := Character'Pos (Str (P)) - Character'Pos ('0');
P := P + 1;
@@ -270,11 +255,34 @@ package body System.Val_Uns is
-- Return result, dealing with sign and overflow
- if Overflow or else (Minus and then Uval /= 0) then
+ if Overflow then
raise Constraint_Error;
else
return Uval;
end if;
+ end Scan_Raw_Unsigned;
+
+ -------------------
+ -- Scan_Unsigned --
+ -------------------
+
+ function Scan_Unsigned
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Unsigned
+ is
+ Start : Positive;
+ -- Save location of first non-blank character
+
+ begin
+ Scan_Plus_Sign (Str, Ptr, Max, Start);
+
+ if Str (Ptr.all) not in '0' .. '9' then
+ Ptr.all := Start;
+ raise Constraint_Error;
+ end if;
+
+ return Scan_Raw_Unsigned (Str, Ptr, Max);
end Scan_Unsigned;
--------------------