Commit 4e45e7a9 by Robert Dewar Committed by Arnaud Charlet

a-strunb.ads, [...]: Add missing pragma Ada_05 statements Fix name of Set routine

2005-02-09  Robert Dewar  <dewar@adacore.com>

        * a-strunb.ads, a-strunb.adb: Add missing pragma Ada_05 statements
        Fix name of Set routine

	* a-strfix.ads, a-strfix.adb: Add new index functions from AI-301 to
	fixed packages.

	* a-stwise.ads, a-stwise.adb, a-stwifi.ads, a-stwifi.adb,
	a-strsea.ads, a-strsea.adb: Add new index functions from AI-301 to
	fixed packages

	* a-witeio.ads, a-witeio.adb, a-textio.ads, a-textio.adb: New function
	forms of Get_Line subprograms for AI-301.

	* a-wtcoau.adb, a-wtcoau.ads, a-wtcoio.adb, a-wtcoio.ads,
	a-wtedit.adb, a-wtedit.adb, a-wtedit.ads, a-wttest.adb,
	a-wttest.ads, a-strmap.ads, a-strmap.adb, a-stwima.adb,
	a-stwima.ads: Minor reformatting.

From-SVN: r94810
parent 82c80734
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -76,9 +76,9 @@ package body Ada.Strings.Search is ...@@ -76,9 +76,9 @@ package body Ada.Strings.Search is
----------- -----------
function Count function Count
(Source : String; (Source : String;
Pattern : String; Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is is
N : Natural; N : Natural;
J : Natural; J : Natural;
...@@ -110,9 +110,9 @@ package body Ada.Strings.Search is ...@@ -110,9 +110,9 @@ package body Ada.Strings.Search is
end Count; end Count;
function Count function Count
(Source : String; (Source : String;
Pattern : String; Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural Mapping : Maps.Character_Mapping_Function) return Natural
is is
Mapped_Source : String (Source'Range); Mapped_Source : String (Source'Range);
N : Natural; N : Natural;
...@@ -280,7 +280,6 @@ package body Ada.Strings.Search is ...@@ -280,7 +280,6 @@ package body Ada.Strings.Search is
declare declare
pragma Unsuppress (Access_Check); pragma Unsuppress (Access_Check);
begin begin
for J in Source'Range loop for J in Source'Range loop
Mapped_Source (J) := Mapping.all (Source (J)); Mapped_Source (J) := Mapping.all (Source (J));
...@@ -348,6 +347,84 @@ package body Ada.Strings.Search is ...@@ -348,6 +347,84 @@ package body Ada.Strings.Search is
return 0; return 0;
end Index; end Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return Index
(Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return Index
(Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Set, Test, Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Set, Test, Backward);
end if;
end Index;
--------------------- ---------------------
-- Index_Non_Blank -- -- Index_Non_Blank --
--------------------- ---------------------
...@@ -375,7 +452,30 @@ package body Ada.Strings.Search is ...@@ -375,7 +452,30 @@ package body Ada.Strings.Search is
-- Fall through if no match -- Fall through if no match
return 0; return 0;
end Index_Non_Blank;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (From .. Source'Last), Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (Source'First .. From), Backward);
end if;
end Index_Non_Blank; end Index_Non_Blank;
end Ada.Strings.Search; end Ada.Strings.Search;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -61,8 +61,34 @@ pragma Preelaborate (Search); ...@@ -61,8 +61,34 @@ pragma Preelaborate (Search);
Test : Membership := Inside; Test : Membership := Inside;
Going : Direction := Forward) return Natural; Going : Direction := Forward) return Natural;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank function Index_Non_Blank
(Source : String; (Source : String;
From : Positive;
Going : Direction := Forward) return Natural; Going : Direction := Forward) return Natural;
function Count function Count
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -40,8 +40,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -40,8 +40,7 @@ package body Ada.Strings.Wide_Maps is
--------- ---------
function "-" function "-"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set
return Wide_Character_Set
is is
LS : constant Wide_Character_Ranges_Access := Left.Set; LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set; RS : constant Wide_Character_Ranges_Access := Right.Set;
...@@ -159,8 +158,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -159,8 +158,7 @@ package body Ada.Strings.Wide_Maps is
----------- -----------
function "and" function "and"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set
return Wide_Character_Set
is is
LS : constant Wide_Character_Ranges_Access := Left.Set; LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set; RS : constant Wide_Character_Ranges_Access := Right.Set;
...@@ -210,8 +208,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -210,8 +208,7 @@ package body Ada.Strings.Wide_Maps is
----------- -----------
function "not" function "not"
(Right : in Wide_Character_Set) (Right : Wide_Character_Set) return Wide_Character_Set
return Wide_Character_Set
is is
RS : constant Wide_Character_Ranges_Access := Right.Set; RS : constant Wide_Character_Ranges_Access := Right.Set;
...@@ -253,8 +250,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -253,8 +250,7 @@ package body Ada.Strings.Wide_Maps is
---------- ----------
function "or" function "or"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set
return Wide_Character_Set
is is
LS : constant Wide_Character_Ranges_Access := Left.Set; LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set; RS : constant Wide_Character_Ranges_Access := Right.Set;
...@@ -341,8 +337,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -341,8 +337,7 @@ package body Ada.Strings.Wide_Maps is
----------- -----------
function "xor" function "xor"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set
return Wide_Character_Set
is is
begin begin
return (Left or Right) - (Left and Right); return (Left or Right) - (Left and Right);
...@@ -409,9 +404,8 @@ package body Ada.Strings.Wide_Maps is ...@@ -409,9 +404,8 @@ package body Ada.Strings.Wide_Maps is
----------- -----------
function Is_In function Is_In
(Element : in Wide_Character; (Element : Wide_Character;
Set : in Wide_Character_Set) Set : Wide_Character_Set) return Boolean
return Boolean
is is
L, R, M : Natural; L, R, M : Natural;
SS : constant Wide_Character_Ranges_Access := Set.Set; SS : constant Wide_Character_Ranges_Access := Set.Set;
...@@ -446,9 +440,8 @@ package body Ada.Strings.Wide_Maps is ...@@ -446,9 +440,8 @@ package body Ada.Strings.Wide_Maps is
--------------- ---------------
function Is_Subset function Is_Subset
(Elements : in Wide_Character_Set; (Elements : Wide_Character_Set;
Set : in Wide_Character_Set) Set : Wide_Character_Set) return Boolean
return Boolean
is is
ES : constant Wide_Character_Ranges_Access := Elements.Set; ES : constant Wide_Character_Ranges_Access := Elements.Set;
SS : constant Wide_Character_Ranges_Access := Set.Set; SS : constant Wide_Character_Ranges_Access := Set.Set;
...@@ -493,8 +486,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -493,8 +486,7 @@ package body Ada.Strings.Wide_Maps is
--------------- ---------------
function To_Domain function To_Domain
(Map : in Wide_Character_Mapping) (Map : Wide_Character_Mapping) return Wide_Character_Sequence
return Wide_Character_Sequence
is is
begin begin
return Map.Map.Domain; return Map.Map.Domain;
...@@ -505,8 +497,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -505,8 +497,7 @@ package body Ada.Strings.Wide_Maps is
---------------- ----------------
function To_Mapping function To_Mapping
(From, To : in Wide_Character_Sequence) (From, To : Wide_Character_Sequence) return Wide_Character_Mapping
return Wide_Character_Mapping
is is
Domain : Wide_Character_Sequence (1 .. From'Length); Domain : Wide_Character_Sequence (1 .. From'Length);
Rangev : Wide_Character_Sequence (1 .. To'Length); Rangev : Wide_Character_Sequence (1 .. To'Length);
...@@ -554,8 +545,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -554,8 +545,7 @@ package body Ada.Strings.Wide_Maps is
-------------- --------------
function To_Range function To_Range
(Map : in Wide_Character_Mapping) (Map : Wide_Character_Mapping) return Wide_Character_Sequence
return Wide_Character_Sequence
is is
begin begin
return Map.Map.Rangev; return Map.Map.Rangev;
...@@ -566,8 +556,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -566,8 +556,7 @@ package body Ada.Strings.Wide_Maps is
--------------- ---------------
function To_Ranges function To_Ranges
(Set : in Wide_Character_Set) (Set : in Wide_Character_Set) return Wide_Character_Ranges
return Wide_Character_Ranges
is is
begin begin
return Set.Set.all; return Set.Set.all;
...@@ -578,8 +567,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -578,8 +567,7 @@ package body Ada.Strings.Wide_Maps is
----------------- -----------------
function To_Sequence function To_Sequence
(Set : in Wide_Character_Set) (Set : Wide_Character_Set) return Wide_Character_Sequence
return Wide_Character_Sequence
is is
SS : constant Wide_Character_Ranges_Access := Set.Set; SS : constant Wide_Character_Ranges_Access := Set.Set;
...@@ -604,8 +592,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -604,8 +592,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of multiple range input -- Case of multiple range input
function To_Set function To_Set
(Ranges : in Wide_Character_Ranges) (Ranges : Wide_Character_Ranges) return Wide_Character_Set
return Wide_Character_Set
is is
Result : Wide_Character_Ranges (Ranges'Range); Result : Wide_Character_Ranges (Ranges'Range);
N : Natural := 0; N : Natural := 0;
...@@ -667,8 +654,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -667,8 +654,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of single range input -- Case of single range input
function To_Set function To_Set
(Span : in Wide_Character_Range) (Span : Wide_Character_Range) return Wide_Character_Set
return Wide_Character_Set
is is
begin begin
if Span.Low > Span.High then if Span.Low > Span.High then
...@@ -685,8 +671,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -685,8 +671,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of wide string input -- Case of wide string input
function To_Set function To_Set
(Sequence : in Wide_Character_Sequence) (Sequence : Wide_Character_Sequence) return Wide_Character_Set
return Wide_Character_Set
is is
R : Wide_Character_Ranges (1 .. Sequence'Length); R : Wide_Character_Ranges (1 .. Sequence'Length);
...@@ -701,8 +686,7 @@ package body Ada.Strings.Wide_Maps is ...@@ -701,8 +686,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of single wide character input -- Case of single wide character input
function To_Set function To_Set
(Singleton : in Wide_Character) (Singleton : Wide_Character) return Wide_Character_Set
return Wide_Character_Set
is is
begin begin
return return
...@@ -715,9 +699,8 @@ package body Ada.Strings.Wide_Maps is ...@@ -715,9 +699,8 @@ package body Ada.Strings.Wide_Maps is
----------- -----------
function Value function Value
(Map : in Wide_Character_Mapping; (Map : Wide_Character_Mapping;
Element : in Wide_Character) Element : Wide_Character) return Wide_Character
return Wide_Character
is is
L, R, M : Natural; L, R, M : Natural;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-1998 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
...@@ -63,16 +63,13 @@ package Ada.Strings.Wide_Maps is ...@@ -63,16 +63,13 @@ package Ada.Strings.Wide_Maps is
array (Positive range <>) of Wide_Character_Range; array (Positive range <>) of Wide_Character_Range;
function To_Set function To_Set
(Ranges : in Wide_Character_Ranges) (Ranges : Wide_Character_Ranges) return Wide_Character_Set;
return Wide_Character_Set;
function To_Set function To_Set
(Span : in Wide_Character_Range) (Span : Wide_Character_Range) return Wide_Character_Set;
return Wide_Character_Set;
function To_Ranges function To_Ranges
(Set : in Wide_Character_Set) (Set : in Wide_Character_Set) return Wide_Character_Ranges;
return Wide_Character_Ranges;
--------------------------------------- ---------------------------------------
-- Operations on Wide Character Sets -- -- Operations on Wide Character Sets --
...@@ -81,55 +78,44 @@ package Ada.Strings.Wide_Maps is ...@@ -81,55 +78,44 @@ package Ada.Strings.Wide_Maps is
function "=" (Left, Right : in Wide_Character_Set) return Boolean; function "=" (Left, Right : in Wide_Character_Set) return Boolean;
function "not" function "not"
(Right : in Wide_Character_Set) (Right : Wide_Character_Set) return Wide_Character_Set;
return Wide_Character_Set;
function "and" function "and"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set;
return Wide_Character_Set;
function "or" function "or"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set;
return Wide_Character_Set;
function "xor" function "xor"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set;
return Wide_Character_Set;
function "-" function "-"
(Left, Right : in Wide_Character_Set) (Left, Right : Wide_Character_Set) return Wide_Character_Set;
return Wide_Character_Set;
function Is_In function Is_In
(Element : in Wide_Character; (Element : Wide_Character;
Set : in Wide_Character_Set) Set : Wide_Character_Set) return Boolean;
return Boolean;
function Is_Subset function Is_Subset
(Elements : in Wide_Character_Set; (Elements : Wide_Character_Set;
Set : in Wide_Character_Set) Set : Wide_Character_Set) return Boolean;
return Boolean;
function "<=" function "<="
(Left : in Wide_Character_Set; (Left : Wide_Character_Set;
Right : in Wide_Character_Set) Right : Wide_Character_Set) return Boolean
return Boolean
renames Is_Subset; renames Is_Subset;
subtype Wide_Character_Sequence is Wide_String; subtype Wide_Character_Sequence is Wide_String;
-- Alternative representation for a set of character values -- Alternative representation for a set of character values
function To_Set function To_Set
(Sequence : in Wide_Character_Sequence) (Sequence : Wide_Character_Sequence) return Wide_Character_Set;
return Wide_Character_Set;
function To_Set function To_Set
(Singleton : in Wide_Character) (Singleton : Wide_Character) return Wide_Character_Set;
return Wide_Character_Set;
function To_Sequence function To_Sequence
(Set : in Wide_Character_Set) (Set : Wide_Character_Set) return Wide_Character_Sequence;
return Wide_Character_Sequence;
----------------------------------------- -----------------------------------------
-- Wide Character Mapping Declarations -- -- Wide Character Mapping Declarations --
...@@ -139,9 +125,8 @@ package Ada.Strings.Wide_Maps is ...@@ -139,9 +125,8 @@ package Ada.Strings.Wide_Maps is
-- Representation for a wide character to wide character mapping: -- Representation for a wide character to wide character mapping:
function Value function Value
(Map : in Wide_Character_Mapping; (Map : Wide_Character_Mapping;
Element : in Wide_Character) Element : Wide_Character) return Wide_Character;
return Wide_Character;
Identity : constant Wide_Character_Mapping; Identity : constant Wide_Character_Mapping;
...@@ -150,19 +135,16 @@ package Ada.Strings.Wide_Maps is ...@@ -150,19 +135,16 @@ package Ada.Strings.Wide_Maps is
--------------------------------- ---------------------------------
function To_Mapping function To_Mapping
(From, To : in Wide_Character_Sequence) (From, To : Wide_Character_Sequence) return Wide_Character_Mapping;
return Wide_Character_Mapping;
function To_Domain function To_Domain
(Map : in Wide_Character_Mapping) (Map : Wide_Character_Mapping) return Wide_Character_Sequence;
return Wide_Character_Sequence;
function To_Range function To_Range
(Map : in Wide_Character_Mapping) (Map : Wide_Character_Mapping) return Wide_Character_Sequence;
return Wide_Character_Sequence;
type Wide_Character_Mapping_Function is type Wide_Character_Mapping_Function is
access function (From : in Wide_Character) return Wide_Character; access function (From : Wide_Character) return Wide_Character;
private private
package AF renames Ada.Finalization; package AF renames Ada.Finalization;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -42,8 +42,7 @@ package body Ada.Strings.Wide_Search is ...@@ -42,8 +42,7 @@ package body Ada.Strings.Wide_Search is
function Belongs function Belongs
(Element : Wide_Character; (Element : Wide_Character;
Set : Wide_Maps.Wide_Character_Set; Set : Wide_Maps.Wide_Character_Set;
Test : Membership) Test : Membership) return Boolean;
return Boolean;
pragma Inline (Belongs); pragma Inline (Belongs);
-- Determines if the given element is in (Test = Inside) or not in -- Determines if the given element is in (Test = Inside) or not in
-- (Test = Outside) the given character set. -- (Test = Outside) the given character set.
...@@ -55,9 +54,8 @@ package body Ada.Strings.Wide_Search is ...@@ -55,9 +54,8 @@ package body Ada.Strings.Wide_Search is
function Belongs function Belongs
(Element : Wide_Character; (Element : Wide_Character;
Set : Wide_Maps.Wide_Character_Set; Set : Wide_Maps.Wide_Character_Set;
Test : Membership) Test : Membership) return Boolean
return Boolean is is
begin begin
if Test = Inside then if Test = Inside then
return Is_In (Element, Set); return Is_In (Element, Set);
...@@ -71,10 +69,10 @@ package body Ada.Strings.Wide_Search is ...@@ -71,10 +69,10 @@ package body Ada.Strings.Wide_Search is
----------- -----------
function Count function Count
(Source : in Wide_String; (Source : Wide_String;
Pattern : in Wide_String; Pattern : Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural return Natural
is is
N : Natural; N : Natural;
J : Natural; J : Natural;
...@@ -117,10 +115,9 @@ package body Ada.Strings.Wide_Search is ...@@ -117,10 +115,9 @@ package body Ada.Strings.Wide_Search is
end Count; end Count;
function Count function Count
(Source : in Wide_String; (Source : Wide_String;
Pattern : in Wide_String; Pattern : Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function) Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
return Natural
is is
Mapped_Source : Wide_String (Source'Range); Mapped_Source : Wide_String (Source'Range);
...@@ -132,9 +129,9 @@ package body Ada.Strings.Wide_Search is ...@@ -132,9 +129,9 @@ package body Ada.Strings.Wide_Search is
return Count (Mapped_Source, Pattern); return Count (Mapped_Source, Pattern);
end Count; end Count;
function Count (Source : in Wide_String; function Count
Set : in Wide_Maps.Wide_Character_Set) (Source : in Wide_String;
return Natural Set : Wide_Maps.Wide_Character_Set) return Natural
is is
N : Natural := 0; N : Natural := 0;
...@@ -153,9 +150,9 @@ package body Ada.Strings.Wide_Search is ...@@ -153,9 +150,9 @@ package body Ada.Strings.Wide_Search is
---------------- ----------------
procedure Find_Token procedure Find_Token
(Source : in Wide_String; (Source : Wide_String;
Set : in Wide_Maps.Wide_Character_Set; Set : Wide_Maps.Wide_Character_Set;
Test : in Membership; Test : Membership;
First : out Positive; First : out Positive;
Last : out Natural) Last : out Natural)
is is
...@@ -190,11 +187,11 @@ package body Ada.Strings.Wide_Search is ...@@ -190,11 +187,11 @@ package body Ada.Strings.Wide_Search is
----------- -----------
function Index function Index
(Source : in Wide_String; (Source : Wide_String;
Pattern : in Wide_String; Pattern : Wide_String;
Going : in Direction := Forward; Going : Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural return Natural
is is
begin begin
if Pattern = "" then if Pattern = "" then
...@@ -239,16 +236,11 @@ package body Ada.Strings.Wide_Search is ...@@ -239,16 +236,11 @@ package body Ada.Strings.Wide_Search is
return 0; return 0;
end Index; end Index;
-----------
-- Index --
-----------
function Index function Index
(Source : in Wide_String; (Source : Wide_String;
Pattern : in Wide_String; Pattern : Wide_String;
Going : in Direction := Forward; Going : Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function) Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
return Natural
is is
Mapped_Source : Wide_String (Source'Range); Mapped_Source : Wide_String (Source'Range);
...@@ -261,11 +253,10 @@ package body Ada.Strings.Wide_Search is ...@@ -261,11 +253,10 @@ package body Ada.Strings.Wide_Search is
end Index; end Index;
function Index function Index
(Source : in Wide_String; (Source : Wide_String;
Set : in Wide_Maps.Wide_Character_Set; Set : Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside; Test : Membership := Inside;
Going : in Direction := Forward) Going : Direction := Forward) return Natural
return Natural
is is
begin begin
if Going = Forward then if Going = Forward then
...@@ -288,14 +279,92 @@ package body Ada.Strings.Wide_Search is ...@@ -288,14 +279,92 @@ package body Ada.Strings.Wide_Search is
return 0; return 0;
end Index; end Index;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return Index
(Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return Index
(Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Set, Test, Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Set, Test, Backward);
end if;
end Index;
--------------------- ---------------------
-- Index_Non_Blank -- -- Index_Non_Blank --
--------------------- ---------------------
function Index_Non_Blank function Index_Non_Blank
(Source : in Wide_String; (Source : Wide_String;
Going : in Direction := Forward) Going : Direction := Forward) return Natural
return Natural
is is
begin begin
if Going = Forward then if Going = Forward then
...@@ -316,7 +385,30 @@ package body Ada.Strings.Wide_Search is ...@@ -316,7 +385,30 @@ package body Ada.Strings.Wide_Search is
-- Fall through if no match -- Fall through if no match
return 0; return 0;
end Index_Non_Blank;
function Index_Non_Blank
(Source : Wide_String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (From .. Source'Last), Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (Source'First .. From), Backward);
end if;
end Index_Non_Blank; end Index_Non_Blank;
end Ada.Strings.Wide_Search; end Ada.Strings.Wide_Search;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-1997 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -43,49 +43,76 @@ with Ada.Strings.Wide_Maps; ...@@ -43,49 +43,76 @@ with Ada.Strings.Wide_Maps;
private package Ada.Strings.Wide_Search is private package Ada.Strings.Wide_Search is
pragma Preelaborate (Wide_Search); pragma Preelaborate (Wide_Search);
function Index (Source : in Wide_String; function Index
Pattern : in Wide_String; (Source : Wide_String;
Going : in Direction := Forward; Pattern : Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping := Going : Direction := Forward;
Wide_Maps.Identity) Mapping : Wide_Maps.Wide_Character_Mapping :=
return Natural; Wide_Maps.Identity) return Natural;
function Index (Source : in Wide_String; function Index
Pattern : in Wide_String; (Source : Wide_String;
Going : in Direction := Forward; Pattern : Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function) Going : Direction := Forward;
return Natural; Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Index (Source : in Wide_String; function Index
Set : in Wide_Maps.Wide_Character_Set; (Source : Wide_String;
Test : in Membership := Inside; Set : Wide_Maps.Wide_Character_Set;
Going : in Direction := Forward) Test : Membership := Inside;
return Natural; Going : Direction := Forward) return Natural;
function Index_Non_Blank (Source : in Wide_String; function Index
Going : in Direction := Forward) (Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural; return Natural;
function Count (Source : in Wide_String; function Index
Pattern : in Wide_String; (Source : Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping := Pattern : Wide_String;
Wide_Maps.Identity) From : Positive;
return Natural; Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Count (Source : in Wide_String; function Index
Pattern : in Wide_String; (Source : Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function) Set : Wide_Maps.Wide_Character_Set;
return Natural; From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : Wide_String;
Going : Direction := Forward) return Natural;
function Count (Source : in Wide_String; function Index_Non_Blank
Set : in Wide_Maps.Wide_Character_Set) (Source : Wide_String;
From : Positive;
Going : Direction := Forward) return Natural;
function Count
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural; return Natural;
function Count
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Count
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set) return Natural;
procedure Find_Token (Source : in Wide_String; procedure Find_Token
Set : in Wide_Maps.Wide_Character_Set; (Source : Wide_String;
Test : in Membership; Set : Wide_Maps.Wide_Character_Set;
First : out Positive; Test : Membership;
Last : out Natural); First : out Positive;
Last : out Natural);
end Ada.Strings.Wide_Search; end Ada.Strings.Wide_Search;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
...@@ -86,34 +86,34 @@ pragma Elaborate_Body (Text_IO); ...@@ -86,34 +86,34 @@ pragma Elaborate_Body (Text_IO);
procedure Create procedure Create
(File : in out File_Type; (File : in out File_Type;
Mode : in File_Mode := Out_File; Mode : File_Mode := Out_File;
Name : in String := ""; Name : String := "";
Form : in String := ""); Form : String := "");
procedure Open procedure Open
(File : in out File_Type; (File : in out File_Type;
Mode : in File_Mode; Mode : File_Mode;
Name : in String; Name : String;
Form : in String := ""); Form : String := "");
procedure Close (File : in out File_Type); procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type); procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type; Mode : File_Mode);
procedure Reset (File : in out File_Type); procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode; function Mode (File : File_Type) return File_Mode;
function Name (File : in File_Type) return String; function Name (File : File_Type) return String;
function Form (File : in File_Type) return String; function Form (File : File_Type) return String;
function Is_Open (File : in File_Type) return Boolean; function Is_Open (File : File_Type) return Boolean;
------------------------------------------------------ ------------------------------------------------------
-- Control of default input, output and error files -- -- Control of default input, output and error files --
------------------------------------------------------ ------------------------------------------------------
procedure Set_Input (File : in File_Type); procedure Set_Input (File : File_Type);
procedure Set_Output (File : in File_Type); procedure Set_Output (File : File_Type);
procedure Set_Error (File : in File_Type); procedure Set_Error (File : File_Type);
function Standard_Input return File_Type; function Standard_Input return File_Type;
function Standard_Output return File_Type; function Standard_Output return File_Type;
...@@ -140,76 +140,76 @@ pragma Elaborate_Body (Text_IO); ...@@ -140,76 +140,76 @@ pragma Elaborate_Body (Text_IO);
-- Note: The parameter file is IN OUT in the RM, but this is clearly -- Note: The parameter file is IN OUT in the RM, but this is clearly
-- an oversight, and was intended to be IN, see AI95-00057. -- an oversight, and was intended to be IN, see AI95-00057.
procedure Flush (File : in File_Type); procedure Flush (File : File_Type);
procedure Flush; procedure Flush;
-------------------------------------------- --------------------------------------------
-- Specification of line and page lengths -- -- Specification of line and page lengths --
-------------------------------------------- --------------------------------------------
procedure Set_Line_Length (File : in File_Type; To : in Count); procedure Set_Line_Length (File : File_Type; To : Count);
procedure Set_Line_Length (To : in Count); procedure Set_Line_Length (To : Count);
procedure Set_Page_Length (File : in File_Type; To : in Count); procedure Set_Page_Length (File : File_Type; To : Count);
procedure Set_Page_Length (To : in Count); procedure Set_Page_Length (To : Count);
function Line_Length (File : in File_Type) return Count; function Line_Length (File : File_Type) return Count;
function Line_Length return Count; function Line_Length return Count;
function Page_Length (File : in File_Type) return Count; function Page_Length (File : File_Type) return Count;
function Page_Length return Count; function Page_Length return Count;
------------------------------------ ------------------------------------
-- Column, Line, and Page Control -- -- Column, Line, and Page Control --
------------------------------------ ------------------------------------
procedure New_Line (File : in File_Type; Spacing : in Positive_Count := 1); procedure New_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure New_Line (Spacing : in Positive_Count := 1); procedure New_Line (Spacing : Positive_Count := 1);
procedure Skip_Line (File : in File_Type; Spacing : in Positive_Count := 1); procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure Skip_Line (Spacing : in Positive_Count := 1); procedure Skip_Line (Spacing : Positive_Count := 1);
function End_Of_Line (File : in File_Type) return Boolean; function End_Of_Line (File : File_Type) return Boolean;
function End_Of_Line return Boolean; function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type); procedure New_Page (File : File_Type);
procedure New_Page; procedure New_Page;
procedure Skip_Page (File : in File_Type); procedure Skip_Page (File : File_Type);
procedure Skip_Page; procedure Skip_Page;
function End_Of_Page (File : in File_Type) return Boolean; function End_Of_Page (File : File_Type) return Boolean;
function End_Of_Page return Boolean; function End_Of_Page return Boolean;
function End_Of_File (File : in File_Type) return Boolean; function End_Of_File (File : File_Type) return Boolean;
function End_Of_File return Boolean; function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count); procedure Set_Col (File : File_Type; To : Positive_Count);
procedure Set_Col (To : in Positive_Count); procedure Set_Col (To : Positive_Count);
procedure Set_Line (File : in File_Type; To : in Positive_Count); procedure Set_Line (File : File_Type; To : Positive_Count);
procedure Set_Line (To : in Positive_Count); procedure Set_Line (To : Positive_Count);
function Col (File : in File_Type) return Positive_Count; function Col (File : File_Type) return Positive_Count;
function Col return Positive_Count; function Col return Positive_Count;
function Line (File : in File_Type) return Positive_Count; function Line (File : File_Type) return Positive_Count;
function Line return Positive_Count; function Line return Positive_Count;
function Page (File : in File_Type) return Positive_Count; function Page (File : File_Type) return Positive_Count;
function Page return Positive_Count; function Page return Positive_Count;
---------------------------- ----------------------------
-- Character Input-Output -- -- Character Input-Output --
---------------------------- ----------------------------
procedure Get (File : in File_Type; Item : out Character); procedure Get (File : File_Type; Item : out Character);
procedure Get (Item : out Character); procedure Get (Item : out Character);
procedure Put (File : in File_Type; Item : in Character); procedure Put (File : File_Type; Item : Character);
procedure Put (Item : in Character); procedure Put (Item : Character);
procedure Look_Ahead procedure Look_Ahead
(File : in File_Type; (File : File_Type;
Item : out Character; Item : out Character;
End_Of_Line : out Boolean); End_Of_Line : out Boolean);
...@@ -218,14 +218,14 @@ pragma Elaborate_Body (Text_IO); ...@@ -218,14 +218,14 @@ pragma Elaborate_Body (Text_IO);
End_Of_Line : out Boolean); End_Of_Line : out Boolean);
procedure Get_Immediate procedure Get_Immediate
(File : in File_Type; (File : File_Type;
Item : out Character); Item : out Character);
procedure Get_Immediate procedure Get_Immediate
(Item : out Character); (Item : out Character);
procedure Get_Immediate procedure Get_Immediate
(File : in File_Type; (File : File_Type;
Item : out Character; Item : out Character;
Available : out Boolean); Available : out Boolean);
...@@ -237,13 +237,13 @@ pragma Elaborate_Body (Text_IO); ...@@ -237,13 +237,13 @@ pragma Elaborate_Body (Text_IO);
-- String Input-Output -- -- String Input-Output --
------------------------- -------------------------
procedure Get (File : in File_Type; Item : out String); procedure Get (File : File_Type; Item : out String);
procedure Get (Item : out String); procedure Get (Item : out String);
procedure Put (File : in File_Type; Item : in String); procedure Put (File : File_Type; Item : String);
procedure Put (Item : in String); procedure Put (Item : String);
procedure Get_Line procedure Get_Line
(File : in File_Type; (File : File_Type;
Item : out String; Item : out String;
Last : out Natural); Last : out Natural);
...@@ -251,12 +251,18 @@ pragma Elaborate_Body (Text_IO); ...@@ -251,12 +251,18 @@ pragma Elaborate_Body (Text_IO);
(Item : out String; (Item : out String;
Last : out Natural); Last : out Natural);
function Get_Line (File : File_Type) return String;
pragma Ada_05 (Get_Line);
function Get_Line return String;
pragma Ada_05 (Get_Line);
procedure Put_Line procedure Put_Line
(File : in File_Type; (File : File_Type;
Item : in String); Item : String);
procedure Put_Line procedure Put_Line
(Item : in String); (Item : String);
--------------------------------------- ---------------------------------------
-- Generic packages for Input-Output -- -- Generic packages for Input-Output --
...@@ -375,7 +381,7 @@ private ...@@ -375,7 +381,7 @@ private
procedure Write procedure Write
(File : in out Text_AFCB; (File : in out Text_AFCB;
Item : in Ada.Streams.Stream_Element_Array); Item : Ada.Streams.Stream_Element_Array);
-- Write operation used when Text_IO file is treated directly as Stream -- Write operation used when Text_IO file is treated directly as Stream
------------------------ ------------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
...@@ -89,34 +89,34 @@ package Ada.Wide_Text_IO is ...@@ -89,34 +89,34 @@ package Ada.Wide_Text_IO is
procedure Create procedure Create
(File : in out File_Type; (File : in out File_Type;
Mode : in File_Mode := Out_File; Mode : File_Mode := Out_File;
Name : in String := ""; Name : String := "";
Form : in String := ""); Form : String := "");
procedure Open procedure Open
(File : in out File_Type; (File : in out File_Type;
Mode : in File_Mode; Mode : File_Mode;
Name : in String; Name : String;
Form : in String := ""); Form : String := "");
procedure Close (File : in out File_Type); procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type); procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type; Mode : File_Mode);
procedure Reset (File : in out File_Type); procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode; function Mode (File : File_Type) return File_Mode;
function Name (File : in File_Type) return String; function Name (File : File_Type) return String;
function Form (File : in File_Type) return String; function Form (File : File_Type) return String;
function Is_Open (File : in File_Type) return Boolean; function Is_Open (File : File_Type) return Boolean;
------------------------------------------------------ ------------------------------------------------------
-- Control of default input, output and error files -- -- Control of default input, output and error files --
------------------------------------------------------ ------------------------------------------------------
procedure Set_Input (File : in File_Type); procedure Set_Input (File : File_Type);
procedure Set_Output (File : in File_Type); procedure Set_Output (File : File_Type);
procedure Set_Error (File : in File_Type); procedure Set_Error (File : File_Type);
function Standard_Input return File_Type; function Standard_Input return File_Type;
function Standard_Output return File_Type; function Standard_Output return File_Type;
...@@ -143,76 +143,76 @@ package Ada.Wide_Text_IO is ...@@ -143,76 +143,76 @@ package Ada.Wide_Text_IO is
-- Note: The paramter file is in out in the RM, but as pointed out -- Note: The paramter file is in out in the RM, but as pointed out
-- in <<95-5166.a Tucker Taft 95-6-23>> this is clearly an oversight. -- in <<95-5166.a Tucker Taft 95-6-23>> this is clearly an oversight.
procedure Flush (File : in File_Type); procedure Flush (File : File_Type);
procedure Flush; procedure Flush;
-------------------------------------------- --------------------------------------------
-- Specification of line and page lengths -- -- Specification of line and page lengths --
-------------------------------------------- --------------------------------------------
procedure Set_Line_Length (File : in File_Type; To : in Count); procedure Set_Line_Length (File : File_Type; To : Count);
procedure Set_Line_Length (To : in Count); procedure Set_Line_Length (To : Count);
procedure Set_Page_Length (File : in File_Type; To : in Count); procedure Set_Page_Length (File : File_Type; To : Count);
procedure Set_Page_Length (To : in Count); procedure Set_Page_Length (To : Count);
function Line_Length (File : in File_Type) return Count; function Line_Length (File : File_Type) return Count;
function Line_Length return Count; function Line_Length return Count;
function Page_Length (File : in File_Type) return Count; function Page_Length (File : File_Type) return Count;
function Page_Length return Count; function Page_Length return Count;
------------------------------------ ------------------------------------
-- Column, Line, and Page Control -- -- Column, Line, and Page Control --
------------------------------------ ------------------------------------
procedure New_Line (File : in File_Type; Spacing : in Positive_Count := 1); procedure New_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure New_Line (Spacing : in Positive_Count := 1); procedure New_Line (Spacing : Positive_Count := 1);
procedure Skip_Line (File : in File_Type; Spacing : in Positive_Count := 1); procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure Skip_Line (Spacing : in Positive_Count := 1); procedure Skip_Line (Spacing : Positive_Count := 1);
function End_Of_Line (File : in File_Type) return Boolean; function End_Of_Line (File : File_Type) return Boolean;
function End_Of_Line return Boolean; function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type); procedure New_Page (File : File_Type);
procedure New_Page; procedure New_Page;
procedure Skip_Page (File : in File_Type); procedure Skip_Page (File : File_Type);
procedure Skip_Page; procedure Skip_Page;
function End_Of_Page (File : in File_Type) return Boolean; function End_Of_Page (File : File_Type) return Boolean;
function End_Of_Page return Boolean; function End_Of_Page return Boolean;
function End_Of_File (File : in File_Type) return Boolean; function End_Of_File (File : File_Type) return Boolean;
function End_Of_File return Boolean; function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count); procedure Set_Col (File : File_Type; To : Positive_Count);
procedure Set_Col (To : in Positive_Count); procedure Set_Col (To : Positive_Count);
procedure Set_Line (File : in File_Type; To : in Positive_Count); procedure Set_Line (File : File_Type; To : Positive_Count);
procedure Set_Line (To : in Positive_Count); procedure Set_Line (To : Positive_Count);
function Col (File : in File_Type) return Positive_Count; function Col (File : File_Type) return Positive_Count;
function Col return Positive_Count; function Col return Positive_Count;
function Line (File : in File_Type) return Positive_Count; function Line (File : File_Type) return Positive_Count;
function Line return Positive_Count; function Line return Positive_Count;
function Page (File : in File_Type) return Positive_Count; function Page (File : File_Type) return Positive_Count;
function Page return Positive_Count; function Page return Positive_Count;
---------------------------- ----------------------------
-- Character Input-Output -- -- Character Input-Output --
---------------------------- ----------------------------
procedure Get (File : in File_Type; Item : out Wide_Character); procedure Get (File : File_Type; Item : out Wide_Character);
procedure Get (Item : out Wide_Character); procedure Get (Item : out Wide_Character);
procedure Put (File : in File_Type; Item : in Wide_Character); procedure Put (File : File_Type; Item : Wide_Character);
procedure Put (Item : in Wide_Character); procedure Put (Item : Wide_Character);
procedure Look_Ahead procedure Look_Ahead
(File : in File_Type; (File : File_Type;
Item : out Wide_Character; Item : out Wide_Character;
End_Of_Line : out Boolean); End_Of_Line : out Boolean);
...@@ -221,14 +221,14 @@ package Ada.Wide_Text_IO is ...@@ -221,14 +221,14 @@ package Ada.Wide_Text_IO is
End_Of_Line : out Boolean); End_Of_Line : out Boolean);
procedure Get_Immediate procedure Get_Immediate
(File : in File_Type; (File : File_Type;
Item : out Wide_Character); Item : out Wide_Character);
procedure Get_Immediate procedure Get_Immediate
(Item : out Wide_Character); (Item : out Wide_Character);
procedure Get_Immediate procedure Get_Immediate
(File : in File_Type; (File : File_Type;
Item : out Wide_Character; Item : out Wide_Character;
Available : out Boolean); Available : out Boolean);
...@@ -240,13 +240,13 @@ package Ada.Wide_Text_IO is ...@@ -240,13 +240,13 @@ package Ada.Wide_Text_IO is
-- String Input-Output -- -- String Input-Output --
------------------------- -------------------------
procedure Get (File : in File_Type; Item : out Wide_String); procedure Get (File : File_Type; Item : out Wide_String);
procedure Get (Item : out Wide_String); procedure Get (Item : out Wide_String);
procedure Put (File : in File_Type; Item : in Wide_String); procedure Put (File : File_Type; Item : Wide_String);
procedure Put (Item : in Wide_String); procedure Put (Item : Wide_String);
procedure Get_Line procedure Get_Line
(File : in File_Type; (File : File_Type;
Item : out Wide_String; Item : out Wide_String;
Last : out Natural); Last : out Natural);
...@@ -254,12 +254,18 @@ package Ada.Wide_Text_IO is ...@@ -254,12 +254,18 @@ package Ada.Wide_Text_IO is
(Item : out Wide_String; (Item : out Wide_String;
Last : out Natural); Last : out Natural);
function Get_Line (File : File_Type) return Wide_String;
pragma Ada_05 (Get_Line);
function Get_Line return Wide_String;
pragma Ada_05 (Get_Line);
procedure Put_Line procedure Put_Line
(File : in File_Type; (File : File_Type;
Item : in Wide_String); Item : Wide_String);
procedure Put_Line procedure Put_Line
(Item : in Wide_String); (Item : Wide_String);
--------------------------------------- ---------------------------------------
-- Generic packages for Input-Output -- -- Generic packages for Input-Output --
...@@ -398,7 +404,7 @@ private ...@@ -398,7 +404,7 @@ private
procedure Write procedure Write
(File : in out Wide_Text_AFCB; (File : in out Wide_Text_AFCB;
Item : in Ada.Streams.Stream_Element_Array); Item : Ada.Streams.Stream_Element_Array);
-- Write operation used when Wide_Text_IO file is treated as a Stream -- Write operation used when Wide_Text_IO file is treated as a Stream
------------------------ ------------------------
...@@ -440,7 +446,7 @@ private ...@@ -440,7 +446,7 @@ private
-- occurs. The result is EOF if the end of file was read. -- occurs. The result is EOF if the end of file was read.
procedure Get_Character procedure Get_Character
(File : in File_Type; (File : File_Type;
Item : out Character); Item : out Character);
-- This is essentially a copy of the normal Get routine from Text_IO. It -- This is essentially a copy of the normal Get routine from Text_IO. It
-- obtains a single character from the input file File, and places it in -- obtains a single character from the input file File, and places it in
...@@ -449,8 +455,7 @@ private ...@@ -449,8 +455,7 @@ private
function Get_Wide_Char function Get_Wide_Char
(C : Character; (C : Character;
File : File_Type) File : File_Type) return Wide_Character;
return Wide_Character;
-- This function is shared by Get and Get_Immediate to extract a wide -- This function is shared by Get and Get_Immediate to extract a wide
-- character value from the given File. The first byte has already been -- character value from the given File. The first byte has already been
-- read and is passed in C. The wide character value is returned as the -- read and is passed in C. The wide character value is returned as the
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -45,7 +45,7 @@ package body Ada.Wide_Text_IO.Complex_Aux is ...@@ -45,7 +45,7 @@ package body Ada.Wide_Text_IO.Complex_Aux is
--------- ---------
procedure Get procedure Get
(File : in File_Type; (File : File_Type;
ItemR : out Long_Long_Float; ItemR : out Long_Long_Float;
ItemI : out Long_Long_Float; ItemI : out Long_Long_Float;
Width : Field) Width : Field)
...@@ -96,7 +96,7 @@ package body Ada.Wide_Text_IO.Complex_Aux is ...@@ -96,7 +96,7 @@ package body Ada.Wide_Text_IO.Complex_Aux is
---------- ----------
procedure Gets procedure Gets
(From : in String; (From : String;
ItemR : out Long_Long_Float; ItemR : out Long_Long_Float;
ItemI : out Long_Long_Float; ItemI : out Long_Long_Float;
Last : out Positive) Last : out Positive)
...@@ -163,8 +163,8 @@ package body Ada.Wide_Text_IO.Complex_Aux is ...@@ -163,8 +163,8 @@ package body Ada.Wide_Text_IO.Complex_Aux is
(To : out String; (To : out String;
ItemR : Long_Long_Float; ItemR : Long_Long_Float;
ItemI : Long_Long_Float; ItemI : Long_Long_Float;
Aft : in Field; Aft : Field;
Exp : in Field) Exp : Field)
is is
I_String : String (1 .. 3 * Field'Last); I_String : String (1 .. 3 * Field'Last);
R_String : String (1 .. 3 * Field'Last); R_String : String (1 .. 3 * Field'Last);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
package Ada.Wide_Text_IO.Complex_Aux is package Ada.Wide_Text_IO.Complex_Aux is
procedure Get procedure Get
(File : in File_Type; (File : File_Type;
ItemR : out Long_Long_Float; ItemR : out Long_Long_Float;
ItemI : out Long_Long_Float; ItemI : out Long_Long_Float;
Width : Field); Width : Field);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ada.Wide_Text_IO.Complex_Aux; with Ada.Wide_Text_IO.Complex_Aux;
with System.WCh_Con; use System.WCh_Con; with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.WCh_WtS; with System.WCh_WtS; use System.WCh_WtS;
...@@ -44,9 +45,6 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -44,9 +45,6 @@ package body Ada.Wide_Text_IO.Complex_IO is
subtype LLF is Long_Long_Float; subtype LLF is Long_Long_Float;
-- Type used for calls to routines in Aux -- Type used for calls to routines in Aux
-- subtype TFT is Ada.Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
function TFT is new function TFT is new
Ada.Unchecked_Conversion (File_Type, Ada.Wide_Text_IO.File_Type); Ada.Unchecked_Conversion (File_Type, Ada.Wide_Text_IO.File_Type);
-- This unchecked conversion is to get around a visibility bug in -- This unchecked conversion is to get around a visibility bug in
...@@ -58,12 +56,12 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -58,12 +56,12 @@ package body Ada.Wide_Text_IO.Complex_IO is
--------- ---------
procedure Get procedure Get
(File : in File_Type; (File : File_Type;
Item : out Complex; Item : out Complex;
Width : in Field := 0) Width : Field := 0)
is is
Real_Item : Real'Base; Real_Item : Real'Base;
Imag_Item : Real'Base; Imag_Item : Real'Base;
begin begin
Aux.Get (TFT (File), LLF (Real_Item), LLF (Imag_Item), Width); Aux.Get (TFT (File), LLF (Real_Item), LLF (Imag_Item), Width);
...@@ -79,7 +77,7 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -79,7 +77,7 @@ package body Ada.Wide_Text_IO.Complex_IO is
procedure Get procedure Get
(Item : out Complex; (Item : out Complex;
Width : in Field := 0) Width : Field := 0)
is is
begin begin
Get (Current_Input, Item, Width); Get (Current_Input, Item, Width);
...@@ -90,7 +88,7 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -90,7 +88,7 @@ package body Ada.Wide_Text_IO.Complex_IO is
--------- ---------
procedure Get procedure Get
(From : in Wide_String; (From : Wide_String;
Item : out Complex; Item : out Complex;
Last : out Positive) Last : out Positive)
is is
...@@ -116,11 +114,11 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -116,11 +114,11 @@ package body Ada.Wide_Text_IO.Complex_IO is
--------- ---------
procedure Put procedure Put
(File : in File_Type; (File : File_Type;
Item : in Complex; Item : Complex;
Fore : in Field := Default_Fore; Fore : Field := Default_Fore;
Aft : in Field := Default_Aft; Aft : Field := Default_Aft;
Exp : in Field := Default_Exp) Exp : Field := Default_Exp)
is is
begin begin
Aux.Put (TFT (File), LLF (Re (Item)), LLF (Im (Item)), Fore, Aft, Exp); Aux.Put (TFT (File), LLF (Re (Item)), LLF (Im (Item)), Fore, Aft, Exp);
...@@ -131,10 +129,10 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -131,10 +129,10 @@ package body Ada.Wide_Text_IO.Complex_IO is
--------- ---------
procedure Put procedure Put
(Item : in Complex; (Item : Complex;
Fore : in Field := Default_Fore; Fore : Field := Default_Fore;
Aft : in Field := Default_Aft; Aft : Field := Default_Aft;
Exp : in Field := Default_Exp) Exp : Field := Default_Exp)
is is
begin begin
Put (Current_Output, Item, Fore, Aft, Exp); Put (Current_Output, Item, Fore, Aft, Exp);
...@@ -146,9 +144,9 @@ package body Ada.Wide_Text_IO.Complex_IO is ...@@ -146,9 +144,9 @@ package body Ada.Wide_Text_IO.Complex_IO is
procedure Put procedure Put
(To : out Wide_String; (To : out Wide_String;
Item : in Complex; Item : Complex;
Aft : in Field := Default_Aft; Aft : Field := Default_Aft;
Exp : in Field := Default_Exp) Exp : Field := Default_Exp)
is is
S : String (To'First .. To'Last); S : String (To'First .. To'Last);
......
...@@ -27,36 +27,36 @@ package Ada.Wide_Text_IO.Complex_IO is ...@@ -27,36 +27,36 @@ package Ada.Wide_Text_IO.Complex_IO is
Default_Exp : Field := 3; Default_Exp : Field := 3;
procedure Get procedure Get
(File : in File_Type; (File : File_Type;
Item : out Complex; Item : out Complex;
Width : in Field := 0); Width : Field := 0);
procedure Get procedure Get
(Item : out Complex; (Item : out Complex;
Width : in Field := 0); Width : Field := 0);
procedure Put procedure Put
(File : in File_Type; (File : File_Type;
Item : in Complex; Item : Complex;
Fore : in Field := Default_Fore; Fore : Field := Default_Fore;
Aft : in Field := Default_Aft; Aft : Field := Default_Aft;
Exp : in Field := Default_Exp); Exp : Field := Default_Exp);
procedure Put procedure Put
(Item : in Complex; (Item : Complex;
Fore : in Field := Default_Fore; Fore : Field := Default_Fore;
Aft : in Field := Default_Aft; Aft : Field := Default_Aft;
Exp : in Field := Default_Exp); Exp : Field := Default_Exp);
procedure Get procedure Get
(From : in Wide_String; (From : Wide_String;
Item : out Complex; Item : out Complex;
Last : out Positive); Last : out Positive);
procedure Put procedure Put
(To : out Wide_String; (To : out Wide_String;
Item : in Complex; Item : Complex;
Aft : in Field := Default_Aft; Aft : Field := Default_Aft;
Exp : in Field := Default_Exp); Exp : Field := Default_Exp);
end Ada.Wide_Text_IO.Complex_IO; end Ada.Wide_Text_IO.Complex_IO;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-1997 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived from the Ada Reference Manual for use with -- -- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow -- -- GNAT. The copyright notice above, and the license provisions that follow --
...@@ -40,14 +40,12 @@ package Ada.Wide_Text_IO.Editing is ...@@ -40,14 +40,12 @@ package Ada.Wide_Text_IO.Editing is
type Picture is private; type Picture is private;
function Valid function Valid
(Pic_String : in String; (Pic_String : String;
Blank_When_Zero : in Boolean := False) Blank_When_Zero : Boolean := False) return Boolean;
return Boolean;
function To_Picture function To_Picture
(Pic_String : in String; (Pic_String : String;
Blank_When_Zero : in Boolean := False) Blank_When_Zero : Boolean := False) return Picture;
return Picture;
function Pic_String (Pic : in Picture) return String; function Pic_String (Pic : in Picture) return String;
function Blank_When_Zero (Pic : in Picture) return Boolean; function Blank_When_Zero (Pic : in Picture) return Boolean;
...@@ -63,62 +61,59 @@ package Ada.Wide_Text_IO.Editing is ...@@ -63,62 +61,59 @@ package Ada.Wide_Text_IO.Editing is
generic generic
type Num is delta <> digits <>; type Num is delta <> digits <>;
Default_Currency : in Wide_String := Default_Currency : Wide_String :=
Wide_Text_IO.Editing.Default_Currency; Wide_Text_IO.Editing.Default_Currency;
Default_Fill : in Wide_Character := Default_Fill : Wide_Character :=
Wide_Text_IO.Editing.Default_Fill; Wide_Text_IO.Editing.Default_Fill;
Default_Separator : in Wide_Character := Default_Separator : Wide_Character :=
Wide_Text_IO.Editing.Default_Separator; Wide_Text_IO.Editing.Default_Separator;
Default_Radix_Mark : in Wide_Character := Default_Radix_Mark : Wide_Character :=
Wide_Text_IO.Editing.Default_Radix_Mark; Wide_Text_IO.Editing.Default_Radix_Mark;
package Decimal_Output is package Decimal_Output is
function Length function Length
(Pic : in Picture; (Pic : Picture;
Currency : in Wide_String := Default_Currency) Currency : Wide_String := Default_Currency) return Natural;
return Natural;
function Valid function Valid
(Item : Num; (Item : Num;
Pic : in Picture; Pic : Picture;
Currency : in Wide_String := Default_Currency) Currency : Wide_String := Default_Currency) return Boolean;
return Boolean;
function Image function Image
(Item : Num; (Item : Num;
Pic : in Picture; Pic : Picture;
Currency : in Wide_String := Default_Currency; Currency : Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill; Fill : Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator; Separator : Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark) Radix_Mark : Wide_Character := Default_Radix_Mark) return Wide_String;
return Wide_String;
procedure Put procedure Put
(File : in File_Type; (File : File_Type;
Item : Num; Item : Num;
Pic : in Picture; Pic : Picture;
Currency : in Wide_String := Default_Currency; Currency : Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill; Fill : Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator; Separator : Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark); Radix_Mark : Wide_Character := Default_Radix_Mark);
procedure Put procedure Put
(Item : Num; (Item : Num;
Pic : in Picture; Pic : Picture;
Currency : in Wide_String := Default_Currency; Currency : Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill; Fill : Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator; Separator : Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark); Radix_Mark : Wide_Character := Default_Radix_Mark);
procedure Put procedure Put
(To : out Wide_String; (To : out Wide_String;
Item : Num; Item : Num;
Pic : in Picture; Pic : Picture;
Currency : in Wide_String := Default_Currency; Currency : Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill; Fill : Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator; Separator : Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark); Radix_Mark : Wide_Character := Default_Radix_Mark);
end Decimal_Output; end Decimal_Output;
...@@ -196,8 +191,7 @@ private ...@@ -196,8 +191,7 @@ private
Currency_Symbol : Wide_String; Currency_Symbol : Wide_String;
Fill_Character : Wide_Character; Fill_Character : Wide_Character;
Separator_Character : Wide_Character; Separator_Character : Wide_Character;
Radix_Point : Wide_Character) Radix_Point : Wide_Character) return Wide_String;
return Wide_String;
-- Formats number according to Pic -- Formats number according to Pic
function Expand (Picture : in String) return String; function Expand (Picture : in String) return String;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -39,7 +39,7 @@ package body Ada.Wide_Text_IO.Text_Streams is ...@@ -39,7 +39,7 @@ package body Ada.Wide_Text_IO.Text_Streams is
-- Stream -- -- Stream --
------------ ------------
function Stream (File : in File_Type) return Stream_Access is function Stream (File : File_Type) return Stream_Access is
begin begin
System.File_IO.Check_File_Open (FCB.AFCB_Ptr (File)); System.File_IO.Check_File_Open (FCB.AFCB_Ptr (File));
return Stream_Access (File); return Stream_Access (File);
......
...@@ -19,6 +19,6 @@ package Ada.Wide_Text_IO.Text_Streams is ...@@ -19,6 +19,6 @@ package Ada.Wide_Text_IO.Text_Streams is
type Stream_Access is access all Streams.Root_Stream_Type'Class; type Stream_Access is access all Streams.Root_Stream_Type'Class;
function Stream (File : in File_Type) return Stream_Access; function Stream (File : File_Type) return Stream_Access;
end Ada.Wide_Text_IO.Text_Streams; end Ada.Wide_Text_IO.Text_Streams;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment