Commit bc20523f by Arnaud Charlet

[multiple changes]

2010-06-23  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch4.adb: Use predefined unsigned type in all cases.

2010-06-23  Bob Duff  <duff@adacore.com>

	* s-rannum.adb (Reset): Avoid overflow in calculation of Initiator.
	* g-pehage.ads: Minor comment fixes.
	* g-pehage.adb: Minor: Add some additional debugging printouts under
	Verbose flag.

2010-06-23  Robert Dewar  <dewar@adacore.com>

	* binde.adb (Better_Choice): Always prefer Pure/Preelab.
	(Worse_Choice): Always prefer Pure/Preelab.

From-SVN: r161246
parent eeed09ef
2010-06-23 Ed Schonberg <schonberg@adacore.com>
* exp_ch4.adb: Use predefined unsigned type in all cases.
2010-06-23 Bob Duff <duff@adacore.com>
* s-rannum.adb (Reset): Avoid overflow in calculation of Initiator.
* g-pehage.ads: Minor comment fixes.
* g-pehage.adb: Minor: Add some additional debugging printouts under
Verbose flag.
2010-06-23 Robert Dewar <dewar@adacore.com>
* binde.adb (Better_Choice): Always prefer Pure/Preelab.
(Worse_Choice): Always prefer Pure/Preelab.
2010-06-23 Vincent Celier <celier@adacore.com>
* a-reatim.adb: Call System.OS_Primitives.Initialize during elaboration
......
......@@ -6927,7 +6927,7 @@ package body Exp_Ch4 is
Utyp := RTE (RE_Unsigned_16);
elsif RM_Size (Rtyp) = RM_Size (Standard_Unsigned) then
Utyp := Typ;
Utyp := RTE (RE_Unsigned_32);
else
Utyp := RTE (RE_Long_Long_Unsigned);
......
......@@ -33,6 +33,7 @@
with Ada.IO_Exceptions; use Ada.IO_Exceptions;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Directories;
with GNAT.Heap_Sort_G;
with GNAT.OS_Lib; use GNAT.OS_Lib;
......@@ -888,6 +889,11 @@ package body GNAT.Perfect_Hash_Generators is
procedure Finalize is
begin
if Verbose then
Put (Output, "Finalize");
New_Line (Output);
end if;
-- Deallocate all the WT components (both initial and reduced
-- ones) to avoid memory leaks.
......@@ -1165,6 +1171,11 @@ package body GNAT.Perfect_Hash_Generators is
Tries : Positive := Default_Tries)
is
begin
if Verbose then
Put (Output, "Initialize");
New_Line (Output);
end if;
-- Deallocate the part of the table concerning the reduced words.
-- Initial words are already present in the table. We may have reduced
-- words already there because a previous computation failed. We are
......@@ -1245,6 +1256,11 @@ package body GNAT.Perfect_Hash_Generators is
Len : constant Natural := Value'Length;
begin
if Verbose then
Put (Output, "Inserting """ & Value & """");
New_Line (Output);
end if;
WT.Set_Last (NK);
WT.Table (NK) := New_Word (Value);
NK := NK + 1;
......@@ -1494,6 +1510,12 @@ package body GNAT.Perfect_Hash_Generators is
begin
if Verbose then
Put (Output,
"Producing " & Ada.Directories.Current_Directory & "/" & FName);
New_Line (Output);
end if;
File := Create_File (FName, Binary);
if File = Invalid_FD then
......
......@@ -124,11 +124,11 @@ package GNAT.Perfect_Hash_Generators is
procedure Compute (Position : String := Default_Position);
-- Compute the hash function. Position allows to define selection of
-- character positions used in the word hash function. Positions can be
-- separated by commas and range like x-y may be used. Character '$'
-- separated by commas and ranges like x-y may be used. Character '$'
-- represents the final character of a word. With an empty position, the
-- generator automatically produces positions to reduce the memory usage.
-- Raise Too_Many_Tries in case that the algorithm does not succeed in less
-- than Tries attempts (see Initialize).
-- Raise Too_Many_Tries if the algorithm does not succeed within Tries
-- attempts (see Initialize).
procedure Produce (Pkg_Name : String := Default_Pkg_Name);
-- Generate the hash function package Pkg_Name. This package includes the
......
......@@ -484,7 +484,12 @@ package body System.Random_Numbers is
-----------
procedure Reset (Gen : Generator) is
X : constant Unsigned_32 := Unsigned_32 ((Calendar.Clock - Y2K) * 64.0);
Clock : constant Time := Calendar.Clock;
Duration_Since_Y2K : constant Duration := Clock - Y2K;
X : constant Unsigned_32 :=
Unsigned_32'Mod (Unsigned_64 (Duration_Since_Y2K) * 64);
begin
Init (Gen, X);
end Reset;
......
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