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>
* s-regexp.adb (Check_Well_Formed_Pattern): Called before compiling the
......
......@@ -357,13 +357,12 @@ package Einfo is
-- overloaded entities it points to the parent subprogram of a derived
-- subprogram. In case of abstract interface subprograms it points to the
-- subprogram that covers the abstract interface primitive. Also used for
-- a subprogram renaming, where it points to the renamed subprogram.
-- For an inherited operation (of a type extension) that is overridden
-- in a private part, the Alias is the overriding operation. In this
-- fashion a call from outside the package ends up executing the new body
-- even if non-dispatching, and a call from inside calls the overriding
-- operation because it hides the implicit one.
-- Alias is always empty for entries.
-- a subprogram renaming, where it points to the renamed subprogram. For
-- an inherited operation (of a type extension) that is overridden in a
-- private part, the Alias is the overriding operation. In this fashion a
-- call from outside the package ends up executing the new body even if
-- non-dispatching, and a call from inside calls the overriding operation
-- because it hides the implicit one. Alias is always empty for entries.
-- Alignment (Uint14)
-- Present in entities for types and also in constants, variables
......
......@@ -82,8 +82,6 @@
-- end if;
-- end;
-- Use of Unchecked_Union to perform the overlays is not supported.
package GNAT.SSE is
type Float32 is new Float;
type Float64 is new Long_Float;
......
......@@ -32,14 +32,14 @@
-- 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.
-- 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
-- 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
-- must observe the following usage restrictions:
-- Since these new data types are not basic ANSI C data types, you
-- must observe the following usage restrictions:
--
-- * 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
......@@ -51,21 +51,20 @@ package GNAT.SSE.Vector_Types is
-- * Use new data types only with the respective intrinsics described
-- in this documentation. >>
type m128 is private; -- SSE >= 1
type m128 is private; -- SSE >= 1
type m128d is private; -- SSE >= 2
type m128i is private; -- SSE >= 2
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
-- with other vector types, and their scalar components. */
-- typedef float __m128
-- __attribute__ ((__vector_size__ (16), __may_alias__));
--
-- /* Internal data types for implementing the intrinsics. */
-- typedef float __v4sf __attribute__ ((__vector_size__ (16)));
......@@ -73,7 +72,7 @@ private
-- 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;
for m128'Alignment use VECTOR_ALIGN;
......@@ -84,7 +83,7 @@ private
-- 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;
for m128d'Alignment use VECTOR_ALIGN;
......@@ -95,8 +94,8 @@ private
-- m128i --
-------------
-- << The __m128i data type can hold sixteen 8-bit, eight 16-bit, four
-- 32-bit, or two 64-bit integer values. >>
-- The __m128i data type can hold sixteen 8-bit, eight 16-bit, four 32-bit,
-- or two 64-bit integer values.
type m128i is array (1 .. 2) of Integer64;
for m128i'Alignment use VECTOR_ALIGN;
......
......@@ -130,12 +130,11 @@ package body System.Regexp is
-- This total does not include special operators, such as *, (, ...
procedure Check_Well_Formed_Pattern;
-- Check that the pattern to compile is well-formed, so that
-- subsequent code can rely on this without performing each time
-- the checks to avoid accessing the pattern outside its bounds.
-- Except that, not all well-formedness rules are checked.
-- In particular, the rules about special characters not being
-- treated as regular characters are not checked.
-- Check that the pattern to compile is well-formed, so that subsequent
-- code can rely on this without performing each time the checks to
-- avoid accessing the pattern outside its bounds. However, not all
-- well-formedness rules are checked. In particular, rules about special
-- characters not being treated as regular characters are not checked.
procedure Create_Mapping;
-- Creates a mapping between characters in the regexp and columns
......@@ -193,21 +192,25 @@ package body System.Regexp 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,
-- 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,
-- meaning there can be now an occurence of '|'.
Parenthesis_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,
-- or the last occurence of an opening curly brace, if Glob=True.
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 --
......@@ -216,14 +219,14 @@ package body System.Regexp is
procedure Raise_Exception_If_No_More_Chars (K : Integer := 0) is
begin
if J + K > S'Last then
Raise_Exception
("Ill-formed pattern while parsing", J);
Raise_Exception ("Ill-formed pattern while parsing", J);
end if;
end Raise_Exception_If_No_More_Chars;
-- Start of processing for Check_Well_Formed_Pattern
begin
J := S'First;
while J <= S'Last loop
case S (J) is
when Open_Bracket =>
......@@ -254,14 +257,14 @@ package body System.Regexp is
declare
Possible_Range_Start : Boolean := True;
-- Set to True everywhere a range character '-'
-- can occur.
-- Set True everywhere a range character '-' can occur
begin
loop
exit when S (J) = Close_Bracket;
-- The current character should be followed by
-- a closing bracket.
-- The current character should be followed by a
-- closing bracket.
Raise_Exception_If_No_More_Chars (1);
......@@ -281,6 +284,7 @@ package body System.Regexp is
-- except as last character in the set.
Possible_Range_Start := False;
else
Possible_Range_Start := True;
end if;
......@@ -300,8 +304,9 @@ package body System.Regexp is
Past_Term := True;
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
("Incorrect character ']' in regular expression", J);
......@@ -314,6 +319,7 @@ package body System.Regexp is
Past_Elmt := True;
Past_Term := True;
else
-- \ not allowed at the end of the regexp
......@@ -364,6 +370,7 @@ package body System.Regexp is
if Glob then
Curly_Level := Curly_Level + 1;
Last_Open := J;
else
-- Any character can be an elmt or a term
......@@ -388,6 +395,7 @@ package body System.Regexp is
("Empty curly braces not allowed in regular "
& "expression", J);
end if;
else
-- Any character can be an elmt or a term
......@@ -397,6 +405,7 @@ package body System.Regexp is
when '*' | '?' | '+' =>
if not Glob then
-- These operators must apply to an elmt sub-expression,
-- and cannot be found if one has not just been parsed.
......@@ -412,6 +421,7 @@ package body System.Regexp is
when '|' =>
if not Glob then
-- This operator must apply to a term sub-expression,
-- and cannot be found if one has not just been parsed.
......@@ -427,6 +437,7 @@ package body System.Regexp is
when others =>
if not Glob then
-- Any character can be an elmt or a term
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