Commit fb59381e by Hristian Kirtchev Committed by Arnaud Charlet

2008-07-31 Hristian Kirtchev <kirtchev@adacore.com>

	* bindgen.adb Comment reformatting. Update the list of run-time globals.
	(Gen_Adainit_Ada): Add the declaration, import and value set for
	configuration flag Canonical_Streams.
	(Gen_Adainit_C): Add the declaration and initial value of external
	symbol __gl_canonical_streams.
	
	* init.c: Update the list of global values computed by the binder.
	
	* opt.ads: Add flag Canonical_Streams.
	
	* par-prag.adb (Prag): Include Pragma_Canonical_Streams to the list of
	semantically handled pragmas.
	
	* sem_prag.adb: Add an entry into enumeration type Sig_Flags.
	(Analyze_Pragma): Add case for pragma Canonical_Streams.
	
	* snames.adb: Add character value for name Canonical_Streams.
	
	* snames.ads:
	Add Name_Canonical_Streams to the list of configuration pragmas.
	Add Pragma_Canonical_Streams to enumeration type Pragma_Id.
	
	* snames.h: Add a definition for Pragma_Canonical_Streams.
	
	* s-ststop.adb:
	Add a flag and import to seize the value of external symbol
	__gl_canonical_streams. Update comment and initial value of constant
	Use_Block_IO.
	
	* gnat_rm.texi: Add section of pragma Canonical_Streams.
	
	* gnat_ugn.texi:
	Add pragma Canonical_Streams to the list of configuration pragmas.

