text
stringlengths
0
234
package body recent_Exceptions
is
type exception_Usage is
record
the_Exception : AdaM.a_Type.view;
Count : Natural;
end record;
function "<" (L, R : in exception_Usage) return Boolean
is
use type AdaM.Identifier;
begin
return L.the_Exception.Name < R.the_Exception.Name;
end "<";
overriding function "=" (L, R : in exception_Usage) return Boolean
is
use type AdaM.Identifier;
begin
return L.the_Exception.Name = R.the_Exception.Name;
end "=";
package exception_Usage_Sets is new ada.Containers.Ordered_Sets (exception_Usage);
the_usage_Stats : exception_Usage_Sets.Set;
-- procedure register_Usage (the_Exception : in adam.Text)
-- is
-- use exception_Usage_Sets;
--
-- the_exception_Usage : exception_Usage := (the_Exception, others => <>);
-- Current : constant exception_Usage_Sets.Cursor := the_usage_Stats.find (the_exception_Usage);
-- begin
-- if Current /= No_Element
-- then
-- the_exception_Usage.Count := Element (Current).Count + 1;
-- the_usage_Stats.replace_Element (Current, the_exception_Usage);
-- else
-- the_exception_Usage.Count := 1;
-- the_usage_Stats.insert (the_exception_Usage);
-- end if;
-- end register_Usage;
procedure register_Usage (the_Exception : in AdaM.a_Type.view)
is
use exception_Usage_Sets;
use type AdaM.a_Type.view;
the_exception_Usage : exception_Usage := (the_Exception, others => <>);
Current : constant exception_Usage_Sets.Cursor := the_usage_Stats.find (the_exception_Usage);
begin
if the_Exception = null
then
raise program_Error with "NULLLLLLLL exception !!!";
else
put_Line ("ALL FINEEEEEEEEEEEEEEEEEEEEEE");
end if;
if Current /= No_Element
then
the_exception_Usage.Count := Element (Current).Count + 1;
the_usage_Stats.replace_Element (Current, the_exception_Usage);
else
the_exception_Usage.Count := 1;
the_usage_Stats.insert (the_exception_Usage);
end if;
end register_Usage;
function fetch return AdaM.a_Type.vector
is
use exception_Usage_Sets,
ada.Containers;
-- the_Lines : AdaM.text_Lines;
the_Exceptions : AdaM.a_Type.vector;
package type_Usage_Vectors is new ada.Containers.Vectors (Positive, exception_Usage);
use type_Usage_Vectors;
the_usage_List : type_Usage_Vectors.Vector;
begin
declare
Cursor : exception_Usage_Sets.Cursor := the_usage_Stats.First;
begin
while has_Element (Cursor)
loop
if Element (Cursor).Count > 0 then
the_usage_List.append (Element (Cursor));
end if;
exit when the_Exceptions.Length = 25; -- Limit results to 25 entries.
next (Cursor);
end loop;
Function Definition: procedure choice_is (Self : in out Item; --Now : in String;
Function Body: -- package_Name : in String;