id
int64 0
30.9k
| extension
stringclasses 1
value | max_stars_count
int64 0
17k
| max_stars_repo_name
stringlengths 7
106
| max_stars_repo_path
stringlengths 5
136
| text
stringlengths 9
1M
|
|---|---|---|---|---|---|
30,300
|
ada
| 0
|
sebsgit/textproc
|
src/imageio.ads
|
<filename>src/imageio.ads
with PixelArray;
with StbiWrapper;
package ImageIO is
pragma Assertion_Policy (Pre => Check,
Post => Check,
Type_Invariant => Check);
function load(filename: String) return PixelArray.ImagePlane;
function save(filename: String; image: PixelArray.ImagePlane) return Boolean;
procedure save(filename: String; image: PixelArray.ImagePlane);
end ImageIO;
|
30,301
|
ada
| 0
|
thomas070605/shoot-n-loot
|
src/menus.adb
|
-- Shoot'n'loot
-- Copyright (c) 2020 <NAME>
with HAL; use HAL;
with GESTE;
with GESTE.Tile_Bank;
with GESTE.Grid;
with GESTE.Sprite;
with GESTE_Config; use GESTE_Config;
with Render;
with Game;
with Sound;
with PyGamer.Time;
with PyGamer.Controls;
use PyGamer;
with Game_Assets.title_screen;
with Game_Assets.Tileset;
with Game_Assets.Tileset_Collisions;
with Game_Assets.Misc_Objects;
package body Menus is
Tile_Bank : aliased GESTE.Tile_Bank.Instance
(Game_Assets.Tileset.Tiles'Access,
Game_Assets.Tileset_Collisions.Tiles'Access,
Game_Assets.Palette'Access);
Back_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Back.Data'Access,
Tile_Bank'Access);
Menu_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Menu.Data'Access,
Tile_Bank'Access);
Help_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Help.Data'Access,
Tile_Bank'Access);
Credits_Grid : aliased GESTE.Grid.Instance
(Game_Assets.title_screen.Credits.Data'Access,
Tile_Bank'Access);
Cursor : aliased GESTE.Sprite.Instance
(Tile_Bank'Access, Game_Assets.Misc_Objects.Item.Menu_Cursor.Tile_Id);
type Selection_Kind is (Play, Help, Credits);
Current_Selection : Selection_Kind := Play;
Current_Screen : Selection_Kind := Play;
Cursor_Position : constant array (Selection_Kind) of GESTE.Pix_Point :=
(Play => (6 * Tile_Size, 10 * Tile_Size),
Help => (6 * Tile_Size, 11 * Tile_Size),
Credits => (6 * Tile_Size, 12 * Tile_Size));
Time_In_Game : Time.Time_Ms := 0;
procedure Scroll_Screen (Screen : Selection_Kind);
-------------------
-- Scroll_Screen --
-------------------
procedure Scroll_Screen (Screen : Selection_Kind) is
begin
GESTE.Remove_All;
Back_Grid.Move ((0, 0));
GESTE.Add (Back_Grid'Access, 0);
case Screen is
when Play =>
Cursor.Move ((Cursor_Position (Current_Selection)));
GESTE.Add (Cursor'Access, 1);
Menu_Grid.Move ((0, 0));
GESTE.Add (Menu_Grid'Access, 1);
when Help =>
Help_Grid.Move ((0, 0));
GESTE.Add (Help_Grid'Access, 1);
when Credits =>
Credits_Grid.Move ((0, 0));
GESTE.Add (Credits_Grid'Access, 1);
end case;
Render.Scroll_New_Scene (Render.Background_Color);
Current_Screen := Screen;
end Scroll_Screen;
---------
-- Run --
---------
procedure Run is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms;
begin
Scroll_Screen (Play);
Next_Release := Time.Clock;
Sound.Play_Main_Theme;
loop
Controls.Scan;
case Current_Screen is
when Play =>
-- Next menu item selection
if Controls.Falling (Controls.Down)
or else
Controls.Falling (Controls.Sel)
then
Sound.Play_Coin;
if Current_Selection = Selection_Kind'Last then
Current_Selection := Selection_Kind'First;
else
Current_Selection :=
Selection_Kind'Succ (Current_Selection);
end if;
end if;
-- Previous menu item selection
if Controls.Falling (Controls.Up) then
Sound.Play_Coin;
if Current_Selection = Selection_Kind'First then
Current_Selection := Selection_Kind'Last;
else
Current_Selection :=
Selection_Kind'Pred (Current_Selection);
end if;
end if;
-- Enter menu page or return to start playing
if Controls.Falling (Controls.Start)
or else
Controls.Falling (Controls.A)
or else
Controls.Falling (Controls.B)
then
if Current_Selection = Play then
GESTE.Remove_All;
Sound.Play_Gameplay;
-- Start the game and wait for result
if Game.Game_Loop (Time_In_Game) then
-- Victory! Let's have a look at the credits
Scroll_Screen (Credits);
else
-- Game-over, back to the title screen
Scroll_Screen (Play);
end if;
Sound.Play_Main_Theme;
else
Scroll_Screen (Current_Selection);
end if;
Next_Release := Time.Clock;
end if;
-- Move the cursor
Cursor.Move ((Cursor_Position (Current_Selection)));
when others =>
if (for some Button in Controls.Buttons
=> Controls.Falling (Button))
then
Scroll_Screen (Play);
Next_Release := Time.Clock;
end if;
end case;
Sound.Tick;
Render.Render_Dirty (Render.Background_Color);
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Run;
end Menus;
|
30,302
|
ada
| 1
|
ForYouEyesOnly/Space-Convoy
|
Sources/Globe_3d/models/terrain-vbo.adb
|
<gh_stars>1-10
pragma Warnings (Off);
pragma Style_Checks (Off);
with GL,
GL.Textures,
GL.Skins; use GL, GL.Textures;
with GL.Buffer.vertex,
GL.Buffer.indices,
GL.Buffer.texture_coords;
with GL.Geometry.VBO;
with GL.skinned_Geometry;
with GL.IO;
with GLOBE_3D.Math; use GLOBE_3D.Math;
with Ada.Numerics; use Ada.Numerics;
with ada.text_io; use ada.text_io;
package body Terrain.vbo is
-- tbd : this package uses a 'Sprite', whereas a 'triMesh.vbo' would probably be more appropriate.
function new_terrain_Sprite return sprite.p_Sprite
is
the_Sprite : sprite.p_Sprite := new globe_3d.sprite.Sprite (max_geometrys => 1);
begin
the_Sprite.is_Terrain := True;
return the_Sprite;
end;
procedure Heights_are (Self : in sprite.p_Sprite; Now : in height_Map;
Scale : in GLOBE_3D.Vector_3D;
Y_Offset : out Real)
is
use GLOBE_3D, GL, GL.Geometry, GL.Geometry.vbo, GL.Buffer, GL.Buffer.vertex, GLOBE_3D.REF, GLOBE_3D.Math, globe_3d.Sprite;
the_Geometry : GL.geometry.vbo.p_vbo_Geometry := new GL.geometry.vbo.vbo_Geometry;
vertex_Count : vertex_Id := vertex_Id (Now.row_Count * Now.column_Count);
the_Vertices : p_Vertex_array := new GL.geometry.GL_vertex_array' (1 .. vertex_Count => <>);
begin
the_Geometry.primitive_Id := GL.TRIANGLES;
-- vertices
--
set (the_Vertices.all, from_height_map => Now,
scale => scale,
height_offset => Y_Offset);
the_Geometry.Vertices := to_Buffer (the_Vertices, usage => GL.STATIC_DRAW);
the_Geometry.vertex_Count := GL.SizeI (vertex_Count);
the_Geometry.Bounds := Bounds (the_Vertices.all);
self.Bounds := the_Geometry.Bounds;
free (the_Vertices); -- nb : using new/free to avoid storage_Error with large heightmaps.
-- indices
--
declare
use GL.Buffer.indices;
index_Count : constant GL.positive_uInt := GL.positive_uInt ((Now.row_Count - 1) * (Now.column_Count - 1) * 2) * 3;
the_Indices : p_vertex_id_Array := new vertex_id_Array (1 .. index_Count);
Last : GL.positive_uInt := 1;
begin
the_Geometry.indices_Count := GL.SizeI (index_Count);
for Row in 1 .. Now.row_Count - 1 loop
for Col in 1 .. Now.column_Count - 1 loop
declare
use GL.Geometry;
NW : vertex_Id := Vertex_Id_for (Now, Row, Col);
SW : vertex_Id := Vertex_Id_for (Now, Row + 1, Col);
NE : vertex_Id := Vertex_Id_for (Now, Row, Col + 1);
SE : vertex_Id := Vertex_Id_for (Now, Row + 1, Col + 1);
begin
the_Indices (Last) := NW - 1;
Last := Last + 1; the_Indices (Last) := SW - 1;
Last := Last + 1; the_Indices (Last) := NE - 1;
Last := Last + 1; the_Indices (Last) := NE - 1;
Last := Last + 1; the_Indices (Last) := SW - 1;
Last := Last + 1; the_Indices (Last) := SE - 1;
Last := Last + 1;
end;
end loop;
end loop;
pragma assert (Last - 1 = Index_Count);
the_Geometry.Indices := to_Buffer (the_Indices, usage => GL.STATIC_DRAW);
free (the_Indices);
end;
self.skinned_Geometrys (1).Geometry := the_Geometry.all'Access;
self.skinned_geometry_Count := 1;
end;
procedure Texture_is (Self : in sprite.p_Sprite; Now : in GL.textures.Object;
texture_Transform_s : in GL.textures.texture_Transform;
texture_Transform_t : in GL.textures.texture_Transform)
is
use GL.Textures, GL.Skins, GL.Geometry.vbo;
the_skinned_Geometry : GL.skinned_Geometry.skinned_Geometry_t renames self.skinned_geometrys (1);
the_Skin : p_Skin_unlit_textured_vbo := new Skin_unlit_textured_vbo' (texture => Now);
the_Vertices : GL.geometry.GL_vertex_Array renames vbo_Geometry (the_skinned_Geometry.Geometry.all).Vertices.get;
texture_Coords : GL.textures.p_Coordinate_2D_array := to_texture_Coordinates_xz (the_Vertices, texture_Transform_s,
texture_Transform_t);
begin
the_skinned_Geometry.Skin := the_Skin.all'Access;
the_skinned_Geometry.Veneer := the_Skin.all.new_Veneer (for_geometry => the_skinned_Geometry.Geometry.all);
declare
use GL.Buffer.texture_coords;
the_Veneer : GL.skins.Veneer_unlit_textured_vbo'Class renames GL.skins.Veneer_unlit_textured_vbo'Class (the_skinned_Geometry.Veneer.all);
begin
the_Veneer.texture_Coordinates := to_Buffer (texture_Coords, usage => GL.STATIC_DRAW);
end;
free (texture_Coords);
end;
procedure create (Object : out globe_3d.sprite.p_Sprite;
the_height_Map : in height_Map;
scale : in GLOBE_3D.Vector_3D;
the_Texture : in GL.textures.Object;
texture_Transform_s : in GL.textures.texture_Transform;
texture_Transform_t : in GL.textures.texture_Transform;
Y_Offset : out Real)
is
use GLOBE_3D, GL, GL.Geometry, GL.Geometry.vbo, GL.Buffer, GL.Buffer.vertex, GLOBE_3D.REF, GLOBE_3D.Math, globe_3d.Sprite;
begin
Object := new globe_3d.sprite.Sprite (max_geometrys => 1);
Object.is_Terrain := True;
Heights_are (Object, the_Height_Map, Scale, Y_Offset);
Texture_is (Object, the_Texture, texture_Transform_s, texture_Transform_t);
end create;
procedure Create (object : in out GLOBE_3D.sprite.p_Sprite;
png_Heights : in String;
scale : in GLOBE_3D.Vector_3D;
base_Texture : in String)
is
use GLOBE_3D, GL, GLOBE_3D.REF, GLOBE_3D.Math;
the_height_Map : height_Map := to_Height_Map (to_Matrix (png_Heights));
Width : Real := Real (the_height_Map.column_Count - 1) * Scale (0);
Depth : Real := Real (the_height_Map.row_Count - 1) * Scale (2);
ground_Texture : GL.textures.Object := new_Texture (image_Filename => base_Texture);
transform_s : GL.textures.texture_Transform := (offset => 0.5 * Scale (0) + Width / 2.0,
scale => 1.0 / Width);
transform_t : GL.textures.texture_Transform := (offset => 0.5 * Scale (2) + Depth / 2.0,
scale => 1.0 / Depth);
Y_Offset : Real;
begin
create (object, the_Height_Map, Scale, ground_Texture, Transform_s, Transform_t, Y_Offset);
end Create;
function Create (tga_Heights : in String;
texture_Image : in String;
tile_Width : in Positive := 32;
tile_Depth : in Positive := 32;
base_Centre : in Vector_3D := (0.0, 0.0, 0.0);
Scale : in Vector_3D := (1.0, 1.0, 1.0)) return sprite.p_sprite_Grid
is
use globe_3d.Sprite;
the_Matrix : Matrix := to_Matrix (tga_Heights);
total_Width : Real := Real (the_Matrix'Length (2) - 1);
total_Depth : Real := Real (the_Matrix'Length (1) - 1);
function Grid_last (total_Size, tile_Size : in Positive) return Positive
is
Last : Positive := 1 + (total_Size - tile_Size) / (tile_Size - 1);
begin
if (total_Size - tile_Size) mod (tile_Size - 1) /= 0 then
Last := Last + 1;
end if;
return Last;
end;
the_heightmap_Grid : height_map_Grid (1 .. Grid_last (the_Matrix'Length (1), tile_Depth),
1 .. Grid_last (the_Matrix'Length (2), tile_Width));
the_sprite_Grid : p_sprite_Grid (the_heightmap_Grid'Range (1),
the_heightmap_Grid'Range (2));
ground_Texture : GL.textures.Object := new_Texture (image_Filename => texture_Image);
begin
-- create each element heightmap for the_heightmap_Grid.
--
declare
row_First, row_Last,
col_First, col_Last : Integer; -- row and col ranges for each submatrix.
begin
for Row in the_sprite_Grid'Range (1) loop
row_First := (tile_Depth - 1) * (Row - 1) + 1;
row_Last := integer'Min (row_First + (tile_Depth - 1), the_Matrix'Last (1));
for Col in the_sprite_Grid'Range (2) loop
col_First := (tile_Width - 1) * (Col - 1) + 1;
col_Last := integer'Min (col_First + (tile_Width - 1), the_Matrix'Last (2));
the_heightmap_Grid (Row, Col) := new height_Map' (to_height_Map (sub_Matrix (the_Matrix, row_First, row_Last,
col_First, col_Last)));
end loop;
end loop;
end;
-- create the Sprite for each grid element
--
declare
site_X_offset,
site_Z_offset : Real := 0.0;
site_Y_Offset : Real;
begin
for Row in the_sprite_Grid'Range (1) loop
site_X_offset := 0.0;
for Col in the_sprite_Grid'Range (2) loop
create (the_sprite_Grid (Row, Col),
the_heightmap_Grid (Row, Col).all,
Scale,
ground_Texture,
texture_transform_s => (offset => (0.5 + Real (tile_Width - 1) / 2.0) * Scale (0) + site_X_offset,
scale => 1.0 / ((total_Width) * Scale (0))),
texture_transform_t => (offset => (0.5 + Real (tile_Depth - 1) / 2.0) * Scale (2) + site_Z_offset,
scale => 1.0 / ((total_Depth) * Scale (2))),
y_offset => site_Y_Offset);
declare
the_Site : vector_3d := (site_X_offset - (total_Width / 2.0) * Scale (0),
site_Y_Offset,
site_Z_offset - (total_Depth / 2.0) * Scale (2));
begin
the_sprite_Grid (Row, Col).Centre := the_Site + base_Centre;
end;
if Col /= the_sprite_Grid'Last (2) then
site_X_offset := site_X_offset + Width (the_heightmap_Grid (Row, Col).all) * Scale (0) / 2.0
+ Width (the_heightmap_Grid (Row, Col + 1).all) * Scale (0) / 2.0;
end if;
end loop;
if Row /= the_sprite_Grid'Last (1) then
site_Z_offset := site_Z_offset + Depth (the_heightmap_Grid (Row, 1).all) * Scale (2) / 2.0
+ Depth (the_heightmap_Grid (Row + 1, 1).all) * Scale (2) / 2.0;
end if;
end loop;
end;
-- clean up
--
for Row in the_sprite_Grid'Range (1) loop
for Col in the_sprite_Grid'Range (2) loop
free (the_heightmap_Grid (Row, Col));
end loop;
end loop;
return the_sprite_Grid;
end Create;
end Terrain.vbo;
|
30,303
|
ada
| 15
|
My-Colaborations/dynamo
|
src/asis/asis-clauses.adb
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . C L A U S E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adac<EMAIL>.com). --
-- --
------------------------------------------------------------------------------
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.Mapping; use A4G.Mapping;
with A4G.Vcheck; use A4G.Vcheck;
with Atree; use Atree;
with Namet; use Namet;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
with Snames; use Snames;
package body Asis.Clauses is
Package_Name : constant String := "Asis.Clauses.";
------------------
-- Clause_Names --
------------------
function Clause_Names (Clause : Asis.Element) return Asis.Element_List is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
Result_List : List_Id;
Result_Len : Natural := 1;
Withed_Uname : Node_Id;
begin
Check_Validity (Clause, Package_Name & "Clause_Names");
if not (Arg_Kind = A_Use_Package_Clause or else
Arg_Kind = A_Use_Type_Clause or else
Arg_Kind = A_Use_All_Type_Clause or else -- Ada 2012
Arg_Kind = A_With_Clause)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Clause_Names",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
if Arg_Kind = A_With_Clause then
-- first, computing the number of names listed in the argument
-- with clause
-- Note that we should skip implicit with cleause that may be added
-- by front-end
while not (Comes_From_Source (Arg_Node)
and then
Last_Name (Arg_Node))
loop
if Comes_From_Source (Arg_Node) then
Result_Len := Result_Len + 1;
end if;
Arg_Node := Next (Arg_Node);
end loop;
declare
Result_List : Asis.Element_List (1 .. Result_Len);
begin
Arg_Node := Node (Clause);
for I in 1 .. Result_Len loop
Withed_Uname := Sinfo.Name (Arg_Node);
Result_List (I) := Node_To_Element_New
(Starting_Element => Clause,
Node => Withed_Uname);
Arg_Node := Next (Arg_Node);
while Present (Arg_Node)
and then
not Comes_From_Source (Arg_Node)
loop
Arg_Node := Next (Arg_Node);
end loop;
end loop;
return Result_List;
end;
else
if Nkind (Arg_Node) = N_Use_Package_Clause then
Result_List := Names (Arg_Node);
else
Result_List := Subtype_Marks (Arg_Node);
end if;
return N_To_E_List_New (List => Result_List,
Starting_Element => Clause);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Clause_Names",
Argument => Clause);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Clause_Names",
Ex => Ex,
Arg_Element => Clause);
end Clause_Names;
-------------------------------
-- Component_Clause_Position --
-------------------------------
function Component_Clause_Position
(Clause : Asis.Component_Clause)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
begin
Check_Validity (Clause, Package_Name & "Component_Clause_Position");
if not (Arg_Kind = A_Component_Clause) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Component_Clause_Position",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
return Node_To_Element_New (Node => Position (Arg_Node),
Starting_Element => Clause);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Component_Clause_Position",
Argument => Clause);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Component_Clause_Position",
Ex => Ex,
Arg_Element => Clause);
end Component_Clause_Position;
----------------------------
-- Component_Clause_Range --
----------------------------
function Component_Clause_Range
(Clause : Asis.Component_Clause)
return Asis.Discrete_Range
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
begin
Check_Validity (Clause, Package_Name & "Component_Clause_Range");
if not (Arg_Kind = A_Component_Clause) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Component_Clause_Range",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
return Node_To_Element_New
(Node => Arg_Node,
Internal_Kind => A_Discrete_Simple_Expression_Range,
Starting_Element => Clause);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Component_Clause_Range",
Argument => Clause);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Component_Clause_Range",
Ex => Ex,
Arg_Element => Clause);
end Component_Clause_Range;
-----------------------
-- Component_Clauses --
-----------------------
function Component_Clauses
(Clause : Asis.Representation_Clause;
Include_Pragmas : Boolean := False)
return Asis.Component_Clause_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
begin
Check_Validity (Clause, Package_Name & "Component_Clauses");
if not (Arg_Kind = A_Record_Representation_Clause) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Component_Clauses",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
return N_To_E_List_New
(List => Component_Clauses (Arg_Node),
Include_Pragmas => Include_Pragmas,
Starting_Element => Clause);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Component_Clauses",
Argument => Clause,
Bool_Par => Include_Pragmas);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Component_Clauses",
Ex => Ex,
Arg_Element => Clause,
Bool_Par_ON => Include_Pragmas);
end Component_Clauses;
---------------------------
-- Mod_Clause_Expression --
---------------------------
function Mod_Clause_Expression
(Clause : Asis.Representation_Clause)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
Mod_Clause_Node : Node_Id;
begin
Check_Validity (Clause, Package_Name & "Mod_Clause_Expression");
if not (Arg_Kind = A_Record_Representation_Clause) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Mod_Clause_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
Mod_Clause_Node := Next (Arg_Node);
if Nkind (Mod_Clause_Node) = N_Attribute_Definition_Clause and then
From_At_Mod (Mod_Clause_Node)
then
Mod_Clause_Node := Sinfo.Expression (Mod_Clause_Node);
else
Mod_Clause_Node := Empty;
end if;
if No (Mod_Clause_Node) then
return Asis.Nil_Element;
else
return Node_To_Element_New
(Node => Mod_Clause_Node,
Starting_Element => Clause);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Mod_Clause_Expression",
Argument => Clause);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Mod_Clause_Expression",
Ex => Ex,
Arg_Element => Clause);
end Mod_Clause_Expression;
--------------------------------------
-- Representation_Clause_Expression --
--------------------------------------
function Representation_Clause_Expression
(Clause : Asis.Representation_Clause)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
Result_Node : Node_Id;
Result_Kind : Internal_Element_Kinds := Not_An_Element;
begin
Check_Validity (Clause,
Package_Name & "Representation_Clause_Expression");
if not (Arg_Kind = An_Attribute_Definition_Clause or else
Arg_Kind = An_Enumeration_Representation_Clause or else
Arg_Kind = An_At_Clause)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Representation_Clause_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
if Nkind (Arg_Node) = N_Enumeration_Representation_Clause then
Result_Node := Array_Aggregate (Arg_Node);
if Present (Expressions (Result_Node)) then
Result_Kind := A_Positional_Array_Aggregate;
else
Result_Kind := A_Named_Array_Aggregate;
end if;
else
Result_Node := Sinfo.Expression (Arg_Node);
end if;
return Node_To_Element_New (Node => Result_Node,
Internal_Kind => Result_Kind,
Starting_Element => Clause);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Representation_Clause_Expression",
Argument => Clause);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Representation_Clause_Expression",
Ex => Ex,
Arg_Element => Clause);
end Representation_Clause_Expression;
--------------------------------
-- Representation_Clause_Name --
--------------------------------
function Representation_Clause_Name
(Clause : Asis.Clause)
return Asis.Name
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Clause);
Arg_Node : Node_Id;
Result_Node : Node_Id;
Result_Element : Element;
Result_Kind : Internal_Element_Kinds := Not_An_Element;
Attr_Des : Name_Id;
-- needed for special processing of attribute definition clause
begin
Check_Validity (Clause, Package_Name & "Representation_Clause_Name");
if not (Arg_Kind = An_Attribute_Definition_Clause or else
Arg_Kind = An_Enumeration_Representation_Clause or else
Arg_Kind = A_Record_Representation_Clause or else
Arg_Kind = An_At_Clause or else
Arg_Kind = A_Component_Clause)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Representation_Clause_Name",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Clause);
if Nkind (Arg_Node) = N_Attribute_Definition_Clause then
-- for An_Attribute_Definition_Clause argument we have to return
-- as the result the Element of An_Attribute_Reference kind.
-- The tree does not contain the structures for attribute reference
-- in this case (and it should not, because, according to RM 95,
-- there is no attribute reference in the syntax structure of
-- an attribute definition clause, so we have to "emulate"
-- the result Elemet of An_Attribute_Reference kind on the base
-- of the same node
-- first, we have to define the exact kind of the "artificial"
-- attribute reference to be returned
Attr_Des := Chars (Arg_Node);
case Attr_Des is
when Name_Address =>
Result_Kind := An_Address_Attribute;
when Name_Alignment =>
Result_Kind := An_Alignment_Attribute;
when Name_Bit_Order =>
Result_Kind := A_Bit_Order_Attribute;
when Name_Component_Size =>
Result_Kind := A_Component_Size_Attribute;
when Name_External_Tag =>
Result_Kind := An_External_Tag_Attribute;
when Name_Input =>
Result_Kind := An_Input_Attribute;
when Name_Machine_Radix =>
Result_Kind := A_Machine_Radix_Attribute;
when Name_Output =>
Result_Kind := An_Output_Attribute;
when Name_Read =>
Result_Kind := A_Read_Attribute;
when Name_Size =>
Result_Kind := A_Size_Attribute;
when Name_Small =>
Result_Kind := A_Small_Attribute;
when Name_Storage_Size =>
Result_Kind := A_Storage_Size_Attribute;
when Name_Storage_Pool =>
Result_Kind := A_Storage_Pool_Attribute;
when Name_Write =>
Result_Kind := A_Write_Attribute;
when others =>
-- "others" means Name_Object_Size and Name_Value_Size
Result_Kind := An_Implementation_Defined_Attribute;
end case;
Result_Element := Clause;
Set_Int_Kind (Result_Element, Result_Kind);
return Result_Element;
elsif Nkind (Arg_Node) = N_Component_Clause then
Result_Node := Component_Name (Arg_Node);
else
Result_Node := Sinfo.Identifier (Arg_Node);
end if;
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Clause);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Representation_Clause_Name",
Argument => Clause);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Representation_Clause_Name",
Ex => Ex,
Arg_Element => Clause);
end Representation_Clause_Name;
end Asis.Clauses;
|
30,304
|
ada
| 0
|
Letractively/ada-asf
|
src/asf-security.ads
|
<reponame>Letractively/ada-asf
-----------------------------------------------------------------------
-- asf-security -- ASF Security
-- Copyright (C) 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with EL.Functions;
package ASF.Security is
-- EL function name exposed by Set_Functions.
HAS_PERMISSION_FN : constant String := "hasPermission";
-- URI for the EL functions exposed by the security package (See Set_Functions).
AUTH_NAMESPACE_URI : constant String := "http://code.google.com/p/ada-asf/auth";
-- Register a set of functions in the namespace
-- xmlns:fn="http://code.google.com/p/ada-asf/auth"
-- Functions:
-- hasPermission(NAME) -- Returns True if the permission NAME is granted
procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class);
end ASF.Security;
|
30,305
|
ada
| 13
|
annexi-strayline/AURA
|
specification_scanner.adb
|
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Fixed;
with Ada.Assertions;
with Registrar.Source_Files;
package body Specification_Scanner is
-------------------
-- Parse_Toolkit --
-------------------
generic
Buffer: in out Ada_Lexical_Parser.Source_Buffer;
package Parse_Toolkit is
use Ada_Lexical_Parser;
Current_Element: Lexical_Element;
Category: Lexical_Category renames Current_Element.Category;
function Content return Wide_Wide_String is
(WWU.To_Wide_Wide_String (Current_Element.Content));
procedure Next_Element;
-- Advance to next element, skipping comments, and updating
-- Current_Element
function Current_Position return String;
-- Return a string of format "Line:Col"
procedure Assert_Syntax (Check: Boolean);
-- Executes Ada.Assertions.Assert with the message :
-- "Line:Col: Syntax Error.
procedure Load_Identifier (Name: out WWU.Unbounded_Wide_Wide_String);
procedure Skip_To_Semicolon;
end Parse_Toolkit;
--------------------------------------------------
package body Parse_Toolkit is
procedure Next_Element is
begin
loop
Current_Element := Next_Element (Buffer);
exit when Category /= Comment;
end loop;
end Next_Element;
function Current_Position return String is
use Ada.Strings;
use Ada.Strings.Fixed;
Pos: constant Source_Position := Last_Position (Buffer);
begin
return
Trim (Source => Positive'Image (Pos.Line),
Side => Both)
& ':'
& Trim (Source => Positive'Image (Pos.Column),
Side => Both);
end Current_Position;
procedure Assert_Syntax (Check: Boolean) is
begin
Ada.Assertions.Assert
(Check => Check,
Message => Current_Position & ": Syntax error");
end Assert_Syntax;
procedure Load_Identifier (Name: out WWU.Unbounded_Wide_Wide_String) is
use type WWU.Unbounded_Wide_Wide_String;
-- Should be called when Current_Element is an Identifier
begin
Name := Current_Element.Content;
-- Copy the Unbounded_Wide_Wide_String directly
loop
Next_Element;
exit when Category not in Identifier | Delimiter;
exit when Category = Delimiter and then Content /= ".";
Name := Name & Current_Element.Content;
end loop;
end Load_Identifier;
procedure Skip_To_Semicolon is
begin
Next_Element;
while not (Category = Delimiter and then Content = ";") loop
Next_Element;
end loop;
end Skip_To_Semicolon;
end Parse_Toolkit;
--
-- Process Subprograms
--
procedure Scan_Subprogram
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Unit_Tree : in out Declaration_Trees.Tree;
Subprogram_Node: in Declaration_Trees.Cursor);
-- Scan_Subprogram shall be called immediately after encountering
-- the reserved word "function or procedure". A new node for the
-- subprogram declaration shall be provided by Subprogram_Node.
--
-- Scan_Subprogram will set the name, add child declared entities
-- for each parameter, the type of function returns, and the expression
-- of expression functions
procedure Scan_Object
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Entity : in out Declared_Entity);
-- Shall be called immediately after an identifier followed by a ':'
-- delimiter. Node.Name shall be set to the value of the identifier before
-- calling. Scan_Value_Declaration will set Kind, Expression, Is_Constant,
-- Is_Renamed, Is_Anon_Access, Subtype_Mark, and Renamed_Entity_Name as
-- appropriate
--
-- This procedure covers:
-- * object_declaration
-- * number_declaration
-- * exception_declaration
-- * renaming_declaration (for any of the above)
procedure Scan_Generic
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Unit_Tree: in out Declaration_Trees.Tree;
Root : in Declaration_Trees.Cursor);
-- Shall be called immediate after encountering the reserved word "generic".
-- Scan_Generic appends generic parameters to the subtree rooted at Root,
-- and then dispatches to Scan_Specification or Scan_Subprogram as
-- appropriate, passing Root to the Root/Subprogram_Node parameters.
--
-- Is_Generic is set for Root
procedure Scan_Specification
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Unit_Tree: in out Declaration_Trees.Tree;
Root : in Declaration_Trees.Cursor);
-- Shall be called immediately after encountering the reserved word
-- package. Scan_Specifcation expects to find the completion of a
-- "package_specification". The name of the package is used to set the Name
-- property of the node designated by Root. All subsequent declarations are
-- assigned as children to the subtree denoted by Root, including recursive
-- descent into nested packages via recursive calls to Scan_Specification
-- Body stubs ------------------------------------
procedure Scan_Subprogram
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Unit_Tree : in out Declaration_Trees.Tree;
Subprogram_Node: in Declaration_Trees.Cursor)
is separate;
procedure Scan_Object
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Entity : in out Declared_Entity)
is separate;
procedure Scan_Generic
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Unit_Tree: in out Declaration_Trees.Tree;
Root : in Declaration_Trees.Cursor)
is separate;
procedure Scan_Specification
(Buffer : in out Ada_Lexical_Parser.Source_Buffer;
Unit_Tree: in out Declaration_Trees.Tree;
Root : in Declaration_Trees.Cursor)
is separate;
-----------------------
-- Scan_Package_Spec --
-----------------------
procedure Scan_Package_Spec
(Unit : in Registrar.Library_Units.Library_Unit;
Unit_Tree: out Declaration_Trees.Tree)
is
use Registrar.Source_Files;
use Ada_Lexical_Parser;
Source: aliased Source_Stream
:= Checkout_Read_Stream (Unit.Spec_File);
Buffer: Source_Buffer (Source'Access);
package Toolkit is new Parse_Toolkit (Buffer); use Toolkit;
Unit_Root: Declaration_Trees.Cursor;
begin
Unit_Tree := Declaration_Trees.Empty_Tree;
Unit_Root := Unit_Tree.Root;
Unit_Tree.Prepend_Child
(Parent => Unit_Tree.Root,
New_Item => Declared_Entity'(Kind => Package_Declaration,
others => <>));
Unit_Root := Declaration_Trees.First_Child (Unit_Tree.Root);
Next_Element;
-- Scan up until package and then kick off Scan_Specification. Note this
-- handles (ignores) private packages as well
while not (Category = Reserved_Word and then Content = "package") loop
if Category = Reserved_Word and then Content = "generic" then
Unit_Tree(Unit_Root).Is_Generic := True;
end if;
Next_Element;
end loop;
-- Recursive decent starts
Scan_Specification (Buffer => Buffer,
Unit_Tree => Unit_Tree,
Root => Unit_Root);
end Scan_Package_Spec;
end Specification_Scanner;
|
30,306
|
ada
| 15
|
My-Colaborations/dynamo
|
src/gen-commands-page.adb
|
-----------------------------------------------------------------------
-- gen-commands-page -- Page creation command for dynamo
-- Copyright (C) 2011, 2012, 2013, 2014, 2017, 2018, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
with Ada.Text_IO;
with Gen.Artifacts;
with Util.Strings;
package body Gen.Commands.Page is
-- ------------------------------
-- Execute the command with the arguments.
-- ------------------------------
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler) is
function Get_Layout return String;
function Get_Name return String;
Dir : constant String := Generator.Get_Result_Directory & "web/";
function Get_Name return String is
Name : constant String := Args.Get_Argument (1);
Pos : constant Natural := Util.Strings.Rindex (Name, '.');
begin
if Pos = 0 then
return Name;
elsif Name (Pos .. Name'Last) = ".xhtml" then
return Name (Name'First .. Pos - 1);
elsif Name (Pos .. Name'Last) = ".html" then
return Name (Name'First .. Pos - 1);
else
return Name;
end if;
end Get_Name;
function Get_Layout return String is
begin
if Args.Get_Count = 1 then
return "layout";
end if;
declare
Layout : constant String := Args.Get_Argument (2);
begin
if Ada.Directories.Exists (Dir & "WEB-INF/layouts/" & Layout & ".xhtml") then
return Layout;
end if;
Generator.Info ("Layout file {0} not found.", Layout);
return Layout;
end;
end Get_Layout;
begin
if Args.Get_Count = 0 or Args.Get_Count > 2 then
Cmd.Usage (Name, Generator);
return;
end if;
Generator.Set_Force_Save (False);
Generator.Set_Result_Directory (Dir);
Generator.Set_Global ("pageName", Get_Name);
Generator.Set_Global ("layout", Get_Layout);
Gen.Generator.Generate_All (Generator, Gen.Artifacts.ITERATION_TABLE, "page");
end Execute;
-- ------------------------------
-- Write the help associated with the command.
-- ------------------------------
overriding
procedure Help (Cmd : in out Command;
Name : in String;
Generator : in out Gen.Generator.Handler) is
pragma Unreferenced (Cmd, Name);
use Ada.Text_IO;
use Ada.Directories;
Path : constant String := Generator.Get_Result_Directory & "web/WEB-INF/layouts";
Filter : constant Filter_Type := (Ordinary_File => True, others => False);
Search : Search_Type;
Ent : Directory_Entry_Type;
begin
Put_Line ("add-page: Add a new web page to the application");
Put_Line ("Usage: add-page NAME [LAYOUT]");
New_Line;
Put_Line (" The web page is an XHTML file created under the 'web' directory.");
Put_Line (" The NAME can contain a directory that will be created if necessary.");
Put_Line (" The new web page can be configured to use the given layout.");
Put_Line (" The layout file must exist to be used. The default layout is 'layout'.");
Put_Line (" You can create a new layout with 'add-layout' command.");
Put_Line (" You can also write your layout by adding an XHTML file in the directory:");
Put_Line (" " & Path);
if Exists (Path) then
New_Line;
Put_Line (" Available layouts:");
Start_Search (Search, Directory => Path, Pattern => "*.xhtml", Filter => Filter);
while More_Entries (Search) loop
Get_Next_Entry (Search, Ent);
declare
Name : constant String := Simple_Name (Ent);
Layout : constant String := Base_Name (Name);
begin
Put_Line (" " & Layout);
end;
end loop;
end if;
New_Line;
Put_Line (" The following files are generated:");
Put_Line (" web/<name>.xhtml");
end Help;
end Gen.Commands.Page;
|
30,307
|
ada
| 18
|
jquorning/ada-wiki
|
src/wiki-render-links.adb
|
-----------------------------------------------------------------------
-- wiki-render-links -- Wiki links renderering
-- Copyright (C) 2015, 2016 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Wiki.Render.Links is
-- ------------------------------
-- Get the image link that must be rendered from the wiki image link.
-- ------------------------------
overriding
procedure Make_Image_Link (Renderer : in out Default_Link_Renderer;
Link : in Wiki.Strings.WString;
URI : out Wiki.Strings.UString;
Width : in out Natural;
Height : in out Natural) is
pragma Unreferenced (Renderer);
begin
URI := Wiki.Strings.To_UString (Link);
Width := 0;
Height := 0;
end Make_Image_Link;
-- ------------------------------
-- Get the page link that must be rendered from the wiki page link.
-- ------------------------------
overriding
procedure Make_Page_Link (Renderer : in out Default_Link_Renderer;
Link : in Wiki.Strings.WString;
URI : out Wiki.Strings.UString;
Exists : out Boolean) is
pragma Unreferenced (Renderer);
begin
URI := Wiki.Strings.To_UString (Link);
Exists := True;
end Make_Page_Link;
end Wiki.Render.Links;
|
30,308
|
ada
| 33
|
ytomino/drake
|
source/streams/a-direio.adb
|
with Ada.Exception_Identification.From_Here;
with Ada.Streams.Naked_Stream_IO;
with Ada.Streams.Stream_IO.Naked;
package body Ada.Direct_IO is
use Exception_Identification.From_Here;
use type Streams.Stream_Element_Offset;
procedure Create (
File : in out File_Type;
Mode : File_Mode := Inout_File;
Name : String := "";
Form : String := "")
is
NC_File : Streams.Naked_Stream_IO.Non_Controlled_File_Type
renames Streams.Stream_IO.Naked.Non_Controlled (
Streams.Stream_IO.File_Type (File)).all;
begin
Streams.Naked_Stream_IO.Create (
NC_File,
IO_Modes.Inout_File_Mode (Mode),
Name => Name,
Form => Streams.Naked_Stream_IO.Pack (Form));
end Create;
procedure Open (
File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := "")
is
NC_File : Streams.Naked_Stream_IO.Non_Controlled_File_Type
renames Streams.Stream_IO.Naked.Non_Controlled (
Streams.Stream_IO.File_Type (File)).all;
begin
Streams.Naked_Stream_IO.Open (
NC_File,
IO_Modes.Inout_File_Mode (Mode),
Name => Name,
Form => Streams.Naked_Stream_IO.Pack (Form));
end Open;
procedure Close (File : in out File_Type) is
begin
Streams.Stream_IO.Close (Streams.Stream_IO.File_Type (File));
end Close;
procedure Delete (File : in out File_Type) is
begin
Streams.Stream_IO.Delete (Streams.Stream_IO.File_Type (File));
end Delete;
procedure Reset (File : in out File_Type; Mode : File_Mode) is
NC_File : Streams.Naked_Stream_IO.Non_Controlled_File_Type
renames Streams.Stream_IO.Naked.Non_Controlled (
Streams.Stream_IO.File_Type (File)).all;
begin
Streams.Naked_Stream_IO.Reset (NC_File, IO_Modes.Inout_File_Mode (Mode));
end Reset;
procedure Reset (File : in out File_Type) is
begin
Reset (File, File_Mode'(Mode (File)));
end Reset;
function Mode (
File : File_Type)
return File_Mode
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (File) or else raise Status_Error);
NC_File : Streams.Naked_Stream_IO.Non_Controlled_File_Type
renames Streams.Stream_IO.Naked.Non_Controlled (
Streams.Stream_IO.File_Type (File)).all;
begin
return File_Mode (
IO_Modes.Inout_File_Mode'(Streams.Naked_Stream_IO.Mode (NC_File)));
end Mode;
function Name (
File : File_Type)
return String is
begin
return Streams.Stream_IO.Name (
Streams.Stream_IO.File_Type (File)); -- checking the predicate
end Name;
function Form (
File : File_Type)
return String is
begin
return Streams.Stream_IO.Form (
Streams.Stream_IO.File_Type (File)); -- checking the predicate
end Form;
function Is_Open (File : File_Type) return Boolean is
begin
return Streams.Stream_IO.Is_Open (Streams.Stream_IO.File_Type (File));
end Is_Open;
procedure Flush (
File : File_Type) is
begin
Streams.Stream_IO.Flush (
Streams.Stream_IO.File_Type (File)); -- checking the predicate
end Flush;
procedure Read (
File : File_Type;
Item : out Element_Type;
From : Positive_Count)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (File) or else raise Status_Error);
pragma Check (Dynamic_Predicate,
Check => Mode (File) /= Out_File or else raise Mode_Error);
begin
Set_Index (File, From);
Read (File, Item);
end Read;
procedure Read (
File : File_Type;
Item : out Element_Type)
is
pragma Warnings (Off,
"constrained for private type is an obsolescent feature (RM J.4)");
Constrained : constant Boolean := Element_Type'Constrained;
-- 'Definite / 'Has_Discriminants attribute are disallowed here
pragma Warnings (On,
"constrained for private type is an obsolescent feature (RM J.4)");
begin
if not Constrained then
-- indefinite (or unconstrained) types
declare
Buffer_Item : Element_Type;
Buffer_Item_As_SEA : Streams.Stream_Element_Array (
1 ..
Element_Type'Max_Size_In_Storage_Elements);
for Buffer_Item_As_SEA'Address use Buffer_Item'Address;
Last : Streams.Stream_Element_Offset;
begin
Streams.Stream_IO.Read (
Streams.Stream_IO.File_Type (File), -- checking the predicate
Buffer_Item_As_SEA,
Last);
if Last < Buffer_Item_As_SEA'Last then
Raise_Exception (End_Error'Identity);
end if;
Item := Buffer_Item;
end;
else
declare
Item_As_SEA : Streams.Stream_Element_Array (
1 ..
Element_Type'Max_Size_In_Storage_Elements);
for Item_As_SEA'Address use Item'Address;
Last : Streams.Stream_Element_Offset;
begin
Streams.Stream_IO.Read (
Streams.Stream_IO.File_Type (File), -- checking the predicate
Item_As_SEA,
Last);
if Last < Item_As_SEA'Last then
Raise_Exception (End_Error'Identity);
end if;
end;
end if;
end Read;
procedure Write (
File : File_Type;
Item : Element_Type;
To : Positive_Count)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (File) or else raise Status_Error);
pragma Check (Dynamic_Predicate,
Check => Mode (File) /= In_File or else raise Mode_Error);
begin
Set_Index (File, To);
Write (File, Item);
end Write;
procedure Write (
File : File_Type;
Item : Element_Type)
is
Item_As_SEA : Streams.Stream_Element_Array (
1 ..
Element_Type'Max_Size_In_Storage_Elements);
for Item_As_SEA'Address use Item'Address;
begin
Streams.Stream_IO.Write (
Streams.Stream_IO.File_Type (File), -- checking the predicate
Item_As_SEA);
end Write;
procedure Set_Index (
File : File_Type;
To : Positive_Count)
is
Raw_Index : constant Streams.Stream_IO.Positive_Count :=
Streams.Stream_IO.Positive_Count (
(To - 1) * Element_Type'Max_Size_In_Storage_Elements + 1);
begin
Streams.Stream_IO.Set_Index (
Streams.Stream_IO.File_Type (File), -- checking the predicate
Raw_Index);
end Set_Index;
function Index (
File : File_Type)
return Positive_Count
is
Raw_Index : constant Positive_Count :=
Positive_Count (
Streams.Stream_IO.Index (
Streams.Stream_IO.File_Type (File))); -- checking the predicate
Index_From_0 : constant Count := Raw_Index - 1;
begin
if Index_From_0 rem Element_Type'Max_Size_In_Storage_Elements /= 0 then
Raise_Exception (Use_Error'Identity);
end if;
return Index_From_0 / Element_Type'Max_Size_In_Storage_Elements + 1;
end Index;
function Size (
File : File_Type)
return Count
is
Raw_Size : constant Count :=
Count (
Streams.Stream_IO.Size (
Streams.Stream_IO.File_Type (File))); -- checking the predicate
begin
if Raw_Size rem Element_Type'Max_Size_In_Storage_Elements /= 0 then
Raise_Exception (Use_Error'Identity);
end if;
return Raw_Size / Element_Type'Max_Size_In_Storage_Elements;
end Size;
function End_Of_File (
File : File_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (File) or else raise Status_Error);
pragma Check (Dynamic_Predicate,
Check => Mode (File) /= Out_File or else raise Mode_Error);
begin
return Streams.Stream_IO.End_Of_File (
Streams.Stream_IO.File_Type (File));
end End_Of_File;
end Ada.Direct_IO;
|
30,309
|
ada
| 1
|
Jellix/open_weather_map_api
|
src/open_weather_map-api-service-location.ads
|
<reponame>Jellix/open_weather_map_api
--------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
--------------------------------------------------------------------------------
pragma License (Unrestricted);
--------------------------------------------------------------------------------
--% @summary
--% Open_Weather_Map.API.Service.Location
--
--% @description
--% Provides the query object implementing a location based query (i.e. a
--% geographical coordinate given as latitude and longitude).
--------------------------------------------------------------------------------
package Open_Weather_Map.API.Service.Location is
-----------------------------------------------------------------------------
-- API: Current weather data (by location)
-----------------------------------------------------------------------------
type T is new Service.T with private;
-----------------------------------------------------------------------------
-- Initialize
-----------------------------------------------------------------------------
procedure Initialize
(Self : out T;
Configuration : in GNATCOLL.JSON.JSON_Value;
Connection : not null Client.T_Access;
Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval;
Coordinates : in Geo_Coordinates);
--% Initializes the location query object.
--
--% @param Self
--% Instance of the location query to initialize.
--
--% @param Configuration
--% Connection specific configuration data (e.g. proxy server, API key).
--
--% @param Connection
--% The connection to be used for client server communication.
--
--% @param Max_Cache_Interval
--% Denotes the maximum frequency at which actual HTTP queries are being sent
--% to the server.
--
--% @param Coordinates
--% The geographical coordinates of the place to be queried.
private
type T is new Service.T with null record;
-----------------------------------------------------------------------------
-- Decode_Response
-----------------------------------------------------------------------------
overriding function Decode_Response
(Self : in T;
Root : in GNATCOLL.JSON.JSON_Value) return Data_Set;
--% Decodes a location query.
--
--% @param Self
--% Instance of the location query object.
--
--% @param Root
--% Root of the JSON data sent back by the server.
--
--% @return
--% The data set decoded from the server's response.
end Open_Weather_Map.API.Service.Location;
|
30,310
|
ada
| 2
|
thindil/tashy2
|
tests/tk-image-photo-test_data-tests.adb
|
-- This package has been generated automatically by GNATtest.
-- You are allowed to add your code to the bodies of test routines.
-- Such changes will be kept during further regeneration of this file.
-- All code placed outside of test routine bodies will be lost. The
-- code intended to set up and tear down the test environment should be
-- placed into Tk.Image.Photo.Test_Data.
with AUnit.Assertions; use AUnit.Assertions;
with System.Assertions;
-- begin read only
-- id:2.2/00/
--
-- This section can be used to add with clauses if necessary.
--
-- end read only
with Ada.Directories;
with Ada.Environment_Variables; use Ada.Environment_Variables;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-- begin read only
-- end read only
package body Tk.Image.Photo.Test_Data.Tests is
-- begin read only
-- id:2.2/01/
--
-- This section can be used to add global variables and other elements.
--
-- end read only
-- begin read only
-- end read only
-- begin read only
procedure Wrap_Test_Blank_2c1442_30601f
(Photo_Image: Tk_Image;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Blank_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Blank
(Photo_Image, Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Blank_Photo test commitment violated");
end;
end Wrap_Test_Blank_2c1442_30601f;
-- end read only
-- begin read only
procedure Test_Blank_tests_blank_photo(Gnattest_T: in out Test);
procedure Test_Blank_2c1442_30601f(Gnattest_T: in out Test) renames
Test_Blank_tests_blank_photo;
-- id:2.2/2c1442a8bb75046e/Blank/1/0/tests_blank_photo/
procedure Test_Blank_tests_blank_photo(Gnattest_T: in out Test) is
procedure Blank
(Photo_Image: Tk_Image;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Blank_2c1442_30601f;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Blank("myphoto");
Assert(True, "This test can only crash.");
-- begin read only
end Test_Blank_tests_blank_photo;
-- end read only
-- begin read only
function Wrap_Test_Get_Option_e3d52c_8f9fe9
(Photo_Image: Tk_Image; Name: String;
Interpreter: Tcl_Interpreter := Get_Interpreter) return String is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Name'Length > 0 and
Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Get_Option_Photo test requirement violated");
end;
declare
Test_Get_Option_e3d52c_8f9fe9_Result: constant String :=
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Option
(Photo_Image, Name, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Get_Option_Photo test commitment violated");
end;
return Test_Get_Option_e3d52c_8f9fe9_Result;
end;
end Wrap_Test_Get_Option_e3d52c_8f9fe9;
-- end read only
-- begin read only
procedure Test_Get_Option_tests_get_option_photo(Gnattest_T: in out Test);
procedure Test_Get_Option_e3d52c_8f9fe9(Gnattest_T: in out Test) renames
Test_Get_Option_tests_get_option_photo;
-- id:2.2/e3d52c2e49e4f170/Get_Option/1/0/tests_get_option_photo/
procedure Test_Get_Option_tests_get_option_photo(Gnattest_T: in out Test) is
function Get_Option
(Photo_Image: Tk_Image; Name: String;
Interpreter: Tcl_Interpreter := Get_Interpreter) return String renames
Wrap_Test_Get_Option_e3d52c_8f9fe9;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Assert
(Get_Option("myphoto", "format") = "png",
"Failed to get option of the selected image");
-- begin read only
end Test_Get_Option_tests_get_option_photo;
-- end read only
-- begin read only
procedure Wrap_Test_Copy_0a35cf_21de2d
(Destination_Image, Source_Image: Tk_Image;
From, To: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False;
Zoom, Sub_Sample: Point_Position := Empty_Point_Position;
Compositing_Rule: Compositing_Types := NONE;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Destination_Image'Length > 0 and Source_Image'Length > 0 and
Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Copy_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Copy
(Destination_Image, Source_Image, From, To, Shrink, Zoom, Sub_Sample,
Compositing_Rule, Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Copy_Photo test commitment violated");
end;
end Wrap_Test_Copy_0a35cf_21de2d;
-- end read only
-- begin read only
procedure Test_Copy_tests_copy_photo(Gnattest_T: in out Test);
procedure Test_Copy_0a35cf_21de2d(Gnattest_T: in out Test) renames
Test_Copy_tests_copy_photo;
-- id:2.2/0a35cf23b6e9723d/Copy/1/0/tests_copy_photo/
procedure Test_Copy_tests_copy_photo(Gnattest_T: in out Test) is
procedure Copy
(Destination_Image, Source_Image: Tk_Image;
From, To: Dimensions_Type := Empty_Dimension;
Shrink: Boolean := False;
Zoom, Sub_Sample: Point_Position := Empty_Point_Position;
Compositing_Rule: Compositing_Types := NONE;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Copy_0a35cf_21de2d;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Create("myphoto2", Default_Photo_Options);
Copy("myphoto2", "myphoto");
Assert(True, "This test can only crash.");
Delete("myphoto2");
-- begin read only
end Test_Copy_tests_copy_photo;
-- end read only
-- begin read only
function Wrap_Test_Get_Data_433b25_8ba84f
(Photo_Image: Tk_Image; Background, Format: Tcl_String := Null_Tcl_String;
From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False;
Interpreter: Tcl_Interpreter := Get_Interpreter) return Tcl_String is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Get_Data_Photo test requirement violated");
end;
declare
Test_Get_Data_433b25_8ba84f_Result: constant Tcl_String :=
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Data
(Photo_Image, Background, Format, From, Grayscale, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Get_Data_Photo test commitment violated");
end;
return Test_Get_Data_433b25_8ba84f_Result;
end;
end Wrap_Test_Get_Data_433b25_8ba84f;
-- end read only
-- begin read only
procedure Test_Get_Data_tests_get_data_photo(Gnattest_T: in out Test);
procedure Test_Get_Data_433b25_8ba84f(Gnattest_T: in out Test) renames
Test_Get_Data_tests_get_data_photo;
-- id:2.2/433b2501eca6e1fa/Get_Data/1/0/tests_get_data_photo/
procedure Test_Get_Data_tests_get_data_photo(Gnattest_T: in out Test) is
function Get_Data
(Photo_Image: Tk_Image;
Background, Format: Tcl_String := Null_Tcl_String;
From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False;
Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_String renames
Wrap_Test_Get_Data_433b25_8ba84f;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Assert
(Get_Data("myphoto") /= Null_Tcl_String,
"Failed to get data from photo image.");
-- begin read only
end Test_Get_Data_tests_get_data_photo;
-- end read only
-- begin read only
function Wrap_Test_Get_Color_6fd571_5f6b3a
(Photo_Image: Tk_Image; X, Y: Natural;
Interpreter: Tcl_Interpreter := Get_Interpreter) return Color_Type is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Get_Color_Photo test requirement violated");
end;
declare
Test_Get_Color_6fd571_5f6b3a_Result: constant Color_Type :=
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Color
(Photo_Image, X, Y, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Get_Color_Photo test commitment violated");
end;
return Test_Get_Color_6fd571_5f6b3a_Result;
end;
end Wrap_Test_Get_Color_6fd571_5f6b3a;
-- end read only
-- begin read only
procedure Test_Get_Color_tests_get_color_photo(Gnattest_T: in out Test);
procedure Test_Get_Color_6fd571_5f6b3a(Gnattest_T: in out Test) renames
Test_Get_Color_tests_get_color_photo;
-- id:2.2/6fd5718a9ddd1eec/Get_Color/1/0/tests_get_color_photo/
procedure Test_Get_Color_tests_get_color_photo(Gnattest_T: in out Test) is
function Get_Color
(Photo_Image: Tk_Image; X, Y: Natural;
Interpreter: Tcl_Interpreter := Get_Interpreter)
return Color_Type renames
Wrap_Test_Get_Color_6fd571_5f6b3a;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Assert
(Get_Color("myphoto", 1, 1) = (0, 0, 0),
"Failed to get color for photo image pixel.");
-- begin read only
end Test_Get_Color_tests_get_color_photo;
-- end read only
-- begin read only
procedure Wrap_Test_Put_Data_cd9739_ee5695
(Photo_Image: Tk_Image; Data: Tcl_String;
Format: Tcl_String := Null_Tcl_String;
To: Dimensions_Type := Empty_Dimension;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Length(Source => Data) > 0 and
Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Put_Data_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Put_Data
(Photo_Image, Data, Format, To, Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Put_Data_Photo test commitment violated");
end;
end Wrap_Test_Put_Data_cd9739_ee5695;
-- end read only
-- begin read only
procedure Test_Put_Data_tests_put_data_photo(Gnattest_T: in out Test);
procedure Test_Put_Data_cd9739_ee5695(Gnattest_T: in out Test) renames
Test_Put_Data_tests_put_data_photo;
-- id:2.2/cd9739d25bdd8fd7/Put_Data/1/0/tests_put_data_photo/
procedure Test_Put_Data_tests_put_data_photo(Gnattest_T: in out Test) is
procedure Put_Data
(Photo_Image: Tk_Image; Data: Tcl_String;
Format: Tcl_String := Null_Tcl_String;
To: Dimensions_Type := Empty_Dimension;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Put_Data_cd9739_ee5695;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Put_Data
(Photo_Image => "myphoto", Data => To_Tcl_String("red"),
To => (1, 1, 2, 2));
Assert
(Get_Color("myphoto", 1, 1) = (255, 0, 0),
"Failed to set color for selected pixels in photo image.");
-- begin read only
end Test_Put_Data_tests_put_data_photo;
-- end read only
-- begin read only
procedure Wrap_Test_Read_95a1fe_24b510
(Photo_Image: Tk_Image; File_Name: Tcl_String;
Format: Tcl_String := Null_Tcl_String;
From: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False;
To: Point_Position := Empty_Point_Position;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Length(Source => File_Name) > 0 and
Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Read_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Read
(Photo_Image, File_Name, Format, From, Shrink, To, Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Read_Photo test commitment violated");
end;
end Wrap_Test_Read_95a1fe_24b510;
-- end read only
-- begin read only
procedure Test_Read_tests_read_photo(Gnattest_T: in out Test);
procedure Test_Read_95a1fe_24b510(Gnattest_T: in out Test) renames
Test_Read_tests_read_photo;
-- id:2.2/95a1fec265c675e5/Read/1/0/tests_read_photo/
procedure Test_Read_tests_read_photo(Gnattest_T: in out Test) is
procedure Read
(Photo_Image: Tk_Image; File_Name: Tcl_String;
Format: Tcl_String := Null_Tcl_String;
From: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False;
To: Point_Position := Empty_Point_Position;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Read_95a1fe_24b510;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Read("myphoto", To_Tcl_String(".." & Dir_Separator & "test.png"));
Assert(True, "This test can only crash");
-- begin read only
end Test_Read_tests_read_photo;
-- end read only
-- begin read only
procedure Wrap_Test_Redither_68a59f_4f3041
(Photo_Image: Tk_Image;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Redither_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Redither
(Photo_Image, Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Redither_Photo test commitment violated");
end;
end Wrap_Test_Redither_68a59f_4f3041;
-- end read only
-- begin read only
procedure Test_Redither_tests_redither_photo(Gnattest_T: in out Test);
procedure Test_Redither_68a59f_4f3041(Gnattest_T: in out Test) renames
Test_Redither_tests_redither_photo;
-- id:2.2/68a59f049d29ab44/Redither/1/0/tests_redither_photo/
procedure Test_Redither_tests_redither_photo(Gnattest_T: in out Test) is
procedure Redither
(Photo_Image: Tk_Image;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Redither_68a59f_4f3041;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Redither("myphoto");
Assert(True, "This test can only crash");
-- begin read only
end Test_Redither_tests_redither_photo;
-- end read only
-- begin read only
function Wrap_Test_Get_Transparency_6cdf5e_ffe137
(Photo_Image: Tk_Image; X, Y: Natural;
Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Boolean_Result is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Get_Transparency_Photo test requirement violated");
end;
declare
Test_Get_Transparency_6cdf5e_ffe137_Result: constant Tcl_Boolean_Result :=
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Transparency
(Photo_Image, X, Y, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Get_Transparency_Photo test commitment violated");
end;
return Test_Get_Transparency_6cdf5e_ffe137_Result;
end;
end Wrap_Test_Get_Transparency_6cdf5e_ffe137;
-- end read only
-- begin read only
procedure Test_Get_Transparency_tests_get_transparency_photo
(Gnattest_T: in out Test);
procedure Test_Get_Transparency_6cdf5e_ffe137
(Gnattest_T: in out Test) renames
Test_Get_Transparency_tests_get_transparency_photo;
-- id:2.2/6cdf5e730aae7ad4/Get_Transparency/1/0/tests_get_transparency_photo/
procedure Test_Get_Transparency_tests_get_transparency_photo
(Gnattest_T: in out Test) is
function Get_Transparency
(Photo_Image: Tk_Image; X, Y: Natural;
Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Boolean_Result renames
Wrap_Test_Get_Transparency_6cdf5e_ffe137;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Assert
(Get_Transparency("myphoto", 0, 0).Result,
"Failed to get transparency for pixel in photo image.");
-- begin read only
end Test_Get_Transparency_tests_get_transparency_photo;
-- end read only
-- begin read only
procedure Wrap_Test_Set_Transparency_76d5d1_e76ade
(Photo_Image: Tk_Image; X, Y: Natural; Transparent: Boolean;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Set_Transparency_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Set_Transparency
(Photo_Image, X, Y, Transparent, Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Set_Transparency_Photo test commitment violated");
end;
end Wrap_Test_Set_Transparency_76d5d1_e76ade;
-- end read only
-- begin read only
procedure Test_Set_Transparency_tests_set_transparency_photo
(Gnattest_T: in out Test);
procedure Test_Set_Transparency_76d5d1_e76ade
(Gnattest_T: in out Test) renames
Test_Set_Transparency_tests_set_transparency_photo;
-- id:2.2/76d5d19d86527133/Set_Transparency/1/0/tests_set_transparency_photo/
procedure Test_Set_Transparency_tests_set_transparency_photo
(Gnattest_T: in out Test) is
procedure Set_Transparency
(Photo_Image: Tk_Image; X, Y: Natural; Transparent: Boolean;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Set_Transparency_76d5d1_e76ade;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Set_Transparency("myphoto", 0, 0, False);
Assert
(not Get_Transparency("myphoto", 0, 0).Result,
"Failed to set transparency for pixel in photo image.");
-- begin read only
end Test_Set_Transparency_tests_set_transparency_photo;
-- end read only
-- begin read only
procedure Wrap_Test_Write_a9d740_96f97b
(Photo_Image: Tk_Image; File_Name: Tcl_String;
Background, Format: Tcl_String := Null_Tcl_String;
From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False;
Interpreter: Tcl_Interpreter := Get_Interpreter) is
begin
begin
pragma Assert
(Photo_Image'Length > 0 and Length(Source => File_Name) > 0 and
Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-photo.ads:0):Tests_Write_Photo test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Write
(Photo_Image, File_Name, Background, Format, From, Grayscale,
Interpreter);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-photo.ads:0:):Tests_Write_Photo test commitment violated");
end;
end Wrap_Test_Write_a9d740_96f97b;
-- end read only
-- begin read only
procedure Test_Write_tests_write_photo(Gnattest_T: in out Test);
procedure Test_Write_a9d740_96f97b(Gnattest_T: in out Test) renames
Test_Write_tests_write_photo;
-- id:2.2/a9d74045db4a2ae3/Write/1/0/tests_write_photo/
procedure Test_Write_tests_write_photo(Gnattest_T: in out Test) is
procedure Write
(Photo_Image: Tk_Image; File_Name: Tcl_String;
Background, Format: Tcl_String := Null_Tcl_String;
From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False;
Interpreter: Tcl_Interpreter := Get_Interpreter) renames
Wrap_Test_Write_a9d740_96f97b;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Write("myphoto", To_Tcl_String(".." & Dir_Separator & "myphoto.png"));
Assert
(Ada.Directories.Exists(".." & Dir_Separator & "myphoto.png"),
"Failed to write the selected photo image to file.");
Ada.Directories.Delete_File(".." & Dir_Separator & "myphoto.png");
-- begin read only
end Test_Write_tests_write_photo;
-- end read only
-- begin read only
-- id:2.2/02/
--
-- This section can be used to add elaboration code for the global state.
--
begin
-- end read only
null;
-- begin read only
-- end read only
end Tk.Image.Photo.Test_Data.Tests;
|
30,311
|
ada
| 2
|
kevin-chalmers/cpa-lang-shootout
|
src/ada/commstime.adb
|
<gh_stars>1-10
with Ada.Text_IO;
use Ada.Text_IO;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
with Ada.Text_IO.Text_Streams;
use Ada.Text_IO.Text_Streams;
with Ada.Text_IO.Unbounded_IO;
use Ada.Text_IO.Unbounded_IO;
with Ada.Real_Time;
use Ada.Real_Time;
procedure CommsTime is
-- Parameters for the experimental run.
-- Experiments - number of data points collected
-- Iterations_Experiment - number of cycles round commstime for a single data point
Experiments : CONSTANT INTEGER := 100;
Iterations_Experiment : CONSTANT INTEGER := 10000;
task PREFIX is
entry Send(Value : in INTEGER);
end PREFIX;
task SEQ_DELTA is
entry Send(Value : in INTEGER);
end SEQ_DELTA;
task SUCC is
entry Send(Value : in INTEGER);
end SUCC;
task PRINTER is
entry Send(Value : in INTEGER);
end PRINTER;
task body PREFIX is
N : INTEGER;
begin
for i in 0..Experiments loop
SEQ_DELTA.Send(0);
for j in 0..Iterations_Experiment loop
accept Send(Value : in INTEGER) do
N := Value;
end;
SEQ_DELTA.Send(N);
end loop;
-- Accept last value in
accept Send(Value : in INTEGER);
end loop;
end PREFIX;
task body SEQ_DELTA is
N : INTEGER;
begin
for i in 0..Experiments loop
for j in 0..Iterations_Experiment loop
accept Send(Value : in INTEGER) do
N := Value;
end;
PRINTER.Send(Value => N);
SUCC.Send(Value => N);
end loop;
end loop;
end SEQ_DELTA;
task body SUCC is
N : INTEGER;
begin
for i in 0..Experiments loop
for j in 0..Iterations_Experiment loop
accept Send(Value : in INTEGER) do
N := Value;
end;
PREFIX.Send(N + 1);
end loop;
end loop;
end SUCC;
task body PRINTER is
N : INTEGER;
Start : Time;
Total : Time_Span;
Results : File_Type;
begin
Create(File => Results, Mode => Out_File, Name => "ct_ada.csv");
for i in 0..Experiments loop
Start := Clock;
for j in 0..Iterations_Experiment loop
accept Send(Value : in INTEGER) do
N := Value;
end;
end loop;
-- Divide by iterations, then convert to nanos.
-- Four communications.
Total := (((Clock - Start) / Iterations_Experiment) * 1000000000) / 4;
Put_Line(results, Float'Image(Float(To_Duration(Total))));
Put(".");
end loop;
Close(Results);
end PRINTER;
begin
Put_Line("Communication Time Benchmark");
end CommsTime;
|
30,312
|
ada
| 9
|
SALLYPEMDAS/DW1000
|
src/dw1000-types.ads
|
<filename>src/dw1000-types.ads
-------------------------------------------------------------------------------
-- Copyright (c) 2016 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with Interfaces;
package DW1000.Types
with SPARK_Mode => On
is
type Bits_1 is mod 2**1 with Size => 1;
type Bits_2 is mod 2**2 with Size => 2;
type Bits_3 is mod 2**3 with Size => 3;
type Bits_4 is mod 2**4 with Size => 4;
type Bits_5 is mod 2**5 with Size => 5;
type Bits_6 is mod 2**6 with Size => 6;
type Bits_7 is mod 2**7 with Size => 7;
subtype Bits_8 is Interfaces.Unsigned_8;
type Bits_9 is mod 2**9 with Size => 9;
type Bits_10 is mod 2**10 with Size => 10;
type Bits_11 is mod 2**11 with Size => 11;
type Bits_12 is mod 2**12 with Size => 12;
type Bits_13 is mod 2**13 with Size => 13;
type Bits_14 is mod 2**14 with Size => 14;
type Bits_15 is mod 2**15 with Size => 15;
subtype Bits_16 is Interfaces.Unsigned_16;
type Bits_17 is mod 2**17 with Size => 17;
type Bits_18 is mod 2**18 with Size => 18;
type Bits_19 is mod 2**19 with Size => 19;
type Bits_20 is mod 2**20 with Size => 20;
type Bits_21 is mod 2**21 with Size => 21;
type Bits_22 is mod 2**22 with Size => 22;
type Bits_23 is mod 2**23 with Size => 23;
type Bits_24 is mod 2**24 with Size => 24;
type Bits_25 is mod 2**25 with Size => 25;
type Bits_26 is mod 2**26 with Size => 26;
type Bits_27 is mod 2**27 with Size => 27;
type Bits_28 is mod 2**28 with Size => 28;
type Bits_29 is mod 2**29 with Size => 29;
type Bits_30 is mod 2**30 with Size => 30;
type Bits_31 is mod 2**31 with Size => 31;
subtype Bits_32 is Interfaces.Unsigned_32;
type Bits_33 is mod 2**33 with Size => 33;
type Bits_34 is mod 2**34 with Size => 34;
type Bits_35 is mod 2**35 with Size => 35;
type Bits_36 is mod 2**36 with Size => 36;
type Bits_37 is mod 2**37 with Size => 37;
type Bits_38 is mod 2**38 with Size => 38;
type Bits_39 is mod 2**39 with Size => 39;
type Bits_40 is mod 2**40 with Size => 40;
type Bits_41 is mod 2**41 with Size => 41;
type Bits_42 is mod 2**42 with Size => 42;
type Bits_43 is mod 2**43 with Size => 43;
type Bits_44 is mod 2**44 with Size => 44;
type Bits_45 is mod 2**45 with Size => 45;
type Bits_46 is mod 2**46 with Size => 46;
type Bits_47 is mod 2**47 with Size => 47;
type Bits_48 is mod 2**48 with Size => 48;
type Bits_49 is mod 2**49 with Size => 49;
type Bits_50 is mod 2**50 with Size => 50;
type Bits_51 is mod 2**51 with Size => 51;
type Bits_52 is mod 2**52 with Size => 52;
type Bits_53 is mod 2**53 with Size => 53;
type Bits_54 is mod 2**54 with Size => 54;
type Bits_55 is mod 2**55 with Size => 55;
type Bits_56 is mod 2**56 with Size => 56;
type Bits_57 is mod 2**57 with Size => 57;
type Bits_58 is mod 2**58 with Size => 58;
type Bits_59 is mod 2**59 with Size => 59;
type Bits_60 is mod 2**60 with Size => 60;
type Bits_61 is mod 2**61 with Size => 61;
type Bits_62 is mod 2**62 with Size => 62;
type Bits_63 is mod 2**63 with Size => 63;
subtype Bits_64 is Interfaces.Unsigned_64;
subtype Index is Natural range 0 .. Natural'Last - 1;
type Byte_Array is array (Index range <>) of Bits_8;
end DW1000.Types;
|
30,313
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/loop_boolean.adb
|
<reponame>best08618/asylo<gh_stars>1-10
-- { dg-do run }
-- { dg-options "-gnatVaM" }
procedure Loop_Boolean is
type R is record
B : Boolean;
end record;
procedure proc (X : R) is
B : Boolean;
begin
B := X.B;
end;
begin
for I in reverse Boolean loop
Proc ((B => I));
end loop;
end;
|
30,314
|
ada
| 13
|
Fabien-Chouteau/GESTE
|
tests/src/sprites.adb
|
<filename>tests/src/sprites.adb
with GESTE;
with GESTE.Sprite;
with GESTE.Tile_Bank;
with Ada.Text_IO;
with Console_Char_Screen;
procedure Sprites is
use type GESTE.Pix_Point;
package Console_Screen is new Console_Char_Screen
(Width => 16,
Height => 16,
Buffer_Size => 256,
Init_Char => ' ');
Palette : aliased constant GESTE.Palette_Type :=
('#', '0', 'T', ' ');
Background : Character := '_';
Tiles : aliased constant GESTE.Tile_Array :=
(1 => ((3, 3, 1, 3, 3),
(3, 3, 1, 3, 3),
(1, 1, 1, 1, 1),
(3, 3, 1, 3, 3),
(3, 3, 1, 3, 3)),
2 => ((2, 3, 3, 3, 2),
(3, 2, 3, 2, 3),
(3, 3, 2, 3, 3),
(3, 2, 3, 2, 3),
(2, 3, 3, 3, 2)),
3 => ((1, 1, 1, 1, 1),
(1, 3, 3, 3, 3),
(1, 3, 3, 3, 3),
(1, 3, 3, 3, 3),
(1, 3, 3, 3, 3))
);
Bank : aliased GESTE.Tile_Bank.Instance (Tiles'Unrestricted_Access,
GESTE.No_Collisions,
Palette'Unrestricted_Access);
Sprite_A : aliased GESTE.Sprite.Instance
(Bank => Bank'Unrestricted_Access,
Init_Frame => 1);
Sprite_B : aliased GESTE.Sprite.Instance
(Bank => Bank'Unrestricted_Access,
Init_Frame => 2);
begin
Console_Screen.Verbose;
Sprite_A.Move ((1, 1));
if Sprite_A.Position /= (1, 1) then
raise Program_Error;
end if;
GESTE.Add (Sprite_A'Unrestricted_Access, 0);
if Sprite_A.Width /= 5 or else Sprite_A.Height /= 5 then
Ada.Text_IO.Put_Line ("Wrong width or height");
end if;
Sprite_B.Move ((10, 4));
GESTE.Add (Sprite_B'Unrestricted_Access, 0);
GESTE.Render_Window
(Window => Console_Screen.Screen_Rect,
Background => Background,
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
Ada.Text_IO.New_Line;
Sprite_A.Move ((4, 4));
Sprite_B.Move ((6, 6));
GESTE.Render_Dirty
(Screen_Rect => Console_Screen.Screen_Rect,
Background => Background,
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
Sprite_A.Move ((1, 1));
Sprite_A.Set_Tile (3);
Sprite_A.Flip_Vertical;
Sprite_B.Move ((7, 1));
Sprite_B.Set_Tile (3);
Sprite_B.Flip_Horizontal;
GESTE.Render_Dirty
(Screen_Rect => Console_Screen.Screen_Rect,
Background => Background,
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
Sprite_A.Flip_Horizontal;
Sprite_B.Flip_Vertical;
GESTE.Render_Dirty
(Screen_Rect => Console_Screen.Screen_Rect,
Background => Background,
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
end Sprites;
|
30,315
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/deferred_const3.adb
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/deferred_const3.adb
-- { dg-do run }
with System; use System;
with Deferred_Const3_Pkg; use Deferred_Const3_Pkg;
procedure Deferred_Const3 is
begin
if C1'Address /= C'Address then
raise Program_Error;
end if;
if C2'Address /= C'Address then
raise Program_Error;
end if;
if C3'Address /= C'Address then
raise Program_Error;
end if;
end;
|
30,316
|
ada
| 3
|
mosteo/uri-ada
|
src/uri.ads
|
<filename>src/uri.ads
package URI with Preelaborate is
-- Helper functions to identify URLs and their components.
--
-- See https://tools.ietf.org/html/rfc3986 for full details.
--
-- http://user:pass@www.here.com:80/dir1/dir2/xyz.html?p=8&x=doh#anchor
-- | | | | | | |
-- protocol host port path file parameters fragment
--
-- foo://example.com:8042/over/there?name=ferret#nose
-- \_/ \______________/\_________/ \_________/ \__/
-- | | | | |
-- scheme authority path query fragment
-- | _____________________|__
-- / \ / \
-- urn:example:animal:ferret:nose
type Parts is
(Scheme,
Authority,
Path,
Query,
Fragment);
---------------
-- Low level --
---------------
-- The following functions will return "" for any part not recognized. Note
-- that no part is mandatory, so any "malformed" URI will be recognized as
-- a mere Path.
function Extract (This : String; Part : Parts) return String;
-- Return a specific part of the URL, or "" if not present
function Extract (This : String; First, Last : Parts) return String;
-- Return a slice of parts, or "" if none exist in the slice. Note that
-- appropriate separators will be included between parts: ":" after
-- existing scheme, "//" if authority exists, "?" if query exists, "#" if
-- fragment exists. Note that separators will not be included before First
-- nor after Last parts. Note that Scheme .. Path of "file:///path/to" will
-- return "file:/path/to" because authority is empty.
--
-- NOTES on "file:" URIs. Since the Authority only ends when a third '/' is
-- found, the following URIs may have unexpected interpretations (but these
-- are the correct ones!):
--
-- file://hello.txt => authority: hello.txt, path: ""
-- file:///hello.txt => authority: "", path: /hello.txt
-- file:../relative => authority: "", path: ../relative
-- file://../relative => authority: "..", path: /relative
-- file:/absolute => authority: "", path: /absolute
--
-- TL;DR: to ensure proper interpretation of malformed file: URLs, take
-- both the slice Authority .. Path as a whole to be the complete path.
-- Or use Permissive_Path below.
----------------
-- High level --
----------------
function Scheme (This : String) return String
is (Extract (This, Scheme));
function Permissive_Path (This : String) return String
is (Extract (This, Authority, Path));
end URI;
|
30,317
|
ada
| 0
|
stcarrez/hyperion
|
src/hyperion-agents-modules.ads
|
-----------------------------------------------------------------------
-- hyperion-agents-modules -- Module agents
-- Copyright (C) 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Applications;
with ADO;
with AWA.Modules;
with Hyperion.Agents.Models;
package Hyperion.Agents.Modules is
-- The name under which the module is registered.
NAME : constant String := "agents";
-- ------------------------------
-- Module agents
-- ------------------------------
type Agent_Module is new AWA.Modules.Module with private;
type Agent_Module_Access is access all Agent_Module'Class;
-- Initialize the agents module.
overriding
procedure Initialize (Plugin : in out Agent_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Register a new agent under the name, ip and key.
-- Return the agent identifier.
procedure Register_Agent (Plugin : in out Agent_Module;
Agent : in out Models.Agent_Ref);
-- Get the agents module.
function Get_Agent_Module return Agent_Module_Access;
private
type Agent_Module is new AWA.Modules.Module with null record;
end Hyperion.Agents.Modules;
|
30,318
|
ada
| 11
|
reznikmm/ada_lsp
|
source/server/ada_lsp-driver.adb
|
-- Copyright (c) 2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with LSP.Servers;
with LSP.Stdio_Streams;
with Ada_LSP.Contexts;
with Ada_LSP.Handlers;
procedure Ada_LSP.Driver is
Server : aliased LSP.Servers.Server;
Stream : aliased LSP.Stdio_Streams.Stdio_Stream;
Context : aliased Ada_LSP.Contexts.Context;
Handler : aliased Ada_LSP.Handlers.Message_Handler
(Server'Access, Context'Access);
begin
Server.Initialize
(Stream'Unchecked_Access,
Handler'Unchecked_Access,
Handler'Unchecked_Access);
Server.Run;
end Ada_LSP.Driver;
|
30,319
|
ada
| 1
|
ForYouEyesOnly/Space-Convoy
|
Sources/Globe_3d/models/terrain-vbo.ads
|
pragma Warnings (Off);
pragma Style_Checks (Off);
with GLOBE_3D.tri_Mesh;
with GLOBE_3D.Sprite;
with GL.Textures;
with ada.unchecked_Deallocation;
package Terrain.vbo is
use Globe_3d;
-- sprite (uses vertex buffer objects)
--
procedure Create (Object : in out sprite.p_Sprite;
png_Heights : in String; -- filename of the PNG heightmap image
Scale : in Vector_3D;
base_Texture : in String -- filename of the ground texture.
);
function Create (tga_Heights : in String;
texture_Image : in String;
tile_Width : in Positive := 32;
tile_Depth : in Positive := 32;
base_Centre : in Vector_3D := (0.0, 0.0, 0.0); -- Central point of the bottom of the terrain.
Scale : in Vector_3D := (1.0, 1.0, 1.0)) return sprite.p_sprite_Grid;
-------------------------------------
function new_terrain_Sprite return sprite.p_Sprite;
end Terrain.vbo;
|
30,320
|
ada
| 0
|
bkold/RISC-CPU-Assembler
|
Source/compiler.adb
|
with Ada.Text_IO;
with Assemble_Functions;
with Ada.Directories;
with GNAT.Command_Line;
with Ada.Strings.Bounded;
use GNAT.Command_Line;
use Ada.Text_IO;
--main function controls reading and writing
--assemble package handles each line
procedure Compiler is
package SB is new Ada.Strings.Bounded.Generic_Bounded_Length(Max => 50);
Mode : Integer := 0;
Source_File : File_Type;
Output_File : File_Type;
Error_Flag : Boolean := True;
Output_File_Name : SB.Bounded_String;
Input_File_Name : SB.Bounded_String;
begin
loop
case Getopt ("a d o:") is
when 'a' =>
if Mode = 0 then
Mode:=2;
else
Put_Line("Conflicting agument : '-a'");
return;
end if;
when 'd' =>
if Mode = 0 then
Mode:=1;
else
Put_Line("Conflicting agument : '-d'");
return;
end if;
when 'o' =>
Output_File_Name := SB.To_Bounded_String(Parameter);
when others =>
exit;
end case;
end loop;
Input_File_Name := SB.To_Bounded_String(Get_Argument);
if SB.Length(Input_File_Name) = 0 then
Put_Line("No file name given");
return;
end if;
--open files
Open(Source_File, In_File, SB.To_String(Input_File_Name));
Create(File=>Output_File, Name=>"~Out.s");
if Mode = 0 or else Mode = 2 then
Error_Flag := Assemble_Functions.Build(Source_File, Output_File);
elsif Mode = 1 then
Put_Line("Disassemble is not supported yet");
end if;
Close(Source_File);
Close(Output_File);
if Error_Flag = False then
if SB.Length(Output_File_Name) > 0 then
if Ada.Directories.Exists(SB.To_String(Output_File_Name)) then
Ada.Directories.Delete_File(SB.To_String(Output_File_Name));
end if;
Ada.Directories.Rename("~Out.s", SB.To_String(Output_File_Name));
else
if Ada.Directories.Exists("Out.s") then
Ada.Directories.Delete_File("Out.s");
end if;
Ada.Directories.Rename("~Out.s", "Out.s");
end if;
else
Ada.Directories.Delete_File("~Out.s");
end if;
end Compiler;
|
30,321
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr45.adb
|
<reponame>best08618/asylo
-- { dg-do compile }
-- { dg-options "-O2 -gnatws" }
procedure Discr45 is
function Ident_Int (I : Integer) return Integer is
begin
return I;
end;
procedure Proc (Signal : Boolean) is
subtype Index is Integer range 1..10;
type My_Arr is array (Index range <>) OF Integer;
type Rec (D3 : Integer := Ident_Int(1)) is record
case D3 is
when -5..10 => C1 : My_Arr(D3..Ident_Int(11));
when Others => C2 : Integer := Ident_Int(5);
end case;
end record;
X : Rec;
function Value return Rec;
pragma No_Inline (Value);
function Value return Rec is
begin
return X;
end;
begin
if X /= Value then
raise Constraint_Error;
elsif Signal then
raise Program_Error;
end if;
end;
begin
Proc (True);
end;
|
30,322
|
ada
| 3
|
wiremoons/apass
|
src/password_manager.ads
|
-------------------------------------------------------------------------------
-- BUILD FILE : apass --
-- Description : A CLI password generator written in Ada. --
-- Author : <NAME> <<EMAIL>> --
-- License : MIT Open Source. --
-------------------------------------------------------------------------------
package Password_Manager is
function Basic_Password (Number_Of_Words : Positive := 3) return String;
-- obtain all lowercase password string of Number_Of_Words in length from Words_List_Array
function Capitilised_Password (Number_Of_Words : Positive := 3) return String;
-- obtain capitalised per word password string of Number_Of_Words in length from Words_List_Array
function Get_Random_Number return String;
-- obtain a random number in range Random_Num_Int as a trimmed string
function Get_Random_Mark return String;
-- obtain string (single punctuation character) from Marks_List_Array
function Total_Words return String;
-- obtain the total number of words in the Words_List_Array as trimmed string
procedure Print_Password (Final_Password : String);
-- outputs the provided password string string colour text if supported
function Title_Case_String (Input_Str : String) return String;
private
---------------------------------------------------------------------------------------------------------------------
-- Mark_List_Array used to construct passwords into a randomly generated string. Private to ensure it is only --
-- accessed via functions in the Password_Manager package. --
---------------------------------------------------------------------------------------------------------------------
subtype Mark is String (1 .. 1);
type Marks_List is array (Positive range <>) of Mark;
Marks_List_Array : constant Marks_List := ("#", ".", ";", "@", "%", ":", "!", ">", "-", "<");
---------------------------------------------------------------------------------------------------------------------
-- Words_List_Array used to construct passwords into a randomly generated string. Private to ensure it is only --
-- accessed via functions in the Password_Manager package. --
---------------------------------------------------------------------------------------------------------------------
subtype Word is String (1 .. 3);
type Word_List is array (Positive range <>) of Word;
--!pp off
-- disable gnatpp formatting of array block below
Words_List_Array : constant Word_List :=
("aah", "aal", "aas", "aba", "abb", "abo", "abs", "aby", "ace", "ach",
"act", "add", "ado", "ads", "adz", "aff", "aft", "aga", "age", "ago",
"ags", "aha", "ahi", "ahs", "aia", "aid", "ail", "aim", "ain", "air",
"ais", "ait", "aka", "ake", "ala", "alb", "ale", "alf", "all", "alp",
"als", "alt", "alu", "ama", "ame", "ami", "amp", "amu", "ana", "and",
"ane", "ani", "ann", "ans", "ant", "any", "ape", "apo", "app", "apt",
"arb", "arc", "ard", "are", "arf", "ark", "arm", "ars", "art", "ary",
"ash", "ask", "asp", "ass", "ate", "ats", "att", "aua", "aue", "auf",
"auk", "ava", "ave", "avo", "awa", "awe", "awk", "awl", "awn", "axe",
"aye", "ays", "ayu", "azo", "baa", "bac", "bad", "bag", "bah", "bal",
"bam", "ban", "bap", "bar", "bas", "bat", "bay", "bed", "bee", "beg",
"bel", "ben", "bes", "bet", "bey", "bez", "bib", "bid", "big", "bin",
"bio", "bis", "bit", "biz", "boa", "bob", "bod", "bog", "boh", "boi",
"bok", "bon", "boo", "bop", "bor", "bos", "bot", "bow", "box", "boy",
"bra", "bro", "brr", "bru", "bub", "bud", "bug", "bum", "bun", "bur",
"bus", "but", "buy", "bye", "bys", "caa", "cab", "cad", "cag", "cam",
"can", "cap", "car", "cat", "caw", "cay", "caz", "cee", "cel", "cep",
"cha", "che", "chi", "cid", "cig", "cis", "cit", "cly", "cob", "cod",
"cog", "col", "con", "coo", "cop", "cor", "cos", "cot", "cow", "cox",
"coy", "coz", "cru", "cry", "cub", "cud", "cue", "cum", "cup", "cur",
"cut", "cuz", "cwm", "dab", "dad", "dae", "dag", "dah", "dak", "dal",
"dam", "dan", "dap", "das", "daw", "day", "deb", "dee", "def", "deg",
"dei", "del", "den", "dev", "dew", "dex", "dey", "dib", "did", "die",
"dif", "dig", "dim", "din", "dip", "dis", "dit", "div", "dob", "doc",
"dod", "doe", "dof", "dog", "doh", "dol", "dom", "don", "doo", "dop",
"dor", "dos", "dot", "dow", "doy", "dry", "dso", "dub", "dud", "due",
"dug", "duh", "dui", "dun", "duo", "dup", "dux", "dye", "dzo", "ean",
"ear", "eas", "eat", "eau", "ebb", "ech", "eco", "ecu", "edh", "eds",
"eek", "eel", "een", "eff", "efs", "eft", "egg", "ego", "ehs", "eik",
"eke", "eld", "elf", "elk", "ell", "elm", "els", "elt", "eme", "emo",
"ems", "emu", "end", "ene", "eng", "ens", "eon", "era", "ere", "erf",
"erg", "erk", "erm", "ern", "err", "ers", "ess", "est", "eta", "eth",
"euk", "eve", "evo", "ewe", "ewk", "ewt", "exo", "eye", "faa", "fab",
"fad", "fae", "fag", "fah", "fan", "fap", "far", "fas", "fat", "faw",
"fax", "fay", "fed", "fee", "feg", "feh", "fem", "fen", "fer", "fes",
"fet", "feu", "few", "fey", "fez", "fib", "fid", "fie", "fig", "fil",
"fin", "fir", "fit", "fix", "fiz", "flu", "fly", "fob", "foe", "fog",
"foh", "fon", "fop", "for", "fou", "fox", "foy", "fra", "fro", "fry",
"fub", "fud", "fug", "fum", "fun", "fur", "gab", "gad", "gae", "gag",
"gak", "gal", "gam", "gan", "gap", "gar", "gas", "gat", "gau", "gaw",
"gay", "ged", "gee", "gel", "gem", "gen", "geo", "ger", "get", "gey",
"ghi", "gib", "gid", "gie", "gif", "gig", "gin", "gio", "gip", "gis",
"git", "gju", "gnu", "goa", "gob", "god", "goe", "gon", "goo", "gor",
"gos", "got", "gov", "gox", "goy", "gub", "gue", "gul", "gum", "gun",
"gup", "gur", "gus", "gut", "guv", "guy", "gym", "gyp", "had", "hae",
"hag", "hah", "haj", "ham", "han", "hao", "hap", "has", "hat", "haw",
"hay", "heh", "hem", "hen", "hep", "her", "hes", "het", "hew", "hex",
"hey", "hic", "hid", "hie", "him", "hin", "hip", "his", "hit", "hmm",
"hoa", "hob", "hoc", "hod", "hoe", "hog", "hoh", "hoi", "hom", "hon",
"hoo", "hop", "hos", "hot", "how", "hox", "hoy", "hub", "hue", "hug",
"huh", "hui", "hum", "hun", "hup", "hut", "hye", "hyp", "ice", "ich",
"ick", "icy", "ide", "ids", "iff", "ifs", "igg", "ilk", "ill", "imp",
"ing", "ink", "inn", "ins", "ion", "ios", "ire", "irk", "ish", "ism",
"iso", "ita", "its", "ivy", "iwi", "jab", "jag", "jai", "jak", "jam",
"jap", "jar", "jaw", "jay", "jee", "jet", "jeu", "jew", "jib", "jig",
"jin", "jiz", "job", "joe", "jog", "jol", "jor", "jot", "jow", "joy",
"jud", "jug", "jun", "jus", "jut", "kab", "kae", "kaf", "kai", "kak",
"kam", "kas", "kat", "kaw", "kay", "kea", "keb", "ked", "kef", "keg",
"ken", "kep", "ket", "kex", "key", "khi", "kid", "kif", "kin", "kip",
"kir", "kis", "kit", "koa", "kob", "koi", "kon", "kop", "kor", "kos",
"kow", "kue", "kye", "kyu", "lab", "lac", "lad", "lag", "lah", "lam",
"lap", "lar", "las", "lat", "lav", "law", "lax", "lay", "lea", "led",
"lee", "leg", "lei", "lek", "lep", "les", "let", "leu", "lev", "lew",
"lex", "ley", "lez", "lib", "lid", "lie", "lig", "lin", "lip", "lis",
"lit", "lob", "lod", "log", "loo", "lop", "lor", "los", "lot", "lou",
"low", "lox", "loy", "lud", "lug", "lum", "lur", "luv", "lux", "luz",
"lye", "lym", "maa", "mac", "mad", "mae", "mag", "mak", "mal", "mam",
"man", "map", "mar", "mas", "mat", "maw", "max", "may", "med", "mee",
"meg", "meh", "mel", "mem", "men", "mes", "met", "meu", "mew", "mho",
"mib", "mic", "mid", "mig", "mil", "mim", "mir", "mis", "mix", "miz",
"mna", "moa", "mob", "moc", "mod", "moe", "mog", "moi", "mol", "mom",
"mon", "wit", "moo", "mop", "mor", "mos", "mot", "mou", "mow", "moy",
"moz", "mud", "mug", "mum", "mun", "mus", "mut", "mux", "myc", "nab",
"nae", "nag", "nah", "nam", "nan", "nap", "nas", "nat", "naw", "nay",
"neb", "ned", "nee", "nef", "neg", "nek", "nep", "net", "new", "nib",
"nid", "nie", "nil", "nim", "nip", "nis", "nit", "nix", "nob", "nod",
"nog", "noh", "nom", "non", "noo", "nor", "nos", "not", "now", "nox",
"noy", "nth", "nub", "nun", "nur", "nus", "nut", "nye", "nys", "oaf",
"oak", "oar", "oat", "oba", "obe", "obi", "obo", "obs", "oca", "och",
"oda", "odd", "ode", "ods", "oes", "off", "oft", "ohm", "oho", "ohs",
"oik", "oil", "ois", "oka", "oke", "old", "ole", "olm", "oms", "one",
"ono", "ons", "ony", "oof", "ooh", "oom", "oon", "oop", "oor", "oos",
"oot", "ope", "ops", "opt", "ora", "orb", "orc", "ord", "ore", "orf",
"ors", "ort", "ose", "oud", "ouk", "oup", "our", "ous", "out", "ova",
"owe", "owl", "own", "owt", "oxo", "oxy", "oye", "oys", "pac", "pad",
"pah", "pal", "pam", "pan", "pap", "par", "pas", "pat", "pav", "paw",
"pax", "pay", "pea", "pec", "ped", "pee", "peg", "peh", "pel", "pen",
"pep", "per", "pes", "pet", "pew", "phi", "pho", "pht", "pia", "pic",
"pie", "pig", "pin", "pip", "pir", "pis", "pit", "piu", "pix", "plu",
"ply", "poa", "pod", "poh", "poi", "pol", "pom", "poo", "pop", "pos",
"pot", "pow", "pox", "poz", "pre", "pro", "pry", "psi", "pst", "pub",
"pud", "pug", "puh", "pul", "pun", "pup", "pur", "pus", "put", "puy",
"pya", "pye", "pyx", "qat", "qis", "qua", "qin", "rad", "rag", "rah",
"rai", "raj", "ram", "ran", "rap", "ras", "rat", "rav", "raw", "rax",
"ray", "reb", "rec", "red", "ree", "ref", "reg", "reh", "rei", "rem",
"ren", "reo", "rep", "res", "ret", "rev", "rew", "rex", "rez", "rho",
"rhy", "ria", "rib", "rid", "rif", "rig", "rim", "rin", "rip", "rit",
"riz", "rob", "roc", "rod", "roe", "rok", "rom", "roo", "rot", "row",
"rub", "ruc", "rud", "rue", "rug", "rum", "run", "rut", "rya", "rye",
"sab", "sac", "sad", "sae", "sag", "sai", "sal", "sam", "san", "sap",
"sar", "sat", "sau", "sav", "saw", "sax", "say", "SAY", "saz", "sea",
"sec", "sed", "see", "seg", "sei", "sel", "sen", "ser", "set", "sew",
"sex", "sey", "sez", "sha", "she", "shh", "shy", "sib", "sic", "sif",
"sik", "sim", "sin", "sip", "sir", "sis", "sit", "six", "ska", "ski",
"sky", "sly", "sma", "sny", "sob", "soc", "sod", "sog", "soh", "sol",
"som", "son", "sop", "sos", "sot", "sou", "sov", "sow", "sox", "soy",
"soz", "spa", "spy", "sri", "sty", "sub", "sud", "sue", "sug", "sui",
"suk", "sum", "sun", "sup", "suq", "sur", "sus", "swy", "sye", "syn",
"tab", "tad", "tae", "tag", "tai", "taj", "tak", "tam", "tan", "tao",
"tap", "tar", "tas", "tat", "tau", "tav", "taw", "tax", "tay", "tea",
"tec", "ted", "tee", "tef", "teg", "tel", "ten", "tes", "tet", "tew",
"tex", "the", "tho", "thy", "tic", "tid", "tie", "tig", "tik", "til",
"tin", "tip", "tis", "tit", "tix", "toc", "tod", "toe", "tog", "tom",
"ton", "too", "top", "tor", "tot", "tow", "toy", "try", "tsk", "tub",
"tug", "tui", "tum", "tun", "tup", "tut", "tux", "twa", "two", "twp",
"tye", "tyg", "udo", "uds", "uey", "ufo", "ugh", "ugs", "uke", "ule",
"ulu", "umm", "ump", "ums", "umu", "uni", "uns", "upo", "ups", "urb",
"urd", "ure", "urn", "urp", "use", "uta", "ute", "uts", "utu", "uva",
"vac", "vae", "vag", "van", "var", "vas", "vat", "vau", "vav", "vaw",
"vee", "veg", "vet", "vex", "via", "vid", "vie", "vig", "vim", "vin",
"vis", "vly", "voe", "vol", "vor", "vow", "vox", "vug", "vum", "wab",
"wad", "wae", "wag", "wai", "wan", "wap", "war", "was", "wat", "waw",
"wax", "way", "web", "wed", "wee", "wem", "wen", "wet", "wex", "wey",
"wha", "who", "why", "wig", "win", "wis", "wit", "wiz", "woe", "wof",
"wog", "wok", "won", "woo", "wop", "wos", "wot", "wow", "wox", "wry",
"wud", "wus", "wye", "wyn", "xis", "yad", "yae", "yag", "yah", "yak",
"yam", "yap", "yar", "yaw", "yay", "yea", "yeh", "yen", "yep", "yes",
"yet", "yew", "yex", "ygo", "yid", "yin", "yip", "yob", "yod", "yok",
"yom", "yon", "you", "yow", "yug", "yuk", "yum", "yup", "yus", "zag",
"zap", "zas", "zax", "zea", "zed", "zee", "zek", "zel", "zep", "zex",
"zho", "zig", "zin", "zip", "zit", "ziz", "zoa", "zol", "zoo", "zos",
"zuz", "zzz");
--!pp on
-- re-enable gnatpp formatting
end Password_Manager;
|
30,323
|
ada
| 1
|
LaudateCorpus1/RosettaCodeData
|
Task/Levenshtein-distance/Ada/levenshtein-distance.ada
|
<filename>Task/Levenshtein-distance/Ada/levenshtein-distance.ada
with Ada.Text_IO;
procedure Main is
function Levenshtein_Distance (S, T : String) return Natural is
D : array (0 .. S'Length, 0 .. T'Length) of Natural;
begin
for I in D'Range (1) loop
D (I, 0) := I;
end loop;
for I in D'Range (2) loop
D (0, I) := I;
end loop;
for J in T'Range loop
for I in S'Range loop
if S (I) = T (J) then
D (I, J) := D (I - 1, J - 1);
else
D (I, J) :=
Natural'Min
(Natural'Min (D (I - 1, J) + 1, D (I, J - 1) + 1),
D (I - 1, J - 1) + 1);
end if;
end loop;
end loop;
return D (S'Length, T'Length);
end Levenshtein_Distance;
begin
Ada.Text_IO.Put_Line
("kitten -> sitting:" &
Integer'Image (Levenshtein_Distance ("kitten", "sitting")));
Ada.Text_IO.Put_Line
("rosettacode -> raisethysword:" &
Integer'Image (Levenshtein_Distance ("rosettacode", "raisethysword")));
end Main;
|
30,324
|
ada
| 0
|
reznikmm/webidl
|
source/lexer/webidl-scanners.ads
|
-- SPDX-FileCopyrightText: 2010-2021 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with WebIDL.Abstract_Sources;
with League.Strings;
with WebIDL.Scanner_Handlers;
with WebIDL.Tokens;
with WebIDL.Scanner_Types; use WebIDL.Scanner_Types;
package WebIDL.Scanners is
pragma Preelaborate;
subtype Token is WebIDL.Tokens.Token;
type Scanner is tagged limited private;
procedure Set_Source
(Self : in out Scanner'Class;
Source : not null WebIDL.Abstract_Sources.Source_Access);
procedure Set_Handler
(Self : in out Scanner'Class;
Handler : not null WebIDL.Scanner_Handlers.Handler_Access);
subtype Start_Condition is State;
procedure Set_Start_Condition
(Self : in out Scanner'Class; Condition : Start_Condition);
function Get_Start_Condition
(Self : Scanner'Class) return Start_Condition;
procedure Get_Token (Self : access Scanner'Class; Result : out Token);
function Get_Text
(Self : Scanner'Class) return League.Strings.Universal_String;
function Get_Token_Length (Self : Scanner'Class) return Positive;
function Get_Token_Position (Self : Scanner'Class) return Positive;
private
Buffer_Half_Size : constant := 2048;
subtype Buffer_Index is Positive range 1 .. 2 * Buffer_Half_Size;
type Character_Class_Array is array (Buffer_Index) of Character_Class;
Error_Character : constant Character_Class := 0;
Error_State : constant State := State'Last;
type Buffer_Half is (Low, High);
type Buffer_Offset is array (Buffer_Half) of Natural;
type Scanner is tagged limited record
Handler : WebIDL.Scanner_Handlers.Handler_Access;
Source : WebIDL.Abstract_Sources.Source_Access;
Start : State := INITIAL;
Next : Buffer_Index := 1;
From : Buffer_Index := 1;
To : Natural := 0;
Rule : Scanner_Types.Rule_Index;
Offset : Buffer_Offset := (0, 0);
Buffer : Wide_Wide_String (Buffer_Index) :=
(1 => Wide_Wide_Character'Val (WebIDL.Abstract_Sources.End_Of_Buffer),
others => <>);
Classes : Character_Class_Array := (1 => Error_Character, others => <>);
end record;
procedure Read_Buffer (Self : in out Scanner'Class);
end WebIDL.Scanners;
|
30,325
|
ada
| 0
|
Vovanium/Encodings
|
source/encodings-line_endings.ads
|
<filename>source/encodings-line_endings.ads
package Encodings.Line_Endings is
pragma Pure;
end Encodings.Line_Endings;
|
30,326
|
ada
| 3
|
charlie5/aIDE
|
source/adam-parameter.adb
|
<gh_stars>1-10
with
AdaM.Factory;
package body AdaM.Parameter
is
-- Storage Pool
--
record_Version : constant := 1;
max_Parameters : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"parameters",
max_Parameters,
record_Version,
Parameter.item,
Parameter.view);
-- Vector
--
function to_Source (the_Parameters : in Vector) return text_Vectors.Vector
is
use ada.Containers;
the_Source : text_Vectors.Vector;
begin
for i in 1 .. the_Parameters.Length
loop
the_Source.append (the_Parameters.Element (Integer (i)).to_Source);
if i /= the_Parameters.Length
then
the_Source.append (+";");
end if;
end loop;
return the_Source;
end to_Source;
-- Forge
--
procedure define (Self : in out Item; Name : in String)
is
begin
Self.Name := +Name;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Parameter (Name : in String := "") return View
is
new_View : constant Parameter.view := Pool.new_Item;
begin
define (Parameter.item (new_View.all), Name);
return new_View;
end new_Parameter;
procedure free (Self : in out Parameter.view)
is
begin
destruct (Parameter.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
function Name (Self : in Item) return String
is
begin
return +Self.Name;
end Name;
procedure Name_is (Self : in out Item; Now : in String)
is
begin
Self.Name := +Now;
end Name_is;
function Mode (Self : in Item) return a_Mode
is
begin
return Self.Mode;
end Mode;
procedure Mode_is (Self : in out Item; Now : in a_Mode)
is
begin
Self.Mode := Now;
end Mode_is;
function my_Type (Self : access Item) return access a_Type.view -- access Text
is
begin
return Self.my_Type'Access;
end my_Type;
function my_Type (Self : in Item) return a_Type.view
is
begin
return Self.my_Type;
end my_Type;
procedure Type_is (Self : in out Item; Now : in a_Type.view)
is
begin
Self.my_Type := Now;
end Type_is;
function Default (Self : in Item) return String
is
begin
return +Self.Default;
end Default;
procedure Default_is (Self : in out Item; Now : in String)
is
begin
Self.Default := +Now;
end Default_is;
function to_Source (Self : in Item) return text_Vectors.Vector
is
the_Source : text_Vectors.Vector;
function mode_Text return String
is
use Parameter;
begin
if Self.Mode = in_Mode then return "in";
elsif Self.Mode = out_Mode then return "out";
elsif Self.Mode = in_out_Mode then return "in out";
elsif Self.Mode = access_Mode then return "access";
end if;
raise Program_Error;
end mode_Text;
begin
the_Source.append ((+Self.Name) & " : " & mode_Text & " " & (+(+Self.my_Type.Name)));
if Self.Default /= ""
then
the_Source.append (+" := " & (+Self.Default));
end if;
return the_Source;
end to_Source;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.Parameter;
|
30,327
|
ada
| 1
|
LaudateCorpus1/RosettaCodeData
|
Task/Multiplicative-order/Ada/multiplicative-order-3.ada
|
<filename>Task/Multiplicative-order/Ada/multiplicative-order-3.ada
with Ada.Text_IO, Multiplicative_Order;
procedure Main is
package IIO is new Ada.Text_IO.Integer_IO(Integer);
use Multiplicative_Order;
begin
IIO.Put(Find_Order(3,10));
IIO.Put(Find_Order(37,1000));
IIO.Put(Find_Order(37,10_000));
IIO.Put(Find_Order(37, 3343));
IIO.Put(Find_Order(37, 3344));
-- IIO.Put(Find_Order( 2,1000));
--would raise Program_Error, because there is no I with 2**I=1 mod 1000
Ada.Text_IO.New_Line;
IIO.Put(Find_Order(3, (2,5))); -- 3 * 5 = 10
IIO.Put(Find_Order(37, (8, 125))); -- 8 * 125 = 1000
IIO.Put(Find_Order(37, (16, 625))); -- 16 * 625 = 10_000
IIO.Put(Find_Order(37, (1 => 3343))); -- 1-element-array: 3343 is a prime
IIO.Put(Find_Order(37, (11, 19, 16))); -- 11 * 19 * 16 = 3344
-- this violates the precondition, because 8 and 2 are not coprime
-- it gives an incorrect result
IIO.Put(Find_Order(37, (11, 19, 8, 2)));
end Main;
|
30,328
|
ada
| 1
|
ytomino/vampire
|
source/vampire-r3-preview_page.adb
|
<reponame>ytomino/vampire
-- The Village of Vampire by YT, このソースコードはNYSLです
procedure Vampire.R3.Preview_Page (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Forms.Root_Form_Type'Class;
Template : in String;
Image_Directory : in String;
Village_Id : in Tabula.Villages.Village_Id;
Village : in Villages.Village_Type;
Message : in Villages.Message;
User_Id : in String;
User_Password : in String)
is
procedure Handle (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Tag : in String;
Contents : in Web.Producers.Template) is
begin
if Tag = "action_page" then
Forms.Write_Attribute_Name (Output, "action");
Forms.Write_Link (
Output,
Form,
Current_Directory => ".",
Resource => Forms.Self,
Parameters =>
Form.Parameters_To_Village_Page (
Village_Id => Village_Id,
User_Id => User_Id,
User_Password => <PASSWORD>));
elsif Tag = "villagename" then
Forms.Write_In_HTML (
Output,
Form,
Village.Name.Constant_Reference);
elsif Tag = "speech" then
Handle_Speech (
Output,
Contents,
Form => Form,
Current_Directory => ".",
Image_Directory => Image_Directory,
Face_Width => Village.Face_Width,
Face_Height => Village.Face_Height,
Subject => Village.People.Constant_Reference (Message.Subject),
Text => Message.Text.Constant_Reference,
Time => Message.Time,
Filter => "");
elsif Tag = "value_kind" then
Forms.Write_Attribute_Name (Output, "value");
Forms.Write_Attribute_Open (Output);
Forms.Write_In_Attribute (
Output,
Form,
Villages.Message_Kind'Image (Message.Kind));
Forms.Write_Attribute_Close (Output);
elsif Tag = "value_text" then
Forms.Write_Attribute_Name (Output, "value");
Forms.Write_Attribute_Open (Output);
Forms.Write_In_Attribute (Output, Form, Message.Text.Constant_Reference);
Forms.Write_Attribute_Close (Output);
elsif Tag = "longer" then
if Message.Text.Length > Villages.Max_Length_Of_Message then
Web.Producers.Produce (Output, Contents);
end if;
elsif Tag = "ok" then
if Message.Text.Length <= Villages.Max_Length_Of_Message then
Web.Producers.Produce (Output, Contents, Handler => Handle'Access); -- rec
end if;
else
Raise_Unknown_Tag (Tag);
end if;
end Handle;
begin
Web.Producers.Produce (Output, Read (Template), Handler => Handle'Access);
end Vampire.R3.Preview_Page;
|
30,329
|
ada
| 0
|
JCGobbi/Nucleo-STM32G474RE
|
bb-runtimes/examples/monitor/tms570ls31x/hdk.adb
|
<filename>bb-runtimes/examples/monitor/tms570ls31x/hdk.adb
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2013-2020, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
pragma Warnings (Off);
with System.Machine_Reset;
pragma Warnings (On);
with Interfaces; use Interfaces;
with System;
with Commands; use Commands;
with Console; use Console;
with Dumps; use Dumps;
with Term; use Term;
package body Hdk is
function Get_SCTLR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c1, c0, 0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_SCTLR;
procedure Set_SCTLR (Val : Unsigned_32) is
begin
Asm ("mcr p15, 0, %0, c1, c0, 0",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_SCTLR;
function Get_ACTLR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c1, c0, 1",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_ACTLR;
procedure Set_ACTLR (Val : Unsigned_32) is
begin
Asm ("mcr p15, 0, %0, c1, c0, 1",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_ACTLR;
function Get_MPUIR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c0, c0, 4",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_MPUIR;
procedure Set_RGNR (Val : Unsigned_32) is
begin
Asm ("mcr p15, 0, %0, c6, c2, 0",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_RGNR;
procedure Set_DRBAR (Val : Unsigned_32) is
begin
Asm ("mcr p15, 0, %0, c6, c1, 0",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_DRBAR;
function Get_DRBAR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c6, c1, 0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_DRBAR;
procedure Set_DRSR (Val : Unsigned_32) is
begin
Asm ("mcr p15, 0, %0, c6, c1, 2",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_DRSR;
function Get_DRSR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c6, c1, 2",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_DRSR;
DRSR_E : constant := 1; -- Enable
procedure Set_DRACR (Val : Unsigned_32) is
begin
Asm ("mcr p15, 0, %0, c6, c1, 4",
Inputs => Unsigned_32'Asm_Input ("r", Val),
Volatile => True);
end Set_DRACR;
function Get_DRACR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c6, c1, 4",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_DRACR;
AP_NO_NO : constant := 16#0_00#;
AP_RW_NO : constant := 16#1_00#;
AP_RW_RO : constant := 16#2_00#;
AP_RW_RW : constant := 16#3_00#;
AP_RO_NO : constant := 16#5_00#;
AP_RO_RO : constant := 16#6_00#;
DRACR_XN : constant := 16#1000#; -- Execute never
function Get_DFSR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c5, c0, 0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_DFSR;
function Get_DFAR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c6, c0, 0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_DFAR;
function Get_ADFSR return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mrc p15, 0, %0, c5, c1, 0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_ADFSR;
procedure Dsb is
begin
Asm ("dsb", Volatile => True, Clobber => "memory");
end Dsb;
procedure Isb is
begin
Asm ("isb", Volatile => True, Clobber => "memory");
end Isb;
procedure Dmb is
begin
Asm ("dmb", Volatile => True, Clobber => "memory");
end Dmb;
procedure Enable_Btcm_Ecc is
Val : Unsigned_32;
begin
Val := Get_ACTLR;
Val := Val or 16#0C00_0000#;
Dmb;
Set_ACTLR (Val);
Isb;
end Enable_Btcm_Ecc;
procedure Disable_Btcm_Ecc is
Val : Unsigned_32;
begin
Val := Get_ACTLR;
Val := Val and not 16#0C00_0000#;
Dmb;
Set_ACTLR (Val);
Isb;
end Disable_Btcm_Ecc;
procedure Disable_Mpu is
V : Unsigned_32;
begin
V := Get_SCTLR;
Dsb;
V := V and not 1;
Set_SCTLR (V);
Isb;
end Disable_Mpu;
procedure Enable_Mpu is
V : Unsigned_32;
begin
V := Get_SCTLR;
Dsb;
V := V or 1;
Set_SCTLR (V);
Isb;
end Enable_Mpu;
procedure Disable_Background_Region is
V : Unsigned_32;
Br : constant := 16#2_0000#;
begin
V := Get_SCTLR;
V := V and not Br;
Set_SCTLR (V);
end Disable_Background_Region;
procedure Enable_Background_Region is
V : Unsigned_32;
Br : constant := 16#2_0000#;
begin
V := Get_SCTLR;
V := V or Br;
Set_SCTLR (V);
end Enable_Background_Region;
procedure Mpu_Setup_Region (Num : Unsigned_32;
Base : Unsigned_32;
Acc : Unsigned_32;
Sz : Unsigned_32) is
begin
Set_RGNR (Num);
Set_DRBAR (Base);
Set_DRACR (Acc);
Set_DRSR (Sz);
end Mpu_Setup_Region;
procedure Init_Mpu is
SZ_512B : constant := 2 * 16#08#;
SZ_4GB : constant := 2 * 16#1f#;
SZ_256KB : constant := 2 * 16#11#;
SZ_4MB : constant := 2 * 16#15#;
SZ_8MB : constant := 2 * 16#16#;
SZ_16MB : constant := 2 * 16#17#;
SZ_64MB : constant := 2 * 16#19#;
SZ_128MB : constant := 2 * 16#1a#;
B : constant := 1;
C : constant := 2;
S : constant := 4;
TEX_NC : constant := 2#001_0_00#;
pragma Unreferenced (B, C, S);
pragma Unreferenced (SZ_64MB, SZ_128MB, TEX_NC);
begin
Disable_Mpu;
Disable_Background_Region;
Mpu_Setup_Region (0, 16#0000_0000#, 16#1008#, 16#ff_01# + SZ_4GB);
Mpu_Setup_Region (1, 16#0000_0000#, 16#608#, 16#ff_01# + SZ_4MB);
Mpu_Setup_Region (2, 16#0800_0000#, 16#308#, 16#ff_01# + SZ_256KB);
Mpu_Setup_Region (3, 16#0840_0000#, 16#308#, 16#ff_01# + SZ_256KB);
Mpu_Setup_Region (5, 16#8000_0000#, 16#300#, 16#ff_01# + SZ_8MB);
Mpu_Setup_Region (6, 16#f000_0000#, 16#1208#, 16#ff_01# + SZ_8MB);
Mpu_Setup_Region (7, 16#fc00_0000#, 16#1310#, 16#ff_01# + SZ_16MB);
Mpu_Setup_Region (8, 16#fe00_0000#, 16#1310#, 16#ff_01# + SZ_512B);
Mpu_Setup_Region (9, 16#ff00_0000#, 16#1310#, 16#ff_2f# + SZ_16MB);
Enable_Background_Region;
Enable_Mpu;
end Init_Mpu;
procedure Init_Iomm is
KICK_REG0 : Unsigned_32;
for KICK_REG0'Address use System'To_Address (16#ffff_ea38#);
pragma Volatile (KICK_REG0);
pragma Import (Ada, KICK_REG0);
KICK_REG1 : Unsigned_32;
for KICK_REG1'Address use System'To_Address (16#ffff_ea3c#);
pragma Volatile (KICK_REG1);
pragma Import (Ada, KICK_REG1);
PINMMR : array (0 .. 31) of Unsigned_32;
for PINMMR'Address use System'To_Address (16#ffff_eb10#);
pragma Volatile_Components (PINMMR);
pragma Import (Ada, PINMMR);
GPREG1 : Unsigned_32;
for GPREG1'Address use System'To_Address (16#ffff_ffa0#);
pragma Volatile (GPREG1);
pragma Import (Ada, GPREG1);
begin
KICK_REG0 := 16#83E7_0B13#;
KICK_REG1 := 16#95A4_F1E0#;
PINMMR (1) := 2**17 + 2**25; -- DATA4, DATA5
PINMMR (2) := 2**9; -- DATA6
PINMMR (3) := 2**1 + 2**25; -- DATA7, DATA8
PINMMR (4) := 2**9; -- DATA9
PINMMR (5) := 2**25; -- DATA10
PINMMR (6) := 2**9 + 2**25; -- DATA11, DATA12
PINMMR (7) := 2**1 + 2**25; -- DATA13, DATA14
PINMMR (8) := 2**25; -- DATA15
null;
PINMMR (10) := 2**9 + 2**16 + 2**25; -- DATA3, CS0, DATA2
PINMMR (11) := 2**0 + 2**8 + 2**17; -- CS3, CS4, DATA1
PINMMR (12) := 2**9; -- DATA0
PINMMR (14) := 2**16 + 2**24; -- nWE, BA1
PINMMR (15) := 2**0 + 2**8 + 2**16 + 2**24; -- A21, A20, A19, A18
PINMMR (16) := 2**1 + 2**8 + 2**16; -- BA0, A17, A16
PINMMR (17) := 2**9 + 2**25; -- nDQM1, A5
PINMMR (18) := 2**0 + 2**16; -- A15, A14
PINMMR (19) := 2**1 + 2**17 + 2**25; -- A4, nDQM0, A3
PINMMR (20) := 2**0 + 2**8 + 2**24; -- A13, A12, A11
PINMMR (21) := 2**0 + 2**16 + 2**24; -- A1, A10, A9
PINMMR (22) := 2**0 + 2**8 + 2**16 + 2**25; -- A0, A7, A6, A2
PINMMR (23) := 2**0; -- A8
PINMMR (29) := 0; -- 2**8; -- CLK_SEL
KICK_REG0 := 0;
KICK_REG1 := 0;
GPREG1 := GPREG1 or 2**31;
end Init_Iomm;
procedure Init_Emif is
SDCR : Unsigned_32;
for SDCR'Address use System'To_Address (16#fcff_e808#);
pragma Volatile (SDCR);
pragma Import (Ada, SDCR);
SDRCR : Unsigned_32;
for SDRCR'Address use System'To_Address (16#fcff_e80c#);
pragma Volatile (SDRCR);
pragma Import (Ada, SDRCR);
SDTIMR : Unsigned_32;
for SDTIMR'Address use System'To_Address (16#fcff_e820#);
pragma Volatile (SDTIMR);
pragma Import (Ada, SDTIMR);
SDSRETR : Unsigned_32;
for SDSRETR'Address use System'To_Address (16#fcff_e83c#);
pragma Volatile (SDSRETR);
pragma Import (Ada, SDSRETR);
begin
-- EMIF CLK = VCLK3 = HCLK/2 90Mhz (ie ~12ns)
-- IS42S16400F: 4 Banks, 16Bits
-- Procedure B of 17.2.5.5 is followed
-- 1. Configure the desired EMIF_CLK
-- Already done.
-- 2. Program SDTIMR and SDSRETR to satisdy the timing requirement
-- Formula DataSheet Value
-- T_RFC >= (tRFC x fEMIF_CLK) - 1 tRC = 63ns 5
-- T_RP >= (tRP x fEMIF_CLK) - 1 tRP = 20ns 1
-- T_RCD >= (tRCD x fEMIF_CLK) - 1 tRCD = 20ns 1
-- T_WR >= (tWR x fEMIF_CLK) - 1 tRDL = 2CLK 1
-- T_RAS >= (tRAS x fEMIF_CLK) - 1 tRAS = 42ns 3
-- T_RC >= (tRC x fEMIF_CLK) - 1 tRC = 63ns 5
-- T_RRD >= (tRRD x fEMIF_CLK) - 1 tRRD = 14ns 1
SDTIMR := 2#00101_001_0_001_0_001_0011_0101_0_001_0000#;
-- Self refresh
-- T_XS >= (tXSR x fEMIF_CLK) - 1 tRC = 63ns 5
SDSRETR := 5;
-- 3. Program the RR field of SDRCR such as:
-- (RR * 8) / fEMIF_CLK > 200us
-- -> RR = 2084
SDRCR := 2084;
-- 4. Program SDCR to match the characteristics of the SDRAM device
-- SDRAM configuration
-- SR = 0, NM = 1, CL = 3, BIT11_9LOCK = 1, IBANK=2, PAGESIZE=0
SDCR := 2#0_0000000_00000000_0_1_0_0_011_1_0_010_0_000#;
-- 5. Perform a read from the SDRAM
declare
Tmp : Unsigned_32;
for Tmp'Address use System'To_Address (16#8000_0000#);
pragma Import (Ada, Tmp);
pragma Volatile (Tmp);
V : Unsigned_32;
pragma Unreferenced (V);
begin
V := Tmp;
end;
-- 6. Finally program the RR field to match that of the attached device
-- Refresh control
-- RR <= fEMIF_CLK x tRefresh Period / ncycles
-- tREF = 64ms, ncycles = 4096 -> RR = 1302
SDRCR := 1302;
end Init_Emif;
procedure Proc_Mpu is
MPUIR : constant Unsigned_32 := Get_MPUIR;
Nbr_DReg : constant Unsigned_32 := (MPUIR / 2**8) and 16#ff#;
begin
Next_Word;
if End_Pos > Line_Len then
Put_Line ("MPUIR: " & Image8 (MPUIR));
Put_Line ("Rg Base Sz");
if Nbr_DReg > 0 then
for I in 0 .. Nbr_DReg - 1 loop
Set_RGNR (I);
declare
DRSR : constant Unsigned_32 := Get_DRSR;
Sz : Unsigned_32;
Base : constant Unsigned_32 := Get_DRBAR;
DRACR : constant Unsigned_32 := Get_DRACR;
begin
if (DRSR and DRSR_E) /= 0 then
Put (Image2 (I));
Put (": ");
Put (Image8 (Base));
Put ('-');
Sz := Shift_Left (1, Natural ((DRSR / 2) and 16#1f#)) - 1;
Sz := 2 * Sz + 1;
Put (Image8 (Base + Sz));
Put (' ');
Put (Image8 (DRSR));
Put (' ');
Put (Image8 (DRACR));
Put (' ');
Put_Bit ((DRACR and DRACR_XN) = 0, 'X');
Put (' ');
case DRACR and 16#7_00# is
when AP_NO_NO => Put ("--/--");
when AP_RW_NO => Put ("RW/--");
when AP_RW_RO => Put ("RW/RO");
when AP_RW_RW => Put ("RW/RW");
when AP_RO_NO => Put ("RO/--");
when AP_RO_RO => Put ("RO/RO");
when others => Put ("??/??");
end case;
Put (' ');
if (DRACR and 2#100_0_0_0#) /= 0 then
Put ("Outer ");
case DRACR and 2#011_0_0_0# is
when 2#000_0_0_0# => Put ("NC");
when 2#001_0_0_0# => Put ("WB+WA");
when 2#010_0_0_0# => Put ("WT+noWA");
when 2#011_0_0_0# => Put ("WB+noWA");
when others => Put ("???");
end case;
Put (", Inner ");
case DRACR and 2#011_0_0_0# is
when 2#000_0_0_0# => Put ("NC");
when 2#000_0_0_1# => Put ("WB+WA");
when 2#000_0_1_0# => Put ("WT+noWA");
when 2#000_0_1_1# => Put ("WB+noWA");
when others => Put ("???");
end case;
else
case DRACR and 2#011_0_1_1# is -- TEX + C + B
when 2#000_0_0_0# => Put ("Strongly ordered");
when 2#000_0_0_1# => Put ("Shareable device");
when 2#000_0_1_0# => Put ("WT, no WA");
when 2#000_0_1_1# => Put ("WB, no WA");
when 2#001_0_0_0# => Put ("Non-cacheable");
when 2#001_0_0_1# => Put ("Reserved");
when 2#001_0_1_0# => Put ("Implementation defined");
when 2#001_0_1_1# => Put ("WB, WA");
when 2#010_0_0_0# => Put ("Non-shareable device");
when 2#010_0_0_1#
| 2#010_0_1_0#
| 2#010_0_1_1# => Put ("Reserved");
when 2#011_0_0_0#
| 2#011_0_0_1#
| 2#011_0_1_0#
| 2#011_0_1_1# => Put ("Shareable device");
when others => Put ("???");
end case;
end if;
New_Line;
end if;
end;
end loop;
end if;
elsif Line (Pos .. End_Pos) = "init" then
Init_Mpu;
else
Put_Line ("unknown mpu command");
end if;
end Proc_Mpu;
procedure Proc_Sysesr is
SYS_SYSESR : Unsigned_32;
for SYS_SYSESR'Address use System'To_Address (16#ffff_ffe4#);
pragma Volatile (SYS_SYSESR);
pragma Import (Ada, SYS_SYSESR);
PORST : constant := 2**15;
OSCRST : constant := 2**14;
WDRST : constant := 2**13;
CPURST : constant := 2**5;
SWRST : constant := 2**4;
EXTRST : constant := 2**3;
SYSESR : constant Unsigned_32 := SYS_SYSESR;
begin
Put ("Reset status:");
if (SYSESR and PORST) /= 0 then
Put (" Power-On");
end if;
if (SYSESR and OSCRST) /= 0 then
Put (" Oscillator");
end if;
if (SYSESR and WDRST) /= 0 then
Put (" Watchdog");
end if;
if (SYSESR and CPURST) /= 0 then
Put (" CPU");
end if;
if (SYSESR and SWRST) /= 0 then
Put (" Software");
end if;
if (SYSESR and EXTRST) /= 0 then
Put (" External");
end if;
New_Line;
SYS_SYSESR := SYSESR;
end Proc_Sysesr;
type Handler_Context is record
R0 : Unsigned_32;
R1 : Unsigned_32;
R2 : Unsigned_32;
R3 : Unsigned_32;
R4 : Unsigned_32;
R5 : Unsigned_32;
R6 : Unsigned_32;
R7 : Unsigned_32;
R8 : Unsigned_32;
R9 : Unsigned_32;
R10 : Unsigned_32;
R11 : Unsigned_32;
R12 : Unsigned_32;
LR : Unsigned_32;
end record;
pragma Convention (C, Handler_Context);
type Handler_Context_Acc is access all Handler_Context;
pragma Convention (C, Handler_Context_Acc);
procedure Data_Abort_Handler (Ctxt : Handler_Context_Acc);
pragma Export (C, Data_Abort_Handler);
pragma Warnings (Off);
procedure Force_Dabt_Handler;
pragma Import (Asm, Force_Dabt_Handler);
Reference_To_Force_Dabt_Handler : System.Address :=
Force_Dabt_Handler'Address;
pragma Volatile (Reference_To_Force_Dabt_Handler);
pragma Unreferenced (Reference_To_Force_Dabt_Handler);
pragma Warnings (On);
procedure Data_Abort_Handler (Ctxt : Handler_Context_Acc) is
DFSR : constant Unsigned_32 := Get_DFSR;
begin
New_Line;
Put_Line ("*** DATA Abort ***");
Put ("R0: ");
Put (Image8 (Ctxt.R0));
Put (" R1: ");
Put (Image8 (Ctxt.R1));
Put (" R2: ");
Put (Image8 (Ctxt.R2));
Put (" R3: ");
Put (Image8 (Ctxt.R3));
New_Line;
Put ("R4: ");
Put (Image8 (Ctxt.R4));
Put (" R5: ");
Put (Image8 (Ctxt.R5));
Put (" R6: ");
Put (Image8 (Ctxt.R6));
Put (" R7: ");
Put (Image8 (Ctxt.R7));
New_Line;
Put ("R8: ");
Put (Image8 (Ctxt.R8));
Put (" R9: ");
Put (Image8 (Ctxt.R9));
Put (" R10: ");
Put (Image8 (Ctxt.R10));
Put (" R11: ");
Put (Image8 (Ctxt.R11));
New_Line;
Put ("PC: ");
Put (Image8 (Ctxt.LR));
New_Line;
Put ("DFSR: ");
Put (Image8 (DFSR));
Put (' ');
case (DFSR and 16#0f#) or Shift_Right (DFSR and 16#400#, 6) is
when 2#00001# => Put ("alignment");
when 2#00000# => Put ("background");
when 2#01101# => Put ("permission");
when 2#01000# => Put ("sync external abort");
when 2#10110# => Put ("async external abort");
when 2#11001# => Put ("sync parity/ECC error");
when 2#11000# => Put ("async parity/ECC error");
when 2#00010# => Put ("debug");
when others => Put ("?unknown?");
end case;
Put (" ADFSR: ");
Put (Image8 (Get_ADFSR));
Put (" DFAR: ");
Put (Image8 (Get_DFAR));
New_Line;
New_Line;
System.Machine_Reset.Stop;
end Data_Abort_Handler;
procedure Proc_Tcram is
TCRAM1_RAMCTRL : Unsigned_32;
for TCRAM1_RAMCTRL'Address use System'To_Address (16#ffff_f800#);
pragma Volatile (TCRAM1_RAMCTRL);
pragma Import (Ada, TCRAM1_RAMCTRL);
TCRAM2_RAMCTRL : Unsigned_32;
for TCRAM2_RAMCTRL'Address use System'To_Address (16#ffff_f900#);
pragma Volatile (TCRAM2_RAMCTRL);
pragma Import (Ada, TCRAM2_RAMCTRL);
begin
Next_Word;
if End_Pos > Line_Len then
Put_Line ("tcram");
elsif Line (Pos .. End_Pos) = "ecc" then
Enable_Btcm_Ecc;
elsif Line (Pos .. End_Pos) = "noecc" then
Disable_Btcm_Ecc;
elsif Line (Pos .. End_Pos) = "roecc" then
-- Disable write to ECC RAM.
TCRAM1_RAMCTRL := 16#005_000a#;
TCRAM2_RAMCTRL := 16#005_000a#;
elsif Line (Pos .. End_Pos) = "rwecc" then
-- Enable write to ECC RAM.
TCRAM1_RAMCTRL := 16#005_010a#;
TCRAM2_RAMCTRL := 16#005_010a#;
else
Put_Line ("Unknown subcommand");
end if;
end Proc_Tcram;
procedure Put_Bit (Val : Unsigned_32; M_0 : String; M_1 : String) is
begin
if Val = 0 then
Put ("0: ");
Put (M_0);
else
Put ("1: ");
Put (M_1);
end if;
end Put_Bit;
procedure Proc_SCTLR is
SCTLR : constant Unsigned_32 := Get_SCTLR;
begin
Put ("SCTLR: ");
Put_Line (Image8 (SCTLR));
Put ("IE: endian: ");
Put_Bit (SCTLR and 2**31, "little", "big");
New_Line;
Put ("TE: exception generation: ");
Put_Bit (SCTLR and 2**30, "arm", "thumb");
New_Line;
Put ("AFE: access flag enable: ");
Put_Bit (SCTLR and 2**29, "", "");
New_Line;
Put ("TRE: TEX remap enable: ");
Put_Bit (SCTLR and 2**28, "", "");
New_Line;
Put ("NMFI: non-maskable FIRQ: ");
Put_Bit (SCTLR and 2**27, "yes", "no");
New_Line;
Put ("EE: CPSR E bit set to: ");
Put_Bit (SCTLR and 2**25, "", "");
New_Line;
Put ("VE: exception vector address: ");
Put_Bit (SCTLR and 2**24, "at fixed address", "provided by VIC");
New_Line;
Put ("FI: fast interrupt enable: ");
Put_Bit (SCTLR and 2**21, "no", "yes");
New_Line;
Put ("DZ: divide by zero: ");
Put_Bit (SCTLR and 2**19, "no exception", "undefined exception");
New_Line;
Put ("BR: MPU background region: ");
Put_Bit (SCTLR and 2**17, "no", "yes");
New_Line;
Put ("RR: replacement strategy for cache: ");
Put_Bit (SCTLR and 2**14, "random", "round-robin");
New_Line;
Put ("V: exception vector: ");
Put_Bit (SCTLR and 2**13, "0x00000000", "0xffff0000");
New_Line;
Put ("I: L1 I-cache: ");
Put_Bit (SCTLR and 2**12, "disabled", "enabled");
New_Line;
Put ("Z: branch prediction: ");
Put_Bit (SCTLR and 2**11, "disabled", "enabled");
New_Line;
Put ("C: L1 D-cache: ");
Put_Bit (SCTLR and 2**2, "disabled", "enabled");
New_Line;
Put ("A: struct alignment fault checking: ");
Put_Bit (SCTLR and 2**1, "disabled", "enabled");
New_Line;
Put ("M: MPU: ");
Put_Bit (SCTLR and 2**1, "disabled", "enabled");
New_Line;
end Proc_SCTLR;
procedure Proc_ACTLR is
ACTLR : constant Unsigned_32 := Get_ACTLR;
begin
Put ("ACTLR: ");
Put_Line (Image8 (ACTLR));
Put ("DICDI: case C dual issue: ");
Put_Bit (ACTLR and 2**31, "enable", "disable");
New_Line;
Put ("DIB2DI: case B2 dual issue: ");
Put_Bit (ACTLR and 2**30, "enable", "disable");
New_Line;
Put ("DIB1DI: case B1 dual issue: ");
Put_Bit (ACTLR and 2**29, "enable", "disable");
New_Line;
Put ("DIADI: case A dual issue: ");
Put_Bit (ACTLR and 2**28, "enable", "disable");
New_Line;
Put ("B1TCMPCEN: B1TCM parity/ECC check: ");
Put_Bit (ACTLR and 2**27, "disabled", "enabled");
New_Line;
Put ("B0TCMPCEN: B0TCM parity/ECC check: ");
Put_Bit (ACTLR and 2**26, "disabled", "enabled");
New_Line;
Put ("ATCMPCEN: ATCM parity/ECC check: ");
Put_Bit (ACTLR and 2**25, "disabled", "enabled");
New_Line;
Put ("AXISCEN: AXI slave cache RAM access: ");
Put_Bit (ACTLR and 2**24, "disabled", "enabled");
New_Line;
Put ("AXISCUEN: AXI slave cache RAM user access: ");
Put_Bit (ACTLR and 2**23, "disabled", "enabled");
New_Line;
Put ("DILSM: low interrupt latency on load/store multiple: ");
Put_Bit (ACTLR and 2**22, "enable", "disable");
New_Line;
Put ("DEOLP: end of loop prediction: ");
Put_Bit (ACTLR and 2**21, "enable", "disable");
New_Line;
Put ("DBHE: branch history: ");
Put_Bit (ACTLR and 2**20, "enable", "disable");
New_Line;
Put ("FRCDIS: fetch rate control: ");
Put_Bit (ACTLR and 2**19, "enable", "disable");
New_Line;
Put ("RSDIS: return stack: ");
Put_Bit (ACTLR and 2**17, "enable", "disable");
New_Line;
-- ??? BP
Put ("DBWR: write burst in the AXI master: ");
Put_Bit (ACTLR and 2**14, "enable", "disable");
New_Line;
Put ("DLFO: linefill optimization in the AXI master: ");
Put_Bit (ACTLR and 2**13, "enable", "disable");
New_Line;
Put ("ERPEG: random parity error generation: ");
Put_Bit (ACTLR and 2**12, "disabled", "enabled");
New_Line;
Put ("DNCH: data forwarding for NC accesses in the AXI master: ");
Put_Bit (ACTLR and 2**11, "enable", "disable");
New_Line;
Put ("FORA: force outer read allocate for OWA regions: ");
Put_Bit (ACTLR and 2**10, "disabled", "enabled");
New_Line;
Put ("FWT: force write-throught for write-back regions: ");
Put_Bit (ACTLR and 2**9, "disabled", "enabled");
New_Line;
Put ("FDSnS: force data side to not-shared when MPU is off: ");
Put_Bit (ACTLR and 2**8, "disabled", "enabled");
New_Line;
Put ("sMOV: sMOV out of order: ");
Put_Bit (ACTLR and 2**7, "enabled", "disabled");
New_Line;
Put ("DILS: low interrupt latency on all load/store insns: ");
Put_Bit (ACTLR and 2**6, "enable", "disable");
New_Line;
-- ??? CEC
Put ("B1TCMECEN: B1TCM external error: ");
Put_Bit (ACTLR and 2**2, "disabled", "enabled");
New_Line;
Put ("B0TCMECEN: B0TCM external error: ");
Put_Bit (ACTLR and 2**1, "disabled", "enabled");
New_Line;
Put ("ATCMECEN: ATCM external error: ");
Put_Bit (ACTLR and 2**0, "disabled", "enabled");
New_Line;
end Proc_ACTLR;
Commands : aliased Command_List :=
(5,
((new String'("mpu [init] - Display or initialize MPU config"),
Proc_Mpu'Access),
(new String'("sysesr - Display and clear reset cause"),
Proc_Sysesr'Access),
(new String'("sctlr - Display SCTLR"),
Proc_SCTLR'Access),
(new String'("actlr - Display ACTLR"),
Proc_ACTLR'Access),
(new String'("tcram [ecc | noecc] - Display BTCRAM"),
Proc_Tcram'Access)),
null);
begin
Register_Commands (Commands'Access);
-- Setup sdram
Init_Iomm;
Init_Emif;
end Hdk;
|
30,330
|
ada
| 0
|
ray2501/ada-adapcre
|
tests/my_tests.ads
|
with Ahven.Framework;
package My_Tests is
type Test is new Ahven.Framework.Test_Case with null record;
procedure Initialize (T : in out Test);
procedure PCRE_MATCH;
procedure PCRE_MATCH2;
end My_Tests;
|
30,331
|
ada
| 0
|
caqg/linux-home
|
.emacs.d/elpa/wisi-2.1.1/wisitoken-bnf-output_elisp.adb
|
-- Abstract :
--
-- Output Elisp code implementing the grammar defined by the parameters.
--
-- Copyright (C) 2012 - 2015, 2017 - 2019 Free Software Foundation, Inc.
--
-- The WisiToken package is free software; you can redistribute it
-- and/or modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or
-- (at your option) any later version. This library is distributed in
-- the hope that it will be useful, but WITHOUT ANY WARRANTY; without
-- even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-- PARTICULAR PURPOSE.
--
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with Ada.Text_IO; use Ada.Text_IO;
with WisiToken.BNF.Generate_Utils;
with WisiToken.BNF.Output_Elisp_Common;
with WisiToken.Generate.Packrat;
with WisiToken.Parse.LR;
with WisiToken_Grammar_Runtime;
procedure WisiToken.BNF.Output_Elisp
(Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Elisp_Package : in String;
Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data;
Packrat_Data : in WisiToken.Generate.Packrat.Data;
Tuple : in Generate_Tuple)
is
pragma Unreferenced (Packrat_Data);
procedure Action_Table (Table : in WisiToken.Parse.LR.Parse_Table; Descriptor : in WisiToken.Descriptor)
is
use WisiToken.Parse.LR;
begin
Put (" [");
for State in Table.States'Range loop
if State = Table.States'First then
Put ("(");
else
Put (" (");
end if;
Put ("(default . error)");
declare
Action : Action_Node_Ptr := Table.States (State).Action_List;
begin
loop
declare
Parse_Action_Node : Parse_Action_Node_Ptr := Action.Action;
Conflict : constant Boolean := Parse_Action_Node.Next /= null;
begin
Put (" (" & Image (Action.Symbol, Descriptor) & " . ");
if Conflict then
Put ("(");
end if;
loop
declare
Parse_Action : Parse_Action_Rec renames Parse_Action_Node.Item;
begin
case Parse_Action.Verb is
when Accept_It =>
Put ("accept");
when Error =>
Put ("error");
when Reduce =>
Put
("(" & Image (Parse_Action.Production.LHS, Descriptor) & " ." &
Integer'Image (Parse_Action.Production.RHS) & ")");
when Shift =>
Put (State_Index'Image (Parse_Action.State));
end case;
if Parse_Action_Node.Next = null then
if Conflict then
Put (")");
end if;
Put (")");
exit;
else
Put (" ");
Parse_Action_Node := Parse_Action_Node.Next;
end if;
end;
end loop;
end;
Action := Action.Next;
if Action.Next = null then
if Action.Action.Item.Verb /= Error then
raise SAL.Programmer_Error with "state" &
State_Index'Image (State) & ": default action is not error";
end if;
-- let default handle it
Action := null;
end if;
if Action = null then
if State = Table.States'Last then
Put (")");
else
Put_Line (")");
end if;
exit;
end if;
end loop;
end;
end loop;
Put_Line ("]");
end Action_Table;
procedure Goto_Table (Table : in WisiToken.Parse.LR.Parse_Table; Descriptor : in WisiToken.Descriptor)
is
use WisiToken.Parse.LR;
subtype Nonterminals is Token_ID range Descriptor.First_Nonterminal .. Descriptor.Last_Nonterminal;
function Count_Nonterminals (List : in Goto_Node_Ptr) return Integer
is
Item : Goto_Node_Ptr := List;
Count : Integer := 0;
begin
while Item /= null loop
if Symbol (Item) in Nonterminals then
Count := Count + 1;
end if;
Item := Next (Item);
end loop;
return Count;
end Count_Nonterminals;
begin
Put (" [");
for State in Table.States'Range loop
declare
Nonterminal_Count : constant Integer := Count_Nonterminals (Table.States (State).Goto_List);
Gotos : Goto_Node_Ptr := Table.States (State).Goto_List;
begin
if Nonterminal_Count = 0 then
if State = Table.States'First then
Put_Line ("nil");
else
if State = Table.States'Last then
Put (" nil");
else
Put_Line (" nil");
end if;
end if;
else
if State = Table.States'First then
Put ("(");
else
Put (" (");
end if;
loop
if Symbol (Gotos) in Nonterminals then
Put ("(" & Image (Symbol (Gotos), Descriptor) & " ." &
State_Index'Image (Parse.LR.State (Gotos)) & ")");
end if;
Gotos := Next (Gotos);
exit when Gotos = null;
end loop;
if State = Table.States'Last then
Put (")");
else
Put_Line (")");
end if;
end if;
end;
end loop;
Put ("]");
end Goto_Table;
procedure Output
(Elisp_Package : in String;
Tokens : in WisiToken.BNF.Tokens;
Parser : in WisiToken.Parse.LR.Parse_Table_Ptr;
Descriptor : in WisiToken.Descriptor)
is
use Ada.Strings.Unbounded;
use Ada.Containers; -- count_type
Rule_Length : constant Count_Type := Tokens.Rules.Length;
Rule_Count : Count_Type := 1;
RHS_Length : Count_Type;
RHS_Count : Count_Type;
begin
Put_Line ("(defconst " & Elisp_Package & "-elisp-parse-table");
Put_Line (" (wisi-compile-grammar");
-- nonterminal productions
Put (" '((");
for Rule of Tokens.Rules loop
if Rule_Count = 1 then
Put ("(");
else
Put (" (");
end if;
Put_Line (-Rule.Left_Hand_Side);
RHS_Length := Rule.Right_Hand_Sides.Length;
RHS_Count := 1;
for RHS of Rule.Right_Hand_Sides loop
Put (" ((");
for Token of RHS.Tokens loop
Put (-Token.Identifier & " ");
end loop;
if Length (RHS.Action) = 0 then
Put (")");
else
Put_Line (")");
Put (" " & (-RHS.Action));
end if;
if RHS_Count = RHS_Length then
Put (")");
else
Put_Line (")");
end if;
RHS_Count := RHS_Count + 1;
end loop;
if Rule_Count = Rule_Length then
Put (")");
else
Put_Line (")");
end if;
Rule_Count := Rule_Count + 1;
end loop;
Put_Line (")");
Action_Table (Parser.all, Descriptor);
Goto_Table (Parser.all, Descriptor);
Put_Line ("))");
Put_Line (" ""Parser table."")");
end Output;
procedure Create_Elisp (Algorithm : in LR_Generate_Algorithm)
is
use Ada.Strings.Unbounded;
File : File_Type;
Elisp_Package_1 : constant String :=
(case Algorithm is
when LALR => Elisp_Package & "-lalr",
when LR1 => Elisp_Package & "-lr1");
begin
Create (File, Out_File, Elisp_Package_1 & "-elisp.el");
Set_Output (File);
Put_Line (";;; " & Elisp_Package_1 & "-elisp.el --- Generated parser support file -*- lexical-binding:t -*-");
Put_Command_Line (Elisp_Comment & " ", Use_Tuple => True, Tuple => Tuple);
Put_Raw_Code (Elisp_Comment, Input_Data.Raw_Code (Copyright_License));
Put_Raw_Code (Elisp_Comment, Input_Data.Raw_Code (Actions_Spec_Context));
New_Line;
Put_Line ("(require 'wisi)");
Put_Line ("(require 'wisi-compile)");
Put_Line ("(require 'wisi-elisp-parse)");
New_Line;
Output_Elisp_Common.Indent_Keyword_Table
(Elisp_Package_1, "elisp", Input_Data.Tokens.Keywords, To_String'Access);
New_Line;
Output_Elisp_Common.Indent_Token_Table (Elisp_Package_1, "elisp", Input_Data.Tokens.Tokens, To_String'Access);
New_Line;
Output (Elisp_Package_1, Input_Data.Tokens, Generate_Data.LR_Parse_Table, Generate_Data.Descriptor.all);
New_Line;
Put_Line ("(provide '" & Elisp_Package_1 & "-elisp)");
Put_Line (";; end of file");
Close (File);
Set_Output (Standard_Output);
end Create_Elisp;
begin
Create_Elisp (Tuple.Gen_Alg);
if WisiToken.Trace_Generate > 0 then
WisiToken.BNF.Generate_Utils.Put_Stats (Input_Data, Generate_Data);
end if;
end WisiToken.BNF.Output_Elisp;
|
30,332
|
ada
| 0
|
orb-zhuchen/Orb
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-timsta.adb
|
<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . T I M E _ S T A M P --
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces.C; use Interfaces.C;
package body GNAT.Time_Stamp is
subtype time_stamp is char_array (0 .. 22);
type time_stamp_ptr is access all time_stamp;
-- The desired ISO 8601 string format has exactly 22 characters. We add
-- one additional character for '\0'. The indexing starts from zero to
-- accommodate the C layout.
procedure gnat_current_time_string (Value : time_stamp_ptr);
pragma Import (C, gnat_current_time_string, "__gnat_current_time_string");
------------------
-- Current_Time --
------------------
function Current_Time return String is
Result : aliased time_stamp;
begin
gnat_current_time_string (Result'Unchecked_Access);
Result (22) := nul;
return To_Ada (Result);
end Current_Time;
end GNAT.Time_Stamp;
|
30,333
|
ada
| 1
|
charlie5/lace-alire
|
1-base/lace/source/events/mixin/xgc/lace-make_observer-deferred.ads
|
with
lace.Event;
private
with
ada.Containers.indefinite_Vectors,
ada.Containers.indefinite_hashed_Maps,
ada.Strings.Hash;
generic
type T is abstract new lace.make_Observer.item with private;
package lace.make_Observer.deferred
--
-- Makes a user class T into a deferred event Observer.
--
is
pragma remote_Types;
type Item is abstract limited new T with private;
type View is access all Item'Class;
overriding
procedure destroy (Self : in out Item);
-------------
-- Operations
--
overriding
procedure receive (Self : access Item; the_Event : in Event.item'Class := Event.null_Event;
from_Subject : in Event.subject_Name);
overriding
procedure respond (Self : access Item);
private
----------------
-- Event Vectors
--
use type Event.item;
package event_Vectors is new ada.Containers.indefinite_Vectors (Positive, Event.item'Class);
subtype event_Vector is event_Vectors.Vector;
type event_Vector_view is access all event_Vector;
--------------
-- Safe Events
--
protected
type safe_Events
is
procedure add (the_Event : in Event.item'Class);
procedure fetch (all_Events : out event_Vector);
private
the_Events : event_Vector;
end safe_Events;
type safe_Events_view is access all safe_Events;
------------------------------
-- Subject Maps of safe Events
--
use type event_Vector;
package subject_Maps_of_safe_events is new ada.Containers.indefinite_hashed_Maps (Key_type => Event.subject_Name,
Element_type => safe_Events_view,
Hash => ada.Strings.Hash,
equivalent_Keys => "=");
subtype subject_Map_of_safe_events is subject_Maps_of_safe_events.Map;
-----------------------
-- Subject Events Pairs
--
type String_view is access all String;
type subject_events_Pair is
record
Subject : String_view;
Events : event_Vector;
end record;
type subject_events_Pairs is array (Positive range <>) of subject_events_Pair;
----------------------------------
-- safe Subject Map of safe Events
--
protected
type safe_subject_Map_of_safe_events
is
procedure add (the_Event : in Event.item'Class;
from_Subject : in String);
procedure fetch (all_Events : out subject_events_Pairs;
Count : out Natural);
procedure free;
private
the_Map : subject_Map_of_safe_events;
end safe_subject_Map_of_safe_events;
----------------
-- Observer Item
--
type Item is abstract limited new T with
record
pending_Events : safe_subject_Map_of_safe_events;
end record;
end lace.make_Observer.deferred;
|
30,334
|
ada
| 0
|
fuzzysloth/ada-awa
|
awa/plugins/awa-storages/src/awa-storages-stores-databases.ads
|
<reponame>fuzzysloth/ada-awa
-----------------------------------------------------------------------
-- awa-storages-stores-databases -- Database store
-- Copyright (C) 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO.Sessions;
with AWA.Storages.Models;
-- === Database store ===
-- The `AWA.Storages.Stores.Databases` store uses the database to save a data content.
-- The data is saved in a specific table in a database blob column.
-- The database store uses another store service to temporarily save the data content
-- in a local file when the application needs a file access to the data.
package AWA.Storages.Stores.Databases is
-- ------------------------------
-- Storage Service
-- ------------------------------
type Database_Store is new AWA.Storages.Stores.Store with record
Tmp : AWA.Storages.Stores.Store_Access;
end record;
-- Save the file represented by the `Path` variable into a store and associate that
-- content with the storage reference represented by `Into`.
procedure Save (Storage : in Database_Store;
Session : in out ADO.Sessions.Master_Session;
Into : in out AWA.Storages.Models.Storage_Ref'Class;
Path : in String);
procedure Load (Storage : in Database_Store;
Session : in out ADO.Sessions.Session'Class;
From : in AWA.Storages.Models.Storage_Ref'Class;
Into : in out AWA.Storages.Storage_File);
-- Create a storage
procedure Create (Storage : in Database_Store;
Session : in out ADO.Sessions.Master_Session;
From : in AWA.Storages.Models.Storage_Ref'Class;
Into : in out AWA.Storages.Storage_File);
-- Delete the content associate with the storage represented by `From`.
procedure Delete (Storage : in Database_Store;
Session : in out ADO.Sessions.Master_Session;
From : in out AWA.Storages.Models.Storage_Ref'Class);
end AWA.Storages.Stores.Databases;
|
30,335
|
ada
| 15
|
AdaCore/training_material
|
extern/game_support/stm32f4/src/driver.adb
|
<filename>extern/game_support/stm32f4/src/driver.adb
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with Screen_Interface;
with Railroad;
package body Driver is
----------------
-- Controller --
----------------
task body Controller is
Period : constant Time_Span := Milliseconds (60);
-- arbitrary, but directly affects how fast the trains move
-- and how quickly the screen responds to touch
Next_Start : Time := Clock + Seconds (1);
Current : Screen_Interface.Touch_State;
Previous : Screen_Interface.Touch_State;
begin
delay until Next_Start;
Screen_Interface.Initialize;
Railroad.Initialize;
Current := Screen_Interface.Get_Touch_State;
Previous := Current;
loop
Current := Screen_Interface.Get_Touch_State;
if Current.Touch_Detected /= Previous.Touch_Detected then
if Current.Touch_Detected then
Railroad.On_Touch ((Current.X, Current.Y));
end if;
Previous := Current;
end if;
Railroad.Simulation_Step;
Railroad.Draw;
Next_Start := Next_Start + Period;
delay until Next_Start;
end loop;
end Controller;
end Driver;
|
30,336
|
ada
| 88
|
VVCAS-Sean/OpenUxAS
|
src/ada/src/services/spark/afrl-cmasi-automationresponse-spark_boundary.ads
|
with Common_Formal_Containers; use Common_Formal_Containers;
package AFRL.CMASI.AutomationResponse.SPARK_Boundary with SPARK_Mode is
pragma Annotate (GNATprove, Terminating, SPARK_Boundary);
function Get_WaypointEntity_Set
(Response : AutomationResponse) return Int64_Set
with Global => null;
end AFRL.CMASI.AutomationResponse.SPARK_Boundary;
|
30,337
|
ada
| 0
|
caqg/linux-home
|
.emacs.d/elpa/wisi-3.0.1/recover_stats.adb
|
-- Abstract :
--
-- Summarize error recover log.
--
-- Copyright (C) 2019 <NAME> All Rights Reserved.
--
-- This program is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU General Public License for more details. You
-- should have received a copy of the GNU General Public License
-- distributed with this program; see file COPYING. If not, write to
-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston,
-- MA 02110-1335, USA.
pragma License (GPL);
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Long_Float_Text_IO;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Traceback.Symbolic;
with SAL.Gen_Stats.Gen_Image;
with SAL.Long_Float_Stats;
with WisiToken.Parse.LR;
procedure Recover_Stats
is
subtype Strategies is WisiToken.Parse.LR.Strategies;
File : File_Type;
Delimiters : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set (",() ");
Number : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set ("0123456789");
type Strategy_Counts is array (Strategies) of Natural;
type Recover_Label is (Full, Partial);
type Recover_Summary is record
Event_Count : Integer := 0;
-- 1 per recover event (1 line in log file)
Enqueue_Stats : SAL.Long_Float_Stats.Stats_Type;
Check_Stats : SAL.Long_Float_Stats.Stats_Type;
Strat_Counts_Total : Strategy_Counts := (others => 0);
Strat_Counts_Present : Strategy_Counts := (others => 0);
-- 1 per recover event if used
Ignore_Error : Integer := 0;
-- ie, error is name mismatch.
Recover_Count_Present : Integer := 0;
-- 1 per parser in recover result
Recover_Count_Total : Integer := 0;
-- Sum of all strategy counts
Fail_Event_Count : Integer := 0; -- for all reasons
Fail_Enqueue_Limit : Integer := 0;
Fail_No_Configs_Left : Integer := 0;
Fail_Programmer_Error : Integer := 0;
Fail_Other : Integer := 0;
end record;
Summary : array (Recover_Label) of Recover_Summary;
begin
Open (File, In_File, Ada.Command_Line.Argument (1));
loop
exit when End_Of_File (File);
declare
-- The recover log is written by code in
-- wisitoken-parse-lr-parser.adb Parse (search for Recover_Log).
--
-- A line has the syntax:
-- yyyy-mm-dd hh:mm:ss <partial> <success> pre_parser_count '<file_name>' (<parser_data>)...
--
-- where there is one (<parser_data) for each parser active after recover. <parser_data> is:
--
-- (<strategy_counts>) <enqueue_count> <check_count> <success>
--
-- Note that the per-parser success is always TRUE; it would not be
-- active if recover had failed.
Line : constant String := Get_Line (File);
First : Integer := Index (Line, " "); -- after date
Last : Integer;
Label : Recover_Label := Full;
function Line_Eq (Item : in String) return Boolean
is begin
return Line (First .. First + Item'Length - 1) = Item;
end Line_Eq;
function Next_Integer return Integer
is begin
Find_Token
(Line, Number,
From => Last + 1,
Test => Ada.Strings.Inside,
First => First,
Last => Last);
return Integer'Value (Line (First .. Last));
exception
when Constraint_Error =>
raise Constraint_Error with "bad integer '" & Line (First .. Last - 1) & "' " &
Ada.Text_IO.Count'Image (Ada.Text_IO.Line (File) - 1) & First'Image & Last'Image;
end Next_Integer;
function Next_Boolean return Boolean
is begin
First := Last + 2;
Last := -1 + Index (Line, Delimiters, First);
return Boolean'Value (Line (First .. Last));
end Next_Boolean;
function Read_Strat_Counts (Strategy_Found : out Boolean) return Strategy_Counts
is begin
Strategy_Found := False;
Last := Index (Line, "(", Last + 1);
return Result : Strategy_Counts do
for I in Strategies loop
Result (I) := Next_Integer;
if Result (I) > 0 then
Strategy_Found := True;
end if;
end loop;
Last := 1 + Index (Line, ")", Last + 1);
end return;
end Read_Strat_Counts;
begin
First := Index (Line, " ", First + 1); -- after time
Last := Index (Line, " ", First + 1); -- after Partial_Parse_Active
if Boolean'Value (Line (First + 1 .. Last - 1)) then
Label := Partial;
end if;
Summary (Label).Event_Count := Summary (Label).Event_Count + 1;
First := Last + 1;
if Line (First .. First + 3) = "FAIL" then
Summary (Label).Fail_Event_Count := Summary (Label).Fail_Event_Count + 1;
First := First + 4;
if Line_Eq ("NO_CONFIGS_LEFT") then
Summary (Label).Fail_No_Configs_Left := Summary (Label).Fail_No_Configs_Left + 1;
elsif Line_Eq ("ENQUEUE_LIMIT") then
Summary (Label).Fail_Enqueue_Limit := Summary (Label).Fail_Enqueue_Limit + 1;
elsif Line_Eq ("PROGRAMMER_ERROR") then
Summary (Label).Fail_Programmer_Error := Summary (Label).Fail_Programmer_Error + 1;
else
Summary (Label).Fail_Other := Summary (Label).Fail_Other + 1;
end if;
else
-- Process per-parser data
Last := Index (Line, "(", Last + 1);
loop
exit when Line (Last + 1) = ')';
declare
Strategy_Found : Boolean;
Strat_Counts : constant Strategy_Counts := Read_Strat_Counts (Strategy_Found);
Enqueue_Count : constant Integer := Next_Integer;
Check_Count : constant Integer := Next_Integer;
Success : constant Boolean := Next_Boolean;
pragma Unreferenced (Success);
begin
Summary (Label).Recover_Count_Present := Summary (Label).Recover_Count_Present + 1;
if not Strategy_Found then
Summary (Label).Ignore_Error := Summary (Label).Ignore_Error + 1;
else
-- We don't include Ignore_Error enqueue and check counts in the
-- stats, because they distort them towards 1.
Summary (Label).Enqueue_Stats.Accumulate (Long_Float (Enqueue_Count));
Summary (Label).Check_Stats.Accumulate (Long_Float (Check_Count));
for I in Strategies loop
Summary (Label).Recover_Count_Total :=
Summary (Label).Recover_Count_Total + Strat_Counts (I);
Summary (Label).Strat_Counts_Total (I) :=
Summary (Label).Strat_Counts_Total (I) + Strat_Counts (I);
if Strat_Counts (I) > 0 then
Summary (Label).Strat_Counts_Present (I) := Summary (Label).Strat_Counts_Present (I) + 1;
end if;
end loop;
end if;
end;
end loop;
end if;
end;
end loop;
declare
use Ada.Strings;
Label_Field : String (1 .. 23); -- fits strategy and fail labels
Count_Field : String (1 .. 8);
Percent_Field : String (1 .. 4);
-- Shared by Put_If, Put_Percent
procedure Put_If
(Summary_Label : in Recover_Label;
Name : in String;
Count : in Integer;
Always : in Boolean := False)
is
Percent_Present : constant Integer :=
Integer (100.0 * Float (Count) / Float (Summary (Summary_Label).Event_Count));
begin
if Count > 0 or Always then
Move (Name, Label_Field); Put (Label_Field & " => ");
Move (Count'Image, Count_Field, Justify => Right); Put (Count_Field);
Move (Percent_Present'Image & "%", Percent_Field, Justify => Right); Put_Line (Percent_Field);
end if;
end Put_If;
package Stats_Image is new SAL.Long_Float_Stats.Gen_Image
(Real_IO => Ada.Long_Float_Text_IO,
Default_Mean_Fore => 7,
Default_Mean_Aft => 0,
Default_Mean_Exp => 0,
Default_Sd_Fore => 7,
Default_Sd_Aft => 1,
Default_Sd_Exp => 0);
procedure Put_Percent (Summary_Label : in Recover_Label; Present, Total : in Integer; Name : in String)
is
Percent_Present : constant Integer :=
Integer (100.0 * Float (Present) / Float (Summary (Summary_Label).Recover_Count_Present));
Percent_Total : constant Integer :=
Integer (100.0 * Float (Total) / Float (Summary (Summary_Label).Recover_Count_Total));
begin
Move (Name, Label_Field); Put (Label_Field);
Move (Present'Image, Count_Field, Justify => Right); Put (Count_Field);
Move (Percent_Present'Image & "%", Percent_Field, Justify => Right); Put (Percent_Field & " /");
Move (Total'Image, Count_Field, Justify => Right); Put (Count_Field);
Move (Percent_Total'Image & "%", Percent_Field, Justify => Right); Put_Line (Percent_Field);
end Put_Percent;
begin
for I in Recover_Label loop
Put_Line (I'Image);
Put_Line ("present/total:" & Summary (I).Event_Count'Image & " /" & Summary (I).Recover_Count_Total'Image);
if Summary (I).Event_Count > 0 then
Put_Line (" mean std. dev. min max");
Put_Line ("Enqueue: " & Stats_Image.Image (Summary (I).Enqueue_Stats.Display));
Put_Line ("Check: " & Stats_Image.Image (Summary (I).Check_Stats.Display));
Put_If (I, "FAIL", Summary (I).Fail_Event_Count, Always => True);
Put_If (I, "FAIL_ENQUEUE_LIMIT", Summary (I).Fail_Enqueue_Limit);
Put_If (I, "FAIL_NO_CONFIGS_LEFT", Summary (I).Fail_No_Configs_Left);
Put_If (I, "FAIL_PROGRAMMER_ERROR", Summary (I).Fail_Programmer_Error);
Put_If (I, "FAIL_OTHER", Summary (I).Fail_Other);
for J in Strategies loop
Put_Percent
(I,
Summary (I).Strat_Counts_Present (J),
Summary (I).Strat_Counts_Total (J),
J'Image);
end loop;
Put_Percent (I, Summary (I).Ignore_Error, Summary (I).Ignore_Error, "Ignore_Error");
end if;
New_Line;
end loop;
end;
exception
when E : others =>
Put_Line (Ada.Exceptions.Exception_Name (E) & ": " & Ada.Exceptions.Exception_Message (E));
Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E));
end Recover_Stats;
|
30,338
|
ada
| 1
|
brucegua/moocos
|
tools/scitools/conf/understand/ada/ada05/a-coorma.ads
|
<filename>tools/scitools/conf/understand/ada/ada05/a-coorma.ads
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . O R D E R E D _ M A P S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
--
--
--
--
--
--
--
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
with Ada.Containers.Red_Black_Trees;
with Ada.Finalization;
with Ada.Streams;
generic
type Key_Type is private;
type Element_Type is private;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Ordered_Maps is
pragma Preelaborate;
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
type Map is tagged private;
pragma Preelaborable_Initialization (Map);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
No_Element : constant Cursor;
function "=" (Left, Right : Map) return Boolean;
function Length (Container : Map) return Count_Type;
function Is_Empty (Container : Map) return Boolean;
procedure Clear (Container : in out Map);
function Key (Position : Cursor) return Key_Type;
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element
(Container : in out Map;
Position : Cursor;
New_Item : Element_Type);
procedure Query_Element
(Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type));
procedure Update_Element
(Container : in out Map;
Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert
(Container : in out Map;
Key : Key_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
procedure Include
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
procedure Replace
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
procedure Exclude (Container : in out Map; Key : Key_Type);
procedure Delete (Container : in out Map; Key : Key_Type);
procedure Delete (Container : in out Map; Position : in out Cursor);
procedure Delete_First (Container : in out Map);
procedure Delete_Last (Container : in out Map);
function First (Container : Map) return Cursor;
function First_Element (Container : Map) return Element_Type;
function First_Key (Container : Map) return Key_Type;
function Last (Container : Map) return Cursor;
function Last_Element (Container : Map) return Element_Type;
function Last_Key (Container : Map) return Key_Type;
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
function Previous (Position : Cursor) return Cursor;
procedure Previous (Position : in out Cursor);
function Find (Container : Map; Key : Key_Type) return Cursor;
function Element (Container : Map; Key : Key_Type) return Element_Type;
function Floor (Container : Map; Key : Key_Type) return Cursor;
function Ceiling (Container : Map; Key : Key_Type) return Cursor;
function Contains (Container : Map; Key : Key_Type) return Boolean;
function Has_Element (Position : Cursor) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
function ">" (Left, Right : Cursor) return Boolean;
function "<" (Left : Cursor; Right : Key_Type) return Boolean;
function ">" (Left : Cursor; Right : Key_Type) return Boolean;
function "<" (Left : Key_Type; Right : Cursor) return Boolean;
function ">" (Left : Key_Type; Right : Cursor) return Boolean;
procedure Iterate
(Container : Map;
Process : not null access procedure (Position : Cursor));
procedure Reverse_Iterate
(Container : Map;
Process : not null access procedure (Position : Cursor));
private
type Node_Type;
type Node_Access is access Node_Type;
type Node_Type is limited record
Parent : Node_Access;
Left : Node_Access;
Right : Node_Access;
Color : Red_Black_Trees.Color_Type := Red_Black_Trees.Red;
Key : Key_Type;
Element : Element_Type;
end record;
package Tree_Types is new Red_Black_Trees.Generic_Tree_Types
(Node_Type,
Node_Access);
type Map is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
end record;
procedure Adjust (Container : in out Map);
procedure Finalize (Container : in out Map) renames Clear;
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
use Ada.Streams;
type Map_Access is access all Map;
for Map_Access'Storage_Size use 0;
type Cursor is record
Container : Map_Access;
Node : Node_Access;
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor);
for Cursor'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor);
for Cursor'Read use Read;
No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Map);
for Map'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Map);
for Map'Read use Read;
Empty_Map : constant Map :=
(Controlled with Tree => (First => null,
Last => null,
Root => null,
Length => 0,
Busy => 0,
Lock => 0));
end Ada.Containers.Ordered_Maps;
|
30,339
|
ada
| 1
|
Fabien-Chouteau/sdlada
|
src/sdl-log.ads
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, <NAME>
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Log
--
-- Message logging.
--------------------------------------------------------------------------------------------------------------------
package SDL.Log is
-- Messages longer than Max_Length will be truncated.
-- TODO: Import this from a C constant set from SDL_MAX_LOG_MESSAGE.
Max_Length : constant Integer := 4096;
-- Had to make this into a type with constants due to the abuse of
-- the C enumeration.
type Categories is range 0 .. 2 ** 32;
Application : constant Categories := 0;
Errors : constant Categories := 1;
Assert : constant Categories := 2;
System : constant Categories := 3;
Audio : constant Categories := 4;
Video : constant Categories := 5;
Render : constant Categories := 6;
Input : constant Categories := 7;
Test : constant Categories := 8;
-- Reserved categories.
Reserved_First : constant Categories := 9;
Reserved_Last : constant Categories := 18;
-- Custom categories.
subtype Custom_Categories is Categories range Reserved_Last .. Categories'Last;
type Priorities is (Verbose, Debug, Info, Warn, Error, Critical) with
Convention => C;
for Priorities use
(Verbose => 1,
Debug => 2,
Info => 3,
Warn => 4,
Error => 5,
Critical => 6);
-- Log a message with Category: Application and Priority: Info.
procedure Put (Message : in String) with
Inline => True;
procedure Put (Message : in String; Category : in Categories; Priority : in Priorities) with
Inline => True;
-- Log a message with Priority: Critical.
procedure Put_Critical (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Debug.
procedure Put_Debug (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Error.
procedure Put_Error (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Info.
procedure Put_Info (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Verbose.
procedure Put_Verbose (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Warn.
procedure Put_Warn (Message : in String; Category : in Categories := Application) with
Inline => True;
--
procedure Reset_Priorities with
Inline => True;
-- Set the priority of all the log categories to the given Priority.
procedure Set (Priority : in Priorities) with
Inline => True;
-- Set the the given log Category to the given Priority.
procedure Set (Category : in Categories; Priority : in Priorities) with
Inline => True;
-- Logging callbacks.
-- TODO: complete this.
-- I think this will require a bit more work. I think we will have to allocate a record
-- and store this in a container which gets destroyed on application shutdown before SDL quits.
type Root_User_Data is tagged null record;
type Output_Callback is access procedure
(User_Data : in Root_User_Data'Class;
Category : in Categories;
Priority : in Priorities;
Message : in String);
end SDL.Log;
|
30,340
|
ada
| 0
|
faelys/natools
|
src/natools-s_expressions-file_writers.adb
|
------------------------------------------------------------------------------
-- Copyright (c) 2014-2017, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
package body Natools.S_Expressions.File_Writers is
package Stream_IO renames Ada.Streams.Stream_IO;
overriding procedure Finalize (Object : in out Autoclose) is
begin
if Stream_IO.Is_Open (Object.File) then
Stream_IO.Close (Object.File);
end if;
end Finalize;
-------------------------
-- S-Expression Writer --
-------------------------
overriding procedure Write_Raw
(Output : in out Writer;
Data : in Ada.Streams.Stream_Element_Array) is
begin
Stream_IO.Write (Output.Holder.File, Data);
end Write_Raw;
function Create (Name : String; Form : String := "") return Writer is
begin
return Result : Writer do
Create (Result, Name, Form);
end return;
end Create;
function Open (Name : String; Form : String := "") return Writer is
begin
return Result : Writer do
Open (Result, Name, Form);
end return;
end Open;
procedure Create
(Self : in out Writer;
Name : in String;
Form : in String := "") is
begin
Finalize (Self.Holder);
Stream_IO.Create (Self.Holder.File, Stream_IO.Append_File, Name, Form);
end Create;
procedure Open
(Self : in out Writer;
Name : in String;
Form : in String := "") is
begin
Finalize (Self.Holder);
Stream_IO.Open (Self.Holder.File, Stream_IO.Append_File, Name, Form);
end Open;
function Open_Or_Create (Name : String; Form : String := "")
return Writer is
begin
return Result : Writer do
Open_Or_Create (Result, Name, Form);
end return;
end Open_Or_Create;
procedure Open_Or_Create
(Self : in out Writer;
Name : in String;
Form : in String := "") is
begin
Finalize (Self.Holder);
Open_Attempt :
begin
Stream_IO.Open (Self.Holder.File, Stream_IO.Append_File, Name, Form);
return;
exception
when Stream_IO.Name_Error => null;
end Open_Attempt;
Stream_IO.Create (Self.Holder.File, Stream_IO.Append_File, Name, Form);
end Open_Or_Create;
function Name (Self : Writer) return String is
begin
return Stream_IO.Name (Self.Holder.File);
end Name;
end Natools.S_Expressions.File_Writers;
|
30,341
|
ada
| 0
|
ventaquil/PW-Ada
|
src/pw.adb
|
with Ada.Text_IO;
use Ada.Text_IO;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
with Ada.Numerics.Discrete_Random;
use Ada.Numerics;
package body PW is
task body Semaphore is
Count: Natural;
begin
accept Initialize (N : in Natural) do
Count := N;
end Initialize;
loop
select
when Count > 0 =>
accept Wait do
Count := Count - 1;
end Wait;
or
accept Signal do
Count := Count + 1;
end Signal;
or
accept Try(Success : out Boolean) do
if Count > 0 then
Count := Count - 1;
Success := True;
else
Success := False;
end if;
end Try;
end select;
end loop;
end Semaphore;
task body PlaceSemaphore is
N : Integer := 1;
begin
loop
select
when N > 0 =>
accept Wait do
N := N - 1;
end Wait;
or
accept Signal;
N := N + 1;
end select;
end loop;
end PlaceSemaphore;
task body PrinterSemaphore is
N : Integer := 1;
begin
loop
select
when N > 0 =>
accept Wait do
N := N - 1;
end Wait;
or
accept Signal;
N := N + 1;
end select;
end loop;
end PrinterSemaphore;
function CarHiddenConstructor(Number : Integer) return Car is
begin
return (Number => Number, ToDistributor => -1, InDistributor => -1, GoToExit => False);
end CarHiddenConstructor;
function CarConstructor(Number : Integer; ca : CarActionAccess) return Car is
c : Car;
begin
c := CarHiddenConstructor(Number);
ca.Construct(c);
return c;
end CarConstructor;
type Rand_Range is new Integer range 1..5;
package Rand_Int is new Discrete_Random(Rand_Range);
task body CarAction is
C : Car;
Di : Integer;
DC : DistributorCollection;
Gen: Rand_Int.Generator;
begin
accept Construct(Cr : Car) do
C := Cr;
Rand_Int.Reset(Gen);
end Construct;
Data.GetDC(DC);
loop
if C.ToDistributor = -1 and C.InDistributor = -1 then
Di := FindEmptyDistributor(DC);
if Di /= -1 then
C.ToDistributor := Di;
PlaceSemaphore.Wait;
PrinterSemaphore.Wait;
Put("Car ");
Put(C.Number, 3);
Put(" goes to distributor ");
Put(Di, 1);
New_Line;
PrinterSemaphore.Signal;
end if;
else
if C.ToDistributor /= -1 then
delay Duration(Float(Integer(Rand_Int.Random(Gen))));
PrinterSemaphore.Wait;
Put("Car ");
Put(C.Number, 3);
Put(" in distributor ");
Put(C.ToDistributor, 1);
New_Line;
PrinterSemaphore.Signal;
PlaceSemaphore.Signal;
C.InDistributor := C.ToDistributor;
C.ToDistributor := -1;
end if;
if C.InDistributor /= -1 then
delay Duration(Float(Integer(Rand_Int.Random(Gen))));
PrinterSemaphore.Wait;
Put("Car ");
Put(C.Number, 3);
Put(" in distributor ");
Put(C.InDistributor, 1);
Put_Line(" is ready to go back");
PrinterSemaphore.Signal;
PlaceSemaphore.Wait;
PrinterSemaphore.Wait;
Put("Car ");
Put(C.Number, 3);
Put(" from distributor ");
Put(C.InDistributor, 1);
Put_Line(" goes to exit");
PrinterSemaphore.Signal;
DC.DC(C.InDistributor).S.Signal;
C.InDistributor := -1;
C.GoToExit := True;
end if;
if C.GoToExit then
delay Duration(Float(Integer(Rand_Int.Random(Gen))));
PrinterSemaphore.Wait;
Put("Car ");
Put(C.Number, 3);
Put_Line(" exit");
PrinterSemaphore.Signal;
PlaceSemaphore.Signal;
exit;
end if;
end if;
end loop;
end CarAction;
procedure Initialize(D : in out Distributor) is
begin
D.S := new Semaphore;
D.S.Initialize(1);
end Initialize;
procedure Initialize(DC : in out DistributorCollection) is
begin
for I in Integer range 1..3
loop
declare
D : Distributor;
begin
Initialize(D);
DC.DC(I) := D;
end;
end loop;
end Initialize;
function FindEmptyDistributor(DC : in DistributorCollection) return Integer is
Success : Boolean := False;
begin
for I in DC.DC'Range
loop
DC.DC(I).S.Try(Success);
if Success then
return I;
end if;
end loop;
return -1;
end;
function IncreaseIndex(Index : Integer) return Integer is
I : Integer;
begin
I := Index + 1;
if I = 4 then
I := 1;
end if;
return I;
end IncreaseIndex;
procedure Put(q : in out EntryQueue; c : in Car) is
tmp : Integer;
begin
if q.LastIndex = 0 then
q.FirstIndex := 1;
q.LastIndex := 1;
q.Queue(q.LastIndex) := c;
PrinterSemaphore.Wait;
Put("Car ");
Put(c.Number, 3);
Put(" on ");
Put(1, 1);
New_Line;
PrinterSemaphore.Signal;
else
tmp := IncreaseIndex(q.LastIndex);
if tmp /= q.FirstIndex then
q.LastIndex := tmp;
q.Queue(q.LastIndex) := c;
PrinterSemaphore.Wait;
Put("Car ");
Put(c.Number, 3);
Put(" on ");
Put(Size(q), 1);
New_Line;
PrinterSemaphore.Signal;
end if;
end if;
end Put;
procedure Pop(q : in out EntryQueue; c : out Car) is
zero : Boolean := False;
begin
if q.FirstIndex /= 0 then
if q.FirstIndex = q.LastIndex then
zero := True;
end if;
c := q.Queue(q.FirstIndex);
PrinterSemaphore.Wait;
Put("Car ");
Put(c.Number, 3);
Put(" off ");
Put(1, 1);
New_Line;
PrinterSemaphore.Signal;
if zero then
q.FirstIndex := 0;
q.LastIndex := 0;
else
q.FirstIndex := IncreaseIndex(q.FirstIndex);
end if;
end if;
end Pop;
procedure GetFirst(q : in out EntryQueue; c : out Car) is
begin
c := q.Queue(q.FirstIndex);
end GetFirst;
function Size(q : in EntryQueue) return Integer is
begin
if q.FirstIndex = 0 then
return 0;
else
if q.FirstIndex > q.LastIndex then
return q.LastIndex + 3 - q.FirstIndex + 1;
else
return q.LastIndex - q.FirstIndex + 1;
end if;
end if;
end Size;
task body SpawnCar is
Gen: Rand_Int.Generator;
EQ : EntryQueue;
Cars : Integer := 1;
C : Car;
CA : CarActionAccess;
begin
Rand_Int.Reset(Gen);
Data.GetQueue(EQ);
loop
delay Duration(Float(Integer(Rand_Int.Random(Gen))));
if Size(EQ) > 0 then
GetFirst(EQ, C);
if (C.ToDistributor /= -1) or (C.InDistributor /= -1) or C.GoToExit then
Pop(EQ, C);
end if;
end if;
if Size(EQ) < 3 then
CA := new CarAction;
C := CarConstructor(Cars, CA);
Put(EQ, C);
Cars := Cars + 1;
end if;
end loop;
end SpawnCar;
task body Data is
DCollection : DistributorCollection;
EQ : EntryQueue;
begin
accept SendDC(DC : in DistributorCollection) do
DCollection := DC;
end SendDC;
accept SendQueue(Q : in EntryQueue) do
EQ := Q;
end SendQueue;
loop
select
accept GetDC(DC : out DistributorCollection) do
DC := DCollection;
end GetDC;
or
accept GetQueue(Q : out EntryQueue) do
Q := EQ;
end GetQueue;
or
delay 0.0;
end select;
end loop;
end Data;
end PW;
|
30,342
|
ada
| 0
|
JCGobbi/Nucleo-STM32H743ZI
|
SVD2ada/svd/stm32_svd-swpmi.ads
|
pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32H743x.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package STM32_SVD.SWPMI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- SWPMI Configuration/Control register
type CR_Register is record
-- Reception DMA enable
RXDMA : Boolean := False;
-- Transmission DMA enable
TXDMA : Boolean := False;
-- Reception buffering mode
RXMODE : Boolean := False;
-- Transmission buffering mode
TXMODE : Boolean := False;
-- Loopback mode enable
LPBK : Boolean := False;
-- Single wire protocol master interface activate
SWPACT : Boolean := False;
-- unspecified
Reserved_6_9 : HAL.UInt4 := 16#0#;
-- Single wire protocol master interface deactivate
DEACT : Boolean := False;
-- Single wire protocol master transceiver enable
SWPTEN : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
RXDMA at 0 range 0 .. 0;
TXDMA at 0 range 1 .. 1;
RXMODE at 0 range 2 .. 2;
TXMODE at 0 range 3 .. 3;
LPBK at 0 range 4 .. 4;
SWPACT at 0 range 5 .. 5;
Reserved_6_9 at 0 range 6 .. 9;
DEACT at 0 range 10 .. 10;
SWPTEN at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype BRR_BR_Field is HAL.UInt8;
-- SWPMI Bitrate register
type BRR_Register is record
-- Bitrate prescaler
BR : BRR_BR_Field := 16#1#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
BR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- SWPMI Interrupt and Status register
type ISR_Register is record
-- Read-only. Receive buffer full flag
RXBFF : Boolean;
-- Read-only. Transmit buffer empty flag
TXBEF : Boolean;
-- Read-only. Receive CRC error flag
RXBERF : Boolean;
-- Read-only. Receive overrun error flag
RXOVRF : Boolean;
-- Read-only. Transmit underrun error flag
TXUNRF : Boolean;
-- Read-only. Receive data register not empty
RXNE : Boolean;
-- Read-only. Transmit data register empty
TXE : Boolean;
-- Read-only. Transfer complete flag
TCF : Boolean;
-- Read-only. Slave resume flag
SRF : Boolean;
-- Read-only. SUSPEND flag
SUSP : Boolean;
-- Read-only. DEACTIVATED flag
DEACTF : Boolean;
-- Read-only. transceiver ready flag
RDYF : Boolean;
-- unspecified
Reserved_12_31 : HAL.UInt20;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
RXBFF at 0 range 0 .. 0;
TXBEF at 0 range 1 .. 1;
RXBERF at 0 range 2 .. 2;
RXOVRF at 0 range 3 .. 3;
TXUNRF at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TXE at 0 range 6 .. 6;
TCF at 0 range 7 .. 7;
SRF at 0 range 8 .. 8;
SUSP at 0 range 9 .. 9;
DEACTF at 0 range 10 .. 10;
RDYF at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-- SWPMI Interrupt Flag Clear register
type ICR_Register is record
-- Write-only. Clear receive buffer full flag
CRXBFF : Boolean := False;
-- Write-only. Clear transmit buffer empty flag
CTXBEF : Boolean := False;
-- Write-only. Clear receive CRC error flag
CRXBERF : Boolean := False;
-- Write-only. Clear receive overrun error flag
CRXOVRF : Boolean := False;
-- Write-only. Clear transmit underrun error flag
CTXUNRF : Boolean := False;
-- unspecified
Reserved_5_6 : HAL.UInt2 := 16#0#;
-- Write-only. Clear transfer complete flag
CTCF : Boolean := False;
-- Write-only. Clear slave resume flag
CSRF : Boolean := False;
-- unspecified
Reserved_9_10 : HAL.UInt2 := 16#0#;
-- Write-only. Clear transceiver ready flag
CRDYF : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
CRXBFF at 0 range 0 .. 0;
CTXBEF at 0 range 1 .. 1;
CRXBERF at 0 range 2 .. 2;
CRXOVRF at 0 range 3 .. 3;
CTXUNRF at 0 range 4 .. 4;
Reserved_5_6 at 0 range 5 .. 6;
CTCF at 0 range 7 .. 7;
CSRF at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
CRDYF at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-- SWPMI Interrupt Enable register
type IER_Register is record
-- Receive buffer full interrupt enable
RXBFIE : Boolean := False;
-- Transmit buffer empty interrupt enable
TXBEIE : Boolean := False;
-- Receive CRC error interrupt enable
RXBERIE : Boolean := False;
-- Receive overrun error interrupt enable
RXOVRIE : Boolean := False;
-- Transmit underrun error interrupt enable
TXUNRIE : Boolean := False;
-- Receive interrupt enable
RIE : Boolean := False;
-- Transmit interrupt enable
TIE : Boolean := False;
-- Transmit complete interrupt enable
TCIE : Boolean := False;
-- Slave resume interrupt enable
SRIE : Boolean := False;
-- unspecified
Reserved_9_10 : HAL.UInt2 := 16#0#;
-- Transceiver ready interrupt enable
RDYIE : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
RXBFIE at 0 range 0 .. 0;
TXBEIE at 0 range 1 .. 1;
RXBERIE at 0 range 2 .. 2;
RXOVRIE at 0 range 3 .. 3;
TXUNRIE at 0 range 4 .. 4;
RIE at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
TCIE at 0 range 7 .. 7;
SRIE at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
RDYIE at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype RFL_RFL_Field is HAL.UInt5;
-- SWPMI Receive Frame Length register
type RFL_Register is record
-- Read-only. Receive frame length
RFL : RFL_RFL_Field;
-- unspecified
Reserved_5_31 : HAL.UInt27;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RFL_Register use record
RFL at 0 range 0 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-- SWPMI Option register
type OR_Register is record
-- SWP transceiver bypass
SWP_TBYP : Boolean := False;
-- SWP class selection
SWP_CLASS : Boolean := False;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register use record
SWP_TBYP at 0 range 0 .. 0;
SWP_CLASS at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Single Wire Protocol Master Interface
type SWPMI_Peripheral is record
-- SWPMI Configuration/Control register
CR : aliased CR_Register;
-- SWPMI Bitrate register
BRR : aliased BRR_Register;
-- SWPMI Interrupt and Status register
ISR : aliased ISR_Register;
-- SWPMI Interrupt Flag Clear register
ICR : aliased ICR_Register;
-- SWPMI Interrupt Enable register
IER : aliased IER_Register;
-- SWPMI Receive Frame Length register
RFL : aliased RFL_Register;
-- SWPMI Transmit data register
TDR : aliased HAL.UInt32;
-- SWPMI Receive data register
RDR : aliased HAL.UInt32;
-- SWPMI Option register
OR_k : aliased OR_Register;
end record
with Volatile;
for SWPMI_Peripheral use record
CR at 16#0# range 0 .. 31;
BRR at 16#4# range 0 .. 31;
ISR at 16#C# range 0 .. 31;
ICR at 16#10# range 0 .. 31;
IER at 16#14# range 0 .. 31;
RFL at 16#18# range 0 .. 31;
TDR at 16#1C# range 0 .. 31;
RDR at 16#20# range 0 .. 31;
OR_k at 16#24# range 0 .. 31;
end record;
-- Single Wire Protocol Master Interface
SWPMI_Periph : aliased SWPMI_Peripheral
with Import, Address => SWPMI_Base;
end STM32_SVD.SWPMI;
|
30,343
|
ada
| 0
|
pat-rogers/OpenUxAS
|
src/ada/src/afrl-cmasi-automationrequest-spark_boundary.ads
|
<gh_stars>0
with Common_Formal_Containers; use Common_Formal_Containers;
package afrl.cmasi.AutomationRequest.SPARK_Boundary with SPARK_Mode is
pragma Annotate (GNATprove, Terminating, SPARK_Boundary);
function Get_EntityList
(Request : AutomationRequest) return Int64_Vect
with Global => null;
function Get_OperatingRegion
(Request : AutomationRequest) return Int64
with Global => null;
function Get_TaskList
(Request : AutomationRequest) return Int64_Vect
with Global => null;
end afrl.cmasi.AutomationRequest.SPARK_Boundary;
|
30,344
|
ada
| 18
|
jquorning/ada-wiki
|
src/wiki-render-links.ads
|
-----------------------------------------------------------------------
-- wiki-render-links -- Wiki links renderering
-- Copyright (C) 2015, 2016 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Wiki.Strings;
-- === Link Renderer ===
-- The <tt>Wiki.Render.Links</tt> package defines the <tt>Link_Renderer</tt> interface used
-- for the rendering of links and images. The interface allows to customize the generated
-- links and image source for the final HTML.
--
package Wiki.Render.Links is
pragma Preelaborate;
type Link_Renderer is limited interface;
type Link_Renderer_Access is access all Link_Renderer'Class;
-- Get the image link that must be rendered from the wiki image link.
procedure Make_Image_Link (Renderer : in out Link_Renderer;
Link : in Wiki.Strings.WString;
URI : out Wiki.Strings.UString;
Width : in out Natural;
Height : in out Natural) is abstract;
-- Get the page link that must be rendered from the wiki page link.
procedure Make_Page_Link (Renderer : in out Link_Renderer;
Link : in Wiki.Strings.WString;
URI : out Wiki.Strings.UString;
Exists : out Boolean) is abstract;
type Default_Link_Renderer is new Link_Renderer with null record;
-- Get the image link that must be rendered from the wiki image link.
overriding
procedure Make_Image_Link (Renderer : in out Default_Link_Renderer;
Link : in Wiki.Strings.WString;
URI : out Wiki.Strings.UString;
Width : in out Natural;
Height : in out Natural);
-- Get the page link that must be rendered from the wiki page link.
overriding
procedure Make_Page_Link (Renderer : in out Default_Link_Renderer;
Link : in Wiki.Strings.WString;
URI : out Wiki.Strings.UString;
Exists : out Boolean);
end Wiki.Render.Links;
|
30,345
|
ada
| 1
|
brucegua/moocos
|
tools/scitools/conf/understand/ada/ada12/s-tasinf.ads
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T A S K _ I N F O --
-- --
-- S p e c --
-- --
-- Copyright (C) 2007-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the definitions and routines associated with the
-- implementation and use of the Task_Info pragma. It is specialized
-- appropriately for targets that make use of this pragma.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
-- This unit may be used directly from an application program by providing
-- an appropriate WITH, and the interface can be expected to remain stable.
-- This is the Windows (native) version of this module
with System.Win32;
package System.Task_Info is
pragma Preelaborate;
pragma Elaborate_Body;
-- To ensure that a body is allowed
use type System.Win32.ProcessorId;
-- Windows provides a way to define the ideal processor to use for a given
-- thread. The ideal processor is not necessarily the one that will be used
-- by the OS but the OS will always try to schedule this thread to the
-- specified processor if it is available.
-- The Task_Info pragma:
-- pragma Task_Info (EXPRESSION);
-- allows the specification on a task by task basis of a value of type
-- System.Task_Info.Task_Info_Type to be passed to a task when it is
-- created. The specification of this type, and the effect on the task
-- that is created is target dependent.
-- The Task_Info pragma appears within a task definition (compare the
-- definition and implementation of pragma Priority). If no such pragma
-- appears, then the value Unspecified_Task_Info is passed. If a pragma
-- is present, then it supplies an alternative value. If the argument of
-- the pragma is a discriminant reference, then the value can be set on
-- a task by task basis by supplying the appropriate discriminant value.
-- Note that this means that the type used for Task_Info_Type must be
-- suitable for use as a discriminant (i.e. a scalar or access type).
-----------------------
-- Thread Attributes --
-----------------------
subtype CPU_Number is System.Win32.ProcessorId;
Any_CPU : constant CPU_Number := -1;
Invalid_CPU_Number : exception;
-- Raised when an invalid CPU number has been specified
-- i.e. CPU > Number_Of_Processors.
type Thread_Attributes is record
CPU : CPU_Number := Any_CPU;
end record;
Default_Thread_Attributes : constant Thread_Attributes := (others => <>);
type Task_Info_Type is access all Thread_Attributes;
Unspecified_Task_Info : constant Task_Info_Type := null;
function Number_Of_Processors return Positive;
-- Returns the number of processors on the running host
end System.Task_Info;
|
30,346
|
ada
| 33
|
ytomino/drake
|
source/s-ucf1t3.ads
|
<filename>source/s-ucf1t3.ads<gh_stars>10-100
pragma License (Unrestricted);
-- implementation unit
package System.UTF_Conversions.From_16_To_32 is
pragma Pure;
pragma Suppress (All_Checks); -- for instantiation
procedure Convert is
new Convert_Procedure (
Wide_Character,
Wide_String,
Wide_Wide_Character,
Wide_Wide_String,
From_UTF_16,
To_UTF_32);
function Convert is
new Convert_Function (
Wide_Character,
Wide_String,
Wide_Wide_Character,
Wide_Wide_String,
Expanding_From_16_To_32,
Convert);
end System.UTF_Conversions.From_16_To_32;
|
30,347
|
ada
| 0
|
reznikmm/gela
|
source/nodes/program-nodes-ordinary_fixed_point_types.ads
|
<reponame>reznikmm/gela<filename>source/nodes/program-nodes-ordinary_fixed_point_types.ads<gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Expressions;
with Program.Elements.Real_Range_Specifications;
with Program.Elements.Ordinary_Fixed_Point_Types;
with Program.Element_Visitors;
package Program.Nodes.Ordinary_Fixed_Point_Types is
pragma Preelaborate;
type Ordinary_Fixed_Point_Type is
new Program.Nodes.Node
and Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type
and Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type_Text
with private;
function Create
(Delta_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Delta_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range : not null Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access)
return Ordinary_Fixed_Point_Type;
type Implicit_Ordinary_Fixed_Point_Type is
new Program.Nodes.Node
and Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type
with private;
function Create
(Delta_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range : not null Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Ordinary_Fixed_Point_Type
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Ordinary_Fixed_Point_Type is
abstract new Program.Nodes.Node
and Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type
with record
Delta_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range : not null Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access;
end record;
procedure Initialize (Self : in out Base_Ordinary_Fixed_Point_Type'Class);
overriding procedure Visit
(Self : not null access Base_Ordinary_Fixed_Point_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Delta_Expression
(Self : Base_Ordinary_Fixed_Point_Type)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Real_Range
(Self : Base_Ordinary_Fixed_Point_Type)
return not null Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access;
overriding function Is_Ordinary_Fixed_Point_Type
(Self : Base_Ordinary_Fixed_Point_Type)
return Boolean;
overriding function Is_Type_Definition
(Self : Base_Ordinary_Fixed_Point_Type)
return Boolean;
overriding function Is_Definition
(Self : Base_Ordinary_Fixed_Point_Type)
return Boolean;
type Ordinary_Fixed_Point_Type is
new Base_Ordinary_Fixed_Point_Type
and Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type_Text
with record
Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Ordinary_Fixed_Point_Type_Text
(Self : in out Ordinary_Fixed_Point_Type)
return Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type_Text_Access;
overriding function Delta_Token
(Self : Ordinary_Fixed_Point_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Ordinary_Fixed_Point_Type is
new Base_Ordinary_Fixed_Point_Type
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Ordinary_Fixed_Point_Type_Text
(Self : in out Implicit_Ordinary_Fixed_Point_Type)
return Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Ordinary_Fixed_Point_Type)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Ordinary_Fixed_Point_Type)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Ordinary_Fixed_Point_Type)
return Boolean;
end Program.Nodes.Ordinary_Fixed_Point_Types;
|
30,348
|
ada
| 0
|
reznikmm/lace
|
source/core/lace-contexts.ads
|
<reponame>reznikmm/lace<gh_stars>0
-- SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Containers;
with Lace.Generic_Engines;
package Lace.Contexts is
pragma Preelaborate;
type Context;
subtype Dummy_Variant is Ada.Containers.Hash_Type;
type Boolean_Property is (Is_Static);
package Boolean_Engines is new Lace.Generic_Engines
(Property_Name => Boolean_Property,
Property_Value => Boolean,
Abstract_Context => Context,
Variant_Kind => Dummy_Variant,
Hash => Dummy_Variant'Mod);
type Context is tagged limited record
Boolean : aliased Boolean_Engines.Engine (Context'Unchecked_Access);
end record;
end Lace.Contexts;
|
30,349
|
ada
| 24
|
svn2github/matreshka
|
source/amf/mof/cmof/amf-internals-tables-cmof_reflection.adb
|
<reponame>svn2github/matreshka<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.CMOF.Associations;
with AMF.CMOF.Classes.Collections;
with AMF.CMOF.Classifiers.Collections;
with AMF.CMOF.Comments.Collections;
with AMF.CMOF.Constraints.Collections;
with AMF.CMOF.Data_Types;
with AMF.CMOF.Element_Imports.Collections;
with AMF.CMOF.Elements.Collections;
with AMF.CMOF.Enumeration_Literals.Collections;
with AMF.CMOF.Enumerations;
with AMF.CMOF.Expressions;
with AMF.CMOF.Features.Collections;
with AMF.CMOF.Holders.Parameter_Direction_Kinds;
with AMF.CMOF.Holders.Visibility_Kinds;
with AMF.CMOF.Named_Elements.Collections;
with AMF.CMOF.Namespaces;
with AMF.CMOF.Opaque_Expressions;
with AMF.CMOF.Operations.Collections;
with AMF.CMOF.Package_Imports.Collections;
with AMF.CMOF.Package_Merges.Collections;
with AMF.CMOF.Packageable_Elements.Collections;
with AMF.CMOF.Packages.Collections;
with AMF.CMOF.Parameters.Collections;
with AMF.CMOF.Primitive_Types;
with AMF.CMOF.Properties.Collections;
with AMF.CMOF.Redefinable_Elements.Collections;
with AMF.CMOF.Tags;
with AMF.CMOF.Types.Collections;
with AMF.CMOF.Value_Specifications.Collections;
with AMF.Holders.Elements;
with AMF.Internals.Helpers;
with AMF.Internals.Holders.CMOF_Holders;
with AMF.Internals.Tables.CMOF_Element_Table;
with AMF.Internals.Tables.CMOF_Metamodel;
with AMF.Internals.Tables.CMOF_Types;
with AMF.String_Collections.Internals;
with League.Holders.Booleans;
package body AMF.Internals.Tables.CMOF_Reflection is
---------
-- Get --
---------
function Get
(Self : AMF.Internals.AMF_Element;
Property : CMOF_Element) return League.Holders.Holder
is
function CMOF_Association_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Association class.
function CMOF_Class_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Class class.
function CMOF_Comment_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Comment class.
function CMOF_Constraint_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Constraint class.
function CMOF_Data_Type_Get return League.Holders.Holder;
-- Returns attribute's value of instance of DataType class.
function CMOF_Element_Import_Get return League.Holders.Holder;
-- Returns attribute's value of instance of ElementImport class.
function CMOF_Enumeration_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Enumeration class.
function CMOF_Enumeration_Literal_Get return League.Holders.Holder;
-- Returns attribute's value of instance of EnumerationLiteral class.
function CMOF_Expression_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Expression class.
function CMOF_Opaque_Expression_Get return League.Holders.Holder;
-- Returns attribute's value of instance of OpaqueExpression class.
function CMOF_Operation_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Operation class.
function CMOF_Package_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Package class.
function CMOF_Package_Import_Get return League.Holders.Holder;
-- Returns attribute's value of instance of PackageImport class.
function CMOF_Package_Merge_Get return League.Holders.Holder;
-- Returns attribute's value of instance of PackageMerge class.
function CMOF_Parameter_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Parameter class.
function CMOF_Primitive_Type_Get return League.Holders.Holder;
-- Returns attribute's value of instance of PrimitiveType class.
function CMOF_Property_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Property class.
function CMOF_Tag_Get return League.Holders.Holder;
-- Returns attribute's value of instance of Tag class.
--------------------------
-- CMOF_Association_Get --
--------------------------
function CMOF_Association_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier then
-- Classifier::attribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_End_Type_A_Association then
-- Association::endType : Type
return
AMF.CMOF.Types.Collections.CMOF_Type_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_End_Type);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier then
-- Classifier::feature : Feature
return
AMF.CMOF.Features.Collections.CMOF_Feature_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Feature);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_General_A_Classifier then
-- Classifier::general : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_General);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Inherited_Member_A_Classifier then
-- Classifier::inheritedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Inherited_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Is_Derived then
-- Association::isDerived : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Derived);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Final_Specialization);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association then
-- Association::memberEnd : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member_End);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Navigable_Owned_End_A_Association then
-- Association::navigableOwnedEnd : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Navigable_Owned_End);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Owned_End_Property_Owning_Association then
-- Association::ownedEnd : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_End);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Relationship_Related_Element_A_Relationship then
-- Relationship::relatedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Related_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Association_Get;
--------------------
-- CMOF_Class_Get --
--------------------
function CMOF_Class_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier then
-- Classifier::attribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier then
-- Classifier::feature : Feature
return
AMF.CMOF.Features.Collections.CMOF_Feature_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Feature);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_General_A_Classifier then
-- Classifier::general : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_General);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Inherited_Member_A_Classifier then
-- Classifier::inheritedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Inherited_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Is_Abstract then
-- Class::isAbstract : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Abstract);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Final_Specialization);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Owned_Attribute_Property_Class then
-- Class::ownedAttribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Owned_Operation_Operation_Class then
-- Class::ownedOperation : Operation
return
AMF.CMOF.Operations.Collections.CMOF_Operation_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Operation);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Super_Class_A_Class then
-- Class::superClass : Class
return
AMF.CMOF.Classes.Collections.CMOF_Class_Collections.Internals.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Super_Class);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Class_Get;
----------------------
-- CMOF_Comment_Get --
----------------------
function CMOF_Comment_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Comment_Annotated_Element_A_Comment then
-- Comment::annotatedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Comments.CMOF_Comment_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Annotated_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Comment_Body then
-- Comment::body : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Comments.CMOF_Comment_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Body);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Comments.CMOF_Comment_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Comments.CMOF_Comment_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Comments.CMOF_Comment_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
else
raise Program_Error;
end if;
end CMOF_Comment_Get;
-------------------------
-- CMOF_Constraint_Get --
-------------------------
function CMOF_Constraint_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Constraint_Constrained_Element_A_Constraint then
-- Constraint::constrainedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Constrained_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Constraint_Context_Namespace_Owned_Rule then
-- Constraint::context : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Context));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Constraint_Specification_A_Owning_Constraint then
-- Constraint::specification : ValueSpecification
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Value_Specifications.CMOF_Value_Specification_Access'
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Specification));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Constraint_Get;
------------------------
-- CMOF_Data_Type_Get --
------------------------
function CMOF_Data_Type_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier then
-- Classifier::attribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier then
-- Classifier::feature : Feature
return
AMF.CMOF.Features.Collections.CMOF_Feature_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Feature);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_General_A_Classifier then
-- Classifier::general : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_General);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Inherited_Member_A_Classifier then
-- Classifier::inheritedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Inherited_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Final_Specialization);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Data_Type_Owned_Attribute_Property_Datatype then
-- DataType::ownedAttribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Data_Type_Owned_Operation_Operation_Datatype then
-- DataType::ownedOperation : Operation
return
AMF.CMOF.Operations.Collections.CMOF_Operation_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Operation);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Data_Type_Get;
-----------------------------
-- CMOF_Element_Import_Get --
-----------------------------
function CMOF_Element_Import_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Alias then
-- ElementImport::alias : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Alias);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Imported_Element_A_Element_Import then
-- ElementImport::importedElement : PackageableElement
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packageable_Elements.CMOF_Packageable_Element_Access'
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Element));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Importing_Namespace_Namespace_Element_Import then
-- ElementImport::importingNamespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Importing_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Relationship_Related_Element_A_Relationship then
-- Relationship::relatedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Related_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship then
-- DirectedRelationship::source : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Source);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship then
-- DirectedRelationship::target : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Target);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Visibility then
-- ElementImport::visibility : VisibilityKind
return
AMF.CMOF.Holders.Visibility_Kinds.To_Holder
(AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Element_Import_Get;
--------------------------
-- CMOF_Enumeration_Get --
--------------------------
function CMOF_Enumeration_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier then
-- Classifier::attribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier then
-- Classifier::feature : Feature
return
AMF.CMOF.Features.Collections.CMOF_Feature_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Feature);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_General_A_Classifier then
-- Classifier::general : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_General);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Inherited_Member_A_Classifier then
-- Classifier::inheritedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Inherited_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Final_Specialization);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Data_Type_Owned_Attribute_Property_Datatype then
-- DataType::ownedAttribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Enumeration_Owned_Literal_Enumeration_Literal_Enumeration then
-- Enumeration::ownedLiteral : EnumerationLiteral
return
AMF.CMOF.Enumeration_Literals.Collections.CMOF_Enumeration_Literal_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Literal);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Data_Type_Owned_Operation_Operation_Datatype then
-- DataType::ownedOperation : Operation
return
AMF.CMOF.Operations.Collections.CMOF_Operation_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Operation);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Enumeration_Get;
----------------------------------
-- CMOF_Enumeration_Literal_Get --
----------------------------------
function CMOF_Enumeration_Literal_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Enumeration_Literal_Enumeration_Enumeration_Owned_Literal then
-- EnumerationLiteral::enumeration : Enumeration
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access'
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Enumeration));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Enumeration_Literal_Get;
-------------------------
-- CMOF_Expression_Get --
-------------------------
function CMOF_Expression_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Expression_Operand_A_Expression then
-- Expression::operand : ValueSpecification
return
AMF.CMOF.Value_Specifications.Collections.CMOF_Value_Specification_Collections.Internals.To_Holder
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Operand);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Types.CMOF_Type_Access'
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Type));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Expression_Get;
--------------------------------
-- CMOF_Opaque_Expression_Get --
--------------------------------
function CMOF_Opaque_Expression_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Opaque_Expression_Body then
-- OpaqueExpression::body : String
return
AMF.String_Collections.Internals.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Body);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Opaque_Expression_Language then
-- OpaqueExpression::language : String
return
AMF.String_Collections.Internals.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Language);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Types.CMOF_Type_Access'
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Type));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Opaque_Expression_Get;
------------------------
-- CMOF_Operation_Get --
------------------------
function CMOF_Operation_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Body_Condition_A_Body_Context then
-- Operation::bodyCondition : Constraint
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Constraints.CMOF_Constraint_Access'
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Body_Condition));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Class_Class_Owned_Operation then
-- Operation::class : Class
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access'
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Class));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Datatype_Data_Type_Owned_Operation then
-- Operation::datatype : DataType
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access'
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Datatype));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature then
-- Feature::featuringClassifier : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Featuring_Classifier);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Is_Leaf then
-- RedefinableElement::isLeaf : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Leaf);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Ordered then
-- Operation::isOrdered : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Ordered);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Query then
-- Operation::isQuery : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Query);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Unique then
-- Operation::isUnique : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Unique);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Lower then
-- Operation::lower : Integer
return
AMF.Holders.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Lower);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Owned_Parameter_Parameter_Operation then
-- Operation::ownedParameter : Parameter
return
AMF.CMOF.Parameters.Collections.CMOF_Parameter_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Parameter);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Behavioral_Feature_Owned_Parameter_A_Owner_Formal_Param then
-- BehavioralFeature::ownedParameter : Parameter
return
AMF.CMOF.Parameters.Collections.CMOF_Parameter_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Parameter);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Postcondition_A_Post_Context then
-- Operation::postcondition : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Postcondition);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Precondition_A_Pre_Context then
-- Operation::precondition : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Precondition);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Raised_Exception_A_Operation then
-- Operation::raisedException : Type
return
AMF.CMOF.Types.Collections.CMOF_Type_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Raised_Exception);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Behavioral_Feature_Raised_Exception_A_Behavioral_Feature then
-- BehavioralFeature::raisedException : Type
return
AMF.CMOF.Types.Collections.CMOF_Type_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Raised_Exception);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Redefined_Element_A_Redefinable_Element then
-- RedefinableElement::redefinedElement : RedefinableElement
return
AMF.CMOF.Redefinable_Elements.Collections.CMOF_Redefinable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Redefined_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Redefined_Operation_A_Operation then
-- Operation::redefinedOperation : Operation
return
AMF.CMOF.Operations.Collections.CMOF_Operation_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Redefined_Operation);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Redefinition_Context_A_Redefinable_Element then
-- RedefinableElement::redefinitionContext : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Redefinition_Context);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Type_A_Operation then
-- Operation::type : Type
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Types.CMOF_Type_Access'
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Type));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Upper then
-- Operation::upper : UnlimitedNatural
return
AMF.Holders.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Upper);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Operation_Get;
----------------------
-- CMOF_Package_Get --
----------------------
function CMOF_Package_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Nested_Package_Package_Nesting_Package then
-- Package::nestedPackage : Package
return
AMF.CMOF.Packages.Collections.CMOF_Package_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Nested_Package);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Nesting_Package_Package_Nested_Package then
-- Package::nestingPackage : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Nesting_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Owned_Type_Type_Package then
-- Package::ownedType : Type
return
AMF.CMOF.Types.Collections.CMOF_Type_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Type);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Package_Merge_Package_Merge_Receiving_Package then
-- Package::packageMerge : PackageMerge
return
AMF.CMOF.Package_Merges.Collections.CMOF_Package_Merge_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Merge);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package then
-- Package::packagedElement : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Packaged_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Uri then
-- Package::uri : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Uri);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Package_Get;
-----------------------------
-- CMOF_Package_Import_Get --
-----------------------------
function CMOF_Package_Import_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Imported_Package_A_Package_Import then
-- PackageImport::importedPackage : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Importing_Namespace_Namespace_Package_Import then
-- PackageImport::importingNamespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Importing_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Relationship_Related_Element_A_Relationship then
-- Relationship::relatedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Related_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship then
-- DirectedRelationship::source : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Source);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship then
-- DirectedRelationship::target : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Target);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Visibility then
-- PackageImport::visibility : VisibilityKind
return
AMF.CMOF.Holders.Visibility_Kinds.To_Holder
(AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Package_Import_Get;
----------------------------
-- CMOF_Package_Merge_Get --
----------------------------
function CMOF_Package_Merge_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Merge_Merged_Package_A_Package_Merge then
-- PackageMerge::mergedPackage : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Merged_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Merge_Receiving_Package_Package_Package_Merge then
-- PackageMerge::receivingPackage : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Receiving_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Relationship_Related_Element_A_Relationship then
-- Relationship::relatedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Related_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship then
-- DirectedRelationship::source : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Source);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship then
-- DirectedRelationship::target : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Target);
else
raise Program_Error;
end if;
end CMOF_Package_Merge_Get;
------------------------
-- CMOF_Parameter_Get --
------------------------
function CMOF_Parameter_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Default then
-- Parameter::default : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Default);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Direction then
-- Parameter::direction : ParameterDirectionKind
return
AMF.CMOF.Holders.Parameter_Direction_Kinds.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Direction);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Ordered then
-- MultiplicityElement::isOrdered : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Ordered);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Unique then
-- MultiplicityElement::isUnique : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Unique);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Lower then
-- MultiplicityElement::lower : Integer
return
AMF.Holders.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Lower);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Operation_Operation_Owned_Parameter then
-- Parameter::operation : Operation
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Operations.CMOF_Operation_Access'
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Operation));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Types.CMOF_Type_Access'
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Type));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Upper then
-- MultiplicityElement::upper : UnlimitedNatural
return
AMF.Holders.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Upper);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Parameter_Get;
-----------------------------
-- CMOF_Primitive_Type_Get --
-----------------------------
function CMOF_Primitive_Type_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier then
-- Classifier::attribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace then
-- Namespace::elementImport : ElementImport
return
AMF.CMOF.Element_Imports.Collections.CMOF_Element_Import_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier then
-- Classifier::feature : Feature
return
AMF.CMOF.Features.Collections.CMOF_Feature_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Feature);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_General_A_Classifier then
-- Classifier::general : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_General);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Imported_Member_A_Namespace then
-- Namespace::importedMember : PackageableElement
return
AMF.CMOF.Packageable_Elements.Collections.CMOF_Packageable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Imported_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Inherited_Member_A_Classifier then
-- Classifier::inheritedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Inherited_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Final_Specialization);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace then
-- Namespace::member : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Data_Type_Owned_Attribute_Property_Datatype then
-- DataType::ownedAttribute : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Attribute);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace then
-- Namespace::ownedMember : NamedElement
return
AMF.CMOF.Named_Elements.Collections.CMOF_Named_Element_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Member);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Data_Type_Owned_Operation_Operation_Datatype then
-- DataType::ownedOperation : Operation
return
AMF.CMOF.Operations.Collections.CMOF_Operation_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Operation);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Rule_Constraint_Context then
-- Namespace::ownedRule : Constraint
return
AMF.CMOF.Constraints.Collections.CMOF_Constraint_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Rule);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Packages.CMOF_Package_Access'
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace then
-- Namespace::packageImport : PackageImport
return
AMF.CMOF.Package_Imports.Collections.CMOF_Package_Import_Collections.Internals.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Package_Import);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Primitive_Type_Get;
-----------------------
-- CMOF_Property_Get --
-----------------------
function CMOF_Property_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End then
-- Property::association : Association
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Association));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Class_Class_Owned_Attribute then
-- Property::class : Class
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Classes.CMOF_Class_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Class));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Datatype_Data_Type_Owned_Attribute then
-- Property::datatype : DataType
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Datatype));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Default then
-- Property::default : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Default);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature then
-- Feature::featuringClassifier : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Featuring_Classifier);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Composite then
-- Property::isComposite : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Composite);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Derived then
-- Property::isDerived : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Derived);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Derived_Union then
-- Property::isDerivedUnion : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Derived_Union);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Is_Leaf then
-- RedefinableElement::isLeaf : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Leaf);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Ordered then
-- MultiplicityElement::isOrdered : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Ordered);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Read_Only then
-- Property::isReadOnly : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Read_Only);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Unique then
-- MultiplicityElement::isUnique : Boolean
return
League.Holders.Booleans.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Is_Unique);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Lower then
-- MultiplicityElement::lower : Integer
return
AMF.Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Lower);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member then
-- NamedElement::namespace : Namespace
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Namespaces.CMOF_Namespace_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Namespace));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Opposite_A_Property then
-- Property::opposite : Property
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Opposite));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Owning_Association_Association_Owned_End then
-- Property::owningAssociation : Association
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Associations.CMOF_Association_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owning_Association));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Qualified_Name then
-- NamedElement::qualifiedName : String
return
AMF.Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Qualified_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Redefined_Element_A_Redefinable_Element then
-- RedefinableElement::redefinedElement : RedefinableElement
return
AMF.CMOF.Redefinable_Elements.Collections.CMOF_Redefinable_Element_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Redefined_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Redefined_Property_A_Property then
-- Property::redefinedProperty : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Redefined_Property);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Redefinition_Context_A_Redefinable_Element then
-- RedefinableElement::redefinitionContext : Classifier
return
AMF.CMOF.Classifiers.Collections.CMOF_Classifier_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Redefinition_Context);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Subsetted_Property_A_Property then
-- Property::subsettedProperty : Property
return
AMF.CMOF.Properties.Collections.CMOF_Property_Collections.Internals.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Subsetted_Property);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Types.CMOF_Type_Access'
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Type));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Upper then
-- MultiplicityElement::upper : UnlimitedNatural
return
AMF.Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Upper);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
return
AMF.CMOF.Holders.To_Holder
(AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Visibility);
else
raise Program_Error;
end if;
end CMOF_Property_Get;
------------------
-- CMOF_Tag_Get --
------------------
function CMOF_Tag_Get return League.Holders.Holder is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Element_A_Tag then
-- Tag::element : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Name then
-- Tag::name : String
return
League.Holders.To_Holder
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Name);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Comment_A_Owning_Element then
-- Element::ownedComment : Comment
return
AMF.CMOF.Comments.Collections.CMOF_Comment_Collections.Internals.To_Holder
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Comment);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner then
-- Element::ownedElement : Element
return
AMF.CMOF.Elements.Collections.CMOF_Element_Collections.Internals.To_Holder
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owned_Element);
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element then
-- Element::owner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Tag_Owner_A_Owned_Tag then
-- Tag::tagOwner : Element
return
AMF.Internals.Holders.CMOF_Holders.To_Holder
(AMF.CMOF.Elements.CMOF_Element_Access'
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Tag_Owner));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Value then
-- Tag::value : String
return
League.Holders.To_Holder
(AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Get_Value);
else
raise Program_Error;
end if;
end CMOF_Tag_Get;
begin
case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.CMOF_Types.E_None =>
raise Program_Error;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association =>
return CMOF_Association_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class =>
return CMOF_Class_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment =>
return CMOF_Comment_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint =>
return CMOF_Constraint_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type =>
return CMOF_Data_Type_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import =>
return CMOF_Element_Import_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration =>
return CMOF_Enumeration_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal =>
return CMOF_Enumeration_Literal_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression =>
return CMOF_Expression_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression =>
return CMOF_Opaque_Expression_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation =>
return CMOF_Operation_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package =>
return CMOF_Package_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import =>
return CMOF_Package_Import_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge =>
return CMOF_Package_Merge_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter =>
return CMOF_Parameter_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type =>
return CMOF_Primitive_Type_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property =>
return CMOF_Property_Get;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag =>
return CMOF_Tag_Get;
end case;
end Get;
--------------------
-- Get_Meta_Class --
--------------------
function Get_Meta_Class
(Self : AMF.Internals.AMF_Element) return CMOF_Element is
begin
case CMOF_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.CMOF_Types.E_None =>
return 0;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Association;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Class;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Comment;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Constraint;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Data_Type;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Element_Import;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Enumeration;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Enumeration_Literal;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Expression;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Opaque_Expression;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Operation;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Package;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Package_Import;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Package_Merge;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Parameter;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Primitive_Type;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Property;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag =>
return AMF.Internals.Tables.CMOF_Metamodel.MC_CMOF_Tag;
end case;
end Get_Meta_Class;
---------
-- Set --
---------
procedure Set
(Self : AMF.Internals.AMF_Element;
Property : CMOF_Element;
Value : League.Holders.Holder)
is
procedure CMOF_Association_Set;
-- Sets attribute's value of instance of Association class.
procedure CMOF_Class_Set;
-- Sets attribute's value of instance of Class class.
procedure CMOF_Comment_Set;
-- Sets attribute's value of instance of Comment class.
procedure CMOF_Constraint_Set;
-- Sets attribute's value of instance of Constraint class.
procedure CMOF_Data_Type_Set;
-- Sets attribute's value of instance of DataType class.
procedure CMOF_Element_Import_Set;
-- Sets attribute's value of instance of ElementImport class.
procedure CMOF_Enumeration_Set;
-- Sets attribute's value of instance of Enumeration class.
procedure CMOF_Enumeration_Literal_Set;
-- Sets attribute's value of instance of EnumerationLiteral class.
procedure CMOF_Expression_Set;
-- Sets attribute's value of instance of Expression class.
procedure CMOF_Opaque_Expression_Set;
-- Sets attribute's value of instance of OpaqueExpression class.
procedure CMOF_Operation_Set;
-- Sets attribute's value of instance of Operation class.
procedure CMOF_Package_Set;
-- Sets attribute's value of instance of Package class.
procedure CMOF_Package_Import_Set;
-- Sets attribute's value of instance of PackageImport class.
procedure CMOF_Package_Merge_Set;
-- Sets attribute's value of instance of PackageMerge class.
procedure CMOF_Parameter_Set;
-- Sets attribute's value of instance of Parameter class.
procedure CMOF_Primitive_Type_Set;
-- Sets attribute's value of instance of PrimitiveType class.
procedure CMOF_Property_Set;
-- Sets attribute's value of instance of Property class.
procedure CMOF_Tag_Set;
-- Sets attribute's value of instance of Tag class.
--------------------------
-- CMOF_Association_Set --
--------------------------
procedure CMOF_Association_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Is_Derived then
-- Association::isDerived : Boolean
AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Derived
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Final_Specialization
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Associations.CMOF_Association_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Association_Set;
--------------------
-- CMOF_Class_Set --
--------------------
procedure CMOF_Class_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Is_Abstract then
-- Class::isAbstract : Boolean
AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Abstract
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Final_Specialization
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Classes.CMOF_Class_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Class_Set;
----------------------
-- CMOF_Comment_Set --
----------------------
procedure CMOF_Comment_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Comment_Body then
-- Comment::body : String
AMF.CMOF.Comments.CMOF_Comment_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Body
(AMF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Comment_Set;
-------------------------
-- CMOF_Constraint_Set --
-------------------------
procedure CMOF_Constraint_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Constraint_Context_Namespace_Owned_Rule then
-- Constraint::context : Namespace
AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Context
(AMF.CMOF.Namespaces.CMOF_Namespace_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Constraint_Specification_A_Owning_Constraint then
-- Constraint::specification : ValueSpecification
AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Specification
(AMF.CMOF.Value_Specifications.CMOF_Value_Specification_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Constraints.CMOF_Constraint_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Constraint_Set;
------------------------
-- CMOF_Data_Type_Set --
------------------------
procedure CMOF_Data_Type_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Final_Specialization
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Data_Type_Set;
-----------------------------
-- CMOF_Element_Import_Set --
-----------------------------
procedure CMOF_Element_Import_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Alias then
-- ElementImport::alias : String
AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Alias
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Imported_Element_A_Element_Import then
-- ElementImport::importedElement : PackageableElement
AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Imported_Element
(AMF.CMOF.Packageable_Elements.CMOF_Packageable_Element_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Importing_Namespace_Namespace_Element_Import then
-- ElementImport::importingNamespace : Namespace
AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Importing_Namespace
(AMF.CMOF.Namespaces.CMOF_Namespace_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Visibility then
-- ElementImport::visibility : VisibilityKind
AMF.CMOF.Element_Imports.CMOF_Element_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Visibility_Kinds.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Element_Import_Set;
--------------------------
-- CMOF_Enumeration_Set --
--------------------------
procedure CMOF_Enumeration_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Final_Specialization
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Enumerations.CMOF_Enumeration_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Enumeration_Set;
----------------------------------
-- CMOF_Enumeration_Literal_Set --
----------------------------------
procedure CMOF_Enumeration_Literal_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Enumeration_Literal_Enumeration_Enumeration_Owned_Literal then
-- EnumerationLiteral::enumeration : Enumeration
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Enumeration
(AMF.CMOF.Enumerations.CMOF_Enumeration_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Enumeration_Literal_Set;
-------------------------
-- CMOF_Expression_Set --
-------------------------
procedure CMOF_Expression_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Type
(AMF.CMOF.Types.CMOF_Type_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Expressions.CMOF_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Expression_Set;
--------------------------------
-- CMOF_Opaque_Expression_Set --
--------------------------------
procedure CMOF_Opaque_Expression_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Type
(AMF.CMOF.Types.CMOF_Type_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Opaque_Expression_Set;
------------------------
-- CMOF_Operation_Set --
------------------------
procedure CMOF_Operation_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Body_Condition_A_Body_Context then
-- Operation::bodyCondition : Constraint
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Body_Condition
(AMF.CMOF.Constraints.CMOF_Constraint_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Class_Class_Owned_Operation then
-- Operation::class : Class
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Class
(AMF.CMOF.Classes.CMOF_Class_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Datatype_Data_Type_Owned_Operation then
-- Operation::datatype : DataType
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Datatype
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Is_Leaf then
-- RedefinableElement::isLeaf : Boolean
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Leaf
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Query then
-- Operation::isQuery : Boolean
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Query
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Operations.CMOF_Operation_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Operation_Set;
----------------------
-- CMOF_Package_Set --
----------------------
procedure CMOF_Package_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Nesting_Package_Package_Nested_Package then
-- Package::nestingPackage : Package
AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Nesting_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Uri then
-- Package::uri : String
AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Uri
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Packages.CMOF_Package_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Package_Set;
-----------------------------
-- CMOF_Package_Import_Set --
-----------------------------
procedure CMOF_Package_Import_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Imported_Package_A_Package_Import then
-- PackageImport::importedPackage : Package
AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Imported_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Importing_Namespace_Namespace_Package_Import then
-- PackageImport::importingNamespace : Namespace
AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Importing_Namespace
(AMF.CMOF.Namespaces.CMOF_Namespace_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Visibility then
-- PackageImport::visibility : VisibilityKind
AMF.CMOF.Package_Imports.CMOF_Package_Import_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Visibility_Kinds.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Package_Import_Set;
----------------------------
-- CMOF_Package_Merge_Set --
----------------------------
procedure CMOF_Package_Merge_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Merge_Merged_Package_A_Package_Merge then
-- PackageMerge::mergedPackage : Package
AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Merged_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Merge_Receiving_Package_Package_Package_Merge then
-- PackageMerge::receivingPackage : Package
AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Receiving_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
else
raise Program_Error;
end if;
end CMOF_Package_Merge_Set;
------------------------
-- CMOF_Parameter_Set --
------------------------
procedure CMOF_Parameter_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Default then
-- Parameter::default : String
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Default
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Direction then
-- Parameter::direction : ParameterDirectionKind
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Direction
(AMF.CMOF.Holders.Parameter_Direction_Kinds.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Ordered then
-- MultiplicityElement::isOrdered : Boolean
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Ordered
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Unique then
-- MultiplicityElement::isUnique : Boolean
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Unique
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Lower then
-- MultiplicityElement::lower : Integer
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Lower
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Operation_Operation_Owned_Parameter then
-- Parameter::operation : Operation
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Operation
(AMF.CMOF.Operations.CMOF_Operation_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Type
(AMF.CMOF.Types.CMOF_Type_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Upper then
-- MultiplicityElement::upper : UnlimitedNatural
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Upper
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Parameters.CMOF_Parameter_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Parameter_Set;
-----------------------------
-- CMOF_Primitive_Type_Set --
-----------------------------
procedure CMOF_Primitive_Type_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization then
-- Classifier::isFinalSpecialization : Boolean
AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Final_Specialization
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type then
-- Type::package : Package
AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Package
(AMF.CMOF.Packages.CMOF_Package_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Primitive_Type_Set;
-----------------------
-- CMOF_Property_Set --
-----------------------
procedure CMOF_Property_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End then
-- Property::association : Association
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Association
(AMF.CMOF.Associations.CMOF_Association_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Class_Class_Owned_Attribute then
-- Property::class : Class
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Class
(AMF.CMOF.Classes.CMOF_Class_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Datatype_Data_Type_Owned_Attribute then
-- Property::datatype : DataType
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Datatype
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Default then
-- Property::default : String
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Default
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Composite then
-- Property::isComposite : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Composite
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Derived then
-- Property::isDerived : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Derived
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Derived_Union then
-- Property::isDerivedUnion : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Derived_Union
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Is_Leaf then
-- RedefinableElement::isLeaf : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Leaf
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Ordered then
-- MultiplicityElement::isOrdered : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Ordered
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Read_Only then
-- Property::isReadOnly : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Read_Only
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Is_Unique then
-- MultiplicityElement::isUnique : Boolean
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Is_Unique
(League.Holders.Booleans.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Lower then
-- MultiplicityElement::lower : Integer
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Lower
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name then
-- NamedElement::name : String
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Owning_Association_Association_Owned_End then
-- Property::owningAssociation : Association
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Owning_Association
(AMF.CMOF.Associations.CMOF_Association_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element then
-- TypedElement::type : Type
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Type
(AMF.CMOF.Types.CMOF_Type_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Multiplicity_Element_Upper then
-- MultiplicityElement::upper : UnlimitedNatural
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Upper
(AMF.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility then
-- NamedElement::visibility : VisibilityKind
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Visibility
(AMF.CMOF.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Property_Set;
------------------
-- CMOF_Tag_Set --
------------------
procedure CMOF_Tag_Set is
begin
if Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Name then
-- Tag::name : String
AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Name
(League.Holders.Element (Value));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Tag_Owner_A_Owned_Tag then
-- Tag::tagOwner : Element
AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Tag_Owner
(AMF.CMOF.Elements.CMOF_Element_Access (AMF.Holders.Elements.Element (Value)));
elsif Property = AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Value then
-- Tag::value : String
AMF.CMOF.Tags.CMOF_Tag_Access
(AMF.Internals.Helpers.To_Element (Self)).Set_Value
(League.Holders.Element (Value));
else
raise Program_Error;
end if;
end CMOF_Tag_Set;
begin
case CMOF_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.CMOF_Types.E_None =>
raise Program_Error;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association =>
CMOF_Association_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class =>
CMOF_Class_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment =>
CMOF_Comment_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint =>
CMOF_Constraint_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type =>
CMOF_Data_Type_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import =>
CMOF_Element_Import_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration =>
CMOF_Enumeration_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal =>
CMOF_Enumeration_Literal_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression =>
CMOF_Expression_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression =>
CMOF_Opaque_Expression_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation =>
CMOF_Operation_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package =>
CMOF_Package_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import =>
CMOF_Package_Import_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge =>
CMOF_Package_Merge_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter =>
CMOF_Parameter_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type =>
CMOF_Primitive_Type_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property =>
CMOF_Property_Set;
when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag =>
CMOF_Tag_Set;
end case;
end Set;
end AMF.Internals.Tables.CMOF_Reflection;
|
30,350
|
ada
| 7
|
letsbyteit/build-avr-ada-toolchain
|
rts/gcc-9/adainclude/a-cgcaso.ads
|
<filename>rts/gcc-9/adainclude/a-cgcaso.ads
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.GENERIC_CONSTRAINED_ARRAY_SORT --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
generic
type Index_Type is (<>);
type Element_Type is private;
type Array_Type is array (Index_Type) of Element_Type;
with function "<" (Left, Right : Element_Type)
return Boolean is <>;
procedure Ada.Containers.Generic_Constrained_Array_Sort
(Container : in out Array_Type);
pragma Pure (Ada.Containers.Generic_Constrained_Array_Sort);
|
30,351
|
ada
| 0
|
luk9400/nsi
|
list3/task3/c/src/main.adb
|
<gh_stars>0
with Ada.Text_IO;
with Bubble;
procedure Main is
A : Bubble.Arr := (2, 1, 3, 7);
begin
Bubble.Sort(A);
for I in A'Range loop
Ada.Text_IO.Put_Line(A(I)'Image);
end loop;
end Main;
|
30,352
|
ada
| 80
|
enfoTek/tomato.linksys.e2000.nvram-mod
|
tools-src/gnu/gcc/gcc/ada/i-c.adb
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . C --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Interfaces.C is
-----------------------
-- Is_Nul_Terminated --
-----------------------
-- Case of char_array
function Is_Nul_Terminated (Item : char_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
-- Case of wchar_array
function Is_Nul_Terminated (Item : wchar_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = wide_nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
------------
-- To_Ada --
------------
-- Convert char to Character
function To_Ada (Item : char) return Character is
begin
return Character'Val (char'Pos (Item));
end To_Ada;
-- Convert char_array to String (function form)
function To_Ada
(Item : char_array;
Trim_Nul : Boolean := True)
return String
is
Count : Natural;
From : size_t;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = nul then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
declare
R : String (1 .. Count);
begin
for J in R'Range loop
R (J) := To_Ada (Item (size_t (J) + (Item'First - 1)));
end loop;
return R;
end;
end To_Ada;
-- Convert char_array to String (procedure form)
procedure To_Ada
(Item : char_array;
Target : out String;
Count : out Natural;
Trim_Nul : Boolean := True)
is
From : size_t;
To : Positive;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = nul then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
if Count > Target'Length then
raise Constraint_Error;
else
From := Item'First;
To := Target'First;
for J in 1 .. Count loop
Target (To) := Character (Item (From));
From := From + 1;
To := To + 1;
end loop;
end if;
end To_Ada;
-- Convert wchar_t to Wide_Character
function To_Ada (Item : wchar_t) return Wide_Character is
begin
return Wide_Character (Item);
end To_Ada;
-- Convert wchar_array to Wide_String (function form)
function To_Ada
(Item : wchar_array;
Trim_Nul : Boolean := True)
return Wide_String
is
Count : Natural;
From : size_t;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = wide_nul then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
declare
R : Wide_String (1 .. Count);
begin
for J in R'Range loop
R (J) := To_Ada (Item (size_t (J) + (Item'First - 1)));
end loop;
return R;
end;
end To_Ada;
-- Convert wchar_array to Wide_String (procedure form)
procedure To_Ada
(Item : wchar_array;
Target : out Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True)
is
From : size_t;
To : Positive;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = wide_nul then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
if Count > Target'Length then
raise Constraint_Error;
else
From := Item'First;
To := Target'First;
for J in 1 .. Count loop
Target (To) := To_Ada (Item (From));
From := From + 1;
To := To + 1;
end loop;
end if;
end To_Ada;
----------
-- To_C --
----------
-- Convert Character to char
function To_C (Item : Character) return char is
begin
return char'Val (Character'Pos (Item));
end To_C;
-- Convert String to char_array (function form)
function To_C
(Item : String;
Append_Nul : Boolean := True)
return char_array
is
begin
if Append_Nul then
declare
R : char_array (0 .. Item'Length);
begin
for J in Item'Range loop
R (size_t (J - Item'First)) := To_C (Item (J));
end loop;
R (R'Last) := nul;
return R;
end;
else -- Append_Nul is False
-- A nasty case, if the string is null, we must return
-- a null char_array. The lower bound of this array is
-- required to be zero (RM B.3(50)) but that is of course
-- impossible given that size_t is unsigned. This needs
-- ARG resolution, but for now GNAT returns bounds 1 .. 0
if Item'Length = 0 then
declare
R : char_array (1 .. 0);
begin
return R;
end;
else
declare
R : char_array (0 .. Item'Length - 1);
begin
for J in Item'Range loop
R (size_t (J - Item'First)) := To_C (Item (J));
end loop;
return R;
end;
end if;
end if;
end To_C;
-- Convert String to char_array (procedure form)
procedure To_C
(Item : String;
Target : out char_array;
Count : out size_t;
Append_Nul : Boolean := True)
is
To : size_t;
begin
if Target'Length < Item'Length then
raise Constraint_Error;
else
To := Target'First;
for From in Item'Range loop
Target (To) := char (Item (From));
To := To + 1;
end loop;
if Append_Nul then
if To > Target'Last then
raise Constraint_Error;
else
Target (To) := nul;
Count := Item'Length + 1;
end if;
else
Count := Item'Length;
end if;
end if;
end To_C;
-- Convert Wide_Character to wchar_t
function To_C (Item : Wide_Character) return wchar_t is
begin
return wchar_t (Item);
end To_C;
-- Convert Wide_String to wchar_array (function form)
function To_C
(Item : Wide_String;
Append_Nul : Boolean := True)
return wchar_array
is
begin
if Append_Nul then
declare
R : wchar_array (0 .. Item'Length);
begin
for J in Item'Range loop
R (size_t (J - Item'First)) := To_C (Item (J));
end loop;
R (R'Last) := wide_nul;
return R;
end;
else
-- A nasty case, if the string is null, we must return
-- a null char_array. The lower bound of this array is
-- required to be zero (RM B.3(50)) but that is of course
-- impossible given that size_t is unsigned. This needs
-- ARG resolution, but for now GNAT returns bounds 1 .. 0
if Item'Length = 0 then
declare
R : wchar_array (1 .. 0);
begin
return R;
end;
else
declare
R : wchar_array (0 .. Item'Length - 1);
begin
for J in size_t range 0 .. Item'Length - 1 loop
R (J) := To_C (Item (Integer (J) + Item'First));
end loop;
return R;
end;
end if;
end if;
end To_C;
-- Convert Wide_String to wchar_array (procedure form)
procedure To_C
(Item : Wide_String;
Target : out wchar_array;
Count : out size_t;
Append_Nul : Boolean := True)
is
To : size_t;
begin
if Target'Length < Item'Length then
raise Constraint_Error;
else
To := Target'First;
for From in Item'Range loop
Target (To) := To_C (Item (From));
To := To + 1;
end loop;
if Append_Nul then
if To > Target'Last then
raise Constraint_Error;
else
Target (To) := wide_nul;
Count := Item'Length + 1;
end if;
else
Count := Item'Length;
end if;
end if;
end To_C;
end Interfaces.C;
|
30,353
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/pack16.adb
|
<reponame>best08618/asylo<gh_stars>1-10
-- { dg-do compile }
-- { dg-options "-gnatws" }
with Pack16_Pkg; use Pack16_Pkg;
procedure Pack16 is
type Sample_Table_T is array (1 .. N) of Integer;
type Clock_T is record
N_Ticks : Integer := 0;
end record;
type Sampling_Descriptor_T is record
Values : Sample_Table_T;
Valid : Boolean;
Tstamp : Clock_T;
end record;
pragma Pack (Sampling_Descriptor_T);
Sampling_Data : Sampling_Descriptor_T;
begin
null;
end;
|
30,354
|
ada
| 1
|
ekoeppen/STM32_Generic_Ada_Drivers
|
stm32f0/stm32gd-gpio.ads
|
<filename>stm32f0/stm32gd-gpio.ads
with STM32_SVD.GPIO;
with STM32_SVD; use STM32_SVD;
package STM32GD.GPIO is
pragma Preelaborate;
type GPIO_Port is (Port_A, Port_B, Port_C, Port_D, Port_F);
for GPIO_Port use (Port_A => 0, Port_B => 1, Port_C => 2, Port_D => 3, Port_F => 5);
type GPIO_Pin is
(Pin_0, Pin_1, Pin_2, Pin_3, Pin_4, Pin_5, Pin_6, Pin_7,
Pin_8, Pin_9, Pin_10, Pin_11, Pin_12, Pin_13, Pin_14, Pin_15);
for GPIO_Pin use
(Pin_0 => 16#0001#,
Pin_1 => 16#0002#,
Pin_2 => 16#0004#,
Pin_3 => 16#0008#,
Pin_4 => 16#0010#,
Pin_5 => 16#0020#,
Pin_6 => 16#0040#,
Pin_7 => 16#0080#,
Pin_8 => 16#0100#,
Pin_9 => 16#0200#,
Pin_10 => 16#0400#,
Pin_11 => 16#0800#,
Pin_12 => 16#1000#,
Pin_13 => 16#2000#,
Pin_14 => 16#4000#,
Pin_15 => 16#8000#);
for GPIO_Pin'Size use 16;
-- for compatibility with hardware registers
type GPIO_Pins is array (Positive range <>) of GPIO_Pin;
-- Note that, in addition to aggregates, the language-defined catenation
-- operator "&" is available for types GPIO_Pin and GPIO_Pins, allowing one
-- to construct GPIO_Pins values conveniently
All_Pins : constant GPIO_Pins :=
(Pin_0, Pin_1, Pin_2, Pin_3, Pin_4, Pin_5, Pin_6, Pin_7,
Pin_8, Pin_9, Pin_10, Pin_11, Pin_12, Pin_13, Pin_14, Pin_15);
type Pin_IO_Modes is (Mode_In, Mode_Out, Mode_AF, Mode_Analog)
with Size => 2;
for Pin_IO_Modes use
(Mode_In => 0,
Mode_Out => 1,
Mode_AF => 2,
Mode_Analog => 3);
type Pin_Output_Types is (Push_Pull, Open_Drain)
with Size => 1;
for Pin_Output_Types use (Push_Pull => 0, Open_Drain => 1);
type Pin_Output_Speeds is (Speed_2MHz, Speed_25MHz, Speed_50MHz, Speed_100MHz)
with Size => 2;
for Pin_Output_Speeds use
(Speed_2MHz => 0, -- low
Speed_25MHz => 1, -- medium
Speed_50MHz => 2, -- high
Speed_100MHz => 3); -- very high
Speed_Low : Pin_Output_Speeds renames Speed_2MHz;
Speed_Medium : Pin_Output_Speeds renames Speed_25MHz;
Speed_High : Pin_Output_Speeds renames Speed_50MHz;
Speed_Very_High : Pin_Output_Speeds renames Speed_100MHz;
type Internal_Pin_Resistors is (Floating, Pull_Up, Pull_Down)
with Size => 2;
for Internal_Pin_Resistors use (Floating => 0,
Pull_Up => 1,
Pull_Down => 2);
type GPIO_Alternate_Function is new UInt4;
end STM32GD.GPIO;
|
30,355
|
ada
| 0
|
ytomino/gnat4drake
|
g-tasloc.ads
|
<filename>g-tasloc.ads
pragma License (Unrestricted);
private with System.Shared_Locking; -- implementation unit
package GNAT.Task_Lock is
pragma Preelaborate;
procedure Lock;
procedure Unlock;
pragma Inline (Lock); -- renamed
pragma Inline (Unlock); -- renamed
private
procedure Lock
renames System.Shared_Locking.Enter;
procedure Unlock
renames System.Shared_Locking.Leave;
end GNAT.Task_Lock;
|
30,356
|
ada
| 6
|
mosteo/yeison
|
src/yeison_multi.ads
|
package Yeison_Multi with Preelaborate is
type Any is tagged private;
type Scalar is tagged private with
Integer_Literal => To_Int,
String_Literal => To_Str;
function To_Int (Img : String) return Scalar;
function To_Str (Img : Wide_Wide_String) return Scalar;
type Map is tagged private with
Aggregate => (Empty => Empty,
Add_Named => Insert);
function Empty return Map;
procedure Insert (This : in out Map; Key : String; Val : Any'Class);
procedure Insert (This : in out Map; Key : String; Val : Scalar'Class);
procedure Insert (This : in out Map; Key : String; Val : Map);
private
type Any is tagged null record;
type Scalar is tagged null record;
type Map is tagged null record;
end Yeison_Multi;
|
30,357
|
ada
| 0
|
ray2501/ada-adapcre
|
examples/email.adb
|
<reponame>ray2501/ada-adapcre<filename>examples/email.adb
--
-- Checks if a string is a valid email address.
--
-- Strings for test are located in file <email.txt>
--
with Ada.Text_IO; use Ada.Text_IO;
with AdaPcre; use AdaPcre;
procedure Email is
Email_File : File_Type;
Email_Pattern : constant String :=
"^[A-z0-9._%-]+@[A-z0-9.-]+\.[A-z]{2,4}$";
Email_Str : String (1 .. 100);
Last : Natural;
Regexp : Pcre_Type;
Extra : Extra_type;
Retcode : Integer;
Msg : Message;
Last_Msg, ErrPos : Natural := 0;
Vector : Match_Array (0 .. 2);
begin
Compile (Regexp, Email_Pattern, Msg, Last_Msg, ErrPos);
if Regexp = Null_Pcre then
Put_Line
("PCRE compilation failed at offset " & Natural'Image (ErrPos));
Put_Line (Msg (1 .. Last_Msg));
return;
end if;
Study (Extra, Regexp, Msg, Last_Msg);
Open (Email_File, In_File, "email.txt");
Set_Input (Email_File);
while not End_Of_File (Email_File) loop
Get_Line (Email_Str, Last);
Put (Email_Str (1 .. Last));
Match (Retcode, Vector, Regexp, Extra, Email_Str, Last);
if Retcode = -1 then
Put_Line (" => Invalid Email. No match !");
elsif Retcode < -1 then
Put_Line
("Failure in PCRE ! error number => " & Integer'Image (Retcode));
else
Put_Line (" => Valid Email");
end if;
end loop;
Close (Email_File);
Free (Extra);
Free (Regexp);
end Email;
|
30,358
|
ada
| 13
|
Fabien-Chouteau/GESTE
|
src/geste-sprite-rotated.adb
|
------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with GESTE.Maths; use GESTE.Maths;
package body GESTE.Sprite.Rotated is
-----------
-- Angle --
-----------
function Angle (This : Instance) return Value
is (This.Angle);
-----------
-- Angle --
-----------
procedure Angle (This : in out Instance;
Angle : Value)
is
begin
if This.Angle /= Angle then
This.Angle := Angle;
This.Dirty := True;
end if;
end Angle;
---------------
-- Translate --
---------------
function Transform (This : Instance;
X, Y : in out Integer)
return Boolean
is
SX : constant Integer := X - Tile_Size / 2;
SY : constant Integer := Y - Tile_Size / 2;
begin
X := Integer (Cos (-This.Angle) * SX + Sin (-This.Angle) * SY);
Y := Integer (-Sin (-This.Angle) * SX + Cos (-This.Angle) * SY);
X := X + Tile_Size / 2;
Y := Y + Tile_Size / 2;
if X not in 0 .. This.A_Width - 1
or else
Y not in 0 .. This.A_Height - 1
then
return False;
end if;
return True;
end Transform;
---------
-- Pix --
---------
overriding
function Pix (This : Instance; X, Y : Integer) return Output_Color
is
TX : Integer := X;
TY : Integer := Y;
begin
if This.Transform (TX, TY) then
return Parent (This).Pix (TX, TY);
else
return Transparent;
end if;
end Pix;
--------------
-- Collides --
--------------
overriding
function Collides (This : Instance; X, Y : Integer) return Boolean
is
TX : Integer := X;
TY : Integer := Y;
begin
if This.Transform (TX, TY) then
return Parent (This).Collides (TX, TY);
else
return False;
end if;
end Collides;
end GESTE.Sprite.Rotated;
|
30,359
|
ada
| 0
|
luk9400/nsi
|
list1/task3/src/main.adb
|
with Selection;
with Ada.Text_IO;
procedure Main is
Arr: Selection.Arr (0 .. 3) := (5, 8, 6, 2);
begin
for I in Arr'Range loop
Ada.Text_IO.Put_Line(Arr (I)'Image);
end loop;
Selection.Sort(Arr);
Ada.Text_IO.Put_Line("Sorted:");
for I in Arr'Range loop
Ada.Text_IO.Put_Line(Arr (I)'Image);
end loop;
end Main;
|
30,360
|
ada
| 1
|
vidkidz/crossbridge
|
llvm-gcc-4.2-2.9/gcc/ada/osint.ads
|
<reponame>vidkidz/crossbridge<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- O S I N T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the low level, operating system routines used in
-- the GNAT compiler and binder for command line processing and file input
-- output.
with GNAT.OS_Lib; use GNAT.OS_Lib;
with System; use System;
with Types; use Types;
pragma Elaborate (GNAT.OS_Lib);
package Osint is
Multi_Unit_Index_Character : Character := '~';
-- The character before the index of the unit in a multi-unit source,
-- in ALI and object file names. This is not a constant, because it is
-- changed to '$' on VMS.
Ada_Include_Path : constant String := "ADA_INCLUDE_PATH";
Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH";
Project_Include_Path_File : constant String := "ADA_PRJ_INCLUDE_FILE";
Project_Objects_Path_File : constant String := "ADA_PRJ_OBJECTS_FILE";
procedure Initialize;
-- Initialize internal tables
function Normalize_Directory_Name (Directory : String) return String_Ptr;
-- Verify and normalize a directory name. If directory name is invalid,
-- this will return an empty string. Otherwise it will insure a trailing
-- slash and make other normalizations.
type File_Type is (Source, Library, Config, Definition, Preprocessing_Data);
function Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type;
-- Finds a source, library or config file depending on the value
-- of T following the directory search order rules unless N is the
-- name of the file just read with Next_Main_File and already
-- contains directiory information, in which case just look in the
-- Primary_Directory. Returns File_Name_Type of the full file name
-- if found, No_File if file not found. Note that for the special
-- case of gnat.adc, only the compilation environment directory is
-- searched, i.e. the directory where the ali and object files are
-- written. Another special case is when Debug_Generated_Code is
-- set and the file name ends on ".dg", in which case we look for
-- the generated file only in the current directory, since that is
-- where it is always built.
function Get_File_Names_Case_Sensitive return Int;
pragma Import (C, Get_File_Names_Case_Sensitive,
"__gnat_get_file_names_case_sensitive");
File_Names_Case_Sensitive : constant Boolean :=
Get_File_Names_Case_Sensitive /= 0;
-- Set to indicate whether the operating system convention is for file
-- names to be case sensitive (e.g., in Unix, set True), or non case
-- sensitive (e.g., in OS/2, set False).
procedure Canonical_Case_File_Name (S : in out String);
-- Given a file name, converts it to canonical case form. For systems
-- where file names are case sensitive, this procedure has no effect.
-- If file names are not case sensitive (i.e. for example if you have
-- the file "xyz.adb", you can refer to it as XYZ.adb or XyZ.AdB), then
-- this call converts the given string to canonical all lower case form,
-- so that two file names compare equal if they refer to the same file.
function Number_Of_Files return Int;
-- Gives the total number of filenames found on the command line
No_Index : constant := -1;
-- Value used in Add_File to indicate no index is specified for main
procedure Add_File (File_Name : String; Index : Int := No_Index);
-- Called by the subprogram processing the command line for each file name
-- found. The index, when not defaulted to No_Index is the index of the
-- subprogram in its source, zero indicating that the source is not
-- multi-unit.
procedure Find_Program_Name;
-- Put simple name of current program being run (excluding the directory
-- path) in Name_Buffer, with the length in Name_Len.
function Program_Name (Nam : String) return String_Access;
-- In the native compilation case, Create a string containing Nam. In the
-- cross compilation case, looks at the prefix of the current program being
-- run and prepend it to Nam. For instance if the program being run is
-- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer
-- to "<target>-gcc". This function clobbers Name_Buffer and Name_Len.
procedure Write_Program_Name;
-- Writes name of program as invoked to the current output
-- (normally standard output).
procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
pragma No_Return (Fail);
-- Outputs error messages S1 & S2 & S3 preceded by the name of the
-- executing program and exits with E_Fatal. The output goes to standard
-- error, except if special output is in effect (see Output).
function Is_Directory_Separator (C : Character) return Boolean;
-- Returns True if C is a directory separator
function Get_Directory (Name : File_Name_Type) return File_Name_Type;
-- Get the prefix directory name (if any) from Name. The last separator
-- is preserved. Return the normalized current directory if there is no
-- directory part in the name.
function Is_Readonly_Library (File : File_Name_Type) return Boolean;
-- Check if this library file is a read-only file
function Strip_Directory (Name : File_Name_Type) return File_Name_Type;
-- Strips the prefix directory name (if any) from Name. Returns the
-- stripped name. Name cannot end with a directory separator.
function Strip_Suffix (Name : File_Name_Type) return File_Name_Type;
-- Strips the suffix (the last '.' and whatever comes after it) from Name.
-- Returns the stripped name.
function Executable_Name (Name : File_Name_Type) return File_Name_Type;
-- Given a file name it adds the appropriate suffix at the end so that
-- it becomes the name of the executable on the system at end. For
-- instance under DOS it adds the ".exe" suffix, whereas under UNIX no
-- suffix is added.
function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type;
-- Returns the time stamp of file Name. Name should include relative
-- path information in order to locate it. If the source file cannot be
-- opened, or Name = No_File, and all blank time stamp is returned (this is
-- not an error situation).
type String_Access_List is array (Positive range <>) of String_Access;
-- Deferenced type used to return a list of file specs in
-- To_Canonical_File_List.
type String_Access_List_Access is access all String_Access_List;
-- Type used to return a String_Access_List without dragging in secondary
-- stack.
function To_Canonical_File_List
(Wildcard_Host_File : String;
Only_Dirs : Boolean) return String_Access_List_Access;
-- Expand a wildcard host syntax file or directory specification (e.g. on
-- a VMS host, any file or directory spec that contains:
-- "*", or "%", or "...")
-- and return a list of valid Unix syntax file or directory specs.
-- If Only_Dirs is True, then only return directories.
function To_Canonical_Dir_Spec
(Host_Dir : String;
Prefix_Style : Boolean) return String_Access;
-- Convert a host syntax directory specification (e.g. on a VMS host:
-- "SYS$DEVICE:[DIR]") to canonical (Unix) syntax (e.g. "/sys$device/dir").
-- If Prefix_Style then make it a valid file specification prefix. A file
-- specification prefix is a directory specification that can be appended
-- with a simple file specification to yield a valid absolute or relative
-- path to a file. On a conversion to Unix syntax this simply means the
-- spec has a trailing slash ("/").
function To_Canonical_File_Spec
(Host_File : String) return String_Access;
-- Convert a host syntax file specification (e.g. on a VMS host:
-- "SYS$DEVICE:[DIR]FILE.EXT;69 to canonical (Unix) syntax (e.g.
-- "/sys$device/dir/file.ext.69").
function To_Canonical_Path_Spec
(Host_Path : String) return String_Access;
-- Convert a host syntax Path specification (e.g. on a VMS host:
-- "SYS$DEVICE:[BAR],DISK$USER:[FOO] to canonical (Unix) syntax (e.g.
-- "/sys$device/foo:disk$user/foo").
function To_Host_Dir_Spec
(Canonical_Dir : String;
Prefix_Style : Boolean) return String_Access;
-- Convert a canonical syntax directory specification to host syntax.
-- The Prefix_Style flag is currently ignored but should be set to
-- False.
function To_Host_File_Spec
(Canonical_File : String) return String_Access;
-- Convert a canonical syntax file specification to host syntax
function Relocate_Path
(Prefix : String;
Path : String) return String_Ptr;
-- Given an absolute path and a prefix, if Path starts with Prefix,
-- replace the Prefix substring with the root installation directory.
-- By default, try to compute the root installation directory by looking
-- at the executable name as it was typed on the command line and, if
-- needed, use the PATH environment variable. If the above computation
-- fails, return Path. This function assumes Prefix'First = Path'First.
function Shared_Lib (Name : String) return String;
-- Returns the runtime shared library in the form -l<name>-<version> where
-- version is the GNAT runtime library option for the platform. For example
-- this routine called with Name set to "gnat" will return "-lgnat-5.02"
-- on UNIX and Windows and -lgnat_5_02 on VMS.
-------------------------
-- Search Dir Routines --
-------------------------
function Include_Dir_Default_Prefix return String;
-- Return the directory of the run-time library sources, as modified
-- by update_path.
function Object_Dir_Default_Prefix return String;
-- Return the directory of the run-time library ALI and object files, as
-- modified by update_path.
procedure Add_Default_Search_Dirs;
-- This routine adds the default search dirs indicated by the
-- environment variables and sdefault package.
procedure Add_Lib_Search_Dir (Dir : String);
-- Add Dir at the end of the library file search path
procedure Add_Src_Search_Dir (Dir : String);
-- Add Dir at the end of the source file search path
procedure Get_Next_Dir_In_Path_Init
(Search_Path : String_Access);
function Get_Next_Dir_In_Path
(Search_Path : String_Access) return String_Access;
-- These subprograms are used to parse out the directory names in a
-- search path specified by a Search_Path argument. The procedure
-- initializes an internal pointer to point to the initial directory
-- name, and calls to the function return successive directory names,
-- with a null pointer marking the end of the list.
type Search_File_Type is (Include, Objects);
procedure Add_Search_Dirs
(Search_Path : String_Ptr;
Path_Type : Search_File_Type);
-- These procedure adds all the search directories that are in Search_Path
-- in the proper file search path (library or source)
function Get_Primary_Src_Search_Directory return String_Ptr;
-- Retrieved the primary directory (directory containing the main source
-- file for Gnatmake.
function Nb_Dir_In_Src_Search_Path return Natural;
function Dir_In_Src_Search_Path (Position : Natural) return String_Ptr;
-- Functions to access the directory names in the source search path
function Nb_Dir_In_Obj_Search_Path return Natural;
function Dir_In_Obj_Search_Path (Position : Natural) return String_Ptr;
-- Functions to access the directory names in the Object search path
Include_Search_File : constant String_Access :=
new String'("ada_source_path");
Objects_Search_File : constant String_Access :=
new String'("ada_object_path");
-- Names of the files containg the default include or objects search
-- directories. These files, located in Sdefault.Search_Dir_Prefix, do
-- not necessarily exist.
Exec_Name : String_Ptr;
-- Executable name as typed by the user (used to compute the
-- executable prefix).
function Read_Default_Search_Dirs
(Search_Dir_Prefix : String_Access;
Search_File : String_Access;
Search_Dir_Default_Name : String_Access) return String_Access;
-- Read and return the default search directories from the file located
-- in Search_Dir_Prefix (as modified by update_path) and named Search_File.
-- If no such file exists or an error occurs then instead return the
-- Search_Dir_Default_Name (as modified by update_path).
function Get_RTS_Search_Dir
(Search_Dir : String;
File_Type : Search_File_Type) return String_Ptr;
-- This function retrieves the paths to the search (resp. lib) dirs and
-- return them. The search dir can be absolute or relative. If the search
-- dir contains Include_Search_File (resp. Object_Search_File), then this
-- function reads and returns the default search directories from the file.
-- Otherwise, if the directory is absolute, it will try to find 'adalib'
-- (resp. 'adainclude'). If found, null is returned. If the directory is
-- relative, the following directories for the directories 'adalib' and
-- 'adainclude' will be scanned:
--
-- - current directory (from which the tool has been spawned)
-- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/
-- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/rts-
--
-- The scan will stop as soon as the directory being searched for (adalib
-- or adainclude) is found. If the scan fails, null is returned.
-----------------------
-- Source File Input --
-----------------------
-- Source file input routines are used by the compiler to read the main
-- source files and the subsidiary source files (e.g. with'ed units), and
-- also by the binder to check presence/time stamps of sources.
procedure Read_Source_File
(N : File_Name_Type;
Lo : Source_Ptr;
Hi : out Source_Ptr;
Src : out Source_Buffer_Ptr;
T : File_Type := Source);
-- Allocates a Source_Buffer of appropriate length and then reads the
-- entire contents of the source file N into the buffer. The address of
-- the allocated buffer is returned in Src.
--
-- Each line of text is terminated by one of the sequences:
--
-- CR
-- CR/LF
-- LF/CR
-- LF
-- The source is terminated by an EOF (16#1A#) character, which is
-- the last charcater of the returned source bufer (note that any
-- EOF characters in positions other than the last source character
-- are treated as representing blanks).
--
-- The logical lower bound of the source buffer is the input value of Lo,
-- and on exit Hi is set to the logical upper bound of the source buffer.
-- Note that the returned value in Src points to an array with a physical
-- lower bound of zero. This virtual origin addressing approach means that
-- a constrained array pointer can be used with a low bound of zero which
-- results in more efficient code.
--
-- If the given file cannot be opened, then the action depends on whether
-- this file is the current main unit (i.e. its name matches the name
-- returned by the most recent call to Next_Main_Source). If so, then the
-- failure to find the file is a fatal error, an error message is output,
-- and program execution is terminated. Otherwise (for the case of a
-- subsidiary source loaded directly or indirectly using with), a file
-- not found condition causes null to be set as the result value.
--
-- Note that the name passed to this function is the simple file name,
-- without any directory information. The implementation is responsible
-- for searching for the file in the appropriate directories.
--
-- Note the special case that if the file name is gnat.adc, then the
-- search for the file is done ONLY in the directory corresponding to
-- the current compilation environment, i.e. in the same directory
-- where the ali and object files will be written.
function Full_Source_Name return File_Name_Type;
function Current_Source_File_Stamp return Time_Stamp_Type;
-- Returns the full name/time stamp of the source file most recently read
-- using Read_Source_File. Calling this routine entails no source file
-- directory lookup penalty.
function Full_Source_Name (N : File_Name_Type) return File_Name_Type;
function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-- Returns the full name/time stamp of the source file whose simple name
-- is N which should not include path information. Note that if the file
-- cannot be located No_File is returned for the first routine and an
-- all blank time stamp is returned for the second (this is not an error
-- situation). The full name includes the appropriate directory
-- information. The source file directory lookup penalty is incurred
-- every single time the routines are called unless you have previously
-- called Source_File_Data (Cache => True). See below.
function Current_File_Index return Int;
-- Return the index in its source file of the current main unit
function Matching_Full_Source_Name
(N : File_Name_Type;
T : Time_Stamp_Type) return File_Name_Type;
-- Same semantics than Full_Source_Name but will search on the source
-- path until a source file with time stamp matching T is found. If
-- none is found returns No_File.
procedure Source_File_Data (Cache : Boolean);
-- By default source file data (full source file name and time stamp)
-- are looked up every time a call to Full_Source_Name (N) or
-- Source_File_Stamp (N) is made. This may be undesirable in certain
-- applications as this is uselessly slow if source file data does not
-- change during program execution. When this procedure is called with
-- Cache => True access to source file data does not encurr a penalty if
-- this data was previously retrieved.
-------------------------------------------
-- Representation of Library Information --
-------------------------------------------
-- Associated with each compiled source file is library information,
-- a string of bytes whose exact format is described in the body of
-- Lib.Writ. Compiling a source file generates this library information
-- for the compiled unit, and access the library information for units
-- that were compiled previously on which the unit being compiled depends.
-- How this information is stored is up to the implementation of this
-- package. At the interface level, this information is simply associated
-- with its corresponding source.
-- Several different implementations are possible:
-- 1. The information could be directly associated with the source file,
-- e.g. placed in a resource fork of this file on the Mac, or on
-- MS-DOS, written to the source file after the end of file mark.
-- 2. The information could be written into the generated object module
-- if the system supports the inclusion of arbitrary informational
-- byte streams into object files. In this case there must be a naming
-- convention that allows object files to be located given the name of
-- the corresponding source file.
-- 3. The information could be written to a separate file, whose name is
-- related to the name of the source file by a fixed convention.
-- Which of these three methods is chosen depends on the constraints of the
-- host operating system. The interface described here is independent of
-- which of these approaches is used.
-------------------------------
-- Library Information Input --
-------------------------------
-- These subprograms are used by the binder to read library information
-- files, see section above for representation of these files.
function Read_Library_Info
(Lib_File : File_Name_Type;
Fatal_Err : Boolean := False) return Text_Buffer_Ptr;
-- Allocates a Text_Buffer of appropriate length and reads in the entire
-- source of the library information from the library information file
-- whose name is given by the parameter Name.
--
-- See description of Read_Source_File for details on the format of the
-- returned text buffer (the format is identical). THe lower bound of
-- the Text_Buffer is always zero
--
-- If the specified file cannot be opened, then the action depends on
-- Fatal_Err. If Fatal_Err is True, an error message is given and the
-- compilation is abandoned. Otherwise if Fatal_Err is False, then null
-- is returned. Note that the Lib_File is a simple name which does not
-- include any directory information. The implementation is responsible
-- for searching for the file in appropriate directories.
--
-- If Opt.Check_Object_Consistency is set to True then this routine
-- checks whether the object file corresponding to the Lib_File is
-- consistent with it. The object file is inconsistent if the object
-- does not exist or if it has an older time stamp than Lib_File.
-- This check is not performed when the Lib_File is "locked" (i.e.
-- read/only) because in this case the object file may be buried
-- in a library. In case of inconsistencies Read_Library_Info
-- behaves as if it did not find Lib_File (namely if Fatal_Err is
-- False, null is returned).
function Full_Library_Info_Name return File_Name_Type;
function Full_Object_File_Name return File_Name_Type;
-- Returns the full name of the library/object file most recently read
-- using Read_Library_Info, including appropriate directory information.
-- Calling this routine entails no library file directory lookup
-- penalty. Note that the object file corresponding to a library file
-- is not actually read. Its time stamp is fected when the flag
-- Opt.Check_Object_Consistency is set.
function Current_Library_File_Stamp return Time_Stamp_Type;
function Current_Object_File_Stamp return Time_Stamp_Type;
-- The time stamps of the files returned by the previous two routines.
-- It is an error to call Current_Object_File_Stamp if
-- Opt.Check_Object_Consistency is set to False.
function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-- Returns the full name/time stamp of library file N. N should not
-- include path information. Note that if the file cannot be located
-- No_File is returned for the first routine and an all blank time stamp
-- is returned for the second (this is not an error situation). The
-- full name includes the appropriate directory information. The library
-- file directory lookup penalty is incurred every single time this
-- routine is called.
function Lib_File_Name
(Source_File : File_Name_Type;
Munit_Index : Nat := 0) return File_Name_Type;
-- Given the name of a source file, returns the name of the corresponding
-- library information file. This may be the name of the object file, or
-- of a separate file used to store the library information. In either case
-- the returned result is suitable for use in a call to Read_Library_Info.
-- The Munit_Index is the unit index in multiple unit per file mode, or
-- zero in normal single unit per file mode (used to add ~nnn suffix).
-- Note: this subprogram is in this section because it is used by the
-- compiler to determine the proper library information names to be placed
-- in the generated library information file.
-----------------
-- Termination --
-----------------
type Exit_Code_Type is (
E_Success, -- No warnings or errors
E_Warnings, -- Compiler warnings generated
E_No_Code, -- No code generated
E_No_Compile, -- Compilation not needed (smart recompilation)
E_Errors, -- Compiler error messages generated
E_Fatal, -- Fatal (serious) error, e.g. source file not found
E_Abort); -- Internally detected compiler error
procedure Exit_Program (Exit_Code : Exit_Code_Type);
pragma No_Return (Exit_Program);
-- A call to Exit_Program terminates execution with the given status.
-- A status of zero indicates normal completion, a non-zero status
-- indicates abnormal termination.
-------------------------
-- Command Line Access --
-------------------------
-- Direct interface to command line parameters. (We don't want to use
-- the predefined command line package because it defines functions
-- returning string)
function Arg_Count return Natural;
pragma Import (C, Arg_Count, "__gnat_arg_count");
-- Get number of arguments (note: optional globbing may be enabled)
procedure Fill_Arg (A : System.Address; Arg_Num : Integer);
pragma Import (C, Fill_Arg, "__gnat_fill_arg");
-- Store one argument
function Len_Arg (Arg_Num : Integer) return Integer;
pragma Import (C, Len_Arg, "__gnat_len_arg");
-- Get length of argument
private
ALI_Suffix : constant String_Ptr := new String'("ali");
-- The suffix used for the library files (also known as ALI files)
Current_Main : File_Name_Type := No_File;
-- Used to save a simple file name between calls to Next_Main_Source and
-- Read_Source_File. If the file name argument to Read_Source_File is
-- No_File, that indicates that the file whose name was returned by the
-- last call to Next_Main_Source (and stored here) is to be read.
Target_Object_Suffix : constant String := Get_Target_Object_Suffix.all;
-- The suffix used for the target object files
Output_FD : File_Descriptor;
-- The file descriptor for the current library info, tree or binder output
Output_File_Name : File_Name_Type;
-- File_Name_Type for name of open file whose FD is in Output_FD, the name
-- stored does not include the trailing NUL character.
Argument_Count : constant Integer := Arg_Count - 1;
-- Number of arguments (excluding program name)
type File_Name_Array is array (Int range <>) of String_Ptr;
type File_Name_Array_Ptr is access File_Name_Array;
File_Names : File_Name_Array_Ptr :=
new File_Name_Array (1 .. Int (Argument_Count) + 2);
-- As arguments are scanned, file names are stored in this array
-- The strings do not have terminating NUL files. The array is
-- extensible, because when using project files, there may be
-- more files than arguments on the command line.
type File_Index_Array is array (Int range <>) of Int;
type File_Index_Array_Ptr is access File_Index_Array;
File_Indexes : File_Index_Array_Ptr :=
new File_Index_Array (1 .. Int (Argument_Count) + 2);
Current_File_Name_Index : Int := 0;
-- The index in File_Names of the last file opened by Next_Main_Source
-- or Next_Main_Lib_File. The value 0 indicates that no files have been
-- opened yet.
procedure Create_File_And_Check
(Fdesc : out File_Descriptor;
Fmode : Mode);
-- Create file whose name (NUL terminated) is in Name_Buffer (with the
-- length in Name_Len), and place the resulting descriptor in Fdesc.
-- Issue message and exit with fatal error if file cannot be created.
-- The Fmode parameter is set to either Text or Binary (see description
-- of GNAT.OS_Lib.Create_File).
type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified);
-- Program currently running
procedure Set_Program (P : Program_Type);
-- Indicates to the body of Osint the program currently running.
-- This procedure is called by the child packages of Osint.
-- A check is made that this procedure is not called several times.
function More_Files return Boolean;
-- Implements More_Source_Files and More_Lib_Files
function Next_Main_File return File_Name_Type;
-- Implements Next_Main_Source and Next_Main_Lib_File
function Object_File_Name (N : File_Name_Type) return File_Name_Type;
-- Constructs the name of the object file corresponding to library
-- file N. If N is a full file name than the returned file name will
-- also be a full file name. Note that no lookup in the library file
-- directories is done for this file. This routine merely constructs
-- the name.
procedure Write_Info (Info : String);
-- Implementation of Write_Binder_Info, Write_Debug_Info and
-- Write_Library_Info (identical)
end Osint;
|
30,361
|
ada
| 1
|
Fabien-Chouteau/samd51-hal
|
src/drivers/oscctrl_u2401/sam_svd-oscctrl.ads
|
-- ============================================================================
-- Atmel Microcontroller Software Support
-- ============================================================================
-- Copyright (c) 2017 Atmel Corporation,
-- a wholly owned subsidiary of Microchip Technology Inc.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the Licence at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- ============================================================================
-- This spec has been automatically generated from ATSAMD51J19A.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package SAM_SVD.OSCCTRL is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- OSCCTRL_EVCTRL_CFDEO array
type OSCCTRL_EVCTRL_CFDEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_EVCTRL_CFDEO
type OSCCTRL_EVCTRL_CFDEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CFDEO as a value
Val : HAL.UInt2;
when True =>
-- CFDEO as an array
Arr : OSCCTRL_EVCTRL_CFDEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_EVCTRL_CFDEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type OSCCTRL_EVCTRL_Register is record
-- Clock 0 Failure Detector Event Output Enable
CFDEO : OSCCTRL_EVCTRL_CFDEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for OSCCTRL_EVCTRL_Register use record
CFDEO at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- OSCCTRL_INTENCLR_XOSCRDY array
type OSCCTRL_INTENCLR_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENCLR_XOSCRDY
type OSCCTRL_INTENCLR_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_INTENCLR_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENCLR_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_INTENCLR_XOSCFAIL array
type OSCCTRL_INTENCLR_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENCLR_XOSCFAIL
type OSCCTRL_INTENCLR_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_INTENCLR_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENCLR_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type OSCCTRL_INTENCLR_Register is record
-- XOSC 0 Ready Interrupt Enable
XOSCRDY : OSCCTRL_INTENCLR_XOSCRDY_Field :=
(As_Array => False, Val => 16#0#);
-- XOSC 0 Clock Failure Detector Interrupt Enable
XOSCFAIL : OSCCTRL_INTENCLR_XOSCFAIL_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- DFLL Ready Interrupt Enable
DFLLRDY : Boolean := False;
-- DFLL Out Of Bounds Interrupt Enable
DFLLOOB : Boolean := False;
-- DFLL Lock Fine Interrupt Enable
DFLLLCKF : Boolean := False;
-- DFLL Lock Coarse Interrupt Enable
DFLLLCKC : Boolean := False;
-- DFLL Reference Clock Stopped Interrupt Enable
DFLLRCS : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- DPLL0 Lock Rise Interrupt Enable
DPLL0LCKR : Boolean := False;
-- DPLL0 Lock Fall Interrupt Enable
DPLL0LCKF : Boolean := False;
-- DPLL0 Lock Timeout Interrupt Enable
DPLL0LTO : Boolean := False;
-- DPLL0 Loop Divider Ratio Update Complete Interrupt Enable
DPLL0LDRTO : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- DPLL1 Lock Rise Interrupt Enable
DPLL1LCKR : Boolean := False;
-- DPLL1 Lock Fall Interrupt Enable
DPLL1LCKF : Boolean := False;
-- DPLL1 Lock Timeout Interrupt Enable
DPLL1LTO : Boolean := False;
-- DPLL1 Loop Divider Ratio Update Complete Interrupt Enable
DPLL1LDRTO : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_INTENCLR_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0LTO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1LTO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- OSCCTRL_INTENSET_XOSCRDY array
type OSCCTRL_INTENSET_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENSET_XOSCRDY
type OSCCTRL_INTENSET_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_INTENSET_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENSET_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_INTENSET_XOSCFAIL array
type OSCCTRL_INTENSET_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTENSET_XOSCFAIL
type OSCCTRL_INTENSET_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_INTENSET_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTENSET_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type OSCCTRL_INTENSET_Register is record
-- XOSC 0 Ready Interrupt Enable
XOSCRDY : OSCCTRL_INTENSET_XOSCRDY_Field :=
(As_Array => False, Val => 16#0#);
-- XOSC 0 Clock Failure Detector Interrupt Enable
XOSCFAIL : OSCCTRL_INTENSET_XOSCFAIL_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- DFLL Ready Interrupt Enable
DFLLRDY : Boolean := False;
-- DFLL Out Of Bounds Interrupt Enable
DFLLOOB : Boolean := False;
-- DFLL Lock Fine Interrupt Enable
DFLLLCKF : Boolean := False;
-- DFLL Lock Coarse Interrupt Enable
DFLLLCKC : Boolean := False;
-- DFLL Reference Clock Stopped Interrupt Enable
DFLLRCS : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- DPLL0 Lock Rise Interrupt Enable
DPLL0LCKR : Boolean := False;
-- DPLL0 Lock Fall Interrupt Enable
DPLL0LCKF : Boolean := False;
-- DPLL0 Lock Timeout Interrupt Enable
DPLL0LTO : Boolean := False;
-- DPLL0 Loop Divider Ratio Update Complete Interrupt Enable
DPLL0LDRTO : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- DPLL1 Lock Rise Interrupt Enable
DPLL1LCKR : Boolean := False;
-- DPLL1 Lock Fall Interrupt Enable
DPLL1LCKF : Boolean := False;
-- DPLL1 Lock Timeout Interrupt Enable
DPLL1LTO : Boolean := False;
-- DPLL1 Loop Divider Ratio Update Complete Interrupt Enable
DPLL1LDRTO : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_INTENSET_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0LTO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1LTO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- OSCCTRL_INTFLAG_XOSCRDY array
type OSCCTRL_INTFLAG_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTFLAG_XOSCRDY
type OSCCTRL_INTFLAG_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_INTFLAG_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTFLAG_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_INTFLAG_XOSCFAIL array
type OSCCTRL_INTFLAG_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_INTFLAG_XOSCFAIL
type OSCCTRL_INTFLAG_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_INTFLAG_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_INTFLAG_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type OSCCTRL_INTFLAG_Register is record
-- XOSC 0 Ready
XOSCRDY : OSCCTRL_INTFLAG_XOSCRDY_Field :=
(As_Array => False, Val => 16#0#);
-- XOSC 0 Clock Failure Detector
XOSCFAIL : OSCCTRL_INTFLAG_XOSCFAIL_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- DFLL Ready
DFLLRDY : Boolean := False;
-- DFLL Out Of Bounds
DFLLOOB : Boolean := False;
-- DFLL Lock Fine
DFLLLCKF : Boolean := False;
-- DFLL Lock Coarse
DFLLLCKC : Boolean := False;
-- DFLL Reference Clock Stopped
DFLLRCS : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- DPLL0 Lock Rise
DPLL0LCKR : Boolean := False;
-- DPLL0 Lock Fall
DPLL0LCKF : Boolean := False;
-- DPLL0 Lock Timeout
DPLL0LTO : Boolean := False;
-- DPLL0 Loop Divider Ratio Update Complete
DPLL0LDRTO : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- DPLL1 Lock Rise
DPLL1LCKR : Boolean := False;
-- DPLL1 Lock Fall
DPLL1LCKF : Boolean := False;
-- DPLL1 Lock Timeout
DPLL1LTO : Boolean := False;
-- DPLL1 Loop Divider Ratio Update Complete
DPLL1LDRTO : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_INTFLAG_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range 16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0LTO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1LTO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- OSCCTRL_STATUS_XOSCRDY array
type OSCCTRL_STATUS_XOSCRDY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_STATUS_XOSCRDY
type OSCCTRL_STATUS_XOSCRDY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCRDY as a value
Val : HAL.UInt2;
when True =>
-- XOSCRDY as an array
Arr : OSCCTRL_STATUS_XOSCRDY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_STATUS_XOSCRDY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_STATUS_XOSCFAIL array
type OSCCTRL_STATUS_XOSCFAIL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_STATUS_XOSCFAIL
type OSCCTRL_STATUS_XOSCFAIL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCFAIL as a value
Val : HAL.UInt2;
when True =>
-- XOSCFAIL as an array
Arr : OSCCTRL_STATUS_XOSCFAIL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_STATUS_XOSCFAIL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- OSCCTRL_STATUS_XOSCCKSW array
type OSCCTRL_STATUS_XOSCCKSW_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OSCCTRL_STATUS_XOSCCKSW
type OSCCTRL_STATUS_XOSCCKSW_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- XOSCCKSW as a value
Val : HAL.UInt2;
when True =>
-- XOSCCKSW as an array
Arr : OSCCTRL_STATUS_XOSCCKSW_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OSCCTRL_STATUS_XOSCCKSW_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status
type OSCCTRL_STATUS_Register is record
-- Read-only. XOSC 0 Ready
XOSCRDY : OSCCTRL_STATUS_XOSCRDY_Field;
-- Read-only. XOSC 0 Clock Failure Detector
XOSCFAIL : OSCCTRL_STATUS_XOSCFAIL_Field;
-- Read-only. XOSC 0 Clock Switch
XOSCCKSW : OSCCTRL_STATUS_XOSCCKSW_Field;
-- unspecified
Reserved_6_7 : HAL.UInt2;
-- Read-only. DFLL Ready
DFLLRDY : Boolean;
-- Read-only. DFLL Out Of Bounds
DFLLOOB : Boolean;
-- Read-only. DFLL Lock Fine
DFLLLCKF : Boolean;
-- Read-only. DFLL Lock Coarse
DFLLLCKC : Boolean;
-- Read-only. DFLL Reference Clock Stopped
DFLLRCS : Boolean;
-- unspecified
Reserved_13_15 : HAL.UInt3;
-- Read-only. DPLL0 Lock Rise
DPLL0LCKR : Boolean;
-- Read-only. DPLL0 Lock Fall
DPLL0LCKF : Boolean;
-- Read-only. DPLL0 Timeout
DPLL0TO : Boolean;
-- Read-only. DPLL0 Loop Divider Ratio Update Complete
DPLL0LDRTO : Boolean;
-- unspecified
Reserved_20_23 : HAL.UInt4;
-- Read-only. DPLL1 Lock Rise
DPLL1LCKR : Boolean;
-- Read-only. DPLL1 Lock Fall
DPLL1LCKF : Boolean;
-- Read-only. DPLL1 Timeout
DPLL1TO : Boolean;
-- Read-only. DPLL1 Loop Divider Ratio Update Complete
DPLL1LDRTO : Boolean;
-- unspecified
Reserved_28_31 : HAL.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_STATUS_Register use record
XOSCRDY at 0 range 0 .. 1;
XOSCFAIL at 0 range 2 .. 3;
XOSCCKSW at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
DFLLRDY at 0 range 8 .. 8;
DFLLOOB at 0 range 9 .. 9;
DFLLLCKF at 0 range 10 .. 10;
DFLLLCKC at 0 range 11 .. 11;
DFLLRCS at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DPLL0LCKR at 0 range -- See the reference manual of your device for more information on the
-- configuration of DFLL.
16 .. 16;
DPLL0LCKF at 0 range 17 .. 17;
DPLL0TO at 0 range 18 .. 18;
DPLL0LDRTO at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
DPLL1LCKR at 0 range 24 .. 24;
DPLL1LCKF at 0 range 25 .. 25;
DPLL1TO at 0 range 26 .. 26;
DPLL1LDRTO at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype OSCCTRL_XOSCCTRL_IPTAT_Field is HAL.UInt2;
subtype OSCCTRL_XOSCCTRL_IMULT_Field is HAL.UInt4;
subtype OSCCTRL_XOSCCTRL_STARTUP_Field is HAL.UInt4;
subtype OSCCTRL_XOSCCTRL_CFDPRESC_Field is HAL.UInt4;
-- External Multipurpose Crystal Oscillator Control
type OSCCTRL_XOSCCTRL_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Oscillator Enable
ENABLE : Boolean := False;
-- Crystal Oscillator Enable
XTALEN : Boolean := False;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- On Demand Control
ONDEMAND : Boolean := True;
-- Low Buffer Gain Enable
LOWBUFGAIN : Boolean := False;
-- Oscillator Current Reference
IPTAT : OSCCTRL_XOSCCTRL_IPTAT_Field := 16#0#;
-- Oscillator Current Multiplier
IMULT : OSCCTRL_XOSCCTRL_IMULT_Field := 16#0#;
-- Automatic Loop Control Enable
ENALC : Boolean := False;
-- Clock Failure Detector Enable
CFDEN : Boolean := False;
-- Xosc Clock Switch Enable
SWBEN : Boolean := False;
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- Start-Up Time
STARTUP : OSCCTRL_XOSCCTRL_STARTUP_Field := 16#0#;
-- Clock Failure Detector Prescaler
CFDPRESC : OSCCTRL_XOSCCTRL_CFDPRESC_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_XOSCCTRL_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
XTALEN at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
LOWBUFGAIN at 0 range 8 .. 8;
IPTAT at 0 range 9 .. 10;
IMULT at 0 range 11 .. 14;
ENALC at 0 range 15 .. 15;
CFDEN at 0 range 16 .. 16;
SWBEN at 0 range 17 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
STARTUP at 0 range 20 .. 23;
CFDPRESC at 0 range 24 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- External Multipurpose Crystal Oscillator Control
type OSCCTRL_XOSCCTRL_Registers is array (0 .. 1)
of OSCCTRL_XOSCCTRL_Register;
-- DFLL48M Control A
type OSCCTRL_DFLLCTRLA_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- DFLL Enable
ENABLE : Boolean := True;
-- unspecified
Reserved_2_5 : HAL.UInt4 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- On Demand Control
ONDEMAND : Boolean := True;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLCTRLA_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_5 at 0 range 2 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
end record;
-- DFLL48M Control B
type OSCCTRL_DFLLCTRLB_Register is record
-- Operating Mode Selection
MODE : Boolean := False;
-- Stable DFLL Frequency
STABLE : Boolean := False;
-- Lose Lock After Wake
LLAW : Boolean := False;
-- USB Clock Recovery Mode
USBCRM : Boolean := False;
-- Chill Cycle Disable
CCDIS : Boolean := False;
-- Quick Lock Disable
QLDIS : Boolean := False;
-- Bypass Coarse Lock
BPLCKC : Boolean := False;
-- Wait Lock
WAITLOCK : Boolean := False;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLCTRLB_Register use record
MODE at 0 range 0 .. 0;
STABLE at 0 range 1 .. 1;
LLAW at 0 range 2 .. 2;
USBCRM at 0 range 3 .. 3;
CCDIS at 0 range 4 .. 4;
QLDIS at 0 range 5 .. 5;
BPLCKC at 0 range 6 .. 6;
WAITLOCK at 0 range 7 .. 7;
end record;
subtype OSCCTRL_DFLLVAL_FINE_Field is HAL.UInt8;
subtype OSCCTRL_DFLLVAL_COARSE_Field is HAL.UInt6;
subtype OSCCTRL_DFLLVAL_DIFF_Field is HAL.UInt16;
-- DFLL48M Value
type OSCCTRL_DFLLVAL_Register is record
-- Fine Value
FINE : OSCCTRL_DFLLVAL_FINE_Field := 16#0#;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Coarse Value
COARSE : OSCCTRL_DFLLVAL_COARSE_Field := 16#0#;
-- Read-only. Multiplication Ratio Difference
DIFF : OSCCTRL_DFLLVAL_DIFF_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLVAL_Register use record
FINE at 0 range 0 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
COARSE at 0 range 10 .. 15;
DIFF at 0 range 16 .. 31;
end record;
subtype OSCCTRL_DFLLMUL_MUL_Field is HAL.UInt16;
subtype OSCCTRL_DFLLMUL_FSTEP_Field is HAL.UInt8;
subtype OSCCTRL_DFLLMUL_CSTEP_Field is HAL.UInt6;
-- DFLL48M Multiplier
type OSCCTRL_DFLLMUL_Register is record
-- DFLL Multiply Factor
MUL : OSCCTRL_DFLLMUL_MUL_Field := 16#0#;
-- Fine Maximum Step
FSTEP : OSCCTRL_DFLLMUL_FSTEP_Field := 16#0#;
-- unspecified
Reserved_24_25 : HAL.UInt2 := 16#0#;
-- Coarse Maximum Step
CSTEP : OSCCTRL_DFLLMUL_CSTEP_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLMUL_Register use record
MUL at 0 range 0 .. 15;
FSTEP at 0 range 16 .. 23;
Reserved_24_25 at 0 range 24 .. 25;
CSTEP at 0 range 26 .. 31;
end record;
-- DFLL48M Synchronization
type OSCCTRL_DFLLSYNC_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit;
-- Read-only. ENABLE Synchronization Busy
ENABLE : Boolean;
-- Read-only. DFLLCTRLB Synchronization Busy
DFLLCTRLB : Boolean;
-- Read-only. DFLLVAL Synchronization Busy
DFLLVAL : Boolean;
-- Read-only. DFLLMUL Synchronization Busy
DFLLMUL : Boolean;
-- unspecified
Reserved_5_7 : HAL.UInt3;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for OSCCTRL_DFLLSYNC_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
DFLLCTRLB at 0 range 2 .. 2;
DFLLVAL at 0 range 3 .. 3;
DFLLMUL at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
-- DPLL Control A
type DPLLCTRLA_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- DPLL Enable
ENABLE : Boolean := False;
-- unspecified
Reserved_2_5 : HAL.UInt4 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- On Demand Control
ONDEMAND : Boolean := True;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for DPLLCTRLA_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_5 at 0 range 2 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
end record;
subtype DPLLRATIO_LDR_Field is HAL.UInt13;
subtype DPLLRATIO_LDRFRAC_Field is HAL.UInt5;
-- DPLL Ratio Control
type DPLLRATIO_Register is record
-- Loop Divider Ratio
LDR : DPLLRATIO_LDR_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Loop Divider Ratio Fractional Part
LDRFRAC : DPLLRATIO_LDRFRAC_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DPLLRATIO_Register use record
LDR at 0 range 0 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
LDRFRAC at 0 range 16 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
subtype DPLLCTRLB_FILTER_Field is HAL.UInt4;
-- Reference Clock Selection
type DPLLCTRLB0_REFCLKSelect is
(-- Dedicated GCLK clock reference
Gclk,
-- XOSC32K clock reference
Xosc32,
-- XOSC0 clock reference
Xosc0,
-- XOSC1 clock reference
Xosc1)
with Size => 3;
for DPLLCTRLB0_REFCLKSelect use
(Gclk => 0,
Xosc32 => 1,
Xosc0 => 2,
Xosc1 => 3);
-- Lock Time
type DPLLCTRLB0_LTIMESelect is
(-- No time-out. Automatic lock
Default,
-- Time-out if no lock within 800us
Val_800Us,
-- Time-out if no lock within 900us
Val_900Us,
-- Time-out if no lock within 1ms
Val_1Ms,
-- Time-out if no lock within 1.1ms
Val_1P1Ms)
with Size => 3;
for DPLLCTRLB0_LTIMESelect use
(Default => 0,
Val_800Us => 4,
Val_900Us => 5,
Val_1Ms => 6,
Val_1P1Ms => 7);
subtype DPLLCTRLB_DCOFILTER_Field is HAL.UInt3;
subtype DPLLCTRLB_DIV_Field is HAL.UInt11;
-- DPLL Control B
type DPLLCTRLB_Register is record
-- Proportional Integral Filter Selection
FILTER : DPLLCTRLB_FILTER_Field := 16#0#;
-- Wake Up Fast
WUF : Boolean := False;
-- Reference Clock Selection
REFCLK : DPLLCTRLB0_REFCLKSelect := SAM_SVD.OSCCTRL.Xosc32;
-- Lock Time
LTIME : DPLLCTRLB0_LTIMESelect := SAM_SVD.OSCCTRL.Default;
-- Lock Bypass
LBYPASS : Boolean := False;
-- Sigma-Delta DCO Filter Selection
DCOFILTER : DPLLCTRLB_DCOFILTER_Field := 16#0#;
-- DCO Filter Enable
DCOEN : Boolean := False;
-- Clock Divider
DIV : DPLLCTRLB_DIV_Field := 16#0#;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DPLLCTRLB_Register use record
FILTER at 0 range 0 .. 3;
WUF at 0 range 4 .. 4;
REFCLK at 0 range 5 .. 7;
LTIME at 0 range 8 .. 10;
LBYPASS at 0 range 11 .. 11;
DCOFILTER at 0 range 12 .. 14;
DCOEN at 0 range 15 .. 15;
DIV at 0 range 16 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- DPLL Synchronization Busy
type DPLLSYNCBUSY_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit;
-- Read-only. DPLL Enable Synchronization Status
ENABLE : Boolean;
-- Read-only. DPLL Loop Divider Ratio Synchronization Status
DPLLRATIO : Boolean;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DPLLSYNCBUSY_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
DPLLRATIO at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- DPLL Status
type DPLLSTATUS_Register is record
-- Read-only. DPLL Lock Status
LOCK : Boolean;
-- Read-only. DPLL Clock Ready
CLKRDY : Boolean;
-- unspecified
Reserved_2_31 : HAL.UInt30;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DPLLSTATUS_Register use record
LOCK at 0 range 0 .. 0;
CLKRDY at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Oscillators Control
type OSCCTRL_Peripheral is record
-- Event Control
EVCTRL : aliased OSCCTRL_EVCTRL_Register;
-- Interrupt Enable Clear
INTENCLR : aliased OSCCTRL_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased OSCCTRL_INTENSET_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased OSCCTRL_INTFLAG_Register;
-- Status
STATUS : aliased OSCCTRL_STATUS_Register;
-- External Multipurpose Crystal Oscillator Control
XOSCCTRL : aliased OSCCTRL_XOSCCTRL_Registers;
-- DFLL48M Control A
DFLLCTRLA : aliased OSCCTRL_DFLLCTRLA_Register;
-- DFLL48M Control B
DFLLCTRLB : aliased OSCCTRL_DFLLCTRLB_Register;
-- DFLL48M Value
DFLLVAL : aliased OSCCTRL_DFLLVAL_Register;
-- DFLL48M Multiplier
DFLLMUL : aliased OSCCTRL_DFLLMUL_Register;
-- DFLL48M Synchronization
DFLLSYNC : aliased OSCCTRL_DFLLSYNC_Register;
-- DPLL Control A
DPLLCTRLA0 : aliased DPLLCTRLA_Register;
-- DPLL Ratio Control
DPLLRATIO0 : aliased DPLLRATIO_Register;
-- DPLL Control B
DPLLCTRLB0 : aliased DPLLCTRLB_Register;
-- DPLL Synchronization Busy
DPLLSYNCBUSY0 : aliased DPLLSYNCBUSY_Register;
-- DPLL Status
DPLLSTATUS0 : aliased DPLLSTATUS_Register;
-- DPLL Control A
DPLLCTRLA1 : aliased DPLLCTRLA_Register;
-- DPLL Ratio Control
DPLLRATIO1 : aliased DPLLRATIO_Register;
-- DPLL Control B
DPLLCTRLB1 : aliased DPLLCTRLB_Register;
-- DPLL Synchronization Busy
DPLLSYNCBUSY1 : aliased DPLLSYNCBUSY_Register;
-- DPLL Status
DPLLSTATUS1 : aliased DPLLSTATUS_Register;
end record
with Volatile;
for OSCCTRL_Peripheral use record
EVCTRL at 16#0# range 0 .. 7;
INTENCLR at 16#4# range 0 .. 31;
INTENSET at 16#8# range 0 .. 31;
INTFLAG at 16#C# range 0 .. 31;
STATUS at 16#10# range 0 .. 31;
XOSCCTRL at 16#14# range 0 .. 63;
DFLLCTRLA at 16#1C# range 0 .. 7;
DFLLCTRLB at 16#20# range 0 .. 7;
DFLLVAL at 16#24# range 0 .. 31;
DFLLMUL at 16#28# range 0 .. 31;
DFLLSYNC at 16#2C# range 0 .. 7;
DPLLCTRLA0 at 16#30# range 0 .. 7;
DPLLRATIO0 at 16#34# range 0 .. 31;
DPLLCTRLB0 at 16#38# range 0 .. 31;
DPLLSYNCBUSY0 at 16#3C# range 0 .. 31;
DPLLSTATUS0 at 16#40# range 0 .. 31;
DPLLCTRLA1 at 16#44# range 0 .. 7;
DPLLRATIO1 at 16#48# range 0 .. 31;
DPLLCTRLB1 at 16#4C# range 0 .. 31;
DPLLSYNCBUSY1 at 16#50# range 0 .. 31;
DPLLSTATUS1 at 16#54# range 0 .. 31;
end record;
-- Oscillators Control
OSCCTRL_Periph : aliased OSCCTRL_Peripheral
with Import, Address => OSCCTRL_Base;
end SAM_SVD.OSCCTRL;
|
30,362
|
ada
| 1
|
danva994/ASFML-1.6
|
include/sf-graphics-color.ads
|
<reponame>danva994/ASFML-1.6
-- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 <NAME> (<EMAIL>)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
-- ////////////////////////////////////////////////////////////
-- // Headers
-- ////////////////////////////////////////////////////////////
with Sf.Config;
package Sf.Graphics.Color is
use Sf.Config;
-- ////////////////////////////////////////////////////////////
-- /// sfColor is an utility class for manipulating colors
-- ////////////////////////////////////////////////////////////
type sfColor is record
r : aliased sfUint8;
g : aliased sfUint8;
b : aliased sfUint8;
a : aliased sfUint8;
end record;
pragma Convention (C_Pass_By_Copy, sfColor);
-- ////////////////////////////////////////////////////////////
-- /// Define some common colors
-- ////////////////////////////////////////////////////////////
sfBlack : constant sfColor := (0, 0, 0, 255);
sfWhite : constant sfColor := (255, 255, 255, 255);
sfRed : constant sfColor := (255, 0, 0, 255);
sfGreen : constant sfColor := (0, 255, 0, 255);
sfBlue : constant sfColor := (0, 0, 255, 255);
sfYellow : constant sfColor := (255, 255, 0, 255);
sfMagenta : constant sfColor := (255, 0, 255, 255);
sfCyan : constant sfColor := (0, 255, 255, 255);
-- ////////////////////////////////////////////////////////////
-- /// Construct a color from its 3 RGB components
-- ///
-- /// \param R : Red component (0 .. 255)
-- /// \param G : Green component (0 .. 255)
-- /// \param B : Blue component (0 .. 255)
-- ///
-- /// \return sfColor constructed from the components
-- ///
-- ////////////////////////////////////////////////////////////
function sfColor_FromRGB (R, G, B : sfUint8) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Construct a color from its 4 RGBA components
-- ///
-- /// \param R : Red component (0 .. 255)
-- /// \param G : Green component (0 .. 255)
-- /// \param B : Blue component (0 .. 255)
-- /// \param A : Alpha component (0 .. 255)
-- ///
-- /// \return sfColor constructed from the components
-- ///
-- ////////////////////////////////////////////////////////////
function sfColor_FromRGBA (R, G, B, A : sfUint8) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Add two colors
-- ///
-- /// \param Color1 : First color
-- /// \param Color2 : Second color
-- ///
-- /// \return Component-wise saturated addition of the two colors
-- ///
-- ////////////////////////////////////////////////////////////
function sfColor_Add (Color1, Color2 : sfColor) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Modulate two colors
-- ///
-- /// \param Color1 : First color
-- /// \param Color2 : Second color
-- ///
-- /// \return Component-wise multiplication of the two colors
-- ///
-- ////////////////////////////////////////////////////////////
function sfColor_Modulate (Color1, Color2 : sfColor) return sfColor;
private
pragma Import (C, sfColor_FromRGB, "sfColor_FromRGB");
pragma Import (C, sfColor_FromRGBA, "sfColor_FromRGBA");
pragma Import (C, sfColor_Add, "sfColor_Add");
pragma Import (C, sfColor_Modulate, "sfColor_Modulate");
end Sf.Graphics.Color;
|
30,363
|
ada
| 1
|
LaudateCorpus1/RosettaCodeData
|
Task/Exponentiation-operator/Ada/exponentiation-operator-1.ada
|
<filename>Task/Exponentiation-operator/Ada/exponentiation-operator-1.ada
package Integer_Exponentiation is
-- int^int
procedure Exponentiate (Argument : in Integer;
Exponent : in Natural;
Result : out Integer);
function "**" (Left : Integer;
Right : Natural) return Integer;
-- real^int
procedure Exponentiate (Argument : in Float;
Exponent : in Integer;
Result : out Float);
function "**" (Left : Float;
Right : Integer) return Float;
end Integer_Exponentiation;
|
30,364
|
ada
| 0
|
rkoeninger/life
|
src/world.adb
|
package body World is
---------------
-- New_World --
---------------
function New_World (Size : Positive) return World_Grid is
begin
return World_Grid'(Size => Size,
Grid1 => (others => (others => False)),
Grid2 => (others => (others => False)),
Step => 0);
end;
--------------
-- Get_Spot --
--------------
function Get_Spot (W : World_Grid; X, Y : Positive) return Boolean is
begin
if X not in 1 .. W.Size or Y not in 1 .. W.Size then
return False;
elsif W.Size mod 2 = 1 then
return W.Grid1 (X, Y);
else
return W.Grid2 (X, Y);
end if;
end;
--------------
-- Set_Spot --
--------------
procedure Set_Spot (W : in out World_Grid; X, Y : Positive; B : Boolean) is
begin
if W.Size mod 2 = 1 then
W.Grid2 (X, Y) := B;
else
W.Grid1 (X, Y) := B;
end if;
end;
--------------
-- Run_Step --
--------------
procedure Run_Step (W : in out World_Grid) is
Count : Natural;
begin
W.Step := W.Step + 1;
for X in Positive range 1 .. W.Size loop
for Y in Positive range 1 .. W.Size loop
Count := Live_Neighbors (W, X, Y);
if Count < 2 then
Set_Spot (W, X, Y, False); -- Underpopulation
elsif Count = 2 then
Set_Spot (W, X, Y, Get_Spot (W, X, Y)); -- Survival
elsif Count = 3 then
Set_Spot (W, X, Y, True); -- Reproduction
elsif Count > 3 then
Set_Spot (W, X, Y, False); -- Overpopulation
end if;
end loop;
end loop;
end;
--------------------
-- Live_Neighbors --
--------------------
function Live_Neighbors (W : World_Grid; X, Y : Positive) return Natural is
Count : Natural := 0;
procedure Count_Neighbor (W : World_Grid; Count : in out Natural; X, Y : Positive) is
begin
if Get_Spot (W, X, Y) then
Count := Count + 1;
end if;
end Count_Neighbor;
begin
Count_Neighbor (W, Count, X - 1, Y - 1);
Count_Neighbor (W, Count, X, Y - 1);
Count_Neighbor (W, Count, X + 1, Y - 1);
Count_Neighbor (W, Count, X - 1, Y);
Count_Neighbor (W, Count, X + 1, Y);
Count_Neighbor (W, Count, X - 1, Y + 1);
Count_Neighbor (W, Count, X, Y + 1);
Count_Neighbor (W, Count, X + 1, Y + 1);
return Count;
end;
end;
|
30,365
|
ada
| 0
|
fintatarta/eugen
|
src/Projects/eu_projects.adb
|
<filename>src/Projects/eu_projects.adb
pragma Ada_2012;
with Tokenize.Token_Vectors;
with Ada.Text_IO; use Ada.Text_IO;
package body EU_Projects is
function Verbose_To_ID (X : String) return Dotted_Identifier
is
begin
Put_Line ("TT(" & X & ")" & Is_Valid_ID (X)'Image);
return To_Bounded_String (X);
end Verbose_To_ID;
----------------
-- To_ID_List --
----------------
function To_ID_List (Input : String;
Separators : String := " ,")
return ID_List
is
use Tokenize;
Result : ID_List;
Splitted : constant Token_Vectors.Vector :=
Token_Vectors.To_Vector(Split (To_Be_Splitted => Input,
Separator => Separators,
Collate_Separator => True));
OK : Boolean;
Consumed : Natural;
Tmp : Dotted_Identifier;
begin
for ID of Splitted loop
-- Put_Line ("[" & Id & "]");
ID_Readers.Reader (Input => ID,
Success => OK,
Consumed => Consumed,
Result => Tmp);
-- Put_Line (Ok'Image & " " & Consumed'Image & "(" & To_String (Tmp) & ")");
if not OK or Consumed < ID'Length then
raise Bad_Identifier with "Bad ID in '" & ID & "'";
else
Result.Append (Tmp);
end if;
end loop;
return Result;
end To_ID_List;
end EU_Projects;
|
30,366
|
ada
| 0
|
JeremyGrosser/arm_cmsis_dsp
|
src/quaternion_math_functions_h.ads
|
pragma Ada_2012;
pragma Style_Checks (Off);
pragma Warnings ("U");
with Interfaces.C; use Interfaces.C;
with arm_math_types_h;
with sys_ustdint_h;
package quaternion_math_functions_h is
procedure arm_quaternion_norm_f32
(pInputQuaternions : access arm_math_types_h.float32_t;
pNorms : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:60
with Import => True,
Convention => C,
External_Name => "arm_quaternion_norm_f32";
procedure arm_quaternion_inverse_f32
(pInputQuaternions : access arm_math_types_h.float32_t;
pInverseQuaternions : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:73
with Import => True,
Convention => C,
External_Name => "arm_quaternion_inverse_f32";
procedure arm_quaternion_conjugate_f32
(inputQuaternions : access arm_math_types_h.float32_t;
pConjugateQuaternions : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:84
with Import => True,
Convention => C,
External_Name => "arm_quaternion_conjugate_f32";
procedure arm_quaternion_normalize_f32
(inputQuaternions : access arm_math_types_h.float32_t;
pNormalizedQuaternions : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:95
with Import => True,
Convention => C,
External_Name => "arm_quaternion_normalize_f32";
procedure arm_quaternion_product_single_f32
(qa : access arm_math_types_h.float32_t;
qb : access arm_math_types_h.float32_t;
r : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:107
with Import => True,
Convention => C,
External_Name => "arm_quaternion_product_single_f32";
procedure arm_quaternion_product_f32
(qa : access arm_math_types_h.float32_t;
qb : access arm_math_types_h.float32_t;
r : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:119
with Import => True,
Convention => C,
External_Name => "arm_quaternion_product_f32";
procedure arm_quaternion2rotation_f32
(pInputQuaternions : access arm_math_types_h.float32_t;
pOutputRotations : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:140
with Import => True,
Convention => C,
External_Name => "arm_quaternion2rotation_f32";
procedure arm_rotation2quaternion_f32
(pInputRotations : access arm_math_types_h.float32_t;
pOutputQuaternions : access arm_math_types_h.float32_t;
nbQuaternions : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/quaternion_math_functions.h:151
with Import => True,
Convention => C,
External_Name => "arm_rotation2quaternion_f32";
end quaternion_math_functions_h;
|
30,367
|
ada
| 4
|
davidkristola/vole
|
string_ops.ads
|
-- public domain
with Ada.Calendar;
with Ada.Strings.Maps;
with Interfaces;
package String_Ops is
pragma Elaborate_Body;
type String_Pointer_Type is access String;
-- All the control characters plus space and non-breaking-space.
--
function Is_White_Space
(Char : in Character) return Boolean;
-- The Stuff routines place the source into the target,
-- padding with space or zeros.
--
procedure Stuff
(This : in String;
Into : out String);
procedure Stuff_Right
(This : in String;
Into : out String);
procedure Stuff_Number
(Number : in Integer;
Into : out String);
procedure Stuff_Hex
(Number : in Interfaces.Unsigned_32;
Into : out String);
-- Kills Ada comments from The_String
--
function Drop_Ada_Comments
(The_String : String) return String;
function Drop_Vole_Comments
(The_String : String) return String;
function Up_Case
(The_String : String) return String;
function Down_Case
(The_String : String) return String;
-- Discards blanks from the front and back end
-- of The_String.
--
function Trim_Blanks
(The_String : String) return String;
-- Many times the important string will be enclosed in
-- quotation marks or brackets. This trims one character
-- off of each end.
--
function Trim_One_From_Both_Ends(The_String : String) return String;
-- Discards non-printable characters from
-- The_String.
--
function Filter
(The_String : String) return String;
-- Return the first substring of Str (deliniated by white space).
-- Note: Str is assumed to not start with white space.
--
function First
(Str : in String) return String;
-- Return the second part of Str.
--
function Rest
(Str : in String) return String;
-- Return the second substring of Str (deliniated by white space).
--
function Second
(Str : in String) return String;
-- This returns the Rest of the Rest.
--
function Second_Rest
(Str : in String) return String;
-- Return the third substring of Str (deliniated by white space).
--
function Third
(Str : in String) return String;
-- Return the Nth substring of Str (deliniated by white space).
--
function Nth
(Str : in String;
N : in Positive) return String;
-- Return the Nth substring of Str (deliniated by Set).
--
function Nth
(Str : in String;
N : in Positive;
Set : in Ada.Strings.Maps.Character_Set) return String;
-- This is a caseless compare.
--
function Same(L, R : in String) return Boolean;
-- This is a specialized "=" for strings. For
-- the length of the smaller of Check and Master,
-- both strings must be the same.
--
function Conformance
(Master : in String;
Check : in String) return Boolean;
-- Returns a string in the form "16#0000_0000#"
--
function Integer_To_Hex_String
(Value : in Interfaces.Unsigned_32) return String;
-- These return images without leading blanks.
--
function Str
(Int : Integer) return String;
function Str
(Int : Interfaces.Unsigned_32) return String;
-- This "image" routine will only resort to scientific notation
-- if the number is too large or too small.
--
function Img
(Flt : Float) return String;
-- This will take a number (floating point or integer) from the
-- string and return a Float.
--
function Value
(Str : String) return Float;
function Img
(Int : Integer) return String renames Str;
function Value
(Str : String) return Integer;
function Long_Date
(Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String;
function Short_Date
(Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String;
function Date_As_Filename
(Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String;
function IP_Address
(Addr : Interfaces.Unsigned_32) return String;
-----------------------------------------------------------------------------
generic
type Selection_Type is (<>); -- enumeration
package Selection_Ops is
-- Return true if and only if Str passes "Conformance"
-- to the image of a member of Selection_Type.
-- Str is up cased before conformance checking.
--
function String_Matches
(Str : in String) return Boolean;
-- Return the number of "Conformance" matches.
--
function String_Matches
(Str : in String) return Natural;
-- Returns the first member of Selection_Type to
-- conform to Str, or the first member of
-- Selection_Type.
--
function To_Selection
(Str : in String) return Selection_Type;
end Selection_Ops;
end String_Ops;
|
30,368
|
ada
| 12
|
jquorning/ada-asf
|
src/asf-applications-views.adb
|
-----------------------------------------------------------------------
-- applications -- Ada Web Application
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2018, 2020, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Fixed;
with ASF.Contexts.Facelets;
with ASF.Applications.Main;
with ASF.Components.Base;
with ASF.Components.Core;
with ASF.Components.Core.Views;
with ASF.Converters;
with ASF.Validators;
with EL.Objects;
package body ASF.Applications.Views is
use ASF.Components;
type Facelet_Context is new ASF.Contexts.Facelets.Facelet_Context with record
Facelets : access ASF.Views.Facelets.Facelet_Factory;
Application : access ASF.Applications.Main.Application'Class;
end record;
-- Include the definition having the given name.
overriding
procedure Include_Facelet (Context : in out Facelet_Context;
Source : in String;
Parent : in Base.UIComponent_Access);
overriding
function Get_Converter (Context : in Facelet_Context;
Name : in EL.Objects.Object)
return ASF.Converters.Converter_Access;
overriding
function Get_Validator (Context : in Facelet_Context;
Name : in EL.Objects.Object)
return ASF.Validators.Validator_Access;
-- Compose a URI path with two components. Unlike the Ada.Directories.Compose,
-- and Util.Files.Compose the path separator must be a URL path separator (ie, '/').
-- ------------------------------
function Compose (Directory : in String;
Name : in String) return String;
-- ------------------------------
-- Include the definition having the given name.
-- ------------------------------
overriding
procedure Include_Facelet (Context : in out Facelet_Context;
Source : in String;
Parent : in Base.UIComponent_Access) is
use ASF.Views;
Path : constant String := Context.Resolve_Path (Source);
Tree : Facelets.Facelet;
begin
Facelets.Find_Facelet (Factory => Context.Facelets.all,
Name => Path,
Context => Context,
Result => Tree);
Facelets.Build_View (View => Tree,
Context => Context,
Root => Parent);
end Include_Facelet;
-- ------------------------------
-- Get a converter from a name.
-- Returns the converter object or null if there is no converter.
-- ------------------------------
function Get_Converter (Context : in Facelet_Context;
Name : in EL.Objects.Object)
return ASF.Converters.Converter_Access is
begin
return Context.Application.Find (Name);
end Get_Converter;
-- ------------------------------
-- Get a validator from a name.
-- Returns the validator object or null if there is no validator.
-- ------------------------------
function Get_Validator (Context : in Facelet_Context;
Name : in EL.Objects.Object)
return ASF.Validators.Validator_Access is
begin
return Context.Application.Find_Validator (Name);
end Get_Validator;
-- ------------------------------
-- Get the facelet name from the view name.
-- ------------------------------
function Get_Facelet_Name (Handler : in View_Handler;
Name : in String) return String is
use Ada.Strings.Fixed;
use Ada.Strings.Unbounded;
Pos : constant Natural := Index (Name, ".", Ada.Strings.Backward);
begin
if Pos > 0 and then Handler.View_Ext = Name (Pos .. Name'Last) then
return Name (Name'First .. Pos - 1) & To_String (Handler.File_Ext);
elsif Pos > 0 and then Handler.File_Ext = Name (Pos .. Name'Last) then
return Name;
end if;
return Name & To_String (Handler.File_Ext);
end Get_Facelet_Name;
-- ------------------------------
-- Restore the view identified by the given name in the faces context
-- and create the component tree representing that view.
-- ------------------------------
procedure Restore_View (Handler : in out View_Handler;
Name : in String;
Context : in out ASF.Contexts.Faces.Faces_Context'Class;
View : out ASF.Components.Root.UIViewRoot;
Ignore : in Boolean := False) is
use ASF.Views;
use Util.Locales;
use type ASF.Components.Base.UIComponent_Access;
Ctx : Facelet_Context;
Tree : Facelets.Facelet;
View_Name : constant String := Handler.Get_Facelet_Name (Name);
begin
Ctx.Facelets := Handler.Facelets'Unchecked_Access;
Ctx.Application := Context.Get_Application;
Ctx.Set_ELContext (Context.Get_ELContext);
Facelets.Find_Facelet (Factory => Handler.Facelets,
Name => View_Name,
Context => Ctx,
Result => Tree,
Ignore => Ignore);
-- If the view could not be found, do not report any error yet.
-- The SC_NOT_FOUND response will be returned when rendering the response.
if Facelets.Is_Null (Tree) then
return;
end if;
-- Build the component tree for this request.
declare
Root : aliased Core.UIComponentBase;
Node : Base.UIComponent_Access;
begin
Facelets.Build_View (View => Tree,
Context => Ctx,
Root => Root'Unchecked_Access);
ASF.Components.Base.Steal_Root_Component (Root, Node);
-- If there was some error while building the view, return now.
-- The SC_NOT_FOUND response will also be returned when rendering the response.
if Node = null then
return;
end if;
ASF.Components.Root.Set_Root (View, Node, View_Name);
if Context.Get_Locale = NULL_LOCALE then
if Node.all in Core.Views.UIView'Class then
Context.Set_Locale (Core.Views.UIView'Class (Node.all).Get_Locale (Context));
else
Context.Set_Locale (Handler.Calculate_Locale (Context));
end if;
end if;
end;
end Restore_View;
-- ------------------------------
-- Create a new UIViewRoot instance initialized from the context and with
-- the view identifier. If the view is a valid view, create the component tree
-- representing that view.
-- ------------------------------
procedure Create_View (Handler : in out View_Handler;
Name : in String;
Context : in out ASF.Contexts.Faces.Faces_Context'Class;
View : out ASF.Components.Root.UIViewRoot;
Ignore : in Boolean := False) is
Pos : constant Natural := Util.Strings.Rindex (Name, '.');
begin
if Pos > 0 then
Handler.Restore_View (Name (Name'First .. Pos - 1), Context, View, Ignore);
else
Handler.Restore_View (Name, Context, View, Ignore);
end if;
end Create_View;
-- ------------------------------
-- Render the view represented by the component tree. The view is
-- rendered using the context.
-- ------------------------------
procedure Render_View (Handler : in out View_Handler;
Context : in out ASF.Contexts.Faces.Faces_Context'Class;
View : in ASF.Components.Root.UIViewRoot) is
pragma Unreferenced (Handler);
Root : constant access ASF.Components.Base.UIComponent'Class
:= ASF.Components.Root.Get_Root (View);
begin
if Root /= null then
Root.Encode_All (Context);
end if;
end Render_View;
-- ------------------------------
-- Compute the locale that must be used according to the <b>Accept-Language</b> request
-- header and the application supported locales.
-- ------------------------------
function Calculate_Locale (Handler : in View_Handler;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Util.Locales.Locale is
pragma Unreferenced (Handler);
App : constant ASF.Contexts.Faces.Application_Access := Context.Get_Application;
begin
return App.Calculate_Locale (Context);
end Calculate_Locale;
-- ------------------------------
-- Compose a URI path with two components. Unlike the Ada.Directories.Compose,
-- and Util.Files.Compose the path separator must be a URL path separator (ie, '/').
-- ------------------------------
function Compose (Directory : in String;
Name : in String) return String is
begin
if Directory'Length = 0 then
return Name;
elsif Directory (Directory'Last) = '/' and Name (Name'First) = '/' then
return Directory & Name (Name'First + 1 .. Name'Last);
elsif Directory (Directory'Last) = '/' or Name (Name'First) = '/' then
return Directory & Name;
else
return Directory & "/" & Name;
end if;
end Compose;
-- ------------------------------
-- Get the URL suitable for encoding and rendering the view specified by the <b>View</b>
-- identifier.
-- ------------------------------
function Get_Action_URL (Handler : in View_Handler;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
View : in String) return String is
use Ada.Strings.Unbounded;
Pos : constant Natural := Util.Strings.Rindex (View, '.');
Context_Path : constant String := Context.Get_Request.Get_Context_Path;
begin
if Pos > 0 and then View (Pos .. View'Last) = Handler.File_Ext then
return Compose (Context_Path,
View (View'First .. Pos - 1) & To_String (Handler.View_Ext));
end if;
if Pos > 0 and then View (Pos .. View'Last) = Handler.View_Ext then
return Compose (Context_Path, View);
end if;
return Compose (Context_Path, View);
end Get_Action_URL;
-- ------------------------------
-- Get the URL for redirecting the user to the specified view.
-- ------------------------------
function Get_Redirect_URL (Handler : in View_Handler;
Context : in ASF.Contexts.Faces.Faces_Context'Class;
View : in String) return String is
Pos : constant Natural := Util.Strings.Rindex (View, '?');
begin
if Pos > 0 then
return Handler.Get_Action_URL (Context, View (View'First .. Pos - 1))
& View (Pos .. View'Last);
else
return Handler.Get_Action_URL (Context, View);
end if;
end Get_Redirect_URL;
-- ------------------------------
-- Initialize the view handler.
-- ------------------------------
procedure Initialize (Handler : out View_Handler;
Components : access ASF.Factory.Component_Factory;
Conf : in Config) is
use ASF.Views;
use Ada.Strings.Unbounded;
begin
Handler.Paths := Conf.Get (VIEW_DIR_PARAM);
Handler.View_Ext := Conf.Get (VIEW_EXT_PARAM);
Handler.File_Ext := Conf.Get (VIEW_FILE_EXT_PARAM);
Facelets.Initialize (Factory => Handler.Facelets,
Components => Components,
Paths => To_String (Handler.Paths),
Ignore_White_Spaces => Conf.Get (VIEW_IGNORE_WHITE_SPACES_PARAM),
Ignore_Empty_Lines => Conf.Get (VIEW_IGNORE_EMPTY_LINES_PARAM),
Escape_Unknown_Tags => Conf.Get (VIEW_ESCAPE_UNKNOWN_TAGS_PARAM));
end Initialize;
-- ------------------------------
-- Closes the view handler
-- ------------------------------
procedure Close (Handler : in out View_Handler) is
use ASF.Views;
begin
Facelets.Clear_Cache (Handler.Facelets);
end Close;
-- ------------------------------
-- Set the extension mapping rule to find the facelet file from
-- the name.
-- ------------------------------
procedure Set_Extension_Mapping (Handler : in out View_Handler;
From : in String;
Into : in String) is
use Ada.Strings.Unbounded;
begin
Handler.View_Ext := To_Unbounded_String (From);
Handler.File_Ext := To_Unbounded_String (Into);
end Set_Extension_Mapping;
end ASF.Applications.Views;
|
30,369
|
ada
| 0
|
charlesdaniels/libagar
|
ada/gui/demo/agar_ada_demo.adb
|
<reponame>charlesdaniels/libagar
------------------------------------------
-- agar_ada_demo.adb: Agar-GUI Ada demo --
------------------------------------------
with Agar.Init;
with Agar.Init_GUI;
with Agar.Error;
with Agar.Surface; use Agar.Surface;
with Agar.Text;
with Interfaces; use Interfaces;
--with Agar.Widget;
with Ada.Characters.Latin_1;
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Text_IO;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure agar_ada_demo is
package T_IO renames Ada.Text_IO;
package RT renames Ada.Real_Time;
package LAT1 renames Ada.Characters.Latin_1;
Epoch : constant RT.Time := RT.Clock;
begin
if not Agar.Init.Init_Core ("agar_ada_demo") then
raise program_error with Agar.Error.Get_Error;
end if;
if not Agar.Init_GUI.Init_GUI then
raise program_error with Agar.Error.Get_Error;
end if;
declare
Major : Natural;
Minor : Natural;
Patch : Natural;
begin
Agar.Init.Get_Version(Major, Minor, Patch);
T_IO.Put_Line
("Agar version" &
Integer'Image(Major) & " ." &
Integer'Image(Minor) & " ." &
Integer'Image(Patch) & " initialized in " &
Duration'Image(RT.To_Duration(RT.Clock - Epoch)) & "s");
end;
T_IO.Put_Line("Size of AG_Surface = " & Natural'Image(Surface'Size));
--
-- Create a surface of pixels.
--
declare
W : constant Natural := 640;
H : constant Natural := 480;
Surf : constant Surface_Access := New_Surface(W,H);
Blue : aliased AG_Color := Color_8(0,0,200,255);
Border_W : constant Natural := 20;
begin
if Surf = null then
raise Program_Error with Agar.Error.Get_Error;
end if;
--
-- Fill the background with a given color.
-- Here are different ways of specifying colors:
--
Fill_Rect
(Surface => Surf,
Color => Color_8(200,0,0)); -- 8-bit RGB components
Fill_Rect
(Surface => Surf,
Color => Color_16(51400,0,0)); -- 16-bit RGB components
Fill_Rect
(Surface => Surf,
Color => Color_HSV(0.9, 1.0, 1.0, 1.0)); -- Hue / Saturation / Value
Fill_Rect
(Surface => Surf,
Color => Blue'Unchecked_Access); -- AG_Color access
Fill_Rect
(Surface => Surf,
Color => Blue); -- AG_Color argument
--
-- Use Put_Pixel to create a gradient.
--
T_IO.Put_Line("Creating gradient");
for Y in Border_W .. H-Border_W loop
if Y rem 4 = 0 then
Blue.B := Blue.B - Component_Offset_8(1);
end if;
Blue.G := 0;
for X in Border_W .. W-Border_W loop
if X rem 8 = 0 then
Blue.G := Blue.G + Component_Offset_8(1);
end if;
Put_Pixel
(Surface => Surf,
X => X,
Y => Y,
Pixel => Map_Pixel(Surf, Blue),
Clipping => false);
end loop;
end loop;
--
-- Generate a 2bpp indexed surface and initialize its 4-color palette.
--
T_IO.Put_Line("Creating a 4-color indexed surface");
declare
Bitmap : Surface_Access;
begin
T_IO.Put_Line("Creating surface...");
Bitmap := New_Surface
(Mode => INDEXED,
Bits_per_Pixel => 2,
W => 128,
H => 128);
if Bitmap = null then
Agar.Error.Fatal_Error ("null bitmap");
end if;
T_IO.Put_Line("Initializing bitmap palette...");
Set_Color(Bitmap, 0, Color_8(0, 0, 0));
Set_Color(Bitmap, 1, Color_8(0, 100,0));
Set_Color(Bitmap, 2, Color_8(150,0, 0));
Set_Color(Bitmap, 3, Color_8(200,200,0));
T_IO.Put_Line("Creating pattern...");
for Y in 0 .. Bitmap.H loop
for X in 0 .. Bitmap.W loop
if Natural(X) rem 16 = 0 then
Put_Pixel
(Surface => Bitmap,
X => Integer(X),
Y => Integer(Y),
Pixel => 1);
else
if Natural(Y) rem 8 = 0 then
Put_Pixel
(Surface => Bitmap,
X => Integer(X),
Y => Integer(Y),
Pixel => 1);
elsif Sqrt(Float(X)*Float(X) + Float(Y)*Float(Y)) < 50.0 then
Put_Pixel
(Surface => Bitmap,
X => Integer(X),
Y => Integer(Y),
Pixel => 2);
elsif Sqrt(Float(X)*Float(X) + Float(Y)*Float(Y)) > 150.0 then
Put_Pixel
(Surface => Bitmap,
X => Integer(X),
Y => Integer(Y),
Pixel => 3);
else
Put_Pixel
(Surface => Bitmap,
X => Integer(X),
Y => Integer(Y),
Pixel => 0);
end if;
end if;
end loop;
end loop;
--
-- Export our 2bpp indexed surface to a PNG file.
--
T_IO.Put_Line("Writing indexed 2bpp surface to output-index.png");
-- Export to an indexed PNG file.
if not Export_PNG(Bitmap, "output-index.png") then
T_IO.Put_Line ("output-index.png: " & Agar.Error.Get_Error);
end if;
--
-- Conversion from indexed to RGBA is done implicitely by Blit.
--
T_IO.Put_Line("Testing blit conversion from indexed to packed");
Blit_Surface
(Source => Bitmap,
Target => Surf,
Dst_X => 32,
Dst_Y => 32);
--
-- Blit our indexed surface again using a different palette.
--
Set_Color(Bitmap, 0, Color_8(255,255,255));
Set_Color(Bitmap, 1, Color_8(100,100,180));
Set_Color(Bitmap, 2, Color_8(120,0,0));
Set_Color(Bitmap, 3, Color_8(0,0,150));
Blit_Surface
(Source => Bitmap,
Target => Surf,
Dst_X => 200,
Dst_Y => 32);
Free_Surface (Bitmap);
end;
--
-- Test the font engine by rendering text to a surface.
--
T_IO.Put_Line("Testing Agar's font engine");
declare
-- Hello_Label : aliased Surface := Agar.Text_Render_Text("Hello, world!");
Text_W, Text_H : Natural;
Line_Count : Natural;
begin
Agar.Text.Size_Text
(Text => "Hello",
W => Text_W,
H => Text_H);
T_IO.Put_Line("Font engine says expected size of `Hello' line is: " &
Natural'Image(Text_W) & " x " & Natural'Image(Text_H) & " pixels");
Agar.Text.Size_Text
(Text => "Hello, one" & LAT1.CR & LAT1.LF &
"two" & LAT1.CR & LAT1.LF &
"and three",
W => Text_W,
H => Text_H,
Line_Count => Line_Count);
T_IO.Put_Line("Font engine says expected size of three lines is " &
Natural'Image(Text_W) & " x " & Natural'Image(Text_H) & " pixels and " &
Natural'Image(Line_Count) & " lines");
-- Blit_Surface
-- (Source => Hello_Label,
-- Target => Surf,
-- Dst_X => 64,
-- Dst_Y => 32);
-- Free_Surface(Hello_Label);
end;
--
-- Set a clipping rectangle.
--
Set_Clipping_Rect
(Surface => Surf,
X => 55,
Y => 220,
W => 640-(55*2),
H => 200);
--
-- Show the extent of the clipping rectangle.
--
T_IO.Put_Line("Testing clipping rectangles");
declare
White : constant AG_Pixel := Map_Pixel(Surf, Color_8(255,255,255));
Clip_X : constant Integer := Integer(Surf.Clip_Rect.X);
Clip_Y : constant Integer := Integer(Surf.Clip_Rect.Y);
Clip_W : constant Integer := Integer(Surf.Clip_Rect.W);
Clip_H : constant Integer := Integer(Surf.Clip_Rect.H);
procedure Put_Crosshairs
(Surface : Surface_Access;
X,Y : Natural;
Pixel : AG_Pixel) is
begin
for Z in 1 .. 3 loop
Put_Pixel (Surface, X+Z,Y, Pixel, Clipping => false);
Put_Pixel (Surface, X-Z,Y, Pixel, Clipping => false);
Put_Pixel (Surface, X,Y+Z, Pixel, Clipping => false);
Put_Pixel (Surface, X,Y-Z, Pixel, Clipping => false);
end loop;
end;
begin
Put_Crosshairs (Surf, Clip_X, Clip_Y, White);
Put_Crosshairs (Surf, Clip_X+Clip_W, Clip_Y, White);
Put_Crosshairs (Surf, Clip_X+Clip_W, Clip_Y+Clip_H, White);
Put_Crosshairs (Surf, Clip_X, Clip_Y+Clip_H, White);
end;
T_IO.Put_Line
("Surf W:" & C.unsigned'Image(Surf.W) &
" H:" & C.unsigned'Image(Surf.H) &
" Pitch:" & C.unsigned'Image(Surf.Pitch) &
" Clip_X:" & C.int'Image(Surf.Clip_Rect.X) &
" Clip_Y:" & C.int'Image(Surf.Clip_Rect.Y) &
" Clip_W:" & C.int'Image(Surf.Clip_Rect.W) &
" Clip_H:" & C.int'Image(Surf.Clip_Rect.H) &
" Padding:" & C.unsigned'Image(Surf.Padding));
--
-- Load a surface from a PNG file and blit it onto Surf. Transparency is
-- expressed by colorkey, or by an alpha component of 0 (in packed RGBA).
--
T_IO.Put_Line("Testing transparency");
declare
Denis : constant Surface_Access := New_Surface("axe.png");
Degs : Float := 0.0;
Alpha : AG_Component := 0;
begin
if Denis /= null then
T_IO.Put_Line
("Denis W:" & C.unsigned'Image(Denis.W) &
" H:" & C.unsigned'Image(Denis.H) &
" Pitch:" & C.unsigned'Image(Denis.Pitch) &
" Clip_X:" & C.int'Image(Denis.Clip_Rect.X) &
" Clip_Y:" & C.int'Image(Denis.Clip_Rect.Y) &
" Clip_W:" & C.int'Image(Denis.Clip_Rect.W) &
" Clip_H:" & C.int'Image(Denis.Clip_Rect.H) &
" Padding:" & C.unsigned'Image(Denis.Padding));
for Y in 1 .. 50 loop
Degs := Degs + 30.0;
Set_Alpha
(Surface => Denis,
Alpha => Alpha); -- Per-surface alpha
Alpha := Alpha + 12;
-- Render to target coordinates under Surf.
for Z in 1 .. 3 loop
Blit_Surface
(Source => Denis,
Target => Surf,
Dst_X => Y*25,
Dst_Y => H/2 + Z*40 - Natural(Denis.H)/2 -
Integer(50.0 * Sin(Degs,360.0)));
end loop;
end loop;
else
T_IO.Put_Line (Agar.Error.Get_Error);
end if;
end;
T_IO.Put_Line("Testing export to PNG");
if not Export_PNG(Surf, "output.png") then
raise program_error with Agar.Error.Get_Error;
end if;
T_IO.Put_Line ("Surface saved to output.png");
Free_Surface(Surf);
end;
T_IO.Put_Line
("Exiting after" &
Duration'Image(RT.To_Duration(RT.Clock - Epoch)) & "s");
Agar.Init.Quit;
end agar_ada_demo;
|
30,370
|
ada
| 0
|
stcarrez/hyperion
|
src/model/hyperion-monitoring-models.ads
|
-----------------------------------------------------------------------
-- Hyperion.Monitoring.Models -- Hyperion.Monitoring.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with Hyperion.Hosts.Models;
pragma Warnings (On);
package Hyperion.Monitoring.Models is
pragma Style_Checks ("-mr");
type Format_Type is (FORMAT_JSON);
for Format_Type use (FORMAT_JSON => 0);
package Format_Type_Objects is
new Util.Beans.Objects.Enums (Format_Type);
type Nullable_Format_Type is record
Is_Null : Boolean := True;
Value : Format_Type;
end record;
type Snapshot_Ref is new ADO.Objects.Object_Ref with null record;
type Source_Ref is new ADO.Objects.Object_Ref with null record;
type Series_Ref is new ADO.Objects.Object_Ref with null record;
-- Create an object key for Snapshot.
function Snapshot_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Snapshot from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Snapshot_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Snapshot : constant Snapshot_Ref;
function "=" (Left, Right : Snapshot_Ref'Class) return Boolean;
-- Set the snapshot identifier
procedure Set_Id (Object : in out Snapshot_Ref;
Value : in ADO.Identifier);
-- Get the snapshot identifier
function Get_Id (Object : in Snapshot_Ref)
return ADO.Identifier;
-- Set the snapshot date
procedure Set_Start_Date (Object : in out Snapshot_Ref;
Value : in Ada.Calendar.Time);
-- Get the snapshot date
function Get_Start_Date (Object : in Snapshot_Ref)
return Ada.Calendar.Time;
-- Set the snapshot end date.
procedure Set_End_Date (Object : in out Snapshot_Ref;
Value : in Ada.Calendar.Time);
-- Get the snapshot end date.
function Get_End_Date (Object : in Snapshot_Ref)
return Ada.Calendar.Time;
-- Get the optimistic lock version
function Get_Version (Object : in Snapshot_Ref)
return Integer;
-- Set the host to which the snapshot is associated
procedure Set_Host (Object : in out Snapshot_Ref;
Value : in Hyperion.Hosts.Models.Host_Ref'Class);
-- Get the host to which the snapshot is associated
function Get_Host (Object : in Snapshot_Ref)
return Hyperion.Hosts.Models.Host_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Snapshot_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Snapshot_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Snapshot_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Snapshot_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Snapshot_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Snapshot_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
SNAPSHOT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Snapshot_Ref);
-- Copy of the object.
procedure Copy (Object : in Snapshot_Ref;
Into : in out Snapshot_Ref);
package Snapshot_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Snapshot_Ref,
"=" => "=");
subtype Snapshot_Vector is Snapshot_Vectors.Vector;
procedure List (Object : in out Snapshot_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The source describes an element of the system that is monitored and which
-- for which we have collected data.
-- --------------------
-- Create an object key for Source.
function Source_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Source from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Source_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Source : constant Source_Ref;
function "=" (Left, Right : Source_Ref'Class) return Boolean;
-- Set unique identifier.
procedure Set_Id (Object : in out Source_Ref;
Value : in ADO.Identifier);
-- Get unique identifier.
function Get_Id (Object : in Source_Ref)
return ADO.Identifier;
-- Set the time series name.
procedure Set_Name (Object : in out Source_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Source_Ref;
Value : in String);
-- Get the time series name.
function Get_Name (Object : in Source_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Source_Ref)
return String;
-- Set the label to be used in presentation.
procedure Set_Label (Object : in out Source_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Label (Object : in out Source_Ref;
Value : in String);
-- Get the label to be used in presentation.
function Get_Label (Object : in Source_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Label (Object : in Source_Ref)
return String;
-- Get the optimistic lock version
function Get_Version (Object : in Source_Ref)
return Integer;
-- Set the host to which the source is associated
procedure Set_Host (Object : in out Source_Ref;
Value : in Hyperion.Hosts.Models.Host_Ref'Class);
-- Get the host to which the source is associated
function Get_Host (Object : in Source_Ref)
return Hyperion.Hosts.Models.Host_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Source_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Source_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Source_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Source_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Source_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Source_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
SOURCE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Source_Ref);
-- Copy of the object.
procedure Copy (Object : in Source_Ref;
Into : in out Source_Ref);
package Source_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Source_Ref,
"=" => "=");
subtype Source_Vector is Source_Vectors.Vector;
procedure List (Object : in out Source_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The Series table holds the collected data
-- for a given time frame. Values are serialized
-- in the 'content' blob in a format described by
-- the Format_Type enumeration.
-- --------------------
-- Create an object key for Series.
function Series_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Series from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Series_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Series : constant Series_Ref;
function "=" (Left, Right : Series_Ref'Class) return Boolean;
-- Set the series unique identifier
procedure Set_Id (Object : in out Series_Ref;
Value : in ADO.Identifier);
-- Get the series unique identifier
function Get_Id (Object : in Series_Ref)
return ADO.Identifier;
-- Get the optimistic lock version.
function Get_Version (Object : in Series_Ref)
return Integer;
-- Set the date and time of the first value in the series.
procedure Set_Start_Date (Object : in out Series_Ref;
Value : in Ada.Calendar.Time);
-- Get the date and time of the first value in the series.
function Get_Start_Date (Object : in Series_Ref)
return Ada.Calendar.Time;
-- Set the date and time of the last value in the series.
procedure Set_End_Date (Object : in out Series_Ref;
Value : in Ada.Calendar.Time);
-- Get the date and time of the last value in the series.
function Get_End_Date (Object : in Series_Ref)
return Ada.Calendar.Time;
-- Set the series content (JSON).
procedure Set_Content (Object : in out Series_Ref;
Value : in ADO.Blob_Ref);
-- Get the series content (JSON).
function Get_Content (Object : in Series_Ref)
return ADO.Blob_Ref;
-- Set the number of values in the series.
procedure Set_Count (Object : in out Series_Ref;
Value : in Integer);
-- Get the number of values in the series.
function Get_Count (Object : in Series_Ref)
return Integer;
-- Set the first value of the serie.
procedure Set_First_Value (Object : in out Series_Ref;
Value : in Integer);
-- Get the first value of the serie.
function Get_First_Value (Object : in Series_Ref)
return Integer;
-- Set the format of the content blob data.
procedure Set_Format (Object : in out Series_Ref;
Value : in Hyperion.Monitoring.Models.Format_Type);
-- Get the format of the content blob data.
function Get_Format (Object : in Series_Ref)
return Hyperion.Monitoring.Models.Format_Type;
--
procedure Set_Source (Object : in out Series_Ref;
Value : in Hyperion.Monitoring.Models.Source_Ref'Class);
--
function Get_Source (Object : in Series_Ref)
return Hyperion.Monitoring.Models.Source_Ref'Class;
-- Set the snapshot that produced the series
procedure Set_Snapshot (Object : in out Series_Ref;
Value : in Hyperion.Monitoring.Models.Snapshot_Ref'Class);
-- Get the snapshot that produced the series
function Get_Snapshot (Object : in Series_Ref)
return Hyperion.Monitoring.Models.Snapshot_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Series_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Series_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Series_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Series_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Series_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Series_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
SERIES_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Series_Ref);
-- Copy of the object.
procedure Copy (Object : in Series_Ref;
Into : in out Series_Ref);
private
SNAPSHOT_NAME : aliased constant String := "hyperion_snapshot";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "start_date";
COL_2_1_NAME : aliased constant String := "end_date";
COL_3_1_NAME : aliased constant String := "version";
COL_4_1_NAME : aliased constant String := "host_id";
SNAPSHOT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 5,
Table => SNAPSHOT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access)
);
SNAPSHOT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= SNAPSHOT_DEF'Access;
Null_Snapshot : constant Snapshot_Ref
:= Snapshot_Ref'(ADO.Objects.Object_Ref with null record);
type Snapshot_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SNAPSHOT_DEF'Access)
with record
Start_Date : Ada.Calendar.Time;
End_Date : Ada.Calendar.Time;
Version : Integer;
Host : Hyperion.Hosts.Models.Host_Ref;
end record;
type Snapshot_Access is access all Snapshot_Impl;
overriding
procedure Destroy (Object : access Snapshot_Impl);
overriding
procedure Find (Object : in out Snapshot_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Snapshot_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Snapshot_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Snapshot_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Snapshot_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Snapshot_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Snapshot_Ref'Class;
Impl : out Snapshot_Access);
SOURCE_NAME : aliased constant String := "hyperion_source";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "name";
COL_2_2_NAME : aliased constant String := "label";
COL_3_2_NAME : aliased constant String := "version";
COL_4_2_NAME : aliased constant String := "host_id";
SOURCE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 5,
Table => SOURCE_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access)
);
SOURCE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= SOURCE_DEF'Access;
Null_Source : constant Source_Ref
:= Source_Ref'(ADO.Objects.Object_Ref with null record);
type Source_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SOURCE_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Label : Ada.Strings.Unbounded.Unbounded_String;
Version : Integer;
Host : Hyperion.Hosts.Models.Host_Ref;
end record;
type Source_Access is access all Source_Impl;
overriding
procedure Destroy (Object : access Source_Impl);
overriding
procedure Find (Object : in out Source_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Source_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Source_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Source_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Source_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Source_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Source_Ref'Class;
Impl : out Source_Access);
SERIES_NAME : aliased constant String := "hyperion_series";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "version";
COL_2_3_NAME : aliased constant String := "start_date";
COL_3_3_NAME : aliased constant String := "end_date";
COL_4_3_NAME : aliased constant String := "content";
COL_5_3_NAME : aliased constant String := "count";
COL_6_3_NAME : aliased constant String := "first_value";
COL_7_3_NAME : aliased constant String := "format";
COL_8_3_NAME : aliased constant String := "source_id";
COL_9_3_NAME : aliased constant String := "snapshot_id";
SERIES_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 10,
Table => SERIES_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access,
4 => COL_3_3_NAME'Access,
5 => COL_4_3_NAME'Access,
6 => COL_5_3_NAME'Access,
7 => COL_6_3_NAME'Access,
8 => COL_7_3_NAME'Access,
9 => COL_8_3_NAME'Access,
10 => COL_9_3_NAME'Access)
);
SERIES_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= SERIES_DEF'Access;
Null_Series : constant Series_Ref
:= Series_Ref'(ADO.Objects.Object_Ref with null record);
type Series_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SERIES_DEF'Access)
with record
Version : Integer;
Start_Date : Ada.Calendar.Time;
End_Date : Ada.Calendar.Time;
Content : ADO.Blob_Ref;
Count : Integer;
First_Value : Integer;
Format : Hyperion.Monitoring.Models.Format_Type;
Source : Hyperion.Monitoring.Models.Source_Ref;
Snapshot : Hyperion.Monitoring.Models.Snapshot_Ref;
end record;
type Series_Access is access all Series_Impl;
overriding
procedure Destroy (Object : access Series_Impl);
overriding
procedure Find (Object : in out Series_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Series_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Series_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Series_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Series_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Series_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Series_Ref'Class;
Impl : out Series_Access);
end Hyperion.Monitoring.Models;
|
30,371
|
ada
| 5
|
reznikmm/increment
|
source/base/incr-version_trees.adb
|
-- Copyright (c) 2015-2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Incr.Version_Trees is
----------------------
-- Versioned_Values --
----------------------
package body Versioned_Values is
-------------
-- Discard --
-------------
procedure Discard
(Self : in out Container;
Time : Version;
Changes : out Integer) is
begin
if Time = Self.Versions (Self.Index) then
Self.Index := Self.Index - 1;
Changes := -1;
elsif Time < Self.Versions (Self.Index) then
-- Reverting of earlyer version is not allowed
raise Constraint_Error;
else
Changes := 0;
end if;
end Discard;
---------
-- Get --
---------
function Get (Self : Container; Time : Version) return Element is
begin
for J in Self.Versions'Range loop
if Time >= Self.Versions (Self.Index - J) then
return Self.Elements (Self.Index - J);
end if;
end loop;
raise Constraint_Error with "version is too old";
end Get;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Container;
Initial_Value : Element)
is
begin
Self.Versions := (others => 0);
Self.Elements := (others => Initial_Value);
Self.Index := 0;
end Initialize;
---------
-- Set --
---------
procedure Set
(Self : in out Container;
Value : Element;
Time : Version;
Changes : in out Integer)
is
Prev : constant Version := Time - 1; -- Tree.Parent (Time)
Old : constant Element := Get (Self, Prev);
Is_Old : constant Boolean := Value = Old;
begin
if Time = Self.Versions (Self.Index) and Is_Old then
Self.Index := Self.Index - 1;
Changes := Changes - 1;
elsif Time > Self.Versions (Self.Index) and not Is_Old then
Self.Index := Self.Index + 1;
Self.Versions (Self.Index) := Time;
Changes := Changes + 1;
elsif Time < Self.Versions (Self.Index) then
-- Update of earlyer version is not allowed
raise Constraint_Error;
end if;
if not Is_Old then
Self.Elements (Self.Index) := Value;
end if;
end Set;
end Versioned_Values;
function "<" (Left, Right : Version) return Boolean is
L : constant Natural := Natural (Left);
R : constant Natural := Natural (Right);
begin
if L < 128 xor R < 128 then
return Natural (L + 8) < Natural (R + 8);
else
return L < R;
end if;
end "<";
--------------
-- Changing --
--------------
function Changing (Self : Version_Tree) return Version is
begin
return Self.Changing;
end Changing;
-----------------
-- Is_Changing --
-----------------
function Is_Changing
(Self : Version_Tree; Value : Version) return Boolean is
begin
return Self.Changing = Value;
end Is_Changing;
------------
-- Parent --
------------
function Parent (Self : Version_Tree; Value : Version) return Version is
pragma Unreferenced (Self);
begin
return Value - 1;
end Parent;
------------------
-- Start_Change --
------------------
procedure Start_Change
(Self : in out Version_Tree;
Parent : Version;
Changing : out Version)
is
begin
if Parent /= Self.Changing then
raise Constraint_Error with "not implemented";
end if;
Self.Changing := Self.Changing + 1;
Changing := Self.Changing;
end Start_Change;
end Incr.Version_Trees;
|
30,372
|
ada
| 6
|
yannickmoy/SPARKZumo
|
src/algos/line_finder/line_finder_types.ads
|
pragma SPARK_Mode;
with Types; use Types;
-- @summary
-- Types used in the line finder algorithm
package Line_Finder_Types is
-- States detected by the IR sensors
-- @value Lost no line found. Start panicking
-- @value Online one line is found somewhere under the middle set of
-- sensors
-- @value BranchRight we found a branch going to the right of the robot
-- @value BranchLeft we found a branch going to the left of the robot
-- @value Fork we found a fork in the line. Pick it up!
-- @value Perp we came to a perpendicular intersection.
-- @value Unknown this is a state where we have lots of noise. Ignore
type LineState is
(Lost, Online, BranchRight, BranchLeft, Fork, Perp, Unknown)
with Size => 8;
-- The orientation of the robot in relation to the line
-- @value Left the line is under the left side of the robot
-- @value Center the line is under the center of the robot
-- @value Right the line is under the right side of the robot
type BotOrientation is
(Left, Center, Right);
-- When we can't find the line we should do larger circles to refind it.
-- This is the type that we can use to tell the motors how to circle
subtype OfflineCounterType is Integer range
2 * Motor_Speed'First .. 2 * Motor_Speed'Last;
-- We can make decisions based on a simple scheme or complex
-- @value Simple simple decision matrix. Best when we are Lost
-- @value Complex complex decision matrix. Best when we know whats going on
type DecisionType is
(Simple, Complex);
-- The data structure holding information about the robot and its current
-- situation
-- @field LineHistory the last computer state
-- @field OrientationHistory the last computed BotOrientation
-- @field SensorValueHistory the last sensor value detected
-- @field ErrorHistory the last computed error from the robot centered
-- @field OfflineCounter How the motors should circle when lost
-- @field LostCounter How long its been since we saw the line
-- @field Decision type of decisions matrix to use
-- @field LineDetect the value computed from the value we read from the
-- sensors
-- @field Sensor_Values the actual values we read from the sensors
type RobotState is record
LineHistory : LineState := Online;
OrientationHistory : BotOrientation := Center;
SensorValueHistory : Integer := 0;
ErrorHistory : Robot_Position := 0;
OfflineCounter : OfflineCounterType := 0;
LostCounter : Natural := 0;
Decision : DecisionType := Complex;
LineDetect : Byte := 0;
Sensor_Values : Sensor_Array := (others => 0);
end record;
-- FOR DEBUG! Maps states to strings
LineStateStr : array (LineState) of String (1 .. 2) :=
(Lost => "Lo",
Online => "On",
BranchRight => "BR",
BranchLeft => "BL",
Fork => "Fo",
Perp => "Pe",
Unknown => "Uk");
-- This is the lookup table we use to convert SensorValues to detected
-- states.
LineStateLookup : constant array (0 .. 2 ** Num_Sensors - 1) of LineState :=
(2#00_000_000# => Lost,
2#00_000_001# => Online,
2#00_000_010# => Online,
2#00_000_011# => Online,
2#00_000_100# => Online,
2#00_000_101# => Fork,
2#00_000_110# => Online,
2#00_000_111# => BranchLeft,
2#00_001_000# => Online,
2#00_001_001# => Fork,
2#00_001_010# => Fork,
2#00_001_011# => Fork,
2#00_001_100# => Online,
2#00_001_101# => Fork,
2#00_001_110# => Online,
2#00_001_111# => BranchLeft,
2#00_010_000# => Online,
2#00_010_001# => Fork,
2#00_010_010# => Fork,
2#00_010_011# => Fork,
2#00_010_100# => Fork,
2#00_010_101# => Unknown,
2#00_010_110# => Fork,
2#00_010_111# => Fork,
2#00_011_000# => Online,
2#00_011_001# => Fork,
2#00_011_010# => Fork,
2#00_011_011# => Fork,
2#00_011_100# => Online,
2#00_011_101# => Fork,
2#00_011_110# => Online,
2#00_011_111# => BranchLeft,
2#00_100_000# => Online,
2#00_100_001# => Fork,
2#00_100_010# => Fork,
2#00_100_011# => Fork,
2#00_100_100# => Fork,
2#00_100_101# => Unknown,
2#00_100_110# => Fork,
2#00_100_111# => Fork,
2#00_101_000# => Fork,
2#00_101_001# => Unknown,
2#00_101_010# => Unknown,
2#00_101_011# => Unknown,
2#00_101_100# => Fork,
2#00_101_101# => Unknown,
2#00_101_110# => Fork,
2#00_101_111# => Fork,
2#00_110_000# => Online,
2#00_110_001# => Fork,
2#00_110_010# => Fork,
2#00_110_011# => Fork,
2#00_110_100# => Fork,
2#00_110_101# => Unknown,
2#00_110_110# => Fork,
2#00_110_111# => Fork,
2#00_111_000# => BranchRight,
2#00_111_001# => Fork,
2#00_111_010# => Fork,
2#00_111_011# => Fork,
2#00_111_100# => BranchRight,
2#00_111_101# => Unknown,
2#00_111_110# => BranchRight,
2#00_111_111# => Perp);
end Line_Finder_Types;
|
30,373
|
ada
| 79
|
Roldak/OpenGLAda
|
src/gl/interface/gl-rasterization.ads
|
<gh_stars>10-100
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Types;
private with GL.Low_Level;
package GL.Rasterization is
pragma Preelaborate;
use GL.Types;
subtype Line_Width_Range is Singles.Vector2;
type Polygon_Mode_Type is (Point, Line, Fill);
procedure Set_Line_Width (Value : Single);
function Line_Width return Single;
function Aliased_Line_Width_Range return Line_Width_Range;
function Smooth_Line_Width_Range return Line_Width_Range;
function Smooth_Line_Width_Granularity return Single;
procedure Set_Polygon_Mode (Value : Polygon_Mode_Type);
function Polygon_Mode return Polygon_Mode_Type;
procedure Set_Polygon_Offset (Factor, Units : Single := 0.0);
procedure Set_Point_Size (Value : Single);
function Point_Size return Single;
function Point_Size_Range return Singles.Vector2;
function Point_Size_Granularity return Single;
procedure Set_Point_Fade_Threshold_Size (Value : Single);
function Point_Fade_Threshold_Size return Single;
private
for Polygon_Mode_Type use (Point => 16#1B00#,
Line => 16#1B01#,
Fill => 16#1B02#);
for Polygon_Mode_Type'Size use Low_Level.Enum'Size;
end GL.Rasterization;
|
30,374
|
ada
| 4
|
faelys/gela-asis
|
source/asis/spec/ada-numerics-float_random.ads
|
<reponame>faelys/gela-asis<filename>source/asis/spec/ada-numerics-float_random.ads<gh_stars>1-10
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
package Ada.Numerics.Float_Random is
-- Basic facilities
type Generator is limited private;
subtype Uniformly_Distributed is Float range 0.0 .. 1.0;
function Random (Gen : Generator) return Uniformly_Distributed;
procedure Reset (Gen : in Generator;
Initiator : in Integer);
procedure Reset (Gen : in Generator);
-- Advanced facilities
type State is private;
procedure Save (Gen : in Generator;
To_State : out State);
procedure Reset (Gen : in Generator;
From_State : in State);
Max_Image_Width : constant := implementation-defined;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
private
pragma Import (Ada, State);
pragma Import (Ada, Generator);
end Ada.Numerics.Float_Random;
|
30,375
|
ada
| 30
|
jscparker/math_packages
|
disorderly/disorderly-random-clock_entropy.adb
|
<gh_stars>10-100
-------------------------------------------------------------------------------
-- package body Disorderly.Random.Clock_Entropy, Random Number Initialization
-- Copyright (C) 1995-2018 <NAME>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------------------
with Ada.Calendar;
with System; -- for Tick : Duration;
package body Disorderly.Random.Clock_Entropy is
-------------------------
-- Get_Seed_From_Clock --
-------------------------
-- Clock sets initial seed.
-- Seconds (T) is <= 86_400.0.
-- Day (T) is <= 31.0.
--
procedure Get_Seed_From_Clock
(Initiator : out Seed_Random_Int)
is
type Real is digits 15;
Fake_Ticks_per_Second : constant Real := 77_777_777.0;
Seconds_per_Day : constant Real := 86_400.0;
Fake_Ticks_per_Day : constant Real := Fake_Ticks_per_Second * Seconds_per_Day;
Min_Delay : constant Duration := System.Tick;
T : Ada.Calendar.Time;
Seed : Parent_Random_Int;
begin
delay Min_Delay * 3.0;
T := Ada.Calendar.Clock;
Seed := Random_Int (Real (Ada.Calendar.Seconds (T)) * Fake_Ticks_per_Second +
Real (Ada.Calendar.Day (T)) * Fake_Ticks_per_Day);
-- So Seed is the number of elapsed fake ticks in present month.
--
-- Even if Seconds (T) = 0.0000123 we want
-- Seconds (T)) * Fake_Ticks_per_Second to be big integer, so make
-- Fake_Ticks_per_Second very large.
--
-- Max val of Seed ~ 0.83 * 2^51.
Initiator := Seed + 777_777; -- 0 < Seed <= Random_Int'Last
delay Min_Delay * (7.0 + Duration (Initiator mod 77));
-- Minimize likelihood that next call to Reset_with_Calendar produces
-- the same Initiator1, and hence the same state S.
-- Doesn't guarantee that there is no relationship between successive
-- seeds, but such a relationship would be difficult to see.
-- All we need is 1 bit of difference between the outputs of two
-- successive calls to Ada.Calendar.Clock, and the two 256 bit
-- states generated by the successive calls will have no apparent
-- similarities.
end Get_Seed_From_Clock;
-----------
-- Reset --
-----------
procedure Reset
(S : out State)
is
Initiator1, Initiator2 : Seed_Random_Int;
begin
Get_Seed_From_Clock (Initiator1);
Get_Seed_From_Clock (Initiator2);
Disorderly.Random.Reset (S, Initiator1, Initiator2);
end Reset;
end Disorderly.Random.Clock_Entropy;
|
30,376
|
ada
| 0
|
djamal2727/Main-Bearing-Analytical-Model
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/namet-sp.ads
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- N A M E T - S P --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This child package contains a spell checker for Name_Id values. It is
-- separated off as a child package, because of the extra dependencies,
-- in particular on GNAT.UTF_32_Spelling_Checker. There are a number of
-- packages that use Namet that do not need the spell checking feature,
-- and this separation helps in dealing with older versions of GNAT.
package Namet.Sp is
function Is_Bad_Spelling_Of (Found, Expect : Name_Id) return Boolean;
-- Compares two identifier names from the names table, and returns True if
-- Found is a plausible misspelling of Expect. This function properly deals
-- with wide and wide wide character encodings in the input names. Note
-- that an exact match in the names results in False being returned.
end Namet.Sp;
|
30,377
|
ada
| 19
|
jquorning/ada-security
|
regtests/security-oauth-jwt-tests.adb
|
-----------------------------------------------------------------------
-- Security-oayth-jwt-tests - Unit tests for JSON Web Token
-- Copyright (C) 2013, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar.Formatting;
with Util.Test_Caller;
package body Security.OAuth.JWT.Tests is
package Caller is new Util.Test_Caller (Test, "Security.OAuth.JWT");
-- A JWT token returned by Google+.
K : constant String := "<KEY>"
& "<KEY>"
& "<KEY>"
& "<KEY>"
& "<KEY>"
& "<KEY>"
& "_N7fiz1CgttJcwbmMVwhag3ox2WE9C1KwXhrjwT8eigZ0WkDys5WO1dYs2G1QbDZPnsYYMyHK9XpycaDMEKtVZ"
& "C4C6DkB1SrBHbN0Tv6ExWpszzp1JEL8nZnHd3T_AA3paqONnkvQw_yo";
procedure Test_Operation (T : in out Test) is
R : Token;
begin
R := Decode (K);
Util.Tests.Assert_Equals (T, Value, Get (R), "Extraction failed");
end Test_Operation;
procedure Test_Time_Operation (T : in out Test) is
R : Token;
begin
R := Decode (K);
Util.Tests.Assert_Equals (T, Value, Ada.Calendar.Formatting.Image (Get (R)),
"Extraction failed");
end Test_Time_Operation;
procedure Test_Get_Issuer is
new Test_Operation (Get_Issuer, "accounts.google.com");
procedure Test_Get_Audience is
new Test_Operation (Get_Audience, "872655994014.apps.googleusercontent.com");
procedure Test_Get_Subject is
new Test_Operation (Get_Subject, "108360703099708978870");
procedure Test_Get_Authorized_Presenters is
new Test_Operation (Get_Authorized_Presenters, "872655994014.apps.googleusercontent.com");
procedure Test_Get_Expiration is
new Test_Time_Operation (Get_Expiration, "2013-05-19 14:02:13");
procedure Test_Get_Issued_At is
new Test_Time_Operation (Get_Issued_At, "2013-05-19 12:57:13");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Decode",
Test_Get_Issuer'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Issuer",
Test_Get_Issuer'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Audience",
Test_Get_Audience'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Subject",
Test_Get_Subject'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Authorized_Presenters",
Test_Get_Authorized_Presenters'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Expiration",
Test_Get_Expiration'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Authentication_Time",
Test_Get_Issued_At'Access);
Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Decode (error)",
Test_Decode_Error'Access);
end Add_Tests;
-- ------------------------------
-- Test Decode operation with errors.
-- ------------------------------
procedure Test_Decode_Error (T : in out Test) is
K : constant String := "<KEY>"
& "<KEY>"
& "<KEY>"
& <KEY>
& <KEY>
& "<KEY>
& <KEY>"
& "<KEY>";
R : Token;
pragma Unreferenced (R);
begin
R := Decode (K);
T.Fail ("No exception raised");
T.Assert (False, "Bad");
exception
when Invalid_Token =>
null;
end Test_Decode_Error;
end Security.OAuth.JWT.Tests;
|
30,378
|
ada
| 7,053
|
Elon143/Amass
|
resources/scripts/api/intelx.ads
|
-- Copyright 2021 <NAME>. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "IntelX"
type = "api"
useragent = "OWASP Amass"
host = "https://2.intelx.io/"
max = 1000
function start()
set_rate_limit(2)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
phonebook(ctx, domain, c.key)
end
function phonebook(ctx, domain, key)
local id = search(ctx, "", domain, key)
if id == "" then
return
end
local status = 3
local limit = 1000
while status == 0 or status == 3 do
local resp = results(ctx, id, limit, key)
if resp == nil then
break
end
status = resp.status
if ((status == 0 or status == 1) and resp.selectors ~= nil and #(resp.selectors) > 0) then
if #(resp.selectors) < limit then
limit = limit - #(resp.selectors)
end
for _, s in pairs(resp.selectors) do
local t = s.selectortype
if (t == 2 or t == 3 or t == 23) then
print(s.selectorvalue)
send_names(ctx, s.selectorvalue)
end
end
end
if limit <= 0 then
break
end
end
end
function search(ctx, domain, key)
local err, body, resp
body, err = json.encode({
term=domain,
lookuplevel=0,
timeout=0,
maxresults=max,
datefrom="",
dateto="",
sort=0,
media=0,
})
if (err ~= nil and err ~= "") then
return ""
end
resp, err = request(ctx, {
method="POST",
data=body,
['url']=host .. "phonebook/search",
headers={
['x-key']=key,
['Content-Type']="application/json",
['User-Agent']=useragent,
Connection="keep-alive",
},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical search request to service failed: " .. err)
return ""
end
local j = json.decode(resp)
if (j == nil or j.status == nil or j.id == nil or j.status ~= 0) then
return ""
end
return j.id
end
function results(ctx, id, limit, key)
local resp, err = request(ctx, {
['url']=host .. "phonebook/search/result?id=" .. id .. "&limit=" .. limit,
headers={
['x-key']=key,
['User-Agent']=useragent,
Connection="keep-alive",
},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical results request to service failed: " .. err)
return nil
end
local j = json.decode(resp)
if (j == nil or j.status == nil) then
return nil
end
return j
end
|
30,379
|
ada
| 0
|
melwyncarlo/ProjectEuler
|
problems/029/a029.adb
|
with Ada.Text_IO;
with Ada.Strings.Fixed;
with Ada.Integer_Text_IO;
-- Copyright 2021 <NAME>
procedure A029 is
use Ada.Text_IO;
use Ada.Strings.Fixed;
use Ada.Integer_Text_IO;
N_Str, N_Str_Copy : String (1 .. 200);
Temp_Product : String (1 .. 3);
FT : File_Type;
Last_Index : Natural;
File_Line : String (1 .. 201);
File_Name : constant String := "problems/029/temp.dat";
Products_Array : array (Integer range 1 .. 201,
Integer range 1 .. 201) of Character;
Sum_Val : Integer := 0;
Is_First : Boolean := True;
Temp_Sum, Str_Length : Integer;
begin
Create (FT, Out_File, File_Name);
for I in 2 .. 100 loop
N_Str (1 .. 200) := 200 * "0";
if I < 10 then
N_Str (2 .. 2) := Trim (Integer'Image (I), Ada.Strings.Both);
else
N_Str (1 .. Trim (Integer'Image (I), Ada.Strings.Both)'Length) :=
Trim (Integer'Image (I), Ada.Strings.Both);
end if;
Str_Length := 2;
Products_Array := (others => (others => Character'Val (0)));
for J in 2 .. 100 loop
for M in reverse 1 .. Str_Length loop
Temp_Sum := I * (Character'Pos (N_Str (M))
- Character'Pos ('0'));
Move (Source => Trim (Integer'Image (Temp_Sum), Ada.Strings.Both),
Target => Temp_Product (1 .. 3),
Justify => Ada.Strings.Right,
Pad => '0');
for K1 in 1 .. M loop
Products_Array (M, K1) := '0';
end loop;
for K2 in (M + 1) .. (M + 3) loop
Products_Array (M, K2) := Temp_Product (K2 - M);
end loop;
for K3 in (M + 4) .. (Str_Length + 3) loop
Products_Array (M, K3) := '0';
end loop;
end loop;
N_Str (1 .. 200) := 200 * "0";
for M in reverse 2 .. (Str_Length + 3) loop
Temp_Sum := 0;
for N in 1 .. Str_Length loop
Temp_Sum := Temp_Sum
+ Character'Pos (Products_Array (N, M))
- Character'Pos ('0');
end loop;
Temp_Sum := Temp_Sum
+ Character'Pos (N_Str (M - 1))
- Character'Pos ('0');
N_Str (M - 1) := Character'Val ((Temp_Sum mod 10)
+ Character'Pos ('0'));
if (M - 2) > 0 then
N_Str (M - 2) := Character'Val (Integer (Float'Floor (
Float (Temp_Sum) / 10.0))
+ Character'Pos ('0'));
end if;
end loop;
Str_Length := Str_Length + 2;
N_Str_Copy (1 .. 200) := 200 * "0";
N_Str_Copy (201 - Str_Length .. N_Str_Copy'Last) :=
N_Str (1 .. Str_Length);
Reset (FT, In_File);
while not End_Of_File (FT) loop
Get_Line (FT, File_Line, Last_Index);
if File_Line (1 .. Last_Index) = N_Str_Copy then
goto Label_10;
end if;
end loop;
if Is_First then
Reset (FT, Out_File);
Is_First := False;
else
Reset (FT, Append_File);
end if;
Put_Line (FT, N_Str_Copy);
<<Label_10>>
end loop;
end loop;
Reset (FT, In_File);
while not End_Of_File (FT) loop
Get_Line (FT, File_Line, Last_Index);
Sum_Val := Sum_Val + 1;
end loop;
Delete (FT);
Put (Sum_Val, Width => 0);
end A029;
|
30,380
|
ada
| 1
|
charlie5/lace-alire
|
1-base/lace/source/events/interface/lace-subject.adb
|
with
lace.Event.Logger;
package body lace.Subject
is
the_Logger : Event.Logger.view;
procedure Logger_is (Now : in Event.Logger.view)
is
begin
the_Logger := Now;
end Logger_is;
function Logger return Event.Logger.view
is
begin
return the_Logger;
end Logger;
end lace.Subject;
|
30,381
|
ada
| 5
|
jhumphry/auto_counters
|
src/smart_ptrs/unique_ptrs.ads
|
<reponame>jhumphry/auto_counters<gh_stars>1-10
-- unique_ptrs.ads
-- A "unique pointer" type similar to that in C++
-- Copyright (c) 2016, <NAME>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
pragma Profile (No_Implementation_Extensions);
with Ada.Finalization;
generic
type T (<>) is limited private;
with procedure Delete (X : in out T) is null;
package Unique_Ptrs is
type T_Ptr is access T;
subtype T_Ptr_Not_Null is not null T_Ptr;
type T_Const_Ptr is access constant T;
Unique_Ptr_Error : exception;
-- Unique_Ptr_Error indicates an attempt to create a null Unique_Ptr or an
-- attempt to create one directly without going through the Make_Unique_Ptr
-- function.
type Unique_Ptr(Element : not null access T) is
new Ada.Finalization.Limited_Controlled with private
with Implicit_Dereference => Element;
-- Unique_Ptr is an implementation of a generalised reference type that
-- automatically releases the storage associated with the underlying value
-- when the Unique_Ptr is destroyed. Unique_Ptr can only point to values
-- created in a storage pool, not static values or local stack values.
function Get (U : in Unique_Ptr) return T_Ptr with Inline;
-- Returns a named access value that points to the target of the Unique_Ptr.
-- This should not be saved as it can become invalid without warning when
-- the original Unique_Ptr is destroyed. In particular do not attempt to
-- duplicate Unique_Ptr by passing the result to Make_Unique_Ptr as the
-- result will be erroneous.
function Make_Unique_Ptr (X : T_Ptr_Not_Null) return Unique_Ptr with Inline;
-- Make_Unique_Ptr creates a Unique_Ptr from an access value to an object
-- stored in a pool. Note that mixing the use of regular access values and
-- Unique_Ptr types is not wise, as the storage may be reclaimed when the
-- Unique_Ptr is destroyed, leaving the access values invalid.
type Unique_Const_Ptr(Element : not null access constant T) is
new Ada.Finalization.Limited_Controlled with private
with Implicit_Dereference => Element;
-- Unique_Const_Ptr is an implementation of a generalised reference type
-- that automatically releases the storage associated with the underlying
-- constant value when the Unique_Ptr is destroyed. Unique_Const_Ptr can
-- only point to values created in a storage pool, not static values or
-- local stack values.
function Get (U : in Unique_Const_Ptr) return T_Const_Ptr with Inline;
-- Returns a named access to constant value that points to the target of the
-- Unique_Const_Ptr. This should not be saved as it can become invalid
-- without warning when the original Unique_Const_Ptr is destroyed.
function Make_Unique_Const_Ptr (X : T_Ptr_Not_Null)
return Unique_Const_Ptr with Inline;
-- Make_Unique_Const_Ptr creates a Unique_Const_Ptr from an access value to
-- an object stored in a pool. Note that mixing the use of regular access
-- values and Unique_Const_Ptr types is not wise, as the storage may be
-- reclaimed when the Unique_Const_Ptr is destroyed, leaving the access
-- values invalid.
--
-- Unique_Const_Ptr differs from a regular access-to-const type in that
-- it must be able to call the Delete function and destroy the storage
-- associated with the target. Therefore they can only point at variables,
-- not constants.
private
-- Note - the Invalid components of these records are required solely to
-- cope with the rare cases when the Finalization routine can be called twice
-- as it is used to prevent double-deallocation.
type Unique_Ptr(Element : not null access T) is
new Ada.Finalization.Limited_Controlled
with
record
Invalid : Boolean := True;
end record;
overriding procedure Initialize (Object : in out Unique_Ptr);
overriding procedure Finalize (Object : in out Unique_Ptr);
type Unique_Const_Ptr(Element : not null access constant T) is
new Ada.Finalization.Limited_Controlled
with
record
Invalid : Boolean := True;
end record;
overriding procedure Initialize (Object : in out Unique_Const_Ptr);
overriding procedure Finalize (Object : in out Unique_Const_Ptr);
end Unique_Ptrs;
|
30,382
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/controlled_record.ads
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/controlled_record.ads
with Ada.Finalization;
package Controlled_Record is
type Point_T is limited private;
procedure Assert_Invariants (PA : Point_T);
private
type Coords_T is array (1 .. 2) of Natural;
type Point_T is new Ada.Finalization.Controlled with record
Pos : Coords_T := (0, 0);
end record;
end Controlled_Record;
|
30,383
|
ada
| 2
|
zenharris/ada-bbs
|
src/display_warning.adb
|
<gh_stars>1-10
with Extools; use Extools;
package body Display_Warning is
procedure Warning (Message : String; Down :Integer := 0;D : Duration := 0.0) is
Display_Window : Window;
Width : Column_Position := 40;
Length : Line_Position := 5;
c : Key_Code;
Lines : Line_Position;
Columns : Column_Position;
-- D : Duration := 0.3;
Now : Time := Clock;
Next : Time := Now + D;
begin
Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns);
Display_Window := Sub_Window(Win => Standard_Window,
Number_Of_Lines => Length,
Number_Of_Columns => Width,
First_Line_Position => ((Lines - Length) / 2)+Line_Position(Down),
First_Column_Position => (Columns - Width) / 2);
Clear(Display_Window);
Box(Display_Window);
Add (Win => Display_Window,
Column => Column_Position((Width - Message'Length) / 2),
Line => 2,
Str => Message);
Refrosh(Display_Window);
if D > 0.0 then
delay until Next;
else
Add (Win => Display_Window,Column => 1,Line => 4,Str => "Any Key to Continue");
Refrosh(Display_Window);
c := Get_Keystroke;
end if;
Clear(Display_Window);
Refrosh(Display_Window);
Delete (Win => Display_Window);
end;
function GetYN (Message : String; Down : Integer := 0) return Boolean is
Display_Window : Window;
Width : Column_Position := 40;
Length : Line_Position := 5;
c : Key_Code;
Lines : Line_Position;
Columns : Column_Position;
retval : Boolean := False;
begin
Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns);
Display_Window := Sub_Window(Win => Standard_Window,
Number_Of_Lines => Length,
Number_Of_Columns => Width,
First_Line_Position => ((Lines - Length) / 2)+Line_Position(Down),
First_Column_Position => (Columns - Width) / 2);
Clear(Display_Window);
Box(Display_Window);
Add (Win => Display_Window,
Column => 1,
Line => 2,
Str => Message);
Add (Win => Display_Window,Column => 1,Line => 4,Str => "y/n Continue Esc Cancel");
Refrosh(Display_Window);
Cancel := False;
loop
c := Get_Keystroke;
case Character'Val (c) is
when 'Y'|'y' =>
retval := True;
exit;
when 'N'|'n' =>
retval := False;
exit;
when ESC =>
Cancel := True;
exit;
when others => null;
end case;
end loop;
Clear(Display_Window);
Refrosh(Display_Window);
Delete (Win => Display_Window);
return retval;
end;
end Display_Warning;
|
30,384
|
ada
| 1
|
danva994/ASFML-1.6
|
include/sf-graphics-image.ads
|
-- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 <NAME> (<EMAIL>)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
-- ////////////////////////////////////////////////////////////
-- // Headers
-- ////////////////////////////////////////////////////////////
with Sf.Config;
with Sf.Graphics.Color;
with Sf.Graphics.Rect;
with Sf.Graphics.Types;
package Sf.Graphics.Image is
use Sf.Config;
use Sf.Graphics.Color;
use Sf.Graphics.Rect;
use Sf.Graphics.Types;
-- ////////////////////////////////////////////////////////////
-- /// Create a new empty image
-- ///
-- /// \return A new sfImage object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_Create return sfImage_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new image filled with a color
-- ///
-- /// \param Width : Image width
-- /// \param Height : Image height
-- /// \param Col : Image color
-- ///
-- /// \return A new sfImage object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_CreateFromColor (Width, Height : sfUint32; Color : sfColor) return sfImage_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new image from an array of pixels in memory
-- ///
-- /// \param Width : Image width
-- /// \param Height : Image height
-- /// \param Data : Pointer to the pixels in memory (assumed format is RGBA)
-- ///
-- /// \return A new sfImage object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_CreateFromPixels (Width, Height : sfUint32; Data : sfUint8_Ptr) return sfImage_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new image from a file
-- ///
-- /// \param Filename : Path of the image file to load
-- ///
-- /// \return A new sfImage object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_CreateFromFile (Filename : Standard.String) return sfImage_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new image from a file in memory
-- ///
-- /// \param Data : Pointer to the file data in memory
-- /// \param SizeInBytes : Size of the data to load, in bytes
-- ///
-- /// \return A new sfImage object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_CreateFromMemory (Data : sfInt8_Ptr; SizeInBytes : sfSize_t) return sfImage_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Destroy an existing image
-- ///
-- /// \param Image : Image to delete
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfImage_Destroy (Image : sfImage_Ptr);
-- ////////////////////////////////////////////////////////////
-- /// Save the content of an image to a file
-- ///
-- /// \param Image : Image to save
-- /// \param Filename : Path of the file to save (overwritten if already exist)
-- ///
-- /// \return sfTrue if saving was successful
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_SaveToFile (Image : sfImage_Ptr; Filename : Standard.String) return sfBool;
-- ////////////////////////////////////////////////////////////
-- /// Create a transparency mask for an image from a specified colorkey
-- ///
-- /// \param Image : Image to modify
-- /// \param ColorKey : Color to become transparent
-- /// \param Alpha : Alpha value to use for transparent pixels
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfImage_CreateMaskFromColor (Image : sfImage_Ptr; ColorKey : sfColor; Alpha : sfUint8);
-- ////////////////////////////////////////////////////////////
-- /// Copy pixels from another image onto this one.
-- /// This function does a slow pixel copy and should only
-- /// be used at initialization time
-- ///
-- /// \param Image : Destination image
-- /// \param Source : Source image to copy
-- /// \param DestX : X coordinate of the destination position
-- /// \param DestY : Y coordinate of the destination position
-- /// \param SourceRect : Sub-rectangle of the source image to copy
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfImage_Copy
(Image : sfImage_Ptr;
Source : sfImage_Ptr;
DestX, DestY : sfUint32;
SourceRect : sfIntRect);
-- ////////////////////////////////////////////////////////////
-- /// Create the image from the current contents of the
-- /// given window
-- ///
-- /// \param Image : Destination image
-- /// \param Window : Window to capture
-- /// \param SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image)
-- ///
-- /// \return True if creation was successful
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_CopyScreen
(Image : sfImage_Ptr;
Window : sfRenderWindow_Ptr;
SourceRect : sfIntRect)
return sfBool;
-- ////////////////////////////////////////////////////////////
-- /// Change the color of a pixel of an image
-- /// Don't forget to call Update when you end modifying pixels
-- ///
-- /// \param Image : Image to modify
-- /// \param X : X coordinate of pixel in the image
-- /// \param Y : Y coordinate of pixel in the image
-- /// \param Col : New color for pixel (X, Y)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfImage_SetPixel (Image : sfImage_Ptr; X, Y : sfUint32; Color : sfColor);
-- ////////////////////////////////////////////////////////////
-- /// Get a pixel from an image
-- ///
-- /// \param Image : Image to read
-- /// \param X : X coordinate of pixel in the image
-- /// \param Y : Y coordinate of pixel in the image
-- ///
-- /// \return Color of pixel (x, y)
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_GetPixel (Image : sfImage_Ptr; X, Y : sfUint32) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA)
-- /// Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4
-- /// This pointer becomes invalid if you reload or resize the image
-- ///
-- /// \param Image : Image to read
-- ///
-- /// \return Pointer to the array of pixels
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_GetPixelsPtr (Image : sfImage_Ptr) return sfUint8_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Bind the image for rendering
-- ///
-- /// \param Image : Image to bind
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfImage_Bind (Image : sfImage_Ptr);
-- ////////////////////////////////////////////////////////////
-- /// Enable or disable image smooth filter
-- ///
-- /// \param Image : Image to modify
-- /// \param Smooth : sfTrue to enable smoothing filter, false to disable it
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfImage_SetSmooth (Image : sfImage_Ptr; Smooth : sfBool);
-- ////////////////////////////////////////////////////////////
-- /// Return the width of the image
-- ///
-- /// \param Image : Image to read
-- ///
-- /// \return Width in pixels
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_GetWidth (Image : sfImage_Ptr) return sfUint32;
-- ////////////////////////////////////////////////////////////
-- /// Return the height of the image
-- ///
-- /// \param Image : Image to read
-- ///
-- /// \return Height in pixels
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_GetHeight (Image : sfImage_Ptr) return sfUint32;
-- ////////////////////////////////////////////////////////////
-- /// Tells whether the smoothing filter is enabled or not on an image
-- ///
-- /// \param Image : Image to read
-- ///
-- /// \return sfTrue if the smoothing filter is enabled
-- ///
-- ////////////////////////////////////////////////////////////
function sfImage_IsSmooth (Image : sfImage_Ptr) return sfBool;
private
pragma Import (C, sfImage_Create, "sfImage_Create");
pragma Import (C, sfImage_CreateFromColor, "sfImage_CreateFromColor");
pragma Import (C, sfImage_CreateFromPixels, "sfImage_CreateFromPixels");
pragma Import (C, sfImage_CreateFromMemory, "sfImage_CreateFromMemory");
pragma Import (C, sfImage_Destroy, "sfImage_Destroy");
pragma Import (C, sfImage_CreateMaskFromColor, "sfImage_CreateMaskFromColor");
pragma Import (C, sfImage_Copy, "sfImage_Copy");
pragma Import (C, sfImage_CopyScreen, "sfImage_CopyScreen");
pragma Import (C, sfImage_SetPixel, "sfImage_SetPixel");
pragma Import (C, sfImage_GetPixel, "sfImage_GetPixel");
pragma Import (C, sfImage_GetPixelsPtr, "sfImage_GetPixelsPtr");
pragma Import (C, sfImage_Bind, "sfImage_Bind");
pragma Import (C, sfImage_SetSmooth, "sfImage_SetSmooth");
pragma Import (C, sfImage_GetWidth, "sfImage_GetWidth");
pragma Import (C, sfImage_GetHeight, "sfImage_GetHeight");
pragma Import (C, sfImage_IsSmooth, "sfImage_IsSmooth");
end Sf.Graphics.Image;
|
30,385
|
ada
| 1,167
|
CandyROM/external_libncurses
|
Ada95/samples/ncurses2-color_edit.adb
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000-2006,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: <NAME> <<EMAIL>> 2000
-- Version Control
-- $Revision: 1.6 $
-- $Date: 2009/12/26 17:38:58 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with ncurses2.genericPuts;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
procedure ncurses2.color_edit is
use Int_IO;
type RGB_Enum is (Redx, Greenx, Bluex);
procedure change_color (current : Color_Number;
field : RGB_Enum;
value : RGB_Value;
usebase : Boolean);
procedure change_color (current : Color_Number;
field : RGB_Enum;
value : RGB_Value;
usebase : Boolean) is
red, green, blue : RGB_Value;
begin
if usebase then
Color_Content (current, red, green, blue);
else
red := 0;
green := 0;
blue := 0;
end if;
case field is
when Redx => red := red + value;
when Greenx => green := green + value;
when Bluex => blue := blue + value;
end case;
declare
begin
Init_Color (current, red, green, blue);
exception
when Curses_Exception => Beep;
end;
end change_color;
package x is new ncurses2.genericPuts (100); use x;
tmpb : x.BS.Bounded_String;
tmp4 : String (1 .. 4);
tmp6 : String (1 .. 6);
tmp8 : String (1 .. 8);
-- This would be easier if Ada had a Bounded_String
-- defined as a class instead of the inferior generic package,
-- then I could define Put, Add, and Get for them. Blech.
value : RGB_Value := 0;
red, green, blue : RGB_Value;
max_colors : constant Natural := Number_Of_Colors;
current : Color_Number := 0;
field : RGB_Enum := Redx;
this_c : Key_Code := 0;
begin
Refresh;
for i in Color_Number'(0) .. Color_Number (Number_Of_Colors) loop
Init_Pair (Color_Pair (i), White, i);
end loop;
Move_Cursor (Line => Lines - 2, Column => 0);
Add (Str => "Number: ");
myPut (tmpb, Integer (value));
myAdd (Str => tmpb);
loop
Switch_Character_Attribute (On => False,
Attr => (Bold_Character => True,
others => False));
Add (Line => 0, Column => 20, Str => "Color RGB Value Editing");
Switch_Character_Attribute (On => False,
Attr => (Bold_Character => True,
others => False));
for i in Color_Number'(0) .. Color_Number (Number_Of_Colors) loop
Move_Cursor (Line => 2 + Line_Position (i), Column => 0);
if current = i then
Add (Ch => '>');
else
Add (Ch => ' ');
end if;
-- TODO if i <= color_names'Max then
Put (tmp8, Integer (i));
Set_Character_Attributes (Color => Color_Pair (i));
Add (Str => " ");
Set_Character_Attributes;
Refresh;
Color_Content (i, red, green, blue);
Add (Str => " R = ");
if current = i and field = Redx then
Switch_Character_Attribute (On => True,
Attr => (Stand_Out => True,
others => False));
end if;
Put (tmp4, Integer (red));
Add (Str => tmp4);
if current = i and field = Redx then
Set_Character_Attributes;
end if;
Add (Str => " G = ");
if current = i and field = Greenx then
Switch_Character_Attribute (On => True,
Attr => (Stand_Out => True,
others => False));
end if;
Put (tmp4, Integer (green));
Add (Str => tmp4);
if current = i and field = Greenx then
Set_Character_Attributes;
end if;
Add (Str => " B = ");
if current = i and field = Bluex then
Switch_Character_Attribute (On => True,
Attr => (Stand_Out => True,
others => False));
end if;
Put (tmp4, Integer (blue));
Add (Str => tmp4);
if current = i and field = Bluex then
Set_Character_Attributes;
end if;
Set_Character_Attributes;
Add (Ch => ')');
end loop;
Add (Line => Line_Position (Number_Of_Colors + 3), Column => 0,
Str => "Use up/down to select a color, left/right to change " &
"fields.");
Add (Line => Line_Position (Number_Of_Colors + 4), Column => 0,
Str => "Modify field by typing nnn=, nnn-, or nnn+. ? for help.");
Move_Cursor (Line => 2 + Line_Position (current), Column => 0);
this_c := Getchar;
if Is_Digit (this_c) then
value := 0;
end if;
case this_c is
when KEY_UP =>
current := (current - 1) mod Color_Number (max_colors);
when KEY_DOWN =>
current := (current + 1) mod Color_Number (max_colors);
when KEY_RIGHT =>
field := RGB_Enum'Val ((RGB_Enum'Pos (field) + 1) mod 3);
when KEY_LEFT =>
field := RGB_Enum'Val ((RGB_Enum'Pos (field) - 1) mod 3);
when
Character'Pos ('0') |
Character'Pos ('1') |
Character'Pos ('2') |
Character'Pos ('3') |
Character'Pos ('4') |
Character'Pos ('5') |
Character'Pos ('6') |
Character'Pos ('7') |
Character'Pos ('8') |
Character'Pos ('9') =>
value := value * 10 + RGB_Value (ctoi (Code_To_Char (this_c)));
when Character'Pos ('+') =>
change_color (current, field, value, True);
when Character'Pos ('-') =>
change_color (current, field, -value, True);
when Character'Pos ('=') =>
change_color (current, field, value, False);
when Character'Pos ('?') =>
Erase;
P (" RGB Value Editing Help");
P ("");
P ("You are in the RGB value editor. Use the arrow keys to " &
"select one of");
P ("the fields in one of the RGB triples of the current colors;" &
" the one");
P ("currently selected will be reverse-video highlighted.");
P ("");
P ("To change a field, enter the digits of the new value; they" &
" are echoed");
P ("as entered. Finish by typing `='. The change will take" &
" effect instantly.");
P ("To increment or decrement a value, use the same procedure," &
" but finish");
P ("with a `+' or `-'.");
P ("");
P ("To quit, do `x' or 'q'");
Pause;
Erase;
when Character'Pos ('q') |
Character'Pos ('x') =>
null;
when others =>
Beep;
end case;
Move_Cursor (Line => Lines - 2, Column => 0);
Put (tmp6, Integer (value));
Add (Str => "Number: " & tmp6);
Clear_To_End_Of_Line;
exit when this_c = Character'Pos ('x') or
this_c = Character'Pos ('q');
end loop;
Erase;
End_Windows;
end ncurses2.color_edit;
|
30,386
|
ada
| 1
|
alexbarker/Nuclear_Submarine_Control_System
|
Trident/src/trident.ads
|
-- SET10112 2018-9 TR2 001 - Formal Approaches to Software Engineering
-- Trident - Submarine Coursework
-- Version 0.3.1
-- <NAME>
-- 40333139
-- Last Updated on 19th April 2019
-- trident.ads
package Trident with SPARK_Mode is
type Operational is (Yes, No);
type WeaponsSystemAvailable is (Available, Unavailable);
type TorpedoesStored is (Stored, Notstored);
type TorpedoesLoaded is (Loaded, Notloaded);
type TorpedoesFiring is (Firing, Waiting);
type TorpedoesCount is range 0..5;
type AirlockDoorOne is (Closed, Open);
type AirlockDoorTwo is (Closed, Open);
type AirlockLockOne is (Locked, Unlocked);
type AirlockLockTwo is (Locked, Unlocked);
type DiveOperation is (Dive, Surface);
type DepthWarning is (OptimalDepth, Warning, MaximumDepth);
type Depth is new Integer range 0..1000;
type LifeSupport is (Optimal, Danger);
type LifeSupportWarning is (OptimalOxygen, OxygenWarning);
type OxygenPercentage is new Integer range 0..100;
type ReactorWarning is (Optimal, Overheating);
type ReactorTemp is range 0..250;
type Submarine is record
operating : Operational;
WeaponsAvailablity : WeaponsSystemAvailable;
CloseAirlockOne : AirlockDoorOne;
CloseAirlockTwo : AirlockDoorTwo;
LockAirlockOne : AirlockLockOne;
LockAirlockTwo : AirlockLockTwo;
torpedoes : TorpedoesCount;
loaded : Boolean;
storedTorpedoes : TorpedoesStored;
loadedTorpedoes : TorpedoesLoaded;
firingTorpedoes : TorpedoesFiring;
diveOperational : DiveOperation;
depthPositionCheck : DepthWarning;
depthRange : Depth;
lifeSupportStatus : LifeSupport;
lifeSupportWarnings : LifeSupportWarning;
oxygenRange : OxygenPercentage;
reactorWarnings : ReactorWarning;
reactorTemperature : ReactorTemp;
end record;
TridentSubmarine : Submarine := (operating => No, CloseAirlockOne => Open,
CloseAirlockTwo => Closed, LockAirlockOne => Unlocked,
LockAirlockTwo => Unlocked, WeaponsAvailablity => Unavailable,
loaded => False, torpedoes => 0, storedTorpedoes => Notstored,
loadedTorpedoes => NotLoaded, firingTorpedoes => Waiting,
diveOperational => Surface, depthPositionCheck => OptimalDepth, depthRange => 0,
lifeSupportStatus => Optimal, lifeSupportWarnings => OptimalOxygen, oxygenRange => 100,
reactorTemperature => 1, reactorWarnings => Optimal);
procedure OperateSubmarine with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.operating = No and then TridentSubmarine.CloseAirlockOne = Closed
and then TridentSubmarine.LockAirlockOne = Locked and then TridentSubmarine.CloseAirlockTwo = Closed
and then TridentSubmarine.LockAirlockTwo = Locked,
Post => TridentSubmarine.operating = Yes;
procedure WeaponsSystemCheck with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.operating = Yes and then TridentSubmarine.loadedTorpedoes = Loaded,
Post => TridentSubmarine.WeaponsAvailablity = Available;
procedure ReadyToFire with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.WeaponsAvailablity = Available and then TridentSubmarine.loadedTorpedoes = Loaded,
Post => TridentSubmarine.WeaponsAvailablity = Available;
procedure DepthPosition with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available,
Post => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available;
procedure DepthTest with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.diveOperational = Dive and then
TridentSubmarine.depthRange < 8,
Post => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.diveOperational = Dive and then
TridentSubmarine.depthRange /= 0;
procedure DiveCheck with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.diveOperational = Surface,
Post => TridentSubmarine.diveOperational = Dive;
procedure EmergencySurface with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.diveOperational = Dive,
Post=> TridentSubmarine.diveOperational = Surface and then
TridentSubmarine.oxygenRange = 100;
procedure LifeSupportCheck with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.oxygenRange <= 0,
Post => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.oxygenRange <= 0;
procedure OxygenTest with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.diveOperational = Dive and then
TridentSubmarine.oxygenRange >= 20,
Post => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.diveOperational = Dive and then
TridentSubmarine.oxygenRange >= 0;
procedure ReactorCheck with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.Operating = Yes and then
TridentSubmarine.WeaponsAvailablity = Available and then
TridentSubmarine.reactorWarnings = Optimal and then
TridentSubmarine.diveOperational = Dive,
Post => TridentSubmarine.Operating = Yes and then
TridentSubmarine.reactorWarnings = Optimal and then
TridentSubmarine.reactorWarnings = Overheating;
procedure Load with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.WeaponsAvailablity = Available and then TridentSubmarine.loaded = False and then TridentSubmarine.torpedoes > 0,
Post => TridentSubmarine.loaded = True and then TridentSubmarine.loadedTorpedoes = Loaded and then TridentSubmarine.torpedoes = TridentSubmarine.torpedoes'Old;
procedure Fire with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.WeaponsAvailablity = Available and then TridentSubmarine.loaded = True and then TridentSubmarine.torpedoes > 0,
Post => TridentSubmarine.loaded = False and then TridentSubmarine.firingTorpedoes = Firing and then TridentSubmarine.torpedoes = TridentSubmarine.torpedoes'Old - 1;
procedure Store with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.WeaponsAvailablity = Available and then TridentSubmarine.torpedoes < TorpedoesCount'Last,
Post => TridentSubmarine.torpedoes = TridentSubmarine.torpedoes'Old + 1 and then TridentSubmarine.storedTorpedoes = Stored;
procedure CloseAirlockOne with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.CloseAirlockOne = Open and then TridentSubmarine.CloseAirlockTwo = Closed,
Post => TridentSubmarine.CloseAirlockOne = Closed;
procedure CloseAirlockTwo with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.CloseAirlockTwo = Open and then TridentSubmarine.CloseAirlockOne = Closed,
Post => TridentSubmarine.CloseAirlockTwo = Closed;
procedure LockAirlockOne with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.CloseAirlockOne = Closed and then
TridentSubmarine.LockAirlockOne = Unlocked,
Post => TridentSubmarine.LockAirlockOne = Locked;
procedure LockAirlockTwo with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.CloseAirlockTwo = Closed and then
TridentSubmarine.LockAirlockTwo = Unlocked,
Post => TridentSubmarine.LockAirlockTwo = Locked;
procedure OpenAirlockOne with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.LockAirlockOne = Unlocked and then
TridentSubmarine.CloseAirlockOne = Closed and then
TridentSubmarine.CloseAirlockTwo = Closed,
Post => TridentSubmarine.CloseAirlockOne = Open;
procedure OpenAirlockTwo with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.LockAirlockTwo = Unlocked and then
TridentSubmarine.CloseAirlockTwo = Closed and then
TridentSubmarine.CloseAirlockOne = Closed,
Post => TridentSubmarine.CloseAirlockTwo = Open;
procedure UnlockAirlockOne with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.CloseAirlockOne = Closed and then TridentSubmarine.LockAirlockOne = Locked,
Post => TridentSubmarine.CloseAirlockOne = Closed and then TridentSubmarine.LockAirlockOne = Unlocked;
procedure UnlockAirlockTwo with
Global => (In_Out => TridentSubmarine),
Pre => TridentSubmarine.CloseAirlockTwo = Closed and then TridentSubmarine.LockAirlockTwo = Locked,
Post => TridentSubmarine.CloseAirlockTwo = Closed and then TridentSubmarine.LockAirlockTwo = Unlocked;
end Trident;
|
30,387
|
ada
| 15
|
My-Colaborations/dynamo
|
src/gnat/prj-tree.ads
|
<filename>src/gnat/prj-tree.ads
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . T R E E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the structure of the Project File tree
with GNAT.Dynamic_HTables;
with GNAT.Dynamic_Tables;
with Table;
with Prj.Attr; use Prj.Attr;
with Prj.Env;
with Prj.Ext;
package Prj.Tree is
-----------------
-- Environment --
-----------------
-- The following record contains the context in which projects are parsed
-- and processed (finding importing project, resolving external values,..).
type Environment is record
External : Prj.Ext.External_References;
-- External references are stored in this hash table (and manipulated
-- through subprograms in prj-ext.ads). External references are
-- project-tree specific so that one can load the same tree twice but
-- have two views of it, for instance.
Project_Path : aliased Prj.Env.Project_Search_Path;
-- The project path is tree specific, since we might want to load
-- simultaneously multiple projects, each with its own search path, in
-- particular when using different compilers with different default
-- search directories.
Flags : Prj.Processing_Flags;
-- Configure errors and warnings
end record;
procedure Initialize
(Self : out Environment;
Flags : Processing_Flags);
-- Initialize a new environment
procedure Initialize_And_Copy
(Self : out Environment;
Copy_From : Environment);
-- Initialize a new environment, copying its values from Copy_From
procedure Free (Self : in out Environment);
-- Free the memory used by Self
procedure Override_Flags
(Self : in out Environment; Flags : Prj.Processing_Flags);
-- Override the subprogram called in case there are parsing errors. This
-- is needed in applications that do their own error handling, since the
-- error handler is likely to be a local subprogram in this case (which
-- can't be stored when the flags are created).
-------------------
-- Project nodes --
-------------------
type Project_Node_Tree_Data;
type Project_Node_Tree_Ref is access all Project_Node_Tree_Data;
-- Type to designate a project node tree, so that several project node
-- trees can coexist in memory.
Project_Nodes_Initial : constant := 1_000;
Project_Nodes_Increment : constant := 100;
-- Allocation parameters for initializing and extending number
-- of nodes in table Tree_Private_Part.Project_Nodes
Project_Node_Low_Bound : constant := 0;
Project_Node_High_Bound : constant := 099_999_999;
-- Range of values for project node id's (in practice infinite)
type Project_Node_Id is range
Project_Node_Low_Bound .. Project_Node_High_Bound;
-- The index of table Tree_Private_Part.Project_Nodes
Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
-- Designates no node in table Project_Nodes
First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound + 1;
subtype Variable_Node_Id is Project_Node_Id;
-- Used to designate a node whose expected kind is one of
-- N_Typed_Variable_Declaration, N_Variable_Declaration or
-- N_Variable_Reference.
subtype Package_Declaration_Id is Project_Node_Id;
-- Used to designate a node whose expected kind is N_Project_Declaration
type Project_Node_Kind is
(N_Project,
N_With_Clause,
N_Project_Declaration,
N_Declarative_Item,
N_Package_Declaration,
N_String_Type_Declaration,
N_Literal_String,
N_Attribute_Declaration,
N_Typed_Variable_Declaration,
N_Variable_Declaration,
N_Expression,
N_Term,
N_Literal_String_List,
N_Variable_Reference,
N_External_Value,
N_Attribute_Reference,
N_Case_Construction,
N_Case_Item,
N_Comment_Zones,
N_Comment);
-- Each node in the tree is of a Project_Node_Kind. For the signification
-- of the fields in each node of Project_Node_Kind, look at package
-- Tree_Private_Part.
function Present (Node : Project_Node_Id) return Boolean;
pragma Inline (Present);
-- Return True if Node /= Empty_Node
function No (Node : Project_Node_Id) return Boolean;
pragma Inline (No);
-- Return True if Node = Empty_Node
procedure Initialize (Tree : Project_Node_Tree_Ref);
-- Initialize the Project File tree: empty the Project_Nodes table
-- and reset the Projects_Htable.
function Default_Project_Node
(In_Tree : Project_Node_Tree_Ref;
Of_Kind : Project_Node_Kind;
And_Expr_Kind : Variable_Kind := Undefined) return Project_Node_Id;
-- Returns a Project_Node_Record with the specified Kind and Expr_Kind. All
-- the other components have default nil values.
-- To create a node for a project itself, see Create_Project below instead
function Hash (N : Project_Node_Id) return Header_Num;
-- Used for hash tables where the key is a Project_Node_Id
function Imported_Or_Extended_Project_Of
(Project : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
With_Name : Name_Id) return Project_Node_Id;
-- Return the node of a project imported or extended by project Project and
-- whose name is With_Name. Return Empty_Node if there is no such project.
--------------
-- Comments --
--------------
type Comment_State is private;
-- A type to store the values of several global variables related to
-- comments.
procedure Save (S : out Comment_State);
-- Save in variable S the comment state. Called before scanning a new
-- project file.
procedure Restore_And_Free (S : in out Comment_State);
-- Restore the comment state to a previously saved value. Called after
-- scanning a project file. Frees the memory occupied by S
procedure Reset_State;
-- Set the comment state to its initial value. Called before scanning a
-- new project file.
function There_Are_Unkept_Comments return Boolean;
-- Indicates that some of the comments in a project file could not be
-- stored in the parse tree.
procedure Set_Previous_Line_Node (To : Project_Node_Id);
-- Indicate the node on the previous line. If there are comments
-- immediately following this line, then they should be associated with
-- this node.
procedure Set_Previous_End_Node (To : Project_Node_Id);
-- Indicate that on the previous line the "end" belongs to node To.
-- If there are comments immediately following this "end" line, they
-- should be associated with this node.
procedure Set_End_Of_Line (To : Project_Node_Id);
-- Indicate the node on the current line. If there is an end of line
-- comment, then it should be associated with this node.
procedure Set_Next_End_Node (To : Project_Node_Id);
-- Put node To on the top of the end node stack. When an END line is found
-- with this node on the top of the end node stack, the comments, if any,
-- immediately preceding this "end" line will be associated with this node.
procedure Remove_Next_End_Node;
-- Remove the top of the end node stack
------------------------
-- Comment Processing --
------------------------
type Comment_Data is record
Value : Name_Id := No_Name;
Follows_Empty_Line : Boolean := False;
Is_Followed_By_Empty_Line : Boolean := False;
end record;
-- Component type for Comments Table below
package Comments is new Table.Table
(Table_Component_Type => Comment_Data,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100,
Table_Name => "Prj.Tree.Comments");
-- A table to store the comments that may be stored is the tree
procedure Scan (In_Tree : Project_Node_Tree_Ref);
-- Scan the tokens and accumulate comments
type Comment_Location is
(Before, After, Before_End, After_End, End_Of_Line);
-- Used in call to Add_Comments below
procedure Add_Comments
(To : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
Where : Comment_Location);
-- Add comments to this node
----------------------
-- Access Functions --
----------------------
-- The following query functions are part of the abstract interface
-- of the Project File tree. They provide access to fields of a project.
-- The access functions should be called only with valid arguments.
-- For each function the condition of validity is specified. If an access
-- function is called with invalid arguments, then exception
-- Assertion_Error is raised if assertions are enabled, otherwise the
-- behaviour is not defined and may result in a crash.
function Name_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id;
pragma Inline (Name_Of);
-- Valid for all non empty nodes. May return No_Name for nodes that have
-- no names.
function Display_Name_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id;
pragma Inline (Display_Name_Of);
-- Valid only for N_Project node. Returns the display name of the project.
function Kind_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Kind;
pragma Inline (Kind_Of);
-- Valid for all non empty nodes
function Location_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Source_Ptr;
pragma Inline (Location_Of);
-- Valid for all non empty nodes
function First_Comment_After
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Valid only for N_Comment_Zones nodes
function First_Comment_After_End
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Valid only for N_Comment_Zones nodes
function First_Comment_Before
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Valid only for N_Comment_Zones nodes
function First_Comment_Before_End
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Valid only for N_Comment_Zones nodes
function Next_Comment
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Valid only for N_Comment nodes
function End_Of_Line_Comment
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id;
-- Valid only for non empty nodes
function Follows_Empty_Line
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Boolean;
-- Valid only for N_Comment nodes
function Is_Followed_By_Empty_Line
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Boolean;
-- Valid only for N_Comment nodes
function Parent_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Parent_Project_Of);
-- Valid only for N_Project nodes
function Project_File_Includes_Unkept_Comments
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Boolean;
-- Valid only for N_Project nodes
function Directory_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Directory_Of);
-- Returns the directory that contains the project file. This always ends
-- with a directory separator. Only valid for N_Project nodes.
function Expression_Kind_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Variable_Kind;
pragma Inline (Expression_Kind_Of);
-- Only valid for N_Literal_String, N_Attribute_Declaration,
-- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
-- N_Term, N_Variable_Reference, N_Attribute_Reference nodes or
-- N_External_Value.
function Is_Extending_All
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Boolean;
pragma Inline (Is_Extending_All);
-- Only valid for N_Project and N_With_Clause
function Is_Not_Last_In_List
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Boolean;
pragma Inline (Is_Not_Last_In_List);
-- Only valid for N_With_Clause
function First_Variable_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Variable_Node_Id;
pragma Inline (First_Variable_Of);
-- Only valid for N_Project or N_Package_Declaration nodes
function First_Package_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Package_Declaration_Id;
pragma Inline (First_Package_Of);
-- Only valid for N_Project nodes
function Package_Id_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Package_Node_Id;
pragma Inline (Package_Id_Of);
-- Only valid for N_Package_Declaration nodes
function Path_Name_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Path_Name_Of);
-- Only valid for N_Project and N_With_Clause nodes
function String_Value_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id;
pragma Inline (String_Value_Of);
-- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment.
-- For a N_With_Clause created automatically for a virtual extending
-- project, No_Name is returned.
function Source_Index_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Int;
pragma Inline (Source_Index_Of);
-- Only valid for N_Literal_String and N_Attribute_Declaration nodes
function First_With_Clause_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_With_Clause_Of);
-- Only valid for N_Project nodes
function Project_Declaration_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Project_Declaration_Of);
-- Only valid for N_Project nodes
function Project_Qualifier_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Qualifier;
pragma Inline (Project_Qualifier_Of);
-- Only valid for N_Project nodes
function Extending_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Extending_Project_Of);
-- Only valid for N_Project_Declaration nodes
function First_String_Type_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_String_Type_Of);
-- Only valid for N_Project nodes
function Extended_Project_Path_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Extended_Project_Path_Of);
-- Only valid for N_With_Clause nodes
function Project_Node_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Project_Node_Of);
-- Only valid for N_With_Clause, N_Variable_Reference and
-- N_Attribute_Reference nodes.
function Non_Limited_Project_Node_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Non_Limited_Project_Node_Of);
-- Only valid for N_With_Clause nodes. Returns Empty_Node for limited
-- imported project files, otherwise returns the same result as
-- Project_Node_Of.
function Next_With_Clause_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_With_Clause_Of);
-- Only valid for N_With_Clause nodes
function First_Declarative_Item_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_Declarative_Item_Of);
-- Only valid for N_Project_Declaration, N_Case_Item and
-- N_Package_Declaration.
function Extended_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Extended_Project_Of);
-- Only valid for N_Project_Declaration nodes
function Current_Item_Node
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Current_Item_Node);
-- Only valid for N_Declarative_Item nodes
function Next_Declarative_Item
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Declarative_Item);
-- Only valid for N_Declarative_Item node
function Project_Of_Renamed_Package_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Project_Of_Renamed_Package_Of);
-- Only valid for N_Package_Declaration nodes. May return Empty_Node.
function Next_Package_In_Project
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Package_In_Project);
-- Only valid for N_Package_Declaration nodes
function First_Literal_String
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_Literal_String);
-- Only valid for N_String_Type_Declaration nodes
function Next_String_Type
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_String_Type);
-- Only valid for N_String_Type_Declaration nodes
function Next_Literal_String
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Literal_String);
-- Only valid for N_Literal_String nodes
function Expression_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Expression_Of);
-- Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
-- or N_Variable_Declaration nodes
function Associative_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref)
return Project_Node_Id;
pragma Inline (Associative_Project_Of);
-- Only valid for N_Attribute_Declaration nodes
function Associative_Package_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref)
return Project_Node_Id;
pragma Inline (Associative_Package_Of);
-- Only valid for N_Attribute_Declaration nodes
function Value_Is_Valid
(For_Typed_Variable : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
Value : Name_Id) return Boolean;
pragma Inline (Value_Is_Valid);
-- Only valid for N_Typed_Variable_Declaration. Returns True if Value is
-- in the list of allowed strings for For_Typed_Variable. False otherwise.
function Associative_Array_Index_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id;
pragma Inline (Associative_Array_Index_Of);
-- Only valid for N_Attribute_Declaration and N_Attribute_Reference.
-- Returns No_Name for non associative array attributes.
function Next_Variable
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Variable);
-- Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
-- nodes.
function First_Term
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_Term);
-- Only valid for N_Expression nodes
function Next_Expression_In_List
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Expression_In_List);
-- Only valid for N_Expression nodes
function Current_Term
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Current_Term);
-- Only valid for N_Term nodes
function Next_Term
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Term);
-- Only valid for N_Term nodes
function First_Expression_In_List
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_Expression_In_List);
-- Only valid for N_Literal_String_List nodes
function Package_Node_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Package_Node_Of);
-- Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
-- May return Empty_Node.
function Default_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Attribute_Default_Value;
pragma Inline (Default_Of);
-- Only valid for N_Attribute_Reference nodes
function String_Type_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (String_Type_Of);
-- Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
-- nodes.
function External_Reference_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (External_Reference_Of);
-- Only valid for N_External_Value nodes
function External_Default_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (External_Default_Of);
-- Only valid for N_External_Value nodes
function Case_Variable_Reference_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Case_Variable_Reference_Of);
-- Only valid for N_Case_Construction nodes
function First_Case_Item_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_Case_Item_Of);
-- Only valid for N_Case_Construction nodes
function First_Choice_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (First_Choice_Of);
-- Only valid for N_Case_Item nodes. Return the first choice in a
-- N_Case_Item, or Empty_Node if this is when others.
function Next_Case_Item
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Next_Case_Item);
-- Only valid for N_Case_Item nodes
function Case_Insensitive
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Boolean;
-- Only valid for N_Attribute_Declaration and N_Attribute_Reference nodes
-----------------------
-- Create procedures --
-----------------------
-- The following procedures are used to edit a project file tree. They are
-- slightly higher-level than the Set_* procedures below
function Create_Project
(In_Tree : Project_Node_Tree_Ref;
Name : Name_Id;
Full_Path : Path_Name_Type;
Is_Config_File : Boolean := False) return Project_Node_Id;
-- Create a new node for a project and register it in the tree so that it
-- can be retrieved later on.
function Create_Package
(Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id;
Pkg : String) return Project_Node_Id;
-- Create a new package in Project. If the package already exists, it is
-- returned. The name of the package *must* be lower-cases, or none of its
-- attributes will be recognized.
function Create_Attribute
(Tree : Project_Node_Tree_Ref;
Prj_Or_Pkg : Project_Node_Id;
Name : Name_Id;
Index_Name : Name_Id := No_Name;
Kind : Variable_Kind := List;
At_Index : Integer := 0;
Value : Project_Node_Id := Empty_Node) return Project_Node_Id;
-- Create a new attribute. The new declaration is added at the end of the
-- declarative item list for Prj_Or_Pkg (a project or a package), but
-- before any package declaration). No addition is done if Prj_Or_Pkg is
-- Empty_Node. If Index_Name is not "", then if creates an attribute value
-- for a specific index. At_Index is used for the " at <idx>" in the naming
-- exceptions.
--
-- To set the value of the attribute, either provide a value for Value, or
-- use Set_Expression_Of to set the value of the attribute (in which case
-- Enclose_In_Expression might be useful). The former is recommended since
-- it will more correctly handle cases where the index needs to be set on
-- the expression rather than on the index of the attribute (i.e. 'for
-- Specification ("unit") use "file" at 3', versus 'for Executable ("file"
-- at 3) use "name"'). Value must be a N_String_Literal if an index will be
-- added to it.
function Create_Literal_String
(Str : Namet.Name_Id;
Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Create a literal string whose value is Str
procedure Add_At_End
(Tree : Project_Node_Tree_Ref;
Parent : Project_Node_Id;
Expr : Project_Node_Id;
Add_Before_First_Pkg : Boolean := False;
Add_Before_First_Case : Boolean := False);
-- Add a new declarative item in the list in Parent. This new declarative
-- item will contain Expr (unless Expr is already a declarative item, in
-- which case it is added directly to the list). The new item is inserted
-- at the end of the list, unless Add_Before_First_Pkg is True. In the
-- latter case, it is added just before the first case construction is
-- seen, or before the first package (this assumes that all packages are
-- found at the end of the project, which isn't true in the general case
-- unless you have normalized the project to match this description).
function Enclose_In_Expression
(Node : Project_Node_Id;
Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Enclose the Node inside a N_Expression node, and return this expression.
-- This does nothing if Node is already a N_Expression.
--------------------
-- Set Procedures --
--------------------
-- The following procedures are part of the abstract interface of the
-- Project File tree.
-- Foe each Set_* procedure the condition of validity is specified. If an
-- access function is called with invalid arguments, then exception
-- Assertion_Error is raised if assertions are enabled, otherwise the
-- behaviour is not defined and may result in a crash.
-- These are very low-level, and manipulate the tree itself directly. You
-- should look at the Create_* procedure instead if you want to use higher
-- level constructs
procedure Set_Name_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Name_Id);
pragma Inline (Set_Name_Of);
-- Valid for all non empty nodes
procedure Set_Display_Name_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Name_Id);
pragma Inline (Set_Display_Name_Of);
-- Valid only for N_Project nodes
procedure Set_Kind_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Kind);
pragma Inline (Set_Kind_Of);
-- Valid for all non empty nodes
procedure Set_Location_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Source_Ptr);
pragma Inline (Set_Location_Of);
-- Valid for all non empty nodes
procedure Set_First_Comment_After
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Comment_After);
-- Valid only for N_Comment_Zones nodes
procedure Set_First_Comment_After_End
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Comment_After_End);
-- Valid only for N_Comment_Zones nodes
procedure Set_First_Comment_Before
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Comment_Before);
-- Valid only for N_Comment_Zones nodes
procedure Set_First_Comment_Before_End
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Comment_Before_End);
-- Valid only for N_Comment_Zones nodes
procedure Set_Next_Comment
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Comment);
-- Valid only for N_Comment nodes
procedure Set_Parent_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
-- Valid only for N_Project nodes
procedure Set_Project_File_Includes_Unkept_Comments
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Boolean);
-- Valid only for N_Project nodes
procedure Set_Directory_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Path_Name_Type);
pragma Inline (Set_Directory_Of);
-- Valid only for N_Project nodes
procedure Set_Expression_Kind_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Variable_Kind);
pragma Inline (Set_Expression_Kind_Of);
-- Only valid for N_Literal_String, N_Attribute_Declaration,
-- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
-- N_Term, N_Variable_Reference, N_Attribute_Reference or N_External_Value
-- nodes.
procedure Set_Is_Extending_All
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref);
pragma Inline (Set_Is_Extending_All);
-- Only valid for N_Project and N_With_Clause
procedure Set_Is_Not_Last_In_List
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref);
pragma Inline (Set_Is_Not_Last_In_List);
-- Only valid for N_With_Clause
procedure Set_First_Variable_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Variable_Node_Id);
pragma Inline (Set_First_Variable_Of);
-- Only valid for N_Project or N_Package_Declaration nodes
procedure Set_First_Package_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Package_Declaration_Id);
pragma Inline (Set_First_Package_Of);
-- Only valid for N_Project nodes
procedure Set_Package_Id_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Package_Node_Id);
pragma Inline (Set_Package_Id_Of);
-- Only valid for N_Package_Declaration nodes
procedure Set_Path_Name_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Path_Name_Type);
pragma Inline (Set_Path_Name_Of);
-- Only valid for N_Project and N_With_Clause nodes
procedure Set_String_Value_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Name_Id);
pragma Inline (Set_String_Value_Of);
-- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment.
procedure Set_Source_Index_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Int);
pragma Inline (Set_Source_Index_Of);
-- Only valid for N_Literal_String and N_Attribute_Declaration nodes. For
-- N_Literal_String, set the source index of the literal string. For
-- N_Attribute_Declaration, set the source index of the index of the
-- associative array element.
procedure Set_First_With_Clause_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_With_Clause_Of);
-- Only valid for N_Project nodes
procedure Set_Project_Declaration_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Project_Declaration_Of);
-- Only valid for N_Project nodes
procedure Set_Project_Qualifier_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Qualifier);
pragma Inline (Set_Project_Qualifier_Of);
-- Only valid for N_Project nodes
procedure Set_Extending_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Extending_Project_Of);
-- Only valid for N_Project_Declaration nodes
procedure Set_First_String_Type_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_String_Type_Of);
-- Only valid for N_Project nodes
procedure Set_Extended_Project_Path_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Path_Name_Type);
pragma Inline (Set_Extended_Project_Path_Of);
-- Only valid for N_With_Clause nodes
procedure Set_Project_Node_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id;
Limited_With : Boolean := False);
pragma Inline (Set_Project_Node_Of);
-- Only valid for N_With_Clause, N_Variable_Reference and
-- N_Attribute_Reference nodes.
procedure Set_Next_With_Clause_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_With_Clause_Of);
-- Only valid for N_With_Clause nodes
procedure Set_First_Declarative_Item_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Declarative_Item_Of);
-- Only valid for N_Project_Declaration, N_Case_Item and
-- N_Package_Declaration.
procedure Set_Extended_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Extended_Project_Of);
-- Only valid for N_Project_Declaration nodes
procedure Set_Current_Item_Node
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Current_Item_Node);
-- Only valid for N_Declarative_Item nodes
procedure Set_Next_Declarative_Item
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Declarative_Item);
-- Only valid for N_Declarative_Item node
procedure Set_Project_Of_Renamed_Package_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Project_Of_Renamed_Package_Of);
-- Only valid for N_Package_Declaration nodes.
procedure Set_Next_Package_In_Project
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Package_In_Project);
-- Only valid for N_Package_Declaration nodes
procedure Set_First_Literal_String
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Literal_String);
-- Only valid for N_String_Type_Declaration nodes
procedure Set_Next_String_Type
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_String_Type);
-- Only valid for N_String_Type_Declaration nodes
procedure Set_Next_Literal_String
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Literal_String);
-- Only valid for N_Literal_String nodes
procedure Set_Expression_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Expression_Of);
-- Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
-- or N_Variable_Declaration nodes
procedure Set_Associative_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Associative_Project_Of);
-- Only valid for N_Attribute_Declaration nodes
procedure Set_Associative_Package_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Associative_Package_Of);
-- Only valid for N_Attribute_Declaration nodes
procedure Set_Associative_Array_Index_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Name_Id);
pragma Inline (Set_Associative_Array_Index_Of);
-- Only valid for N_Attribute_Declaration and N_Attribute_Reference.
procedure Set_Next_Variable
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Variable);
-- Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
-- nodes.
procedure Set_First_Term
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Term);
-- Only valid for N_Expression nodes
procedure Set_Next_Expression_In_List
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Expression_In_List);
-- Only valid for N_Expression nodes
procedure Set_Current_Term
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Current_Term);
-- Only valid for N_Term nodes
procedure Set_Next_Term
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Term);
-- Only valid for N_Term nodes
procedure Set_First_Expression_In_List
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Expression_In_List);
-- Only valid for N_Literal_String_List nodes
procedure Set_Package_Node_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Package_Node_Of);
-- Only valid for N_Variable_Reference or N_Attribute_Reference nodes
procedure Set_Default_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Attribute_Default_Value);
pragma Inline (Set_Default_Of);
-- Only valid for N_Attribute_Reference nodes
procedure Set_String_Type_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_String_Type_Of);
-- Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
-- nodes.
procedure Set_External_Reference_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_External_Reference_Of);
-- Only valid for N_External_Value nodes
procedure Set_External_Default_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_External_Default_Of);
-- Only valid for N_External_Value nodes
procedure Set_Case_Variable_Reference_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Case_Variable_Reference_Of);
-- Only valid for N_Case_Construction nodes
procedure Set_First_Case_Item_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Case_Item_Of);
-- Only valid for N_Case_Construction nodes
procedure Set_First_Choice_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_First_Choice_Of);
-- Only valid for N_Case_Item nodes.
procedure Set_Next_Case_Item
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
pragma Inline (Set_Next_Case_Item);
-- Only valid for N_Case_Item nodes.
procedure Set_Case_Insensitive
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Boolean);
-- Only valid for N_Attribute_Declaration and N_Attribute_Reference nodes
-------------------------------
-- Restricted Access Section --
-------------------------------
package Tree_Private_Part is
-- This is conceptually in the private part. However, for efficiency,
-- some packages are accessing it directly.
type Project_Node_Record is record
Kind : Project_Node_Kind;
Qualifier : Project_Qualifier := Unspecified;
Location : Source_Ptr := No_Location;
Directory : Path_Name_Type := No_Path;
-- Only for N_Project
Display_Name : Name_Id := No_Name;
-- Only for N_Project
Expr_Kind : Variable_Kind := Undefined;
-- See below for what Project_Node_Kind it is used
Variables : Variable_Node_Id := Empty_Node;
-- First variable in a project or a package
Packages : Package_Declaration_Id := Empty_Node;
-- First package declaration in a project
Pkg_Id : Package_Node_Id := Empty_Package;
-- Only used for N_Package_Declaration
--
-- The component Pkg_Id is an entry into the table Package_Attributes
-- (in Prj.Attr). It is used to indicate all the attributes of the
-- package with their characteristics.
--
-- The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
-- are built once and for all through a call (from Prj.Initialize)
-- to procedure Prj.Attr.Initialize. It is never modified after that.
Name : Name_Id := No_Name;
-- See below for what Project_Node_Kind it is used
Src_Index : Int := 0;
-- Index of a unit in a multi-unit source.
-- Only for some N_Attribute_Declaration and N_Literal_String.
Path_Name : Path_Name_Type := No_Path;
-- See below for what Project_Node_Kind it is used
Value : Name_Id := No_Name;
-- See below for what Project_Node_Kind it is used
Default : Attribute_Default_Value := Empty_Value;
-- Only used in N_Attribute_Reference
Field1 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field2 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field3 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field4 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Flag1 : Boolean := False;
-- This flag is significant only for:
--
-- N_Attribute_Declaration and N_Attribute_Reference
-- Indicates for an associative array attribute, that the
-- index is case insensitive.
--
-- N_Comment
-- Indicates that the comment is preceded by an empty line.
--
-- N_Project
-- Indicates that there are comments in the project source that
-- cannot be kept in the tree.
--
-- N_Project_Declaration
-- Indicates that there are unkept comments in the project.
--
-- N_With_Clause
-- Indicates that this is not the last with in a with clause.
-- Set for "A", but not for "B" in with "B"; and with "A", "B";
Flag2 : Boolean := False;
-- This flag is significant only for:
--
-- N_Project
-- Indicates that the project "extends all" another project.
--
-- N_Comment
-- Indicates that the comment is followed by an empty line.
--
-- N_With_Clause
-- Indicates that the originally imported project is an extending
-- all project.
Comments : Project_Node_Id := Empty_Node;
-- For nodes other that N_Comment_Zones or N_Comment, designates the
-- comment zones associated with the node.
--
-- For N_Comment_Zones, designates the comment after the "end" of
-- the construct.
--
-- For N_Comment, designates the next comment, if any.
end record;
-- type Project_Node_Kind is
-- (N_Project,
-- -- Name: project name
-- -- Path_Name: project path name
-- -- Expr_Kind: Undefined
-- -- Field1: first with clause
-- -- Field2: project declaration
-- -- Field3: first string type
-- -- Field4: parent project, if any
-- -- Value: extended project path name (if any)
-- N_With_Clause,
-- -- Name: imported project name
-- -- Path_Name: imported project path name
-- -- Expr_Kind: Undefined
-- -- Field1: project node
-- -- Field2: next with clause
-- -- Field3: project node or empty if "limited with"
-- -- Field4: not used
-- -- Value: literal string withed
-- N_Project_Declaration,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: first declarative item
-- -- Field2: extended project
-- -- Field3: extending project
-- -- Field4: not used
-- -- Value: not used
-- N_Declarative_Item,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: current item node
-- -- Field2: next declarative item
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Package_Declaration,
-- -- Name: package name
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: project of renamed package (if any)
-- -- Field2: first declarative item
-- -- Field3: next package in project
-- -- Field4: not used
-- -- Value: not used
-- N_String_Type_Declaration,
-- -- Name: type name
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: first literal string
-- -- Field2: next string type
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Literal_String,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: next literal string
-- -- Field2: not used
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: string value
-- N_Attribute_Declaration,
-- -- Name: attribute name
-- -- Path_Name: not used
-- -- Expr_Kind: attribute kind
-- -- Field1: expression
-- -- Field2: project of full associative array
-- -- Field3: package of full associative array
-- -- Field4: not used
-- -- Value: associative array index
-- -- (if an associative array element)
-- N_Typed_Variable_Declaration,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: expression
-- -- Field2: type of variable (N_String_Type_Declaration)
-- -- Field3: next variable
-- -- Field4: not used
-- -- Value: not used
-- N_Variable_Declaration,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: variable kind
-- -- Field1: expression
-- -- Field2: not used
-- -- Field3 is used for next variable, instead of Field2,
-- -- so that it is the same field for
-- -- N_Variable_Declaration and
-- -- N_Typed_Variable_Declaration
-- -- Field3: next variable
-- -- Field4: not used
-- -- Value: not used
-- N_Expression,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: expression kind
-- -- Field1: first term
-- -- Field2: next expression in list
-- -- Field3: not used
-- -- Value: not used
-- N_Term,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: term kind
-- -- Field1: current term
-- -- Field2: next term in the expression
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Literal_String_List,
-- -- Designates a list of string expressions between brackets
-- -- separated by commas. The string expressions are not necessarily
-- -- literal strings.
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: List
-- -- Field1: first expression
-- -- Field2: not used
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Variable_Reference,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: variable kind
-- -- Field1: project (if specified)
-- -- Field2: package (if specified)
-- -- Field3: type of variable (N_String_Type_Declaration), if any
-- -- Field4: not used
-- -- Value: not used
-- N_External_Value,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: Name of the external reference (literal string)
-- -- Field2: Default (literal string)
-- -- Field3: not used
-- -- Value: not used
-- N_Attribute_Reference,
-- -- Name: attribute name
-- -- Path_Name: not used
-- -- Expr_Kind: attribute kind
-- -- Field1: project
-- -- Field2: package (if attribute of a package)
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: associative array index
-- -- (if an associative array element)
-- N_Case_Construction,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: case variable reference
-- -- Field2: first case item
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Case_Item
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: not used
-- -- Field1: first choice (literal string), or Empty_Node
-- -- for when others
-- -- Field2: first declarative item
-- -- Field3: next case item
-- -- Field4: not used
-- -- Value: not used
-- N_Comment_zones
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: not used
-- -- Field1: comment before the construct
-- -- Field2: comment after the construct
-- -- Field3: comment before the "end" of the construct
-- -- Value: end of line comment
-- -- Field4: not used
-- -- Comments: comment after the "end" of the construct
-- N_Comment
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: not used
-- -- Field1: not used
-- -- Field2: not used
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: comment
-- -- Flag1: comment is preceded by an empty line
-- -- Flag2: comment is followed by an empty line
-- -- Comments: next comment
package Project_Node_Table is new
GNAT.Dynamic_Tables
(Table_Component_Type => Project_Node_Record,
Table_Index_Type => Project_Node_Id,
Table_Low_Bound => First_Node_Id,
Table_Initial => Project_Nodes_Initial,
Table_Increment => Project_Nodes_Increment);
-- Table contains the syntactic tree of project data from project files
type Project_Name_And_Node is record
Name : Name_Id;
-- Name of the project
Node : Project_Node_Id;
-- Node of the project in table Project_Nodes
Resolved_Path : Path_Name_Type;
-- Resolved and canonical path of a real project file.
-- No_Name in case of virtual projects.
Extended : Boolean;
-- True when the project is being extended by another project
From_Extended : Boolean;
-- True when the project is only imported by projects that are
-- extended.
Proj_Qualifier : Project_Qualifier;
-- The project qualifier of the project, if any
end record;
No_Project_Name_And_Node : constant Project_Name_And_Node :=
(Name => No_Name,
Node => Empty_Node,
Resolved_Path => No_Path,
Extended => True,
From_Extended => False,
Proj_Qualifier => Unspecified);
package Projects_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Project_Name_And_Node,
No_Element => No_Project_Name_And_Node,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- This hash table contains a mapping of project names to project nodes.
-- Note that this hash table contains only the nodes whose Kind is
-- N_Project. It is used to find the node of a project from its name,
-- and to verify if a project has already been parsed, knowing its name.
end Tree_Private_Part;
type Project_Node_Tree_Data is record
Project_Nodes : Tree_Private_Part.Project_Node_Table.Instance;
Projects_HT : Tree_Private_Part.Projects_Htable.Instance;
Incomplete_With : Boolean := False;
-- Set to True if the projects were loaded with the flag
-- Ignore_Missing_With set to True, and there were indeed some with
-- statements that could not be resolved
end record;
procedure Free (Proj : in out Project_Node_Tree_Ref);
-- Free memory used by Prj
private
type Comment_Array is array (Positive range <>) of Comment_Data;
type Comments_Ptr is access Comment_Array;
type Comment_State is record
End_Of_Line_Node : Project_Node_Id := Empty_Node;
Previous_Line_Node : Project_Node_Id := Empty_Node;
Previous_End_Node : Project_Node_Id := Empty_Node;
Unkept_Comments : Boolean := False;
Comments : Comments_Ptr := null;
end record;
end Prj.Tree;
|
30,388
|
ada
| 20
|
charlie5/lace
|
3-mid/opengl/source/lean/light/opengl-light-directional.adb
|
<filename>3-mid/opengl/source/lean/light/opengl-light-directional.adb
with
openGL.conversions;
package body openGL.Light.directional
is
procedure inverse_view_Transform_is (Self : in out Item; Now : in Matrix_3x3)
is
use linear_Algebra;
begin
Self.Direction := Now * Normalised (Self.Site);
Self.halfplane_Vector := Normalised ( Normalised (Self.Direction (1 .. 3))
+ (0.0, 0.0, 1.0));
end inverse_view_Transform_is;
procedure Color_is (Self : in out Item; Ambient,
Diffuse,
Specular : in light_Color)
is
use openGL.conversions;
begin
Self. ambient_Color := to_Vector_4 (Ambient);
Self. diffuse_Color := to_Vector_4 (Diffuse);
Self.specular_Color := to_Vector_4 (Specular);
end Color_is;
function ambient_Color (Self : in Item) return Vector_4
is
begin
return Self.ambient_Color;
end ambient_Color;
function diffuse_Color (Self : in Item) return Vector_4
is
begin
return Self.diffuse_Color;
end diffuse_Color;
function specular_Color (Self : in Item) return Vector_4
is
begin
return Self.specular_Color;
end specular_Color;
function Direction (Self : in Item) return Vector_3
is
begin
return Self.Direction;
end Direction;
function halfplane_Vector (Self : in Item) return Vector_3
is
begin
return Self.halfplane_Vector;
end halfplane_Vector;
end openGL.Light.directional;
|
30,389
|
ada
| 1
|
io7m/coreland-openal-ada
|
openal-context-capture.ads
|
with OpenAL.Buffer;
with OpenAL.Types;
package OpenAL.Context.Capture is
--
-- API
--
type Buffer_Size_t is range 2 .. 65536;
-- proc_map : alcCaptureOpenDevice
function Open_Device
(Name : in String;
Frequency : in Types.Frequency_t;
Format : in OpenAL.Context.Request_Format_t;
Buffer_Size : in Buffer_Size_t) return Device_t;
-- proc_map : alcCaptureOpenDevice
function Open_Default_Device
(Frequency : in Types.Frequency_t;
Format : in OpenAL.Context.Request_Format_t;
Buffer_Size : in Buffer_Size_t) return Device_t;
-- proc_map : alcCaptureCloseDevice
procedure Close_Device (Device : in out Device_t);
-- proc_map : alcCaptureStart
procedure Start (Device : in Device_t);
-- proc_map : alcCaptureStop
procedure Stop (Device : in Device_t);
-- proc_map : alcCaptureSamples
procedure Samples_Mono_8
(Device : in Device_t;
Samples : out OpenAL.Buffer.Sample_Array_8_t);
-- proc_map : alcCaptureSamples
procedure Samples_Stereo_8
(Device : in Device_t;
Samples : out OpenAL.Buffer.Sample_Array_8_t);
-- proc_map : alcCaptureSamples
procedure Samples_Mono_16
(Device : in Device_t;
Samples : out OpenAL.Buffer.Sample_Array_16_t);
-- proc_map : alcCaptureSamples
procedure Samples_Stereo_16
(Device : in Device_t;
Samples : out OpenAL.Buffer.Sample_Array_16_t);
end OpenAL.Context.Capture;
|
30,390
|
ada
| 0
|
Fabien-Chouteau/offmt-tool
|
src/offmt_lib-fmt_data-unsigned_generic.ads
|
<reponame>Fabien-Chouteau/offmt-tool
generic
type T is mod <>;
package Offmt_Lib.Fmt_Data.Unsigned_Generic is
subtype Parent is Fmt_Data.Instance;
type Instance
is new Parent with private;
overriding
procedure From_Frame (This : in out Instance;
Frame : in out Data_Frame);
overriding
function Format (This : Instance;
Kind : Format_Kind)
return String;
overriding
procedure Put (This : Instance;
Kind : Format_Kind);
function Value (This : Instance) return T;
private
type Instance
is new Parent with record
Val : T;
Loaded : Boolean := False;
end record;
end Offmt_Lib.Fmt_Data.Unsigned_Generic;
|
30,391
|
ada
| 33
|
ytomino/drake
|
source/a-fixed.adb
|
<filename>source/a-fixed.adb
with System.Long_Long_Float_Types;
with System.Long_Long_Integer_Types;
package body Ada.Fixed is
subtype Long_Long_Unsigned is
System.Long_Long_Integer_Types.Long_Long_Unsigned;
pragma Compile_Time_Error (
Long_Long_Float'Size < 96,
"Long_Long_Float is too short for the intermediate format.");
-- implementation
procedure Divide (
Dividend : Dividend_Type;
Divisor : Divisor_Type;
Quotient : out Quotient_Type;
Remainder : out Remainder_Type) is
begin
if Divisor = 0.0 and then Division_Check'Enabled then
raise Constraint_Error;
end if;
if Dividend_Type'Small = Divisor_Type'Small then
declare
subtype LLU is Long_Long_Unsigned;
N : constant LLU :=
LLU'Integer_Value (Dividend_Type'(abs Dividend));
D : constant LLU := LLU'Integer_Value (Divisor_Type'(abs Divisor));
Q : LLU;
R : LLU;
begin
System.Long_Long_Integer_Types.Divide (N, D, Q, R);
Quotient := Quotient_Type (Q);
Remainder := Remainder_Type (Dividend_Type'Fixed_Value (R));
end;
elsif Dividend_Type'Small >= 1.0 and then Divisor_Type'Small >= 1.0 then
declare
subtype LLF is Long_Long_Float;
N : constant LLF := LLF (abs Dividend);
D : constant LLF := LLF (abs Divisor);
Q : LLF;
R : LLF;
begin
System.Long_Long_Float_Types.Divide (N, D, Q, R);
Quotient := Quotient_Type (Q);
Remainder := Remainder_Type (R);
end;
else
declare
subtype LLF is Long_Long_Float;
ND_Smallest : constant LLF :=
LLF'Min (Dividend_Type'Small, Divisor_Type'Small);
N : constant LLF :=
(Dividend_Type'Small / ND_Smallest)
* LLF (
Long_Long_Integer'Integer_Value (
Dividend_Type'(abs Dividend)));
D : constant LLF :=
(Divisor_Type'Small / ND_Smallest)
* LLF (
Long_Long_Integer'Integer_Value (
Divisor_Type'(abs Divisor)));
Q : LLF;
R : LLF;
begin
System.Long_Long_Float_Types.Divide (N, D, Q, R);
Quotient := Quotient_Type (Q);
Remainder := Remainder_Type (ND_Smallest * R);
end;
end if;
if (Dividend < 0.0) /= (Divisor < 0.0) then
Quotient := -Quotient;
end if;
if Dividend < 0.0 then
Remainder := -Remainder;
end if;
end Divide;
end Ada.Fixed;
|
30,392
|
ada
| 4
|
faelys/gela-asis
|
source/libgela/gela-source_buffers-portable.adb
|
------------------------------------------------------------------------------
-- <NAME> A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Streams.Stream_IO;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
package body Gela.Source_Buffers.Portable is
type Stream_Element_Access is access all Ada.Streams.Stream_Element;
function Convert is new Ada.Unchecked_Conversion
(Stream_Element_Access, Cursor);
----------
-- Open --
----------
procedure Open
(Object : in out Source_Buffer;
File_Name : in String)
is
use Ada.Streams;
use Ada.Streams.Stream_IO;
subtype IO_Count is Ada.Streams.Stream_IO.Count;
Input : File_Type;
File_Size : IO_Count;
Upper : Stream_Element_Offset;
Last : Stream_Element_Offset;
End_Of_File : constant Stream_Element :=
Stream_Element'Val (Code_Unit'Pos (Source_Buffers.End_Of_File));
begin
Open (Input, In_File, File_Name);
File_Size := Size (Input);
-- Reserve a few bytes for End_Of_File marker.
Upper := Stream_Element_Offset (File_Size + 2);
Object.Internal_Array := new Stream_Element_Array (1 .. Upper);
Read (Input, Object.Internal_Array.all, Last);
Object.Internal_Array (Last + 1 .. Upper) := (others => End_Of_File);
Close (Input);
end Open;
-----------
-- Close --
-----------
procedure Close (Object : in out Source_Buffer) is
procedure Deallocate is new Ada.Unchecked_Deallocation
(Ada.Streams.Stream_Element_Array, Array_Access);
begin
Deallocate (Object.Internal_Array);
end Close;
------------------
-- Buffer_Start --
------------------
function Buffer_Start (Object : Source_Buffer) return Cursor is
begin
return Convert (Object.Internal_Array (1)'Access);
end Buffer_Start;
end Gela.Source_Buffers.Portable;
------------------------------------------------------------------------------
-- Copyright (c) 2008, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Authors:
-- <NAME>
-- <NAME>
-- <NAME>
------------------------------------------------------------------------------
|
30,393
|
ada
| 5
|
hulpke/smallgrp
|
id6/id1920.adb
|
<gh_stars>1-10
#############################################################################
##
#W id1920.adb GAP library of id's <NAME>
##
ID_GROUP_TREE.next[1920].next[1].next[106]:=
rec(
fp:= [ 106, 606, 1106, 1606, 2106 ],
next:= [ rec(
fp:= [ 31719, 91192, 91483 ],
next:= [ rec(
fp:= [ 1799, 4105, 15665, 22211, 32867, 42806, 60681, 63076, 63307,
80381, 91343, 92866 ],
level:= 4,
next:= [ 4389, 4378, 4385, 4390, 4392, 4391, 4383, 4387, 4393, 4394,
4388, 4381 ] ), rec(
fp:= [ 23910, 82038 ],
level:= 4,
next:= [ 4376, 4379 ] ), rec(
fp:= [ 5894, 24611, 32022, 36913, 67696 ],
level:= 4,
next:= [ 4384, 4382, 4386, 4380, 4377 ] ) ] ), rec(
fp:= [ 3596, 46537, 65954 ],
next:= [ rec(
fp:= [ 17955, 21825, 28894, 64608, 84112, 91091 ],
level:= 4,
next:= [ 26389, 26387, 26381, 26378, 26375, 26384 ] ), rec(
fp:= [ 3258, 55402, 63317, 89321, 91884 ],
level:= 4,
next:= [ 26374, 26383, 26377, 26386, 26380 ] ), rec(
fp:= [ 260, 1163, 2317, 11444, 13368, 15475, 18937, 21312, 22246,
22456, 24008, 32394, 34497, 34818, 35183, 35640, 37169, 39268, 49471, 50246,
51707, 52794, 53812, 57267, 62965, 66414, 68416, 75032, 77135, 84867, 86953,
89056, 90334, 93654 ],
level:= 4,
next:= [ 26394, 26403, 26417, 26382, 26388, 26410, 26408, 26399, 26406,
26390, 26376, 26402, 26397, 26415, 26404, 26396, 26391, 26413, 26395, 26398,
26411, 26401, 26418, 26393, 26385, 26412, 26409, 26405, 26407, 26416, 26400,
26414, 26379, 26392 ] ) ] ), rec(
fp:= [ 6681, 64546, 87916 ],
next:= [ rec(
fp:= [ 305, 4516, 5984, 8497, 12252, 42426, 43829, 56060, 68291, 69792,
74003, 81739, 82023, 86234, 89203, 95755, 97424 ],
level:= 4,
next:= [ rec(
fp:= [ 9915, 19506, 20288, 38032, 81985, 90618, 94996, 97525 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56239, 56222 ] ), rec(
desc:= [ 111003 ],
fp:= [ 4, 212 ],
next:= [ 56209, 56210 ] ), rec(
desc:= [ 110003 ],
fp:= [ 2, 12 ],
next:= [ 56252, 56253 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56238, 56223 ] ), rec(
desc:= [ 110003 ],
fp:= [ 2, 12 ],
next:= [ 56272, 56273 ] ), rec(
desc:= [ 110003 ],
fp:= [ 4, 212 ],
next:= [ 56246, 56247 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56233, 56282 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56232, 56283 ] ) ] ), rec(
fp:= [ 13970, 21986, 69906, 90790 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 56259, 56276 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 56262, 56278 ] ), 56219, 56312 ] ), rec(
fp:= [ 19331, 56721 ],
next:= [ 56317, 56318 ] ), 56206, rec(
fp:= [ 31761, 36613 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56189, 56198 ] ), rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 56186, 56180 ] ) ] ), rec(
fp:= [ 4355, 44735 ],
next:= [ 56183, 56192 ] ), rec(
fp:= [ 42282, 55213, 80027 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 4, 14 ],
next:= [ 56311, 56309 ] ), rec(
desc:= [ 109003 ],
fp:= [ 4, 14 ],
next:= [ 56307, 56306 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 14 ],
next:= [ 56310, 56308 ] ) ] ), rec(
fp:= [ 17548, 47856, 49766, 56492, 58399, 84815 ],
next:= [ rec(
desc:= [ 108003 ],
fp:= [ 16, 412 ],
next:= [ 56266, 56290 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56295, 56242 ] ), rec(
desc:= [ 106003 ],
fp:= [ 4, 14 ],
next:= [ 56269, 56305 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56296, 56243 ] ), rec(
desc:= [ 111003 ],
fp:= [ 2, 12 ],
next:= [ 56302, 56218 ] ), rec(
desc:= [ 111003 ],
fp:= [ 214, 412 ],
next:= [ 56301, 56217 ] ) ] ), rec(
fp:= [ 54978, 88261, 92569, 97018 ],
next:= [ 56221, 56314, rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 56261, 56281 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 56260, 56280 ] ) ] ), rec(
fp:= [ 37837, 58250, 58756, 60779, 66473, 82961 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56292, 56240 ] ), rec(
desc:= [ 108003 ],
fp:= [ 4, 212 ],
next:= [ 56265, 56289 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56294, 56245 ] ), rec(
desc:= [ 106003 ],
fp:= [ 4, 14 ],
next:= [ 56268, 56303 ] ), rec(
desc:= [ 110003 ],
fp:= [ 214, 412 ],
next:= [ 56298, 56214 ] ), rec(
desc:= [ 110003 ],
fp:= [ 2, 12 ],
next:= [ 56300, 56216 ] ) ] ), rec(
fp:= [ 26537, 39417, 66037, 98599 ],
next:= [ rec(
desc:= [ 110003 ],
fp:= [ 6, 214, 412 ],
next:= [ 56241, rec(
desc:= [ 302009, 210002 ],
fp:= [ 4, 14 ],
next:= [ 56297, 56291 ] ), 56213 ] ), rec(
desc:= [ 106003 ],
fp:= [ 4, 14 ],
next:= [ 56267, 56304 ] ), rec(
desc:= [ 111003 ],
fp:= [ 6, 214, 412 ],
next:= [ 56244, rec(
desc:= [ 302008, 211002 ],
fp:= [ 4, 14 ],
next:= [ 56299, 56293 ] ), 56215 ] ), rec(
desc:= [ 109003 ],
fp:= [ 4, 212 ],
next:= [ 56264, 56288 ] ) ] ), rec(
fp:= [ 5214, 28741 ],
next:= [ 56201, rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 56204, 56195 ] ) ] ), rec(
fp:= [ 11551, 17880, 28293, 67663, 77012, 79789, 96420, 98369 ],
next:= [ rec(
desc:= [ 110003 ],
fp:= [ 2, 12 ],
next:= [ 56255, 56257 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56234, 56227 ] ), rec(
desc:= [ 110003 ],
fp:= [ 4, 212 ],
next:= [ 56208, 56211 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56228, 56287 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56236, 56225 ] ), rec(
desc:= [ 109003 ],
fp:= [ 2, 12 ],
next:= [ 56271, 56274 ] ), rec(
desc:= [ 109003 ],
fp:= [ 4, 212 ],
next:= [ 56249, 56251 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56230, 56285 ] ) ] ), rec(
fp:= [ 25, 21820, 32611, 41733, 62165, 65069, 77630, 87058 ],
next:= [ rec(
desc:= [ 109003 ],
fp:= [ 2, 12 ],
next:= [ 56254, 56256 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56235, 56226 ] ), rec(
desc:= [ 109003 ],
fp:= [ 4, 212 ],
next:= [ 56248, 56250 ] ), rec(
desc:= [ 109003 ],
fp:= [ 2, 12 ],
next:= [ 56270, 56275 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 56237, 56224 ] ), rec(
desc:= [ 110003 ],
fp:= [ 4, 212 ],
next:= [ 56207, 56212 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56229, 56286 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56231, 56284 ] ) ] ), rec(
fp:= [ 7548, 90187 ],
next:= [ 56322, 56321 ] ), rec(
fp:= [ 3000, 34505, 70825, 97607 ],
next:= [ 56313, 56220, rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 56258, 56277 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 56263, 56279 ] ) ] ), rec(
fp:= [ 48615, 73893, 79848, 89179 ],
next:= [ 56316, 56320, 56319, 56315 ] ) ] ), rec(
fp:= [ 17834, 65569, 91532, 91988 ],
level:= 4,
next:= [ rec(
fp:= [ 1366, 22098 ],
next:= [ 56191, 56182 ] ), rec(
fp:= [ 27997, 44842 ],
next:= [ 56200, rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 56203, 56194 ] ) ] ), rec(
fp:= [ 43180, 53294 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56188, 56197 ] ), rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 56185, 56179 ] ) ] ), 56205 ] ), rec(
fp:= [ 30970, 43201, 55432 ],
level:= 4,
next:= [ rec(
fp:= [ 4290, 67867 ],
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 16, 412 ],
next:= [ 56202, 56193 ] ), 56199 ] ), rec(
fp:= [ 79486, 99435 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 414, 612 ],
next:= [ 56184, 56178 ] ), rec(
desc:= [ 107003 ],
fp:= [ 4, 212 ],
next:= [ 56187, 56196 ] ) ] ), rec(
fp:= [ 27006, 95627 ],
next:= [ 56190, 56181 ] ) ] ) ] ), rec(
fp:= [ 6547, 50040, 59410 ],
next:= [ rec(
fp:= [ 730, 5748, 22057, 24234, 26608, 29697, 33550, 39620, 46693,
54488, 55489, 55680, 57802, 59062, 60652, 64542, 70776, 71718, 72652, 88399,
91941, 97393, 98202, 98223 ],
level:= 4,
next:= [ rec(
fp:= [ 13121, 16308, 48403, 86135 ],
next:= [ 137172, 137184, 137167, 137179 ] ), 137213, rec(
fp:= [ 32853, 43477, 70610, 85718 ],
next:= [ 137168, 137183, 137180, 137171 ] ), 137162, rec(
fp:= [ 11617, 58708, 85827 ],
next:= [ 137177, 137174, 137186 ] ), 137190, rec(
fp:= [ 11676, 21770, 29485, 29616, 47352, 63092, 71652, 72714, 95634,
95910 ],
next:= [ 137165, 137195, 137193, 137164, 137191, 137192, 137196,
137163, 137166, 137194 ] ), rec(
fp:= [ 794, 15203, 19624 ],
next:= [ 137209, 137207, 137211 ] ), rec(
fp:= [ 9371, 18136, 55564 ],
next:= [ 137203, 137204, 137205 ] ), rec(
fp:= [ 25034, 50802, 79312 ],
next:= [ 137178, 137173, 137185 ] ), 137188, rec(
fp:= [ 33213, 42921, 89828, 96910 ],
next:= [ 137198, 137197, 137200, 137199 ] ), 137158, 137160, 137201,
137189, 137206, 137202, rec(
fp:= [ 34032, 43770, 74772, 92594 ],
next:= [ 137182, 137170, 137169, 137181 ] ), rec(
fp:= [ 8404, 55058, 96050 ],
next:= [ 137208, 137212, 137210 ] ), rec(
fp:= [ 32138, 47429, 96875 ],
next:= [ 137150, 137156, 137144 ] ), 137153, rec(
fp:= [ 3615, 31020, 83090 ],
next:= [ 137176, 137175, 137187 ] ), 137147 ] ), rec(
fp:= [ 4414, 17226, 19254, 25243, 44835, 53887 ],
level:= 4,
next:= [ 137157, rec(
fp:= [ 31790, 77214, 96559 ],
next:= [ 137149, 137155, 137143 ] ), 137159, 137152, 137146,
137161 ] ), rec(
fp:= [ 28392, 43161, 83740 ],
level:= 4,
next:= [ rec(
fp:= [ 32921, 75208, 93178 ],
next:= [ 137148, 137142, 137154 ] ), 137151, 137145 ] ) ] ), rec(
fp:= [ 1924, 21341, 61695 ],
next:= [ rec(
fp:= [ 33529, 49275, 53091 ],
level:= 4,
next:= [ rec(
fp:= [ 42323, 50411, 72124, 76311, 91215, 98569 ],
next:= [ 199547, 199556, 199568, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199538, 199562 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199565, 199550 ] ), 199544 ] ), 199559, rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 199553, 199541 ] ) ] ), rec(
fp:= [ 955, 5213, 6053, 10304, 27180, 28614, 33187, 43095, 50736,
60442, 71691, 77821, 85894 ],
level:= 4,
next:= [ rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 199623, 199624 ] ), rec(
fp:= [ 44003, 58259, 77604, 81834, 86136, 86558 ],
next:= [ 199549, 199558, 199570, rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199540, 199564 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199567, 199552 ] ), 199546 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 199619, 199621 ] ), rec(
fp:= [ 7507, 11429, 19556, 32284, 47121, 50759, 63362, 89984 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199686, 199572 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199647, 199636 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199626, 199616 ] ), rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199602, 199584 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199629, 199618 ] ), rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199599, 199587 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199644, 199634 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199683, 199575 ] ) ] ), rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 199555, 199543 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 199620, 199622 ] ), rec(
fp:= [ 15429, 15852, 21044, 21942, 45967, 52127, 79075, 84943 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 199648, 199635 ] ), rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199598, 199588 ] ), rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 199682, 199576 ] ), rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199603, 199583 ] ), rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 199687, 199571 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199643, 199633 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199625, 199615 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199630, 199617 ] ) ] ), rec(
fp:= [ 968, 8858, 28596, 61153, 77771, 95146 ],
next:= [ 199638, 199637, 199592, 199591, rec(
desc:= [ 108003 ],
fp:= [ 2, 12 ],
next:= [ 199580, 199579 ] ), rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199650, 199649 ] ) ] ), rec(
fp:= [ 46519, 53405, 71782, 71916, 74493, 77454 ],
next:= [ 199589, 199639, rec(
desc:= [ 107003 ],
fp:= [ 2, 12 ],
next:= [ 199582, 199577 ] ), 199641, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 199653, 199651 ] ), 199594 ] ), rec(
fp:= [ 610, 3660, 6281, 8517, 9844, 11873, 15485, 16952, 17208,
20864, 26001, 37109, 37251, 42622, 44272, 45483, 45723, 49567, 55465, 60209,
61806, 63189, 63369, 64776, 71295, 80319, 86987, 87028, 91745, 92627 ],
next:= [ rec(
desc:= [ 107003 ],
fp:= [ 13, 211 ],
next:= [ 199691, 199657 ] ), rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199671, 199605 ] ), 199612, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199694, 199595 ] ), 199680, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199670, 199606 ] ), 199677, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199669, 199607 ] ), rec(
desc:= [ 108003 ],
fp:= [ 13, 211 ],
next:= [ 199688, 199660 ] ), 199674, 199610, rec(
desc:= [ 107003 ],
fp:= [ 13, 211 ],
next:= [ 199690, 199658 ] ), 199679, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199672, 199604 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 199662, 199665 ] ), 199681, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199696, 199597 ] ), 199611, 199675, 199676, rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 199659, 199689 ] ), rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 199655, 199693 ] ), rec(
desc:= [ 106003 ],
fp:= [ 14, 212 ],
next:= [ 199656, 199692 ] ), 199678, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199695, 199596 ] ), rec(
desc:= [ 107003 ],
fp:= [ 14, 212 ],
next:= [ 199661, 199666 ] ), 199673, rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199667, 199609 ] ), rec(
desc:= [ 105003 ],
fp:= [ 2, 12 ],
next:= [ 199668, 199608 ] ), rec(
desc:= [ 108003 ],
fp:= [ 14, 212 ],
next:= [ 199663, 199664 ] ) ] ), rec(
fp:= [ 5149, 12028, 18805, 36220, 60000, 69285, 78858, 87716 ],
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199627, 199613 ] ), rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 199685, 199573 ] ), rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 199646, 199632 ] ), rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199601, 199585 ] ), rec(
desc:= [ 108003 ],
fp:= [ 15, 213 ],
next:= [ 199684, 199574 ] ), rec(
desc:= [ 107003 ],
fp:= [ 16, 214 ],
next:= [ 199645, 199631 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199628, 199614 ] ), rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199600, 199586 ] ) ] ), 199561, rec(
fp:= [ 12610, 52211, 55363, 72350, 81388, 82402 ],
next:= [ 199642, 199590, 199593, 199640, rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 199654, 199652 ] ), rec(
desc:= [ 106003 ],
fp:= [ 2, 12 ],
next:= [ 199581, 199578 ] ) ] ) ] ), rec(
fp:= [ 10653, 86644, 94749 ],
level:= 4,
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 17, 215 ],
next:= [ 199554, 199542 ] ), rec(
fp:= [ 12614, 27833, 45521, 60556, 64804, 77586 ],
next:= [ rec(
desc:= [ 105003 ],
fp:= [ 14, 212 ],
next:= [ 199539, 199563 ] ), rec(
desc:= [ 105003 ],
fp:= [ 13, 211 ],
next:= [ 199566, 199551 ] ), 199569, 199545, 199557, 199548 ] ),
199560 ] ) ] ) ] );
|
30,394
|
ada
| 0
|
usainzg/EHU
|
MP/LAB_001/Ver_Potencia.adb
|
<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Ver_Potencia is
-- entrada: 1 natural, Num (EE)
-- salida: 4 naturales y 1 natural, Pot (SE)
-- post: Los cuatro naturales corresponden a 4 de casos de prueba
-- potencias de 2, y Pot es 2 elevado a Num, 2**Num (Potencia de 2).
-- pre: { N >= 0 }
function Potencia (N:Natural) return Natural is
-- EJERCICIO 1- ESPECIFICA E IMPLEMENTA recursivamente el subprograma
-- Potencia que calcula la n-�sima potencia de 2.
begin
-- Completar
if N = 0 then
return 1;
end if;
if N > 0 then
return 2 * Potencia(N-1);
end if;
end Potencia;
Num: Natural;
-- post: { 2^N == Potencia(N) }
begin
---------- PRUEBAS EXPL�CITAS A PROBAR
Put_Line ("--------------------------------");
Put(" CASO1: 2^0= "); put(2**0, 0); put(", y con tu programa es --> "); Put (Potencia(0), 0); Put_Line(".");
New_Line;New_Line;
Put_Line ("--------------------------------");
Put(" CASO2: 2^1= "); put(2**1, 0); put(", y con tu programa es --> "); Put (Potencia(1), 0); Put_Line(".");
New_Line;New_Line;
Put_Line ("--------------------------------");
Put(" CASO3: 2^5= "); put(2**5, 0); put(", y con tu programa es --> "); Put (Potencia(5), 0); Put_Line(".");
New_Line;New_Line;
Put_Line ("--------------------------------");
Put(" CASO4: 2^15= "); put(2**15, 0); put(", y con tu programa es --> "); Put (Potencia(15), 0); put_line(".");
New_Line;New_Line;
Put_Line ("--------------------------------");
Put_Line ("--------------------------------");
Put(" CASO5: Elige el exponente: ");
Get (Num);
Put(" 2^");put(Num,0);put("= ");put(2**Num,0);put(", y con tu programa es --> ");
Put(Potencia(Num), 0);
end Ver_Potencia;
|
30,395
|
ada
| 4
|
ytomino/yaml-ada
|
examples/test_yaml.adb
|
with Ada.Command_Line;
with Ada.Directories;
with Ada.Environment_Variables;
with Ada.Streams.Stream_IO;
with Ada.Text_IO;
with YAML.Streams;
procedure test_yaml is
Verbose : Boolean := False;
procedure Put (Item : in String) is
begin
if Verbose then
Ada.Text_IO.Put (Item);
end if;
end Put;
procedure New_Line is
begin
if Verbose then
Ada.Text_IO.New_Line;
end if;
end New_Line;
function "=" (Left, Right : YAML.Event) return Boolean is
use YAML;
begin
if Left.Event_Type /= Right.Event_Type then
return False;
else
case Left.Event_Type is
when Stream_Start =>
return Left.Encoding = Right.Encoding;
when Document_Start | Document_End =>
if Left.Implicit_Indicator /= Right.Implicit_Indicator then
return False;
end if;
case Left.Event_Type is
when Document_Start =>
if Left.Version_Directive = null then
if Right.Version_Directive /= null then
return False;
end if;
elsif Right.Version_Directive = null then
return False;
elsif Left.Version_Directive.all /= Right.Version_Directive.all then
return False;
end if;
if Left.Tag_Directives = null then
return Right.Tag_Directives = null;
elsif Right.Tag_Directives = null then
return False;
else
raise Program_Error; -- unimplemented
end if;
when others =>
return True;
end case;
when Alias | Scalar | Sequence_Start | Mapping_Start =>
if Left.Anchor = null then
if Right.Anchor /= null then
return False;
end if;
elsif Right.Anchor = null then
return False;
elsif Left.Anchor.all /= Right.Anchor.all then
return False;
end if;
case Left.Event_Type is
when Scalar | Sequence_Start | Mapping_Start =>
if Left.Tag = null then
if Right.Tag /= null then
return False;
end if;
elsif Right.Tag = null then
return False;
elsif Left.Tag.all /= Right.Tag.all then
return False;
end if;
case Left.Event_Type is
when Scalar =>
if Left.Value.all /= Right.Value.all then
return False;
end if;
return Left.Plain_Implicit_Tag = Right.Plain_Implicit_Tag
and then Left.Quoted_Implicit_Tag = Right.Quoted_Implicit_Tag
and then Left.Scalar_Style = Right.Scalar_Style;
when Sequence_Start | Mapping_Start =>
if Left.Implicit_Tag /= Right.Implicit_Tag then
return False;
end if;
case Left.Event_Type is
when Sequence_Start =>
return Left.Sequence_Style = Right.Sequence_Style;
when Mapping_Start =>
return Left.Mapping_Style = Right.Mapping_Style;
when others =>
return True;
end case;
when others =>
return True;
end case;
when others =>
return True;
end case;
when No_Event | Stream_End | Sequence_End | Mapping_End =>
return True;
end case;
end if;
end "=";
Test_File_Name : constant String :=
Ada.Directories.Compose (
Ada.Environment_Variables.Value ("TMPDIR", Default => "/tmp"),
"test_yaml.yaml");
type Event_Constant is access constant YAML.Event;
The_Tag_1 : aliased constant String := "!TEST";
The_Value_1 : aliased constant String := "Hello";
The_Value_2 : aliased constant String := "YAML";
Data : constant array (Positive range <>) of not null Event_Constant := (
new YAML.Event'(
Event_Type => YAML.Stream_Start,
Encoding => YAML.UTF_8),
new YAML.Event'(
Event_Type => YAML.Document_Start,
Implicit_Indicator => False,
Version_Directive => null,
Tag_Directives => null),
new YAML.Event'(
Event_Type => YAML.Mapping_Start,
Anchor => null,
Tag => The_Tag_1'Unchecked_Access,
Implicit_Tag => False,
Mapping_Style => YAML.Block),
new YAML.Event'(
Event_Type => YAML.Scalar,
Anchor => null,
Tag => null,
Value => The_Value_1'Unchecked_Access,
Plain_Implicit_Tag => True,
Quoted_Implicit_Tag => False,
Scalar_Style => YAML.Plain),
new YAML.Event'(
Event_Type => YAML.Scalar,
Anchor => null,
Tag => null,
Value => The_Value_2'Unchecked_Access,
Plain_Implicit_Tag => True,
Quoted_Implicit_Tag => False,
Scalar_Style => YAML.Plain),
new YAML.Event'(
Event_Type => YAML.Mapping_End),
new YAML.Event'(
Event_Type => YAML.Document_End,
Implicit_Indicator => True),
new YAML.Event'(
Event_Type => YAML.Stream_End));
begin
-- options
for I in 1 .. Ada.Command_Line.Argument_Count loop
declare
A : constant String := Ada.Command_Line.Argument (I);
begin
if A = "--verbose" then
Verbose := True;
else
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error.all, "unknown option: " & A);
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
end;
end loop;
-- emitter
declare
W : YAML.Emitter := YAML.Create (Put'Access);
begin
for I in Data'Range loop
YAML.Put (W, Data (I).all);
end loop;
YAML.Flush (W);
end;
declare
File : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Create (File, Name => Test_File_Name);
declare
W : YAML.Emitter :=
YAML.Streams.Create (Ada.Streams.Stream_IO.Stream (File));
begin
Put ("Writing...");
for I in Data'Range loop
Put (I'Img);
YAML.Put (W, Data (I).all);
end loop;
YAML.Flush (W);
Put (" ok");
New_Line;
end;
Ada.Streams.Stream_IO.Close (File);
end;
-- parser
declare
File : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Open (File, Ada.Streams.Stream_IO.In_File,
Name => Test_File_Name);
declare
R : YAML.Parser :=
YAML.Streams.Create (Ada.Streams.Stream_IO.Stream (File));
begin
Put ("Reading...");
for I in Data'Range loop
Put (I'Img);
declare
procedure Process (
Event : in YAML.Event;
Start_Mark, End_Mark : in YAML.Mark)
is
pragma Unreferenced (Start_Mark);
pragma Unreferenced (End_Mark);
begin
if Event /= Data (I).all then
raise Program_Error;
end if;
end Process;
begin
YAML.Get (R, Process'Access);
end;
end loop;
Put (" ok");
New_Line;
end;
Ada.Streams.Stream_IO.Close (File);
end;
-- finish
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error.all, "ok");
end test_yaml;
|
30,396
|
ada
| 0
|
AntonMeep/endianness
|
src/endianness.ads
|
<gh_stars>0
with Ada.Streams; use Ada.Streams;
package Endianness with
Pure,
Preelaborate,
SPARK_Mode => On
is
-- @summary
-- Convenience subprograms to convert between Big- and Little-endianness
--
-- @description
-- This package contains a few convenient subprograms that allow you to
-- simply switch between native endianness of the running system and big
-- or little endianness. Ada's byte order handling is quite sophisticated
-- and it doesn't provide such routines at all. Hopefully, there is a
-- GNAT.Byte_Swapping available in GNAT, but it only allows for simple
-- swapping of bytes.
-- This package is built on top of GNAT.Byte_Swapping, but provides much
-- simpler programming interface.
--
-- This package provides generic function interfaces, but mostly you would
-- be better off utilizing already instantiated Endiannes.Standard and
-- Endianness.Interfaces packages which initialize all of the provided
-- functions for compatible types from Standard and Interfaces packages,
-- respectively.
generic
type Source is (<>);
-- Input source type
function Swap_Endian (Value : Source) return Source with
Global => null,
Pre => Source'Size = 8 or else Source'Size = 16 or else Source'Size = 32
or else Source'Size = 64;
-- Convert from one endianness to another.
generic
type Source is (<>);
-- Input source types
function Native_To_Big_Endian
(Value : Source) return Stream_Element_Array with
Global => null,
Pre => Source'Size = 8 or else Source'Size = 16 or else Source'Size = 32
or else Source'Size = 64,
Post => Native_To_Big_Endian'Result'Length =
Source'Max_Size_In_Storage_Elements;
-- Convert Value from native endianness into an array of bytes, ordered
-- as in big endian.
generic
type Source is (<>);
function Native_To_Little_Endian
(Value : Source) return Stream_Element_Array with
Global => null,
Pre => Source'Size = 8 or else Source'Size = 16 or else Source'Size = 32
or else Source'Size = 64,
Post => Native_To_Little_Endian'Result'Length =
Source'Max_Size_In_Storage_Elements;
-- Convert Value from native endianness into an array of bytes, ordered
-- as in little endian.
generic
type Target is (<>);
function Big_Endian_To_Native
(Value : Stream_Element_Array) return Target with
Global => null,
Pre =>
(Target'Size = 8 or else Target'Size = 16 or else Target'Size = 32
or else Target'Size = 64)
and then Value'Length = Target'Max_Size_In_Storage_Elements;
-- Convert Value from an array of bytes into a native value, order
-- of input bytes is assumed to be in big endian
generic
type Target is (<>);
function Little_Endian_To_Native
(Value : Stream_Element_Array) return Target with
Global => null,
Pre =>
(Target'Size = 8 or else Target'Size = 16 or else Target'Size = 32
or else Target'Size = 64)
and then Value'Length = Target'Max_Size_In_Storage_Elements;
-- Convert Value from an array of bytes into a native value, order
-- of input bytes is assumed to be in little endian
end Endianness;
|
30,397
|
ada
| 0
|
sonneveld/adazmq
|
src/zmq_thin.ads
|
<reponame>sonneveld/adazmq
with Interfaces.C;
with Interfaces.C.Strings;
with System;
package ZMQ_Thin is
-- Version
procedure zmq_version (major : access Interfaces.C.int; minor : access Interfaces.C.int; patch : access Interfaces.C.int);
pragma Import (C, zmq_version, "zmq_version");
-- Errors
function zmq_errno return Interfaces.C.int;
pragma Import (C, zmq_errno, "zmq_errno");
function zmq_strerror (errnum : Interfaces.C.int) return Interfaces.C.Strings.chars_ptr;
pragma Import (C, zmq_strerror, "zmq_strerror");
-- Contexts
function zmq_ctx_new return System.Address;
pragma Import (C, zmq_ctx_new, "zmq_ctx_new");
function zmq_ctx_term (context : System.Address) return Interfaces.C.int;
pragma Import (C, zmq_ctx_term, "zmq_ctx_term");
function zmq_ctx_shutdown (ctx_u : System.Address) return Interfaces.C.int;
pragma Import (C, zmq_ctx_shutdown, "zmq_ctx_shutdown");
function zmq_ctx_set (context : System.Address; option : Interfaces.C.int; optval : Interfaces.C.int) return Interfaces.C.int;
pragma Import (C, zmq_ctx_set, "zmq_ctx_set");
function zmq_ctx_get (context : System.Address; option : Interfaces.C.int) return Interfaces.C.int;
pragma Import (C, zmq_ctx_get, "zmq_ctx_get");
-- Message
type zmq_msg_t_u_u_array is array (1 .. 64) of Interfaces.C.unsigned_char;
type zmq_msg_t is record
u_u : zmq_msg_t_u_u_array := (others => 0);
end record;
for zmq_msg_t'Alignment use 8;
pragma Convention (C_Pass_By_Copy, zmq_msg_t);
function zmq_msg_init (msg : access zmq_msg_t) return Interfaces.C.int;
pragma Import (C, zmq_msg_init, "zmq_msg_init");
function zmq_msg_init_size (msg : access zmq_msg_t; size : Interfaces.C.size_t) return Interfaces.C.int;
pragma Import (C, zmq_msg_init_size, "zmq_msg_init_size");
function zmq_msg_send (msg : access zmq_msg_t; s : System.Address; flags : Interfaces.C.unsigned) return Interfaces.C.int;
pragma Import (C, zmq_msg_send, "zmq_msg_send");
function zmq_msg_recv (msg : access zmq_msg_t; s : System.Address; flags : Interfaces.C.unsigned) return Interfaces.C.int;
pragma Import (C, zmq_msg_recv, "zmq_msg_recv");
function zmq_msg_close (msg : access zmq_msg_t) return Interfaces.C.int;
pragma Import (C, zmq_msg_close, "zmq_msg_close");
function zmq_msg_move (dest : access zmq_msg_t; src : access zmq_msg_t) return Interfaces.C.int;
pragma Import (C, zmq_msg_move, "zmq_msg_move");
function zmq_msg_copy (dest : access zmq_msg_t; src : access zmq_msg_t) return Interfaces.C.int;
pragma Import (C, zmq_msg_copy, "zmq_msg_copy");
function zmq_msg_data (msg : access zmq_msg_t) return System.Address;
pragma Import (C, zmq_msg_data, "zmq_msg_data");
function zmq_msg_size (msg : access zmq_msg_t) return Interfaces.C.size_t;
pragma Import (C, zmq_msg_size, "zmq_msg_size");
function zmq_msg_more (msg : access zmq_msg_t) return Interfaces.C.int;
pragma Import (C, zmq_msg_more, "zmq_msg_more");
function zmq_msg_get (msg : access zmq_msg_t; option : Interfaces.C.int) return Interfaces.C.int;
pragma Import (C, zmq_msg_get, "zmq_msg_get");
function zmq_msg_set (msg : access zmq_msg_t; option : Interfaces.C.int; optval : Interfaces.C.int) return Interfaces.C.int;
pragma Import (C, zmq_msg_set, "zmq_msg_set");
-- Sockets
function zmq_socket (cxt : System.Address; s_type : Interfaces.C.int) return System.Address;
pragma Import (C, zmq_socket, "zmq_socket");
function zmq_close (s : System.Address) return Interfaces.C.int;
pragma Import (C, zmq_close, "zmq_close");
function zmq_setsockopt (s : System.Address; option : Interfaces.C.int; optval : System.Address; optvallen : Interfaces.C.size_t) return Interfaces.C.int;
pragma Import (C, zmq_setsockopt, "zmq_setsockopt");
function zmq_getsockopt (s : System.Address; option : Interfaces.C.int; optval : System.Address; optvallen : access Interfaces.C.size_t) return Interfaces.C.int;
pragma Import (C, zmq_getsockopt, "zmq_getsockopt");
function zmq_bind (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return Interfaces.C.int;
pragma Import (C, zmq_bind, "zmq_bind");
function zmq_connect (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return Interfaces.C.int;
pragma Import (C, zmq_connect, "zmq_connect");
function zmq_unbind (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return Interfaces.C.int;
pragma Import (C, zmq_unbind, "zmq_unbind");
function zmq_disconnect (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return Interfaces.C.int;
pragma Import (C, zmq_disconnect, "zmq_disconnect");
function zmq_send (s : System.Address; buf : System.Address; len : Interfaces.C.size_t; flags : Interfaces.C.unsigned) return Interfaces.C.int;
pragma Import (C, zmq_send, "zmq_send");
function zmq_recv (s : System.Address; buf : System.Address; len : Interfaces.C.size_t; flags : Interfaces.C.unsigned) return Interfaces.C.int;
pragma Import (C, zmq_recv, "zmq_recv");
-- Polling
type zmq_pollitem_t is record
socket : System.Address := System.Null_Address;
fd : Interfaces.C.int := 0;
events : Interfaces.C.short := 0;
revents : aliased Interfaces.C.short := 0;
end record;
pragma Convention (C_Pass_By_Copy, zmq_pollitem_t);
function zmq_poll (items : access zmq_pollitem_t; nitems : Interfaces.C.int; timeout : Interfaces.C.long) return Interfaces.C.int;
pragma Import (C, zmq_poll, "zmq_poll");
-- Proxy
function zmq_proxy (frontend : System.Address; backend : System.Address; capture : System.Address) return Interfaces.C.int;
pragma Import (C, zmq_proxy, "zmq_proxy");
function zmq_proxy_steerable (frontend : System.Address; backend : System.Address; capture : System.Address; control : System.Address) return Interfaces.C.int;
pragma Import (C, zmq_proxy_steerable, "zmq_proxy_steerable");
end ZMQ_Thin;
|
30,398
|
ada
| 1
|
ForYouEyesOnly/Space-Convoy
|
Sources/Swarm/swarm_control.ads
|
<filename>Sources/Swarm/swarm_control.ads
--
-- Jan & <NAME>, Australia, 2013
--
with Ada.Task_Identification; use Ada.Task_Identification;
with Barrier_Type; use Barrier_Type;
with Real_Type; use Real_Type;
with Swarm_Configuration; use Swarm_Configuration;
with Swarm_Structures; use Swarm_Structures;
with Swarm_Structures_Base; use Swarm_Structures_Base;
with Vectors_3D; use Vectors_3D;
package Swarm_Control is
pragma Elaborate_Body;
protected Swarm_Monitor is
function Id_Task return Swarm_Element_Index;
function Id_Task (Id : Task_Id) return Swarm_Element_Index;
function Position (Id : Task_Id) return Protected_Point_3D.Monitor_Ptr;
function Velocity (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr;
function Acceleration (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr;
function Controls (Id : Task_Id) return Vehicle_Controls_P;
function Comms (Id : Task_Id) return Vehicle_Comms_P;
function Charge (Id : Task_Id) return Charge_Info;
function Process_abort return Barrier_Ptr;
procedure Append_Random_Swarm (No_Of_Swarm_Elements : Positive := Initial_No_of_Elements;
Centre : Positions := Initial_Swarm_Position;
Volume_Edge_Length : Real := Initual_Edge_Length);
procedure Remove_Vehicle (Element_Ix : Swarm_Element_Index);
function Centre_Of_Gravity return Vector_3D;
function Mean_Velocity return Vector_3D;
function Mean_Velocity return Real;
function Maximal_Radius return Real;
function Mean_Radius return Real;
function Mean_Closest_Distance return Real;
private
Last_Vehicle_Id : Natural := 0;
end Swarm_Monitor;
Vehicle_could_not_be_created,
Task_did_not_repond_to_Identfiy_Call,
No_Such_Task : exception;
procedure Remove_Vehicles (No_Of_Swarm_Elements : Positive := 1);
procedure Set_Acceleration (Element_Index : Swarm_Element_Index);
procedure Set_All_Accelerations;
procedure Forward_Messages (Element_Index : Swarm_Element_Index);
procedure Forward_All_Messages;
procedure Move_Element (Element_Index : Swarm_Element_Index);
procedure Move_All_Elements;
procedure Update_Rotation (Element_Index : Swarm_Element_Index);
procedure Update_All_Rotations;
procedure Remove_Empties;
end Swarm_Control;
|
30,399
|
ada
| 192
|
rocher/Ada_Drivers_Library
|
arch/ARM/STM32/driver_demos/demo_timer_interrupts_basic/src/demo.adb
|
<gh_stars>100-1000
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Basic demo for timer interrupts. On each interrupt the green LED will blink
-- on the Discovery board. Interrupts occur at one second intervals so the LED
-- will be on for a second, off for a second, and so on, indefinitely.
with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
with STM32.Device; use STM32.Device;
with STM32.Board; use STM32.Board;
with STM32.Timers; use STM32.Timers;
with Ada.Real_Time; use Ada.Real_Time;
with STM32F4_Timer_Interrupts; pragma Unreferenced (STM32F4_Timer_Interrupts);
procedure Demo is
begin
Initialize_LEDs;
-- just to signal that we are indeed running...
for K in 1 .. 3 loop
All_LEDs_On;
delay until Clock + Milliseconds (200);
All_LEDs_Off;
delay until Clock + Milliseconds (200);
end loop;
Enable_Clock (Timer_7);
Reset (Timer_7);
Configure (Timer_7, Prescaler => 13999, Period => 5999);
Enable_Interrupt (Timer_7, Timer_Update_Interrupt);
Enable (Timer_7);
loop
null;
end loop;
end Demo;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.