text stringlengths 0 234 |
|---|
Row, Col : Guint := 0; |
begin |
put_Line ("build_recent_List"); |
Self.recent_Table.Foreach (destroy_Callback'Access); |
for i in 1 .. Integer (the_Recent.Length) |
loop |
declare |
use AdaM; |
the_Package : AdaM.a_Package.view renames the_Recent.Element (i); |
begin |
the_Button := aIDE.Palette.of_packages_subpackages.new_Button (for_Package => the_Package, |
Named => +the_Package.Name, |
packages_Palette => Self'unchecked_Access); |
Self.recent_Table.attach (the_Button, |
Col, Col + 1, |
Row, Row + 1, |
Xoptions => 0, |
Yoptions => 0); |
the_Button.show_All; |
if Row = 6 |
then |
Row := 0; |
Col := Col + 1; |
else |
Row := Row + 1; |
end if; |
Function Definition: procedure register_Usage (the_Type : in Identifier); |
Function Body: function fetch return text_Lines; |
end recent_Types; |
package body recent_Types |
is |
type type_Usage is |
record |
Name : Text; -- The type name. |
Count : Natural; -- Number of times the type has been used. |
end record; |
use type Adam.Text; |
function "<" (L, R : in type_Usage) return Boolean |
is |
begin |
return L.Name < R.Name; |
end "<"; |
overriding function "=" (L, R : in type_Usage) return Boolean |
is |
begin |
return L.Name = R.Name; |
end "="; |
package type_Usage_Sets is new ada.Containers.Ordered_Sets (type_Usage); |
the_usage_Stats : type_Usage_Sets.Set; |
procedure register_Usage (the_Type : in Identifier) |
is |
use type_Usage_Sets; |
the_type_Usage : type_Usage := (+String (the_Type), others => <>); |
Current : constant type_Usage_Sets.Cursor := the_usage_Stats.find (the_type_Usage); |
begin |
if Current /= No_Element |
then |
the_type_Usage.Count := Element (Current).Count + 1; |
the_usage_Stats.replace_Element (Current, the_type_Usage); |
else |
the_type_Usage.Count := 1; |
the_usage_Stats.insert (the_type_Usage); |
end if; |
end register_Usage; |
function fetch return text_Lines |
is |
use type_Usage_Sets, |
ada.Containers; |
the_Lines : text_Lines; |
package type_Usage_Vectors is new ada.Containers.Vectors (Positive, type_Usage); |
use type_Usage_Vectors; |
the_usage_List : type_Usage_Vectors.Vector; |
begin |
declare |
Cursor : type_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; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.