From-SVN: r138407
parent 8198b93d
......@@ -126,39 +126,39 @@ package body Bindgen is
-- Detect_Blocking : Integer;
-- Default_Stack_Size : Integer;
-- Leap_Seconds_Support : Integer;
-- Main_Priority is the priority value set by pragma Priority in the
-- main program. If no such pragma is present, the value is -1.
-- Time_Slice_Value is the time slice value set by pragma Time_Slice
-- in the main program, or by the use of a -Tnnn parameter for the
-- binder (if both are present, the binder value overrides). The
-- value is in milliseconds. A value of zero indicates that time
-- slicing should be suppressed. If no pragma is present, and no
-- -T switch was used, the value is -1.
-- WC_Encoding shows the wide character encoding method used for
-- the main program. This is one of the encoding letters defined
-- in System.WCh_Con.WC_Encoding_Letters.
-- Locking_Policy is a space if no locking policy was specified
-- for the partition. If a locking policy was specified, the value
-- is the upper case first character of the locking policy name,
-- for example, 'C' for Ceiling_Locking.
-- Queuing_Policy is a space if no queuing policy was specified
-- for the partition. If a queuing policy was specified, the value
-- is the upper case first character of the queuing policy name
-- for example, 'F' for FIFO_Queuing.
-- Task_Dispatching_Policy is a space if no task dispatching policy
-- was specified for the partition. If a task dispatching policy
-- was specified, the value is the upper case first character of
-- the policy name, e.g. 'F' for FIFO_Within_Priorities.
-- Priority_Specific_Dispatching is the address of a string used to
-- store the task dispatching policy specified for the different priorities
-- in the partition. The length of this string is determined by the last
-- Canonical_Streams : Integer;
-- Main_Priority is the priority value set by pragma Priority in the main
-- program. If no such pragma is present, the value is -1.
-- Time_Slice_Value is the time slice value set by pragma Time_Slice in the
-- main program, or by the use of a -Tnnn parameter for the binder (if both
-- are present, the binder value overrides). The value is in milliseconds.
-- A value of zero indicates that time slicing should be suppressed. If no
-- pragma is present, and no -T switch was used, the value is -1.
-- WC_Encoding shows the wide character encoding method used for the main
-- program. This is one of the encoding letters defined in
-- System.WCh_Con.WC_Encoding_Letters.
-- Locking_Policy is a space if no locking policy was specified for the
-- partition. If a locking policy was specified, the value is the upper
-- case first character of the locking policy name, for example, 'C' for
-- Ceiling_Locking.
-- Queuing_Policy is a space if no queuing policy was specified for the
-- partition. If a queuing policy was specified, the value is the upper
-- case first character of the queuing policy name for example, 'F' for
-- FIFO_Queuing.
-- Task_Dispatching_Policy is a space if no task dispatching policy was
-- specified for the partition. If a task dispatching policy was specified,
-- the value is the upper case first character of the policy name, e.g. 'F'
-- for FIFO_Within_Priorities.
-- Priority_Specific_Dispatching is the address of a string used to store
-- the task dispatching policy specified for the different priorities in
-- the partition. The length of this string is determined by the last
-- priority for which such a pragma applies (the string will be a null
-- string if no specific dispatching policies were used). If pragma were
-- present, the entries apply to the priorities in sequence from the first
......@@ -182,12 +182,12 @@ package body Bindgen is
-- such a pragma is given (the string will be a null string if no pragmas
-- were used). If pragma were present the entries apply to the interrupts
-- in sequence from the first interrupt, and are set to one of four
-- possible settings: 'n' for not specified, 'u' for user, 'r' for
-- run time, 's' for system, see description of Interrupt_State pragma
-- for further details.
-- possible settings: 'n' for not specified, 'u' for user, 'r' for run
-- time, 's' for system, see description of Interrupt_State pragma for
-- further details.
-- Num_Interrupt_States is the length of the Interrupt_States string.
-- It will be set to zero if no Interrupt_State pragmas are present.
-- Num_Interrupt_States is the length of the Interrupt_States string. It
-- will be set to zero if no Interrupt_State pragmas are present.
-- Unreserve_All_Interrupts is set to one if at least one unit in the
-- partition had a pragma Unreserve_All_Interrupts, and zero otherwise.
......@@ -201,18 +201,21 @@ package body Bindgen is
-- this partition, and to zero if longjmp/setjmp exceptions are used.
-- the use of zero
-- Detect_Blocking indicates whether pragma Detect_Blocking is
-- active or not. A value of zero indicates that the pragma is not
-- present, while a value of 1 signals its presence in the
-- partition.
-- Detect_Blocking indicates whether pragma Detect_Blocking is active or
-- not. A value of zero indicates that the pragma is not present, while a
-- value of 1 signals its presence in the partition.
-- Default_Stack_Size is the default stack size used when creating an
-- Ada task with no explicit Storize_Size clause.
-- Default_Stack_Size is the default stack size used when creating an Ada
-- task with no explicit Storize_Size clause.
-- Leap_Seconds_Support denotes whether leap seconds have been enabled or
-- disabled. A value of zero indicates that leap seconds are turned "off",
-- while a value of one signifies "on" status.
-- Canonical_Streams indicates whether stream-related optimizations are
-- active. A value of zero indicates that all optimizations are active,
-- while a value of one signifies that they have been disabled.
-----------------------
-- Local Subprograms --
-----------------------
......@@ -593,6 +596,9 @@ package body Bindgen is
WBI (" Leap_Seconds_Support : Integer;");
WBI (" pragma Import (C, Leap_Seconds_Support, " &
"""__gl_leap_seconds_support"");");
WBI (" Canonical_Streams : Integer;");
WBI (" pragma Import (C, Canonical_Streams, " &
"""__gl_canonical_streams"");");
-- Import entry point for elaboration time signal handler
-- installation, and indication of if it's been called previously.
......@@ -761,6 +767,17 @@ package body Bindgen is
Set_String (";");
Write_Statement_Buffer;
Set_String (" Canonical_Streams := ");
if Canonical_Streams then
Set_Int (1);
else
Set_Int (0);
end if;
Set_String (";");
Write_Statement_Buffer;
-- Generate call to Install_Handler
WBI ("");
......@@ -1042,6 +1059,18 @@ package body Bindgen is
Set_String (";");
Write_Statement_Buffer;
WBI (" extern int __gl_canonical_streams;");
Set_String (" __gl_canonical_streams = ");
if Canonical_Streams then
Set_Int (1);
else
Set_Int (0);
end if;
Set_String (";");
Write_Statement_Buffer;
WBI ("");
-- Install elaboration time signal handler
......
......@@ -104,6 +104,7 @@ Implementation Defined Pragmas
* Pragma Assert::
* Pragma Ast_Entry::
* Pragma C_Pass_By_Copy::
* Pragma Canonical_Streams::
* Pragma Check::
* Pragma Check_Name::
* Pragma Check_Policy::
......@@ -705,6 +706,7 @@ consideration, the use of these pragmas should be minimized.
* Pragma Assert::
* Pragma Ast_Entry::
* Pragma C_Pass_By_Copy::
* Pragma Canonical_Streams::
* Pragma Check::
* Pragma Check_Name::
* Pragma Check_Policy::
......@@ -1057,6 +1059,27 @@ You can also pass records by copy by specifying the convention
@code{Import} and @code{Export} pragmas, which allow specification of
passing mechanisms on a parameter by parameter basis.
@node Pragma Canonical_Streams
@unnumberedsec Canonical Streams
@cindex Canonical streams
@findex Canonical_Streams
@noindent
Syntax:
@smallexample @c ada
pragma Canonical_Streams;
@end smallexample
@noindent
This configuration pragma affects the behavior of stream attributes of any
@code{String}, @code{Wide_String} or @code{Wide_Wide_String} based type. When
this pragma is present, @code{'Input}, @code{'Output}, @code{'Read} and
@code{'Write} exibit Ada 95 canonical behavior, in other words, streaming of
values is done character by character.
@noindent
The use of this pragma is intended to bypass any implementation-related
optimizations allowed by Ada 2005 RM 13.13.2 (56/2) Implementation Permission.
@node Pragma Check
@unnumberedsec Pragma Check
@cindex Assertions
......
......@@ -10925,6 +10925,7 @@ recognized by GNAT:
Ada_2005
Assertion_Policy
C_Pass_By_Copy
Canonical_Streams
Check_Name
Check_Policy
Compile_Time_Error
......@@ -102,6 +102,7 @@ int __gl_zero_cost_exceptions = 0;
int __gl_detect_blocking = 0;
int __gl_default_stack_size = -1;
int __gl_leap_seconds_support = 0;
int __gl_canonical_streams = 0;
/* Indication of whether synchronous signal handler has already been
installed by a previous call to adainit. */
......
......@@ -283,6 +283,11 @@ package Opt is
-- is set True, or if pragma No_Run_Time is used. See the spec of Rtsfind
-- for details on the handling of the latter pragma.
Canonical_Streams : Boolean := False;
-- GNATBIND
-- Set to True if configuration pragma Canonical_Streams is present. It
-- controls the canonical behaviour of stream operations for String types.
Constant_Condition_Warnings : Boolean := False;
-- GNAT
-- Set to True to activate warnings on constant conditions
......
......@@ -1054,6 +1054,7 @@ begin
Pragma_Atomic |
Pragma_Atomic_Components |
Pragma_Attach_Handler |
Pragma_Canonical_Streams |
Pragma_Check |
Pragma_Check_Name |
Pragma_Check_Policy |
......
......@@ -92,12 +92,23 @@ package body System.Strings.Stream_Ops is
subtype String_Block is String_Type (1 .. C_In_Default_Block);
-- Block IO is used when the low level can support block IO and the size
-- of the character type is a multiple of the stream element type.
Flag : Integer;
pragma Import (C, Flag, "__gl_canonical_streams");
-- This imported value is used to determine whether configuration pragma
-- Canonical_Streams is present. A value of zero indicates whether any
-- stream-related optimizations are enabled, while a value of one
-- indicates a disabled status.
Canonical_Streams : constant Boolean := Flag = 1;
-- Block IO is used when the low level can support block IO, the size
-- of the character type is a multiple of the stream element type and
-- the compilation can use stream optimizations.
Use_Block_IO : constant Boolean :=
Stream_Attributes.Block_IO_OK
and then C_Size mod SE_Size = 0;
and then C_Size mod SE_Size = 0
and then not Canonical_Streams;
-- Conversions to and from Default_Block
......
......@@ -5540,6 +5540,18 @@ package body Sem_Prag is
end if;
end C_Pass_By_Copy;
-----------------------
-- Canonical_Streams --
-----------------------
-- pragma Canonical_Streams;
when Pragma_Canonical_Streams =>
GNAT_Pragma;
Check_Arg_Count (0);
Check_Valid_Configuration_Pragma;
Canonical_Streams := True;
-----------
-- Check --
-----------
......@@ -12081,6 +12093,7 @@ package body Sem_Prag is
Pragma_Atomic => 0,
Pragma_Atomic_Components => 0,
Pragma_Attach_Handler => -1,
Pragma_Canonical_Streams => -1,
Pragma_Check => 99,
Pragma_Check_Name => 0,
Pragma_Check_Policy => 0,
......
......@@ -183,6 +183,7 @@ package body Snames is
"ada_2005#" &
"assertion_policy#" &
"c_pass_by_copy#" &
"canonical_streams#" &
"check_name#" &
"check_policy#" &
"compile_time_error#" &
......
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