------------------------------------------------------------------------------
-- --
--- GNAT RUNTIME COMPONENTS --
+-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T E X T _ I O . E N U M E R A T I O N _ A U X --
-- --
-- B o d y --
-- --
--- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
with Ada.Text_IO.Generic_Aux; use Ada.Text_IO.Generic_Aux;
with Ada.Characters.Handling; use Ada.Characters.Handling;
-with Interfaces.C_Streams; use Interfaces.C_Streams;
-- Note: this package does not yet deal properly with wide characters ???
package body Ada.Text_IO.Enumeration_Aux is
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- -- These definitions replace the ones in Ada.Characters.Handling, which
- -- do not seem to work for some strange not understood reason ??? at
- -- least in the OS/2 version.
-
- function To_Lower (C : Character) return Character;
- function To_Upper (C : Character) return Character;
-
------------------
-- Get_Enum_Lit --
------------------
Buf : out String;
Buflen : out Natural)
is
- ch : int;
+ ch : Integer;
C : Character;
begin
Store_Char (File, Character'Pos (To_Upper (C)), Buf, Buflen);
ch := Getc (File);
- exit when ch = EOF;
+ exit when ch = EOF_Char;
C := Character'Val (ch);
exit when not Is_Letter (C)
Actual_Width : constant Count := Count'Max (Count (Width), Item'Length);
begin
- if Set = Lower_Case and then Item (1) /= ''' then
+ if Set = Lower_Case and then Item (Item'First) /= ''' then
declare
Iteml : String (Item'First .. Item'Last);
----------
procedure Puts
- (To : out String;
- Item : in String;
- Set : Type_Set)
+ (To : out String;
+ Item : String;
+ Set : Type_Set)
is
Ptr : Natural;
else
Ptr := To'First;
for J in Item'Range loop
- if Set = Lower_Case and then Item (1) /= ''' then
+ if Set = Lower_Case and then Item (Item'First) /= ''' then
To (Ptr) := To_Lower (Item (J));
else
To (Ptr) := Item (J);
end if;
end if;
- Stop := Stop - 1;
raise Data_Error;
-- Similarly for identifiers, read as far as we can, in particular,
Stop := Stop + 1;
end loop;
end if;
-
end Scan_Enum_Lit;
- --------------
- -- To_Lower --
- --------------
-
- function To_Lower (C : Character) return Character is
- begin
- if C in 'A' .. 'Z' then
- return Character'Val (Character'Pos (C) + 32);
- else
- return C;
- end if;
- end To_Lower;
-
- function To_Upper (C : Character) return Character is
- begin
- if C in 'a' .. 'z' then
- return Character'Val (Character'Pos (C) - 32);
- else
- return C;
- end if;
- end To_Upper;
-
end Ada.Text_IO.Enumeration_Aux;