Commit d994a6e2 by Robert Dewar Committed by Arnaud Charlet

einfo.ads, [...]: Add comment.

2009-07-23  Robert Dewar  <dewar@adacore.com>

	* einfo.ads, g-ssvety.ads, s-regexp.adb, g-sse.ads: Add comment. Minor
	reformatting.

From-SVN: r150001
parent 19f21e11
2009-07-23 Robert Dewar <dewar@adacore.com>
* einfo.ads, g-ssvety.ads, s-regexp.adb, g-sse.ads: Update comment.
Minor reformatting.
2009-07-23 Yannick Moy <moy@adacore.com> 2009-07-23 Yannick Moy <moy@adacore.com>
* s-regexp.adb (Check_Well_Formed_Pattern): Called before compiling the * s-regexp.adb (Check_Well_Formed_Pattern): Called before compiling the
......
...@@ -357,13 +357,12 @@ package Einfo is ...@@ -357,13 +357,12 @@ package Einfo is
-- overloaded entities it points to the parent subprogram of a derived -- overloaded entities it points to the parent subprogram of a derived
-- subprogram. In case of abstract interface subprograms it points to the -- subprogram. In case of abstract interface subprograms it points to the
-- subprogram that covers the abstract interface primitive. Also used for -- subprogram that covers the abstract interface primitive. Also used for
-- a subprogram renaming, where it points to the renamed subprogram. -- a subprogram renaming, where it points to the renamed subprogram. For
-- For an inherited operation (of a type extension) that is overridden -- an inherited operation (of a type extension) that is overridden in a
-- in a private part, the Alias is the overriding operation. In this -- private part, the Alias is the overriding operation. In this fashion a
-- fashion a call from outside the package ends up executing the new body -- call from outside the package ends up executing the new body even if
-- even if non-dispatching, and a call from inside calls the overriding -- non-dispatching, and a call from inside calls the overriding operation
-- operation because it hides the implicit one. -- because it hides the implicit one. Alias is always empty for entries.
-- Alias is always empty for entries.
-- Alignment (Uint14) -- Alignment (Uint14)
-- Present in entities for types and also in constants, variables -- Present in entities for types and also in constants, variables
......
...@@ -82,8 +82,6 @@ ...@@ -82,8 +82,6 @@
-- end if; -- end if;
-- end; -- end;
-- Use of Unchecked_Union to perform the overlays is not supported.
package GNAT.SSE is package GNAT.SSE is
type Float32 is new Float; type Float32 is new Float;
type Float64 is new Long_Float; type Float64 is new Long_Float;
......
...@@ -32,14 +32,14 @@ ...@@ -32,14 +32,14 @@
-- This unit exposes the Ada __m128 like data types to represent the contents -- This unit exposes the Ada __m128 like data types to represent the contents
-- of SSE registers, for use by bindings to the SSE intrinsic operations. -- of SSE registers, for use by bindings to the SSE intrinsic operations.
-- See GNAT.SSE for the list of targets where this facility is supported. -- See GNAT.SSE for the list of targets where this facility is supported
package GNAT.SSE.Vector_Types is package GNAT.SSE.Vector_Types is
-- The reference guide states a few usage guidelines for the C types : -- The reference guide states a few usage guidelines for the C types:
-- << Since these new data types are not basic ANSI C data types, you -- Since these new data types are not basic ANSI C data types, you
-- must observe the following usage restrictions: -- must observe the following usage restrictions:
-- --
-- * Use new data types only on either side of an assignment, as a -- * Use new data types only on either side of an assignment, as a
-- return value, or as a parameter. You cannot use it with other -- return value, or as a parameter. You cannot use it with other
...@@ -51,21 +51,20 @@ package GNAT.SSE.Vector_Types is ...@@ -51,21 +51,20 @@ package GNAT.SSE.Vector_Types is
-- * Use new data types only with the respective intrinsics described -- * Use new data types only with the respective intrinsics described
-- in this documentation. >> -- in this documentation. >>
type m128 is private; -- SSE >= 1 type m128 is private; -- SSE >= 1
type m128d is private; -- SSE >= 2 type m128d is private; -- SSE >= 2
type m128i is private; -- SSE >= 2 type m128i is private; -- SSE >= 2
private private
-- Each of the m128 types maps to a specific vector_type with an extra
-- "may_alias" attribute as in GCC's definitions for C, for instance in
-- xmmintrin.h:
-- Each of the m128 types maps to a specific vector_type with
-- an extra "may_alias" attribute as in GCC's definitions for C,
-- for instance in xmmintrin.h:
--
-- /* The Intel API is flexible enough that we must allow aliasing -- /* The Intel API is flexible enough that we must allow aliasing
-- with other vector types, and their scalar components. */ -- with other vector types, and their scalar components. */
-- typedef float __m128 -- typedef float __m128
-- __attribute__ ((__vector_size__ (16), __may_alias__)); -- __attribute__ ((__vector_size__ (16), __may_alias__));
--
-- /* Internal data types for implementing the intrinsics. */ -- /* Internal data types for implementing the intrinsics. */
-- typedef float __v4sf __attribute__ ((__vector_size__ (16))); -- typedef float __v4sf __attribute__ ((__vector_size__ (16)));
...@@ -73,7 +72,7 @@ private ...@@ -73,7 +72,7 @@ private
-- M128 -- -- M128 --
------------ ------------
-- << The __m128 data type can hold four 32-bit floating-point values. >> -- The __m128 data type can hold four 32-bit floating-point values
type m128 is array (1 .. 4) of Float32; type m128 is array (1 .. 4) of Float32;
for m128'Alignment use VECTOR_ALIGN; for m128'Alignment use VECTOR_ALIGN;
...@@ -84,7 +83,7 @@ private ...@@ -84,7 +83,7 @@ private
-- m128d -- -- m128d --
------------- -------------
-- << The __m128d data type can hold two 64-bit floating-point values. >> -- The __m128d data type can hold two 64-bit floating-point values
type m128d is array (1 .. 2) of Float64; type m128d is array (1 .. 2) of Float64;
for m128d'Alignment use VECTOR_ALIGN; for m128d'Alignment use VECTOR_ALIGN;
...@@ -95,8 +94,8 @@ private ...@@ -95,8 +94,8 @@ private
-- m128i -- -- m128i --
------------- -------------
-- << The __m128i data type can hold sixteen 8-bit, eight 16-bit, four -- The __m128i data type can hold sixteen 8-bit, eight 16-bit, four 32-bit,
-- 32-bit, or two 64-bit integer values. >> -- or two 64-bit integer values.
type m128i is array (1 .. 2) of Integer64; type m128i is array (1 .. 2) of Integer64;
for m128i'Alignment use VECTOR_ALIGN; for m128i'Alignment use VECTOR_ALIGN;
......
...@@ -130,12 +130,11 @@ package body System.Regexp is ...@@ -130,12 +130,11 @@ package body System.Regexp is
-- This total does not include special operators, such as *, (, ... -- This total does not include special operators, such as *, (, ...
procedure Check_Well_Formed_Pattern; procedure Check_Well_Formed_Pattern;
-- Check that the pattern to compile is well-formed, so that -- Check that the pattern to compile is well-formed, so that subsequent
-- subsequent code can rely on this without performing each time -- code can rely on this without performing each time the checks to
-- the checks to avoid accessing the pattern outside its bounds. -- avoid accessing the pattern outside its bounds. However, not all
-- Except that, not all well-formedness rules are checked. -- well-formedness rules are checked. In particular, rules about special
-- In particular, the rules about special characters not being -- characters not being treated as regular characters are not checked.
-- treated as regular characters are not checked.
procedure Create_Mapping; procedure Create_Mapping;
-- Creates a mapping between characters in the regexp and columns -- Creates a mapping between characters in the regexp and columns
...@@ -193,21 +192,25 @@ package body System.Regexp is ...@@ -193,21 +192,25 @@ package body System.Regexp is
------------------------------- -------------------------------
procedure Check_Well_Formed_Pattern is procedure Check_Well_Formed_Pattern is
J : Integer;
J : Integer := S'First; Past_Elmt : Boolean := False;
Past_Elmt : Boolean := False;
-- Set to True everywhere an elmt has been parsed, if Glob=False, -- Set to True everywhere an elmt has been parsed, if Glob=False,
-- meaning there can be now an occurence of '*', '+' and '?'. -- meaning there can be now an occurence of '*', '+' and '?'.
Past_Term : Boolean := False;
Past_Term : Boolean := False;
-- Set to True everywhere a term has been parsed, if Glob=False, -- Set to True everywhere a term has been parsed, if Glob=False,
-- meaning there can be now an occurence of '|'. -- meaning there can be now an occurence of '|'.
Parenthesis_Level : Integer := 0; Parenthesis_Level : Integer := 0;
Curly_Level : Integer := 0; Curly_Level : Integer := 0;
Last_Open : Integer := S'First - 1;
Last_Open : Integer := S'First - 1;
-- The last occurence of an opening parenthesis, if Glob=False, -- The last occurence of an opening parenthesis, if Glob=False,
-- or the last occurence of an opening curly brace, if Glob=True. -- or the last occurence of an opening curly brace, if Glob=True.
procedure Raise_Exception_If_No_More_Chars (K : Integer := 0); procedure Raise_Exception_If_No_More_Chars (K : Integer := 0);
-- If no more characters are raised, call Raise_Exception
-------------------------------------- --------------------------------------
-- Raise_Exception_If_No_More_Chars -- -- Raise_Exception_If_No_More_Chars --
...@@ -216,14 +219,14 @@ package body System.Regexp is ...@@ -216,14 +219,14 @@ package body System.Regexp is
procedure Raise_Exception_If_No_More_Chars (K : Integer := 0) is procedure Raise_Exception_If_No_More_Chars (K : Integer := 0) is
begin begin
if J + K > S'Last then if J + K > S'Last then
Raise_Exception Raise_Exception ("Ill-formed pattern while parsing", J);
("Ill-formed pattern while parsing", J);
end if; end if;
end Raise_Exception_If_No_More_Chars; end Raise_Exception_If_No_More_Chars;
-- Start of processing for Check_Well_Formed_Pattern -- Start of processing for Check_Well_Formed_Pattern
begin begin
J := S'First;
while J <= S'Last loop while J <= S'Last loop
case S (J) is case S (J) is
when Open_Bracket => when Open_Bracket =>
...@@ -254,14 +257,14 @@ package body System.Regexp is ...@@ -254,14 +257,14 @@ package body System.Regexp is
declare declare
Possible_Range_Start : Boolean := True; Possible_Range_Start : Boolean := True;
-- Set to True everywhere a range character '-' -- Set True everywhere a range character '-' can occur
-- can occur.
begin begin
loop loop
exit when S (J) = Close_Bracket; exit when S (J) = Close_Bracket;
-- The current character should be followed by -- The current character should be followed by a
-- a closing bracket. -- closing bracket.
Raise_Exception_If_No_More_Chars (1); Raise_Exception_If_No_More_Chars (1);
...@@ -281,6 +284,7 @@ package body System.Regexp is ...@@ -281,6 +284,7 @@ package body System.Regexp is
-- except as last character in the set. -- except as last character in the set.
Possible_Range_Start := False; Possible_Range_Start := False;
else else
Possible_Range_Start := True; Possible_Range_Start := True;
end if; end if;
...@@ -300,8 +304,9 @@ package body System.Regexp is ...@@ -300,8 +304,9 @@ package body System.Regexp is
Past_Term := True; Past_Term := True;
when Close_Bracket => when Close_Bracket =>
-- A close bracket must follow a open_bracket,
-- and cannot be found alone on the line. -- A close bracket must follow a open_bracket, and cannot be
-- found alone on the line.
Raise_Exception Raise_Exception
("Incorrect character ']' in regular expression", J); ("Incorrect character ']' in regular expression", J);
...@@ -314,6 +319,7 @@ package body System.Regexp is ...@@ -314,6 +319,7 @@ package body System.Regexp is
Past_Elmt := True; Past_Elmt := True;
Past_Term := True; Past_Term := True;
else else
-- \ not allowed at the end of the regexp -- \ not allowed at the end of the regexp
...@@ -364,6 +370,7 @@ package body System.Regexp is ...@@ -364,6 +370,7 @@ package body System.Regexp is
if Glob then if Glob then
Curly_Level := Curly_Level + 1; Curly_Level := Curly_Level + 1;
Last_Open := J; Last_Open := J;
else else
-- Any character can be an elmt or a term -- Any character can be an elmt or a term
...@@ -388,6 +395,7 @@ package body System.Regexp is ...@@ -388,6 +395,7 @@ package body System.Regexp is
("Empty curly braces not allowed in regular " ("Empty curly braces not allowed in regular "
& "expression", J); & "expression", J);
end if; end if;
else else
-- Any character can be an elmt or a term -- Any character can be an elmt or a term
...@@ -397,6 +405,7 @@ package body System.Regexp is ...@@ -397,6 +405,7 @@ package body System.Regexp is
when '*' | '?' | '+' => when '*' | '?' | '+' =>
if not Glob then if not Glob then
-- These operators must apply to an elmt sub-expression, -- These operators must apply to an elmt sub-expression,
-- and cannot be found if one has not just been parsed. -- and cannot be found if one has not just been parsed.
...@@ -412,6 +421,7 @@ package body System.Regexp is ...@@ -412,6 +421,7 @@ package body System.Regexp is
when '|' => when '|' =>
if not Glob then if not Glob then
-- This operator must apply to a term sub-expression, -- This operator must apply to a term sub-expression,
-- and cannot be found if one has not just been parsed. -- and cannot be found if one has not just been parsed.
...@@ -427,6 +437,7 @@ package body System.Regexp is ...@@ -427,6 +437,7 @@ package body System.Regexp is
when others => when others =>
if not Glob then if not Glob then
-- Any character can be an elmt or a term -- Any character can be an elmt or a term
Past_Elmt := True; Past_Elmt := True;
......
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