Commit 1732c156 by Arnaud Charlet

[multiple changes]

2009-04-07  Bob Duff  <duff@adacore.com>

	* s-secsta.ads, g-pehage.ads, s-fileio.ads: Minor comment fixes

2009-04-07  Bob Duff  <duff@adacore.com>

	* gnat_rm.texi, s-fileio.adb (System.File_IO.Open): New feature: A
	Form parameter of Text_Translation=No allows binary mode for Text_IO
	files.

	* gnat_rm.texi: Document Form parameter Text_Translation=xxx.

2009-04-07  Javier Miranda  <miranda@adacore.com>

	* exp_ch5.adb (Expand_Assign_Array): Add implicit conversion when
	processing the bounds for bit packed arrays or VM target machines.

From-SVN: r145691
parent fcb82ab0
2009-04-07 Bob Duff <duff@adacore.com>
* s-secsta.ads, g-pehage.ads, s-fileio.ads: Minor comment fixes
2009-04-07 Bob Duff <duff@adacore.com>
* gnat_rm.texi, s-fileio.adb (System.File_IO.Open): New feature: A
Form parameter of Text_Translation=No allows binary mode for Text_IO
files.
* gnat_rm.texi: Document Form parameter Text_Translation=xxx.
2009-04-07 Javier Miranda <miranda@adacore.com>
* exp_ch5.adb (Expand_Assign_Array): Add implicit conversion when
processing the bounds for bit packed arrays or VM target machines.
2009-04-07 Thomas Quinot <quinot@adacore.com> 2009-04-07 Thomas Quinot <quinot@adacore.com>
* g-sothco.ads (Int_Access): Remove extraneous access type (use * g-sothco.ads (Int_Access): Remove extraneous access type (use
...@@ -851,12 +851,23 @@ package body Exp_Ch5 is ...@@ -851,12 +851,23 @@ package body Exp_Ch5 is
-- conversions ??? -- conversions ???
else else
-- Copy the bounds and reset the Analyzed flag, because the -- Copy the bounds
-- bounds of the index type itself may be universal, and must
-- must be reaanalyzed to acquire the proper type for Gigi.
Cleft_Lo := New_Copy_Tree (Left_Lo); Cleft_Lo := New_Copy_Tree (Left_Lo);
Cright_Lo := New_Copy_Tree (Right_Lo); Cright_Lo := New_Copy_Tree (Right_Lo);
-- If the types do not match we add an implicit conversion
-- here to ensure proper match
if Etype (Left_Lo) /= Etype (Right_Lo) then
Cright_Lo :=
Unchecked_Convert_To (Etype (Left_Lo), Cright_Lo);
end if;
-- Reset the Analyzed flag, because the bounds of the index
-- type itself may be universal, and must must be reaanalyzed
-- to acquire the proper type for the back end.
Set_Analyzed (Cleft_Lo, False); Set_Analyzed (Cleft_Lo, False);
Set_Analyzed (Cright_Lo, False); Set_Analyzed (Cright_Lo, False);
......
...@@ -40,17 +40,17 @@ ...@@ -40,17 +40,17 @@
-- Processing Letters, 43(1992) pp.257-264, Oct.1992 -- Processing Letters, 43(1992) pp.257-264, Oct.1992
-- Let W be a set of m words. A hash function h is a function that maps the -- Let W be a set of m words. A hash function h is a function that maps the
-- set of words W into some given interval of integers [0, k-1], where k is an -- set of words W into some given interval I of integers [0, k-1], where k is
-- integer, usually k >= m. h (w) where is a word computes an address or an -- an integer, usually k >= m. h (w) where w is a word in W computes an
-- integer from I for the storage or the retrieval of that item. The storage -- address or an integer from I for the storage or the retrieval of that
-- area used to store items is known as a hash table. Words for which the same -- item. The storage area used to store items is known as a hash table. Words
-- address is computed are called synonyms. Due to the existence of synonyms a -- for which the same address is computed are called synonyms. Due to the
-- situation called collision may arise in which two items w1 and w2 have the -- existence of synonyms a situation called collision may arise in which two
-- same address. Several schemes for resolving known. A perfect hash function -- items w1 and w2 have the same address. Several schemes for resolving
-- is an injection from the word set W to the integer interval I with k >= m. -- collisions are known. A perfect hash function is an injection from the word
-- If k = m, then h is a minimal perfect hash function. A hash function is -- set W to the integer interval I with k >= m. If k = m, then h is a minimal
-- order preserving if it puts entries into the hash table in prespecified -- perfect hash function. A hash function is order preserving if it puts
-- order. -- entries into the hash table in a prespecified order.
-- A minimal perfect hash function is defined by two properties: -- A minimal perfect hash function is defined by two properties:
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
-- The functions generated by this package require the words to be known in -- The functions generated by this package require the words to be known in
-- advance (they are "static" hash functions). The hash functions are also -- advance (they are "static" hash functions). The hash functions are also
-- order preserving. If w2 is inserted after w1 in the generator, then (w1) -- order preserving. If w2 is inserted after w1 in the generator, then h (w1)
-- < f (w2). These hashing functions are convenient for use with realtime -- < h (w2). These hashing functions are convenient for use with realtime
-- applications. -- applications.
package GNAT.Perfect_Hash_Generators is package GNAT.Perfect_Hash_Generators is
......
...@@ -278,6 +278,7 @@ The Implementation of Standard I/O ...@@ -278,6 +278,7 @@ The Implementation of Standard I/O
* Wide_Text_IO:: * Wide_Text_IO::
* Wide_Wide_Text_IO:: * Wide_Wide_Text_IO::
* Stream_IO:: * Stream_IO::
* Text Translation::
* Shared Files:: * Shared Files::
* Filenames encoding:: * Filenames encoding::
* Open Modes:: * Open Modes::
...@@ -12161,6 +12162,7 @@ these additional facilities are also described in this chapter. ...@@ -12161,6 +12162,7 @@ these additional facilities are also described in this chapter.
* Wide_Text_IO:: * Wide_Text_IO::
* Wide_Wide_Text_IO:: * Wide_Wide_Text_IO::
* Stream_IO:: * Stream_IO::
* Text Translation::
* Shared Files:: * Shared Files::
* Filenames encoding:: * Filenames encoding::
* Open Modes:: * Open Modes::
...@@ -12237,11 +12239,13 @@ The format of a FORM string in GNAT is: ...@@ -12237,11 +12239,13 @@ The format of a FORM string in GNAT is:
@noindent @noindent
where letters may be in upper or lower case, and there are no spaces where letters may be in upper or lower case, and there are no spaces
between values. The order of the entries is not important. Currently between values. The order of the entries is not important. Currently
there are two keywords defined. the following keywords defined.
@smallexample @smallexample
TEXT_TRANSLATION=[YES|NO]
SHARED=[YES|NO] SHARED=[YES|NO]
WCEM=[n|h|u|s|e|8|b] WCEM=[n|h|u|s|e|8|b]
ENCODING=[UTF8|8BITS]
@end smallexample @end smallexample
@noindent @noindent
...@@ -12941,6 +12945,20 @@ The stream attributes applied to a stream file transfer data in the ...@@ -12941,6 +12945,20 @@ The stream attributes applied to a stream file transfer data in the
manner described for stream attributes. manner described for stream attributes.
@end itemize @end itemize
@node Text Translation
@section Text Translation
@noindent
@samp{Text_Translation=@var{xxx}} may be used as the Form parameter
passed to Text_IO.Create and Text_IO.Open:
@samp{Text_Translation=@var{Yes}} is the default, which means to
translate LF to/from CR/LF on Windows systems.
@samp{Text_Translation=@var{No}} disables this translation; i.e. it
uses binary mode. For output files, @samp{Text_Translation=@var{No}}
may be used to create Unix-style files on
Windows. @samp{Text_Translation=@var{xxx}} has no effect on Unix
systems.
@node Shared Files @node Shared Files
@section Shared Files @section Shared Files
......
...@@ -739,6 +739,8 @@ package body System.File_IO is ...@@ -739,6 +739,8 @@ package body System.File_IO is
Formstr : aliased String (1 .. Form'Length + 1); Formstr : aliased String (1 .. Form'Length + 1);
-- Form string with ASCII.NUL appended, folded to lower case -- Form string with ASCII.NUL appended, folded to lower case
Is_Text_File : Boolean;
Tempfile : constant Boolean := (Name'Length = 0); Tempfile : constant Boolean := (Name'Length = 0);
-- Indicates temporary file case -- Indicates temporary file case
...@@ -800,7 +802,7 @@ package body System.File_IO is ...@@ -800,7 +802,7 @@ package body System.File_IO is
end if; end if;
end; end;
-- Acquire setting of shared parameter -- Acquire setting of encoding parameter
declare declare
V1, V2 : Natural; V1, V2 : Natural;
...@@ -822,6 +824,18 @@ package body System.File_IO is ...@@ -822,6 +824,18 @@ package body System.File_IO is
end if; end if;
end; end;
-- Acquire setting of text_translation parameter. Only needed if this is
-- a [Wide_[Wide_]]Text_IO file, in which case we default to True, but
-- if the Form says Text_Translation=No, we use binary mode, so new-line
-- will be just LF, even on Windows.
Is_Text_File := Text;
if Is_Text_File then
Is_Text_File :=
Form_Boolean (Formstr, "text_translation", Default => True);
end if;
-- If we were given a stream (call from xxx.C_Streams.Open), then set -- If we were given a stream (call from xxx.C_Streams.Open), then set
-- the full name to the given one, and skip to end of processing. -- the full name to the given one, and skip to end of processing.
...@@ -962,7 +976,7 @@ package body System.File_IO is ...@@ -962,7 +976,7 @@ package body System.File_IO is
-- Open specified file if we did not find an existing stream -- Open specified file if we did not find an existing stream
if Stream = NULL_Stream then if Stream = NULL_Stream then
Fopen_Mode (Mode, Text, Creat, Amethod, Fopstr); Fopen_Mode (Mode, Is_Text_File, Creat, Amethod, Fopstr);
-- A special case, if we are opening (OPEN case) a file and the -- A special case, if we are opening (OPEN case) a file and the
-- mode returned by Fopen_Mode is not "r" or "r+", then we first -- mode returned by Fopen_Mode is not "r" or "r+", then we first
...@@ -1026,7 +1040,7 @@ package body System.File_IO is ...@@ -1026,7 +1040,7 @@ package body System.File_IO is
File_Ptr.Is_Regular_File := (is_regular_file (fileno (Stream)) /= 0); File_Ptr.Is_Regular_File := (is_regular_file (fileno (Stream)) /= 0);
File_Ptr.Is_System_File := False; File_Ptr.Is_System_File := False;
File_Ptr.Is_Text_File := Text; File_Ptr.Is_Text_File := Is_Text_File;
File_Ptr.Shared_Status := Shared; File_Ptr.Shared_Status := Shared;
File_Ptr.Access_Method := Amethod; File_Ptr.Access_Method := Amethod;
File_Ptr.Stream := Stream; File_Ptr.Stream := Stream;
......
...@@ -72,7 +72,7 @@ package System.File_IO is ...@@ -72,7 +72,7 @@ package System.File_IO is
-- Mode is the required mode -- Mode is the required mode
-- --
-- Name is the file name, with a null string indicating that a temporary -- Name is the file name, with a null string indicating that a temporary
-- file is to be created (only permitted in create mode, not open mode) -- file is to be created (only permitted in create mode, not open mode).
-- --
-- Creat is True for a create call, and false for an open call -- Creat is True for a create call, and false for an open call
-- --
...@@ -80,16 +80,16 @@ package System.File_IO is ...@@ -80,16 +80,16 @@ package System.File_IO is
-- of the usual binary mode open (w+b or r+b). -- of the usual binary mode open (w+b or r+b).
-- --
-- Form is the form string given in the open or create call, this is -- Form is the form string given in the open or create call, this is
-- stored in the AFCB, but otherwise is not used by this or any other -- stored in the AFCB.
-- routine in this unit (except Form which retrieves the original value)
-- --
-- Amethod indicates the access method -- Amethod indicates the access method:
-- --
-- D = Direct_IO -- D = Direct_IO
-- Q = Sequential_IO -- Q = Sequential_IO
-- S = Stream_IO -- S = Stream_IO
-- T = Text_IO -- T = Text_IO
-- W = Wide_Text_IO -- W = Wide_Text_IO
-- ??? Wide_Wide_Text_IO ???
-- --
-- C_Stream is left at its default value for the normal case of an -- C_Stream is left at its default value for the normal case of an
-- Open or Create call as defined in the RM. The only time this is -- Open or Create call as defined in the RM. The only time this is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2007, 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 -- -- 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- --
...@@ -60,7 +60,7 @@ package System.Secondary_Stack is ...@@ -60,7 +60,7 @@ package System.Secondary_Stack is
-- --
-- Otherwise (Sec_Stack_Ratio between 0 and 100), Stk is an IN parameter -- Otherwise (Sec_Stack_Ratio between 0 and 100), Stk is an IN parameter
-- that is already pointing to a Stack_Id. The secondary stack in this case -- that is already pointing to a Stack_Id. The secondary stack in this case
-- is fixed, and any attempt to allocated more than the initial size will -- is fixed, and any attempt to allocate more than the initial size will
-- result in a Storage_Error being raised. -- result in a Storage_Error being raised.
-- --
-- Note: the reason that Stk is passed is that SS_Init is called before -- Note: the reason that Stk is passed is that SS_Init is called before
......
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