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,800
|
ada
| 0
|
djamal2727/Main-Bearing-Analytical-Model
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tpobmu.adb
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . P R O T E C T E D _ O B J E C T S . --
-- M U L T I P R O C E S S O R S --
-- B o d y --
-- --
-- Copyright (C) 2010-2020, AdaCore --
-- --
-- GNARL 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. GNARL 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
package body System.Tasking.Protected_Objects.Multiprocessors is
------------
-- Served --
------------
procedure Served (Entry_Call : Entry_Call_Link) is
pragma Unreferenced (Entry_Call);
begin
pragma Assert (False, "Invalid operation");
end Served;
-------------------------
-- Wakeup_Served_Entry --
-------------------------
procedure Wakeup_Served_Entry is
begin
pragma Assert (False, "Invalid operation");
end Wakeup_Served_Entry;
end System.Tasking.Protected_Objects.Multiprocessors;
|
30,801
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c5/c52103q.ada
|
-- C52103Q.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT LENGTHS MUST MATCH IN ARRAY AND SLICE ASSIGNMENTS.
-- MORE SPECIFICALLY, TEST THAT ARRAY ASSIGNMENTS WITH MATCHING
-- LENGTHS DO NOT CAUSE CONSTRAINT_ERROR TO BE RAISED AND
-- ARE PERFORMED CORRECTLY.
-- (OVERLAPS BETWEEN THE OPERANDS OF THE ASSIGNMENT STATEMENT
-- ARE TREATED ELSWEWHERE.)
-- THIS IS THE SECOND FILE IN
-- DIVISION D : NULL LENGTHS NOT DETERMINABLE STATICALLY.
-- RM 07/20/81
-- SPS 2/18/83
WITH REPORT;
PROCEDURE C52103Q IS
USE REPORT ;
BEGIN
TEST( "C52103Q" , "CHECK THAT IN ARRAY ASSIGNMENTS AND IN SLICE" &
" ASSIGNMENTS THE LENGTHS MUST MATCH" );
-- ( EACH DIVISION COMPRISES 3 FILES,
-- COVERING RESPECTIVELY THE FIRST
-- 3 , NEXT 2 , AND LAST 3 OF THE 8
-- SELECTIONS FOR THE DIVISION.)
-------------------------------------------------------------------
-- (5) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
--
DECLARE
TYPE TA51 IS ARRAY(
INTEGER RANGE IDENT_INT(11)..IDENT_INT(10)
) OF CHARACTER ;
ARR51 : TA51 ;
BEGIN
-- ARRAY ASSIGNMENT (WITH STRING AGGREGATE):
ARR51 := "" ;
-- CHECKING THE VALUES AFTER THE ASSIGNMENT:
IF ARR51 /= ""
THEN
FAILED( "ARRAY ASSIGNMENT NOT CORRECT (5)" );
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "EXCEPTION RAISED - SUBTEST 5" );
END ;
-------------------------------------------------------------------
-- (14) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
-- WERE DEFINED USING THE "BOX" SYMBOL
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
DECLARE
TYPE TABOX4 IS ARRAY( INTEGER RANGE <> ) OF CHARACTER ;
SUBTYPE TABOX42 IS TABOX4( IDENT_INT(11)..IDENT_INT(15) );
ARRX42 : TABOX42 ;
BEGIN
-- INITIALIZATION OF LHS ARRAY:
ARRX42 := "QUINC" ;
-- NULL SLICE ASSIGNMENT:
ARRX42( IDENT_INT(13)..IDENT_INT(12) ) := "" ;
-- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
IF ARRX42 /= "QUINC" OR
ARRX42( IDENT_INT(11)..IDENT_INT(15) ) /= "QUINC"
THEN
FAILED( "SLICE ASSIGNMENT NOT CORRECT (14)" );
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "EXCEPTION RAISED - SUBTEST 14" );
END ;
-------------------------------------------------------------------
RESULT ;
END C52103Q;
|
30,802
|
ada
| 0
|
sonneveld/adazmq
|
examples/src/wuproxy.adb
|
-- Weather proxy device
with Ada.Command_Line;
with Ada.Text_IO;
with GNAT.Formatted_String;
with Ada.Calendar;
with ZMQ;
procedure WUPRoxy is
use type Ada.Calendar.Time;
use type GNAT.Formatted_String.Formatted_String;
function Main return Ada.Command_Line.Exit_Status
is
begin
declare
Context : ZMQ.Context_Type := ZMQ.New_Context;
-- This is where the weather server sits
Frontend : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_XSUB);
-- This is our public endpoint for subscribers
Backend : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_XPUB);
begin
Frontend.Connect ("tcp://192.168.55.210:5556");
Backend.Bind ("tcp://10.1.1.0:8100");
-- Run the proxy until the user interrupts us
ZMQ.Proxy (Frontend, Backend);
-- We never get here...
Backend.Close;
Frontend.Close;
Context.Term;
end;
return 0;
end Main;
begin
Ada.Command_Line.Set_Exit_Status (Main);
end WUPRoxy;
|
30,803
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/ada/s-vxwext.ads
|
<filename>gcc-gcc-7_3_0-release/gcc/ada/s-vxwext.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . V X W O R K S . E X T --
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2014, Free Software Foundation, Inc. --
-- --
-- GNARL 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/>. --
-- --
------------------------------------------------------------------------------
-- This package provides vxworks specific support functions needed
-- by System.OS_Interface.
-- This is the VxWorks 5 and VxWorks MILS version of this package
with Interfaces.C;
package System.VxWorks.Ext is
pragma Preelaborate;
subtype SEM_ID is Long_Integer;
-- typedef struct semaphore *SEM_ID;
type sigset_t is mod 2 ** Interfaces.C.long'Size;
type t_id is new Long_Integer;
subtype int is Interfaces.C.int;
subtype unsigned is Interfaces.C.unsigned;
type Interrupt_Handler is access procedure (parameter : System.Address);
pragma Convention (C, Interrupt_Handler);
type Interrupt_Vector is new System.Address;
function Int_Lock return int;
pragma Import (C, Int_Lock, "intLock");
function Int_Unlock (Old : int) return int;
pragma Import (C, Int_Unlock, "intUnlock");
function Interrupt_Connect
(Vector : Interrupt_Vector;
Handler : Interrupt_Handler;
Parameter : System.Address := System.Null_Address) return int;
pragma Import (C, Interrupt_Connect, "intConnect");
function Interrupt_Context return int;
pragma Import (C, Interrupt_Context, "intContext");
function Interrupt_Number_To_Vector
(intNum : int) return Interrupt_Vector;
pragma Import (C, Interrupt_Number_To_Vector, "__gnat_inum_to_ivec");
function semDelete (Sem : SEM_ID) return int;
pragma Import (C, semDelete, "semDelete");
function Task_Cont (tid : t_id) return int;
pragma Import (C, Task_Cont, "taskResume");
function Task_Stop (tid : t_id) return int;
pragma Import (C, Task_Stop, "taskSuspend");
function kill (pid : t_id; sig : int) return int;
pragma Import (C, kill, "kill");
function getpid return t_id;
pragma Import (C, getpid, "taskIdSelf");
function Set_Time_Slice (ticks : int) return int;
pragma Import (C, Set_Time_Slice, "kernelTimeSlice");
--------------------------------
-- Processor Affinity for SMP --
--------------------------------
function taskCpuAffinitySet (tid : t_id; CPU : int) return int;
pragma Convention (C, taskCpuAffinitySet);
-- For SMP run-times set the CPU affinity.
-- For uniprocessor systems return ERROR status.
function taskMaskAffinitySet (tid : t_id; CPU_Set : unsigned) return int;
pragma Convention (C, taskMaskAffinitySet);
-- For SMP run-times set the CPU mask affinity.
-- For uniprocessor systems return ERROR status.
end System.VxWorks.Ext;
|
30,804
|
ada
| 1
|
io7m/coreland-opengl-ada
|
opengl-state.ads
|
<reponame>io7m/coreland-opengl-ada
package OpenGL.State is
type Capability_t is
(Alpha_Test,
Auto_Normal,
Blend,
Color_Array,
Color_Logic_Op,
Color_Material,
Color_Sum,
Color_Table,
Convolution_1D,
Convolution_2D,
Cull_Face,
Depth_Test,
Dither,
Edge_Flag_Array,
Fog,
Fog_Coord_Array,
Histogram,
Index_Array,
Index_Logic_Op,
Lighting,
Line_Smooth,
Line_Stipple,
Map1_Color_4,
Map1_Index,
Map1_Normal,
Map1_Texture_Coord_1,
Map1_Texture_Coord_2,
Map1_Texture_Coord_3,
Map1_Texture_Coord_4,
Map2_Color_4,
Map2_Index,
Map2_Normal,
Map2_Texture_Coord_1,
Map2_Texture_Coord_2,
Map2_Texture_Coord_3,
Map2_Texture_Coord_4,
Map2_Vertex_3,
Map2_Vertex_4,
Minmax,
Multisample,
Normal_Array,
Normalize,
Point_Smooth,
Point_Sprite,
Polygon_Smooth,
Polygon_Offset_Fill,
Polygon_Offset_Line,
Polygon_Offset_Point,
Polygon_Stipple,
Post_Color_Matrix_Color_Table,
Post_Convolution_Color_Table,
Rescale_Normal,
Sample_Alpha_To_Coverage,
Sample_Alpha_To_One,
Sample_Coverage,
Scissor_Test,
Secondary_Color_Array,
Separable_2D,
Stencil_Test,
Texture_1D,
Texture_2D,
Texture_3D,
Texture_Coord_Array,
Texture_Cube_Map,
Texture_Gen_Q,
Texture_Gen_R,
Texture_Gen_S,
Texture_Gen_T,
Texture_Rectangle_ARB,
Vertex_Array,
Vertex_Program_Point_Size,
Vertex_Program_Two_Side);
-- proc_map : glEnable
procedure Enable (Capability : in Capability_t);
pragma Inline (Enable);
-- proc_map : glDisable
procedure Disable (Capability : in Capability_t);
pragma Inline (Disable);
-- proc_map : glIsEnabled
function Is_Enabled (Capability : in Capability_t) return Boolean;
pragma Inline (Is_Enabled);
--
-- Client state.
--
type Client_Capability_t is
(Color_Array,
Edge_Flag_Array,
Fog_Coord_Array,
Index_Array,
Normal_Array,
Secondary_Color_Array,
Texture_Coord_Array,
Vertex_Array);
-- proc_map : glEnableClientState
procedure Enable_Client_State (Capability : in Client_Capability_t);
pragma Inline (Enable_Client_State);
-- proc_map : glDisableClientState
procedure Disable_Client_State (Capability : in Client_Capability_t);
pragma Inline (Disable_Client_State);
end OpenGL.State;
|
30,805
|
ada
| 4
|
MOUDDENEHamza/ENSEEIHT
|
1A/S5/PIM/tps/pr2/ensembles_chainage.adb
|
-- Implantation du module Ensembles.
with Ada.Unchecked_Deallocation;
package body Ensembles_Chainage is
-- Libérer la mémoire alloué auparavant.
procedure Free is
new Ada.Unchecked_Deallocation (T_Cellule, T_Ensemble);
procedure Initialiser (Ensemble : out T_Ensemble) is
begin
Ensemble := Null;
end Initialiser;
procedure Detruire (Ensemble : in out T_Ensemble) is
begin
if (Ensemble /= Null) then
Detruire (Ensemble.all.Suivant);
Free (Ensemble);
else
null;
end if;
end Detruire;
function Est_Vide (Ensemble : in T_Ensemble) return Boolean is
begin
return Ensemble = Null;
end Est_Vide;
function Taille (Ensemble : in T_Ensemble) return Integer is
begin
if (Ensemble = Null) then
return 0;
else
return 1 + Taille (Ensemble.all.suivant);
end if;
end Taille;
function Est_Present (Ensemble : in T_Ensemble; Element : in T_Element) return Boolean is
present : Boolean;
Temp : T_Ensemble;
begin
present := False;
Temp := Ensemble;
while (Temp /= Null) loop
if (Temp.all.Element = Element) then
present := True;
end if;
Temp := Temp.all.Suivant;
end loop;
return present;
end Est_Present;
procedure Ajouter (Ensemble : in out T_Ensemble; Element : in T_Element) is
Nouvelle_Cellule, Temp : T_Ensemble;
begin
Nouvelle_Cellule := New T_Cellule'(Element, Null);
if ( Ensemble = Null) then -- Si l'ensemble est vide.
Ensemble := Nouvelle_Cellule; --Créer une nouvelle cellule.
else -- Sinon, on ajoute à la fin de l'ensemble.
Temp := Ensemble;
while (Temp.all.Suivant /= Null) loop
Temp := Temp.all.Suivant;
end loop;
Temp.all.Suivant := Nouvelle_Cellule; --Créer une nouvelle cellule.;
end if;
end Ajouter;
procedure Supprimer (Ensemble : in out T_Ensemble; Element : in T_Element) is
Temp : T_Ensemble;
begin
if (Ensemble.all.Element = Element) then
Temp := Ensemble.all.Suivant;
Free (Ensemble);
Ensemble := Temp;
else
Supprimer (Ensemble.all.Suivant, Element);
end if;
end Supprimer;
procedure Appliquer_Sur_Tous (Ensemble : in T_Ensemble) is
Temp : T_Ensemble;
begin
Temp := Ensemble;
while (Temp /= NULL) loop
Operation (Temp.all.Element);
Temp := Temp.all.Suivant;
end loop;
end Appliquer_Sur_Tous;
end Ensembles_Chainage;
|
30,806
|
ada
| 20
|
charlie5/lace
|
3-mid/opengl/private/freetype/source/freetype-face_size.ads
|
with
freeType_C.FT_Face,
freeType_C.FT_Size;
package freetype.face_Size
--
-- The face_Size class provides an abstraction layer for the Freetype Size type.
--
is
type Item is tagged private;
type View is access all Item'Class;
---------
--- Forge
--
procedure destruct (Self : in out Item) is null;
--------------
--- Attributes
--
function CharSize (Self : access Item; Face : in freeType_C.FT_Face.item;
point_Size : in Natural;
x_Resolution,
y_Resolution : in Natural) return Boolean;
--
-- Sets the char size for the current face.
--
-- This doesn't guarantee that the size was set correctly. Clients should call 'check Error' for
-- more information if this function returns false. If an error does occur the size object isn't modified.
--
-- Face: Parent face for this size object.
-- point_Size: The face size in points (1/72 inch).
-- x_Resolution: The horizontal resolution of the target device.
-- y_Resolution: The vertical resolution of the target device.
--
-- Returns true if the size has been set.
function CharSize (Self : in Item) return Natural; -- Returns the char size in points.
--
-- Get the char size for the current face.
function Ascender (Self : in Item) return Float; -- Returns the Ascender height.
--
-- Gets the global ascender height for the face in pixels.
function Descender (Self : in Item) return Float; -- Returns the Descender height.
--
-- Gets the global descender height for the face in pixels.
function Height (Self : in Item) return Float; -- Returns the height in pixels.
--
-- Gets the global face height for the face.
--
-- If the face is scalable this returns the height of the global
-- bounding box which ensures that any glyph will be less than or
-- equal to this height. If the font isn't scalable there is no
-- guarantee that glyphs will not be taller than this value.
function Width (Self : in Item) return Float; -- Returns the width in pixels.
--
-- Gets the global face width for the face.
--
-- If the face is scalable this returns the width of the global
-- bounding box which ensures that any glyph will be less than or
-- equal to this width. If the font isn't scalable this value is
-- the max_advance for the face.
function Underline (Self : in Item) return Float; -- Returns the underline position in pixels.
--
-- Gets the underline position for the face.
function Error (Self : in Item) return freeType_C.FT_Error; -- Returns the current error code.
--
-- Queries for errors.
private
type Item is tagged
record
ftFace : freeType_C.FT_Face.item; -- The current Freetype face that this FTSize object relates to.
ftSize : freeType_C.FT_Size.item; -- The freetype Size.
Size : Natural := 0; -- The size in points.
xResolution, -- The horizontal resolution.
yResolution : Natural := 0; -- The vertical resolution.
Err : freeType_C.FT_Error := 0; -- Current error code. Zero means no error.
end record;
end freetype.face_Size;
|
30,807
|
ada
| 0
|
djamal2727/Main-Bearing-Analytical-Model
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-lists.adb
|
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-lists.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . L I S T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2018-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. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body GNAT.Lists is
package body Doubly_Linked_Lists is
procedure Delete_Node
(L : Doubly_Linked_List;
Nod : Node_Ptr);
pragma Inline (Delete_Node);
-- Detach and delete node Nod from list L
procedure Ensure_Circular (Head : Node_Ptr);
pragma Inline (Ensure_Circular);
-- Ensure that dummy head Head is circular with respect to itself
procedure Ensure_Created (L : Doubly_Linked_List);
pragma Inline (Ensure_Created);
-- Verify that list L is created. Raise Not_Created if this is not the
-- case.
procedure Ensure_Full (L : Doubly_Linked_List);
pragma Inline (Ensure_Full);
-- Verify that list L contains at least one element. Raise List_Empty if
-- this is not the case.
procedure Ensure_Unlocked (L : Doubly_Linked_List);
pragma Inline (Ensure_Unlocked);
-- Verify that list L is unlocked. Raise Iterated if this is not the
-- case.
function Find_Node
(Head : Node_Ptr;
Elem : Element_Type) return Node_Ptr;
pragma Inline (Find_Node);
-- Travers a list indicated by dummy head Head to determine whethe there
-- exists a node with element Elem. If such a node exists, return it,
-- otherwise return null;
procedure Free is
new Ada.Unchecked_Deallocation
(Doubly_Linked_List_Attributes, Doubly_Linked_List);
procedure Free is new Ada.Unchecked_Deallocation (Node, Node_Ptr);
procedure Insert_Between
(L : Doubly_Linked_List;
Elem : Element_Type;
Left : Node_Ptr;
Right : Node_Ptr);
pragma Inline (Insert_Between);
-- Insert element Elem between nodes Left and Right of list L
function Is_Valid (Iter : Iterator) return Boolean;
pragma Inline (Is_Valid);
-- Determine whether iterator Iter refers to a valid element
function Is_Valid
(Nod : Node_Ptr;
Head : Node_Ptr) return Boolean;
pragma Inline (Is_Valid);
-- Determine whether node Nod is non-null and does not refer to dummy
-- head Head, thus making it valid.
procedure Lock (L : Doubly_Linked_List);
pragma Inline (Lock);
-- Lock all mutation functionality of list L
function Present (Nod : Node_Ptr) return Boolean;
pragma Inline (Present);
-- Determine whether node Nod exists
procedure Unlock (L : Doubly_Linked_List);
pragma Inline (Unlock);
-- Unlock all mutation functionality of list L
------------
-- Append --
------------
procedure Append
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
-- Ensure that the dummy head of an empty list is circular with
-- respect to itself.
Head := L.Nodes'Access;
Ensure_Circular (Head);
-- Append the node by inserting it between the last node and the
-- dummy head.
Insert_Between
(L => L,
Elem => Elem,
Left => Head.Prev,
Right => Head);
end Append;
------------
-- Create --
------------
function Create return Doubly_Linked_List is
begin
return new Doubly_Linked_List_Attributes;
end Create;
--------------
-- Contains --
--------------
function Contains
(L : Doubly_Linked_List;
Elem : Element_Type) return Boolean
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Elem);
return Is_Valid (Nod, Head);
end Contains;
------------
-- Delete --
------------
procedure Delete
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Elem);
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First (L : Doubly_Linked_List) is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Head.Next;
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (L : Doubly_Linked_List) is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Head.Prev;
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete_Last;
-----------------
-- Delete_Node --
-----------------
procedure Delete_Node
(L : Doubly_Linked_List;
Nod : Node_Ptr)
is
Ref : Node_Ptr := Nod;
pragma Assert (Present (Ref));
Next : constant Node_Ptr := Ref.Next;
Prev : constant Node_Ptr := Ref.Prev;
begin
pragma Assert (Present (L));
pragma Assert (Present (Next));
pragma Assert (Present (Prev));
Prev.Next := Next; -- Prev ---> Next
Next.Prev := Prev; -- Prev <--> Next
Ref.Next := null;
Ref.Prev := null;
L.Elements := L.Elements - 1;
-- Invoke the element destructor before deallocating the node
Destroy_Element (Nod.Elem);
Free (Ref);
end Delete_Node;
-------------
-- Destroy --
-------------
procedure Destroy (L : in out Doubly_Linked_List) is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
while Is_Valid (Head.Next, Head) loop
Delete_Node (L, Head.Next);
end loop;
Free (L);
end Destroy;
---------------------
-- Ensure_Circular --
---------------------
procedure Ensure_Circular (Head : Node_Ptr) is
pragma Assert (Present (Head));
begin
if not Present (Head.Next) and then not Present (Head.Prev) then
Head.Next := Head;
Head.Prev := Head;
end if;
end Ensure_Circular;
--------------------
-- Ensure_Created --
--------------------
procedure Ensure_Created (L : Doubly_Linked_List) is
begin
if not Present (L) then
raise Not_Created;
end if;
end Ensure_Created;
-----------------
-- Ensure_Full --
-----------------
procedure Ensure_Full (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
if L.Elements = 0 then
raise List_Empty;
end if;
end Ensure_Full;
---------------------
-- Ensure_Unlocked --
---------------------
procedure Ensure_Unlocked (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list has at least one outstanding iterator
if L.Iterators > 0 then
raise Iterated;
end if;
end Ensure_Unlocked;
-----------
-- Equal --
-----------
function Equal
(Left : Doubly_Linked_List;
Right : Doubly_Linked_List) return Boolean
is
Left_Head : Node_Ptr;
Left_Nod : Node_Ptr;
Right_Head : Node_Ptr;
Right_Nod : Node_Ptr;
begin
-- Two non-existent lists are considered equal
if Left = Nil and then Right = Nil then
return True;
-- A non-existent list is never equal to an already created list
elsif Left = Nil or else Right = Nil then
return False;
-- The two lists must contain the same number of elements to be equal
elsif Size (Left) /= Size (Right) then
return False;
end if;
-- Compare the two lists element by element
Left_Head := Left.Nodes'Access;
Left_Nod := Left_Head.Next;
Right_Head := Right.Nodes'Access;
Right_Nod := Right_Head.Next;
while Is_Valid (Left_Nod, Left_Head)
and then
Is_Valid (Right_Nod, Right_Head)
loop
if Left_Nod.Elem /= Right_Nod.Elem then
return False;
end if;
Left_Nod := Left_Nod.Next;
Right_Nod := Right_Nod.Next;
end loop;
return True;
end Equal;
---------------
-- Find_Node --
---------------
function Find_Node
(Head : Node_Ptr;
Elem : Element_Type) return Node_Ptr
is
pragma Assert (Present (Head));
Nod : Node_Ptr;
begin
-- Traverse the nodes of the list, looking for a matching element
Nod := Head.Next;
while Is_Valid (Nod, Head) loop
if Nod.Elem = Elem then
return Nod;
end if;
Nod := Nod.Next;
end loop;
return null;
end Find_Node;
-----------
-- First --
-----------
function First (L : Doubly_Linked_List) return Element_Type is
begin
Ensure_Created (L);
Ensure_Full (L);
return L.Nodes.Next.Elem;
end First;
--------------
-- Has_Next --
--------------
function Has_Next (Iter : Iterator) return Boolean is
Is_OK : constant Boolean := Is_Valid (Iter);
begin
-- The iterator is no longer valid which indicates that it has been
-- exhausted. Unlock all mutation functionality of the list because
-- the iterator cannot be advanced any further.
if not Is_OK then
Unlock (Iter.List);
end if;
return Is_OK;
end Has_Next;
------------------
-- Insert_After --
------------------
procedure Insert_After
(L : Doubly_Linked_List;
After : Element_Type;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, After);
if Is_Valid (Nod, Head) then
Insert_Between
(L => L,
Elem => Elem,
Left => Nod,
Right => Nod.Next);
end if;
end Insert_After;
-------------------
-- Insert_Before --
-------------------
procedure Insert_Before
(L : Doubly_Linked_List;
Before : Element_Type;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Before);
if Is_Valid (Nod, Head) then
Insert_Between
(L => L,
Elem => Elem,
Left => Nod.Prev,
Right => Nod);
end if;
end Insert_Before;
--------------------
-- Insert_Between --
--------------------
procedure Insert_Between
(L : Doubly_Linked_List;
Elem : Element_Type;
Left : Node_Ptr;
Right : Node_Ptr)
is
pragma Assert (Present (L));
pragma Assert (Present (Left));
pragma Assert (Present (Right));
Nod : constant Node_Ptr :=
new Node'(Elem => Elem,
Next => Right, -- Left Nod ---> Right
Prev => Left); -- Left <--- Nod ---> Right
begin
Left.Next := Nod; -- Left <--> Nod ---> Right
Right.Prev := Nod; -- Left <--> Nod <--> Right
L.Elements := L.Elements + 1;
end Insert_Between;
--------------
-- Is_Empty --
--------------
function Is_Empty (L : Doubly_Linked_List) return Boolean is
begin
Ensure_Created (L);
return L.Elements = 0;
end Is_Empty;
--------------
-- Is_Valid --
--------------
function Is_Valid (Iter : Iterator) return Boolean is
begin
-- The invariant of Iterate and Next ensures that the iterator always
-- refers to a valid node if there exists one.
return Is_Valid (Iter.Curr_Nod, Iter.List.Nodes'Access);
end Is_Valid;
--------------
-- Is_Valid --
--------------
function Is_Valid
(Nod : Node_Ptr;
Head : Node_Ptr) return Boolean
is
begin
-- A node is valid if it is non-null, and does not refer to the dummy
-- head of some list.
return Present (Nod) and then Nod /= Head;
end Is_Valid;
-------------
-- Iterate --
-------------
function Iterate (L : Doubly_Linked_List) return Iterator is
begin
Ensure_Created (L);
-- Lock all mutation functionality of the list while it is being
-- iterated on.
Lock (L);
return (List => L, Curr_Nod => L.Nodes.Next);
end Iterate;
----------
-- Last --
----------
function Last (L : Doubly_Linked_List) return Element_Type is
begin
Ensure_Created (L);
Ensure_Full (L);
return L.Nodes.Prev.Elem;
end Last;
----------
-- Lock --
----------
procedure Lock (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list may be locked multiple times if multiple iterators are
-- operating over it.
L.Iterators := L.Iterators + 1;
end Lock;
----------
-- Next --
----------
procedure Next
(Iter : in out Iterator;
Elem : out Element_Type)
is
Is_OK : constant Boolean := Is_Valid (Iter);
Saved : constant Node_Ptr := Iter.Curr_Nod;
begin
-- The iterator is no linger valid which indicates that it has been
-- exhausted. Unlock all mutation functionality of the list as the
-- iterator cannot be advanced any further.
if not Is_OK then
Unlock (Iter.List);
raise Iterator_Exhausted;
end if;
-- Advance to the next node along the list
Iter.Curr_Nod := Iter.Curr_Nod.Next;
Elem := Saved.Elem;
end Next;
-------------
-- Prepend --
-------------
procedure Prepend
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
-- Ensure that the dummy head of an empty list is circular with
-- respect to itself.
Head := L.Nodes'Access;
Ensure_Circular (Head);
-- Append the node by inserting it between the dummy head and the
-- first node.
Insert_Between
(L => L,
Elem => Elem,
Left => Head,
Right => Head.Next);
end Prepend;
-------------
-- Present --
-------------
function Present (L : Doubly_Linked_List) return Boolean is
begin
return L /= Nil;
end Present;
-------------
-- Present --
-------------
function Present (Nod : Node_Ptr) return Boolean is
begin
return Nod /= null;
end Present;
-------------
-- Replace --
-------------
procedure Replace
(L : Doubly_Linked_List;
Old_Elem : Element_Type;
New_Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Old_Elem);
if Is_Valid (Nod, Head) then
Nod.Elem := New_Elem;
end if;
end Replace;
----------
-- Size --
----------
function Size (L : Doubly_Linked_List) return Natural is
begin
Ensure_Created (L);
return L.Elements;
end Size;
------------
-- Unlock --
------------
procedure Unlock (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list may be locked multiple times if multiple iterators are
-- operating over it.
L.Iterators := L.Iterators - 1;
end Unlock;
end Doubly_Linked_Lists;
end GNAT.Lists;
|
30,808
|
ada
| 0
|
MorganPeterson/avi-editor
|
src/utilities_package.adb
|
<reponame>MorganPeterson/avi-editor<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;
with Editor_Package; use Editor_Package;
package body Utilities_Package is
function Read_File (Name : Unbounded_String; V : View) return Boolean is
Input : File_Type;
BFFR : Character;
begin
Open (File => Input, Mode => In_File, Name => To_String (Name));
loop
BFFR := Character'Input (Stream (Input));
Put (BFFR);
exit when End_Of_File;
end loop;
Close (Input);
return True;
exception
when End_Error =>
if Is_Open (Input) then
Close (Input);
end if;
return False;
when Name_Error =>
Put_Line ("No such file");
return False;
end Read_File;
end Utilities_Package;
|
30,809
|
ada
| 33
|
ytomino/drake
|
source/machine-w64-mingw32/x86_64/seh/s-unbase.adb
|
<filename>source/machine-w64-mingw32/x86_64/seh/s-unbase.adb
-- for Win64 SEH
pragma Check_Policy (Trace => Ignore);
with System.Address_To_Constant_Access_Conversions;
with System.Storage_Elements;
with C.basetsd;
with C.winnt;
separate (System.Unwind.Backtrace)
package body Separated is
pragma Suppress (All_Checks);
use type Storage_Elements.Storage_Offset;
use type C.basetsd.DWORD64;
use type C.winnt.PRUNTIME_FUNCTION;
package DWORD64_const_ptr_Conv is
new Address_To_Constant_Access_Conversions (
C.basetsd.DWORD64,
C.basetsd.DWORD64_const_ptr);
procedure memset (
b : not null access C.winnt.UNWIND_HISTORY_TABLE;
c : Integer;
n : Storage_Elements.Storage_Count)
with Import,
Convention => Intrinsic, External_Name => "__builtin_memset";
procedure memset (
b : not null access C.winnt.KNONVOLATILE_CONTEXT_POINTERS;
c : Integer;
n : Storage_Elements.Storage_Count)
with Import,
Convention => Intrinsic, External_Name => "__builtin_memset";
-- implementation
procedure Backtrace (
Item : aliased out Tracebacks_Array;
Last : out Natural;
Exclude_Min : Address;
Exclude_Max : Address)
is
context : aliased C.winnt.CONTEXT;
history : aliased C.winnt.UNWIND_HISTORY_TABLE := (
Count => <>,
Search => <>,
LowAddress => <>,
HighAddress => <>,
F_Entry => (others => <>));
begin
pragma Check (Trace, Ada.Debug.Put ("start"));
-- Get the context.
C.winnt.RtlCaptureContext (context'Access);
-- Setup unwind history table (a cached to speed-up unwinding).
memset (
history'Access,
0,
C.winnt.UNWIND_HISTORY_TABLE'Size / Standard'Storage_Unit);
Last := Tracebacks_Array'First - 1;
loop
declare
RuntimeFunction : C.winnt.PRUNTIME_FUNCTION;
NvContext : aliased C.winnt.KNONVOLATILE_CONTEXT_POINTERS := (
FloatingContext => (others => <>),
IntegerContext => (others => <>));
ImageBase : aliased C.basetsd.ULONG64;
HandlerData : aliased C.winnt.PVOID;
EstablisherFrame : aliased C.basetsd.ULONG64;
begin
-- Get function metadata.
RuntimeFunction := C.winnt.RtlLookupFunctionEntry (
context.Rip,
ImageBase'Access,
history'Access);
if RuntimeFunction = null then
-- In case of failure, assume this is a leaf function.
context.Rip :=
DWORD64_const_ptr_Conv.To_Pointer (
System'To_Address (context.Rsp))
.all;
context.Rsp := context.Rsp + 8;
else
-- Unwind.
memset (
NvContext'Access,
0,
C.winnt.KNONVOLATILE_CONTEXT_POINTERS'Size
/ Standard'Storage_Unit);
declare
Dummy : C.winnt.PEXCEPTION_ROUTINE;
begin
Dummy := C.winnt.RtlVirtualUnwind (
0,
ImageBase,
context.Rip,
RuntimeFunction,
context'Access,
HandlerData'Access,
EstablisherFrame'Access,
NvContext'Access);
end;
end if;
-- 0 means bottom of the stack.
exit when System'To_Address (context.Rip) = Null_Address;
if System'To_Address (context.Rip) >= Exclude_Min
and then System'To_Address (context.Rip) <= Exclude_Max
then
Last := Tracebacks_Array'First - 1; -- reset
pragma Check (Trace, Ada.Debug.Put ("exclude"));
else
Last := Last + 1;
Item (Last) :=
System'To_Address (context.Rip)
- Storage_Elements.Storage_Offset'(2);
pragma Check (Trace, Ada.Debug.Put ("fill"));
exit when Last >= Tracebacks_Array'Last;
end if;
end;
end loop;
pragma Check (Trace, Ada.Debug.Put ("end"));
end Backtrace;
end Separated;
|
30,810
|
ada
| 1
|
leo-brewin/adm-bssn-numerical
|
adm/code/src/admbase-runge.ads
|
package ADMBase.Runge is
procedure set_time_step;
procedure set_time_step_min;
procedure rk_step
(ct : Real;
cw : Real;
params : SlaveParams);
procedure beg_runge_kutta
(params : SlaveParams);
procedure end_runge_kutta
(params : SlaveParams);
end ADMBase.Runge;
|
30,811
|
ada
| 0
|
strenkml/EE368
|
memsim-master/src/memory-dram.ads
|
package Memory.DRAM is
type DRAM_Type is new Memory_Type with private;
type DRAM_Pointer is access all DRAM_Type'Class;
function Create_DRAM(cas_cycles : Time_Type; -- CAS latency
rcd_cycles : Time_Type; -- RCD latency
rp_cycles : Time_Type; -- Precharge latency
wb_cycles : Time_Type; -- Write-back latency
multiplier : Time_Type; -- Clock multiplier
word_size : Positive; -- Word size in bytes
page_size : Positive; -- Page size in bytes
page_count : Positive; -- Pages per bank
width : Positive; -- Channel width in bytes
burst_size : Positive; -- Burst size
open_page_mode : Boolean) -- Open or closed page
return DRAM_Pointer;
overriding
function Clone(mem : DRAM_Type) return Memory_Pointer;
overriding
procedure Reset(mem : in out DRAM_Type;
context : in Natural);
overriding
procedure Read(mem : in out DRAM_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Write(mem : in out DRAM_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Idle(mem : in out DRAM_Type;
cycles : in Time_Type);
overriding
function To_String(mem : DRAM_Type) return Unbounded_String;
overriding
function Get_Cost(mem : DRAM_Type) return Cost_Type;
overriding
function Get_Writes(mem : DRAM_Type) return Long_Integer;
overriding
function Get_Word_Size(mem : DRAM_Type) return Positive;
overriding
function Get_Ports(mem : DRAM_Type) return Port_Vector_Type;
overriding
procedure Generate(mem : in DRAM_Type;
sigs : in out Unbounded_String;
code : in out Unbounded_String);
private
type Bank_Type is record
page : Address_Type := Address_Type'Last;
dirty : Boolean := False;
pending : Time_Type := 0;
end record;
package Bank_Vectors is new Vectors(Natural, Bank_Type);
type DRAM_Type is new Memory_Type with record
banks : Bank_Vectors.Vector;
bank_size : Positive;
cas_cycles : Time_Type;
rcd_cycles : Time_Type;
rp_cycles : Time_Type;
wb_cycles : Time_Type;
access_cycles : Time_Type;
multiplier : Time_Type;
word_size : Positive;
page_size : Positive;
page_count : Positive;
width : Positive;
burst_size : Positive;
open_page_mode : Boolean;
writes : Long_Integer := 0;
end record;
end Memory.DRAM;
|
30,812
|
ada
| 33
|
ytomino/drake
|
source/numerics/a-ngrear.adb
|
with Ada.Numerics.Generic_Arrays;
package body Ada.Numerics.Generic_Real_Arrays is
package Elementary_Functions is
subtype Float_Type is Real;
function Sqrt (X : Float_Type'Base) return Float_Type'Base;
end Elementary_Functions;
package body Elementary_Functions is
function Sqrt (X : Float_Type'Base) return Float_Type'Base is
begin
if not Standard'Fast_Math and then not (X >= 0.0) then
raise Argument_Error; -- RM A.5.1(22), CXA5A10
end if;
if Float_Type'Digits <= Float'Digits then
declare
function sqrtf (A1 : Float) return Float
with Import,
Convention => Intrinsic,
External_Name => "__builtin_sqrtf";
begin
return Float_Type'Base (sqrtf (Float (X)));
end;
elsif Float_Type'Digits <= Long_Float'Digits then
declare
function sqrt (A1 : Long_Float) return Long_Float
with Import,
Convention => Intrinsic,
External_Name => "__builtin_sqrt";
begin
return Float_Type'Base (sqrt (Long_Float (X)));
end;
else
declare
function sqrtl (x : Long_Long_Float) return Long_Long_Float
with Import,
Convention => Intrinsic,
External_Name => "__builtin_sqrtl";
begin
return Float_Type'Base (sqrtl (Long_Long_Float (X)));
end;
end if;
end Sqrt;
end Elementary_Functions;
function Minor is new Generic_Arrays.Minor (Real'Base, Real_Matrix);
-- for Inverse and Determinant
-- implementation
function "+" (Right : Real_Vector) return Real_Vector is
begin
return Right;
end "+";
function "-" (Right : Real_Vector) return Real_Vector is
function neg_Body is
new Generic_Arrays.Operator_Vector (
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
"-");
pragma Inline_Always (neg_Body);
begin
return neg_Body (Right);
end "-";
function "abs" (Right : Real_Vector) return Real_Vector is
function abs_Body is
new Generic_Arrays.Operator_Vector (
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
"abs");
pragma Inline_Always (abs_Body);
begin
return abs_Body (Right);
end "abs";
function "+" (Left, Right : Real_Vector) return Real_Vector is
function add_Body is
new Generic_Arrays.Operator_Vector_Vector (
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
"+");
pragma Inline_Always (add_Body);
begin
return add_Body (Left, Right);
end "+";
function "-" (Left, Right : Real_Vector) return Real_Vector is
function sub_Body is
new Generic_Arrays.Operator_Vector_Vector (
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
"-");
pragma Inline_Always (sub_Body);
begin
return sub_Body (Left, Right);
end "-";
function "*" (Left, Right : Real_Vector) return Real'Base is
function mul_Body is
new Generic_Arrays.Inner_Production (
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
Real'Base,
Zero => 0.0);
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "abs" (Right : Real_Vector) return Real'Base is
function abs_Body is
new Generic_Arrays.Absolute (
Real'Base,
Real_Vector,
Real'Base,
Zero => 0.0,
Sqrt => Elementary_Functions.Sqrt);
pragma Inline_Always (abs_Body);
begin
return abs_Body (Right);
end "abs";
function "*" (Left : Real'Base; Right : Real_Vector) return Real_Vector is
begin
return Right * Left;
end "*";
function "*" (Left : Real_Vector; Right : Real'Base) return Real_Vector is
function mul_Body is
new Generic_Arrays.Operator_Vector_Param (
Real'Base,
Real_Vector,
Real'Base,
Real'Base,
Real_Vector,
"*");
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "/" (Left : Real_Vector; Right : Real'Base) return Real_Vector is
begin
return Left * (1.0 / Right);
end "/";
function Unit_Vector (
Index : Integer;
Order : Positive;
First : Integer := 1)
return Real_Vector
is
function Unit_Vector_Body is
new Generic_Arrays.Unit_Vector (
Real'Base,
Real_Vector,
Zero => 0.0,
One => 1.0);
pragma Inline_Always (Unit_Vector_Body);
begin
return Unit_Vector_Body (Index, Order, First);
end Unit_Vector;
function "+" (Right : Real_Matrix) return Real_Matrix is
begin
return Right;
end "+";
function "-" (Right : Real_Matrix) return Real_Matrix is
function neg_Body is
new Generic_Arrays.Operator_Matrix (
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
"-");
pragma Inline_Always (neg_Body);
begin
return neg_Body (Right);
end "-";
function "abs" (Right : Real_Matrix) return Real_Matrix is
function abs_Body is
new Generic_Arrays.Operator_Matrix (
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
"abs");
pragma Inline_Always (abs_Body);
begin
return abs_Body (Right);
end "abs";
function Transpose (X : Real_Matrix) return Real_Matrix is
function Transpose_Body is
new Generic_Arrays.Transpose (Real'Base, Real_Matrix);
pragma Inline_Always (Transpose_Body);
begin
return Transpose_Body (X);
end Transpose;
function "+" (Left, Right : Real_Matrix) return Real_Matrix is
function add_Body is
new Generic_Arrays.Operator_Matrix_Matrix (
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
"+");
pragma Inline_Always (add_Body);
begin
return add_Body (Left, Right);
end "+";
function "-" (Left, Right : Real_Matrix) return Real_Matrix is
function sub_Body is
new Generic_Arrays.Operator_Matrix_Matrix (
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
"-");
pragma Inline_Always (sub_Body);
begin
return sub_Body (Left, Right);
end "-";
function "*" (Left, Right : Real_Matrix) return Real_Matrix is
function mul_Body is
new Generic_Arrays.Multiply_Matrix_Matrix (
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
Real'Base,
Real_Matrix,
Zero => 0.0);
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "*" (Left, Right : Real_Vector) return Real_Matrix is
function mul_Body is
new Generic_Arrays.Multiply_Vector_Vector (
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
Real'Base,
Real_Matrix);
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "*" (Left : Real_Vector; Right : Real_Matrix) return Real_Vector is
function mul_Body is
new Generic_Arrays.Multiply_Vector_Matrix (
Real'Base,
Real_Vector,
Real'Base,
Real_Matrix,
Real'Base,
Real_Vector,
Zero => 0.0);
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "*" (Left : Real_Matrix; Right : Real_Vector) return Real_Vector is
function mul_Body is
new Generic_Arrays.Multiply_Matrix_Vector (
Real'Base,
Real_Matrix,
Real'Base,
Real_Vector,
Real'Base,
Real_Vector,
Zero => 0.0);
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "*" (Left : Real'Base; Right : Real_Matrix) return Real_Matrix is
begin
return Right * Left;
end "*";
function "*" (Left : Real_Matrix; Right : Real'Base) return Real_Matrix is
function mul_Body is
new Generic_Arrays.Operator_Matrix_Param (
Real'Base,
Real_Matrix,
Real'Base,
Real'Base,
Real_Matrix,
"*");
pragma Inline_Always (mul_Body);
begin
return mul_Body (Left, Right);
end "*";
function "/" (Left : Real_Matrix; Right : Real'Base) return Real_Matrix is
begin
return Left * (1.0 / Right);
end "/";
function Solve (A : Real_Matrix; X : Real_Vector) return Real_Vector is
begin
return Inverse (A) * X;
end Solve;
function Solve (A, X : Real_Matrix) return Real_Matrix is
begin
return Inverse (A) * X;
end Solve;
function Inverse (A : Real_Matrix) return Real_Matrix is
function Inverse_Body is
new Generic_Arrays.Inverse (
Real'Base,
Real_Matrix,
One => 1.0);
pragma Inline_Always (Inverse_Body);
begin
return Inverse_Body (A);
end Inverse;
function Determinant (A : Real_Matrix) return Real'Base is
function Determinant_Body is
new Generic_Arrays.Determinant (
Real'Base,
Real_Matrix,
Zero => 0.0,
One => 1.0);
-- no inline, Determinant uses recursive calling
begin
return Determinant_Body (A);
end Determinant;
function Eigenvalues (A : Real_Matrix) return Real_Vector is
Vectors : Real_Matrix (A'Range (1), A'Range (2));
begin
return Result : Real_Vector (A'Range (2)) do
Eigensystem (A, Result, Vectors);
end return;
end Eigenvalues;
procedure Eigensystem (
A : Real_Matrix;
Values : out Real_Vector;
Vectors : out Real_Matrix)
is
function Is_Minus (X : Real'Base) return Boolean;
function Is_Minus (X : Real'Base) return Boolean is
begin
return X < 0.0;
end Is_Minus;
function Is_Small (X : Real'Base) return Boolean;
function Is_Small (X : Real'Base) return Boolean is
begin
return abs X < 1.0e-32;
end Is_Small;
procedure Eigensystem_Body is
new Generic_Arrays.Eigensystem (
Real'Base,
Real_Vector,
Real'Base,
Real_Matrix,
Zero => 0.0,
One => 1.0,
Two => 2.0,
Sqrt => Elementary_Functions.Sqrt,
Is_Minus => Is_Minus,
Is_Small => Is_Small,
To_Real => "+");
pragma Inline_Always (Eigensystem_Body);
begin
Eigensystem_Body (A, Values, Vectors);
end Eigensystem;
function Unit_Matrix (Order : Positive; First_1, First_2 : Integer := 1)
return Real_Matrix
is
function Unit_Matrix_Body is
new Generic_Arrays.Unit_Matrix (
Real'Base,
Real_Matrix,
Zero => 0.0,
One => 1.0);
pragma Inline_Always (Unit_Matrix_Body);
begin
return Unit_Matrix_Body (Order, First_1, First_2);
end Unit_Matrix;
end Ada.Numerics.Generic_Real_Arrays;
|
30,813
|
ada
| 0
|
PThierry/ewok-kernel
|
src/arch/socs/stm32f439/soc-nvic.adb
|
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- 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 soc.nvic
with spark_mode => off
is
function to_irq_number
(intr : soc.interrupts.t_interrupt)
return t_irq_index
is
begin
return t_irq_index'val (soc.interrupts.t_interrupt'pos (intr) - 16);
end to_irq_number;
procedure enable_irq
(irq : in t_irq_index)
is
begin
case irq is
when 0 .. 31 => NVIC.ISER0.irq(irq) := IRQ_ENABLED;
when 32 .. 63 => NVIC.ISER1.irq(irq) := IRQ_ENABLED;
when 64 .. 80 => NVIC.ISER2.irq(irq) := IRQ_ENABLED;
end case;
end enable_irq;
procedure clear_pending_irq
(irq : in t_irq_index)
is
begin
case irq is
when 0 .. 31 => NVIC.ICPR0.irq(irq) := CLEAR_PENDING;
when 32 .. 63 => NVIC.ICPR1.irq(irq) := CLEAR_PENDING;
when 64 .. 80 => NVIC.ICPR2.irq(irq) := CLEAR_PENDING;
end case;
end clear_pending_irq;
end soc.nvic;
|
30,814
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/static_initializer.ads
|
-- { dg-do compile }
package static_initializer is
type Vector is array (1 .. 3) of Float;
type Arr is array (Integer range 1 .. 3) of Vector;
Pos : constant Arr := ((0.0, 1.0, 2.0),
(0.5, 1.5, 2.5),
(1.0, 2.0, 4.0));
end;
-- { dg-final { scan-assembler-not "elabs" } }
|
30,815
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41306b.ada
|
-- C41306B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT IF F IS A FUNCTION RETURNING AN ACCESS VALUE DESIGNATING
-- A TASK OF A TYPE HAVING
-- AN ENTRY E , AN ENTRY CALL OF THE FORM
--
-- F.ALL.E
--
-- IS PERMITTED.
-- RM 02/02/82
-- ABW 07/16/82
-- EG 05/28/85
WITH REPORT; USE REPORT;
PROCEDURE C41306B IS
BEGIN
TEST ( "C41306B" , "CHECK THAT IF F IS A FUNCTION RETURNING" &
" AN ACCESS VALUE DESIGNATING" &
" A TASK OF A TYPE HAVING AN ENTRY E , AN" &
" ENTRY CALL OF THE FORM F.ALL.E IS" &
" PERMITTED" );
-------------------------------------------------------------------
DECLARE
X : INTEGER := 0 ;
TASK TYPE T IS
ENTRY E ;
END T ;
TYPE A_T IS ACCESS T ;
TASK BODY T IS
BEGIN
ACCEPT E DO
X := IDENT_INT(17) ;
END E ;
END T ;
FUNCTION F1 RETURN A_T IS
A_T_VAR1 : A_T := NEW T ;
BEGIN
RETURN A_T_VAR1 ;
END F1 ;
FUNCTION F2 (A, B : BOOLEAN) RETURN A_T IS
A_T_VAR2 : A_T := NEW T;
BEGIN
IF A AND B THEN
NULL;
END IF;
RETURN A_T_VAR2;
END F2;
BEGIN
F1.ALL.E ; -- THE ELABOR. OF F1 (BODY) ACTIVATES THE TASK,
-- WHICH PROCEEDS TO WAIT FOR ENTRY E TO
-- BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE SET TO 17 .
IF X /= 17
THEN
FAILED( "WRONG VALUE FOR GLOBAL VARIABLE (1)" );
END IF;
X := 0;
F2(TRUE, TRUE).ALL.E; -- THE ELABORATION OF F2 (BODY)
-- ACTIVATES THE TASK, WHICH
-- PROCEEDS TO WAIT FOR THE
-- ENTRY E TO BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE
-- SET TO 17.
IF X /= 17 THEN
FAILED ("WRONG VALUE FOR GLOBAL VARIABLE (2)");
END IF;
END ;
-------------------------------------------------------------------
DECLARE
X : INTEGER := 0 ;
TASK TYPE T IS
ENTRY E ;
END T ;
TYPE A_T IS ACCESS T ;
TASK BODY T IS
BEGIN
ACCEPT E DO
X := IDENT_INT(17) ;
END E ;
END T ;
FUNCTION F3 RETURN A_T IS
BEGIN
RETURN NEW T ;
END F3;
FUNCTION F4 (C, D : BOOLEAN) RETURN A_T IS
BEGIN
IF C AND D THEN
NULL;
END IF;
RETURN NEW T;
END F4;
BEGIN
F3.ALL.E ; -- THE ELABOR. OF F3 (BODY) ACTIVATES THE TASK,
-- WHICH PROCEEDS TO WAIT FOR ENTRY E TO
-- BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE SET TO 17 .
IF X /= 17
THEN
FAILED( "WRONG VALUE FOR GLOBAL VARIABLE (3)" );
END IF;
X := 0;
F4(TRUE, TRUE).ALL.E; -- THE ELABORATION OF F4 (BODY)
-- ACTIVATES THE TASK, WHICH
-- PROCEEDS TO WAIT FOR THE
-- ENTRY E TO BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE
-- SET TO 17.
IF X /= 17 THEN
FAILED ("WRONG VALUE FOR GLOBAL VARIABLE (4)");
END IF;
END ;
-------------------------------------------------------------------
DECLARE
X : INTEGER := 0 ;
TASK TYPE T IS
ENTRY E ;
END T ;
TYPE A_T IS ACCESS T ;
TASK BODY T IS
BEGIN
ACCEPT E DO
X := IDENT_INT(17) ;
END E ;
END T ;
BEGIN
DECLARE
F3 : A_T := NEW T;
BEGIN
F3.ALL.E;
-- THE CALLED ENTRY CAUSES X TO BE SET TO 17 .
IF X /= 17 THEN
FAILED( "WRONG VALUE FOR GLOBAL VARIABLE (5)" );
END IF;
END;
END ;
-------------------------------------------------------------------
RESULT;
END C41306B;
|
30,816
|
ada
| 0
|
joffreyhuguet/LmcpGen
|
ada/src/afrl/cmasi/afrl-cmasi-location3d.adb
|
package body afrl.cmasi.location3D is
function getFullLmcpTypeName(this : Location3D) return String is ("afrl.cmasi.location3D.Location3D");
function getLmcpTypeName(this : Location3D) return String is ("Location3D");
function getLmcpType(this : Location3D) return UInt32_t is (CMASIEnum'Pos(LOCATION3D_ENUM));
function getLatitude (this : Location3D'Class) return Double_t is (this.Latitude);
procedure setLatitude(this : out Location3D'Class; Latitude : in Double_t) is
begin
this.Latitude := Latitude;
end setLatitude;
function getLongitude(this : Location3D'Class) return Double_t is (this.Longitude);
procedure setLongitude(this : out Location3D'Class; Longitude : in double_t) is
begin
this.Longitude := Longitude;
end setLongitude;
function getAltitude(this : Location3D'Class) return Float_t is (this.Altitude);
procedure setAltitude(this : out Location3D'Class; Altitude : in Float_t) is
begin
this.Altitude := Altitude;
end setAltitude;
function getAltitudeType(this : Location3D'Class) return AltitudeTypeEnum is (this.AltitudeType);
procedure setAltitudeType(this : out Location3D'Class; AltitudeType : in AltitudeTypeEnum) is
begin
this.AltitudeType := AltitudeType;
end setAltitudeType;
end afrl.cmasi.location3D;
|
30,817
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/trampoline2.adb
|
-- { dg-do run }
-- { dg-options "-gnatws" }
with System; use System;
procedure Trampoline2 is
A : Integer;
type FuncPtr is access function (I : Integer) return Integer;
function F (I : Integer) return Integer is
begin
return A + I;
end F;
P : FuncPtr := F'Access;
CA : System.Address := F'Code_Address;
I : Integer;
begin
if CA = System.Null_Address then
raise Program_Error;
end if;
I := P(0);
end;
|
30,818
|
ada
| 12
|
TUM-EI-RCS/StratoX
|
software/hal/hpl/STM32/svd/stm32f427x/stm32_svd-dcmi.ads
|
<gh_stars>10-100
-- This spec has been automatically generated from STM32F427x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
with HAL;
package STM32_SVD.DCMI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- CR_Register --
-----------------
subtype CR_FCRC_Field is HAL.UInt2;
subtype CR_EDM_Field is HAL.UInt2;
-- control register 1
type CR_Register is record
-- Capture enable
CAPTURE : Boolean := False;
-- Capture mode
CM : Boolean := False;
-- Crop feature
CROP : Boolean := False;
-- JPEG format
JPEG : Boolean := False;
-- Embedded synchronization select
ESS : Boolean := False;
-- Pixel clock polarity
PCKPOL : Boolean := False;
-- Horizontal synchronization polarity
HSPOL : Boolean := False;
-- Vertical synchronization polarity
VSPOL : Boolean := False;
-- Frame capture rate control
FCRC : CR_FCRC_Field := 16#0#;
-- Extended data mode
EDM : CR_EDM_Field := 16#0#;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- DCMI enable
ENABLE : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
CAPTURE at 0 range 0 .. 0;
CM at 0 range 1 .. 1;
CROP at 0 range 2 .. 2;
JPEG at 0 range 3 .. 3;
ESS at 0 range 4 .. 4;
PCKPOL at 0 range 5 .. 5;
HSPOL at 0 range 6 .. 6;
VSPOL at 0 range 7 .. 7;
FCRC at 0 range 8 .. 9;
EDM at 0 range 10 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
ENABLE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- status register
type SR_Register is record
-- Read-only. HSYNC
HSYNC : Boolean;
-- Read-only. VSYNC
VSYNC : Boolean;
-- Read-only. FIFO not empty
FNE : Boolean;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
HSYNC at 0 range 0 .. 0;
VSYNC at 0 range 1 .. 1;
FNE at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
------------------
-- RIS_Register --
------------------
-- raw interrupt status register
type RIS_Register is record
-- Read-only. Capture complete raw interrupt status
FRAME_RIS : Boolean;
-- Read-only. Overrun raw interrupt status
OVR_RIS : Boolean;
-- Read-only. Synchronization error raw interrupt status
ERR_RIS : Boolean;
-- Read-only. VSYNC raw interrupt status
VSYNC_RIS : Boolean;
-- Read-only. Line raw interrupt status
LINE_RIS : Boolean;
-- unspecified
Reserved_5_31 : HAL.UInt27;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RIS_Register use record
FRAME_RIS at 0 range 0 .. 0;
OVR_RIS at 0 range 1 .. 1;
ERR_RIS at 0 range 2 .. 2;
VSYNC_RIS at 0 range 3 .. 3;
LINE_RIS at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
------------------
-- IER_Register --
------------------
-- interrupt enable register
type IER_Register is record
-- Capture complete interrupt enable
FRAME_IE : Boolean := False;
-- Overrun interrupt enable
OVR_IE : Boolean := False;
-- Synchronization error interrupt enable
ERR_IE : Boolean := False;
-- VSYNC interrupt enable
VSYNC_IE : Boolean := False;
-- Line interrupt enable
LINE_IE : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
FRAME_IE at 0 range 0 .. 0;
OVR_IE at 0 range 1 .. 1;
ERR_IE at 0 range 2 .. 2;
VSYNC_IE at 0 range 3 .. 3;
LINE_IE at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
------------------
-- MIS_Register --
------------------
-- masked interrupt status register
type MIS_Register is record
-- Read-only. Capture complete masked interrupt status
FRAME_MIS : Boolean;
-- Read-only. Overrun masked interrupt status
OVR_MIS : Boolean;
-- Read-only. Synchronization error masked interrupt status
ERR_MIS : Boolean;
-- Read-only. VSYNC masked interrupt status
VSYNC_MIS : Boolean;
-- Read-only. Line masked interrupt status
LINE_MIS : Boolean;
-- unspecified
Reserved_5_31 : HAL.UInt27;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MIS_Register use record
FRAME_MIS at 0 range 0 .. 0;
OVR_MIS at 0 range 1 .. 1;
ERR_MIS at 0 range 2 .. 2;
VSYNC_MIS at 0 range 3 .. 3;
LINE_MIS at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
------------------
-- ICR_Register --
------------------
-- interrupt clear register
type ICR_Register is record
-- Write-only. Capture complete interrupt status clear
FRAME_ISC : Boolean := False;
-- Write-only. Overrun interrupt status clear
OVR_ISC : Boolean := False;
-- Write-only. Synchronization error interrupt status clear
ERR_ISC : Boolean := False;
-- Write-only. Vertical synch interrupt status clear
VSYNC_ISC : Boolean := False;
-- Write-only. line interrupt status clear
LINE_ISC : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
FRAME_ISC at 0 range 0 .. 0;
OVR_ISC at 0 range 1 .. 1;
ERR_ISC at 0 range 2 .. 2;
VSYNC_ISC at 0 range 3 .. 3;
LINE_ISC at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-------------------
-- ESCR_Register --
-------------------
subtype ESCR_FSC_Field is HAL.Byte;
subtype ESCR_LSC_Field is HAL.Byte;
subtype ESCR_LEC_Field is HAL.Byte;
subtype ESCR_FEC_Field is HAL.Byte;
-- embedded synchronization code register
type ESCR_Register is record
-- Frame start delimiter code
FSC : ESCR_FSC_Field := 16#0#;
-- Line start delimiter code
LSC : ESCR_LSC_Field := 16#0#;
-- Line end delimiter code
LEC : ESCR_LEC_Field := 16#0#;
-- Frame end delimiter code
FEC : ESCR_FEC_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ESCR_Register use record
FSC at 0 range 0 .. 7;
LSC at 0 range 8 .. 15;
LEC at 0 range 16 .. 23;
FEC at 0 range 24 .. 31;
end record;
-------------------
-- ESUR_Register --
-------------------
subtype ESUR_FSU_Field is HAL.Byte;
subtype ESUR_LSU_Field is HAL.Byte;
subtype ESUR_LEU_Field is HAL.Byte;
subtype ESUR_FEU_Field is HAL.Byte;
-- embedded synchronization unmask register
type ESUR_Register is record
-- Frame start delimiter unmask
FSU : ESUR_FSU_Field := 16#0#;
-- Line start delimiter unmask
LSU : ESUR_LSU_Field := 16#0#;
-- Line end delimiter unmask
LEU : ESUR_LEU_Field := 16#0#;
-- Frame end delimiter unmask
FEU : ESUR_FEU_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ESUR_Register use record
FSU at 0 range 0 .. 7;
LSU at 0 range 8 .. 15;
LEU at 0 range 16 .. 23;
FEU at 0 range 24 .. 31;
end record;
---------------------
-- CWSTRT_Register --
---------------------
subtype CWSTRT_HOFFCNT_Field is HAL.UInt14;
subtype CWSTRT_VST_Field is HAL.UInt13;
-- crop window start
type CWSTRT_Register is record
-- Horizontal offset count
HOFFCNT : CWSTRT_HOFFCNT_Field := 16#0#;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Vertical start line count
VST : CWSTRT_VST_Field := 16#0#;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CWSTRT_Register use record
HOFFCNT at 0 range 0 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
VST at 0 range 16 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
---------------------
-- CWSIZE_Register --
---------------------
subtype CWSIZE_CAPCNT_Field is HAL.UInt14;
subtype CWSIZE_VLINE_Field is HAL.UInt14;
-- crop window size
type CWSIZE_Register is record
-- Capture count
CAPCNT : CWSIZE_CAPCNT_Field := 16#0#;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Vertical line count
VLINE : CWSIZE_VLINE_Field := 16#0#;
-- unspecified
Reserved_30_31 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CWSIZE_Register use record
CAPCNT at 0 range 0 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
VLINE at 0 range 16 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-----------------
-- DR_Register --
-----------------
-- DR_Byte array element
subtype DR_Byte_Element is HAL.Byte;
-- DR_Byte array
type DR_Byte_Field_Array is array (0 .. 3) of DR_Byte_Element
with Component_Size => 8, Size => 32;
-- data register
type DR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- Byte as a value
Val : HAL.Word;
when True =>
-- Byte as an array
Arr : DR_Byte_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for DR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Digital camera interface
type DCMI_Peripheral is record
-- control register 1
CR : CR_Register;
-- status register
SR : SR_Register;
-- raw interrupt status register
RIS : RIS_Register;
-- interrupt enable register
IER : IER_Register;
-- masked interrupt status register
MIS : MIS_Register;
-- interrupt clear register
ICR : ICR_Register;
-- embedded synchronization code register
ESCR : ESCR_Register;
-- embedded synchronization unmask register
ESUR : ESUR_Register;
-- crop window start
CWSTRT : CWSTRT_Register;
-- crop window size
CWSIZE : CWSIZE_Register;
-- data register
DR : DR_Register;
end record
with Volatile;
for DCMI_Peripheral use record
CR at 0 range 0 .. 31;
SR at 4 range 0 .. 31;
RIS at 8 range 0 .. 31;
IER at 12 range 0 .. 31;
MIS at 16 range 0 .. 31;
ICR at 20 range 0 .. 31;
ESCR at 24 range 0 .. 31;
ESUR at 28 range 0 .. 31;
CWSTRT at 32 range 0 .. 31;
CWSIZE at 36 range 0 .. 31;
DR at 40 range 0 .. 31;
end record;
-- Digital camera interface
DCMI_Periph : aliased DCMI_Peripheral
with Import, Address => DCMI_Base;
end STM32_SVD.DCMI;
|
30,819
|
ada
| 0
|
DrenfongWong/tkm-rpc
|
specs/ada/common/tkmrpc-response-ike-isa_skip_create_first-convert.ads
|
<filename>specs/ada/common/tkmrpc-response-ike-isa_skip_create_first-convert.ads
with Ada.Unchecked_Conversion;
package Tkmrpc.Response.Ike.Isa_Skip_Create_First.Convert is
function To_Response is new Ada.Unchecked_Conversion (
Source => Isa_Skip_Create_First.Response_Type,
Target => Response.Data_Type);
function From_Response is new Ada.Unchecked_Conversion (
Source => Response.Data_Type,
Target => Isa_Skip_Create_First.Response_Type);
end Tkmrpc.Response.Ike.Isa_Skip_Create_First.Convert;
|
30,820
|
ada
| 33
|
ytomino/drake
|
source/numerics/a-nlrear.ads
|
pragma License (Unrestricted);
with Ada.Numerics.Generic_Real_Arrays;
package Ada.Numerics.Long_Real_Arrays is
new Generic_Real_Arrays (Long_Float);
pragma Pure (Ada.Numerics.Long_Real_Arrays);
|
30,821
|
ada
| 0
|
aeszter/sharepoint2ics
|
src/events.ads
|
<reponame>aeszter/sharepoint2ics<filename>src/events.ads<gh_stars>0
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Text_IO;
with Ada.Calendar;
with Ada.Strings;
with Ada.Strings.Unbounded;
with DOM.Core;
package Events is
type Event_Type is (None, Normal, Reserved, Deleted, Excepted);
type Interval is (daily, weekly, monthly, yearly);
type Month_Day is (first, second, third, fourth, last);
type Event is record
Created, Last_Modified,
Event_Date, End_Date : Ada.Calendar.Time;
Event_Duration : Duration;
Is_All_Day, Is_Recurrent : Boolean;
The_Type : Event_Type;
Summary, Description : Ada.Strings.Unbounded.Unbounded_String;
Location, Category : Ada.Strings.Unbounded.Unbounded_String;
UID, Recurrence_Data : Ada.Strings.Unbounded.Unbounded_String;
Master_ID : Ada.Strings.Unbounded.Unbounded_String;
Recurrence_ID : Ada.Calendar.Time;
end record;
function To_Event_Type (S : String) return Event_Type;
function To_String (I : Interval) return String;
function To_Month_Day (S : String) return Month_Day;
Unexpected_Node : exception;
package Lists is new Ada.Containers.Doubly_Linked_Lists
(Element_Type => Event);
List : Lists.List;
procedure Read (Data_Nodes : DOM.Core.Node_List);
procedure Write (To_File : Ada.Text_IO.File_Type);
end Events;
|
30,822
|
ada
| 8
|
qunying/AdaTutor
|
oa3/nextdate.ada
|
<gh_stars>1-10
with Text_IO; use Text_IO;
procedure Nextdate is
type Month_Type is
(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
subtype Day_Subtype is Integer range 1 .. 31;
type Date is
record
Day : Day_Subtype;
Month : Month_Type;
Year : Positive;
end record;
Passed : Boolean := True;
function Tomorrow(Today : in Date) return Date is separate;
procedure Display (S : in String; D : in Date) is
package Int_IO is new Integer_IO(Integer); use Int_IO;
begin
Put(S);
Put(D.Day, Width => 3);
Put(" " & Month_Type'Image(D.Month));
Put(D.Year, Width => 5);
New_Line;
end Display;
procedure Compare(Today, Right_Answer : in Date) is
My_Answer : Date := Tomorrow(Today);
begin
if My_Answer /= Right_Answer then
Display("Today: ", Today);
Display("My answer: ", My_Answer);
Display("Right answer:", Right_Answer);
New_Line;
Passed := False;
end if;
end Compare;
begin
Compare((12,Dec,1815), (13,Dec,1815)); -- ordinary date
Compare(( 3,Feb,1986), ( 4,Feb,1986)); -- ordinary date in Feb.
Compare((30,Jun,1981), ( 1,Jul,1981)); -- last day of 30-day month
Compare((30,Sep,3999), ( 1,Oct,3999)); -- last day of 30-day month
Compare((31,Mar,1876), ( 1,Apr,1876)); -- last day of 31-day month
Compare((31,Aug,1984), ( 1,Sep,1984)); -- last day of 31-day month
Compare((31,Dec,1966), ( 1,Jan,1967)); -- last day of year
Compare((28,Feb,1980), (29,Feb,1980)); -- leap year
Compare((28,Feb,1600), (29,Feb,1600)); -- century leap year
Compare((28,Feb,2200), ( 1,Mar,2200)); -- century non-leap year
Compare((28,Feb,1982), ( 1,Mar,1982)); -- non-leap year
Compare((29,Feb,1980), ( 1,Mar,1980)); -- leap day in leap year
if Passed then
Put_Line("Congratulations, you completed the assignment!");
end if;
end Nextdate;
|
30,823
|
ada
| 80
|
enfoTek/tomato.linksys.e2000.nvram-mod
|
tools-src/gnu/gcc/gcc/ada/7straceb.adb
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T R A C E B A C K --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1999-2000 Ada Core Technologies, 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. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This version assumes that System.Machine_State_Operations.Pop_Frame can
-- work with the Info parameter being null.
with System.Machine_State_Operations;
package body System.Traceback is
use System.Machine_State_Operations;
----------------
-- Call_Chain --
----------------
procedure Call_Chain
(Traceback : System.Address;
Max_Len : Natural;
Len : out Natural;
Exclude_Min,
Exclude_Max : System.Address := System.Null_Address)
is
type Tracebacks_Array is array (1 .. Max_Len) of Code_Loc;
pragma Suppress_Initialization (Tracebacks_Array);
M : Machine_State;
Code : Code_Loc;
J : Natural := 1;
Trace : Tracebacks_Array;
for Trace'Address use Traceback;
begin
M := Allocate_Machine_State;
Set_Machine_State (M);
loop
Code := Get_Code_Loc (M);
exit when Code = Null_Address or else J = Max_Len + 1;
if Code < Exclude_Min or else Code > Exclude_Max then
Trace (J) := Code;
J := J + 1;
end if;
Pop_Frame (M, System.Null_Address);
end loop;
Len := J - 1;
Free_Machine_State (M);
end Call_Chain;
------------------
-- C_Call_Chain --
------------------
function C_Call_Chain
(Traceback : System.Address;
Max_Len : Natural) return Natural
is
Val : Natural;
begin
Call_Chain (Traceback, Max_Len, Val);
return Val;
end C_Call_Chain;
end System.Traceback;
|
30,824
|
ada
| 24
|
svn2github/matreshka
|
source/amf/dd/amf-internals-tables-dd_constructors.adb
|
<reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, <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.DC;
with AMF.Internals.DG_Canvases;
with AMF.Internals.DG_Circles;
with AMF.Internals.DG_Clip_Paths;
with AMF.Internals.DG_Ellipses;
with AMF.Internals.DG_Groups;
with AMF.Internals.DG_Images;
with AMF.Internals.DG_Linear_Gradients;
with AMF.Internals.DG_Lines;
with AMF.Internals.DG_Marked_Elements;
with AMF.Internals.DG_Markers;
with AMF.Internals.DG_Paths;
with AMF.Internals.DG_Patterns;
with AMF.Internals.DG_Polygons;
with AMF.Internals.DG_Polylines;
with AMF.Internals.DG_Radial_Gradients;
with AMF.Internals.DG_Rectangles;
with AMF.Internals.DG_Styles;
with AMF.Internals.DG_Texts;
with AMF.Internals.Element_Collections;
with AMF.Internals.Tables.DD_Element_Table;
with AMF.Internals.Tables.DD_Types;
with AMF.Internals.Tables.DG_Metamodel;
with Matreshka.Internals.Strings;
package body AMF.Internals.Tables.DD_Constructors is
use AMF.Internals.Tables;
use type AMF.Internals.AMF_Collection_Of_Element;
----------------------
-- Create_DG_Canvas --
----------------------
function Create_DG_Canvas return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Canvas,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Canvases.DG_Canvas_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
5 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Color, (Is_Empty => True)),
-- backgroundColor
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- backgroundFill
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- member
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Group_Member_Graphical_Element_Group,
DD_Element_Table.Table (Self).Member (0).Collection + 3);
-- packagedFill
AMF.Internals.Element_Collections.Initialize_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Canvas_Packaged_Fill_Fill_Canvas,
DD_Element_Table.Table (Self).Member (0).Collection + 4);
-- packagedMarker
AMF.Internals.Element_Collections.Initialize_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Canvas_Packaged_Marker_Marker_Canvas,
DD_Element_Table.Table (Self).Member (0).Collection + 5);
-- packagedStyle
AMF.Internals.Element_Collections.Initialize_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Canvas_Packaged_Style_A_Canvas,
DD_Element_Table.Table (Self).Member (0).Collection + 6);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Canvas;
----------------------
-- Create_DG_Circle --
----------------------
function Create_DG_Circle return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Circle,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Circles.DG_Circle_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
5 => (AMF.Internals.Tables.DD_Types.M_Point, (others => <>)),
-- center
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
4 => (AMF.Internals.Tables.DD_Types.M_Real, 0.0),
-- radius
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Circle;
-------------------------
-- Create_DG_Clip_Path --
-------------------------
function Create_DG_Clip_Path return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Clip_Path,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Clip_Paths.DG_Clip_Path_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clippedElement
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- member
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Group_Member_Graphical_Element_Group,
DD_Element_Table.Table (Self).Member (0).Collection + 3);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Clip_Path;
-----------------------
-- Create_DG_Ellipse --
-----------------------
function Create_DG_Ellipse return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Ellipse,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Ellipses.DG_Ellipse_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
5 => (AMF.Internals.Tables.DD_Types.M_Point, (others => <>)),
-- center
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
4 => (AMF.Internals.Tables.DD_Types.M_Dimension, (others => <>)),
-- radii
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Ellipse;
---------------------
-- Create_DG_Group --
---------------------
function Create_DG_Group return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Group,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Groups.DG_Group_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- member
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Group_Member_Graphical_Element_Group,
DD_Element_Table.Table (Self).Member (0).Collection + 3);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Group;
---------------------
-- Create_DG_Image --
---------------------
function Create_DG_Image return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Image,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Images.DG_Image_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
4 => (AMF.Internals.Tables.DD_Types.M_Bounds, (others => <>)),
-- bounds
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Boolean, False),
-- isAspectRatioPreserved
5 => (AMF.Internals.Tables.DD_Types.M_String, Matreshka.Internals.Strings.Shared_Empty'Access),
-- source
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Image;
--------------------
-- Create_DG_Line --
--------------------
function Create_DG_Line return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Line,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Lines.DG_Line_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
8 => (AMF.Internals.Tables.DD_Types.M_Point, (others => <>)),
-- end
5 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- endMarker
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- midMarker
7 => (AMF.Internals.Tables.DD_Types.M_Point, (others => <>)),
-- start
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- startMarker
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Line;
-------------------------------
-- Create_DG_Linear_Gradient --
-------------------------------
function Create_DG_Linear_Gradient return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Linear_Gradient,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Linear_Gradients.DG_Linear_Gradient_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- canvas
3 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Gradient_Stop, 0),
-- stop
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
4 => (AMF.Internals.Tables.DD_Types.M_Real, 0.00000000000000E+00),
-- x1
5 => (AMF.Internals.Tables.DD_Types.M_Real, 1.00000000000000E+00),
-- x2
6 => (AMF.Internals.Tables.DD_Types.M_Real, 0.00000000000000E+00),
-- y1
7 => (AMF.Internals.Tables.DD_Types.M_Real, 1.00000000000000E+00),
-- y2
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
return Self;
end Create_DG_Linear_Gradient;
------------------------------
-- Create_DG_Marked_Element --
------------------------------
function Create_DG_Marked_Element return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Marked_Element,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Marked_Elements.DG_Marked_Element_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
5 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- endMarker
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- midMarker
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- startMarker
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Marked_Element;
----------------------
-- Create_DG_Marker --
----------------------
function Create_DG_Marker return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Marker,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Markers.DG_Marker_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- canvas
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Point, (others => <>)),
-- reference
5 => (AMF.Internals.Tables.DD_Types.M_Dimension, (others => <>)),
-- size
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- member
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Group_Member_Graphical_Element_Group,
DD_Element_Table.Table (Self).Member (0).Collection + 3);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Marker;
--------------------
-- Create_DG_Path --
--------------------
function Create_DG_Path return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Path,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Paths.DG_Path_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
7 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Path_Command, 0),
-- command
5 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- endMarker
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- midMarker
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- startMarker
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Path;
-----------------------
-- Create_DG_Pattern --
-----------------------
function Create_DG_Pattern return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Pattern,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Patterns.DG_Pattern_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
4 => (AMF.Internals.Tables.DD_Types.M_Bounds, (others => <>)),
-- bounds
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- canvas
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- tile
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
return Self;
end Create_DG_Pattern;
-----------------------
-- Create_DG_Polygon --
-----------------------
function Create_DG_Polygon return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Polygon,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Polygons.DG_Polygon_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
5 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- endMarker
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- midMarker
7 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Point, 0),
-- point
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- startMarker
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Polygon;
------------------------
-- Create_DG_Polyline --
------------------------
function Create_DG_Polyline return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Polyline,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Polylines.DG_Polyline_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
5 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- endMarker
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
6 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- midMarker
7 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Point, 0),
-- point
4 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- startMarker
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Polyline;
-------------------------------
-- Create_DG_Radial_Gradient --
-------------------------------
function Create_DG_Radial_Gradient return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Radial_Gradient,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Radial_Gradients.DG_Radial_Gradient_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- canvas
5 => (AMF.Internals.Tables.DD_Types.M_Real, 5.00000000000000E-01),
-- centerX
6 => (AMF.Internals.Tables.DD_Types.M_Real, 5.00000000000000E-01),
-- centerY
7 => (AMF.Internals.Tables.DD_Types.M_Real, 5.00000000000000E-01),
-- focusX
8 => (AMF.Internals.Tables.DD_Types.M_Real, 5.00000000000000E-01),
-- focusY
4 => (AMF.Internals.Tables.DD_Types.M_Real, 5.00000000000000E-01),
-- radius
3 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Gradient_Stop, 0),
-- stop
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
return Self;
end Create_DG_Radial_Gradient;
-------------------------
-- Create_DG_Rectangle --
-------------------------
function Create_DG_Rectangle return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Rectangle,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Rectangles.DG_Rectangle_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
4 => (AMF.Internals.Tables.DD_Types.M_Bounds, (others => <>)),
-- bounds
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
5 => (AMF.Internals.Tables.DD_Types.M_Real, 0.00000000000000E+00),
-- cornerRadius
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Rectangle;
---------------------
-- Create_DG_Style --
---------------------
function Create_DG_Style return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Style,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Styles.DG_Style_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
1 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- fill
2 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Color, (Is_Empty => True)),
-- fillColor
3 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Real, (Is_Empty => True)),
-- fillOpacity
12 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Boolean, (Is_Empty => True)),
-- fontBold
10 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Color, (Is_Empty => True)),
-- fontColor
11 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Boolean, (Is_Empty => True)),
-- fontItalic
9 => (AMF.Internals.Tables.DD_Types.M_String, null),
-- fontName
8 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Real, (Is_Empty => True)),
-- fontSize
14 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Boolean, (Is_Empty => True)),
-- fontStrikeThrough
13 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Boolean, (Is_Empty => True)),
-- fontUnderline
6 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Color, (Is_Empty => True)),
-- strokeColor
7 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Real, 0),
-- strokeDashLength
5 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Real, (Is_Empty => True)),
-- strokeOpacity
4 => (AMF.Internals.Tables.DD_Types.M_Holder_Of_Real, (Is_Empty => True)),
-- strokeWidth
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
return Self;
end Create_DG_Style;
--------------------
-- Create_DG_Text --
--------------------
function Create_DG_Text return AMF.Internals.AMF_Element is
Self : AMF.Internals.AMF_Element;
begin
DD_Element_Table.Increment_Last;
Self := DD_Element_Table.Last;
DD_Element_Table.Table (Self).all :=
(Kind => AMF.Internals.Tables.DD_Types.E_DG_Text,
Extent => 0,
Proxy =>
new AMF.Internals.DG_Texts.DG_Text_Proxy'(Element => Self),
Member =>
(0 => (Kind => AMF.Internals.Tables.DD_Types.M_None),
6 => (AMF.Internals.Tables.DD_Types.M_Alignment_Kind, AMF.DC.Align_Start),
-- alignment
4 => (AMF.Internals.Tables.DD_Types.M_Bounds, (others => <>)),
-- bounds
3 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- clipPath
5 => (AMF.Internals.Tables.DD_Types.M_String, Matreshka.Internals.Strings.Shared_Empty'Access),
-- data
2 => (AMF.Internals.Tables.DD_Types.M_Element, No_AMF_Link),
-- group
1 => (AMF.Internals.Tables.DD_Types.M_Collection_Of_Transform, 0),
-- transform
others => (Kind => AMF.Internals.Tables.DD_Types.M_None)));
DD_Element_Table.Table (Self).Member (0) :=
(AMF.Internals.Tables.DD_Types.M_Collection_Of_Element,
AMF.Internals.Element_Collections.Allocate_Collections (7));
-- localStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Local_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 1);
-- sharedStyle
AMF.Internals.Element_Collections.Initialize_Ordered_Set_Collection
(Self,
AMF.Internals.Tables.DG_Metamodel.MP_DG_Graphical_Element_Shared_Style_A_Styled_Element,
DD_Element_Table.Table (Self).Member (0).Collection + 2);
return Self;
end Create_DG_Text;
end AMF.Internals.Tables.DD_Constructors;
|
30,825
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/ada/par-load.adb
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P A R . L O A D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2015, 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. --
-- --
------------------------------------------------------------------------------
-- The Par.Load procedure loads all units that are definitely required before
-- it makes any sense at all to proceed with semantic analysis, including
-- with'ed units, corresponding specs for bodies, parents of child specs,
-- and parents of subunits. All these units are loaded and pointers installed
-- in the tree as described in the spec of package Lib.
with Fname.UF; use Fname.UF;
with Lib.Load; use Lib.Load;
with Namet.Sp; use Namet.Sp;
with Uname; use Uname;
with Osint; use Osint;
with Sinput.L; use Sinput.L;
with Stylesw; use Stylesw;
with Validsw; use Validsw;
with GNAT.Spelling_Checker; use GNAT.Spelling_Checker;
separate (Par)
procedure Load is
File_Name : File_Name_Type;
-- Name of file for current unit, derived from unit name
Cur_Unum : constant Unit_Number_Type := Current_Source_Unit;
-- Unit number of unit that we just finished parsing. Note that we need
-- to capture this, because Source_Unit will change as we parse new
-- source files in the multiple main source file case.
Curunit : constant Node_Id := Cunit (Cur_Unum);
-- Compilation unit node for current compilation unit
Loc : Source_Ptr := Sloc (Curunit);
-- Source location for compilation unit node
Save_Style_Check : Boolean;
Save_Style_Checks : Style_Check_Options;
-- Save style check so it can be restored later
Save_Validity_Check : Boolean;
Save_Validity_Checks : Validity_Check_Options;
-- Save validity check so it can be restored later
With_Cunit : Node_Id;
-- Compilation unit node for withed unit
Context_Node : Node_Id;
-- Next node in context items list
With_Node : Node_Id;
-- N_With_Clause node
Spec_Name : Unit_Name_Type;
-- Unit name of required spec
Body_Name : Unit_Name_Type;
-- Unit name of corresponding body
Unum : Unit_Number_Type;
-- Unit number of loaded unit
Limited_With_Found : Boolean := False;
-- We load the context items in two rounds: the first round handles normal
-- withed units and the second round handles Ada 2005 limited-withed units.
-- This is required to allow the low-level circuitry that detects circular
-- dependencies of units the correct notification of errors (see comment
-- bellow). This variable is used to indicate that the second round is
-- required.
function Same_File_Name_Except_For_Case
(Expected_File_Name : File_Name_Type;
Actual_File_Name : File_Name_Type) return Boolean;
-- Given an actual file name and an expected file name (the latter being
-- derived from the unit name), determine if they are the same except for
-- possibly different casing of letters.
------------------------------------
-- Same_File_Name_Except_For_Case --
------------------------------------
function Same_File_Name_Except_For_Case
(Expected_File_Name : File_Name_Type;
Actual_File_Name : File_Name_Type) return Boolean
is
begin
Get_Name_String (Actual_File_Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
declare
Lower_Case_Actual_File_Name : String (1 .. Name_Len);
begin
Lower_Case_Actual_File_Name := Name_Buffer (1 .. Name_Len);
Get_Name_String (Expected_File_Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
return Lower_Case_Actual_File_Name = Name_Buffer (1 .. Name_Len);
end;
end Same_File_Name_Except_For_Case;
-- Start of processing for Load
begin
-- Don't do any loads if we already had a fatal error
if Fatal_Error (Cur_Unum) = Error_Detected then
return;
end if;
Save_Style_Check_Options (Save_Style_Checks);
Save_Style_Check := Opt.Style_Check;
Save_Validity_Check_Options (Save_Validity_Checks);
Save_Validity_Check := Opt.Validity_Checks_On;
-- If main unit, set Main_Unit_Entity (this will get overwritten if
-- the main unit has a separate spec, that happens later on in Load)
if Cur_Unum = Main_Unit then
Main_Unit_Entity := Cunit_Entity (Main_Unit);
end if;
-- If we have no unit name, things are seriously messed up by previous
-- errors, and we should not try to continue compilation.
if Unit_Name (Cur_Unum) = No_Unit_Name then
raise Unrecoverable_Error;
end if;
-- Next step, make sure that the unit name matches the file name
-- and issue a warning message if not. We only output this for the
-- main unit, since for other units it is more serious and is
-- caught in a separate test below. We also inhibit the message in
-- multiple unit per file mode, because in this case the relation
-- between file name and unit name is broken.
File_Name :=
Get_File_Name
(Unit_Name (Cur_Unum),
Subunit => Nkind (Unit (Cunit (Cur_Unum))) = N_Subunit);
if Cur_Unum = Main_Unit
and then Multiple_Unit_Index = 0
and then File_Name /= Unit_File_Name (Cur_Unum)
and then (File_Names_Case_Sensitive
or not Same_File_Name_Except_For_Case
(File_Name, Unit_File_Name (Cur_Unum)))
then
Error_Msg_File_1 := File_Name;
Error_Msg
("??file name does not match unit name, should be{", Sloc (Curunit));
end if;
-- For units other than the main unit, the expected unit name is set and
-- must be the same as the actual unit name, or we are in big trouble, and
-- abandon the compilation since there are situations where this really
-- gets us into bad trouble (e.g. some subunit situations).
if Cur_Unum /= Main_Unit
and then Expected_Unit (Cur_Unum) /= Unit_Name (Cur_Unum)
then
Loc := Error_Location (Cur_Unum);
Error_Msg_File_1 := Unit_File_Name (Cur_Unum);
Get_Name_String (Error_Msg_File_1);
-- Check for predefined file case
if Name_Len > 1
and then Name_Buffer (2) = '-'
and then (Name_Buffer (1) = 'a'
or else
Name_Buffer (1) = 's'
or else
Name_Buffer (1) = 'i'
or else
Name_Buffer (1) = 'g')
then
declare
Expect_Name : constant Unit_Name_Type := Expected_Unit (Cur_Unum);
Actual_Name : constant Unit_Name_Type := Unit_Name (Cur_Unum);
begin
Error_Msg_Unit_1 := Expect_Name;
Error_Msg -- CODEFIX
("$$ is not a predefined library unit!", Loc);
-- In the predefined file case, we know the user did not
-- construct their own package, but we got the wrong one.
-- This means that the name supplied by the user crunched
-- to something we recognized, but then the file did not
-- contain the unit expected. Most likely this is due to
-- a misspelling, e.g.
-- with Ada.Calender;
-- This crunches to a-calend, which indeed contains the unit
-- Ada.Calendar, and we can diagnose the misspelling. This
-- is a simple heuristic, but it catches many common cases
-- of misspelling of predefined unit names without needing
-- a full list of them.
-- Before actually issuing the message, we will check that the
-- unit name is indeed a plausible misspelling of the one we got.
if Is_Bad_Spelling_Of
(Name_Id (Expect_Name), Name_Id (Actual_Name))
then
Error_Msg_Unit_1 := Actual_Name;
Error_Msg -- CODEFIX
("possible misspelling of $$!", Loc);
end if;
end;
-- Non-predefined file name case. In this case we generate a message
-- and then we quit, because we are in big trouble, and if we try
-- to continue compilation, we get into some nasty situations
-- (for example in some subunit cases).
else
Error_Msg ("file { does not contain expected unit!", Loc);
Error_Msg_Unit_1 := Expected_Unit (Cur_Unum);
Error_Msg ("\\expected unit $!", Loc);
Error_Msg_Unit_1 := Unit_Name (Cur_Unum);
Error_Msg ("\\found unit $!", Loc);
end if;
-- In both cases, remove the unit if it is the last unit (which it
-- normally (always?) will be) so that it is out of the way later.
Remove_Unit (Cur_Unum);
end if;
-- If current unit is a body, load its corresponding spec
if Nkind (Unit (Curunit)) = N_Package_Body
or else Nkind (Unit (Curunit)) = N_Subprogram_Body
then
Spec_Name := Get_Spec_Name (Unit_Name (Cur_Unum));
Unum :=
Load_Unit
(Load_Name => Spec_Name,
Required => False,
Subunit => False,
Error_Node => Curunit,
Corr_Body => Cur_Unum,
PMES => (Cur_Unum = Main_Unit));
-- If we successfully load the unit, then set the spec/body pointers.
-- Once again note that if the loaded unit has a fatal error, Load will
-- have set our Fatal_Error flag to propagate this condition.
if Unum /= No_Unit then
Set_Library_Unit (Curunit, Cunit (Unum));
Set_Library_Unit (Cunit (Unum), Curunit);
-- If this is a separate spec for the main unit, then we reset
-- Main_Unit_Entity to point to the entity for this separate spec
-- and this is also where we generate the SCO's for this spec.
if Cur_Unum = Main_Unit then
Main_Unit_Entity := Cunit_Entity (Unum);
if Generate_SCO then
SCO_Record_Raw (Unum);
end if;
end if;
-- If we don't find the spec, then if we have a subprogram body, we
-- are still OK, we just have a case of a body acting as its own spec
elsif Nkind (Unit (Curunit)) = N_Subprogram_Body then
Set_Acts_As_Spec (Curunit, True);
Set_Library_Unit (Curunit, Curunit);
-- Otherwise we do have an error, repeat the load request for the spec
-- with Required set True to generate an appropriate error message.
else
Unum :=
Load_Unit
(Load_Name => Spec_Name,
Required => True,
Subunit => False,
Error_Node => Curunit);
return;
end if;
-- If current unit is a child unit spec, load its parent. If the child unit
-- is loaded through a limited with, the parent must be as well.
elsif Nkind (Unit (Curunit)) = N_Package_Declaration
or else Nkind (Unit (Curunit)) = N_Subprogram_Declaration
or else Nkind (Unit (Curunit)) in N_Generic_Declaration
or else Nkind (Unit (Curunit)) in N_Generic_Instantiation
or else Nkind (Unit (Curunit)) in N_Renaming_Declaration
then
-- Turn style and validity checks off for parent unit
if not GNAT_Mode then
Reset_Style_Check_Options;
Reset_Validity_Check_Options;
end if;
Spec_Name := Get_Parent_Spec_Name (Unit_Name (Cur_Unum));
if Spec_Name /= No_Unit_Name then
Unum :=
Load_Unit
(Load_Name => Spec_Name,
Required => True,
Subunit => False,
Error_Node => Curunit);
if Unum /= No_Unit then
Set_Parent_Spec (Unit (Curunit), Cunit (Unum));
end if;
end if;
-- If current unit is a subunit, then load its parent body
elsif Nkind (Unit (Curunit)) = N_Subunit then
Body_Name := Get_Parent_Body_Name (Unit_Name (Cur_Unum));
Unum :=
Load_Unit
(Load_Name => Body_Name,
Required => True,
Subunit => False,
Error_Node => Name (Unit (Curunit)));
if Unum /= No_Unit then
Set_Library_Unit (Curunit, Cunit (Unum));
end if;
end if;
-- Now we load with'ed units, with style/validity checks turned off
if not GNAT_Mode then
Reset_Style_Check_Options;
Reset_Validity_Check_Options;
end if;
-- Load the context items in two rounds: the first round handles normal
-- withed units and the second round handles Ada 2005 limited-withed units.
-- This is required to allow the low-level circuitry that detects circular
-- dependencies of units the correct notification of the following error:
-- limited with D;
-- with D; with C;
-- package C is ... package D is ...
for Round in 1 .. 2 loop
Context_Node := First (Context_Items (Curunit));
while Present (Context_Node) loop
-- During the first round we check if there is some limited-with
-- context clause; otherwise the second round will be skipped
if Nkind (Context_Node) = N_With_Clause
and then Round = 1
and then Limited_Present (Context_Node)
then
Limited_With_Found := True;
end if;
if Nkind (Context_Node) = N_With_Clause
and then ((Round = 1 and then not Limited_Present (Context_Node))
or else
(Round = 2 and then Limited_Present (Context_Node)))
then
With_Node := Context_Node;
Spec_Name := Get_Unit_Name (With_Node);
Unum :=
Load_Unit
(Load_Name => Spec_Name,
Required => False,
Subunit => False,
Error_Node => With_Node,
Renamings => True,
With_Node => Context_Node);
-- If we find the unit, then set spec pointer in the N_With_Clause
-- to point to the compilation unit for the spec. Remember that
-- the Load routine itself sets our Fatal_Error flag if the loaded
-- unit gets a fatal error, so we don't need to worry about that.
if Unum /= No_Unit then
Set_Library_Unit (With_Node, Cunit (Unum));
-- If the spec isn't found, then try finding the corresponding
-- body, since it is possible that we have a subprogram body
-- that is acting as a spec (since no spec is present).
else
Body_Name := Get_Body_Name (Spec_Name);
Unum :=
Load_Unit
(Load_Name => Body_Name,
Required => False,
Subunit => False,
Error_Node => With_Node,
Renamings => True);
-- If we got a subprogram body, then mark that we are using
-- the body as a spec in the file table, and set the spec
-- pointer in the N_With_Clause to point to the body entity.
if Unum /= No_Unit
and then Nkind (Unit (Cunit (Unum))) = N_Subprogram_Body
then
With_Cunit := Cunit (Unum);
Set_Library_Unit (With_Node, With_Cunit);
Set_Acts_As_Spec (With_Cunit, True);
Set_Library_Unit (With_Cunit, With_Cunit);
-- If we couldn't find the body, or if it wasn't a body spec
-- then we are in trouble. We make one more call to Load to
-- require the spec. We know it will fail of course, the
-- purpose is to generate the required error message (we prefer
-- that this message refer to the missing spec, not the body)
else
Unum :=
Load_Unit
(Load_Name => Spec_Name,
Required => True,
Subunit => False,
Error_Node => With_Node,
Renamings => True);
-- Here we create a dummy package unit for the missing unit
Unum := Create_Dummy_Package_Unit (With_Node, Spec_Name);
Set_Library_Unit (With_Node, Cunit (Unum));
end if;
end if;
end if;
Next (Context_Node);
end loop;
exit when not Limited_With_Found;
end loop;
-- Restore style/validity check mode for main unit
Set_Style_Check_Options (Save_Style_Checks);
Opt.Style_Check := Save_Style_Check;
Set_Validity_Check_Options (Save_Validity_Checks);
Opt.Validity_Checks_On := Save_Validity_Check;
end Load;
|
30,826
|
ada
| 80
|
enfoTek/tomato.linksys.e2000.nvram-mod
|
tools-src/gnu/gcc/gcc/ada/sem_ch2.adb
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C H 2 --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1999, 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. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Opt; use Opt;
with Restrict; use Restrict;
with Sem_Ch8; use Sem_Ch8;
with Sinfo; use Sinfo;
with Stand; use Stand;
package body Sem_Ch2 is
-------------------------------
-- Analyze_Character_Literal --
-------------------------------
procedure Analyze_Character_Literal (N : Node_Id) is
begin
-- The type is eventually inherited from the context. If expansion
-- has already established the proper type, do not modify it.
if No (Etype (N)) then
Set_Etype (N, Any_Character);
end if;
Set_Is_Static_Expression (N);
if Comes_From_Source (N)
and then not In_Character_Range (Char_Literal_Value (N))
then
Check_Restriction (No_Wide_Characters, N);
end if;
end Analyze_Character_Literal;
------------------------
-- Analyze_Identifier --
------------------------
procedure Analyze_Identifier (N : Node_Id) is
begin
Find_Direct_Name (N);
end Analyze_Identifier;
-----------------------------
-- Analyze_Integer_Literal --
-----------------------------
procedure Analyze_Integer_Literal (N : Node_Id) is
begin
Set_Etype (N, Universal_Integer);
Set_Is_Static_Expression (N);
end Analyze_Integer_Literal;
--------------------------
-- Analyze_Real_Literal --
--------------------------
procedure Analyze_Real_Literal (N : Node_Id) is
begin
Set_Etype (N, Universal_Real);
Set_Is_Static_Expression (N);
end Analyze_Real_Literal;
----------------------------
-- Analyze_String_Literal --
----------------------------
procedure Analyze_String_Literal (N : Node_Id) is
begin
-- The type is eventually inherited from the context. If expansion
-- has already established the proper type, do not modify it.
if No (Etype (N)) then
Set_Etype (N, Any_String);
end if;
-- String literals are static in Ada 95. Note that if the subtype
-- turns out to be non-static, then the Is_Static_Expression flag
-- will be reset in Eval_String_Literal.
if Ada_95 then
Set_Is_Static_Expression (N);
end if;
if Comes_From_Source (N) and then Has_Wide_Character (N) then
Check_Restriction (No_Wide_Characters, N);
end if;
end Analyze_String_Literal;
end Sem_Ch2;
|
30,827
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/support/repbody.ada
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/support/repbody.ada<gh_stars>1-10
-- REPBODY.ADA
--
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
--
-- HISTORY:
-- DCB 04/27/80
-- JRK 6/10/80
-- JRK 11/12/80
-- JRK 8/6/81
-- JRK 10/27/82
-- JRK 6/1/84
-- JRK 11/18/85 ADDED PRAGMA ELABORATE.
-- PWB 07/29/87 ADDED STATUS ACTION_REQUIRED AND
-- PROCEDURE SPECIAL_ACTION.
-- TBN 08/20/87 ADDED FUNCTION LEGAL_FILE_NAME.
-- BCB 05/17/90 MODIFIED TO ALLOW OUTPUT TO DIRECT_IO FILE.
-- ADDED TIME-STAMP.
-- LDC 05/17/90 REMOVED OUTPUT TO DIRECT_IO FILE.
-- WMC 08/11/92 UPDATED ACVC VERSION STRING TO "9X BASIC".
-- DTN 07/05/92 UPDATED ACVC VERSION STRING TO
-- "ACVC 2.0 JULY 6 1993 DRAFT".
-- WMC 01/24/94 MODIFIED LEGAL_FILE_NAME TO ALLOW FIVE POSSIBLE
-- FILE NAMES (INCREASED RANGE OF TYPE FILE_NUM TO 1..5).
-- WMC 11/06/94 UPDATED ACVC VERSION STRING TO
-- "ACVC 2.0 NOVEMBER 6 1994 DRAFT".
-- DTN 12/04/94 UPDATED ACVC VERSION STRING TO
-- "ACVC 2.0".
-- KAS 06/19/95 ADDED FUNCTION IDENT_WIDE_CHAR.
-- KAS 06/19/95 ADDED FUNCTION IDENT_WIDE_STR.
-- DTN 11/21/95 UPDATED ACVC VERSION STRING TO
-- "ACVC 2.0.1".
-- DTN 12/14/95 UPDATED ACVC VERSION STRING TO
-- "ACVC 2.1".
-- EDS 12/17/97 UPDATED ACVC VERSION STRING TO
-- "2.2".
-- RLB 3/16/00 UPDATED ACATS VERSION STRING TO "2.3".
-- CHANGED VARIOUS STRINGS TO READ "ACATS".
-- RLB 3/22/01 UPDATED ACATS VERSION STRING TO "2.4".
-- RLB 3/29/01 UPDATED ACATS VERSION STRING TO "2.5".
WITH TEXT_IO, CALENDAR;
USE TEXT_IO, CALENDAR;
PRAGMA ELABORATE (TEXT_IO, CALENDAR);
PACKAGE BODY REPORT IS
TYPE STATUS IS (PASS, FAIL, DOES_NOT_APPLY, ACTION_REQUIRED,
UNKNOWN);
TYPE TIME_INTEGER IS RANGE 0 .. 86_400;
TEST_STATUS : STATUS := FAIL;
MAX_NAME_LEN : CONSTANT := 15; -- MAXIMUM TEST NAME LENGTH.
TEST_NAME : STRING (1..MAX_NAME_LEN);
NO_NAME : CONSTANT STRING (1..7) := "NO_NAME";
TEST_NAME_LEN : INTEGER RANGE 0..MAX_NAME_LEN := 0;
ACATS_VERSION : CONSTANT STRING := "2.5";
-- VERSION OF ACATS BEING RUN (X.XX).
PROCEDURE PUT_MSG (MSG : STRING) IS
-- WRITE MESSAGE. LONG MESSAGES ARE FOLDED (AND INDENTED).
MAX_LEN : CONSTANT INTEGER RANGE 50..150 := 72; -- MAXIMUM
-- OUTPUT LINE LENGTH.
INDENT : CONSTANT INTEGER := TEST_NAME_LEN + 9; -- AMOUNT TO
-- INDENT CONTINUATION LINES.
I : INTEGER := 0; -- CURRENT INDENTATION.
M : INTEGER := MSG'FIRST; -- START OF MESSAGE SLICE.
N : INTEGER; -- END OF MESSAGE SLICE.
BEGIN
LOOP
IF I + (MSG'LAST-M+1) > MAX_LEN THEN
N := M + (MAX_LEN-I) - 1;
IF MSG (N) /= ' ' THEN
WHILE N >= M AND THEN MSG (N+1) /= ' ' LOOP
N := N - 1;
END LOOP;
IF N < M THEN
N := M + (MAX_LEN-I) - 1;
END IF;
END IF;
ELSE N := MSG'LAST;
END IF;
SET_COL (STANDARD_OUTPUT, TEXT_IO.COUNT (I+1));
PUT_LINE (STANDARD_OUTPUT, MSG (M..N));
I := INDENT;
M := N + 1;
WHILE M <= MSG'LAST AND THEN MSG (M) = ' ' LOOP
M := M + 1;
END LOOP;
EXIT WHEN M > MSG'LAST;
END LOOP;
END PUT_MSG;
FUNCTION TIME_STAMP RETURN STRING IS
TIME_NOW : CALENDAR.TIME;
YEAR,
MONTH,
DAY,
HOUR,
MINUTE,
SECOND : TIME_INTEGER := 1;
FUNCTION CONVERT (NUMBER : TIME_INTEGER) RETURN STRING IS
STR : STRING (1..2) := (OTHERS => '0');
DEC_DIGIT : CONSTANT STRING := "0123456789";
NUM : TIME_INTEGER := NUMBER;
BEGIN
IF NUM = 0 THEN
RETURN STR;
ELSE
NUM := NUM MOD 100;
STR (2) := DEC_DIGIT (INTEGER (NUM MOD 10 + 1));
NUM := NUM / 10;
STR (1) := DEC_DIGIT (INTEGER (NUM + 1));
RETURN STR;
END IF;
END CONVERT;
BEGIN
TIME_NOW := CALENDAR.CLOCK;
SPLIT (TIME_NOW, YEAR_NUMBER (YEAR), MONTH_NUMBER (MONTH),
DAY_NUMBER (DAY), DAY_DURATION (SECOND));
HOUR := SECOND / 3600;
SECOND := SECOND MOD 3600;
MINUTE := SECOND / 60;
SECOND := SECOND MOD 60;
RETURN (CONVERT (TIME_INTEGER (YEAR)) & "-" &
CONVERT (TIME_INTEGER (MONTH)) & "-" &
CONVERT (TIME_INTEGER (DAY)) & " " &
CONVERT (TIME_INTEGER (HOUR)) & ":" &
CONVERT (TIME_INTEGER (MINUTE)) & ":" &
CONVERT (TIME_INTEGER (SECOND)));
END TIME_STAMP;
PROCEDURE TEST (NAME : STRING; DESCR : STRING) IS
BEGIN
TEST_STATUS := PASS;
IF NAME'LENGTH <= MAX_NAME_LEN THEN
TEST_NAME_LEN := NAME'LENGTH;
ELSE TEST_NAME_LEN := MAX_NAME_LEN;
END IF;
TEST_NAME (1..TEST_NAME_LEN) :=
NAME (NAME'FIRST .. NAME'FIRST+TEST_NAME_LEN-1);
PUT_MSG ("");
PUT_MSG (",.,. " & TEST_NAME (1..TEST_NAME_LEN) & " " &
"ACATS " & ACATS_VERSION & " " & TIME_STAMP);
PUT_MSG ("---- " & TEST_NAME (1..TEST_NAME_LEN) & " " &
DESCR & ".");
END TEST;
PROCEDURE COMMENT (DESCR : STRING) IS
BEGIN
PUT_MSG (" - " & TEST_NAME (1..TEST_NAME_LEN) & " " &
DESCR & ".");
END COMMENT;
PROCEDURE FAILED (DESCR : STRING) IS
BEGIN
TEST_STATUS := FAIL;
PUT_MSG (" * " & TEST_NAME (1..TEST_NAME_LEN) & " " &
DESCR & ".");
END FAILED;
PROCEDURE NOT_APPLICABLE (DESCR : STRING) IS
BEGIN
IF TEST_STATUS = PASS OR TEST_STATUS = ACTION_REQUIRED THEN
TEST_STATUS := DOES_NOT_APPLY;
END IF;
PUT_MSG (" + " & TEST_NAME (1..TEST_NAME_LEN) & " " &
DESCR & ".");
END NOT_APPLICABLE;
PROCEDURE SPECIAL_ACTION (DESCR : STRING) IS
BEGIN
IF TEST_STATUS = PASS THEN
TEST_STATUS := ACTION_REQUIRED;
END IF;
PUT_MSG (" ! " & TEST_NAME (1..TEST_NAME_LEN) & " " &
DESCR & ".");
END SPECIAL_ACTION;
PROCEDURE RESULT IS
BEGIN
CASE TEST_STATUS IS
WHEN PASS =>
PUT_MSG ("==== " & TEST_NAME (1..TEST_NAME_LEN) &
" PASSED ============================.");
WHEN DOES_NOT_APPLY =>
PUT_MSG ("++++ " & TEST_NAME (1..TEST_NAME_LEN) &
" NOT-APPLICABLE ++++++++++++++++++++.");
WHEN ACTION_REQUIRED =>
PUT_MSG ("!!!! " & TEST_NAME (1..TEST_NAME_LEN) &
" TENTATIVELY PASSED !!!!!!!!!!!!!!!!.");
PUT_MSG ("!!!! " & (1..TEST_NAME_LEN => ' ') &
" SEE '!' COMMENTS FOR SPECIAL NOTES!!");
WHEN OTHERS =>
PUT_MSG ("**** " & TEST_NAME (1..TEST_NAME_LEN) &
" FAILED ****************************.");
END CASE;
TEST_STATUS := FAIL;
TEST_NAME_LEN := NO_NAME'LENGTH;
TEST_NAME (1..TEST_NAME_LEN) := NO_NAME;
END RESULT;
FUNCTION IDENT_INT (X : INTEGER) RETURN INTEGER IS
BEGIN
IF EQUAL (X, X) THEN -- ALWAYS EQUAL.
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN 0; -- NEVER EXECUTED.
END IDENT_INT;
FUNCTION IDENT_CHAR (X : CHARACTER) RETURN CHARACTER IS
BEGIN
IF EQUAL (CHARACTER'POS(X), CHARACTER'POS(X)) THEN -- ALWAYS
-- EQUAL.
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN '0'; -- NEVER EXECUTED.
END IDENT_CHAR;
FUNCTION IDENT_WIDE_CHAR (X : WIDE_CHARACTER) RETURN WIDE_CHARACTER IS
BEGIN
IF EQUAL (WIDE_CHARACTER'POS(X), WIDE_CHARACTER'POS(X)) THEN
-- ALWAYS EQUAL.
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN '0'; -- NEVER EXECUTED.
END IDENT_WIDE_CHAR;
FUNCTION IDENT_BOOL (X : BOOLEAN) RETURN BOOLEAN IS
BEGIN
IF EQUAL (BOOLEAN'POS(X), BOOLEAN'POS(X)) THEN -- ALWAYS
-- EQUAL.
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN FALSE; -- NEVER EXECUTED.
END IDENT_BOOL;
FUNCTION IDENT_STR (X : STRING) RETURN STRING IS
BEGIN
IF EQUAL (X'LENGTH, X'LENGTH) THEN -- ALWAYS EQUAL.
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN ""; -- NEVER EXECUTED.
END IDENT_STR;
FUNCTION IDENT_WIDE_STR (X : WIDE_STRING) RETURN WIDE_STRING IS
BEGIN
IF EQUAL (X'LENGTH, X'LENGTH) THEN -- ALWAYS EQUAL.
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN ""; -- NEVER EXECUTED.
END IDENT_WIDE_STR;
FUNCTION EQUAL (X, Y : INTEGER) RETURN BOOLEAN IS
REC_LIMIT : CONSTANT INTEGER RANGE 1..100 := 3; -- RECURSION
-- LIMIT.
Z : BOOLEAN; -- RESULT.
BEGIN
IF X < 0 THEN
IF Y < 0 THEN
Z := EQUAL (-X, -Y);
ELSE Z := FALSE;
END IF;
ELSIF X > REC_LIMIT THEN
Z := EQUAL (REC_LIMIT, Y-X+REC_LIMIT);
ELSIF X > 0 THEN
Z := EQUAL (X-1, Y-1);
ELSE Z := Y = 0;
END IF;
RETURN Z;
EXCEPTION
WHEN OTHERS =>
RETURN X = Y;
END EQUAL;
FUNCTION LEGAL_FILE_NAME (X : FILE_NUM := 1;
NAM : STRING := "")
RETURN STRING IS
SUFFIX : STRING (2..6);
BEGIN
IF NAM = "" THEN
SUFFIX := TEST_NAME(3..7);
ELSE
SUFFIX := NAM(3..7);
END IF;
CASE X IS
WHEN 1 => RETURN ('X' & SUFFIX);
WHEN 2 => RETURN ('Y' & SUFFIX);
WHEN 3 => RETURN ('Z' & SUFFIX);
WHEN 4 => RETURN ('V' & SUFFIX);
WHEN 5 => RETURN ('W' & SUFFIX);
END CASE;
END LEGAL_FILE_NAME;
BEGIN
TEST_NAME_LEN := NO_NAME'LENGTH;
TEST_NAME (1..TEST_NAME_LEN) := NO_NAME;
END REPORT;
|
30,828
|
ada
| 52
|
onox/orka
|
orka/src/gl/interface/gl.ads
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 <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 Interfaces.C;
with Orka;
package GL is
pragma Pure;
package C renames Interfaces.C;
-- Index types for vectors and matrices
subtype Index_Homogeneous is Orka.Index_Homogeneous;
subtype Index_2D is Orka.Index_2D;
subtype Index_3D is Orka.Index_3D;
use all type Orka.Integer_32;
use all type Orka.Integer_64;
use all type Orka.Float_32;
use all type Orka.Float_64;
use all type Index_Homogeneous;
Feature_Not_Supported_Exception : exception;
-- Raised when a function that is not available for the current
-- context is called
end GL;
|
30,829
|
ada
| 488
|
ouankou/rose
|
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/fib.adb
|
<filename>tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/fib.adb
function Fib(x: in Integer) return Integer is
Result : Integer;
begin
if x = 0 then
Result := 0;
elsif x = 1 then
Result := 1;
else
Result := Fib(x-2) + Fib(x-1);
end if;
return Result;
end Fib;
|
30,830
|
ada
| 0
|
thierr26/ada-apsepp
|
src/apsepp-test_node_class-case_stub.ads
|
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Apsepp.Test_Node_Class.Generic_Case_And_Suite_Run_Body;
package Apsepp.Test_Node_Class.Case_Stub is
type Test_Case_Stub is limited new Test_Node_Interfa with private
with Type_Invariant'Class =>
Test_Case_Stub.Invariant_Class_Test_Case_Stub;
not overriding
function Invariant_Class_Test_Case_Stub
(Obj : Test_Case_Stub) return Boolean
is (Test_Case_Stub'Class (Obj).Child_Count = 0
and then
Test_Case_Stub'Class (Obj).No_Subtasking);
overriding
function Routine_Count (Obj : Test_Case_Stub) return Test_Routine_Count
is (0);
overriding
function Routine (Obj : Test_Case_Stub;
K : Test_Routine_Index) return Test_Routine;
overriding
procedure Run (Obj : in out Test_Case_Stub;
Outcome : out Test_Outcome;
Kind : Run_Kind := Assert_Cond_And_Run_Test);
overriding
function Child_Count (Obj : Test_Case_Stub) return Test_Node_Count
is (0);
overriding
function Child (Obj : Test_Case_Stub;
K : Test_Node_Index) return Test_Node_Access;
overriding
function No_Subtasking (Obj : Test_Case_Stub) return Boolean
is (True);
procedure Run_Body
is new Generic_Case_And_Suite_Run_Body (Work => Run_Test_Routines);
overriding
function Has_Early_Test (Obj : Test_Case_Stub) return Boolean
is (False);
overriding
function Early_Run_Done (Obj : Test_Case_Stub) return Boolean
is (True);
overriding
procedure Early_Run (Obj : in out Test_Case_Stub) is null;
private
type Test_Case_Stub is limited new Test_Node_Interfa with null record;
end Apsepp.Test_Node_Class.Case_Stub;
|
30,831
|
ada
| 0
|
sebsgit/textproc
|
src/morphology.adb
|
<filename>src/morphology.adb
with PixelArray; use PixelArray;
package body Morphology is
function maxPixel(image: PixelArray.ImagePlane; x, y: Natural; size: Positive) return PixelArray.Pixel is
result: PixelArray.Pixel;
begin
result := image.get(x, y);
for py in y - size / 2 .. y + size / 2 loop
for px in x - size / 2 .. x + size / 2 loop
if image.isInside(px, py) then
result := PixelArray.Pixel'Max(result, image.get(px, py));
if result = PixelArray.Pixel'Last then
return result;
end if;
end if;
end loop;
end loop;
return result;
end maxPixel;
function minPixel(image: PixelArray.ImagePlane; x, y: Natural; size: Positive) return PixelArray.Pixel is
result: PixelArray.Pixel;
begin
result := image.get(x, y);
for py in y - size / 2 .. y + size / 2 loop
for px in x - size / 2 .. x + size / 2 loop
if image.isInside(px, py) then
result := PixelArray.Pixel'Min(result, image.get(px, py));
if result = PixelArray.Pixel'First then
return result;
end if;
end if;
end loop;
end loop;
return result;
end minPixel;
function dilate(image: PixelArray.ImagePlane; size: Positive) return PixelArray.ImagePlane is
begin
return result: PixelArray.ImagePlane := PixelArray.allocate(image.width, image.height) do
for py in 0 .. image.height - 1 loop
for px in 0 .. image.width - 1 loop
result.set(px, py, maxPixel(image, px, py, size));
end loop;
end loop;
end return;
end dilate;
function erode(image: PixelArray.ImagePlane; size: Positive) return PixelArray.ImagePlane is
begin
return result: PixelArray.ImagePlane := PixelArray.allocate(image.width, image.height) do
for py in 0 .. image.height - 1 loop
for px in 0 .. image.width - 1 loop
result.set(px, py, minPixel(image, px, py, size));
end loop;
end loop;
end return;
end erode;
end Morphology;
|
30,832
|
ada
| 33
|
ytomino/drake
|
source/hash/a-cmuha3.adb
|
<reponame>ytomino/drake
package body Ada.Containers.Murmur_Hash_3 is
-- use MurmurHash3_x86_32
procedure Step (h1 : in out Hash_Type; Item : Hash_Type);
procedure Step (h1 : in out Hash_Type; Item : Hash_Type) is
c1 : constant := 16#cc9e2d51#;
c2 : constant := 16#1b873593#;
k1 : Hash_Type := Item;
begin
k1 := k1 * c1;
k1 := Rotate_Left (k1, 15);
k1 := k1 * c2;
h1 := h1 xor k1;
end Step;
-- implementation
function Initialize (Initiator : Hash_Type) return State is
begin
return (h1 => Initiator, len => 0);
end Initialize;
procedure Update (S : in out State; Item : Hash_Type) is
begin
Step (S.h1, Item);
S.h1 := Rotate_Left (S.h1, 13);
S.h1 := S.h1 * 5 + 16#e6546b64#;
S.len := S.len + 4;
end Update;
procedure Update (S : in out State; Item : Hash_8) is
begin
Step (S.h1, Hash_Type'Mod (Item));
S.len := S.len + 1;
end Update;
procedure Update (S : in out State; Item : Hash_16) is
begin
Step (S.h1, Hash_Type'Mod (Item));
S.len := S.len + 2;
end Update;
procedure Update (S : in out State; Item : Hash_24) is
begin
Step (S.h1, Hash_Type'Mod (Item));
S.len := S.len + 3;
end Update;
procedure Finalize (S : State; Digest : out Hash_Type) is
begin
Digest := S.h1 xor Hash_Type'Mod (S.len);
Digest := Digest xor Shift_Right (Digest, 16);
Digest := Digest * 16#85ebca6b#;
Digest := Digest xor Shift_Right (Digest, 13);
Digest := Digest * 16#c2b2ae35#;
Digest := Digest xor Shift_Right (Digest, 16);
end Finalize;
end Ada.Containers.Murmur_Hash_3;
|
30,833
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c45251a.ada
|
-- C45251A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT FOR RELATIONAL OPERATIONS ON FIXED POINT TYPES THE
-- FOLLOWING HOLD:
-- (A) A /= B IS THE SAME AS NOT (A = B).
-- (B) A < B IS THE SAME AS NOT (A >= B).
-- (C) A > B IS THE SAME AS NOT (A <= B).
-- (D) ADJACENT MODEL NUMBERS GIVE CORRECT RESULTS.
-- (E) NON-MODEL NUMBERS WITH DISTINCT MODEL INTERVALS GIVE
-- CORRECT RESULTS.
-- (F) CASE WHERE MODEL INTERVALS INTERSECT IN A SINGLE MODEL
-- NUMBER GIVES CORRECT RESULT.
-- CASE A: BASIC TYPES THAT FIT THE CHARACTERISTICS OF DURATION'BASE.
-- WRG 8/26/86
WITH REPORT; USE REPORT;
PROCEDURE C45251A IS
-- THE NAME OF EACH TYPE OR SUBTYPE ENDS WITH THAT TYPE'S
-- 'MANTISSA VALUE.
TYPE LIKE_DURATION_M23 IS DELTA 0.020 RANGE -86_400.0 .. 86_400.0;
TYPE DECIMAL_M4 IS DELTA 100.0 RANGE -1000.0 .. 1000.0;
BEGIN
TEST ("C45251A", "CHECK RELATIONAL OPERATIONS FOR FIXED POINT " &
"TYPES - BASIC TYPES");
-------------------------------------------------------------------
DECLARE
A, B : LIKE_DURATION_M23 := 0.0;
C, D : DECIMAL_M4 := 0.0;
BEGIN
IF EQUAL (3, 3) THEN
A := 2#0.0000_0011#; -- JUST BELOW LIKE_DURATION'SMALL.
B := 2#0.0000_0101#; -- JUST ABOVE LIKE_DURATION'SMALL.
END IF;
-- (A)
IF A /= B XOR NOT (A = B) THEN
FAILED ("A /= B IS NOT THE SAME AS NOT (A = B)");
END IF;
-- (B)
IF A < B XOR NOT (A >= B) THEN
FAILED ("A < B IS NOT THE SAME AS NOT (A >= B)");
END IF;
-- (C)
IF A > B XOR NOT (A <= B) THEN
FAILED ("A > B IS NOT THE SAME AS NOT (A <= B)");
END IF;
-- (D)
IF EQUAL (3, 3) THEN
A := -(16#1_5180.00#); -- (-86_400.0)
B := -(16#1_517F.FC#); -- (-86_400.0 + 1.0/64)
C := 64.0; -- DECIMAL_M4'SMALL.
D := 128.0; -- 2 * DECIMAL_M4'SMALL.
END IF;
IF "=" (LEFT => A, RIGHT => B) THEN
FAILED ("ADJACENT MODEL NUMBERS GIVE INCORRECT RESULT " &
"- (A = B)");
END IF;
IF NOT "/=" (LEFT => C, RIGHT => D) THEN
FAILED ("ADJACENT MODEL NUMBERS GIVE INCORRECT RESULT " &
"- (C /= D)");
END IF;
IF "<" (LEFT => B, RIGHT => A) THEN
FAILED ("ADJACENT MODEL NUMBERS GIVE INCORRECT RESULT " &
"- (B < A)");
END IF;
IF ">" (LEFT => C, RIGHT => D) THEN
FAILED ("ADJACENT MODEL NUMBERS GIVE INCORRECT RESULT " &
"- (C > D)");
END IF;
IF ">=" (LEFT => A, RIGHT => B) THEN
FAILED ("ADJACENT MODEL NUMBERS GIVE INCORRECT RESULT " &
"- (A >= B)");
END IF;
IF "<=" (LEFT => D, RIGHT => C) THEN
FAILED ("ADJACENT MODEL NUMBERS GIVE INCORRECT RESULT " &
"- (D <= C)");
END IF;
-- (E)
IF EQUAL (3, 3) THEN
A := 0.02; -- INTERVAL IS 1.0/64 .. 2.0/64.
B := -0.02; -- INTERVAL IS -2.0/64 .. -1.0/64.
C := 800.0; -- INTERVAL IS 768.0 .. 832.0.
D := 900.0; -- INTERVAL IS 896.0 .. 960.0.
END IF;
IF A = B THEN
FAILED ("NON-MODEL NUMBERS WITH DISTINCT MODEL " &
"INTERVALS GIVE INCORRECT RESULT - (A = B)");
END IF;
IF NOT (C /= D) THEN
FAILED ("NON-MODEL NUMBERS WITH DISTINCT MODEL " &
"INTERVALS GIVE INCORRECT RESULT - (C /= D)");
END IF;
IF A < B THEN
FAILED ("NON-MODEL NUMBERS WITH DISTINCT MODEL " &
"INTERVALS GIVE INCORRECT RESULT - (A < B)");
END IF;
IF C > D THEN
FAILED ("NON-MODEL NUMBERS WITH DISTINCT MODEL " &
"INTERVALS GIVE INCORRECT RESULT - (C > D)");
END IF;
IF B >= A THEN
FAILED ("NON-MODEL NUMBERS WITH DISTINCT MODEL " &
"INTERVALS GIVE INCORRECT RESULT - (B >= A)");
END IF;
IF D <= C THEN
FAILED ("NON-MODEL NUMBERS WITH DISTINCT MODEL " &
"INTERVALS GIVE INCORRECT RESULT - (D <= C)");
END IF;
-- (F)
IF EQUAL (3, 3) THEN
B := 0.035; -- INTERVAL IS 2.0/64 .. 3.0/64.
C := 850.0; -- INTERVAL IS 832.0 .. 896.0.
END IF;
IF NOT (A <= B) THEN
FAILED ("COMPARISON OF NON-MODEL NUMBERS WITH ONE " &
"COMMON MODEL INTERVAL END-POINT GIVES " &
"INCORRECT RESULT - (A <= B)");
END IF;
IF A > B THEN
FAILED ("COMPARISON OF NON-MODEL NUMBERS WITH ONE " &
"COMMON MODEL INTERVAL END-POINT GIVES " &
"INCORRECT RESULT - (A > B)");
END IF;
IF NOT (D >= C) THEN
FAILED ("COMPARISON OF NON-MODEL NUMBERS WITH ONE " &
"COMMON MODEL INTERVAL END-POINT GIVES " &
"INCORRECT RESULT - (D >= C)");
END IF;
IF D < C THEN
FAILED ("COMPARISON OF NON-MODEL NUMBERS WITH ONE " &
"COMMON MODEL INTERVAL END-POINT GIVES " &
"INCORRECT RESULT - (D < C)");
END IF;
END;
-------------------------------------------------------------------
RESULT;
END C45251A;
|
30,834
|
ada
| 0
|
JCGobbi/Nucleo-STM32G474RE
|
bb-runtimes/src/s-bbpara__x86_64.ads
|
<reponame>JCGobbi/Nucleo-STM32G474RE<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . P A R A M E T E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2021, AdaCore --
-- --
-- GNARL 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. GNARL 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
-- This package defines basic parameters used by the low level tasking system
-- This is the x86-64 version of this package
pragma Restrictions (No_Elaboration_Code);
package System.BB.Parameters is
pragma Pure;
--------------------
-- Hardware clock --
--------------------
Ticks_Per_Second : constant := 1_000_000_000;
-- On x86-64 we read the TSC frequency from the CPU and convert that time
-- to nanoseconds.
TSC_Frequency : constant := 0;
-- The frequency of the Time Stamp Clock (TSC) in Hertz. When set to zero
-- the runtime will attempt to determine its value from the processor's
-- internal registers following the guidelines provided by the Intel 64 and
-- IA-32 Architectures Software Developer's Manual, Volume 3B, Section
-- 18.7.3. Since the TSC clock source is implemented differently across
-- the different Intel chip families, on some certain processors the
-- runtime may fail to either determine the TSC frequency or will set it
-- incorrectly. In the former case the runtime will raise a Program_Error
-- on boot, while for the latter always check to ensure the timing
-- behaviour is as expected. In both cases you will need to manual set the
-- TSC_Frequency constant above.
APIC_Timer_Divider : constant := 16;
-- Since the timer frequency is typically in GHz, clock the timer down as
-- we do not need such a fine grain timer capable of firing every
-- nanosecond (which also means the longest delay we can have before
-- having to reset the 32-bit timer is ~ 1 second). Instead we aim for
-- microsecond granularity.
----------------
-- Interrupts --
----------------
-- These definitions are in this package in order to isolate target
-- dependencies.
subtype Interrupt_Range is Natural range 0 .. 255;
-- Number of interrupts supported by the Local APIC
------------
-- Stacks --
------------
Interrupt_Stack_Frame_Size : constant := 8 * 1024; -- bytes
-- Size of the interrupt stack used for handling an interrupt.
Interrupt_Stack_Size : constant :=
Interrupt_Stack_Frame_Size *
(Interrupt_Priority'Last - Interrupt_Priority'First + 1);
-- Total size of the interrupt stack per processor. Each processor
-- allocates an individual interrupt stack frame for each priority level.
Interrupt_Sec_Stack_Size : constant := 128;
-- Size of the secondary stack for interrupt handlers
Exception_Stack_Size : constant := 4096; -- bytes
-- Size for each processor exception stack.
----------
-- CPUS --
----------
Max_Number_Of_CPUs : constant := 1;
-- Maximum number of CPUs
Multiprocessor : constant Boolean := Max_Number_Of_CPUs /= 1;
-- Are we on a multiprocessor board?
end System.BB.Parameters;
|
30,835
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/static_initializer5_pkg.ads
|
package Static_Initializer5_Pkg is
type Arr is array (Positive range <>) of Character;
type Buffer_Type (Length : Positive) is record
Content : Arr (1 .. Length);
end record;
type Buffer_Access is access Buffer_Type;
type Rec is tagged record
Buffer : Buffer_Access;
end record;
Null_Rec : constant Rec := (Buffer => null);
end Static_Initializer5_Pkg;
|
30,836
|
ada
| 0
|
strenkml/EE368
|
memsim-master/src/parser-parse_flip.adb
|
with Memory.Transform.Flip; use Memory.Transform.Flip;
with Parser.Transform_Parser;
separate (Parser)
procedure Parse_Flip(parser : in out Parser_Type;
result : out Memory_Pointer) is
package Flip_Parser is new Transform_Parser(
T_Type => Flip_Type,
T_Pointer => Flip_Pointer,
Create_Transform => Create_Flip
);
begin
Flip_Parser.Parse(parser, result);
end Parse_Flip;
|
30,837
|
ada
| 65
|
PThierry/ewok-kernel
|
src/arch/socs/stm32f439/soc-interrupts.adb
|
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- 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 m4.cpu;
package body soc.interrupts
with spark_mode => on
is
function get_interrupt
return t_interrupt
is
ipsr : constant m4.cpu.t_IPSR_register := m4.cpu.get_ipsr_register;
begin
return t_interrupt'val (ipsr.ISR_NUMBER);
end get_interrupt;
end soc.interrupts;
|
30,838
|
ada
| 0
|
fintatarta/fakedsp
|
Ada/src/fakelib/utilities-option_lists.adb
|
pragma Ada_2012;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Fixed;
with Ada.Characters.Handling;
with Utilities.Tokenize;
with Ada.Strings;
package body Utilities.Option_Lists is
-----------
-- Parse --
-----------
function Parse
(Input : String;
Entry_Separator : Character := ',';
Key_Separator : Character := '=';
Trim_Key : Boolean := True;
Trim_Value : Boolean := True;
Key_Case : Case_Action := Force_Lower;
Default_Value : String := "")
return Option_List
is
use Tokenize;
procedure Split_Key_Value (Item : String;
Separator : Character;
Key : out Unbounded_String;
Value : out Unbounded_String)
is
use Ada.Strings;
Pos : constant Natural := Fixed.Index (Source => Item,
Pattern => Separator & "");
begin
if Pos = 0 then
-- No key-value separator: it is pure key
Key := To_Unbounded_String (Item);
Value := To_Unbounded_String (Default_Value);
elsif Pos = Item'Last then
-- The separator is at the end: value is the empty string
Key := To_Unbounded_String (Item (Item'First .. Pos - 1));
Value := Null_Unbounded_String;
else
-- The separator is at the end: value is the empty string
Key := To_Unbounded_String (Item (Item'First .. Pos - 1));
Value := To_Unbounded_String (Item (Pos + 1 .. Item'Last));
end if;
if Trim_Key then
Key := Trim (Key, Strings.Both);
end if;
if Key = "" then
raise Constraint_Error with "Empty key in '" & Item & "'";
end if;
if Trim_Value then
Value := Trim (Value, Strings.Both);
end if;
end Split_Key_Value;
function Manage_Case (X : String; How : Case_Action) return string
is ((case How is
when Force_Lower =>
Characters.Handling.To_Lower (X),
when Force_Upper =>
Characters.Handling.To_Upper (X),
when Keep =>
X));
function Manage_Case (X : Unbounded_String; How : Case_Action) return string
is (Manage_Case (To_String (X), How));
Entries : constant Token_List :=
Split (To_Be_Splitted => Input,
Separator => Entry_Separator,
Collate_Separator => True);
Result : Option_List;
begin
for Pair of Entries loop
declare
Key : Unbounded_String;
Value : Unbounded_String;
begin
Split_Key_Value (Pair, Key_Separator, Key, Value);
Result.Include (Key => Manage_Case (Key, Key_Case),
New_Item => To_String (Value));
end;
end loop;
return Result;
end Parse;
end Utilities.Option_Lists;
|
30,839
|
ada
| 3
|
Heziode/aoc-ada-2021
|
03/2/src/main.adb
|
with Ada.Containers.Vectors,
Ada.Exceptions,
Ada.Integer_Text_IO,
Ada.Strings.Unbounded,
Ada.Text_IO;
with Utils;
procedure Main is
use Ada.Containers, Ada.Strings.Unbounded, Ada.Text_IO;
use Utils;
subtype Binary_Values is Natural range 0 .. 1;
package Unbounded_String_Vectors is new Ada.Containers.Vectors (Natural, Unbounded_String);
use Unbounded_String_Vectors;
package Unbounded_String_Cursor_Vectors is new Ada.Containers.Vectors (Natural, Cursor);
type Rate_Arrays is array (Binary_Values'Range) of Natural;
type Binary_Maps is array (Binary_Values'Range) of Unbounded_String_Cursor_Vectors.Vector;
type Strategies is (Most_Common, Least_Common);
-- Given a String which represents a Natural in binary format, it returns the corresponding Natural.
-- @param Str A String which represents a Natural in binary format
-- @retuns Returns the corresponding Natural
function Binary_String_To_Number (Str : String) return Natural;
function Binary_String_To_Number (Str : String) return Natural
is
Exponent : Natural := Natural'First;
Result : Natural := Natural'First;
begin
for Elt of reverse Str loop
if Elt = '1' then
Result := Result + 2 ** Exponent;
end if;
Exponent := Exponent + 1;
end loop;
return Result;
end Binary_String_To_Number;
-- Find the result in a set of String which represents a Natural in binary format according to criteria.
-- @param Values Contains all values (String which represents a Natural in binary format) extracted from a file.
-- @param Rate Indicate how many 0s and 1s there are at index "Index".
-- @param Map An array (Called Map because each index corresponds to a filter) that contains for each index (0 and
-- 1) each values of Values that contain a 0 (for index 0 of Map) or a 1 (for index 1 of Map) at index "Index" in
-- the the value in Values.
-- @param Index This index denote the position in the binary string representation of a Natural.
-- @param Strategy The strategy to apply (Most Common, Least Common).
-- @retuns Return the value that match the criteria (Strategy)
function Find_Value_According_To_Criteria (Values : Vector;
Rate : Rate_Arrays;
Map : Binary_Maps;
Index : in out Positive;
Strategy : Strategies)
return Natural;
function Find_Value_According_To_Criteria (Values : Vector;
Rate : Rate_Arrays;
Map : Binary_Maps;
Index : in out Positive;
Strategy : Strategies)
return Natural
is
-- Filter the result for the next recursive call of Find_Value_According_To_Criteria.
-- @param Previous_Filtered_Values List of Cursor (pointing to value in Values) that match the previous
-- criteria.
-- @param Rate Indicate how many 0s and 1s there are at index "Index".
-- @param Map An array (Called Map because each index corresponds to a filter) that contains for each index (0
-- and 1) each values of Values that contain a 0 (for index 0 of Map) or a 1 (for index 1 of Map) at index
-- "Index" in the the value in Values.
procedure Filter (Previous_Filtered_Values : Unbounded_String_Cursor_Vectors.Vector;
Rate : in out Rate_Arrays;
Map : in out Binary_Maps);
procedure Filter (Previous_Filtered_Values : Unbounded_String_Cursor_Vectors.Vector;
Rate : in out Rate_Arrays;
Map : in out Binary_Maps)
is
Current_Value : Unbounded_String;
Binary_Value : Binary_Values;
begin
for Curs : Cursor of Previous_Filtered_Values loop
Current_Value := Element (Curs);
declare
Str : constant String := To_String (Current_Value);
begin
Binary_Value := Binary_Values'Value (Str (Index .. Index));
Map (Binary_Value).Append (Curs);
Rate (Binary_Value) := Rate (Binary_Value) + 1;
end;
end loop;
end Filter;
New_Rate : Rate_Arrays;
New_Map : Binary_Maps;
Filtered_Map_Index : Natural;
begin
-- Short-circuit in the case where before having gone through the whole bit chain, there is only one solution.
if Values.Length = 1 then
return Binary_String_To_Number (To_String (Values.First_Element));
end if;
-- Apply the bit criteria strategy
case Strategy is
when Most_Common =>
if Rate (1) > Rate (0) or else Rate (0) = Rate (1) then
-- Take in account values which contains a 1 at index "Index"
Filtered_Map_Index := 1;
else
-- Take in account values which contains a 0 at index "Index"
Filtered_Map_Index := 0;
end if;
when Least_Common =>
if Rate (1) > Rate (0) or else Rate (0) = Rate (1) then
-- Take in account values which contains a 0 at index "Index"
Filtered_Map_Index := 0;
else
-- Take in account values which contains a 0 at index "Index"
Filtered_Map_Index := 1;
end if;
end case;
Index := Index + 1;
-- If there is only one remaining value, is that it is the desired solution
if Map (Filtered_Map_Index).Length = 1 then
return Binary_String_To_Number (To_String (Element (Map (Filtered_Map_Index).First_Element)));
end if;
-- Apply the filter to the next Index
Filter (Previous_Filtered_Values => Map (Filtered_Map_Index),
Rate => New_Rate,
Map => New_Map);
return Find_Value_According_To_Criteria (Values => Values,
Rate => New_Rate,
Map => New_Map,
Index => Index,
Strategy => Strategy);
end Find_Value_According_To_Criteria;
File : File_Type;
Values : Vector;
Rate : Rate_Arrays := (others => Natural'First);
Bin_Map_Sort : Binary_Maps := (others => Unbounded_String_Cursor_Vectors.Empty_Vector);
Current_Index : Positive := Positive'First;
begin
Get_File (File);
-- Get all values
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
First_Value : constant Binary_Values := Binary_Values'Value (Line (Line'First .. Line'First));
begin
Values.Append (To_Unbounded_String (Line));
Bin_Map_Sort (First_Value).Append (Values.Last);
Rate (First_Value) := Rate (First_Value) + 1;
end;
end loop;
Put_Result : declare
Oxygen_Generator_Rating : constant Natural := Find_Value_According_To_Criteria (Values => Values,
Rate => Rate,
Map => Bin_Map_Sort,
Index => Current_Index,
Strategy => Most_Common);
CO2_Scrubber_Rating : Natural;
begin
Current_Index := Positive'First;
CO2_Scrubber_Rating := Find_Value_According_To_Criteria (Values => Values,
Rate => Rate,
Map => Bin_Map_Sort,
Index => Current_Index,
Strategy => Least_Common);
Put ("Result: ");
Ada.Integer_Text_IO.Put (Item => Oxygen_Generator_Rating * CO2_Scrubber_Rating,
Width => 0);
New_Line;
end Put_Result;
Close_If_Open (File);
exception
when Occur : others =>
Put_Line ("Error: " & Ada.Exceptions.Exception_Message (Occur));
Close_If_Open (File);
end Main;
|
30,840
|
ada
| 4
|
MOUDDENEHamza/ENSEEIHT
|
1A/S5/PIM/projet/src/alea.ads
|
<reponame>MOUDDENEHamza/ENSEEIHT<filename>1A/S5/PIM/projet/src/alea.ads
generic
Lower_Bound, Upper_Bound : Integer; -- bounds in which random numbers are generated
-- { Lower_Bound <= Upper_Bound }
package Alea is
-- Compute a random number in the range Lower_Bound..Upper_Bound.
--
-- Notice that Ada advocates the definition of a range type in such a case
-- to ensure that the type reflects the real possible values.
procedure Get_Random_Number (Resultat : out Integer);
end Alea;
|
30,841
|
ada
| 1
|
LaudateCorpus1/RosettaCodeData
|
Task/Sorting-algorithms-Heapsort/Ada/sorting-algorithms-heapsort-1.ada
|
generic
type Element_Type is private;
type Index_Type is (<>);
type Collection is array(Index_Type range <>) of Element_Type;
with function "<" (Left, right : element_type) return boolean is <>;
procedure Generic_Heapsort(Item : in out Collection);
|
30,842
|
ada
| 1
|
vidkidz/crossbridge
|
llvm-gcc-4.2-2.9/gcc/ada/g-tasloc.ads
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . T A S K _ L O C K --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2005, 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. --
-- --
------------------------------------------------------------------------------
-- Simple task lock and unlock routines
-- A small package containing a task lock and unlock routines for creating
-- a critical region. The lock involved is a global lock, shared by all
-- tasks, and by all calls to these routines, so these routines should be
-- used with care to avoid unnecessary reduction of concurrency.
-- These routines may be used in a non-tasking program, and in that case
-- they have no effect (they do NOT cause the tasking runtime to be loaded).
package GNAT.Task_Lock is
pragma Elaborate_Body;
procedure Lock;
pragma Inline (Lock);
-- Acquires the global lock, starts the execution of a critical region
-- which no other task can enter until the locking task calls Unlock
procedure Unlock;
pragma Inline (Unlock);
-- Releases the global lock, allowing another task to successfully
-- complete a Lock operation. Terminates the critical region.
--
-- The recommended protocol for using these two procedures is as
-- follows:
--
-- Locked_Processing : begin
-- Lock;
-- ...
-- TSL.Unlock;
--
-- exception
-- when others =>
-- Unlock;
-- raise;
-- end Locked_Processing;
--
-- This ensures that the lock is not left set if an exception is raised
-- explicitly or implicitly during the critical locked region.
--
-- Note on multiple calls to Lock: It is permissible to call Lock
-- more than once with no intervening Unlock from a single task,
-- and the lock will not be released until the corresponding number
-- of Unlock operations has been performed. For example:
--
-- GNAT.Task_Lock.Lock; -- acquires lock
-- GNAT.Task_Lock.Lock; -- no effect
-- GNAT.Task_Lock.Lock; -- no effect
-- GNAT.Task_Lock.Unlock; -- no effect
-- GNAT.Task_Lock.Unlock; -- no effect
-- GNAT.Task_Lock.Unlock; -- releases lock
--
-- However, as previously noted, the Task_Lock facility should only
-- be used for very local locks where the probability of conflict is
-- low, so usually this kind of nesting is not a good idea in any case.
-- In more complex locking situations, it is more appropriate to define
-- an appropriate protected type to provide the required locking.
--
-- It is an error to call Unlock when there has been no prior call to
-- Lock. The effect of such an erroneous call is undefined, and may
-- result in deadlock, or other malfunction of the run-time system.
end GNAT.Task_Lock;
|
30,843
|
ada
| 0
|
bkold/Ada_Sandpiles
|
main.adb
|
<reponame>bkold/Ada_Sandpiles<filename>main.adb<gh_stars>0
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Real_Time;
with Ada.Unchecked_Conversion;
procedure Main is
pragma Suppress(All_Checks);
Matrix_Size : constant := 3200;
type Matrix_Range is range 0 .. Matrix_Size - 1;
Bound_High, Bound_Low : Matrix_Range;
type Pile is range 0..7 with Size=>8;
type Pile_Pointer is access all Pile;
type Generic_Matrix_Row is array (Matrix_Range range <>) of aliased Pile with Pack;
subtype Matrix_Row is Generic_Matrix_Row(Matrix_Range);
subtype Matrix_Sub_Row is Generic_Matrix_Row(0..7);
type Matrix is array (Matrix_Range) of Matrix_Row with Pack;
type Matrix_Pointer is access all Matrix;
type m128i is array (0 .. 15) of Pile with Pack, Alignment=>16;
pragma Machine_Attribute (m128i, "vector_type");
pragma Machine_Attribute (m128i, "may_alias");
----------------------------------------------------------------------
function ia32_Add (X, Y : m128i) return m128i with Inline;
pragma Import (Intrinsic, ia32_Add, "__builtin_ia32_paddb128");
function ia32_Load (X : Pile_Pointer) return m128i with Inline;
pragma Import (Intrinsic, ia32_Load, "__builtin_ia32_loaddqu");
procedure ia32_Store (X : Pile_Pointer; Y : m128i) with Inline;
pragma Import (Intrinsic, ia32_Store, "__builtin_ia32_storedqu");
procedure Print (Map : in Matrix; Name : in String) is
begin
Put_Line(Name);
for I in Bound_Low .. Bound_High loop
for J in Bound_Low .. Bound_High loop
Put(Pile'Image(Map(I)(J)));
end loop;
New_Line(1);
end loop;
Put_Line("------------");
end;
function Topple (Base : in Matrix_Pointer) return Boolean is
type Mod_64 is mod 2**64;
type Mod_64_Array is array (0..1) of aliased Mod_64;
type Mod_64_Pointer is access all Mod_64;
function ia32_Load (X : Mod_64_Pointer) return m128i with Inline;
pragma Import (Intrinsic, ia32_Load, "__builtin_ia32_loaddqu");
function Move is new Ada.Unchecked_Conversion (Source=>Mod_64, Target=>Matrix_Sub_Row);
function Move is new Ada.Unchecked_Conversion (Source=>Matrix_Sub_Row, Target=>Mod_64);
Changed : Boolean := False;
Local_Bound_High : constant Matrix_Range := Bound_High;
Local_Bound_Low : constant Matrix_Range := Bound_Low;
I : Matrix_Range := Bound_Low;
Temp_Values : Mod_64_Array;
begin
while I <= Local_Bound_High loop
declare
J : Matrix_Range := Local_Bound_Low - (Local_Bound_Low mod 16);
Temp : m128i;
Sum_m128i_Buffer : m128i;
Upper_Sum_m128i_Buffer : m128i;
Lower_Sum_m128i_Buffer : m128i;
begin
while J <= Local_Bound_High loop
Temp_Values(0) := (Move(Base(I)(J..J+7)) / 2**2) AND 16#0F0F0F0F0F0F0F0F#;
Temp_Values(1) := (Move(Base(I)(J+8..J+15)) / 2**2) AND 16#0F0F0F0F0F0F0F0F#;
if (Temp_Values(0) OR Temp_Values(1)) /= 0 then
Changed := True;
if I - 1 < Bound_Low then
Bound_Low := Bound_Low - 1;
Bound_High := Bound_High + 1;
end if;
Temp := ia32_Load(Temp_Values(0)'Access);
Upper_Sum_m128i_Buffer := ia32_Load(Base(I-1)(J)'Access);
ia32_Store(Base(I-1)(J)'Access, ia32_Add(Upper_Sum_m128i_Buffer, Temp));
Lower_Sum_m128i_Buffer := ia32_Load(Base(I+1)(J)'Access);
ia32_Store(Base(I+1)(J)'Access, ia32_Add(Lower_Sum_m128i_Buffer, Temp));
Sum_m128i_Buffer := ia32_Load(Base(I)(J-1)'Access);
ia32_Store(Base(I)(J-1)'Access, ia32_Add(Sum_m128i_Buffer, Temp));
Sum_m128i_Buffer := ia32_Load(Base(I)(J+1)'Access);
ia32_Store(Base(I)(J+1)'Access, ia32_Add(Sum_m128i_Buffer, Temp));
Base(I)(J..J+7) := Move(Move(Base(I)(J..J+7)) - (Temp_Values(0) * 4));
Base(I)(J+8..J+15) := Move(Move(Base(I)(J+8..J+15)) - (Temp_Values(1) * 4));
end if;
J := J + 16;
end loop;
end;
I := I + 1;
end loop;
return Changed;
end Topple;
function Drip (Value : in out Natural) return Pile with Inline is
begin
if Value /= 0 then
Value := Value - 4;
return 4;
else
return 0;
end if;
end Drip;
procedure Color (Item : in Matrix) with Import, Convention=>C, Link_Name=>"color_map";
----------------------------------------------------------------------
Base_Matrix : constant Matrix_Pointer := new Matrix'(others=>(others=>0));
Input_Sand_Stream : Natural := Natural'Value(Argument(1));
Center : constant Matrix_Range := Matrix_Range'Last/2;
begin
if Input_Sand_Stream mod 4 /= 0 then
raise Constraint_Error with "Input should be multiple for 4";
end if;
if Matrix_Size mod 16 /= 0 then
raise Constraint_Error with "Compiled with a bad matrix size";
end if;
if Natural(Matrix_Size**2 * 1.5) < Input_Sand_Stream then
raise Constraint_Error with "Optimazation accounting for an infinite plane makes that input dangerous";
end if;
Bound_High := Center;
Bound_Low := Center;
Base_Matrix(Center)(Center) := Base_Matrix(Center)(Center) + Drip(Input_Sand_Stream);
declare
use type Ada.Real_Time.Time;
Start_Time :constant Ada.Real_Time.Time := Ada.Real_Time.Clock;
End_Time : Ada.Real_Time.Time;
begin
while Topple(Base_Matrix) loop
if Input_Sand_Stream mod 2048 = 0 then
Put_Line(Natural'Image(Input_Sand_Stream));
Put_Line(Matrix_Range'Image(Bound_High));
Put_Line(Matrix_Range'Image(Bound_Low));
end if;
if Base_Matrix(Center)(Center) < 4 then
Base_Matrix(Center)(Center) := Base_Matrix(Center)(Center) + Drip(Input_Sand_Stream);
end if;
end loop;
End_Time := Ada.Real_Time.Clock;
Put_Line(Duration'Image(Ada.Real_Time.To_Duration(End_Time-Start_Time)));
Put_Line("Printing...");
end;
Color(Base_Matrix.all);
end Main;
|
30,844
|
ada
| 0
|
JCGobbi/Nucleo-STM32G474RE
|
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-cohata.ads
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . H A S H _ T A B L E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2021, 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/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
-- This package declares the hash-table type used to implement hashed
-- containers.
with Ada.Containers.Helpers;
package Ada.Containers.Hash_Tables is
pragma Pure;
-- Declare Pure so this can be imported by Remote_Types packages
generic
type Node_Type (<>) is limited private;
type Node_Access is access Node_Type;
package Generic_Hash_Table_Types is
type Buckets_Type is array (Hash_Type range <>) of Node_Access;
type Buckets_Access is access all Buckets_Type;
for Buckets_Access'Storage_Size use 0;
-- Storage_Size of zero so this package can be Pure
type Hash_Table_Type is tagged record
Buckets : Buckets_Access := null;
Length : Count_Type := 0;
TC : aliased Helpers.Tamper_Counts;
end record;
package Implementation is new Helpers.Generic_Implementation;
end Generic_Hash_Table_Types;
generic
type Node_Type is private;
package Generic_Bounded_Hash_Table_Types is
type Nodes_Type is array (Count_Type range <>) of Node_Type;
type Buckets_Type is array (Hash_Type range <>) of Count_Type;
type Hash_Table_Type
(Capacity : Count_Type;
Modulus : Hash_Type) is
tagged record
Length : Count_Type := 0;
TC : aliased Helpers.Tamper_Counts;
Free : Count_Type'Base := -1;
Nodes : Nodes_Type (1 .. Capacity);
Buckets : Buckets_Type (1 .. Modulus) := (others => 0);
end record;
package Implementation is new Helpers.Generic_Implementation;
end Generic_Bounded_Hash_Table_Types;
end Ada.Containers.Hash_Tables;
|
30,845
|
ada
| 1
|
jed-frey/e200-gcc
|
build_gnu/binutils/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/foo.adb
|
-- Copyright 2012-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, 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
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
type Table is array (Positive range <>) of Integer;
type Table_Access is access Table;
type Object (N : Integer) is record
Ptr : Table_Access;
Data : Table (1 .. N);
end record;
My_Object : Object := (N => 3, Ptr => null, Data => (3, 5, 8));
-- Same as above, but with a pointer to an unconstrained packed array.
type Byte is range 0 .. 255;
type P_Table is array (Positive range <>) of Byte;
pragma Pack (P_Table);
type P_Table_Access is access P_Table;
type P_Object (N : Integer) is record
Ptr : P_Table_Access;
Data : P_Table (1 .. N);
end record;
My_P_Object : P_Object := (N => 3, Ptr => null, Data => (3, 5, 8));
begin
My_Object.Ptr := new Table'(13, 21, 34); -- STOP1
My_P_Object.Ptr := new P_Table'(13, 21, 34);
Do_Nothing (My_Object'Address); -- STOP2
Do_Nothing (My_P_Object'Address);
end Foo;
|
30,846
|
ada
| 1
|
LaudateCorpus1/RosettaCodeData
|
Task/Sort-an-array-of-composite-structures/Ada/sort-an-array-of-composite-structures-1.ada
|
<gh_stars>1-10
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Generic_Array_Sort;
procedure Demo_Array_Sort is
function "+" (S : String) return Unbounded_String renames To_Unbounded_String;
type A_Composite is
record
Name : Unbounded_String;
Value : Unbounded_String;
end record;
function "<" (L, R : A_Composite) return Boolean is
begin
return L.Name < R.Name;
end "<";
procedure Put_Line (C : A_Composite) is
begin
Put_Line (To_String (C.Name) & " " & To_String (C.Value));
end Put_Line;
type An_Array is array (Natural range <>) of A_Composite;
procedure Sort is new Ada.Containers.Generic_Array_Sort (Natural, A_Composite, An_Array);
Data : An_Array := (1 => (Name => +"Joe", Value => +"5531"),
2 => (Name => +"Adam", Value => +"2341"),
3 => (Name => +"Bernie", Value => +"122"),
4 => (Name => +"Walter", Value => +"1234"),
5 => (Name => +"David", Value => +"19"));
begin
Sort (Data);
for I in Data'Range loop
Put_Line (Data (I));
end loop;
end Demo_Array_Sort;
|
30,847
|
ada
| 30
|
jscparker/math_packages
|
ordinary/sinu_2.adb
|
<reponame>jscparker/math_packages
package body Sinu_2 is
function Norm (Y : Dynamical_Variable)
return Real
is
Sum : Real := +0.0;
begin
for i in Dyn_Index loop
Sum := Sum + Abs Y(i);
--Sum := Sum + Y(i) * Y(i);
end loop;
return Sum;
end Norm;
function "-"
(Left : Dynamical_Variable;
Right : Dynamical_Variable)
return Dynamical_Variable
is
Result : Dynamical_Variable;
begin
for I in Dyn_Index loop
Result(I) := Left(I) - Right(I);
end loop;
return Result;
end "-";
function "*"
(Left : Real;
Right : Dynamical_Variable)
return Dynamical_Variable
is
Result : Dynamical_Variable;
begin
for I in Dyn_Index loop
Result(I) := Left * Right(I);
end loop;
return Result;
end "*";
function "+"
(Left : Dynamical_Variable;
Right : Dynamical_Variable)
return Dynamical_Variable
is
Result : Dynamical_Variable;
begin
for I in Dyn_Index loop
Result(I) := Left(I) + Right(I);
end loop;
return Result;
end "+";
-- The differential equation is (d/dt)^2 Y = F (t, Y)
function F
(Time : Real;
Y : Dynamical_Variable)
return Dynamical_Variable
is
Second_Deriv : Dynamical_Variable;
begin
Second_Deriv(0) := -Y(0);
Second_Deriv(1) := 0.0; -- just ignore 2nd component.
return Second_Deriv;
end F;
end Sinu_2;
|
30,848
|
ada
| 0
|
alire-project/sdlada
|
src/image/sdl-images.adb
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2018 <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.Images
--------------------------------------------------------------------------------------------------------------------
with SDL.Error;
package body SDL.Images is
use type C.char_array;
use type C.int;
Format_Strings : constant Format_String_Arrays :=
("TGA" & C.char'Val (0) & C.char'Val (0),
"CUR" & C.char'Val (0) & C.char'Val (0),
"ICO" & C.char'Val (0) & C.char'Val (0),
"BMP" & C.char'Val (0) & C.char'Val (0),
"GIF" & C.char'Val (0) & C.char'Val (0),
"JPG" & C.char'Val (0) & C.char'Val (0),
"LBM" & C.char'Val (0) & C.char'Val (0),
"PCX" & C.char'Val (0) & C.char'Val (0),
"PNG" & C.char'Val (0) & C.char'Val (0),
"PNM" & C.char'Val (0) & C.char'Val (0),
"TIF" & C.char'Val (0) & C.char'Val (0),
"XCF" & C.char'Val (0) & C.char'Val (0),
"XPM" & C.char'Val (0) & C.char'Val (0),
"XV" & C.char'Val (0) & C.char'Val (0) & C.char'Val (0),
"WEBP" & C.char'Val (0));
overriding
function Initialise (Flags : in Init_Image_Flags := Enable_Everything) return Boolean is
function IMG_Init (Flags : in Init_Image_Flags) return Init_Image_Flags with
Import => True,
Convention => C,
External_Name => "IMG_Init";
Result : Init_Image_Flags := IMG_Init (Flags);
begin
if Result = 0 then
return False;
end if;
return True;
end Initialise;
function Format_String (Format : in Formats) return Format_String_Names is
begin
return Format_Strings (Format);
end Format_String;
end SDL.Images;
|
30,849
|
ada
| 0
|
reznikmm/gela
|
source/oasis/program-element_filters.ads
|
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements;
package Program.Element_Filters is
pragma Pure;
function Is_Pragma
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Pragma);
function Is_Defining_Name
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Defining_Name);
function Is_Defining_Identifier
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Defining_Identifier);
function Is_Defining_Character_Literal
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Defining_Character_Literal);
function Is_Defining_Operator_Symbol
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Defining_Operator_Symbol);
function Is_Defining_Expanded_Name
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Defining_Expanded_Name);
function Is_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Declaration);
function Is_Type_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Type_Declaration);
function Is_Task_Type_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Task_Type_Declaration);
function Is_Protected_Type_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Protected_Type_Declaration);
function Is_Subtype_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Subtype_Declaration);
function Is_Object_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Object_Declaration);
function Is_Single_Task_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Single_Task_Declaration);
function Is_Single_Protected_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Single_Protected_Declaration);
function Is_Number_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Number_Declaration);
function Is_Enumeration_Literal_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Enumeration_Literal_Specification);
function Is_Discriminant_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discriminant_Specification);
function Is_Component_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Component_Declaration);
function Is_Loop_Parameter_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Loop_Parameter_Specification);
function Is_Generalized_Iterator_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generalized_Iterator_Specification);
function Is_Element_Iterator_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Element_Iterator_Specification);
function Is_Procedure_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Procedure_Declaration);
function Is_Function_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Declaration);
function Is_Parameter_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Parameter_Specification);
function Is_Procedure_Body_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Procedure_Body_Declaration);
function Is_Function_Body_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Body_Declaration);
function Is_Return_Object_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Return_Object_Specification);
function Is_Package_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Package_Declaration);
function Is_Package_Body_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Package_Body_Declaration);
function Is_Object_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Object_Renaming_Declaration);
function Is_Exception_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Exception_Renaming_Declaration);
function Is_Procedure_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Procedure_Renaming_Declaration);
function Is_Function_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Renaming_Declaration);
function Is_Package_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Package_Renaming_Declaration);
function Is_Generic_Package_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generic_Package_Renaming_Declaration);
function Is_Generic_Procedure_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generic_Procedure_Renaming_Declaration);
function Is_Generic_Function_Renaming_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generic_Function_Renaming_Declaration);
function Is_Task_Body_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Task_Body_Declaration);
function Is_Protected_Body_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Protected_Body_Declaration);
function Is_Entry_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Entry_Declaration);
function Is_Entry_Body_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Entry_Body_Declaration);
function Is_Entry_Index_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Entry_Index_Specification);
function Is_Procedure_Body_Stub
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Procedure_Body_Stub);
function Is_Function_Body_Stub
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Body_Stub);
function Is_Package_Body_Stub
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Package_Body_Stub);
function Is_Task_Body_Stub
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Task_Body_Stub);
function Is_Protected_Body_Stub
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Protected_Body_Stub);
function Is_Exception_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Exception_Declaration);
function Is_Choice_Parameter_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Choice_Parameter_Specification);
function Is_Generic_Package_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generic_Package_Declaration);
function Is_Generic_Procedure_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generic_Procedure_Declaration);
function Is_Generic_Function_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Generic_Function_Declaration);
function Is_Package_Instantiation
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Package_Instantiation);
function Is_Procedure_Instantiation
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Procedure_Instantiation);
function Is_Function_Instantiation
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Instantiation);
function Is_Formal_Object_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Object_Declaration);
function Is_Formal_Type_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Type_Declaration);
function Is_Formal_Procedure_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Procedure_Declaration);
function Is_Formal_Function_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Function_Declaration);
function Is_Formal_Package_Declaration
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Package_Declaration);
function Is_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Definition);
function Is_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Type_Definition);
function Is_Subtype_Indication
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Subtype_Indication);
function Is_Constraint
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Constraint);
function Is_Component_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Component_Definition);
function Is_Discrete_Range
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discrete_Range);
function Is_Discrete_Subtype_Indication
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discrete_Subtype_Indication);
function Is_Discrete_Range_Attribute_Reference
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discrete_Range_Attribute_Reference);
function Is_Discrete_Simple_Expression_Range
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discrete_Simple_Expression_Range);
function Is_Unknown_Discriminant_Part
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Unknown_Discriminant_Part);
function Is_Known_Discriminant_Part
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Known_Discriminant_Part);
function Is_Record_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Record_Definition);
function Is_Null_Component
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Null_Component);
function Is_Variant_Part
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Variant_Part);
function Is_Variant
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Variant);
function Is_Others_Choice
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Others_Choice);
function Is_Anonymous_Access_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Anonymous_Access_Definition);
function Is_Anonymous_Access_To_Object
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Anonymous_Access_To_Object);
function Is_Anonymous_Access_To_Procedure
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Anonymous_Access_To_Procedure);
function Is_Anonymous_Access_To_Function
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Anonymous_Access_To_Function);
function Is_Private_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Private_Type_Definition);
function Is_Private_Extension_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Private_Extension_Definition);
function Is_Incomplete_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Incomplete_Type_Definition);
function Is_Task_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Task_Definition);
function Is_Protected_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Protected_Definition);
function Is_Formal_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Type_Definition);
function Is_Aspect_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Aspect_Specification);
function Is_Real_Range_Specification
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Real_Range_Specification);
function Is_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Expression);
function Is_Numeric_Literal
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Numeric_Literal);
function Is_String_Literal
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_String_Literal);
function Is_Identifier
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Identifier);
function Is_Operator_Symbol
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Operator_Symbol);
function Is_Character_Literal
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Character_Literal);
function Is_Explicit_Dereference
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Explicit_Dereference);
function Is_Infix_Operator
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Infix_Operator);
function Is_Function_Call
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Call);
function Is_Indexed_Component
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Indexed_Component);
function Is_Slice
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Slice);
function Is_Selected_Component
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Selected_Component);
function Is_Attribute_Reference
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Attribute_Reference);
function Is_Record_Aggregate
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Record_Aggregate);
function Is_Extension_Aggregate
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Extension_Aggregate);
function Is_Array_Aggregate
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Array_Aggregate);
function Is_Short_Circuit_Operation
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Short_Circuit_Operation);
function Is_Membership_Test
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Membership_Test);
function Is_Null_Literal
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Null_Literal);
function Is_Parenthesized_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Parenthesized_Expression);
function Is_Raise_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Raise_Expression);
function Is_Type_Conversion
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Type_Conversion);
function Is_Qualified_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Qualified_Expression);
function Is_Allocator
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Allocator);
function Is_Case_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Case_Expression);
function Is_If_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_If_Expression);
function Is_Quantified_Expression
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Quantified_Expression);
function Is_Association
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Association);
function Is_Discriminant_Association
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discriminant_Association);
function Is_Record_Component_Association
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Record_Component_Association);
function Is_Array_Component_Association
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Array_Component_Association);
function Is_Parameter_Association
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Parameter_Association);
function Is_Formal_Package_Association
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Package_Association);
function Is_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Statement);
function Is_Null_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Null_Statement);
function Is_Assignment_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Assignment_Statement);
function Is_If_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_If_Statement);
function Is_Case_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Case_Statement);
function Is_Loop_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Loop_Statement);
function Is_While_Loop_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_While_Loop_Statement);
function Is_For_Loop_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_For_Loop_Statement);
function Is_Block_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Block_Statement);
function Is_Exit_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Exit_Statement);
function Is_Goto_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Goto_Statement);
function Is_Call_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Call_Statement);
function Is_Simple_Return_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Simple_Return_Statement);
function Is_Extended_Return_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Extended_Return_Statement);
function Is_Accept_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Accept_Statement);
function Is_Requeue_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Requeue_Statement);
function Is_Delay_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Delay_Statement);
function Is_Terminate_Alternative_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Terminate_Alternative_Statement);
function Is_Select_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Select_Statement);
function Is_Abort_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Abort_Statement);
function Is_Raise_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Raise_Statement);
function Is_Code_Statement
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Code_Statement);
function Is_Path
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Path);
function Is_Elsif_Path
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Elsif_Path);
function Is_Case_Path
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Case_Path);
function Is_Select_Path
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Select_Path);
function Is_Case_Expression_Path
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Case_Expression_Path);
function Is_Elsif_Expression_Path
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Elsif_Expression_Path);
function Is_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Clause);
function Is_Use_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Use_Clause);
function Is_With_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_With_Clause);
function Is_Representation_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Representation_Clause);
function Is_Component_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Component_Clause);
function Is_Derived_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Derived_Type);
function Is_Derived_Record_Extension
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Derived_Record_Extension);
function Is_Enumeration_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Enumeration_Type);
function Is_Signed_Integer_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Signed_Integer_Type);
function Is_Modular_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Modular_Type);
function Is_Root_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Root_Type);
function Is_Floating_Point_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Floating_Point_Type);
function Is_Ordinary_Fixed_Point_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Ordinary_Fixed_Point_Type);
function Is_Decimal_Fixed_Point_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Decimal_Fixed_Point_Type);
function Is_Unconstrained_Array_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Unconstrained_Array_Type);
function Is_Constrained_Array_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Constrained_Array_Type);
function Is_Record_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Record_Type);
function Is_Interface_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Interface_Type);
function Is_Object_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Object_Access_Type);
function Is_Procedure_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Procedure_Access_Type);
function Is_Function_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Function_Access_Type);
function Is_Formal_Private_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Private_Type_Definition);
function Is_Formal_Derived_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Derived_Type_Definition);
function Is_Formal_Discrete_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Discrete_Type_Definition);
function Is_Formal_Signed_Integer_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Signed_Integer_Type_Definition);
function Is_Formal_Modular_Type_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Modular_Type_Definition);
function Is_Formal_Floating_Point_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Floating_Point_Definition);
function Is_Formal_Ordinary_Fixed_Point_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Ordinary_Fixed_Point_Definition);
function Is_Formal_Decimal_Fixed_Point_Definition
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Decimal_Fixed_Point_Definition);
function Is_Formal_Unconstrained_Array_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Unconstrained_Array_Type);
function Is_Formal_Constrained_Array_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Constrained_Array_Type);
function Is_Formal_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Access_Type);
function Is_Formal_Object_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Object_Access_Type);
function Is_Formal_Procedure_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Procedure_Access_Type);
function Is_Formal_Function_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Function_Access_Type);
function Is_Formal_Interface_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Formal_Interface_Type);
function Is_Access_Type
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Access_Type);
function Is_Range_Attribute_Reference
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Range_Attribute_Reference);
function Is_Simple_Expression_Range
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Simple_Expression_Range);
function Is_Digits_Constraint
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Digits_Constraint);
function Is_Delta_Constraint
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Delta_Constraint);
function Is_Index_Constraint
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Index_Constraint);
function Is_Discriminant_Constraint
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Discriminant_Constraint);
function Is_Attribute_Definition_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Attribute_Definition_Clause);
function Is_Enumeration_Representation_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Enumeration_Representation_Clause);
function Is_Record_Representation_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Record_Representation_Clause);
function Is_At_Clause
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_At_Clause);
function Is_Exception_Handler
(Self : not null Program.Elements.Element_Access) return Boolean is
(Self.Is_Exception_Handler);
end Program.Element_Filters;
|
30,850
|
ada
| 60
|
RREE/ada-util
|
regtests/util-concurrent-tests.ads
|
-----------------------------------------------------------------------
-- concurrency.tests -- Unit tests for concurrency package
-- Copyright (C) 2009, 2010, 2011, 2012, 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 Util.Tests;
package Util.Concurrent.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Increment (T : in out Test);
procedure Test_Decrement (T : in out Test);
procedure Test_Decrement_And_Test (T : in out Test);
procedure Test_Copy (T : in out Test);
-- Test concurrent pool
procedure Test_Pool (T : in out Test);
-- Test concurrent pool
procedure Test_Concurrent_Pool (T : in out Test);
-- Test fifo.
procedure Test_Fifo (T : in out Test);
-- Test concurrent aspects of fifo.
procedure Test_Concurrent_Fifo (T : in out Test);
-- Test concurrent arrays.
procedure Test_Array (T : in out Test);
-- Test concurrent sequences.
procedure Test_Concurrent_Sequences (T : in out Test);
end Util.Concurrent.Tests;
|
30,851
|
ada
| 0
|
persan/a-taglib
|
tests/src/taglib-tests.ads
|
package taglib.Tests is
end taglib.Tests;
|
30,852
|
ada
| 12
|
mgrojo/protobuf
|
source/runtime/pb_support-internal.adb
|
-- MIT License
--
-- Copyright (c) 2020 <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 Ada.Unchecked_Conversion;
with League.Text_Codecs;
package body PB_Support.Internal is
use type Ada.Streams.Stream_Element_Count;
procedure Write
(Self : in out Stream;
Value : Boolean)
with Inline;
procedure Write
(Self : in out Stream;
Value : Interfaces.IEEE_Float_32)
with Inline;
procedure Write
(Self : in out Stream;
Value : Interfaces.IEEE_Float_64)
with Inline;
procedure Write
(Self : in out Stream;
Value : League.Strings.Universal_String)
with Inline;
procedure Write
(Self : in out Stream;
Value : League.Stream_Element_Vectors.Stream_Element_Vector)
with Inline;
procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Unsigned_32)
with Inline;
procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Unsigned_64)
with Inline;
procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Integer_64)
with Inline;
procedure Write_Zigzag
(Self : in out Stream;
Value : Interfaces.Integer_32)
with Inline;
procedure Write_Zigzag
(Self : in out Stream;
Value : Interfaces.Integer_64)
with Inline;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Integer_32)
with Inline;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Integer_64)
with Inline;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Unsigned_32)
with Inline;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Unsigned_64)
with Inline;
----------
-- Size --
----------
function Size (Value : Interfaces.Unsigned_32)
return Ada.Streams.Stream_Element_Count
is
use type Interfaces.Unsigned_32;
Left : Interfaces.Unsigned_32 := Value;
Last : Ada.Streams.Stream_Element_Count := 0;
begin
while Left >= 16#80# loop
Last := Last + 1;
Left := Interfaces.Shift_Right (Left, 7);
end loop;
Last := Last + 1;
return Last;
end Size;
function Size (Value : Interfaces.Unsigned_64)
return Ada.Streams.Stream_Element_Count
is
use type Interfaces.Unsigned_64;
Left : Interfaces.Unsigned_64 := Value;
Last : Ada.Streams.Stream_Element_Count := 0;
begin
while Left >= 16#80# loop
Last := Last + 1;
Left := Interfaces.Shift_Right (Left, 7);
end loop;
Last := Last + 1;
return Last;
end Size;
function Size (Value : Interfaces.Integer_32)
return Ada.Streams.Stream_Element_Count
is
use type Interfaces.Integer_32;
begin
if Value < 0 then
return 10;
else
return Size (Interfaces.Unsigned_32 (Value));
end if;
end Size;
function Size (Value : Interfaces.Integer_64)
return Ada.Streams.Stream_Element_Count
is
use type Interfaces.Integer_64;
begin
if Value < 0 then
return 10;
else
return Size (Interfaces.Unsigned_64 (Value));
end if;
end Size;
-------------------
-- Start_Message --
-------------------
not overriding procedure Start_Message
(Self : in out Stream)
is
begin
Self.Level := Self.Level + 1;
if Self.Level = 2 then
Self.Riffling := not Self.Riffling;
if Self.Riffling then
Self.Size.Clear;
Self.Size.Set_Length (0);
Self.Index := 1;
end if;
end if;
if Self.Riffling then
Self.Size.Append (Self.Written);
Self.Stack.Append (Self.Size.Last_Index);
elsif Self.Level > 1 then
Self.Write (Self.Size (Self.Index));
Self.Index := Self.Index + 1;
end if;
end Start_Message;
-----------------
-- End_Message --
-----------------
not overriding function End_Message
(Self : in out Stream) return Boolean
is
Id : Message_Id;
begin
if Self.Riffling then
Id := Self.Stack.Last_Element;
Self.Stack.Delete_Last;
Self.Size (Id) := Self.Written - Self.Size (Id);
Self.Write (Self.Size (Id));
end if;
Self.Level := Self.Level - 1;
return Self.Level = 1 and Self.Riffling;
end End_Message;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : Boolean) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write (Value);
end Write;
-----------
-- Write --
-----------
procedure Write (Self : in out Stream; Value : Boolean) is
begin
if Self.Riffling then
Self.Written := Self.Written + 1;
elsif Value then
Self.Parent.Write ((1 => 1));
else
Self.Parent.Write ((1 => 0));
end if;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Boolean_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write (Field, Value.Get (J));
end loop;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.IEEE_Float_32)
is
begin
Self.Write_Key ((Field, Fixed_32));
Self.Write (Value);
end Write;
-----------
-- Write --
-----------
procedure Write
(Self : in out Stream;
Value : Interfaces.IEEE_Float_32) is
begin
if Self.Riffling then
Self.Written := Self.Written + 4;
else
Interfaces.IEEE_Float_32'Write (Self.Parent, Value);
end if;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.IEEE_Float_32_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write (Field, Value.Get (J));
end loop;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.IEEE_Float_64_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write (Field, Value.Get (J));
end loop;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.IEEE_Float_64)
is
begin
Self.Write_Key ((Field, Fixed_64));
Self.Write (Value);
end Write;
-----------
-- Write --
-----------
procedure Write
(Self : in out Stream;
Value : Interfaces.IEEE_Float_64) is
begin
if Self.Riffling then
Self.Written := Self.Written + 8;
else
Interfaces.IEEE_Float_64'Write (Self.Parent, Value);
end if;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : League.Strings.Universal_String) is
begin
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Value);
end Write;
-----------
-- Write --
-----------
procedure Write
(Self : in out Stream;
Value : League.Strings.Universal_String)
is
Codec : constant League.Text_Codecs.Text_Codec :=
League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("utf-8"));
Data : constant League.Stream_Element_Vectors.Stream_Element_Vector :=
Codec.Encode (Value);
begin
Self.Write (Data);
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : League.String_Vectors.Universal_String_Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write (Field, Value.Element (J));
end loop;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Stream_Element_Vector_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write (Field, Value.Get (J));
end loop;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Stream;
Field : Field_Number;
Value : League.Stream_Element_Vectors.Stream_Element_Vector) is
begin
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Value);
end Write;
-----------
-- Write --
-----------
procedure Write
(Self : in out Stream;
Value : League.Stream_Element_Vectors.Stream_Element_Vector)
is
begin
Self.Write (Value.Length);
if Self.Riffling then
Self.Written := Self.Written + Value.Length;
else
Self.Parent.Write (Value.To_Stream_Element_Array);
end if;
end Write;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_32) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write_Varint (Value);
end Write_Varint;
------------------
-- Write_Varint --
------------------
procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Unsigned_32)
is
use type Interfaces.Unsigned_32;
Left : Interfaces.Unsigned_32 := Value;
Data : Ada.Streams.Stream_Element_Array (1 .. 32 / 7 + 1);
Last : Ada.Streams.Stream_Element_Count := 0;
begin
while Left >= 16#80# loop
Last := Last + 1;
Data (Last) := Ada.Streams.Stream_Element
((Left and 16#7F#) + 16#80#);
Left := Interfaces.Shift_Right (Left, 7);
end loop;
Last := Last + 1;
if Self.Riffling then
Self.Written := Self.Written + Last;
else
Data (Last) := Ada.Streams.Stream_Element'Mod (Left);
Self.Parent.Write (Data (1 .. Last));
end if;
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_32_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Varint (Field, Value.Get (J));
end loop;
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_64) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write_Varint (Value);
end Write_Varint;
------------------
-- Write_Varint --
------------------
procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Unsigned_64)
is
use type Interfaces.Unsigned_64;
Left : Interfaces.Unsigned_64 := Value;
Data : Ada.Streams.Stream_Element_Array (1 .. 64 / 7 + 1);
Last : Ada.Streams.Stream_Element_Count := 0;
begin
while Left >= 16#80# loop
Last := Last + 1;
Data (Last) := Ada.Streams.Stream_Element
((Left and 16#7F#) + 16#80#);
Left := Interfaces.Shift_Right (Left, 7);
end loop;
Last := Last + 1;
if Self.Riffling then
Self.Written := Self.Written + Last;
else
Data (Last) := Ada.Streams.Stream_Element'Mod (Left);
Self.Parent.Write (Data (1 .. Last));
end if;
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_32) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write_Varint (Value);
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Integer_32) is
begin
-- "If you use int32 or int64 as the type for a negative number, the
-- resulting varint is always ten bytes long"
Self.Write_Varint (Interfaces.Integer_64 (Value));
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_32_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Varint (Field, Value.Get (J));
end loop;
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_64_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Varint (Field, Value.Get (J));
end loop;
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_64_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Varint (Field, Value.Get (J));
end loop;
end Write_Varint;
------------------
-- Write_Varint --
------------------
not overriding procedure Write_Varint
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_64) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write_Varint (Value);
end Write_Varint;
------------------
-- Write_Varint --
------------------
procedure Write_Varint
(Self : in out Stream;
Value : Interfaces.Integer_64)
is
function Cast is new Ada.Unchecked_Conversion
(Interfaces.Integer_64, Interfaces.Unsigned_64);
begin
Self.Write_Varint (Cast (Value));
end Write_Varint;
not overriding procedure Write_Varint_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_32;
Default : Interfaces.Unsigned_32)
is
use type Interfaces.Unsigned_32;
begin
if Value /= Default then
Self.Write_Varint (Field, Value);
end if;
end Write_Varint_Option;
not overriding procedure Write_Varint_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_64;
Default : Interfaces.Unsigned_64)
is
use type Interfaces.Unsigned_64;
begin
if Value /= Default then
Self.Write_Varint (Field, Value);
end if;
end Write_Varint_Option;
not overriding procedure Write_Varint_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_32;
Default : Interfaces.Integer_32)
is
use type Interfaces.Integer_32;
begin
if Value /= Default then
Self.Write_Varint (Field, Value);
end if;
end Write_Varint_Option;
not overriding procedure Write_Varint_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_64;
Default : Interfaces.Integer_64)
is
use type Interfaces.Integer_64;
begin
if Value /= Default then
Self.Write_Varint (Field, Value);
end if;
end Write_Varint_Option;
not overriding procedure Write_Varint_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_32_Vectors.Vector)
is
Length : Ada.Streams.Stream_Element_Count := 0;
begin
if Value.Length = 0 then
return;
end if;
for J in 1 .. Value.Length loop
Length := Length + Size (Value.Get (J));
end loop;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Varint (Value.Get (J));
end loop;
end if;
end Write_Varint_Packed;
not overriding procedure Write_Varint_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_64_Vectors.Vector)
is
Length : Ada.Streams.Stream_Element_Count := 0;
begin
if Value.Length = 0 then
return;
end if;
for J in 1 .. Value.Length loop
Length := Length + Size (Value.Get (J));
end loop;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Varint (Value.Get (J));
end loop;
end if;
end Write_Varint_Packed;
not overriding procedure Write_Varint_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_32_Vectors.Vector)
is
Length : Ada.Streams.Stream_Element_Count := 0;
begin
if Value.Length = 0 then
return;
end if;
for J in 1 .. Value.Length loop
Length := Length + Size (Value.Get (J));
end loop;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Varint (Value.Get (J));
end loop;
end if;
end Write_Varint_Packed;
not overriding procedure Write_Varint_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_64_Vectors.Vector)
is
Length : Ada.Streams.Stream_Element_Count := 0;
begin
if Value.Length = 0 then
return;
end if;
for J in 1 .. Value.Length loop
Length := Length + Size (Value.Get (J));
end loop;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Varint (Value.Get (J));
end loop;
end if;
end Write_Varint_Packed;
-----------
-- Write --
-----------
procedure Write
(Self : in out Stream;
Value : Ada.Streams.Stream_Element_Count) is
begin
Self.Write_Varint (Interfaces.Unsigned_32 (Value));
end Write;
-----------
-- Write --
-----------
overriding procedure Write
(Stream : in out Internal.Stream;
Item : Ada.Streams.Stream_Element_Array)
is
begin
raise Program_Error with "Unexpected call to Write procedure";
end Write;
---------------
-- Write_Key --
---------------
not overriding procedure Write_Key
(Self : in out Stream;
Value : Key)
is
use type Interfaces.Unsigned_32;
Integer : constant Interfaces.Unsigned_32 :=
Interfaces.Shift_Left (Interfaces.Unsigned_32 (Value.Field), 3) +
Wire_Type'Pos (Value.Encoding);
begin
Self.Write_Varint (Integer);
end Write_Key;
not overriding procedure Write_Option
(Self : in out Stream;
Field : Field_Number;
Value : Boolean;
Default : Boolean) is
begin
if Value /= Default then
Self.Write (Field, Value);
end if;
end Write_Option;
not overriding procedure Write_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.IEEE_Float_32;
Default : Interfaces.IEEE_Float_32)
is
use type Interfaces.IEEE_Float_32;
begin
if Value /= Default then
Self.Write (Field, Value);
end if;
end Write_Option;
not overriding procedure Write_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.IEEE_Float_64;
Default : Interfaces.IEEE_Float_64)
is
use type Interfaces.IEEE_Float_64;
begin
if Value /= Default then
Self.Write (Field, Value);
end if;
end Write_Option;
not overriding procedure Write_Option
(Self : in out Stream;
Field : Field_Number;
Value : League.Strings.Universal_String;
Default : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String)
is
use type League.Strings.Universal_String;
begin
if Value /= Default then
Self.Write (Field, Value);
end if;
end Write_Option;
not overriding procedure Write_Option
(Self : in out Stream;
Field : Field_Number;
Value : League.Stream_Element_Vectors.Stream_Element_Vector;
Default : League.Stream_Element_Vectors.Stream_Element_Vector :=
League.Stream_Element_Vectors.Empty_Stream_Element_Vector)
is
use type League.Stream_Element_Vectors.Stream_Element_Vector;
begin
if Value /= Default then
Self.Write (Field, Value);
end if;
end Write_Option;
not overriding procedure Write_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Boolean_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length);
Data : Ada.Streams.Stream_Element_Array (1 .. Length);
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in Data'Range loop
Data (J) := Boolean'Pos (Value.Get (Positive (J)));
end loop;
Self.Parent.Write (Data);
end if;
end Write_Packed;
not overriding procedure Write_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.IEEE_Float_32_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length) * 4;
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write (Value.Get (J));
end loop;
end if;
end Write_Packed;
not overriding procedure Write_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.IEEE_Float_64_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length) * 8;
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write (Value.Get (J));
end loop;
end if;
end Write_Packed;
procedure Write_Zigzag
(Self : in out Stream;
Value : Interfaces.Integer_32)
is
use Interfaces;
Unsigned : constant Interfaces.Unsigned_32 :=
2 * Interfaces.Unsigned_32 (abs Value) +
Boolean'Pos (Value < 0);
begin
Self.Write_Varint (Unsigned);
end Write_Zigzag;
procedure Write_Zigzag
(Self : in out Stream;
Value : Interfaces.Integer_64)
is
use Interfaces;
Unsigned : constant Interfaces.Unsigned_64 :=
2 * Interfaces.Unsigned_64 (abs Value) +
Boolean'Pos (Value < 0);
begin
Self.Write_Varint (Unsigned);
end Write_Zigzag;
------------------
-- Write_Zigzag --
------------------
not overriding procedure Write_Zigzag
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_32) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write_Zigzag (Value);
end Write_Zigzag;
not overriding procedure Write_Zigzag
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_64) is
begin
Self.Write_Key ((Field, Var_Int));
Self.Write_Zigzag (Value);
end Write_Zigzag;
not overriding procedure Write_Zigzag
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_32_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Zigzag (Field, Value.Get (J));
end loop;
end Write_Zigzag;
not overriding procedure Write_Zigzag
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_64_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Zigzag (Field, Value.Get (J));
end loop;
end Write_Zigzag;
not overriding procedure Write_Zigzag_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_32;
Default : Interfaces.Integer_32)
is
use type Interfaces.Integer_32;
begin
if Value /= Default then
Self.Write_Zigzag (Field, Value);
end if;
end Write_Zigzag_Option;
not overriding procedure Write_Zigzag_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_64;
Default : Interfaces.Integer_64)
is
use type Interfaces.Integer_64;
begin
if Value /= Default then
Self.Write_Zigzag (Field, Value);
end if;
end Write_Zigzag_Option;
not overriding procedure Write_Zigzag_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_32_Vectors.Vector)
is
use type Interfaces.Integer_32;
use type Interfaces.Unsigned_32;
Length : Ada.Streams.Stream_Element_Count := 0;
begin
if Value.Length = 0 then
return;
end if;
for J in 1 .. Value.Length loop
Length := Length +
Size (2 * Interfaces.Unsigned_32 (abs Value.Get (J)));
end loop;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Zigzag (Value.Get (J));
end loop;
end if;
end Write_Zigzag_Packed;
not overriding procedure Write_Zigzag_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_64_Vectors.Vector)
is
use type Interfaces.Integer_64;
use type Interfaces.Unsigned_64;
Length : Ada.Streams.Stream_Element_Count := 0;
begin
if Value.Length = 0 then
return;
end if;
for J in 1 .. Value.Length loop
Length := Length +
Size (2 * Interfaces.Unsigned_64 (abs Value.Get (J)));
end loop;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Zigzag (Value.Get (J));
end loop;
end if;
end Write_Zigzag_Packed;
-----------------
-- Write_Fixed --
-----------------
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Integer_32) is
begin
if Self.Riffling then
Self.Written := Self.Written + 4;
else
Interfaces.Integer_32'Write (Self.Parent, Value);
end if;
end Write_Fixed;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Integer_64) is
begin
if Self.Riffling then
Self.Written := Self.Written + 8;
else
Interfaces.Integer_64'Write (Self.Parent, Value);
end if;
end Write_Fixed;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Unsigned_32) is
begin
if Self.Riffling then
Self.Written := Self.Written + 4;
else
Interfaces.Unsigned_32'Write (Self.Parent, Value);
end if;
end Write_Fixed;
procedure Write_Fixed
(Self : in out Stream;
Value : Interfaces.Unsigned_64) is
begin
if Self.Riffling then
Self.Written := Self.Written + 8;
else
Interfaces.Unsigned_64'Write (Self.Parent, Value);
end if;
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_32) is
begin
Self.Write_Key ((Field, Fixed_32));
Self.Write_Fixed (Value);
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_64) is
begin
Self.Write_Key ((Field, Fixed_64));
Self.Write_Fixed (Value);
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_32) is
begin
Self.Write_Key ((Field, Fixed_32));
Self.Write_Fixed (Value);
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_64) is
begin
Self.Write_Key ((Field, Fixed_64));
Self.Write_Fixed (Value);
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_32_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Fixed (Field, Value.Get (J));
end loop;
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_64_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Fixed (Field, Value.Get (J));
end loop;
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_32_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Fixed (Field, Value.Get (J));
end loop;
end Write_Fixed;
not overriding procedure Write_Fixed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_64_Vectors.Vector) is
begin
for J in 1 .. Value.Length loop
Self.Write_Fixed (Field, Value.Get (J));
end loop;
end Write_Fixed;
not overriding procedure Write_Fixed_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_32;
Default : Interfaces.Unsigned_32)
is
use type Interfaces.Unsigned_32;
begin
if Value /= Default then
Self.Write_Fixed (Field, Value);
end if;
end Write_Fixed_Option;
not overriding procedure Write_Fixed_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Unsigned_64;
Default : Interfaces.Unsigned_64)
is
use type Interfaces.Unsigned_64;
begin
if Value /= Default then
Self.Write_Fixed (Field, Value);
end if;
end Write_Fixed_Option;
not overriding procedure Write_Fixed_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_32;
Default : Interfaces.Integer_32)
is
use type Interfaces.Integer_32;
begin
if Value /= Default then
Self.Write_Fixed (Field, Value);
end if;
end Write_Fixed_Option;
not overriding procedure Write_Fixed_Option
(Self : in out Stream;
Field : Field_Number;
Value : Interfaces.Integer_64;
Default : Interfaces.Integer_64)
is
use type Interfaces.Integer_64;
begin
if Value /= Default then
Self.Write_Fixed (Field, Value);
end if;
end Write_Fixed_Option;
not overriding procedure Write_Fixed_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_32_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length) * 4;
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Fixed (Value.Get (J));
end loop;
end if;
end Write_Fixed_Packed;
not overriding procedure Write_Fixed_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Integer_64_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length) * 8;
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Fixed (Value.Get (J));
end loop;
end if;
end Write_Fixed_Packed;
not overriding procedure Write_Fixed_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_32_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length) * 4;
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Fixed (Value.Get (J));
end loop;
end if;
end Write_Fixed_Packed;
not overriding procedure Write_Fixed_Packed
(Self : in out Stream;
Field : Field_Number;
Value : PB_Support.Unsigned_64_Vectors.Vector)
is
Length : constant Ada.Streams.Stream_Element_Count :=
Ada.Streams.Stream_Element_Count (Value.Length) * 8;
begin
if Value.Length = 0 then
return;
end if;
Self.Write_Key ((Field, Length_Delimited));
Self.Write (Length);
if Self.Riffling then
Self.Written := Self.Written + Length;
else
for J in 1 .. Value.Length loop
Self.Write_Fixed (Value.Get (J));
end loop;
end if;
end Write_Fixed_Packed;
end PB_Support.Internal;
|
30,853
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt38.adb
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt38.adb
-- { dg-do run }
-- { dg-options "-O2 -gnatn" }
with Opt38_Pkg; use Opt38_Pkg;
procedure Opt38 is
begin
Test (-1);
end;
|
30,854
|
ada
| 7
|
stcarrez/mat
|
mat/src/gtk/mat-callbacks.ads
|
-----------------------------------------------------------------------
-- mat-callbacks - Callbacks for Gtk
-- Copyright (C) 2014 <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 Gtkada.Builder;
with MAT.Targets.Gtkmat;
package MAT.Callbacks is
-- Initialize and register the callbacks.
procedure Initialize (Target : in MAT.Targets.Gtkmat.Target_Type_Access;
Builder : in Gtkada.Builder.Gtkada_Builder);
-- Callback executed when the "quit" action is executed from the menu.
procedure On_Menu_Quit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class);
-- Callback executed when the "about" action is executed from the menu.
procedure On_Menu_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class);
-- Callback executed when the "close-about" action is executed from the about box.
procedure On_Close_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class);
-- Callback executed when the "cmd-sizes" action is executed from the "Sizes" action.
procedure On_Btn_Sizes (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class);
-- Callback executed when the "cmd-threads" action is executed from the "Threads" action.
procedure On_Btn_Threads (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class);
end MAT.Callbacks;
|
30,855
|
ada
| 1
|
ytomino/vampire
|
source/tabula-calendar-time_io.ads
|
<filename>source/tabula-calendar-time_io.ads<gh_stars>1-10
-- The Village of Vampire by YT, このソースコードはNYSLです
with Serialization;
package Tabula.Calendar.Time_IO is
procedure IO (
Serializer : not null access Serialization.Serializer;
Name : in String;
Value : in out Ada.Calendar.Time);
procedure IO (
Serializer : not null access Serialization.Serializer;
Name : in String;
Value : in out Duration);
end Tabula.Calendar.Time_IO;
|
30,856
|
ada
| 0
|
iyan22/AprendeAda
|
ejercicios2/prueba_posicion_en_matriz.adb
|
<filename>ejercicios2/prueba_posicion_en_matriz.adb<gh_stars>0
with Ada.Text_Io, Ada.Integer_Text_Io;
use Ada.Text_Io, Ada.Integer_Text_Io;
with matrices,posicion_en_matriz;
use matrices;
procedure prueba_posicion_en_matriz is
M1:Matriz_De_Enteros(1..4, 1..10);
numero, posicion_fila, posicion_columna: Integer;
begin
-- Caso de prueba 1:
M1 := ((1, 3, 5, 7, 9, 11, 13, 15, 17, 1),
(3, 3, 5, 7, 9, 11, 13, 15, 17, 1),
(5, 3, 5, 7, 9, 11, 13, 15, 17, 1),
(7, 3, 5, 7, 9, 11, 13, 15, 17, 19));
-- lo mismo que hacer M1(1,1) := 1; ... M1(4, 10) := 19;
Put_line("prueba 1: el numero al final de la matriz");
Put_line(" posicion_en_matriz((1, 3, 5, 7, 9, 11, 13, 15, 17, 1)");
Put_line(" (3, 3, 5, 7, 9, 11, 13, 15, 17, 1)");
Put_line(" (5, 3, 5, 7, 9, 11, 13, 15, 17, 1)");
Put_line(" (7, 3, 5, 7, 9, 11, 13, 15, 17, 19))");
put_line(" El resultado deberia de ser numero=19 fila=4 columna=10 ");
numero:=19;
posicion_en_matriz(M1, numero, posicion_fila, posicion_columna);
Put(numero);
Put(posicion_fila);
Put(posicion_columna);
New_Line(3);
Put_Line("Pulsa Intro para continuar");
Skip_Line;
New_Line(3);
-- Caso de prueba 2:
M1 := (( 1, 3, 5, 7, 9, 11, 13, 15, 17, 19),
(21, 23, 25, 27, 29, 31, 33, 35, 37, 39),
(41, 43, 45, 47, 49, 51, 53, 55, 57, 59),
(61, 63, 65, 67, 69, 71, 73, 75, 77, 79));
-- lo mismo que hacer M1(1,1) := 1; ... M1(4, 10) := 19;
Put_line("prueba 1: el numero al final de la matriz");
Put_line(" posicion_en_matriz(( 1, 3, 5, 7, 9, 11, 13, 15, 17, 19)");
Put_line(" (21, 23, 25, 27, 29, 31, 33, 35, 37, 39)");
Put_line(" (41, 43, 45, 47, 49, 51, 53, 55, 57, 59)");
Put_line(" (61, 63, 65, 67, 69, 71, 73, 75, 77, 79))");
put_line(" El resultado deberia de ser numero=55 fila=3 columna=8 ");
numero:=55;
posicion_en_matriz(M1, numero, posicion_fila, posicion_columna);
Put(numero);
Put(posicion_fila);
Put(posicion_columna);
New_Line(3);
Put_Line("Pulsa Intro para continuar");
Skip_Line;
New_Line(3);
-- Caso de prueba 3:
M1 := ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
-- lo mismo que hacer M1(1,1) := 1; ... M1(4, 10) := 19;
Put_line("prueba 1: el numero al final de la matriz");
Put_line(" posicion_en_matriz((0, 1, 2, 3, 4, 5, 6, 7, 8, 9)");
Put_line(" (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)");
Put_line(" (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)");
Put_line(" (0, 1, 2, 3, 4, 5, 6, 7, 8, 9))");
put_line(" El resultado deberia de ser numero=10 fila=-1 columna=-1 ");
numero:=10;
posicion_en_matriz(M1, numero, posicion_fila, posicion_columna);
Put(numero);
Put(posicion_fila);
Put(posicion_columna);
New_Line(3);
Put_Line("Pulsa Intro para continuar");
Skip_Line;
New_Line(3);
end prueba_posicion_en_matriz;
|
30,857
|
ada
| 6
|
My-Colaborations/ada-servlet
|
src/servlet-security-filters-oauth.ads
|
-----------------------------------------------------------------------
-- servlet-security-filters-oauth -- OAuth Security filter
-- Copyright (C) 2017, 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 Ada.Strings.Unbounded;
with Servlet.Filters;
with Servlet.Requests;
with Servlet.Responses;
with Servlet.Core;
with Security.OAuth.Servers; use Security.OAuth;
-- The <b>Servlet.Security.Filters.OAuth</b> package provides a servlet filter that
-- implements the RFC 6749 "Accessing Protected Resources" part: it extracts the OAuth
-- access token, verifies the grant and the permission. The servlet filter implements
-- the RFC 6750 "OAuth 2.0 Bearer Token Usage".
--
package Servlet.Security.Filters.OAuth is
-- RFC 2617 HTTP header for authorization.
AUTHORIZATION_HEADER_NAME : constant String := "Authorization";
-- RFC 2617 HTTP header for failed authorization.
WWW_AUTHENTICATE_HEADER_NAME : constant String := "WWW-Authenticate";
type Auth_Filter is new Servlet.Filters.Filter with private;
-- Called by the servlet container to indicate to a servlet that the servlet
-- is being placed into service.
overriding
procedure Initialize (Server : in out Auth_Filter;
Config : in Servlet.Core.Filter_Config);
-- Set the authorization manager that must be used to verify the OAuth token.
procedure Set_Auth_Manager (Filter : in out Auth_Filter;
Manager : in Servers.Auth_Manager_Access);
-- Filter the request to make sure the user is authenticated.
-- Invokes the <b>Do_Login</b> procedure if there is no user.
-- If a permission manager is defined, check that the user has the permission
-- to view the page. Invokes the <b>Do_Deny</b> procedure if the permission
-- is denied.
procedure Do_Filter (F : in Auth_Filter;
Request : in out Servlet.Requests.Request'Class;
Response : in out Servlet.Responses.Response'Class;
Chain : in out Servlet.Core.Filter_Chain);
-- Display or redirects the user to the login page. This procedure is called when
-- the user is not authenticated.
procedure Do_Login (F : in Auth_Filter;
Request : in out Servlet.Requests.Request'Class;
Response : in out Servlet.Responses.Response'Class);
-- Display the forbidden access page. This procedure is called when the user is not
-- authorized to see the page. The default implementation returns the SC_FORBIDDEN error.
procedure Do_Deny (F : in Auth_Filter;
Request : in out Servlet.Requests.Request'Class;
Response : in out Servlet.Responses.Response'Class);
private
type Auth_Filter is new Servlet.Filters.Filter with record
Realm : Servers.Auth_Manager_Access;
Realm_URL : Ada.Strings.Unbounded.Unbounded_String;
end record;
end Servlet.Security.Filters.OAuth;
|
30,858
|
ada
| 24
|
svn2github/matreshka
|
source/web/tools/wsdl2ada/wsdl-parsers.ads
|
<filename>source/web/tools/wsdl2ada/wsdl-parsers.ads<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, <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$
------------------------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
private with Ada.Containers.Vectors;
private with League.Strings.Hash;
private with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
private with XML.SAX.Locators;
private with WSDL.Assertions;
with WSDL.AST;
private with WSDL.AST.Services;
package WSDL.Parsers is
type WSDL_Parser is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler with private;
function Get_Description
(Self : WSDL_Parser'Class) return WSDL.AST.Description_Access;
private
package Namespace_Maps is
new Ada.Containers.Hashed_Maps
(League.Strings.Universal_String,
League.Strings.Universal_String,
League.Strings.Hash,
League.Strings."=",
League.Strings."=");
type Description_Child_Kind is
(None,
Documentation,
Include_Import,
Types,
Interface_Binding_Service);
type Parser_State_Kind is
(None,
Document,
WSDL_Binding,
WSDL_Binding_Fault,
WSDL_Binding_Operation,
WSDL_Description,
WSDL_Endpoint,
WSDL_Infault,
WSDL_Input,
WSDL_Interface,
WSDL_Interface_Fault,
WSDL_Interface_Operation,
WSDL_Outfault,
WSDL_Output,
WSDL_Service,
WSDL_Types);
type Parser_State (Kind : Parser_State_Kind := None) is record
case Kind is
when WSDL_Description =>
Last_Child_Kind : Description_Child_Kind := None;
-- Kind of last processed child of 'description' element. This
-- member is used to track order of children elements of
-- 'description' element.
when others =>
null;
end case;
end record;
package State_Vectors is
new Ada.Containers.Vectors (Positive, Parser_State);
type WSDL_Parser is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler with
record
Locator : XML.SAX.Locators.SAX_Locator;
-- SAX document locator to obtain file and position to report assertion
-- violations.
Description : WSDL.AST.Description_Access;
-- Root element of AST for the processed file.
Current_State : Parser_State;
-- Current state of the parser.
Previous_State : Parser_State;
-- Previous state of the parser.
State_Stack : State_Vectors.Vector;
-- Stack of parser's state.
Ignore_Depth : Natural := 0;
-- Counter of the depth of ignored elements.
Namespaces : Namespace_Maps.Map;
-- Mapping from prefix to namespace URI.
-- Current_Fault : WSDL.AST.Faults.Interface_Fault_Access;
-- -- Currently processed fault component.
--
Current_Interface : WSDL.AST.Interface_Access;
-- Currently processed interface component.
Current_Operation : WSDL.AST.Interface_Operation_Access;
-- Currently processed interface operation component.
Current_Binding : WSDL.AST.Binding_Access;
-- Currently processed binding component.
Current_Service : WSDL.AST.Services.Service_Access;
-- Currently processed service component.
end record;
overriding function Error_String
(Self : WSDL_Parser) return League.Strings.Universal_String;
overriding procedure Set_Document_Locator
(Self : in out WSDL_Parser;
Locator : XML.SAX.Locators.SAX_Locator);
overriding procedure Start_Document
(Self : in out WSDL_Parser;
Success : in out Boolean);
overriding procedure Start_Prefix_Mapping
(Self : in out WSDL_Parser;
Prefix : League.Strings.Universal_String;
Namespace_URI : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Start_Element
(Self : in out WSDL_Parser;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out WSDL_Parser;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
procedure Report
(Self : WSDL_Parser;
Assertion : WSDL.Assertions.WSDL_Assertion);
-- Reports violation of WSDL assertion.
end WSDL.Parsers;
|
30,859
|
ada
| 1
|
brucegua/moocos
|
tools/scitools/sample/mahjongg/board.adb
|
<filename>tools/scitools/sample/mahjongg/board.adb
-------------------------------------------------------------------------------
--
-- BOARD ADT (implementation)
--
-------------------------------------------------------------------------------
WITH TileADT, Display, Screen, stack_package, Queue_Package, Text_IO;
USE TileADT;
PACKAGE BODY Board IS
PACKAGE My_Int_IO IS new Text_IO.Integer_io (INTEGER);
-------------------------------------------------------------------------------
PROCEDURE Clear IS
BEGIN
null;
END Clear;
-------------------------------------------------------------------------------
PROCEDURE Reset_Hints IS
BEGIN
null;
END Reset_Hints;
-------------------------------------------------------------------------------
PROCEDURE Load (Mah_Num: STRING ) IS
BEGIN
Text_IO.Put("Stub for Board.Load");
Delay 1.0;
END Load;
-------------------------------------------------------------------------------
PROCEDURE Save IS
BEGIN
Text_IO.Put ("Stub for Board.Save");
END Save;
-------------------------------------------------------------------------------
PROCEDURE Create_New IS
BEGIN
Text_IO.Put ("Stub for Board.Create_New");
END Create_New;
-------------------------------------------------------------------------------
PROCEDURE Show (Version: IN STRING) IS
-- Display the entire board
BEGIN
-- Display Screen boundaries (columns and row headers)
Screen.ClearScreen;
Screen.MoveCursor(1,21);
Text_IO.Put_Line ("ASCII Mah Jongg by JD. Version " & Version);
Text_IO.PUT (" A B C D E F G H I J K L M N O");
Text_IO.New_Line;
Text_IO.New_Line;
FOR num in ROW LOOP
My_Int_IO.PUT(num,width=>1);
Text_IO.New_Line;
Text_IO.New_Line;
END LOOP;
END Show;
-------------------------------------------------------------------------------
FUNCTION GetTop (TheCol : TileADT.Col; TheRow : Row) RETURN Tile IS
Top_Tile: TileADT.Tile;
BEGIN
RETURN Top_Tile;
END GetTop;
-------------------------------------------------------------------------------
PROCEDURE RemoveTop (TheCol : Col; TheRow : Row) IS
BEGIN
null;
END REmoveTop;
-------------------------------------------------------------------------------
PROCEDURE ReplaceTop (TheCol : Col; TheRow : Row; Value: TileValue) IS
BEGIN
null;
END ReplaceTop;
-------------------------------------------------------------------------------
FUNCTION IsPositionRemovable (TheCol : Col; TheRow : Row) RETURN BOOLEAN IS
BEGIN
RETURN TRUE;
END IsPositionRemovable;
-------------------------------------------------------------------------------
FUNCTION IsEmpty (TheCol : Col; TheRow : Row) RETURN BOOLEAN IS
BEGIN
RETURN TRUE;
END IsEmpty;
-------------------------------------------------------------------------------
procedure DumpBoard ( Layers : INTEGER) IS
BEGIN
null;
end DumpBoard;
-------------------------------------------------------------------------------
PROCEDURE Give_Hint IS
BEGIN
null;
END Give_Hint;
-------------------------------------------------------------------------------
PROCEDURE Inc_Tiles_Left IS
BEGIN
null;
END Inc_Tiles_Left;
PROCEDURE Dec_Tiles_Left IS
BEGIN
null;
END Dec_Tiles_Left;
FUNCTION Get_Tiles_Left RETURN NATURAL IS
BEGIN
RETURN 0;
END Get_Tiles_Left;
END Board;
|
30,860
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/cpp1.ads
|
-- { dg-do compile }
package cpp1 is
type Root_Interface is interface;
type Typ is new Root_Interface with record
TOTO : Integer;
pragma CPP_Vtable (TOTO);
end record;
end cpp1;
|
30,861
|
ada
| 0
|
ekoeppen/MSP430_Generic_Ada_Drivers
|
drivers/drivers-nrf24.adb
|
<filename>drivers/drivers-nrf24.adb<gh_stars>0
with System;
with Utils;
package body Drivers.NRF24 is
package IRQHandler is new HAL.Pin_IRQ (Pin => IRQ);
type UInt2 is mod 2 ** 2;
type UInt3 is mod 2 ** 3;
type Register_Type is (
CONFIG,
EN_AA,
EN_RXADDR,
SETUP_AW,
SETUP_RETR,
RF_CH,
RF_SETUP,
STATUS,
OBSERVE_TX,
RPD,
RX_ADDR_P0,
RX_ADDR_P1,
RX_ADDR_P2,
RX_ADDR_P3,
RX_ADDR_P4,
RX_ADDR_P5,
TX_ADDR,
RX_PW_P0,
RX_PW_P1,
RX_PW_P2,
RX_PW_P3,
RX_PW_P4,
RX_PW_P5,
FIFO_STATUS,
DYNPD,
FEATURE);
for Register_Type use (
CONFIG => 16#00#,
EN_AA => 16#01#,
EN_RXADDR => 16#02#,
SETUP_AW => 16#03#,
SETUP_RETR => 16#04#,
RF_CH => 16#05#,
RF_SETUP => 16#06#,
STATUS => 16#07#,
OBSERVE_TX => 16#08#,
RPD => 16#09#,
RX_ADDR_P0 => 16#0A#,
RX_ADDR_P1 => 16#0B#,
RX_ADDR_P2 => 16#0C#,
RX_ADDR_P3 => 16#0D#,
RX_ADDR_P4 => 16#0E#,
RX_ADDR_P5 => 16#0F#,
TX_ADDR => 16#10#,
RX_PW_P0 => 16#11#,
RX_PW_P1 => 16#12#,
RX_PW_P2 => 16#13#,
RX_PW_P3 => 16#14#,
RX_PW_P4 => 16#15#,
RX_PW_P5 => 16#16#,
FIFO_STATUS => 16#17#,
DYNPD => 16#1C#,
FEATURE => 16#1D#);
type Command_Type is (
R_REGISTER,
W_REGISTER,
R_RX_PL_WID,
R_RX_PAYLOAD,
W_TX_PAYLOAD,
W_ACK_PAYLOAD,
W_TX_PAYLOAD_NOACK,
FLUSH_TX,
FLUSH_RX,
REUSE_TX_PL,
NOP);
for Command_Type use (
R_REGISTER => 2#0000_0000#,
W_REGISTER => 2#0010_0000#,
R_RX_PL_WID => 2#0110_0000#,
R_RX_PAYLOAD => 2#0110_0001#,
W_TX_PAYLOAD => 2#1010_0000#,
W_ACK_PAYLOAD => 2#1010_1000#,
W_TX_PAYLOAD_NOACK => 2#1011_0000#,
FLUSH_TX => 2#1110_0001#,
FLUSH_RX => 2#1110_0010#,
REUSE_TX_PL => 2#1110_0011#,
NOP => 2#1111_1111#);
type Config_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
Mask_RX_DR : Boolean;
Mask_TX_DS : Boolean;
Mask_Max_RT : Boolean;
EN_CRC : Boolean;
CRCO : Boolean;
Pwr_Up : Boolean;
Prim_RX : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for Config_Register_Type use
record
Val at 0 range 0 .. 7;
Mask_RX_DR at 0 range 6 .. 6;
Mask_TX_DS at 0 range 5 .. 5;
Mask_Max_RT at 0 range 4 .. 4;
EN_CRC at 0 range 3 .. 3;
CRCO at 0 range 2 .. 2;
Pwr_Up at 0 range 1 .. 1;
Prim_RX at 0 range 0 .. 0;
end record;
type EN_AA_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
ENAA_P5 : Boolean;
ENAA_P4 : Boolean;
ENAA_P3 : Boolean;
ENAA_P2 : Boolean;
ENAA_P1 : Boolean;
ENAA_P0 : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for EN_AA_Register_Type use
record
ENAA_P5 at 0 range 5 .. 5;
ENAA_P4 at 0 range 4 .. 4;
ENAA_P3 at 0 range 3 .. 3;
ENAA_P2 at 0 range 2 .. 2;
ENAA_P1 at 0 range 1 .. 1;
ENAA_P0 at 0 range 0 .. 0;
end record;
type EN_RXADDR_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
ERX_P5 : Boolean;
ERX_P4 : Boolean;
ERX_P3 : Boolean;
ERX_P2 : Boolean;
ERX_P1 : Boolean;
ERX_P0 : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for EN_RXADDR_Register_Type use
record
ERX_P5 at 0 range 5 .. 5;
ERX_P4 at 0 range 4 .. 4;
ERX_P3 at 0 range 3 .. 3;
ERX_P2 at 0 range 2 .. 2;
ERX_P1 at 0 range 1 .. 1;
ERX_P0 at 0 range 0 .. 0;
end record;
type Address_Width_Type is (AW_3_Unsigned_8s, AW_4_Unsigned_8s, AW_5_Unsigned_8s);
for Address_Width_Type use (AW_3_Unsigned_8s => 1, AW_4_Unsigned_8s => 2, AW_5_Unsigned_8s => 3);
type Setup_AW_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
AW : Address_Width_Type;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for Setup_AW_Register_Type use
record
AW at 0 range 0 .. 2;
end record;
type RF_SETUP_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
CONST_WAVE : Boolean;
RF_DR_LOW : Boolean;
PLL_LOCK : Boolean;
RF_DR_HIGH : Boolean;
RF_PWR : UInt2;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for RF_SETUP_Register_Type use
record
CONST_WAVE at 0 range 7 .. 7;
RF_DR_LOW at 0 range 5 .. 5;
PLL_LOCK at 0 range 4 .. 4;
RF_DR_HIGH at 0 range 3 .. 3;
RF_PWR at 0 range 1 .. 2;
end record;
type STATUS_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
RX_DR : Boolean;
TX_DS : Boolean;
MAX_RT : Boolean;
RX_P_NO : UInt3;
TX_FULL : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for STATUS_Register_Type use
record
RX_DR at 0 range 6 .. 6;
TX_DS at 0 range 5 .. 5;
MAX_RT at 0 range 4 .. 4;
RX_P_NO at 0 range 1 .. 3;
TX_FULL at 0 range 0 .. 0;
end record;
type FIFO_STATUS_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
TX_REUSE : Boolean;
TX_FULL : Boolean;
TX_EMPTY : Boolean;
RX_FULL : Boolean;
RX_EMPTY : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for FIFO_STATUS_Register_Type use
record
TX_REUSE at 0 range 6 .. 6;
TX_FULL at 0 range 5 .. 5;
TX_EMPTY at 0 range 4 .. 4;
RX_FULL at 0 range 1 .. 1;
RX_EMPTY at 0 range 0 .. 0;
end record;
type DYNPD_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
DPL_P5 : Boolean;
DPL_P4 : Boolean;
DPL_P3 : Boolean;
DPL_P2 : Boolean;
DPL_P1 : Boolean;
DPL_P0 : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for DYNPD_Register_Type use
record
DPL_P5 at 0 range 5 .. 5;
DPL_P4 at 0 range 4 .. 4;
DPL_P3 at 0 range 3 .. 3;
DPL_P2 at 0 range 2 .. 2;
DPL_P1 at 0 range 1 .. 1;
DPL_P0 at 0 range 0 .. 0;
end record;
type FEATURE_Register_Type (As_Value : Boolean := False) is
record
case As_Value is
when True =>
Val : Unsigned_8;
when False =>
EN_DPL : Boolean;
EN_ACK_PAY : Boolean;
EN_DYN_ACK : Boolean;
end case;
end record
with Unchecked_Union, Size => 8, Bit_Order => System.Low_Order_First;
for FEATURE_Register_Type use
record
EN_DPL at 0 range 2 .. 2;
EN_ACK_PAY at 0 range 1 .. 1;
EN_DYN_ACK at 0 range 0 .. 0;
end record;
Config_Init : constant Config_Register_Type := (EN_CRC => True, others => False);
EN_AA_Init : constant EN_AA_Register_Type := (others => False);
Status_Init : constant Status_Register_Type := (RX_DR => True, TX_DS => True, MAX_RT => True, RX_P_NO => 0, others => False);
AW_Init : constant Setup_AW_Register_Type := (AW => AW_5_Unsigned_8s, others => False);
EN_RXADDR_Init : constant EN_RXADDR_Register_Type := (ERX_P0 => True, ERX_P1 => True, others => False);
RF_SETUP_Init : constant RF_SETUP_Register_Type := (RF_DR_LOW => True, RF_DR_HIGH => False, RF_PWR => 3, others => False);
FEATURE_Init : constant FEATURE_Register_Type := (EN_DPL => True, EN_DYN_ACK => True, others => False);
DYNPD_Init : constant DYNPD_Register_Type := (DPL_P0 => True, DPL_P1 => True, others => False);
RX_Mode_Setting : constant Config_Register_Type := (EN_CRC => True, PRIM_RX => True, PWR_UP => True, others => False);
TX_Mode_Setting : constant Config_Register_Type := (EN_CRC => True, PWR_UP => True, others => False);
procedure Write_Register (Register : Register_Type; Value : Unsigned_8);
procedure Read_Register (Register : Register_Type; Value : out Unsigned_8);
function Read_Register (Register : Register_Type) return Unsigned_8;
procedure Send_Address (Address : Address_Type);
procedure Write_Register (Register : Register_Type; Value : Unsigned_8) is
begin
Chip_Select.Clear;
SPI.Send (Register'Enum_Rep + W_REGISTER'Enum_Rep);
SPI.Send (Value);
Chip_Select.Set;
end Write_Register;
procedure Read_Register (Register : Register_Type; Value : out Unsigned_8) is
begin
Chip_Select.Clear;
SPI.Send (Register'Enum_Rep + R_REGISTER'Enum_Rep);
SPI.Receive (Value);
Chip_Select.Set;
end Read_Register;
function Read_Register (Register : Register_Type) return Unsigned_8 is
Value : Unsigned_8;
begin
Chip_Select.Clear;
SPI.Send (Register'Enum_Rep + R_REGISTER'Enum_Rep);
SPI.Receive (Value);
Chip_Select.Set;
return Value;
end Read_Register;
procedure Read_Registers (Registers : out Raw_Register_Array) is
begin
for R in Register_Type loop
Read_Register(R, Registers (R'Enum_Rep));
end loop;
end Read_Registers;
procedure Print_Registers is
begin
Put_Line (
"Status:" & Utils.To_Hex_String (Read_Register (STATUS)) &
" Config:" & Utils.To_Hex_String (Read_Register (CONFIG)) &
" RF CH:" & Utils.To_Hex_String (Read_Register (RF_CH)) &
" RF Setup:" & Utils.To_Hex_String (Read_Register (RF_SETUP)) &
" AW Setup:" & Utils.To_Hex_String (Read_Register (SETUP_AW)) &
" RX P0:" & Utils.To_Hex_String (Read_Register (RX_PW_P0)) &
" RX P1:" & Utils.To_Hex_String (Read_Register (RX_PW_P1)) &
" FIFO Status:" & Utils.To_Hex_String (Read_Register (FIFO_STATUS)) &
" DYNPD:" & Utils.To_Hex_String (Read_Register (DYNPD)) &
" Feature:" & Utils.To_Hex_String (Read_Register (FEATURE))
);
end Print_Registers;
procedure Init is
begin
Power_Down;
Write_Register (SETUP_AW, AW_Init.Val);
Write_Register (EN_AA, EN_AA_Init.Val);
Write_Register (STATUS, STATUS_Init.Val);
Write_Register (RF_SETUP, RF_SETUP_Init.Val);
Write_Register (EN_RXADDR, EN_RXADDR_Init.Val);
Write_Register (DYNPD, DYNPD_Init.Val);
Write_Register (FEATURE, FEATURE_Init.Val);
IRQHandler.Configure_Trigger (Falling => True);
Chip_Select.Clear;
SPI.Send (FLUSH_TX'Enum_Rep);
Chip_Select.Set;
Chip_Select.Clear;
SPI.Send (FLUSH_RX'Enum_Rep);
Chip_Select.Set;
end Init;
procedure Set_Channel (Channel : Channel_Type) is
begin
Write_Register (RF_CH, Channel);
end Set_Channel;
procedure Send_Address (Address : Address_Type) is
begin
for I in Address'Range loop
SPI.Send (Address (I));
end loop;
end Send_Address;
procedure Set_RX_Address (Address : Address_Type) is
begin
Chip_Select.Clear;
SPI.Send (RX_ADDR_P1'Enum_Rep + W_REGISTER'Enum_Rep);
Send_Address (Address);
Chip_Select.Set;
end Set_RX_Address;
procedure Set_TX_Address (Address : Address_Type) is
begin
Chip_Select.Clear;
SPI.Send (TX_ADDR'Enum_Rep + W_REGISTER'Enum_Rep);
Send_Address (Address);
Chip_Select.Set;
Chip_Select.Clear;
SPI.Send (RX_ADDR_P0'Enum_Rep + W_REGISTER'Enum_Rep);
Send_Address (Address);
Chip_Select.Set;
end Set_TX_Address;
procedure TX_Mode is
begin
Write_Register (CONFIG, TX_Mode_Setting.Val);
end TX_Mode;
procedure RX_Mode is
begin
Write_Register (CONFIG, RX_Mode_Setting.Val);
Chip_Enable.Set;
end RX_Mode;
procedure TX (Packet: Packet_Type) is
S : Status_Register_Type;
begin
IRQHandler.Clear_Trigger;
Chip_Select.Clear;
SPI.Send (FLUSH_TX'Enum_Rep);
Chip_Select.Set;
Chip_Select.Clear;
SPI.Send (W_TX_PAYLOAD_NOACK'Enum_Rep);
for I in Packet'Range loop
SPI.Send (Packet (I));
end loop;
Chip_Select.Set;
Chip_Enable.Set;
Clock.Delay_us (500);
Chip_Enable.Clear;
loop
S.Val := Read_Register (STATUS);
exit when S.TX_DS;
end loop;
Write_Register (STATUS, STATUS_Init.Val);
end TX;
function Wait_For_RX return Boolean is
begin
IRQHandler.Clear_Trigger;
IRQHandler.Wait_For_Trigger;
Write_Register (STATUS, STATUS_Init.Val);
return IRQHandler.Triggered;
end Wait_For_RX;
procedure RX (Packet : out Packet_Type) is
begin
Chip_Select.Clear;
SPI.Send (FLUSH_RX'Enum_Rep);
Chip_Select.Set;
end RX;
procedure Power_Down is
begin
Chip_Enable.Clear;
Write_Register (CONFIG, Config_Init.Val);
end Power_Down;
procedure Cancel is
begin
IRQHandler.Cancel_Wait;
end Cancel;
end Drivers.NRF24;
|
30,862
|
ada
| 0
|
drm343/drm343.github.io
|
ch1/hello.adb
|
<reponame>drm343/drm343.github.io<filename>ch1/hello.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
procedure Hello is
type Hello_Integer is array (Positive range 2 .. 4) of Integer;
V : hello_integer := (3, 5, 7);
procedure Say_Hello_To (Name : String) is
begin
Put ("hello ");
Put_Line (Name);
end Say_Hello_To;
begin
if Argument_Count = 1 then
Say_Hello_To (Argument (1));
else
Put_Line ("You need a name!");
Put_Line ("./hello name");
end if;
for I in V'first .. V'Last loop
Put_Line (Integer'Image (V (I)));
end loop;
end;
|
30,863
|
ada
| 1
|
ekoeppen/STM32_Generic_Ada_Drivers
|
examples/tasking/tasks.adb
|
<filename>examples/tasking/tasks.adb
with STM32GD.Board; use STM32GD.Board;
package body Tasks is
protected body Protect is
procedure Go is
begin
Active := True;
end Go;
entry Wait when Active is
begin
Active := False;
end Wait;
end Protect;
task body T is
begin
loop
Protect.Wait;
Text_IO.Put_Line ("Subtask T running");
end loop;
end T;
end Tasks;
|
30,864
|
ada
| 12
|
TUM-EI-RCS/StratoX
|
tests/alternative-units/cosy.ads
|
with Units; use Units;
with Generic_Unit_Vectors;
pragma Elaborate_All(Generic_Unit_Vectors);
package CoSy with SPARK_Mode is
type Spartial_Type is new Float with
Dimension_System =>
((Unit_Name => Meter_X, Unit_Symbol => "m_x", Dim_Symbol => "Lx"),
(Unit_Name => Meter_Y, Unit_Symbol => "m_y", Dim_Symbol => "Ly"),
(Unit_Name => Meter_Z, Unit_Symbol => "m_z", Dim_Symbol => "Lz"));
package Electric_Field_Pack is new Generic_Unit_Vectors(Electric_Field_Type);
use Electric_Field_Pack;
subtype Electric_Field_Vector is Electric_Field_Pack.Unit_Vector;
function "+" is new Electric_Field_Pack.addition;
subtype Electric_Field_Vector2 is Electric_Field_Pack.Unit_Vector2;
type CoSy_Type is null record;
end CoSy;
|
30,865
|
ada
| 20
|
charlie5/lace
|
3-mid/impact/source/3d/collision/dispatch/impact-d3-union_find.ads
|
<reponame>charlie5/lace
-- #include "LinearMath/btAlignedObjectArray.h"
private
with ada.Containers.Vectors,
ada.unchecked_Deallocation;
package impact.d3.union_Find
--
-- UnionFind calculates connected subsets
--
-- Implements weighted Quick Union with path compression optimization: could use short ints
-- instead of ints (halving memory, would limit the number of rigid bodies to 64k, sounds reasonable).
--
is
type Item is tagged private;
type View is access all Item'Class;
USE_PATH_COMPRESSION : constant Boolean := True;
STATIC_SIMULATION_ISLAND_OPTIMIZATION : constant Boolean := True;
--
-- See for discussion of static island optimizations by Vroonsh here: http://code.google.com/p/bullet/issues/detail?id=406.
type btElement is
record
m_id,
m_sz : Integer;
end record;
--- Forge
--
procedure destruct (Self : in out Item);
--- Attributes
--
function getNumElements (Self : in Item) return Natural;
-- SIMD_FORCE_INLINE int getNumElements() const
-- {
-- return int(m_elements.size());
-- }
function isRoot (Self : in Item; x : in Integer) return Boolean;
-- SIMD_FORCE_INLINE bool isRoot(int x) const
-- {
-- return (x == m_elements[x].m_id);
-- }
function getElement (Self : in Item; index : in Integer) return access btElement;
-- btElement& getElement(int index)
-- {
-- return m_elements[index];
-- }
function find (Self : in Item; p, q : in Integer) return Boolean;
-- int find(int p, int q)
-- {
-- return (find(p) == find(q));
-- }
function find (Self : in Item; index : in Integer) return Integer;
-- int find(int x)
-- {
-- //btAssert(x < m_N);
-- //btAssert(x >= 0);
--
-- while (x != m_elements[x].m_id)
-- {
-- //not really a reason not to use path compression, and it flattens the trees/improves find performance dramatically
--
-- #ifdef USE_PATH_COMPRESSION
-- const btElement* elementPtr = &m_elements[m_elements[x].m_id];
-- m_elements[x].m_id = elementPtr->m_id;
-- x = elementPtr->m_id;
-- #else//
-- x = m_elements[x].m_id;
-- #endif
-- //btAssert(x < m_N);
-- //btAssert(x >= 0);
--
-- }
-- return x;
-- }
--- Operations
--
procedure sortIslands (Self : in out Item);
--
-- This is a special operation, destroying the content of impact.d3.union_Find.
--
-- It sorts the elements, based on island id, in order to make it easy to iterate over islands
procedure reset (Self : in out Item; N : in Integer);
procedure allocate (Self : in out Item; N : in Integer);
procedure Free (Self : in out Item);
procedure unite (Self : in out Item; p, q : in Integer);
-- void unite(int p, int q)
-- {
-- int i = find(p), j = find(q);
-- if (i == j)
-- return;
--
-- #ifndef USE_PATH_COMPRESSION
-- //weighted quick union, this keeps the 'trees' balanced, and keeps performance of unite O( log(n) )
-- if (m_elements[i].m_sz < m_elements[j].m_sz)
-- {
-- m_elements[i].m_id = j; m_elements[j].m_sz += m_elements[i].m_sz;
-- }
-- else
-- {
-- m_elements[j].m_id = i; m_elements[i].m_sz += m_elements[j].m_sz;
-- }
-- #else
-- m_elements[i].m_id = j; m_elements[j].m_sz += m_elements[i].m_sz;
-- #endif //USE_PATH_COMPRESSION
-- }
private
type btElement_view is access all btElement;
procedure free is new ada.unchecked_Deallocation (btElement, btElement_view);
package btElement_Vectors is new ada.Containers.Vectors (Natural, btElement_view);
subtype btElement_Vector is btElement_Vectors.Vector;
type Item is tagged
record
m_elements : btElement_Vector;
end record;
end impact.d3.union_Find;
|
30,866
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c5/c52104l.ada
|
<reponame>best08618/asylo
-- C52104L.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT LENGTHS MUST MATCH IN ARRAY AND SLICE ASSIGNMENTS.
-- MORE SPECIFICALLY, TEST THAT ATTEMPTED ASSIGNMENTS BETWEEN
-- ARRAYS WITH NON-MATCHING LENGTHS LEAVE THE DESTINATION ARRAY
-- INTACT AND CAUSE CONSTRAINT_ERROR TO BE RAISED.
-- (OVERLAPS BETWEEN THE OPERANDS OF THE ASSIGNMENT STATEMENT
-- ARE TREATED ELSEWHERE.)
-- THIS IS THE SECOND FILE IN
-- DIVISION C : NON-NULL LENGTHS NOT DETERMINABLE STATICALLY.
-- HISTORY:
-- RM 07/20/81 CREATED ORIGINAL TEST.
-- SPS 03/22/83
-- DHH 10/20/87 SHORTENED LINES CONTAINING MORE THAN 72 CHARACTERS.
WITH REPORT;
PROCEDURE C52104L IS
USE REPORT ;
BEGIN
TEST( "C52104L" , "CHECK THAT IN ARRAY ASSIGNMENTS AND IN SLICE" &
" ASSIGNMENTS THE LENGTHS MUST MATCH" );
-- ( EACH DIVISION COMPRISES 3 FILES,
-- COVERING RESPECTIVELY THE FIRST
-- 3 , NEXT 2 , AND LAST 3 OF THE 8
-- SELECTIONS FOR THE DIVISION.)
-------------------------------------------------------------------
-- (13) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
-- WERE DEFINED USING THE "BOX" SYMBOL
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
DECLARE
TYPE TABOX3 IS ARRAY( INTEGER RANGE <> ) OF CHARACTER ;
ARRX31 : TABOX3( IDENT_INT(2)..IDENT_INT(6) ) := "QUINC" ;
BEGIN
-- ARRAY ASSIGNMENT (WITH STRING AGGREGATE):
ARRX31 := "ABCD" ;
FAILED( "NO EXCEPTION RAISED (13)" );
EXCEPTION
WHEN CONSTRAINT_ERROR =>
-- CHECKING THE VALUES AFTER THE ASSIGNMENT:
IF ARRX31 /= "QUINC" OR
ARRX31( IDENT_INT(2)..IDENT_INT(6) ) /= "QUINC"
THEN
FAILED( "LHS ARRAY ALTERED (13)" );
END IF;
WHEN OTHERS =>
FAILED( "WRONG EXCEPTION RAISED - SUBTEST 13" );
END ;
-------------------------------------------------------------------
-- (14) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
-- WERE DEFINED USING THE "BOX" SYMBOL
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
DECLARE
TYPE TABOX4 IS ARRAY( INTEGER RANGE <> ) OF CHARACTER ;
SUBTYPE TABOX42 IS TABOX4( IDENT_INT(5)..IDENT_INT(9) );
ARRX42 : TABOX42 ;
BEGIN
-- INITIALIZATION OF LHS ARRAY:
ARRX42 := "QUINC" ;
-- SLICE ASSIGNMENT:
ARRX42( IDENT_INT(6)..IDENT_INT(9) ) := "ABCDEFGH" ;
FAILED( "NO EXCEPTION RAISED (14)" );
EXCEPTION
WHEN CONSTRAINT_ERROR =>
-- CHECKING THE VALUES AFTER THE ASSIGNMENT:
IF ARRX42 /= "QUINC" OR
ARRX42( IDENT_INT(5)..IDENT_INT(9) ) /= "QUINC"
THEN
FAILED( "LHS ARRAY ALTERED (14)" );
END IF;
WHEN OTHERS =>
FAILED( "WRONG EXCEPTION RAISED - SUBTEST 14" );
END ;
-------------------------------------------------------------------
RESULT ;
END C52104L;
|
30,867
|
ada
| 1
|
ytomino/vampire
|
source/vampire-forms.ads
|
<filename>source/vampire-forms.ads
-- The Village of Vampire by YT, このソースコードはNYSLです
with Ada.Calendar;
with Ada.Streams;
with Ada.Strings.Unbounded;
with Web.HTML;
with Tabula.Casts;
with Tabula.Villages;
package Vampire.Forms is
type Base_Page is (Index_Page, User_Page, User_List_Page, Village_Page);
type Template_Set_Type is (For_Full, For_Mobile);
type Root_Form_Type is abstract tagged limited null record;
-- HTML / template set
function HTML_Version (Form : Root_Form_Type) return Web.HTML.HTML_Version is
abstract;
function Template_Set (Form : Root_Form_Type) return Template_Set_Type is
abstract;
-- 出力用
function Self return String;
function Parameters_To_Index_Page (
Form : Root_Form_Type;
User_Id : String;
User_Password : String)
return Web.Query_Strings is abstract;
function Parameters_To_User_Page (
Form : Root_Form_Type;
User_Id : String;
User_Password : String)
return Web.Query_Strings is abstract;
function Parameters_To_Village_Page (
Form : Root_Form_Type;
Village_Id : Villages.Village_Id;
Day : Integer := -1;
First : Tabula.Villages.Speech_Index'Base := -1;
Last : Tabula.Villages.Speech_Index'Base := -1;
Latest : Tabula.Villages.Speech_Positive_Count'Base := -1;
User_Id : String;
User_Password : String)
return Web.Query_Strings is abstract;
function Parameters_To_Base_Page (
Form : Root_Form_Type'Class;
Base_Page : Forms.Base_Page;
Village_Id : Villages.Village_Id;
User_Id : String;
User_Password : String)
return Web.Query_Strings;
procedure Write_Attribute_Name (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Name : in String);
procedure Write_Attribute_Open (
Stream : not null access Ada.Streams.Root_Stream_Type'Class);
procedure Write_Attribute_Close (
Stream : not null access Ada.Streams.Root_Stream_Type'Class);
procedure Write_In_HTML (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Root_Form_Type;
Item : in String;
Pre : in Boolean := False) is abstract;
procedure Write_In_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Root_Form_Type;
Item : in String) is abstract;
procedure Write_Link (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Root_Form_Type'Class;
Current_Directory : in String;
Resource : in String;
Parameters : in Web.Query_Strings := Web.String_Maps.Empty_Map);
procedure Write_Link_To_Village_Page (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Root_Form_Type'Class;
Current_Directory : in String;
HTML_Directory : in String;
Log : in Boolean;
Village_Id : in Villages.Village_Id;
Day : Integer := -1;
First : Tabula.Villages.Speech_Index'Base := -1;
Last : Tabula.Villages.Speech_Index'Base := -1;
Latest : Tabula.Villages.Speech_Positive_Count'Base := -1;
User_Id : in String;
User_Password : in String);
function Paging (Form : Root_Form_Type) return Boolean is abstract;
function Speeches_Per_Page (Form : Root_Form_Type)
return Tabula.Villages.Speech_Positive_Count'Base is abstract;
-- ユーザー情報
function Get_User_Id (
Form : Root_Form_Type;
Query_Strings : Web.Query_Strings;
Cookie : Web.Cookie)
return String is abstract;
function Get_User_Password (
Form : Root_Form_Type;
Query_Strings : Web.Query_Strings;
Cookie : Web.Cookie)
return String is abstract;
function Get_New_User_Id (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return String;
function Get_New_User_Password (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return String;
function Get_New_User_Confirmation_Password (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return String;
procedure Set_User (
Form : in out Root_Form_Type;
Cookie : in out Web.Cookie;
New_User_Id : in String;
New_User_Password : in String) is abstract;
-- ページ
function Get_Base_Page (
Form : Root_Form_Type'Class;
Query_Strings : Web.Query_Strings;
Cookie : Web.Cookie)
return Base_Page;
-- 個人ページ
function Is_User_Page (
Form : Root_Form_Type;
Query_Strings : Web.Query_Strings;
Cookie : Web.Cookie)
return Boolean is abstract;
function Is_User_List_Page (
Form : Root_Form_Type'Class;
Query_Strings : Web.Query_Strings)
return Boolean;
-- 村
function Get_Village_Id (
Form : Root_Form_Type;
Query_Strings : Web.Query_Strings)
return Villages.Village_Id is abstract;
function Get_Day (
Form : Root_Form_Type;
Village : Villages.Village_Type'Class;
Query_Strings : Web.Query_Strings)
return Natural is abstract;
function Get_Range (
Form : Root_Form_Type;
Village : Villages.Village_Type'Class;
Day : Natural;
Now : Ada.Calendar.Time;
Query_Strings : Web.Query_Strings)
return Villages.Speech_Range_Type is abstract;
-- コマンド
function Get_Command (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return String;
function Get_New_Village_Name (
Form : Root_Form_Type;
Inputs : Web.Query_Strings)
return String is abstract;
function Get_Group (
Form : Root_Form_Type;
Inputs : Web.Query_Strings)
return Integer;
type Joining is record
Work_Index : Casts.Works.Cursor; -- "既定"はNo_Element
Name_Index : Casts.People.Cursor; -- No_Elementにはならない
Request : aliased Ada.Strings.Unbounded.Unbounded_String;
end record;
function Get_Joining (
Form : Root_Form_Type;
Inputs : Web.Query_Strings)
return Joining;
type Mark is (Missing, NG, OK);
function Get_Answered (
Form : Root_Form_Type;
Inputs : Web.Query_Strings)
return Mark;
function Get_Text (
Form : Root_Form_Type;
Inputs : Web.Query_Strings)
return String is abstract;
function Get_Reedit_Kind (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return String;
function Get_Action (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return String;
function Get_Target (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return Villages.Person_Index'Base;
function Get_Special (
Form : Root_Form_Type'Class;
Inputs : Web.Query_Strings)
return Boolean;
procedure Set_Rule (
Form : in Root_Form_Type'Class;
Village : in out Villages.Village_Type'Class;
Inputs : in Web.Query_Strings);
private
function Trim_Name (S : String) return String;
function Trim_Text (S : String) return String;
end Vampire.Forms;
|
30,868
|
ada
| 1
|
vidkidz/crossbridge
|
llvm-gcc-4.2-2.9/gcc/ada/s-rident.ads
|
<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . R I D E 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. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- This package defines the set of restriction identifiers. It is a generic
-- package that is instantiated by the compiler/binder in package Rident, and
-- is instantiated in package System.Restrictions for use at run-time.
-- The reason that we make this a generic package is so that in the case of
-- the instantiation in Rident for use at compile time and bind time, we can
-- generate normal image tables for the enumeration types, which are needed
-- for diagnostic and informational messages. At run-time we really do not
-- want to waste the space for these image tables, and they are not needed,
-- so we can do the instantiation under control of Discard_Names to remove
-- the tables.
generic
package System.Rident is
-- The following enumeration type defines the set of restriction
-- identifiers that are implemented in GNAT.
-- To add a new restriction identifier, add an entry with the name
-- to be used in the pragma, and add appropriate calls to the
-- Restrict.Check_Restriction routine.
type Restriction_Id is
-- The following cases are checked for consistency in the binder
(Simple_Barriers, -- GNAT (Ravenscar)
No_Abort_Statements, -- (RM D.7(5), H.4(3))
No_Access_Subprograms, -- (RM H.4(17))
No_Allocators, -- (RM H.4(7))
No_Asynchronous_Control, -- (RM D.7(10))
No_Calendar, -- GNAT
No_Delay, -- (RM H.4(21))
No_Direct_Boolean_Operators, -- GNAT
No_Dispatch, -- (RM H.4(19))
No_Dispatching_Calls, -- GNAT
No_Dynamic_Attachment, -- GNAT
No_Dynamic_Priorities, -- (RM D.9(9))
No_Enumeration_Maps, -- GNAT
No_Entry_Calls_In_Elaboration_Code, -- GNAT
No_Entry_Queue, -- GNAT (Ravenscar)
No_Exception_Handlers, -- GNAT
No_Exception_Registration, -- GNAT
No_Exceptions, -- (RM H.4(12))
No_Finalization, -- GNAT
No_Fixed_Point, -- (RM H.4(15))
No_Floating_Point, -- (RM H.4(14))
No_IO, -- (RM H.4(20))
No_Implicit_Conditionals, -- GNAT
No_Implicit_Dynamic_Code, -- GNAT
No_Implicit_Heap_Allocations, -- (RM D.8(8), H.4(3))
No_Implicit_Loops, -- GNAT
No_Initialize_Scalars, -- GNAT
No_Local_Allocators, -- (RM H.4(8))
No_Local_Protected_Objects, -- GNAT
No_Nested_Finalization, -- (RM D.7(4))
No_Protected_Type_Allocators, -- GNAT
No_Protected_Types, -- (RM H.4(5))
No_Recursion, -- (RM H.4(22))
No_Reentrancy, -- (RM H.4(23))
No_Relative_Delay, -- GNAT (Ravenscar)
No_Requeue_Statements, -- GNAT
No_Secondary_Stack, -- GNAT
No_Select_Statements, -- GNAT (Ravenscar)
No_Standard_Storage_Pools, -- GNAT
No_Streams, -- GNAT
No_Task_Allocators, -- (RM D.7(7))
No_Task_Attributes_Package, -- GNAT
No_Task_Hierarchy, -- (RM D.7(3), H.4(3))
No_Task_Termination, -- GNAT (Ravenscar)
No_Tasking, -- GNAT
No_Terminate_Alternatives, -- (RM D.7(6))
No_Unchecked_Access, -- (RM H.4(18))
No_Unchecked_Conversion, -- (RM H.4(16))
No_Unchecked_Deallocation, -- (RM H.4(9))
Static_Priorities, -- GNAT
Static_Storage_Size, -- GNAT
-- The following cases do not require partition-wide checks
Immediate_Reclamation, -- (RM H.4(10))
No_Implementation_Attributes, -- Ada 2005 AI-257
No_Implementation_Pragmas, -- Ada 2005 AI-257
No_Implementation_Restrictions, -- GNAT
No_Elaboration_Code, -- GNAT
No_Obsolescent_Features, -- Ada 2005 AI-368
No_Wide_Characters, -- GNAT
-- The following cases require a parameter value
-- The following entries are fully checked at compile/bind time,
-- which means that the compiler can in general tell the minimum
-- value which could be used with a restrictions pragma. The binder
-- can deduce the appropriate minimum value for the partition by
-- taking the maximum value required by any unit.
Max_Protected_Entries, -- (RM D.7(14))
Max_Select_Alternatives, -- (RM D.7(12))
Max_Task_Entries, -- (RM D.7(13), H.4(3))
-- The following entries are also fully checked at compile/bind
-- time, and the compiler can also at least in some cases tell
-- the minimum value which could be used with a restriction pragma.
-- The difference is that the contributions are additive, so the
-- binder deduces this value by adding the unit contributions.
Max_Tasks, -- (RM D.7(19), H.4(3))
-- The following entries are checked at compile time only for
-- zero/nonzero entries. This means that the compiler can tell
-- at compile time if a restriction value of zero is (would be)
-- violated, but that is all. The compiler cannot distinguish
-- between different non-zero values.
Max_Asynchronous_Select_Nesting, -- (RM D.7(18), H.4(3))
Max_Entry_Queue_Length, -- GNAT
-- The remaining entries are not checked at compile/bind time
Max_Storage_At_Blocking, -- (RM D.7(17))
Not_A_Restriction_Id);
-- Synonyms permitted for historical purposes of compatibility.
-- Must be coordinated with Restrict.Process_Restriction_Synonym.
Boolean_Entry_Barriers : Restriction_Id renames Simple_Barriers;
Max_Entry_Queue_Depth : Restriction_Id renames Max_Entry_Queue_Length;
No_Dynamic_Interrupts : Restriction_Id renames No_Dynamic_Attachment;
No_Requeue : Restriction_Id renames No_Requeue_Statements;
No_Task_Attributes : Restriction_Id renames No_Task_Attributes_Package;
subtype All_Restrictions is Restriction_Id range
Simple_Barriers .. Max_Storage_At_Blocking;
-- All restrictions (excluding only Not_A_Restriction_Id)
subtype All_Boolean_Restrictions is Restriction_Id range
Simple_Barriers .. No_Wide_Characters;
-- All restrictions which do not take a parameter
subtype Partition_Boolean_Restrictions is All_Boolean_Restrictions range
Simple_Barriers .. Static_Storage_Size;
-- Boolean restrictions that are checked for partition consistency.
-- Note that all parameter restrictions are checked for partition
-- consistency by default, so this distinction is only needed in the
-- case of Boolean restrictions.
subtype Cunit_Boolean_Restrictions is All_Boolean_Restrictions range
Immediate_Reclamation .. No_Wide_Characters;
-- Boolean restrictions that are not checked for partition consistency
-- and that thus apply only to the current unit. Note that for these
-- restrictions, the compiler does not apply restrictions found in
-- with'ed units, parent specs etc to the main unit.
subtype All_Parameter_Restrictions is
Restriction_Id range
Max_Protected_Entries .. Max_Storage_At_Blocking;
-- All restrictions that are take a parameter
subtype Checked_Parameter_Restrictions is
All_Parameter_Restrictions range
Max_Protected_Entries .. Max_Entry_Queue_Length;
-- These are the parameter restrictions that can be at least partially
-- checked at compile/binder time. Minimally, the compiler can detect
-- violations of a restriction pragma with a value of zero reliably.
subtype Checked_Max_Parameter_Restrictions is
Checked_Parameter_Restrictions range
Max_Protected_Entries .. Max_Task_Entries;
-- Restrictions with parameters that can be checked in some cases by
-- maximizing among statically detected instances where the compiler
-- can determine the count.
subtype Checked_Add_Parameter_Restrictions is
Checked_Parameter_Restrictions range
Max_Tasks .. Max_Tasks;
-- Restrictions with parameters that can be checked in some cases by
-- summing the statically detected instances where the compiler can
-- determine the count.
subtype Checked_Val_Parameter_Restrictions is
Checked_Parameter_Restrictions range
Max_Protected_Entries .. Max_Tasks;
-- Restrictions with parameter where the count is known at least in
-- some cases by the compiler/binder.
subtype Checked_Zero_Parameter_Restrictions is
Checked_Parameter_Restrictions range
Max_Asynchronous_Select_Nesting .. Max_Entry_Queue_Length;
-- Restrictions with parameters where the compiler can detect the use of
-- the feature, and hence violations of a restriction specifying a value
-- of zero, but cannot detect specific values other than zero/nonzero.
subtype Unchecked_Parameter_Restrictions is
All_Parameter_Restrictions range
Max_Storage_At_Blocking .. Max_Storage_At_Blocking;
-- Restrictions with parameters where the compiler cannot ever detect
-- corresponding compile time usage, so the binder and compiler never
-- detect violations of any restriction.
-------------------------------------
-- Restriction Status Declarations --
-------------------------------------
-- The following declarations are used to record the current status
-- or restrictions (for the current unit, or related units, at compile
-- time, and for all units in a partition at bind time or run time).
type Restriction_Flags is array (All_Restrictions) of Boolean;
type Restriction_Values is array (All_Parameter_Restrictions) of Natural;
type Parameter_Flags is array (All_Parameter_Restrictions) of Boolean;
type Restrictions_Info is record
Set : Restriction_Flags := (others => False);
-- An entry is True in the Set array if a restrictions pragma has
-- been encountered for the given restriction. If the value is
-- True for a parameter restriction, then the corresponding entry
-- in the Value array gives the minimum value encountered for any
-- such restriction.
Value : Restriction_Values;
-- If the entry for a parameter restriction in Set is True (i.e. a
-- restrictions pragma for the restriction has been encountered), then
-- the corresponding entry in the Value array is the minimum value
-- specified by any such restrictions pragma. Note that a restrictions
-- pragma specifying a value greater than Int'Last is simply ignored.
Violated : Restriction_Flags := (others => False);
-- An entry is True in the violations array if the compiler has
-- detected a violation of the restriction. For a parameter
-- restriction, the Count and Unknown arrays have additional
-- information.
Count : Restriction_Values := (others => 0);
-- If an entry for a parameter restriction is True in Violated,
-- the corresponding entry in the Count array may record additional
-- information. If the actual minimum count is known (by taking
-- maximums, or sums, depending on the restriction), it will be
-- recorded in this array. If not, then the value will remain zero.
Unknown : Parameter_Flags := (others => False);
-- If an entry for a parameter restriction is True in Violated,
-- the corresponding entry in the Unknown array may record additional
-- information. If the actual count is not known by the compiler (but
-- is known to be non-zero), then the entry in Unknown will be True.
-- This indicates that the value in Count is not known to be exact,
-- and the actual violation count may be higher.
-- Note: If Violated (K) is True, then either Count (K) > 0 or
-- Unknown (K) = True. It is possible for both these to be set.
-- For example, if Count (K) = 3 and Unknown (K) is True, it means
-- that the actual violation count is at least 3 but might be higher.
end record;
----------------------------------
-- Profile Definitions and Data --
----------------------------------
type Profile_Name is (Ravenscar, Restricted);
-- Names of recognized pfofiles
type Profile_Data is record
Set : Restriction_Flags;
-- Set to True if given restriction must be set for the profile,
-- and False if it need not be set (False does not mean that it
-- must not be set, just that it need not be set). If the flag
-- is True for a parameter restriction, then the Value array
-- gives the maximum value permitted by the profile.
Value : Restriction_Values;
-- An entry in this array is meaningful only if the corresponding
-- flag in Set is True. In that case, the value in this array is
-- the maximum value of the parameter permitted by the profile.
end record;
Profile_Info : array (Profile_Name) of Profile_Data :=
-- Restricted Profile
(Restricted =>
-- Restrictions for Restricted profile
(Set =>
(No_Abort_Statements => True,
No_Asynchronous_Control => True,
No_Dynamic_Attachment => True,
No_Dynamic_Priorities => True,
No_Entry_Queue => True,
No_Local_Protected_Objects => True,
No_Protected_Type_Allocators => True,
No_Requeue_Statements => True,
No_Task_Allocators => True,
No_Task_Attributes_Package => True,
No_Task_Hierarchy => True,
No_Terminate_Alternatives => True,
Max_Asynchronous_Select_Nesting => True,
Max_Protected_Entries => True,
Max_Select_Alternatives => True,
Max_Task_Entries => True,
others => False),
-- Value settings for Restricted profile
Value =>
(Max_Asynchronous_Select_Nesting => 0,
Max_Protected_Entries => 1,
Max_Select_Alternatives => 0,
Max_Task_Entries => 0,
others => 0)),
-- Ravenscar Profile
-- Note: the table entries here only represent the
-- required restriction profile for Ravenscar. The
-- full Ravenscar profile also requires:
-- pragma Dispatching_Policy (FIFO_Within_Priorities);
-- pragma Locking_Policy (Ceiling_Locking);
-- pragma Detect_Blocking
Ravenscar =>
-- Restrictions for Ravenscar = Restricted profile ..
(Set =>
(No_Abort_Statements => True,
No_Asynchronous_Control => True,
No_Dynamic_Attachment => True,
No_Dynamic_Priorities => True,
No_Entry_Queue => True,
No_Local_Protected_Objects => True,
No_Protected_Type_Allocators => True,
No_Requeue_Statements => True,
No_Task_Allocators => True,
No_Task_Attributes_Package => True,
No_Task_Hierarchy => True,
No_Terminate_Alternatives => True,
Max_Asynchronous_Select_Nesting => True,
Max_Protected_Entries => True,
Max_Select_Alternatives => True,
Max_Task_Entries => True,
-- plus these additional restrictions:
No_Calendar => True,
No_Implicit_Heap_Allocations => True,
No_Relative_Delay => True,
No_Select_Statements => True,
No_Task_Termination => True,
Simple_Barriers => True,
others => False),
-- Value settings for Ravenscar (same as Restricted)
Value =>
(Max_Asynchronous_Select_Nesting => 0,
Max_Protected_Entries => 1,
Max_Select_Alternatives => 0,
Max_Task_Entries => 0,
others => 0)));
end System.Rident;
|
30,869
|
ada
| 0
|
ytomino/gnat4drake
|
g-io.adb
|
with Ada.Integer_Text_IO;
package body GNAT.IO is
procedure Put (Item : Integer) is
begin
Ada.Integer_Text_IO.Put (Item);
end Put;
end GNAT.IO;
|
30,870
|
ada
| 7
|
kimtg/euler-ada
|
euler18.adb
|
with Ada.Text_IO;
procedure Euler18 is
Nums : array(Positive range <>, Positive range <>) of Natural :=
((75,00,00,00,00,00,00,00,00,00,00,00,00,00,00),
(95,64,00,00,00,00,00,00,00,00,00,00,00,00,00),
(17,47,82,00,00,00,00,00,00,00,00,00,00,00,00),
(18,35,87,10,00,00,00,00,00,00,00,00,00,00,00),
(20,04,82,47,65,00,00,00,00,00,00,00,00,00,00),
(19,01,23,75,03,34,00,00,00,00,00,00,00,00,00),
(88,02,77,73,07,63,67,00,00,00,00,00,00,00,00),
(99,65,04,28,06,16,70,92,00,00,00,00,00,00,00),
(41,41,26,56,83,40,80,70,33,00,00,00,00,00,00),
(41,48,72,33,47,32,37,16,94,29,00,00,00,00,00),
(53,71,44,65,25,43,91,52,97,51,14,00,00,00,00),
(70,11,33,28,77,73,17,78,39,68,17,57,00,00,00),
(91,71,52,38,17,14,91,43,58,50,27,29,48,00,00),
(63,66,04,68,89,53,67,30,73,16,69,87,40,31,00),
(04,62,98,27,23,09,70,98,73,93,38,53,60,04,23));
begin
-- go backward
for I in reverse 1 .. Nums'Last(1) - 1 loop
for J in 1 .. I loop
Nums(I,J) := Nums(I,J) + Integer'Max(Nums(I+1,J), Nums(I+1,J+1));
end loop;
end loop;
Ada.Text_IO.Put_Line(Integer'Image(Nums(1,1)));
end;
|
30,871
|
ada
| 3
|
mindviser/keepaSDK
|
ada-server/src/server/-skeletons.ads
|
<reponame>mindviser/keepaSDK
-- Keepa API
-- The Keepa API offers numerous endpoints. Every request requires your API access key as a parameter. You can find and change your key in the keepa portal. All requests must be issued as a HTTPS GET and accept gzip encoding. If possible, use a Keep_Alive connection. Multiple requests can be made in parallel to increase throughput.
--
-- OpenAPI spec version: 1.0.0
-- Contact: <EMAIL>
--
-- NOTE: This package is auto generated by the swagger code generator 4.0.0-beta2.
-- https://openapi-generator.tech
-- Do not edit the class manually.
with Swagger.Servers;
with .Models;
with Security.Permissions;
package .Skeletons is
use .Models;
type Server_Type is limited interface;
-- Returns Amazon category information from Keepa API.
-- Retrieve category objects using their node ids and (optional) their parent tree.
procedure Category
(Server : in out Server_Type;
Key : in Swagger.UString;
Domain : in Integer;
Category : in Integer;
Parents : in Integer;
Result : out .Models.CategoryType_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type) is abstract;
-- Retrieve the product for the specified ASIN and domain.
-- Retrieves the product object for the specified ASIN and domain. If our last update is older than one hour it will be automatically refreshed before delivered to you to ensure you get near to real-time pricing data. You can request products via either their ASIN (preferred) or via UPC and EAN codes. You can not use both parameters, asin and code, in the same request. Keepa can not track Amazon Fresh and eBooks.
procedure Product
(Server : in out Server_Type;
Key : in Swagger.UString;
Domain : in Integer;
Asin : in Swagger.Nullable_UString;
Code : in Swagger.Nullable_UString;
Result : out .Models.CategoryType_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type) is abstract;
generic
type Implementation_Type is limited new Server_Type with private;
URI_Prefix : String := "";
package Skeleton is
procedure Register (Server : in out Swagger.Servers.Application_Type'Class);
-- Returns Amazon category information from Keepa API.
procedure Category
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type);
-- Retrieve the product for the specified ASIN and domain.
procedure Product
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type);
end Skeleton;
generic
type Implementation_Type is limited new Server_Type with private;
URI_Prefix : String := "";
package Shared_Instance is
procedure Register (Server : in out Swagger.Servers.Application_Type'Class);
-- Returns Amazon category information from Keepa API.
procedure Category
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type);
-- Retrieve the product for the specified ASIN and domain.
procedure Product
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type);
private
protected Server is
-- Returns Amazon category information from Keepa API.
procedure Category
(Key : in Swagger.UString;
Domain : in Integer;
Category : in Integer;
Parents : in Integer;
Result : out .Models.CategoryType_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
-- Retrieve the product for the specified ASIN and domain.
procedure Product
(Key : in Swagger.UString;
Domain : in Integer;
Asin : in Swagger.Nullable_UString;
Code : in Swagger.Nullable_UString;
Result : out .Models.CategoryType_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
private
Impl : Implementation_Type;
end Server;
end Shared_Instance;
end .Skeletons;
|
30,872
|
ada
| 0
|
annexi-strayline/ASAP-Modular_Hashing
|
modular_hashing-sha1.ads
|
<reponame>annexi-strayline/ASAP-Modular_Hashing<gh_stars>0
------------------------------------------------------------------------------
-- --
-- Modular Hash Infrastructure --
-- --
-- SHA1 --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018-2021, 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 Interfaces;
with Ada.Streams;
package Modular_Hashing.SHA1 is
type SHA1_Hash is new Hash with private;
-- The final hash is a 160-bit message digest, which can also be displayed
-- as a 40 character hex string and is 20 bytes long
overriding function "<" (Left, Right : SHA1_Hash) return Boolean;
overriding function ">" (Left, Right : SHA1_Hash) return Boolean;
overriding function "=" (Left, Right : SHA1_Hash) return Boolean;
SHA1_Hash_Bytes: constant := 20;
overriding function Binary_Bytes (Value: SHA1_Hash) return Positive is
(SHA1_Hash_Bytes);
overriding function Binary (Value: SHA1_Hash) return Hash_Binary_Value with
Post => Binary'Result'Length = SHA1_Hash_Bytes;
type SHA1_Engine is new Hash_Algorithm with private;
overriding
procedure Write (Stream : in out SHA1_Engine;
Item : in Ada.Streams.Stream_Element_Array);
overriding procedure Reset (Engine : in out SHA1_Engine);
overriding function Digest (Engine : in out SHA1_Engine)
return Hash'Class;
private
use Ada.Streams, Interfaces;
type Message_Digest is array (1 .. 5) of Unsigned_32;
type SHA1_Hash is new Hash with
record
Digest: Message_Digest;
end record;
-----------------
-- SHA1_Engine --
-----------------
-- SHA-1 Defined initialization constants
H0_Initial: constant := 16#67452301#;
H1_Initial: constant := 16#EFCDAB89#;
H2_Initial: constant := 16#98BADCFE#;
H3_Initial: constant := 16#10325476#;
H4_Initial: constant := 16#C3D2E1F0#;
type SHA1_Engine is new Hash_Algorithm with record
Last_Element_Index : Stream_Element_Offset := 0;
Buffer : Stream_Element_Array(1 .. 64);
Message_Length : Unsigned_64 := 0;
H0 : Unsigned_32 := H0_Initial;
H1 : Unsigned_32 := H1_Initial;
H2 : Unsigned_32 := H2_Initial;
H3 : Unsigned_32 := H3_Initial;
H4 : Unsigned_32 := H4_Initial;
end record;
end Modular_Hashing.SHA1;
|
30,873
|
ada
| 5
|
reznikmm/increment
|
source/base/incr-nodes-tokens.adb
|
<gh_stars>1-10
-- Copyright (c) 2015-2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Incr.Nodes.Tokens is
------------------
-- Constructors --
------------------
package body Constructors is
----------------
-- Initialize --
----------------
procedure Initialize
(Self : out Token'Class;
Kind : Node_Kind;
Value : League.Strings.Universal_String;
State : Scanner_State;
Lookahead : Natural)
is
Now : constant Version_Trees.Version :=
Self.Document.History.Changing;
Diff : Integer := 0;
begin
Self.Kind := Kind;
Nodes.Constructors.Initialize (Self);
Versioned_Strings.Initialize
(Self.Text, League.Strings.Empty_Universal_String);
Versioned_Naturals.Initialize (Self.Back, 1);
Versioned_Naturals.Initialize (Self.Ahead, 1);
Versioned_Naturals.Initialize (Self.States, 0);
Versioned_Booleans.Set (Self.Exist, True, Now, Diff); -- UNDELETE??
Versioned_Strings.Set (Self.Text, Value, Now, Diff);
Versioned_Naturals.Set (Self.Ahead, Lookahead, Now, Diff);
Versioned_Naturals.Set (Self.States, Natural (State), Now, Diff);
Self.Update_Local_Changes (Diff);
end Initialize;
------------------------
-- Initialize_Ancient --
------------------------
procedure Initialize_Ancient
(Self : aliased in out Token'Class;
Parent : Node_Access;
Back : Natural) is
begin
Self.Kind := 0;
Nodes.Constructors.Initialize_Ancient (Self, Parent);
Versioned_Strings.Initialize
(Self.Text, League.Strings.Empty_Universal_String);
Versioned_Naturals.Initialize (Self.Back, Back);
Versioned_Naturals.Initialize (Self.Ahead, 1);
Versioned_Naturals.Initialize (Self.States, 0);
end Initialize_Ancient;
end Constructors;
-----------
-- Arity --
-----------
overriding function Arity (Self : Token) return Natural is
pragma Unreferenced (Self);
begin
return 0;
end Arity;
-----------
-- Child --
-----------
overriding function Child
(Self : Token;
Index : Positive;
Time : Version_Trees.Version) return Node_Access
is
pragma Unreferenced (Self, Index, Time);
begin
return null;
end Child;
-------------
-- Discard --
-------------
overriding procedure Discard (Self : in out Token) is
Now : constant Version_Trees.Version := Self.Document.History.Changing;
Diff : Integer;
begin
Versioned_Booleans.Discard (Self.Exist, Now, Diff);
Versioned_Strings.Discard (Self.Text, Now, Diff);
Versioned_Naturals.Discard (Self.Back, Now, Diff);
Versioned_Naturals.Discard (Self.Ahead, Now, Diff);
Versioned_Naturals.Discard (Self.States, Now, Diff);
Self.Update_Local_Changes (Diff);
end Discard;
--------------
-- Is_Token --
--------------
overriding function Is_Token (Self : Token) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Token;
----------
-- Kind --
----------
overriding function Kind (Self : Token) return Node_Kind is
begin
return Self.Kind;
end Kind;
--------------
-- Lookback --
--------------
not overriding function Lookback
(Self : Token;
Time : Version_Trees.Version) return Natural is
begin
return Versioned_Naturals.Get (Self.Back, Time);
end Lookback;
--------------------
-- Nested_Changes --
--------------------
overriding function Nested_Changes
(Self : Token;
From : Version_Trees.Version;
To : Version_Trees.Version) return Boolean
is
pragma Unreferenced (Self, From, To);
begin
return False;
end Nested_Changes;
----------------
-- Next_Token --
----------------
not overriding function Next_Token
(Self : aliased Token;
Time : Version_Trees.Version) return Token_Access
is
Next_Subtree : Node_Access := Self.Next_Subtree (Time);
Result : Token_Access;
begin
while Next_Subtree /= null loop
Result := Next_Subtree.First_Token (Time);
exit when Result /= null;
Next_Subtree := Next_Subtree.Next_Subtree (Time);
end loop;
return Result;
end Next_Token;
--------------------
-- Previous_Token --
--------------------
not overriding function Previous_Token
(Self : aliased Token;
Time : Version_Trees.Version) return Token_Access
is
Prev_Subtree : Node_Access := Self.Previous_Subtree (Time);
Result : Token_Access;
begin
while Prev_Subtree /= null loop
Result := Prev_Subtree.Last_Token (Time);
exit when Result /= null;
Prev_Subtree := Prev_Subtree.Previous_Subtree (Time);
end loop;
return Result;
end Previous_Token;
--------------
-- Set_Text --
--------------
not overriding procedure Set_Text
(Self : in out Token;
Value : League.Strings.Universal_String)
is
Now : constant Version_Trees.Version := Self.Document.History.Changing;
Diff : Integer := 0;
begin
Versioned_Strings.Set (Self.Text, Value, Now, Diff);
Self.Update_Local_Changes (Diff);
end Set_Text;
----------
-- Span --
----------
overriding function Span
(Self : aliased in out Token;
Kind : Span_Kinds;
Time : Version_Trees.Version) return Natural is
begin
case Kind is
when Text_Length =>
return Tokens.Text (Self, Time).Length;
when Token_Count =>
return 1;
when Line_Count =>
return Tokens.Text (Self, Time).Count (LF);
end case;
end Span;
-----------
-- State --
-----------
not overriding function State
(Self : access Token;
Time : Version_Trees.Version) return Scanner_State is
begin
return Scanner_State
(Versioned_Naturals.Get (Self.States, Time));
end State;
----------
-- Text --
----------
not overriding function Text
(Self : Token;
Time : Version_Trees.Version) return League.Strings.Universal_String is
begin
return Versioned_Strings.Get (Self.Text, Time);
end Text;
end Incr.Nodes.Tokens;
|
30,874
|
ada
| 0
|
joffreyhuguet/LmcpGen
|
ada/src/afrl/cmasi/afrl-cmasi-enumerations.ads
|
<reponame>joffreyhuguet/LmcpGen
package afrl.cmasi.enumerations is
type WavelengthBandEnum is (AllAny, EO, LWIR, SWIR, MWIR, Other);
for WavelengthBandEnum use (AllAny => 0, EO => 1, LWIR => 2, SWIR => 3, MWIR => 4, Other => 5);
type AltitudeTypeEnum is (AGL, MSL);
for AltitudeTypeEnum use (AGL => 0, MSL => 1);
type FOVOperationModeEnum is (Continuous, Discrete);
for FOVOperationModeEnum use (Continuous => 0, Discrete => 1);
type GimbalPointingModeEnum is (Unknown, AirVehicleRelativeAngle, AirVehicleRelativeSlewRate, LatLonSlaved, InertialRelativeSlewRate, Scan, Stowed);
for GimbalPointingModeEnum use (Unknown => 0, AirVehicleRelativeAngle => 1, AirVehicleRelativeSlewRate => 2, LatLonSlaved => 3, InertialRelativeSlewRate => 4, Scan => 5, Stowed => 6);
type CmasiEnum is (ABSTRACTGEOMETRY_ENUM,
KEYVALUEPAIR_ENUM,
LOCATION3D_ENUM,
PAYLOADACTION_ENUM,
PAYLOADCONFIGURATION_ENUM,
PAYLOADSTATE_ENUM,
VEHICLEACTION_ENUM,
-- TASK,
SEARCHTASK_ENUM,
ABSTRACTZONE_ENUM,
ENTITYCONFIGURATION_ENUM,
FLIGHTPROFILE_ENUM,
AIRVEHICLECONFIGURATION_ENUM,
ENTITYSTATE_ENUM,
AIRVEHICLESTATE_ENUM,
WEDGE_ENUM,
AREASEARCHTASK_ENUM,
CAMERAACTION_ENUM,
CAMERACONFIGURATION_ENUM,
GIMBALLEDPAYLOADSTATE_ENUM,
CAMERASTATE_ENUM,
CIRCLE_ENUM,
GIMBALANGLEACTION_ENUM,
GIMBALCONFIGURATION_ENUM,
GIMBALSCANACTION_ENUM,
GIMBALSTAREACTION_ENUM,
GIMBALSTATE_ENUM,
GOTOWAYPOINTACTION_ENUM,
KEEPINZONE_ENUM,
KEEPOUTZONE_ENUM,
LINESEARCHTASK_ENUM,
NAVIGATIONACTION_ENUM,
LOITERACTION_ENUM,
LOITERTASK_ENUM,
WAYPOINT_ENUM,
MISSIONCOMMAND_ENUM,
MUSTFLYTASK_ENUM,
OPERATORSIGNAL_ENUM,
OPERATINGREGION_ENUM,
AUTOMATIONREQUEST_ENUM,
POINTSEARCHTASK_ENUM,
POLYGON_ENUM,
RECTANGLE_ENUM,
REMOVETASKS_ENUM,
SERVICESTATUS_ENUM,
SESSIONSTATUS_ENUM,
VEHICLEACTIONCOMMAND_ENUM,
VIDEOSTREAMACTION_ENUM,
VIDEOSTREAMCONFIGURATION_ENUM,
VIDEOSTREAMSTATE_ENUM,
AUTOMATIONRESPONSE_ENUM,
REMOVEZONES_ENUM,
REMOVEENTITIES_ENUM,
FLIGHTDIRECTORACTION_ENUM,
WEATHERREPORT_ENUM,
FOLLOWPATHCOMMAND_ENUM,
PATHWAYPOINT_ENUM,
STOPMOVEMENTACTION_ENUM,
WAYPOINTTRANSFER_ENUM,
PAYLOADSTOWACTION_ENUM
);
for CmasiEnum use (ABSTRACTGEOMETRY_ENUM => 1,
KEYVALUEPAIR_ENUM => 2,
LOCATION3D_ENUM => 3,
PAYLOADACTION_ENUM => 4,
PAYLOADCONFIGURATION_ENUM => 5,
PAYLOADSTATE_ENUM => 6,
VEHICLEACTION_ENUM => 7,
-- TASK => 8,
SEARCHTASK_ENUM => 9,
ABSTRACTZONE_ENUM => 10,
ENTITYCONFIGURATION_ENUM => 11,
FLIGHTPROFILE_ENUM => 12,
AIRVEHICLECONFIGURATION_ENUM => 13,
ENTITYSTATE_ENUM => 14,
AIRVEHICLESTATE_ENUM => 15,
WEDGE_ENUM => 16,
AREASEARCHTASK_ENUM => 17,
CAMERAACTION_ENUM => 18,
CAMERACONFIGURATION_ENUM => 19,
GIMBALLEDPAYLOADSTATE_ENUM => 20,
CAMERASTATE_ENUM => 21,
CIRCLE_ENUM => 22,
GIMBALANGLEACTION_ENUM => 23,
GIMBALCONFIGURATION_ENUM => 24,
GIMBALSCANACTION_ENUM => 25,
GIMBALSTAREACTION_ENUM => 26,
GIMBALSTATE_ENUM => 27,
GOTOWAYPOINTACTION_ENUM => 28,
KEEPINZONE_ENUM => 29,
KEEPOUTZONE_ENUM => 30,
LINESEARCHTASK_ENUM => 31,
NAVIGATIONACTION_ENUM => 32,
LOITERACTION_ENUM => 33,
LOITERTASK_ENUM => 34,
WAYPOINT_ENUM => 35,
MISSIONCOMMAND_ENUM => 36,
MUSTFLYTASK_ENUM => 37,
OPERATORSIGNAL_ENUM => 38,
OPERATINGREGION_ENUM => 39,
AUTOMATIONREQUEST_ENUM => 40,
POINTSEARCHTASK_ENUM => 41,
POLYGON_ENUM => 42,
RECTANGLE_ENUM => 43,
REMOVETASKS_ENUM => 44,
SERVICESTATUS_ENUM => 45,
SESSIONSTATUS_ENUM => 46,
VEHICLEACTIONCOMMAND_ENUM => 47,
VIDEOSTREAMACTION_ENUM => 48,
VIDEOSTREAMCONFIGURATION_ENUM => 49,
VIDEOSTREAMSTATE_ENUM => 50,
AUTOMATIONRESPONSE_ENUM => 51,
REMOVEZONES_ENUM => 52,
REMOVEENTITIES_ENUM => 53,
FLIGHTDIRECTORACTION_ENUM => 54,
WEATHERREPORT_ENUM => 55,
FOLLOWPATHCOMMAND_ENUM => 56,
PATHWAYPOINT_ENUM => 57,
STOPMOVEMENTACTION_ENUM => 58,
WAYPOINTTRANSFER_ENUM => 59,
PAYLOADSTOWACTION_ENUM => 60
);
end afrl.cmasi.enumerations;
|
30,875
|
ada
| 488
|
rose-compiler/rose
|
src/frontend/Experimental_Ada_ROSE_Connection/parser/asis_adapter/source/asis_adapter-element-definitions.adb
|
<gh_stars>100-1000
with Asis.Definitions;
with Asis.Elements;
with A4G.A_Types; use A4G.A_Types;
with Asis.Set_Get;
package body Asis_Adapter.Element.Definitions is
-- "Add_And_Return_* functions query ASIS for a single value or list of
-- values, add it to the Dot graph, and return the value. These functions
-- usually have more than one caller.
--
-- "Add_*" procedures query ASIS for a single value or list of values,
-- add it to the Dot graph, and set the corresponding value in the local
-- Result record. These procedures are only called from the subprogram they
-- are declared in.
--
-- "Create_And_Return_*" functions create a struct, populate it by calling
-- Add_And_Return_* and Add_* routines based on the Element sub kind, and
-- return the struct. These functions are only called from the subprogram
-- they are declared in.
------------
-- EXPORTED:
------------
procedure Do_Pre_Child_Processing
(Element : in Asis.Element; State : in out Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Pre_Child_Processing";
-----------------------------------------------------------------------
-- BEGIN field support (Alphabetical order):
function Add_And_Return_Access_To_Function_Result_Profile return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Access_To_Function_Result_Profile (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Access_To_Function_Result_Profile", ID);
return ID;
end;
function Add_And_Return_Access_To_Subprogram_Parameter_Profile return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Access_To_Subprogram_Parameter_Profile (Element),
Dot_Label_Name => "Access_To_Subprogram_Parameter_Profile");
end;
function Add_And_Return_Ancestor_Subtype_Indication return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Ancestor_Subtype_Indication (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Ancestor_Subtype_Indication", ID);
return ID;
end;
function Add_And_Return_Anonymous_Access_To_Object_Subtype_Mark return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Anonymous_Access_To_Object_Subtype_Mark (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Anonymous_Access_To_Object_Subtype_Mark", ID);
return ID;
end;
function Add_And_Return_Array_Component_Definition return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Array_Component_Definition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Array_Component_Definition", ID);
return ID;
end;
function Add_And_Return_Aspect_Mark return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Aspect_Mark (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Aspect_Mark", ID);
return ID;
end;
function Add_And_Return_Aspect_Definition return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Aspect_Definition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Aspect_Definition", ID);
return ID;
end;
function Add_And_Return_Component_Definition_View return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Component_Definition_View (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Component_Definition_View", ID);
return ID;
end;
function Add_And_Return_Component_Subtype_Indication return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Component_Subtype_Indication (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Component_Subtype_Indication", ID);
return ID;
end;
function Add_And_Return_Corresponding_Parent_Subtype return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Corresponding_Parent_Subtype
(Element));
begin
State.Add_To_Dot_Label ("Corresponding_Parent_Subtype", ID);
return ID;
end;
function Add_And_Return_Corresponding_Root_Type return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Corresponding_Root_Type
(Element));
begin
State.Add_To_Dot_Label ("Corresponding_Root_Type", ID);
return ID;
end;
function Add_And_Return_Corresponding_Type_Operators return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Corresponding_Type_Operators (Element),
Dot_Label_Name => "Corresponding_Type_Operators");
end;
function Add_And_Return_Corresponding_Type_Structure return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Corresponding_Type_Structure
(Element));
begin
State.Add_To_Dot_Label ("Corresponding_Type_Structure", ID);
return ID;
end;
function Add_And_Return_Definition_Interface_List return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Definition_Interface_List (Element),
Dot_Label_Name => "Definition_Interface_List",
Add_Edges => True);
end;
function Add_And_Return_Discriminant_Direct_Name return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Discriminant_Direct_Name (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Discriminant_Direct_Name", ID);
return ID;
end;
function Add_And_Return_Delta_Expression return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Delta_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Delta_Expression", ID);
return ID;
end;
function Add_And_Return_Digits_Expression return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Digits_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Digits_Expression", ID);
return ID;
end;
function Add_And_Return_Discrete_Ranges return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Discrete_Ranges (Element),
Dot_Label_Name => "Discrete_Ranges",
Add_Edges => True);
end;
function Add_And_Return_Discriminant_Associations return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Discriminant_Associations (Element),
Dot_Label_Name => "Discriminant_Associations",
Add_Edges => True);
end;
function Add_And_Return_Discriminants return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Discriminants (Element),
Dot_Label_Name => "Discriminants",
Add_Edges => True);
end;
function Add_And_Return_Has_Abstract return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Abstract (Element);
begin
State.Add_To_Dot_Label ("Has_Abstract", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Aliased return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Aliased (Element);
begin
State.Add_To_Dot_Label ("Has_Aliased", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Limited return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Limited (Element);
begin
State.Add_To_Dot_Label ("Has_Limited", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Null_Exclusion return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Null_Exclusion (Element);
begin
State.Add_To_Dot_Label ("Has_Null_Exclusion", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Private return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Private (Element);
begin
State.Add_To_Dot_Label ("Has_Private", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Protected return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Protected (Element);
begin
State.Add_To_Dot_Label ("Has_Protected", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Synchronized return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Synchronized (Element);
begin
State.Add_To_Dot_Label ("Has_Synchronized", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Tagged return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Tagged (Element);
begin
State.Add_To_Dot_Label ("Has_Tagged", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Has_Task return ICE.bool is
Value : constant Boolean := Asis.Elements.Has_Task (Element);
begin
State.Add_To_Dot_Label ("Has_Task", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Implicit_Components return a_nodes_h.Element_ID_List is
-- Not implemented in ASIS for GNAT GPL 2017 (20170515-63)GNAT GPL 2017 (20170515-63):
Implemented_In_Asis : constant Boolean := False;
begin
if Implemented_In_Asis then
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Implicit_Components (Element),
Dot_Label_Name => "Implicit_Components",
Add_Edges => True);
else
return a_nodes_h.Support.Empty_Element_ID_List;
end if;
end;
function Add_And_Return_Implicit_Inherited_Declarations return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Implicit_Inherited_Declarations (Element),
Dot_Label_Name => "Implicit_Inherited_Declarations",
Add_Edges => True);
end;
function Add_And_Return_Implicit_Inherited_Subprograms return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Implicit_Inherited_Subprograms (Element),
Dot_Label_Name => "Implicit_Inherited_Subprograms",
Add_Edges => True);
end;
function Add_And_Return_Index_Subtype_Definitions return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Index_Subtype_Definitions (Element),
Dot_Label_Name => "Index_Subtype_Definitions",
Add_Edges => True);
end;
function Add_And_Return_Is_Not_Null_Return return ICE.bool is
Value : constant Boolean := Asis.Elements.Is_Not_Null_Return (Element);
begin
State.Add_To_Dot_Label ("Is_Not_Null_Return", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Is_Private_Present return ICE.bool is
Value : constant Boolean := Asis.Definitions.Is_Private_Present (Element);
begin
State.Add_To_Dot_Label ("Is_Private_Present", Value);
return a_nodes_h.Support.To_bool (Value);
end;
function Add_And_Return_Lower_Bound return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Lower_Bound (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Lower_Bound", ID);
return ID;
end;
function Add_And_Return_Parent_Subtype_Indication return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Parent_Subtype_Indication
(Element));
begin
State.Add_To_Dot_Label_And_Edge ("Parent_Subtype_Indication", ID);
return ID;
end;
function Add_And_Return_Private_Part_Items return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Private_Part_Items (Element),
Dot_Label_Name => "Private_Part_Items",
Add_Edges => True);
end;
function Add_And_Return_Range_Attribute return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Range_Attribute (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Range_Attribute", ID);
return ID;
end;
function Add_And_Return_Real_Range_Constraint return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Real_Range_Constraint (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Real_Range_Constraint", ID);
return ID;
end;
function Add_And_Return_Record_Components return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Record_Components (Element),
Dot_Label_Name => "Record_Components",
Add_Edges => True);
end;
function Add_And_Return_Record_Definition return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Record_Definition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Record_Definition", ID);
return ID;
end;
function Add_And_Return_Subtype_Constraint return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Subtype_Constraint (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Subtype_Constraint", ID);
return ID;
end;
function Add_And_Return_Subtype_Mark return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Subtype_Mark (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Subtype_Mark", ID);
return ID;
end;
function Add_And_Return_Upper_Bound return a_nodes_h.Element_ID is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Upper_Bound (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Upper_Bound", ID);
return ID;
end;
function Add_And_Return_Variant_Choices return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Variant_Choices (Element),
Dot_Label_Name => "Variant_Choices",
Add_Edges => True);
end;
function Add_And_Return_Variants return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Variants (Element),
Dot_Label_Name => "Variants",
Add_Edges => True);
end;
function Add_And_Return_Visible_Part_Items return a_nodes_h.Element_ID_List is
begin
return To_Element_ID_List
(This => State,
Elements_In => Asis.Definitions.Visible_Part_Items (Element),
Dot_Label_Name => "Visible_Part_Items",
Add_Edges => True);
end;
-- END Field support
-----------------------------------------------------------------------
-- BEGIN record support:
-- Has more than one caller:
-- Has side effects:
function Create_And_Return_Access_Definition
return a_nodes_h.Access_Definition_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name &
".Create_And_Return_Access_Definition";
Result : a_nodes_h.Access_Definition_Struct :=
a_nodes_h.Support.Default_Access_Definition_Struct;
Access_Definition_Kind : constant Asis.Access_Definition_Kinds :=
Asis.Elements.Access_Definition_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Access_Definition_Kind", Access_Definition_Kind'Image);
Result.Access_Definition_Kind := To_Access_Definition_Kinds (Access_Definition_Kind);
Result.Has_Null_Exclusion := Add_And_Return_Has_Null_Exclusion;
end Add_Common_Items;
use all type Asis.Access_Definition_Kinds;
begin
If Access_Definition_Kind /= Not_An_Access_Definition then
Add_Common_Items;
end if;
case Access_Definition_Kind is
when Not_An_Access_Definition =>
raise Internal_Error with
Module_Name & " called with: " & Access_Definition_Kind'Image;
when An_Anonymous_Access_To_Variable =>
Result.Anonymous_Access_To_Object_Subtype_Mark := Add_And_Return_Anonymous_Access_To_Object_Subtype_Mark;
when An_Anonymous_Access_To_Constant =>
Result.Anonymous_Access_To_Object_Subtype_Mark := Add_And_Return_Anonymous_Access_To_Object_Subtype_Mark;
when An_Anonymous_Access_To_Procedure =>
Result.Access_To_Subprogram_Parameter_Profile := Add_And_Return_Access_To_Subprogram_Parameter_Profile;
when An_Anonymous_Access_To_Protected_Procedure =>
Result.Access_To_Subprogram_Parameter_Profile := Add_And_Return_Access_To_Subprogram_Parameter_Profile;
when An_Anonymous_Access_To_Function =>
Result.Access_To_Subprogram_Parameter_Profile := Add_And_Return_Access_To_Subprogram_Parameter_Profile;
Result.Is_Not_Null_Return := Add_And_Return_Is_Not_Null_Return;
when An_Anonymous_Access_To_Protected_Function =>
Result.Access_To_Subprogram_Parameter_Profile := Add_And_Return_Access_To_Subprogram_Parameter_Profile;
Result.Is_Not_Null_Return := Add_And_Return_Is_Not_Null_Return;
end case;
return Result;
end Create_And_Return_Access_Definition;
-- Has side effects:
function Create_And_Return_Access_Type
return a_nodes_h.Access_Type_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name &
".Create_And_Return_Access_Type";
Result : a_nodes_h.Access_Type_Struct :=
a_nodes_h.Support.Default_Access_Type_Struct;
Access_Type_Kind : constant Asis.Access_Type_Kinds :=
Asis.Elements.Access_Type_Kind (Element);
-- Supporting procedures are in alphabetical order:
procedure Add_Access_To_Object_Definition is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Access_To_Object_Definition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Access_To_Object_Definition", ID);
Result.Access_To_Object_Definition := ID;
end;
procedure Add_Access_To_Function_Result_Profile is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Access_To_Function_Result_Profile (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Access_To_Function_Result_Profile", ID);
Result.Access_To_Function_Result_Profile := ID;
end;
procedure Add_Access_To_Subprogram_Parameter_Profile is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Definitions.Access_To_Subprogram_Parameter_Profile (Element),
Dot_Label_Name => "Access_To_Subprogram_Parameter_Profile",
List_Out => Result.Access_To_Subprogram_Parameter_Profile,
Add_Edges => True);
end;
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Access_Type_Kind", Access_Type_Kind'Image);
Result.Access_Type_Kind := To_Access_Type_Kinds (Access_Type_Kind);
end Add_Common_Items;
use all type Asis.Access_Type_Kinds;
begin -- Create_And_Return_Access_Type
If Access_Type_Kind /= Not_An_Access_Type_Definition then
Add_Common_Items;
end if;
case Access_Type_Kind is
when Not_An_Access_Type_Definition =>
raise Internal_Error with
Module_Name & " called with: " & Access_Type_Kind'Image;
when A_Pool_Specific_Access_To_Variable =>
Add_Access_To_Object_Definition;
when An_Access_To_Variable =>
Add_Access_To_Object_Definition;
when An_Access_To_Constant =>
Add_Access_To_Object_Definition;
when An_Access_To_Procedure =>
Add_Access_To_Subprogram_Parameter_Profile;
when An_Access_To_Protected_Procedure =>
Add_Access_To_Subprogram_Parameter_Profile;
when An_Access_To_Function =>
Add_Access_To_Subprogram_Parameter_Profile;
Add_Access_To_Function_Result_Profile;
when An_Access_To_Protected_Function =>
Add_Access_To_Subprogram_Parameter_Profile;
Add_Access_To_Function_Result_Profile;
end case;
-- when An_Anonymous_Access_To_Variable =>
-- -- Anonymous_Access_To_Object_Subtype_Mark -- A2005
-- State.Add_Not_Implemented (Ada_2005);
-- when An_Anonymous_Access_To_Constant =>
-- -- Anonymous_Access_To_Object_Subtype_Mark -- A2005
-- State.Add_Not_Implemented (Ada_2005);
-- when An_Anonymous_Access_To_Procedure =>
-- -- Access_To_Subprogram_Parameter_Profile -- A2005
-- State.Add_Not_Implemented (Ada_2005);
-- when An_Anonymous_Access_To_Protected_Procedure =>
-- -- Access_To_Subprogram_Parameter_Profile -- A2005
-- State.Add_Not_Implemented (Ada_2005);
-- when An_Anonymous_Access_To_Function =>
-- -- Access_To_Subprogram_Parameter_Profile -- A2005
-- State.Add_Not_Implemented (Ada_2005);
-- when An_Anonymous_Access_To_Protected_Function =>
-- -- Access_To_Subprogram_Parameter_Profile -- A2005
-- State.Add_Not_Implemented (Ada_2005);
-- A2005?
-- Result.Has_Null_Exclusion := Add_Has_Null_Exclusion;
-- Result.Is_Not_Null_Return
return Result;
end Create_And_Return_Access_Type;
-- Has side effects:
function Create_And_Return_Aspect_Specification
return a_nodes_h.Aspect_Specification_Struct is
begin
return
(Aspect_Mark => Add_And_Return_Aspect_Mark,
Aspect_Definition => Add_And_Return_Aspect_Definition);
end Create_And_Return_Aspect_Specification;
-- Has side effects:
function Create_And_Return_Component_Definition
return a_nodes_h.Component_Definition_Struct
is
Result : a_nodes_h.Component_Definition_Struct :=
a_nodes_h.Support.Default_Component_Definition_Struct;
begin -- Create_And_Return_Component_Definition
if Supported_Ada_Version < Ada_2005 then
-- Component_Subtype_Indication should not be needed as long as
-- Component_Definition_View is available. See comment in
-- Asis.Definitions under function Component_Subtype_Indication.
Result.Component_Subtype_Indication :=
Add_And_Return_Component_Subtype_Indication;
-- Returns Definition_Kinds:
-- A_Subtype_Indication
else
Result.Component_Definition_View :=
Add_And_Return_Component_Definition_View;
-- Returns Definition_Kinds:
-- A_Subtype_Indication
-- An_Access_Definition
end if;
Result.Has_Aliased := Add_And_Return_Has_Aliased;
return Result;
end Create_And_Return_Component_Definition;
-- Has side effects:
function Create_And_Return_Discrete_Range
return a_nodes_h.Discrete_Range_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name &
".Create_And_Return_Discrete_Range";
Result : a_nodes_h.Discrete_Range_Struct :=
a_nodes_h.Support.Default_Discrete_Range_Struct;
Discrete_Range_Kind : constant Asis.Discrete_Range_Kinds :=
Asis.Elements.Discrete_Range_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Discrete_Range_Kind", Discrete_Range_Kind'Image);
Result.Discrete_Range_Kind := To_Discrete_Range_Kinds (Discrete_Range_Kind);
end Add_Common_Items;
use all type Asis.Discrete_Range_Kinds;
begin -- Create_And_Return_Discrete_Range
If Discrete_Range_Kind /= Not_A_Discrete_Range then
Add_Common_Items;
end if;
case Discrete_Range_Kind is
when Not_A_Discrete_Range =>
raise Internal_Error with
Module_Name & " called with: " & Discrete_Range_Kind'Image;
when A_Discrete_Subtype_Indication =>
Result.Subtype_Mark := Add_And_Return_Subtype_Mark;
Result.Subtype_Constraint := Add_And_Return_Subtype_Constraint;
when A_Discrete_Range_Attribute_Reference =>
Result.Range_Attribute := Add_And_Return_Range_Attribute;
when A_Discrete_Simple_Expression_Range =>
Result.Lower_Bound := Add_And_Return_Lower_Bound;
Result.Upper_Bound := Add_And_Return_Upper_Bound;
end case;
return Result;
end Create_And_Return_Discrete_Range;
-- Has side effects:
function Create_And_Return_Discrete_Subtype_Definition
return a_nodes_h.Discrete_Subtype_Definition_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name &
".Create_And_Return_Discrete_Discrete_Subtype_Definition";
Result : a_nodes_h.Discrete_Subtype_Definition_Struct :=
a_nodes_h.Support.Default_Discrete_Subtype_Definition_Struct;
Discrete_Range_Kind : constant Asis.Discrete_Range_Kinds :=
Asis.Elements.Discrete_Range_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Discrete_Range_Kind", Discrete_Range_Kind'Image);
Result.Discrete_Range_Kind := To_Discrete_Range_Kinds (Discrete_Range_Kind);
end Add_Common_Items;
use all type Asis.Discrete_Range_Kinds;
begin -- Create_And_Return_Discrete_Subtype_Definition
If Discrete_Range_Kind /= Not_A_Discrete_Range then
Add_Common_Items;
end if;
case Discrete_Range_Kind is
when Not_A_Discrete_Range =>
raise Internal_Error with
Module_Name & " called with: " & Discrete_Range_Kind'Image;
when A_Discrete_Subtype_Indication =>
Result.Subtype_Mark := Add_And_Return_Subtype_Mark;
Result.Subtype_Constraint := Add_And_Return_Subtype_Constraint;
when A_Discrete_Range_Attribute_Reference =>
Result.Range_Attribute := Add_And_Return_Range_Attribute;
when A_Discrete_Simple_Expression_Range =>
Result.Lower_Bound := Add_And_Return_Lower_Bound;
Result.Upper_Bound := Add_And_Return_Upper_Bound;
end case;
return Result;
end Create_And_Return_Discrete_Subtype_Definition;
-- Has side effects:
function Create_And_Return_Constraint
return a_nodes_h.Constraint_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name &
".Create_And_Return_Constraint";
Result : a_nodes_h.Constraint_Struct :=
a_nodes_h.Support.Default_Constraint_Struct;
Constraint_Kind : constant Asis.Constraint_Kinds :=
Asis.Elements.Constraint_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Constraint_Kind", Constraint_Kind'Image);
Result.Constraint_Kind := To_Constraint_Kinds (Constraint_Kind);
end Add_Common_Items;
use all type Asis.Constraint_Kinds;
begin -- Create_And_Return_Constraint
if Constraint_Kind /= Not_A_Constraint then
Add_Common_Items;
end if;
case Constraint_Kind is
when Not_A_Constraint =>
raise Internal_Error with
Module_Name & " called with: " & Constraint_Kind'Image;
when A_Range_Attribute_Reference =>
Result.Range_Attribute := Add_And_Return_Range_Attribute;
when A_Simple_Expression_Range =>
Result.Lower_Bound := Add_And_Return_Lower_Bound;
Result.Upper_Bound := Add_And_Return_Upper_Bound;
when A_Digits_Constraint =>
Result.Digits_Expression := Add_And_Return_Digits_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when A_Delta_Constraint =>
Result.Delta_Expression := Add_And_Return_Delta_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when An_Index_Constraint =>
Result.Discrete_Ranges := Add_And_Return_Discrete_Ranges;
when A_Discriminant_Constraint =>
Result.Discriminant_Associations := Add_And_Return_Discriminant_Associations;
end case;
return Result;
end Create_And_Return_Constraint;
-- Has side effects:
function Create_And_Return_Formal_Type_Definition
return a_nodes_h.Formal_Type_Definition_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name &
".Create_And_Return_Formal_Type_Definition";
Result : a_nodes_h.Formal_Type_Definition_Struct :=
a_nodes_h.Support.Default_Formal_Type_Definition_Struct;
Formal_Type_Kind: constant Asis.Formal_Type_Kinds :=
Asis.Elements.Formal_Type_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Formal_Type_Kind", Formal_Type_Kind'Image);
Result.Formal_Type_Kind := To_Formal_Type_Kinds (Formal_Type_Kind);
Result.Corresponding_Type_Operators := Add_And_Return_Corresponding_Type_Operators;
end Add_Common_Items;
use all type Asis.Formal_Type_Kinds;
begin -- Create_And_Return_Formal_Type_Definition
if Formal_Type_Kind /= Not_A_Formal_Type_Definition then
Add_Common_Items;
end if;
case Formal_Type_Kind is
when Not_A_Formal_Type_Definition =>
raise Internal_Error with
Module_Name & " called with: " & Formal_Type_Kind'Image;
when A_Formal_Private_Type_Definition =>
-- Has_Abstract is here for completeness, but it will never be true.
-- See the comment in Asis.Definitins.Has_Abstract:
Result.Has_Abstract := Add_And_Return_Has_Abstract;
Result.Has_Limited := Add_And_Return_Has_Limited;
Result.Has_Private := Add_And_Return_Has_Private;
-- No child elements
when A_Formal_Tagged_Private_Type_Definition =>
Result.Has_Abstract := Add_And_Return_Has_Abstract;
Result.Has_Limited := Add_And_Return_Has_Limited;
Result.Has_Private := Add_And_Return_Has_Private;
Result.Has_Tagged := Add_And_Return_Has_Tagged;
-- No child elements
when A_Formal_Derived_Type_Definition =>
-- Has_Abstract is here for completeness, but it will never be true.
-- See the comment in Asis.Definitins.Has_Abstract:
Result.Has_Abstract := Add_And_Return_Has_Abstract;
Result.Has_Limited := Add_And_Return_Has_Limited;
Result.Has_Private := Add_And_Return_Has_Private;
Result.Implicit_Inherited_Declarations :=
Add_And_Return_Implicit_Inherited_Declarations;
Result.Implicit_Inherited_Subprograms :=
Add_And_Return_Implicit_Inherited_Subprograms;
Result.Subtype_Mark := Add_And_Return_Subtype_Mark;
-- Result.Definition_Interface_List := -- A2005
-- Add_And_Return_Definition_Interface_List; -- A2005
-- Result.Has_Synchronized := -- A2005
-- Add_And_Return_Has_Synchronized; -- A2005
when A_Formal_Discrete_Type_Definition |
A_Formal_Signed_Integer_Type_Definition |
A_Formal_Modular_Type_Definition |
A_Formal_Floating_Point_Definition |
A_Formal_Ordinary_Fixed_Point_Definition |
A_Formal_Decimal_Fixed_Point_Definition =>
null; -- No child elements
when A_Formal_Interface_Type_Definition =>
State.Add_Not_Implemented (Ada_2005);
when A_Formal_Unconstrained_Array_Definition =>
Result.Index_Subtype_Definitions :=
Add_And_Return_Index_Subtype_Definitions;
Result.Array_Component_Definition :=
Add_And_Return_Array_Component_Definition;
when A_Formal_Constrained_Array_Definition =>
Result.Index_Subtype_Definitions :=
Add_And_Return_Index_Subtype_Definitions;
Result.Array_Component_Definition :=
Add_And_Return_Array_Component_Definition;
when A_Formal_Access_Type_Definition =>
Result.Access_Type := Create_And_Return_Access_Type;
end case;
return Result;
end Create_And_Return_Formal_Type_Definition;
-- Has side effects:
function Create_And_Return_Known_Discriminant_Part
return a_nodes_h.Known_Discriminant_Part_Struct is
begin
return
(Discriminants => Add_And_Return_Discriminants);
end Create_And_Return_Known_Discriminant_Part;
-- Has side effects:
function Create_And_Return_Private_Extension_Definition
return a_nodes_h.Private_Extension_Definition_Struct is
begin
return
(Has_Abstract => Add_And_Return_Has_Abstract,
Has_Limited => Add_And_Return_Has_Limited,
Has_Private => Add_And_Return_Has_Private,
Has_Synchronized => Add_And_Return_Has_Synchronized,
Implicit_Inherited_Declarations =>
Add_And_Return_Implicit_Inherited_Declarations,
Implicit_Inherited_Subprograms =>
Add_And_Return_Implicit_Inherited_Subprograms,
Definition_Interface_List =>
Add_And_Return_Definition_Interface_List,
Ancestor_Subtype_Indication =>
Add_And_Return_Ancestor_Subtype_Indication,
Corresponding_Type_Operators =>
Add_And_Return_Corresponding_Type_Operators);
end Create_And_Return_Private_Extension_Definition;
-- Has side effects:
function Create_And_Return_Private_Type_Definition
return a_nodes_h.Private_Type_Definition_Struct is
begin
return
(Has_Abstract => Add_And_Return_Has_Abstract,
Has_Limited => Add_And_Return_Has_Limited,
Has_Private => Add_And_Return_Has_Private,
Corresponding_Type_Operators =>
Add_And_Return_Corresponding_Type_Operators);
end Create_And_Return_Private_Type_Definition;
-- Has side effects:
function Create_And_Return_Protected_Definition
return a_nodes_h.Protected_Definition_Struct is
begin
return
(Has_Protected => Add_And_Return_Has_Protected,
Visible_Part_Items => Add_And_Return_Visible_Part_Items,
Private_Part_Items => Add_And_Return_Private_Part_Items,
Is_Private_Present => Add_And_Return_Is_Private_Present,
Corresponding_Type_Operators =>
Add_And_Return_Corresponding_Type_Operators);
end Create_And_Return_Protected_Definition;
-- Has side effects:
function Create_And_Return_Subtype_Indication
return a_nodes_h.Subtype_Indication_Struct is
begin
return
(Has_Null_Exclusion => Add_And_Return_Has_Null_Exclusion,
Subtype_Mark => Add_And_Return_Subtype_Mark,
Subtype_Constraint => Add_And_Return_Subtype_Constraint);
end Create_And_Return_Subtype_Indication;
-- Has side effects:
function Create_And_Return_Subtype_Constraint
return a_nodes_h.Constraint_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Create_And_Return_Subtype_Constraint";
Result : a_nodes_h.Constraint_Struct :=
a_nodes_h.Support.Default_Constraint_Struct;
Constraint_Kind : constant Asis.Constraint_Kinds :=
Asis.Elements.Constraint_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Constraint_Kind", Constraint_Kind'Image);
Result.Constraint_Kind := To_Constraint_Kinds (Constraint_Kind);
end Add_Common_Items;
use all type Asis.Constraint_Kinds;
begin -- Create_And_Return_Subtype_Constraint
If Constraint_Kind /= Not_A_Constraint then
Add_Common_Items;
end if;
case Constraint_Kind is
when Not_A_Constraint =>
raise Internal_Error with
Module_Name & " called with: " & Constraint_Kind'Image;
when A_Range_Attribute_Reference =>
Result.Range_Attribute := Add_And_Return_Range_Attribute;
when A_Simple_Expression_Range =>
Result.Lower_Bound := Add_And_Return_Lower_Bound;
Result.Upper_Bound := Add_And_Return_Upper_Bound;
when A_Digits_Constraint =>
Result.Digits_Expression := Add_And_Return_Digits_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when A_Delta_Constraint =>
Result.Delta_Expression := Add_And_Return_Delta_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when An_Index_Constraint =>
Result.Discrete_Ranges := Add_And_Return_Discrete_Ranges;
when A_Discriminant_Constraint =>
Result.Discriminant_Associations := Add_And_Return_Discriminant_Associations;
end case;
return Result;
end Create_And_Return_Subtype_Constraint;
-- Has side effects:
function Create_And_Return_Tagged_Private_Type_Definition
return a_nodes_h.Tagged_Private_Type_Definition_Struct is
begin
return
(Has_Abstract => Add_And_Return_Has_Abstract,
Has_Limited => Add_And_Return_Has_Limited,
Has_Private => Add_And_Return_Has_Private,
Has_Tagged => Add_And_Return_Has_Tagged,
Corresponding_Type_Operators =>
Add_And_Return_Corresponding_Type_Operators);
end Create_And_Return_Tagged_Private_Type_Definition;
-- Has side effects:
function Create_And_Return_Type_Definition
return a_nodes_h.Type_Definition_Struct
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Create_And_Return_Type_Definition";
Result : a_nodes_h.Type_Definition_Struct :=
a_nodes_h.Support.Default_Type_Definition_Struct;
Type_Kind : constant Asis.Type_Kinds :=
Asis.Elements.Type_Kind (Element);
-- Supporting procedures are in alphabetical order:
procedure Add_Array_Component_Definition is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Array_Component_Definition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Array_Component_Definition", ID);
Result.Array_Component_Definition := ID;
end;
procedure Add_Discrete_Subtype_Definitions is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Definitions.Discrete_Subtype_Definitions (Element),
Dot_Label_Name => "Discrete_Subtype_Definitions",
List_Out => Result.Discrete_Subtype_Definitions,
Add_Edges => True);
end;
procedure Add_Enumeration_Literal_Declarations is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Definitions.Enumeration_Literal_Declarations (Element),
Dot_Label_Name => "Enumeration_Literal_Declarations",
List_Out => Result.Enumeration_Literal_Declarations,
Add_Edges => True);
end;
procedure Add_Index_Subtype_Definitions is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Definitions.Index_Subtype_Definitions (Element),
Dot_Label_Name => "Index_Subtype_Definitions",
List_Out => Result.Index_Subtype_Definitions,
Add_Edges => True);
end;
procedure Add_Integer_Constraint is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Integer_Constraint (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Integer_Constraint", ID);
Result.Integer_Constraint := ID;
end;
procedure Add_Mod_Static_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Definitions.Mod_Static_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Mod_Static_Expression", ID);
Result.Mod_Static_Expression := ID;
end;
procedure Add_Root_Type_Kind is
Value : Asis.Root_Type_Kinds := Asis.Elements.Root_Type_Kind (Element);
begin
State.Add_To_Dot_Label ("Root_Type_Kind", Value'Image);
Result.Root_Type_Kind :=
To_Root_Type_Kinds (Value);
end;
procedure Add_Common_Items is
begin -- Add_Common_Items
State.Add_To_Dot_Label ("Type_Kind", Type_Kind'Image);
Result.Type_Kind := To_Type_Kinds (Type_Kind);
Result.Has_Limited := Add_And_Return_Has_Limited;
Result.Has_Private := Add_And_Return_Has_Private;
Result.Corresponding_Type_Operators := Add_And_Return_Corresponding_Type_Operators;
end Add_Common_Items;
use all type Asis.Type_Kinds;
begin -- Create_And_Return_Type_Definition
If Type_Kind /= Not_A_Type_Definition then
Add_Common_Items;
end if;
case Type_Kind is
when Not_A_Type_Definition =>
raise Internal_Error with
Module_Name & " called with: " & Type_Kind'Image;
when A_Derived_Type_Definition =>
Result.Parent_Subtype_Indication := Add_And_Return_Parent_Subtype_Indication;
Result.Implicit_Inherited_Declarations := Add_And_Return_Implicit_Inherited_Declarations;
Result.Implicit_Inherited_Subprograms := Add_And_Return_Implicit_Inherited_Subprograms;
Result.Corresponding_Parent_Subtype := Add_And_Return_Corresponding_Parent_Subtype;
Result.Corresponding_Root_Type := Add_And_Return_Corresponding_Root_Type;
Result.Corresponding_Type_Structure := Add_And_Return_Corresponding_Type_Structure;
when A_Derived_Record_Extension_Definition =>
Result.Has_Abstract := Add_And_Return_Has_Abstract;
Result.Parent_Subtype_Indication := Add_And_Return_Parent_Subtype_Indication;
Result.Record_Definition := Add_And_Return_Record_Definition;
Result.Implicit_Inherited_Declarations := Add_And_Return_Implicit_Inherited_Declarations;
Result.Implicit_Inherited_Subprograms := Add_And_Return_Implicit_Inherited_Subprograms;
Result.Corresponding_Parent_Subtype := Add_And_Return_Corresponding_Parent_Subtype;
Result.Corresponding_Root_Type := Add_And_Return_Corresponding_Root_Type;
Result.Corresponding_Type_Structure := Add_And_Return_Corresponding_Type_Structure;
Result.Definition_Interface_List := Add_And_Return_Definition_Interface_List;
when An_Enumeration_Type_Definition =>
Add_Enumeration_Literal_Declarations;
when A_Signed_Integer_Type_Definition =>
Add_Integer_Constraint;
when A_Modular_Type_Definition =>
Add_Mod_Static_Expression;
when A_Root_Type_Definition =>
Add_Root_Type_Kind;
-- No more info
when A_Floating_Point_Definition =>
Result.Digits_Expression := Add_And_Return_Digits_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when An_Ordinary_Fixed_Point_Definition =>
Result.Delta_Expression := Add_And_Return_Delta_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when A_Decimal_Fixed_Point_Definition =>
Result.Digits_Expression := Add_And_Return_Digits_Expression;
Result.Delta_Expression := Add_And_Return_Delta_Expression;
Result.Real_Range_Constraint := Add_And_Return_Real_Range_Constraint;
when An_Unconstrained_Array_Definition =>
Add_Index_Subtype_Definitions;
Add_Array_Component_Definition;
when A_Constrained_Array_Definition =>
Add_Discrete_Subtype_Definitions;
Add_Array_Component_Definition;
when A_Record_Type_Definition =>
Result.Record_Definition := Add_And_Return_Record_Definition;
when A_Tagged_Record_Type_Definition =>
Result.Has_Tagged := Add_And_Return_Has_Tagged;
Result.Has_Abstract := Add_And_Return_Has_Abstract;
Result.Record_Definition := Add_And_Return_Record_Definition;
when An_Interface_Type_Definition => -- A2005
State.Add_Not_Implemented (Ada_2005);
when An_Access_Type_Definition =>
Result.Access_Type := Create_And_Return_Access_Type;
end case;
return Result;
end Create_And_Return_Type_Definition;
-- Has side effects:
function Create_And_Return_Record_Definition
return a_nodes_h.Record_Definition_Struct is
begin
return
(Record_Components => Add_And_Return_Record_Components,
Implicit_Components => Add_And_Return_Implicit_Components);
end Create_And_Return_Record_Definition;
-- Has side effects:
function Create_And_Return_Task_Definition
return a_nodes_h.Task_Definition_Struct is
begin
return
(Has_Task => Add_And_Return_Has_Task,
Visible_Part_Items => Add_And_Return_Visible_Part_Items,
Private_Part_Items => Add_And_Return_Private_Part_Items,
Is_Private_Present => Add_And_Return_Is_Private_Present,
Corresponding_Type_Operators =>
Add_And_Return_Corresponding_Type_Operators);
end Create_And_Return_Task_Definition;
-- Has side effects:
function Create_And_Return_Variant
return a_nodes_h.Variant_Struct is
begin
return
(Record_Components => Add_And_Return_Record_Components,
Implicit_Components => Add_And_Return_Implicit_Components,
Variant_Choices => Add_And_Return_Variant_Choices);
end Create_And_Return_Variant;
-- Has side effects:
function Create_And_Return_Variant_Part
return a_nodes_h.Variant_Part_Struct is
begin
return
(Discriminant_Direct_Name => Add_And_Return_Discriminant_Direct_Name,
Variants => Add_And_Return_Variants);
end Create_And_Return_Variant_Part;
-- END record support
-----------------------------------------------------------------------
Result : a_nodes_h.Definition_Struct :=
a_nodes_h.Support.Default_Definition_Struct;
Definition_Kind : constant Asis.Definition_Kinds :=
Asis.Elements.Definition_Kind (Element);
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Definition_Kind", Definition_Kind'Image);
Result.Definition_Kind := To_Definition_Kinds (Definition_Kind);
end Add_Common_Items;
use all type Asis.Definition_Kinds;
begin -- Do_Pre_Child_Processing
If Definition_Kind /= Not_A_Definition then
Add_Common_Items;
end if;
case Definition_Kind is
when Not_A_Definition =>
raise Internal_Error with
Module_Name & " called with: " & Definition_Kind'Image;
when A_Type_Definition =>
Result.The_Union.The_Type_Definition :=
Create_And_Return_Type_Definition;
when A_Subtype_Indication =>
Result.The_Union.The_Subtype_Indication :=
Create_And_Return_Subtype_Indication;
when A_Constraint =>
Result.The_Union.The_Constraint := Create_And_Return_Constraint;
when A_Component_Definition =>
Result.The_Union.The_Component_Definition :=
Create_And_Return_Component_Definition;
when A_Discrete_Subtype_Definition =>
Result.The_Union.The_Discrete_Subtype_Definition :=
Create_And_Return_Discrete_Subtype_Definition;
when A_Discrete_Range =>
Result.The_Union.The_Discrete_Range :=
Create_And_Return_Discrete_Range;
when An_Unknown_Discriminant_Part =>
null; -- No more components:
when A_Known_Discriminant_Part =>
Result.The_Union.The_Known_Discriminant_Part :=
Create_And_Return_Known_Discriminant_Part;
when A_Record_Definition =>
Result.The_Union.The_Record_Definition :=
Create_And_Return_Record_Definition;
when A_Null_Record_Definition =>
null; -- No more components
when A_Null_Component =>
null; -- No more components
when A_Variant_Part =>
Result.The_Union.The_Variant_Part := Create_And_Return_Variant_Part;
when A_Variant =>
Result.The_Union.The_Variant := Create_And_Return_Variant;
when An_Others_Choice =>
null; -- No more components
when An_Access_Definition => -- A2005
Result.The_Union.The_Access_Definition :=
Create_And_Return_Access_Definition;
when A_Private_Type_Definition =>
Result.The_Union.The_Private_Type_Definition :=
Create_And_Return_Private_Type_Definition;
when A_Tagged_Private_Type_Definition =>
Result.The_Union.The_Tagged_Private_Type_Definition :=
Create_And_Return_Tagged_Private_Type_Definition;
when A_Private_Extension_Definition =>
Result.The_Union.The_Private_Extension_Definition :=
Create_And_Return_Private_Extension_Definition;
when A_Task_Definition =>
Result.The_Union.The_Task_Definition :=
Create_And_Return_Task_Definition;
when A_Protected_Definition =>
Result.The_Union.The_Protected_Definition :=
Create_And_Return_Protected_Definition;
when A_Formal_Type_Definition =>
Result.The_Union.The_Formal_Type_Definition :=
Create_And_Return_Formal_Type_Definition;
when An_Aspect_Specification => -- A2012
Result.The_Union.The_Aspect_Specification :=
Create_And_Return_Aspect_Specification;
end case;
State.A_Element.Element_Kind := a_nodes_h.A_Definition;
State.A_Element.The_Union.Definition := Result;
end Do_Pre_Child_Processing;
procedure Do_Post_Child_Processing
(Element : in Asis.Element; State : in out Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Post_Child_Processing";
Definition_Kind : constant Asis.Definition_Kinds :=
Asis.Elements.Definition_Kind (Element);
use all type Asis.Definition_Kinds;
procedure Append_Implicit_Inherited_Declarations
is
elementList : Asis.Element_List := Asis.Definitions.Implicit_Inherited_Declarations (Element);
begin
for Elm of elementList loop
declare
-- Default_Node : Dot.Node_Stmt.Class; -- Initialized
Default_Label : Dot.HTML_Like_Labels.Class; -- Initialized
Element_ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Elm);
Element_Kind : constant Asis.Element_Kinds :=
Asis.Elements.Element_Kind (Elm);
SpecialCase : A4G.A_Types.Special_Cases := Asis.Set_Get.Special_Case(Elm);
begin
-- PUT_LINE(Special_Cases'Image (SpecialCase));
If SpecialCase /= Stand_Char_Literal then
state.Process_Element_Tree(
Element => Elm,
Outputs => State.Outputs );
end if;
end;
end loop;
end Append_Implicit_Inherited_Declarations;
-----------------------------------------------------------------------
begin -- Do_Post_Child_Processing
-- Currently this post-processing is only needed to complete
-- the dot graph and node structure to include implicit elements.
--
-- The following comment from ASIS document lists the implicit element support,
-- which should later be included in to the post processing here:
--
-- ASIS-for-GNAT supports implicit Elements for the following constructs:
-- Derived user-defined subprograms
-- Derived enumeration literals
-- Derived record components
If Definition_Kind = A_Type_Definition then
declare
Type_Kind : constant Asis.Type_Kinds :=
Asis.Elements.Type_Kind (Element);
use all type Asis.Type_Kinds;
begin
If Type_Kind = A_Derived_Type_Definition then
Append_Implicit_Inherited_Declarations;
end if;
end;
end if;
end Do_Post_Child_Processing;
end Asis_Adapter.Element.Definitions;
|
30,876
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/volatile2.ads
|
with volatile1; use volatile1;
package volatile2 is
type PData_Array is access Data_Array;
type Result_Desc is
record
Data : PData_Array;
end record;
type Result is access Result_Desc;
procedure Copy;
end volatile2;
|
30,877
|
ada
| 3
|
pyjarrett/archaic_terminal
|
src/common/trendy_terminal-io.ads
|
<filename>src/common/trendy_terminal-io.ads
-------------------------------------------------------------------------------
-- Copyright 2021, The Trendy Terminal Developers (see AUTHORS file)
-- 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.Containers.Vectors;
with Ada.Strings.Unbounded;
with Trendy_Terminal.Lines.Line_Vectors;
with Trendy_Terminal.Platform;
with Trendy_Terminal.VT100;
package Trendy_Terminal.IO is
package ASU renames Ada.Strings.Unbounded;
-- These are platform-specific terminal read/write functions to avoid
-- messing with Ada standard library internals such as current column.
-- This avoids spurious formatting and other implementation quirks of
-- those libraries.
procedure Put (C : Character) renames Trendy_Terminal.Platform.Put;
procedure Put (S : String) renames Trendy_Terminal.Platform.Put;
procedure Put (S : ASU.Unbounded_String);
procedure Put_Line (S : String);
procedure Put_Line (S : ASU.Unbounded_String);
procedure Rewrite_Line (Pos : VT100.Cursor_Position; S : String);
procedure New_Line (Num_Lines : Positive := 1);
procedure Set_Col (Column : Positive);
end Trendy_Terminal.IO;
|
30,878
|
ada
| 19
|
jrcarter/Ada_GUI
|
strings_edit-base64.ads
|
<reponame>jrcarter/Ada_GUI
-- --
-- package Copyright (c) <NAME> --
-- Strings_Edit.Base64 Luebeck --
-- Interface Autumn, 2014 --
-- --
-- Last revision : 18:40 01 Aug 2019 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2 of --
-- the License, 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. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 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. --
--____________________________________________________________________--
--
-- This package provides Base64 encoding and decoding as defined in
-- RFC 4648.
--
with Ada.Streams; use Ada.Streams;
with Interfaces; use Interfaces;
package Strings_Edit.Base64 is
--
-- From_Base64 -- Decode Base64 to plain string
--
-- Text - To convert
--
-- Returns :
--
-- Equivalent string
--
-- Exceptions :
--
-- Data_Error - Syntax error
--
function From_Base64 (Text : String) return String;
--
-- To_Base64 -- Encode plain string as Base64
--
-- Text - To convert
--
-- Returns :
--
-- Base64 string
--
function To_Base64 (Text : String) return String;
------------------------------------------------------------------------
--
-- Base64_Encoder -- Base64 encoding stream
--
-- Size - The stream buffer size
--
-- The encoder stream when written encodes the input into Base64. The
-- encoded content can be then read from the stream.
--
type Base64_Encoder
( Size : Stream_Element_Count
) is new Root_Stream_Type with private;
--
-- Flush -- The encoding
--
-- Stream - The encoding stream
--
-- This procedure is called at the end of encoding after the last stream
-- element has been written. Status_Error is propagated when the stream
-- presently has no space available. The operation can be repeated
-- after reading from the stream.
--
-- Exceptions :
--
-- Status_Error - No space in the stream
-- Use_Error - The stream is too small (fatal)
--
procedure Flush (Stream : in out Base64_Encoder);
--
-- Free -- Available space
--
-- Stream - The encoding stream
--
-- Returns :
--
-- The number of elements that can be safely written
--
function Free (Stream : Base64_Encoder) return Stream_Element_Count;
--
-- Is_Empty -- Check if the stream is empty
--
-- Stream - The encoding stream
--
-- Returns :
--
-- True of the stream can be read
--
function Is_Empty (Stream : Base64_Encoder) return Boolean;
--
-- Is_Full -- Check if the stream is full
--
-- Stream - The encoding stream
--
-- Returns :
--
-- True if the stream cannot be written
--
function Is_Full (Stream : Base64_Encoder) return Boolean;
--
-- Reset -- The stream
--
-- Stream - The encoding stream
--
procedure Reset (Stream : in out Base64_Encoder);
--
-- Size -- The maximum stream capacity
--
-- Stream - The encoding stream
--
-- Returns :
--
-- How many elements can be written when the stream is empty
--
function Size (Stream : Base64_Encoder) return Stream_Element_Count;
--
-- Used -- The number of elements in the stream
--
-- Stream - The encoding stream
--
-- Returns :
--
-- The number of elements available to read
--
function Used (Stream : Base64_Encoder) return Stream_Element_Count;
------------------------------------------------------------------------
--
-- Base64_Decoder -- Base64 decoding stream
--
-- Size - The stream buffer size
--
-- The decoder stream when written decodes the input from Base64. The
-- decoded content can be then read from the stream.
--
type Base64_Decoder
( Size : Stream_Element_Count
) is new Root_Stream_Type with private;
--
-- Reset -- The stream
--
-- Stream - The encoding stream
--
procedure Reset (Stream : in out Base64_Decoder);
--
-- Free -- Available space
--
-- Stream - The encoding stream
--
-- Returns :
--
-- The number of elements that can be safely written
--
function Free (Stream : Base64_Decoder) return Stream_Element_Count;
--
-- Is_Empty -- Check if the stream is empty
--
-- Stream - The decoding stream
--
-- Returns :
--
-- True of the stream can be read
--
function Is_Empty (Stream : Base64_Decoder) return Boolean;
--
-- Is_Full -- Check if the stream is full
--
-- Stream - The decoding stream
--
-- Returns :
--
-- True if the stream cannot be written
--
function Is_Full (Stream : Base64_Decoder) return Boolean;
--
-- Size -- The maximum stream capacity
--
-- Stream - The decoding stream
--
-- Returns :
--
-- How many elements can be written when the stream is empty
--
function Size (Stream : Base64_Decoder) return Stream_Element_Count;
--
-- Used -- The number of elements in the stream
--
-- Stream - The decoding stream
--
-- Returns :
--
-- The number of elements available to read
--
function Used (Stream : Base64_Decoder) return Stream_Element_Count;
private
type Base64_Stream
( Size : Stream_Element_Count
) is abstract new Root_Stream_Type with
record
Item_In : Stream_Element_Count := 1;
Item_Out : Stream_Element_Count := 1;
Accum : Unsigned_16 := 0;
Bits : Natural := 0;
FIFO : Stream_Element_Array (1..Size);
end record;
function Free (Stream : Base64_Stream)
return Stream_Element_Count is abstract;
procedure Read
( Stream : in out Base64_Stream;
Data : out Stream_Element_Array;
Last : out Stream_Element_Offset
);
function Size (Stream : Base64_Stream)
return Stream_Element_Count is abstract;
procedure Store
( Stream : in out Base64_Stream;
Item : Stream_Element
);
type Base64_Encoder
( Size : Stream_Element_Count
) is new Base64_Stream (Size) with null record;
procedure Write
( Stream : in out Base64_Encoder;
Data : Stream_Element_Array
);
type Base64_Decoder
( Size : Stream_Element_Count
) is new Base64_Stream (Size) with
record
Equality : Boolean := False;
end record;
procedure Write
( Stream : in out Base64_Decoder;
Data : Stream_Element_Array
);
end Strings_Edit.Base64;
|
30,879
|
ada
| 0
|
optikos/oasis
|
source/nodes/program-nodes-formal_discrete_type_definitions.ads
|
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Formal_Discrete_Type_Definitions;
with Program.Element_Visitors;
package Program.Nodes.Formal_Discrete_Type_Definitions is
pragma Preelaborate;
type Formal_Discrete_Type_Definition is
new Program.Nodes.Node
and Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition
and Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition_Text
with private;
function Create
(Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Formal_Discrete_Type_Definition;
type Implicit_Formal_Discrete_Type_Definition is
new Program.Nodes.Node
and Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Formal_Discrete_Type_Definition
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Formal_Discrete_Type_Definition is
abstract new Program.Nodes.Node
and Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition
with null record;
procedure Initialize
(Self : aliased in out Base_Formal_Discrete_Type_Definition'Class);
overriding procedure Visit
(Self : not null access Base_Formal_Discrete_Type_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Formal_Discrete_Type_Definition_Element
(Self : Base_Formal_Discrete_Type_Definition)
return Boolean;
overriding function Is_Formal_Type_Definition_Element
(Self : Base_Formal_Discrete_Type_Definition)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Formal_Discrete_Type_Definition)
return Boolean;
type Formal_Discrete_Type_Definition is
new Base_Formal_Discrete_Type_Definition
and Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition_Text
with record
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Formal_Discrete_Type_Definition_Text
(Self : aliased in out Formal_Discrete_Type_Definition)
return Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition_Text_Access;
overriding function Left_Bracket_Token
(Self : Formal_Discrete_Type_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Box_Token
(Self : Formal_Discrete_Type_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Right_Bracket_Token
(Self : Formal_Discrete_Type_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Formal_Discrete_Type_Definition is
new Base_Formal_Discrete_Type_Definition
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Formal_Discrete_Type_Definition_Text
(Self : aliased in out Implicit_Formal_Discrete_Type_Definition)
return Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Discrete_Type_Definition)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Discrete_Type_Definition)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Discrete_Type_Definition)
return Boolean;
end Program.Nodes.Formal_Discrete_Type_Definitions;
|
30,880
|
ada
| 0
|
strenkml/EE368
|
memsim-master/src/parser-parse_eor.adb
|
<reponame>strenkml/EE368
with Memory.Transform.EOR; use Memory.Transform.EOR;
with Parser.Transform_Parser;
separate (Parser)
procedure Parse_EOR(parser : in out Parser_Type;
result : out Memory_Pointer) is
package EOR_Parser is new Transform_Parser(
T_Type => Memory.Transform.EOR.EOR_Type,
T_Pointer => Memory.Transform.EOR.EOR_Pointer,
Create_Transform => Memory.Transform.EOR.Create_EOR
);
begin
EOR_Parser.Parse(parser, result);
end Parse_EOR;
|
30,881
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34012a.ada
|
-- C34012A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT DEFAULT EXPRESSIONS IN DERIVED RECORD TYPES AND
-- DERIVED SUBPROGRAMS ARE EVALUATED USING THE ENTITIES DENOTED BY
-- THE EXPRESSIONS IN THE PARENT TYPE.
-- HISTORY:
-- RJW 06/19/86 CREATED ORIGINAL TEST.
-- BCB 08/19/87 CHANGED HEADER TO STANDARD HEADER FORMAT. CHANGED
-- PACKAGE B SO WOULD HAVE ONE CASE WHERE DEFAULT IS
-- DECLARED BEFORE THE DERIVED TYPE DECLARATION.
WITH REPORT; USE REPORT;
PROCEDURE C34012A IS
BEGIN
TEST ("C34012A", "CHECK THAT DEFAULT EXPRESSIONS IN DERIVED " &
"RECORD TYPES AND DERIVED SUBPROGRAMS ARE " &
"EVALUATED USING THE ENTITIES DENOTED BY THE " &
"EXPRESSIONS IN THE PARENT TYPE" );
DECLARE
PACKAGE P IS
X : INTEGER := 5;
TYPE REC IS
RECORD
C : INTEGER := X;
END RECORD;
END P;
PACKAGE Q IS
X : INTEGER := 6;
TYPE NEW_REC IS NEW P.REC;
QVAR : NEW_REC;
END Q;
PACKAGE R IS
X : INTEGER := 7;
TYPE BRAND_NEW_REC IS NEW Q.NEW_REC;
RVAR : BRAND_NEW_REC;
END R;
USE Q;
USE R;
BEGIN
IF QVAR.C = 5 THEN
NULL;
ELSE
FAILED ( "INCORRECT VALUE FOR QVAR" );
END IF;
IF RVAR.C = 5 THEN
NULL;
ELSE
FAILED ( "INCORRECT VALUE FOR RVAR" );
END IF;
END;
DECLARE
PACKAGE A IS
TYPE T IS RANGE 1 .. 10;
DEFAULT : T := 5;
FUNCTION F (X : T := DEFAULT) RETURN T;
END A;
PACKAGE BODY A IS
FUNCTION F (X : T := DEFAULT) RETURN T IS
BEGIN
RETURN X;
END F;
END A;
PACKAGE B IS
DEFAULT : A.T:= 6;
TYPE NEW_T IS NEW A.T;
BVAR : NEW_T := F;
END B;
PACKAGE C IS
TYPE BRAND_NEW_T IS NEW B.NEW_T;
DEFAULT : BRAND_NEW_T := 7;
CVAR : BRAND_NEW_T :=F;
END C;
USE B;
USE C;
BEGIN
IF BVAR = 5 THEN
NULL;
ELSE
FAILED ( "INCORRECT VALUE FOR BVAR" );
END IF;
IF CVAR = 5 THEN
NULL;
ELSE
FAILED ( "INCORRECT VALUE FOR CVAR" );
END IF;
DECLARE
VAR : BRAND_NEW_T := F;
BEGIN
IF VAR = 5 THEN
NULL;
ELSE
FAILED ( "INCORRECT VALUE FOR VAR" );
END IF;
END;
END;
RESULT;
END C34012A;
|
30,882
|
ada
| 5
|
ianloic/unladen-swallow
|
Util/llvm/test/FrontendAda/placeholder.adb
|
-- RUN: %llvmgcc -c %s
procedure Placeholder is
subtype Bounded is Integer range 1 .. 5;
type Vector is array (Bounded range <>) of Integer;
type Interval (Length : Bounded := 1) is record
Points : Vector (1 .. Length);
end record;
An_Interval : Interval := (Length => 1, Points => (1 => 1));
generic The_Interval : Interval; package R is end;
package body R is end;
package S is new R (An_Interval);
begin null; end;
|
30,883
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c99005a.ada
|
-- C99005A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT THE ATTRIBUTE 'COUNT RETURNS THE CORRECT VALUE.
-- HISTORY:
-- DHH 03/24/88 CREATED ORIGINAL TEST.
with Impdef;
WITH SYSTEM; USE SYSTEM;
WITH REPORT; USE REPORT;
PROCEDURE C99005A IS
BEGIN
TEST("C99005A", "CHECK THAT THE ATTRIBUTE 'COUNT RETURNS THE " &
"CORRECT VALUE");
DECLARE
TASK A IS
END A;
TASK B IS
END B;
TASK C IS
END C;
TASK D IS
END D;
TASK E IS
END E;
TASK F IS
END F;
TASK G IS
END G;
TASK H IS
END H;
TASK I IS
END I;
TASK J IS
END J;
TASK T IS
ENTRY WAIT;
END T;
TASK CHOICE IS
ENTRY RETURN_CALL;
ENTRY E2;
ENTRY E1;
END CHOICE;
TASK BODY A IS
BEGIN
CHOICE.E1;
END A;
TASK BODY B IS
BEGIN
CHOICE.E1;
END B;
TASK BODY C IS
BEGIN
CHOICE.E1;
END C;
TASK BODY D IS
BEGIN
CHOICE.E1;
END D;
TASK BODY E IS
BEGIN
CHOICE.E1;
END E;
TASK BODY F IS
BEGIN
CHOICE.E2;
END F;
TASK BODY G IS
BEGIN
CHOICE.E2;
END G;
TASK BODY H IS
BEGIN
CHOICE.E2;
END H;
TASK BODY I IS
BEGIN
CHOICE.E2;
END I;
TASK BODY J IS
BEGIN
CHOICE.E2;
END J;
TASK BODY T IS
BEGIN
LOOP
SELECT
ACCEPT WAIT DO
DELAY 1.0 * Impdef.One_Second;
END WAIT;
CHOICE.RETURN_CALL;
OR
TERMINATE;
END SELECT;
END LOOP;
END T;
TASK BODY CHOICE IS
BEGIN
WHILE E1'COUNT + E2'COUNT < 10 LOOP
T.WAIT;
ACCEPT RETURN_CALL;
END LOOP;
FOR I IN REVERSE 1 ..10 LOOP
SELECT
ACCEPT E2 DO
IF (E2'COUNT + E1'COUNT + 1) /= I THEN
FAILED("'COUNT NOT RETURNING " &
"CORRECT VALUE FOR LOOP" &
INTEGER'IMAGE(I) & "VALUE " &
INTEGER'IMAGE((E2'COUNT
+ E1'COUNT + 1)));
END IF;
END E2;
OR
ACCEPT E1 DO
IF (E2'COUNT + E1'COUNT + 1) /= I THEN
FAILED("'COUNT NOT RETURNING " &
"CORRECT VALUE FOR LOOP" &
INTEGER'IMAGE(I) & "VALUE " &
INTEGER'IMAGE((E2'COUNT
+ E1'COUNT + 1)));
END IF;
END E1;
END SELECT;
END LOOP;
END CHOICE;
BEGIN
NULL;
END;
RESULT;
END C99005A;
|
30,884
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ca/ca2009c0.ada
|
<reponame>best08618/asylo
-- CA2009C0M.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT A GENERIC PACKAGE SUBUNIT CAN BE SPECIFIED AND
-- INSTANTIATED. IN THIS TEST, THE SUBUNIT BODY IS IN A
-- SEPARATE FILE.
-- APPLICABILITY CRITERIA:
-- THIS TEST MUST RUN AND REPORT "PASSED" FOR ALL ADA 95 IMPLEMENTATIONS.
-- SEPARATE FILES ARE:
-- CA2009C0M THE MAIN PROCEDURE.
-- CA2009C1 A SUBUNIT PACKAGE BODY (PKG1).
-- HISTORY:
-- BHS 08/01/84 CREATED ORIGINAL TEST.
-- BCB 01/05/88 MODIFIED HEADER.
-- EDS 08/04/98 REMOVE CONTROL Z AT END OF FILE.
-- RLB 09/13/99 UPDATED APPLICABILITY CRITERIA FOR ADA 95.
-- RLB 09/15/99 REMOVED JUNK COMMENT.
WITH REPORT;
USE REPORT;
PROCEDURE CA2009C0M IS
INT1 : INTEGER := 1;
SUBTYPE STR15 IS STRING (1..15);
SVAR : STR15 := "ABCDEFGHIJKLMNO";
GENERIC
TYPE ITEM IS PRIVATE;
CON1 : IN ITEM;
VAR1 : IN OUT ITEM;
PACKAGE PKG1 IS
END PKG1;
PACKAGE BODY PKG1 IS SEPARATE;
PACKAGE NI_PKG1 IS NEW PKG1 (INTEGER, IDENT_INT(2), INT1);
PACKAGE NS_PKG1 IS NEW PKG1 (STR15, IDENT_STR("REINSTANTIATION"),
SVAR);
BEGIN
TEST ("CA2009C", "SPECIFICATION AND INSTANTIATION " &
"OF GENERIC PACKAGE SUBUNITS " &
" - SEPARATE FILES USED");
IF INT1 /= 2 THEN
FAILED ("INCORRECT INSTANTIATION - INTEGER");
END IF;
IF SVAR /= "REINSTANTIATION" THEN
FAILED ("INCORRECT INSTANTIATION - STRING");
END IF;
RESULT;
END CA2009C0M;
|
30,885
|
ada
| 1
|
mimo/Tracker
|
surface-window.ads
|
<filename>surface-window.ads
with Raylib;
package Surface.Window is
type Instance is abstract new Actor with private;
procedure Attach (Application : in out Reference);
procedure Run (Self : in out Instance'Class);
procedure Title (Self : in out Instance ; Title : String);
procedure Background_Color (Self : in out Instance ; Tint : raylib.Color);
procedure Size (Self : in out Instance ; Width, Height : Integer);
procedure Setup (self : in out Instance);
procedure Update (self : in out Instance ; dt : Float) is null;
private
type instance is new Actor with record
Window_Title : String (1..42);
Window_Width : Integer;
Window_Height : Integer;
Border_Width : integer;
Border_Color : raylib.Color;
Background_Color : Raylib.Color;
end record;
end Surface.Window;
|
30,886
|
ada
| 4
|
carter-e-veldhuizen/RACK
|
ada/examples/regression/regression_library.ads
|
package Regression_Library is
function LibraryFun (Input : Boolean) return Boolean;
end Regression_Library;
|
30,887
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/fixedpnt.adb
|
-- { dg-do run }
procedure Fixedpnt is
A : Duration := 1.0;
B : Duration := Duration ((-1.0) * A);
begin
if B > 0.0 then
raise Constraint_Error;
end if;
end;
|
30,888
|
ada
| 17
|
WinterAlexander/Ada-IntelliJ
|
src/main/resources/project-templates/aws_simple_web_server/src/@_project_name_@.ads
|
package @_Project_Name_@ is
pragma Pure;
Host : constant String := "@_host_@";
Port : constant := @_port_@;
end @_Project_Name_@;
|
30,889
|
ada
| 52
|
onox/orka
|
orka/src/orka/interface/orka-containers-bounded_vectors.ads
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <<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.Iterator_Interfaces;
generic
type Index_Type is new Natural;
type Element_Type is private;
package Orka.Containers.Bounded_Vectors is
pragma Pure;
subtype Length_Type is Index_Type'Base range 0 .. Index_Type'Last;
type Vector (Capacity : Length_Type) is tagged private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Reference_Type;
pragma Preelaborable_Initialization (Vector);
procedure Append (Container : in out Vector; Elements : Vector)
with Pre => Container.Length + Elements.Length <= Container.Capacity,
Post => Container.Length = Container'Old.Length + Elements.Length;
procedure Append (Container : in out Vector; Element : Element_Type)
with Pre => Container.Length < Container.Capacity,
Post => Container.Length = Container'Old.Length + 1;
-- Add the element to the end of the vector
procedure Remove_Last (Container : in out Vector; Element : out Element_Type)
with Pre => Container.Length > 0,
Post => Container.Length = Container'Old.Length - 1;
procedure Clear (Container : in out Vector)
with Post => Container.Length = 0;
type Element_Array is array (Index_Type range <>) of aliased Element_Type;
procedure Query
(Container : Vector;
Process : not null access procedure (Elements : Element_Array));
procedure Update
(Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type))
with Pre => Index <= Container.Length;
-----------------------------------------------------------------------------
function Element (Container : Vector; Index : Index_Type) return Element_Type;
type Constant_Reference_Type (Value : not null access constant Element_Type) is limited private
with Implicit_Dereference => Value;
type Reference_Type (Value : not null access Element_Type) is limited private
with Implicit_Dereference => Value;
function Constant_Reference
(Container : aliased Vector;
Index : Index_Type) return Constant_Reference_Type;
function Reference
(Container : aliased in out Vector;
Index : Index_Type) return Reference_Type;
type Cursor is private;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean is
(Position /= No_Element);
package Vector_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element);
function Iterate (Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'Class;
-----------------------------------------------------------------------------
function Length (Container : Vector) return Length_Type
with Inline;
function Is_Empty (Container : Vector) return Boolean
with Inline;
function Is_Full (Container : Vector) return Boolean
with Inline;
private
type Vector_Access is access constant Vector;
type Cursor is record
Object : Vector_Access;
Index : Length_Type;
end record;
No_Element : constant Cursor := Cursor'(null, 0);
-----------------------------------------------------------------------------
function Element
(Container : aliased Vector;
Position : Cursor) return Element_Type;
type Constant_Reference_Type
(Value : not null access constant Element_Type) is limited null record;
type Reference_Type (Value : not null access Element_Type) is limited null record;
function Constant_Reference
(Container : aliased Vector;
Position : Cursor) return Constant_Reference_Type;
function Reference
(Container : aliased in out Vector;
Position : Cursor) return Reference_Type;
-----------------------------------------------------------------------------
type Vector (Capacity : Length_Type) is tagged record
Elements : Element_Array (Index_Type'First .. Capacity) := (others => <>);
Length : Length_Type := 0;
end record;
pragma Preelaborable_Initialization (Vector);
-----------------------------------------------------------------------------
type Iterator is limited new
Vector_Iterator_Interfaces.Reversible_Iterator with
record
Container : Vector_Access;
end record;
overriding function First (Object : Iterator) return Cursor;
overriding function Last (Object : Iterator) return Cursor;
overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
overriding function Previous
(Object : Iterator;
Position : Cursor) return Cursor;
end Orka.Containers.Bounded_Vectors;
|
30,890
|
ada
| 52
|
onox/orka
|
orka/src/orka/implementation/orka-types.adb
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <<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 Orka.SIMD.AVX.Singles;
with Orka.SIMD.F16C;
package body Orka.Types is
use SIMD.AVX.Singles;
function Convert
(Kind : Numeric_Type) return GL.Types.Numeric_Type
is (case Kind is
when UByte_Type => GL.Types.UByte_Type,
when UShort_Type => GL.Types.UShort_Type,
when UInt_Type => GL.Types.UInt_Type,
when Byte_Type => GL.Types.Byte_Type,
when Short_Type => GL.Types.Short_Type,
when Int_Type => GL.Types.Int_Type,
when Half_Type => GL.Types.Half_Type,
when Single_Type => GL.Types.Single_Type,
when Double_Type => GL.Types.Double_Type);
function Convert
(Kind : Index_Type) return GL.Types.Index_Type
is (case Kind is
when UShort_Type => GL.Types.UShort_Type,
when UInt_Type => GL.Types.UInt_Type);
-----------------------------------------------------------------------------
generic
Size : GL.Types.Int;
type Source_Type is private;
type Target_Type is private;
type Source_Array_Type is array (GL.Types.Size range <>) of Source_Type;
type Target_Array_Type is array (GL.Types.Size range <>) of Target_Type;
with procedure Convert_Slice (Values : Source_Array_Type; Result : out Target_Array_Type);
procedure Generic_Convert (Elements : Source_Array_Type; Result : out Target_Array_Type);
procedure Generic_Convert (Elements : Source_Array_Type; Result : out Target_Array_Type) is
use type GL.Types.Int;
Iterations : constant GL.Types.Size := Elements'Length / Size;
Remainder : constant GL.Types.Size := Elements'Length rem Size;
Offset : GL.Types.Size := Elements'First;
begin
-- Convert Size elements in each iteration
for Index in 0 .. Iterations - 1 loop
Offset := Elements'First + Index * Size;
Convert_Slice
(Elements (Offset .. Offset + Size - 1),
Result (Offset .. Offset + Size - 1));
end loop;
pragma Assert (Elements'Last - Remainder = Offset + Size - 1);
-- Convert remaining elements
Convert_Slice
(Elements (Elements'Last - Remainder + 1 .. Elements'Last),
Result (Elements'Last - Remainder + 1 .. Elements'Last));
end Generic_Convert;
-----------------------------------------------------------------------------
procedure Convert_Slice (Values : GL.Types.Single_Array; Result : out GL.Types.Half_Array) is
use SIMD.F16C;
S : GL.Types.Single_Array (1 .. m256'Length);
H : m128s;
begin
S (1 .. Values'Length) := Values;
H := Convert_Nearest_Integer (m256 (S));
Result := GL.Types.Half_Array (H) (1 .. Values'Length);
end Convert_Slice;
procedure Convert_Slice (Values : GL.Types.Half_Array; Result : out GL.Types.Single_Array) is
use SIMD.F16C;
S : GL.Types.Half_Array (1 .. m256'Length);
H : m256;
begin
S (1 .. Values'Length) := Values;
H := Convert (m128s (S));
Result := GL.Types.Single_Array (H) (1 .. Values'Length);
end Convert_Slice;
procedure Convert_Single is new Generic_Convert
(m256'Length, GL.Types.Single, GL.Types.Half,
GL.Types.Single_Array, GL.Types.Half_Array, Convert_Slice);
procedure Convert_Half is new Generic_Convert
(m256'Length, GL.Types.Half, GL.Types.Single,
GL.Types.Half_Array, GL.Types.Single_Array, Convert_Slice);
procedure Convert (Elements : GL.Types.Single_Array; Result : out GL.Types.Half_Array)
renames Convert_Single;
procedure Convert (Elements : GL.Types.Half_Array; Result : out GL.Types.Single_Array)
renames Convert_Half;
-----------------------------------------------------------------------------
function Is_Power_Of_Two (Value : Positive) return Boolean is
use type GL.Types.UInt;
begin
return (GL.Types.UInt (Value) and GL.Types.UInt (Value - 1)) = 0;
end Is_Power_Of_Two;
function Clamp (Value : in Source) return Target is
A : constant Source := Source'Min (Source (Target'Last), Value);
B : constant Source := Source'Max (Source (Target'First), A);
begin
return Target (B);
end Clamp;
function Normalize_Periodic (Value : in Source) return Target is
Target_Min : constant Source := Source (Target'First);
Target_Range : constant Source := Source (Target'Last - Target'First);
begin
return Target (Value - Target_Range * Source'Floor ((Value - Target_Min) / Target_Range));
end Normalize_Periodic;
end Orka.Types;
|
30,891
|
ada
| 1
|
ekoeppen/STM32_Generic_Ada_Drivers
|
boards/nucleo_f072rb/stm32gd-board.ads
|
<gh_stars>1-10
with STM32GD.GPIO; use STM32GD.GPIO;
with STM32GD.GPIO.Pin;
with STM32GD.USART;
with STM32GD.USART.Peripheral;
with STM32GD.SPI;
with STM32GD.SPI.Peripheral;
with STM32GD.RTC;
with STM32GD.Clock;
with STM32GD.Clock.Tree;
with Drivers.Text_IO;
package STM32GD.Board is
package CLOCKS is new STM32GD.Clock.Tree;
package SCLK is new Pin (Pin => Pin_5, Port => Port_A, Mode => Mode_AF);
package MISO is new Pin (Pin => Pin_6, Port => Port_A, Mode => Mode_AF);
package MOSI is new Pin (Pin => Pin_7, Port => Port_A, Mode => Mode_AF);
package CSN is new Pin (Pin => Pin_6, Port => Port_B, Mode => Mode_Out);
package BUTTON is new Pin (Pin => Pin_13, Port => Port_C);
package LED is new Pin (Pin => Pin_5, Port => Port_A, Mode => Mode_Out);
package LED2 is new Pin (Pin => Pin_8, Port => Port_C, Mode => Mode_Out);
package LED3 is new Pin (Pin => Pin_6, Port => Port_C, Mode => Mode_Out);
package TX is new Pin (Pin => Pin_2, Port => Port_A,
Pull_Resistor => Pull_Up,
Mode => Mode_AF, Alternate_Function => 1);
package RX is new Pin (Pin => Pin_3, Port => Port_A,
Pull_Resistor => Pull_Up,
Mode => Mode_AF, Alternate_Function => 1);
package USART is new STM32GD.USART.Peripheral (
USART => STM32GD.USART.USART_2,
Speed => 115200, RX_DMA_Buffer_Size => 64,
Clock_Tree => CLOCKS,
Clock => STM32GD.Clock.PCLK);
package RTC is new STM32GD.RTC (Clock_Tree => STM32GD.Board.Clocks,
Clock => STM32GD.Clock.LSI);
package SPI is new STM32GD.SPI.Peripheral (SPI => STM32GD.SPI.SPI_1);
package Text_IO is new Drivers.Text_IO (USART => STM32GD.Board.USART);
procedure Init;
end STM32GD.Board;
|
30,892
|
ada
| 24
|
svn2github/matreshka
|
tools/ayacc/src/ayacc_file_names.adb
|
with Ada.Characters.Handling;
with Ada.Directories;
with Ada.Strings.Unbounded;
with String_Pkg;
package body Ayacc_File_Names is
use Ada.Characters.Handling;
use Ada.Strings.Unbounded;
function "+" (Item : String) return Unbounded_String
renames To_Unbounded_String;
function "+" (Item : Unbounded_String) return String
renames To_String;
Source_File_Name : Unbounded_String;
Out_File_Name : Unbounded_String;
Verbose_File_Name : Unbounded_String;
Template_File_Name : Unbounded_String;
Actions_File_Name : Unbounded_String;
Shift_Reduce_File_Name : Unbounded_String;
Goto_File_Name : Unbounded_String;
Tokens_File_Name : Unbounded_String;
-- UMASS CODES :
Error_Report_File_Name : Unbounded_String;
Listing_File_Name : Unbounded_String;
-- END OF UMASS CODES.
C_Lex_File_Name : Unbounded_String;
Include_File_Name : Unbounded_String;
--RJS ==========================================
function End_of_Unit_Name (Name : in String) return Natural is
Dot_Position : Natural := Name'Last;
begin
while Dot_Position >= Name'First and then
Name (Dot_Position) /= '.'
loop
Dot_Position := Dot_Position - 1;
end loop;
return Dot_Position - 1;
end End_of_Unit_Name;
function Get_Unit_Name (Filename : in String) return String is
-- modified to check for valid Ada identifiers. 11/28/88 kn
Filename_Without_Extension : String :=
Filename (Filename'First .. End_of_Unit_Name (Filename));
End_of_Directory : Natural := Filename_Without_Extension'Last + 1;
function Is_Alphabetic (Ch : in Character) return Boolean is
begin
return Ch in 'A' .. 'Z' or else
Ch in 'a' .. 'z';
end Is_Alphabetic;
function Is_AlphaNum_or_Underscore (Ch : in Character) return Boolean is
begin
return Is_Alphabetic(Ch) or else
Ch in '0' .. '9' or else
Ch = '_' or else Ch = '-';
end Is_AlphaNum_or_Underscore;
use String_Pkg;
begin
-- find end of directory
for Pos in reverse Filename_Without_Extension'FIRST..
Filename_Without_Extension'LAST loop
exit when Filename_Without_Extension(Pos) = '/';
End_Of_Directory := Pos;
end loop;
if End_Of_Directory <= Filename_Without_Extension'LAST and then
Is_Alphabetic (Filename_Without_Extension (End_of_Directory)) then
Check_Remaining_Characters :
for i in End_Of_Directory + 1 .. Filename_Without_Extension'LAST
loop
if not Is_AlphaNum_or_Underscore (Filename_Without_Extension(i)) then
return "";
elsif Filename_Without_Extension(i) = '-' then
Filename_Without_Extension(i) := '.';
end if;
end loop Check_Remaining_Characters;
return Value (Mixed (Filename_Without_Extension (End_of_Directory ..
Filename_Without_Extension'Last)));
else
return "";
end if;
end Get_Unit_Name;
---------------------
-- C_Lex_Unit_Name --
---------------------
function C_Lex_Unit_Name return String is
Filename : constant String := To_Upper (+C_Lex_File_Name);
begin
return Get_Unit_Name (Filename);
end C_Lex_Unit_Name;
---------------------------
-- Goto_Tables_Unit_Name --
---------------------------
function Goto_Tables_Unit_Name return String is
Filename : constant String := To_Upper (+Goto_File_Name);
begin
return Get_Unit_Name (Filename);
end Goto_Tables_Unit_Name;
-----------------------------------
-- Shift_Reduce_Tables_Unit_Name --
-----------------------------------
function Shift_Reduce_Tables_Unit_Name return String is
Filename : constant String := To_Upper (+Shift_Reduce_File_Name);
begin
return Get_Unit_Name (Filename);
end Shift_Reduce_Tables_Unit_Name;
----------------------
-- Tokens_Unit_Name --
----------------------
function Tokens_Unit_Name return String is
Filename : constant String := To_Upper (+Tokens_File_Name);
begin
return Get_Unit_Name (Filename);
end Tokens_Unit_Name;
--------------------
-- Main_Unit_Name --
--------------------
function Main_Unit_Name return String is
Filename : constant String := To_Upper (+Out_File_Name);
begin
return Get_Unit_Name (Filename);
end Main_Unit_Name;
-- UMASS CODES :
----------------------------
-- Error_Report_Unit_Name --
----------------------------
function Error_Report_Unit_Name return String is
Filename : constant String := To_Upper (+Error_Report_File_Name);
begin
return Get_Unit_Name (Filename);
end Error_Report_Unit_Name;
-- END OF UMASS CODES.
--RJS ==========================================
--------------------------
-- Get_Source_File_Name --
--------------------------
function Get_Source_File_Name return String is
begin
return +Source_File_Name;
end;
-----------------------
-- Get_Out_File_Name --
-----------------------
function Get_Out_File_Name return String is
begin
return +Out_File_Name;
end;
---------------------------
-- Get_Verbose_File_Name --
---------------------------
function Get_Verbose_File_Name return String is
begin
return +Verbose_File_Name;
end;
----------------------------
-- Get_Template_File_Name --
----------------------------
function Get_Template_File_Name return String is
begin
return +Template_File_Name;
end;
---------------------------
-- Get_Actions_File_Name --
---------------------------
function Get_Actions_File_Name return String is
begin
return +Actions_File_Name;
end;
--------------------------------
-- Get_Shift_Reduce_File_Name --
--------------------------------
function Get_Shift_Reduce_File_Name return String is
begin
return +Shift_Reduce_File_Name;
end;
------------------------
-- Get_Goto_File_Name --
------------------------
function Get_Goto_File_Name return String is
begin
return +Goto_File_Name;
end;
--------------------------
-- Get_Tokens_File_Name --
--------------------------
function Get_Tokens_File_Name return String is
begin
return +Tokens_File_Name;
end;
-- UMASS CODES :
--------------------------------
-- Get_Error_Report_File_Name --
--------------------------------
function Get_Error_Report_File_Name return String is
begin
return +Error_Report_File_Name;
end Get_Error_Report_File_Name;
---------------------------
-- Get_Listing_File_Name --
---------------------------
function Get_Listing_File_Name return String is
begin
return +Listing_File_Name;
end;
-- END OF UMASS CODES.
-------------------------
-- Get_C_Lex_File_Name --
-------------------------
function Get_C_Lex_File_Name return String is
begin
return +C_Lex_File_Name;
end;
---------------------------
-- Get_Include_File_Name --
---------------------------
function Get_Include_File_Name return String is
begin
return +Include_File_Name;
end;
--------------------
-- Set_File_Names --
--------------------
procedure Set_File_Names(Input_File, Extension: in String) is
Base_Name : constant String := Ada.Directories.Base_Name (Input_File);
begin
if Input_File'Length < 3
or else (Input_File(Input_File'Last) /= 'y'
and then Input_File(Input_File'Last) /= 'Y')
or else Input_File(Input_File'Last - 1) /= '.' then
raise Illegal_File_Name;
end if;
Source_File_Name := +Input_File;
Out_File_Name := +Base_Name;
Append (Out_File_Name, Extension);
Verbose_File_Name := +Base_Name;
Append (Verbose_File_Name, ".verbose");
Tokens_File_Name := +Base_Name;
Append (Tokens_File_Name, "_tokens" & Extension & "ds");
-- UMASS CODES :
Error_Report_File_Name := +Base_Name;
Append (Error_Report_File_Name, "-error_report" & Extension);
Listing_File_Name := +Base_Name;
Append (Listing_File_Name, ".lis");
-- END OF UMASS CODES.
Template_File_Name := +"yyparse.template";
Actions_File_Name := +Base_Name;
Append (Actions_File_Name, ".accs");
Shift_Reduce_File_Name := +Base_Name;
Append (Shift_Reduce_File_Name, "-shift_reduce" & Extension & "ds");
Goto_File_Name := +Base_Name;
Append (Goto_File_Name, "-goto_table" & Extension & "ds");
C_Lex_File_Name := +Base_Name;
Append (C_Lex_File_Name, "-c_lex" & Extension);
Include_File_Name := +Base_Name;
Append (Include_File_Name, ".h");
end Set_File_Names;
end Ayacc_File_Names;
|
30,893
|
ada
| 0
|
hgrodriguez/embedded-dashboard-console
|
src/led_control.adb
|
<reponame>hgrodriguez/embedded-dashboard-console
.-- Copyright 2021 (C) <NAME>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with RP.Device;
with RP.GPIO;
with ItsyBitsy;
package body LED_Control is
subtype LED_Type is RP.GPIO.GPIO_Point;
-----------------------------------------------------------------------
-- All Red LED related definitions
-----------------------------------------------------------------------
LED_0_Red : LED_Type renames ItsyBitsy.GP26;
procedure LED_0_Red_Off is
begin
LED_0_Red.Clear;
end LED_0_Red_Off;
procedure LED_0_Red_On is
begin
LED_0_Red.Set;
end LED_0_Red_On;
procedure LED_0_Red_Toggle is
begin
LED_0_Red.Toggle;
end LED_0_Red_Toggle;
-----------------------------------------------------------------------
-- All Amber LED related definitions
-----------------------------------------------------------------------
LED_0_Amber : LED_Type renames ItsyBitsy.GP27;
procedure LED_0_Amber_Off is
begin
LED_0_Amber.Clear;
end LED_0_Amber_Off;
procedure LED_0_Amber_On is
begin
LED_0_Amber.Set;
end LED_0_Amber_On;
procedure LED_0_Amber_Toggle is
begin
LED_0_Amber.Toggle;
end LED_0_Amber_Toggle;
-----------------------------------------------------------------------
-- All Green LED related definitions
-----------------------------------------------------------------------
LED_0_Green : LED_Type renames ItsyBitsy.GP28;
procedure LED_0_Green_Off is
begin
LED_0_Green.Clear;
end LED_0_Green_Off;
procedure LED_0_Green_On is
begin
LED_0_Green.Set;
end LED_0_Green_On;
procedure LED_0_Green_Toggle is
begin
LED_0_Green.Toggle;
end LED_0_Green_Toggle;
-----------------------------------------------------------------------
-- All White LED related definitions
-----------------------------------------------------------------------
LED_0_White : LED_Type renames ItsyBitsy.GP29;
procedure LED_0_White_Off is
begin
LED_0_White.Clear;
end LED_0_White_Off;
procedure LED_0_White_On is
begin
LED_0_White.Set;
end LED_0_White_On;
procedure LED_0_White_Toggle is
begin
LED_0_White.Toggle;
end LED_0_White_Toggle;
-----------------------------------------------------------------------
-- All Blue LED related definitions
-----------------------------------------------------------------------
LED_0_Blue : LED_Type renames ItsyBitsy.GP24;
procedure LED_0_Blue_Off is
begin
LED_0_Blue.Clear;
end LED_0_Blue_Off;
procedure LED_0_Blue_On is
begin
LED_0_Blue.Set;
end LED_0_Blue_On;
procedure LED_0_Blue_Toggle is
begin
LED_0_Blue.Toggle;
end LED_0_Blue_Toggle;
-----------------------------------------------------------------------
-- see .ads
-----------------------------------------------------------------------
procedure Toggle_All_LEDs (Delay_Between_In_Milliseconds : Integer
:= WAIT_FOR_NEXT_LED) is
begin
LED_0_Red_Toggle;
RP.Device.Timer.Delay_Milliseconds (Delay_Between_In_Milliseconds);
LED_0_Amber_Toggle;
RP.Device.Timer.Delay_Milliseconds (Delay_Between_In_Milliseconds);
LED_0_Green_Toggle;
RP.Device.Timer.Delay_Milliseconds (Delay_Between_In_Milliseconds);
LED_0_White_Toggle;
RP.Device.Timer.Delay_Milliseconds (Delay_Between_In_Milliseconds);
LED_0_Blue_Toggle;
RP.Device.Timer.Delay_Milliseconds (Delay_Between_In_Milliseconds);
end Toggle_All_LEDs;
begin
LED_0_Red.Configure (RP.GPIO.Output);
LED_0_Amber.Configure (RP.GPIO.Output);
LED_0_Green.Configure (RP.GPIO.Output);
LED_0_White.Configure (RP.GPIO.Output);
LED_0_Blue.Configure (RP.GPIO.Output);
end LED_Control;
|
30,894
|
ada
| 1
|
vidkidz/crossbridge
|
llvm-gcc-4.2-2.9/gcc/ada/impunit.adb
|
<reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I M P U N I T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2000-2006, 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. --
-- --
------------------------------------------------------------------------------
with Lib; use Lib;
with Namet; use Namet;
package body Impunit is
subtype File_Name_8 is String (1 .. 8);
type File_List is array (Nat range <>) of File_Name_8;
------------------
-- Ada 95 Units --
------------------
-- The following is a giant string list containing the names of all
-- non-implementation internal files, i.e. the complete list of files for
-- internal units which a program may legitimately WITH when operating in
-- either Ada 95 or Ada 05 mode.
-- Note that this list should match the list of units documented in the
-- "GNAT Library" section of the GNAT Reference Manual.
Non_Imp_File_Names_95 : constant File_List := (
------------------------------------------------------
-- Ada Hierarchy Units from Ada-83 Reference Manual --
------------------------------------------------------
"a-astaco", -- Ada.Asynchronous_Task_Control
"a-calend", -- Ada.Calendar
"a-chahan", -- Ada.Characters.Handling
"a-charac", -- Ada.Characters
"a-chlat1", -- Ada.Characters.Latin_1
"a-comlin", -- Ada.Command_Line
"a-decima", -- Ada.Decimal
"a-direio", -- Ada.Direct_IO
"a-dynpri", -- Ada.Dynamic_Priorities
"a-except", -- Ada.Exceptions
"a-finali", -- Ada.Finalization
"a-flteio", -- Ada.Float_Text_IO
"a-fwteio", -- Ada.Float_Wide_Text_IO
"a-inteio", -- Ada.Integer_Text_IO
"a-interr", -- Ada.Interrupts
"a-intnam", -- Ada.Interrupts.Names
"a-ioexce", -- Ada.IO_Exceptions
"a-iwteio", -- Ada.Integer_Wide_Text_IO
"a-ncelfu", -- Ada.Numerics.Complex_Elementary_Functions
"a-ngcefu", -- Ada.Numerics.Generic_Complex_Elementary_Functions
"a-ngcoty", -- Ada.Numerics.Generic_Complex_Types
"a-ngelfu", -- Ada.Numerics.Generic_Elementary_Functions
"a-nucoty", -- Ada.Numerics.Complex_Types
"a-nudira", -- Ada.Numerics.Discrete_Random
"a-nuelfu", -- Ada.Numerics.Elementary_Functions
"a-nuflra", -- Ada.Numerics.Float_Random
"a-numeri", -- Ada.Numerics
"a-reatim", -- Ada.Real_Time
"a-sequio", -- Ada.Sequential_IO
"a-stmaco", -- Ada.Strings.Maps.Constants
"a-storio", -- Ada.Storage_IO
"a-strbou", -- Ada.Strings.Bounded
"a-stream", -- Ada.Streams
"a-strfix", -- Ada.Strings.Fixed
"a-string", -- Ada.Strings
"a-strmap", -- Ada.Strings.Maps
"a-strunb", -- Ada.Strings.Unbounded
"a-ststio", -- Ada.Streams.Stream_IO
"a-stwibo", -- Ada.Strings.Wide_Bounded
"a-stwifi", -- Ada.Strings.Wide_Fixed
"a-stwima", -- Ada.Strings.Wide_Maps
"a-stwiun", -- Ada.Strings.Wide_Unbounded
"a-swmwco", -- Ada.Strings.Wide_Maps.Wide_Constants
"a-sytaco", -- Ada.Synchronous_Task_Control
"a-tags ", -- Ada.Tags
"a-tasatt", -- Ada.Task_Attributes
"a-taside", -- Ada.Task_Identification
"a-teioed", -- Ada.Text_IO.Editing
"a-textio", -- Ada.Text_IO
"a-ticoio", -- Ada.Text_IO.Complex_IO
"a-titest", -- Ada.Text_IO.Text_Streams
"a-unccon", -- Ada.Unchecked_Conversion
"a-uncdea", -- Ada.Unchecked_Deallocation
"a-witeio", -- Ada.Wide_Text_IO
"a-wtcoio", -- Ada.Wide_Text_IO.Complex_IO
"a-wtedit", -- Ada.Wide_Text_IO.Editing
"a-wttest", -- Ada.Wide_Text_IO.Text_Streams
-------------------------------------------------
-- RM Required Additions to Ada for GNAT Types --
-------------------------------------------------
"a-lfteio", -- Ada.Long_Float_Text_IO
"a-lfwtio", -- Ada.Long_Float_Wide_Text_IO
"a-liteio", -- Ada.Long_Integer_Text_IO
"a-liwtio", -- Ada.Long_Integer_Wide_Text_IO
"a-llftio", -- Ada.Long_Long_Float_Text_IO
"a-llfwti", -- Ada.Long_Long_Float_Wide_Text_IO
"a-llitio", -- Ada.Long_Long_Integer_Text_IO
"a-lliwti", -- Ada.Long_Long_Integer_Wide_Text_IO
"a-nlcefu", -- Ada.Long_Complex_Elementary_Functions
"a-nlcoty", -- Ada.Numerics.Long_Complex_Types
"a-nlelfu", -- Ada.Numerics.Long_Elementary_Functions
"a-nllcef", -- Ada.Long_Long_Complex_Elementary_Functions
"a-nllefu", -- Ada.Numerics.Long_Long_Elementary_Functions
"a-nllcty", -- Ada.Numerics.Long_Long_Complex_Types
"a-nscefu", -- Ada.Short_Complex_Elementary_Functions
"a-nscoty", -- Ada.Numerics.Short_Complex_Types
"a-nselfu", -- Ada.Numerics.Short_Elementary_Functions
"a-sfteio", -- Ada.Short_Float_Text_IO
"a-sfwtio", -- Ada.Short_Float_Wide_Text_IO
"a-siteio", -- Ada.Short_Integer_Text_IO
"a-siwtio", -- Ada.Short_Integer_Wide_Text_IO
"a-ssitio", -- Ada.Short_Short_Integer_Text_IO
"a-ssiwti", -- Ada.Short_Short_Integer_Wide_Text_IO
-----------------------------------
-- GNAT Defined Additions to Ada --
-----------------------------------
"a-chlat9", -- Ada.Characters.Latin_9
"a-colien", -- Ada.Command_Line.Environment
"a-colire", -- Ada.Command_Line.Remove
"a-cwila1", -- Ada.Characters.Wide_Latin_1
"a-cwila9", -- Ada.Characters.Wide_Latin_9
"a-diocst", -- Ada.Direct_IO.C_Streams
"a-einuoc", -- Ada.Exceptions.Is_Null_Occurrence
"a-elchha", -- Ada.Exceptions.Last_Chance_Handler
"a-exctra", -- Ada.Exceptions.Traceback
"a-siocst", -- Ada.Sequential_IO.C_Streams
"a-ssicst", -- Ada.Streams.Stream_IO.C_Streams
"a-suteio", -- Ada.Strings.Unbounded.Text_IO
"a-swuwti", -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
"a-taidim", -- Ada.Task_Identification.Image
"a-tiocst", -- Ada.Text_IO.C_Streams
"a-wtcstr", -- Ada.Wide_Text_IO.C_Streams
-- Note: strictly the next two should be Ada 2005 units, but it seems
-- harmless (and useful) to make then available in Ada 95 mode, since
-- they only deal with Wide_Character, not Wide_Wide_Character.
"a-wichun", -- Ada.Wide_Characters.Unicode
"a-widcha", -- Ada.Wide_Characters
---------------------------
-- GNAT Special IO Units --
---------------------------
-- As further explained elsewhere (see Sem_Ch10), the internal
-- packages of Text_IO and Wide_Text_IO are actually implemented
-- as separate children, but this fact is intended to be hidden
-- from the user completely. Any attempt to WITH one of these
-- units will be diagnosed as an error later on, but for now we
-- do not consider these internal implementation units (if we did,
-- then we would get a junk warning which would be confusing and
-- unecessary, given that we generate a clear error message).
"a-tideio", -- Ada.Text_IO.Decimal_IO
"a-tienio", -- Ada.Text_IO.Enumeration_IO
"a-tifiio", -- Ada.Text_IO.Fixed_IO
"a-tiflio", -- Ada.Text_IO.Float_IO
"a-tiinio", -- Ada.Text_IO.Integer_IO
"a-tiinio", -- Ada.Text_IO.Integer_IO
"a-timoio", -- Ada.Text_IO.Modular_IO
"a-wtdeio", -- Ada.Wide_Text_IO.Decimal_IO
"a-wtenio", -- Ada.Wide_Text_IO.Enumeration_IO
"a-wtfiio", -- Ada.Wide_Text_IO.Fixed_IO
"a-wtflio", -- Ada.Wide_Text_IO.Float_IO
"a-wtinio", -- Ada.Wide_Text_IO.Integer_IO
"a-wtmoio", -- Ada.Wide_Text_IO.Modular_IO
------------------------
-- GNAT Library Units --
------------------------
"g-altive", -- GNAT.Altivec
"g-alvety", -- GNAT.Altivec.Vector_Types
"g-alvevi", -- GNAT.Altivec.Vector_Views
"g-alveop", -- GNAT.Altivec.Vector_Operations
"g-altcon", -- GNAT.Altivec.Conversions
"g-arrspl", -- GNAT.Array_Split
"g-awk ", -- GNAT.AWK
"g-boubuf", -- GNAT.Bounded_Buffers
"g-boumai", -- GNAT.Bounded_Mailboxes
"g-bubsor", -- GNAT.Bubble_Sort
"g-busora", -- GNAT.Bubble_Sort_A
"g-busorg", -- GNAT.Bubble_Sort_G
"g-calend", -- GNAT.Calendar
"g-casuti", -- GNAT.Case_Util
"g-catiio", -- GNAT.Calendar.Time_IO
"g-cgi ", -- GNAT.CGI
"g-cgicoo", -- GNAT.CGI.Cookie
"g-cgideb", -- GNAT.CGI.Debug
"g-comlin", -- GNAT.Command_Line
"g-comver", -- GNAT.Compiler_Version
"g-crc32 ", -- GNAT.CRC32
"g-ctrl_c", -- GNAT.Ctrl_C
"g-curexc", -- GNAT.Current_Exception
"g-debpoo", -- GNAT.Debug_Pools
"g-debuti", -- GNAT.Debug_Utilities
"g-diopit", -- GNAT.Directory_Operations.Iteration
"g-dirope", -- GNAT.Directory_Operations
"g-dynhta", -- GNAT.Dynamic_HTables
"g-dyntab", -- GNAT.Dynamic_Tables
"g-excact", -- GNAT.Exception_Actions
"g-except", -- GNAT.Exceptions
"g-exctra", -- GNAT.Exception_Traces
"g-expect", -- GNAT.Expect
"g-flocon", -- GNAT.Float_Control
"g-heasor", -- GNAT.Heap_Sort
"g-hesora", -- GNAT.Heap_Sort_A
"g-hesorg", -- GNAT.Heap_Sort_G
"g-htable", -- GNAT.Htable
"g-io ", -- GNAT.IO
"g-io_aux", -- GNAT.IO_Aux
"g-locfil", -- GNAT.Lock_Files
"g-md5 ", -- GNAT.MD5
"g-memdum", -- GNAT.Memory_Dump
"g-moreex", -- GNAT.Most_Recent_Exception
"g-os_lib", -- GNAT.Os_Lib
"g-pehage", -- GNAT.Perfect_Hash_Generators
"g-regexp", -- GNAT.Regexp
"g-regist", -- GNAT.Registry
"g-regpat", -- GNAT.Regpat
"g-semaph", -- GNAT.Semaphores
"g-sestin", -- GNAT.Secondary_Stack_Info
"g-signal", -- GNAT.Signals
"g-socket", -- GNAT.Sockets
"g-souinf", -- GNAT.Source_Info
"g-speche", -- GNAT.Spell_Checker
"g-spipat", -- GNAT.Spitbol.Patterns
"g-spitbo", -- GNAT.Spitbol
"g-sptabo", -- GNAT.Spitbol.Table_Boolean
"g-sptain", -- GNAT.Spitbol.Table_Integer
"g-sptavs", -- GNAT.Spitbol.Table_Vstring
"g-string", -- GNAT.Strings
"g-strspl", -- GNAT.String_Split
"g-table ", -- GNAT.Table
"g-tasloc", -- GNAT.Task_Lock
"g-thread", -- GNAT.Threads
"g-traceb", -- GNAT.Traceback
"g-trasym", -- GNAT.Traceback.Symbolic
"g-utf_32", -- GNAT.UTF_32
"g-wistsp", -- GNAT.Wide_String_Split
-----------------------------------------------------
-- Interface Hierarchy Units from Reference Manual --
-----------------------------------------------------
"i-c ", -- Interfaces.C
"i-cobol ", -- Interfaces.Cobol
"i-cpoint", -- Interfaces.C.Pointers
"i-cstrin", -- Interfaces.C.Strings
"i-fortra", -- Interfaces.Fortran
------------------------------------------
-- GNAT Defined Additions to Interfaces --
------------------------------------------
"i-cexten", -- Interfaces.C.Extensions
"i-cpp ", -- Interfaces.CPP
"i-cstrea", -- Interfaces.C.Streams
"i-jalaob", -- Interfaces.Java.Lang.Object
"i-jalasy", -- Interfaces.Java.Lang.System
"i-jalath", -- Interfaces.Java.Lang.Thread
"i-java ", -- Interfaces.Java
"i-javlan", -- Interfaces.Java.Lang
"i-os2err", -- Interfaces.Os2lib.Errors
"i-os2lib", -- Interfaces.Os2lib
"i-os2syn", -- Interfaces.Os2lib.Synchronization
"i-os2thr", -- Interfaces.Os2lib.Threads
"i-pacdec", -- Interfaces.Packed_Decimal
"i-vthrea", -- Interfaces.Vthreads
"i-vxwoio", -- Interfaces.VxWorks.IO
"i-vxwork", -- Interfaces.VxWorks
--------------------------------------------------
-- System Hierarchy Units from Reference Manual --
--------------------------------------------------
"s-atacco", -- System.Address_To_Access_Conversions
"s-maccod", -- System.Machine_Code
"s-rpc ", -- System.Rpc
"s-stoele", -- System.Storage_Elements
"s-stopoo", -- System.Storage_Pools
--------------------------------------
-- GNAT Defined Additions to System --
--------------------------------------
"s-addima", -- System.Address_Image
"s-assert", -- System.Assertions
"s-memory", -- System.Memory
"s-parint", -- System.Partition_Interface
"s-pooglo", -- System.Pool_Global
"s-pooloc", -- System.Pool_Local
"s-restri", -- System.Restrictions
"s-rident", -- System.Rident
"s-tasinf", -- System.Task_Info
"s-wchcnv", -- System.Wch_Cnv
"s-wchcon"); -- System.Wch_Con
--------------------
-- Ada 2005 Units --
--------------------
-- The following units should be used only in Ada 05 mode
Non_Imp_File_Names_05 : constant File_List := (
--------------------------------------------------------
-- Ada Hierarchy Units from Ada 2005 Reference Manual --
--------------------------------------------------------
"a-cdlili", -- Ada.Containers.Doubly_Linked_Lists
"a-cgaaso", -- Ada.Containers.Generic_Anonymous_Array_Sort
"a-cgarso", -- Ada.Containers.Generic_Array_Sort
"a-cgcaso", -- Ada.Containers.Generic_Constrained_Array_Sort
"a-chacon", -- Ada.Characters.Conversions
"a-cidlli", -- Ada.Containers.Indefinite_Doubly_Linked_Lists
"a-cihama", -- Ada.Containers.Indefinite_Hashed_Maps
"a-cihase", -- Ada.Containers.Indefinite_Hashed_Sets
"a-ciorma", -- Ada.Containers.Indefinite_Ordered_Maps
"a-ciorse", -- Ada.Containers.Indefinite_Ordered_Sets
"a-cohama", -- Ada.Containers.Hashed_Maps
"a-cohase", -- Ada.Containers.Hashed_Sets
"a-coinve", -- Ada.Containers.Indefinite_Vectors
"a-contai", -- Ada.Containers
"a-convec", -- Ada.Containers.Vectors
"a-coorma", -- Ada.Containers.Ordered_Maps
"a-coorse", -- Ada.Containers.Ordered_Sets
"a-coteio", -- Ada.Complex_Text_IO
"a-direct", -- Ada.Directories
"a-envvar", -- Ada.Environment_Variables
"a-rttiev", -- Ada.Real_Time.Timing_Events
"a-secain", -- Ada.Strings.Equal_Case_Insensitive
"a-shcain", -- Ada.Strings.Hash_Case_Insensitive
"a-slcain", -- Ada.Strings.Less_Case_Insensitive
"a-stboha", -- Ada.Strings.Bounded.Hash
"a-stfiha", -- Ada.Strings.Fixed.Hash
"a-strhas", -- Ada.Strings.Hash
"a-stunha", -- Ada.Strings.Unbounded.Hash
"a-stwiha", -- Ada.Strings.Wide_Hash
"a-stzbou", -- Ada.Strings.Wide_Wide_Bounded
"a-stzfix", -- Ada.Strings.Wide_Wide_Fixed
"a-stzhas", -- Ada.Strings.Wide_Wide_Hash
"a-stzmap", -- Ada.Strings.Wide_Wide_Maps
"a-stzunb", -- Ada.Strings.Wide_Wide_Unbounded
"a-swbwha", -- Ada.Strings.Wide_Bounded.Wide_Hash
"a-swfwha", -- Ada.Strings.Wide_Fixed.Wide_Hash
"a-swuwha", -- Ada.Strings.Wide_Unbounded.Wide_Hash
"a-szbzha", -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
"a-szfzha", -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
"a-szmzco", -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
"a-szuzha", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
"a-taster", -- Ada.Task_Termination
"a-tgdico", -- Ada.Tags.Generic_Dispatching_Constructor
"a-tiboio", -- Ada.Text_IO.Bounded_IO
"a-tiunio", -- Ada.Text_IO.Unbounded_IO
"a-wichun", -- Ada.Wide_Characters.Unicode
"a-wwboio", -- Ada.Wide_Text_IO.Wide_Bounded_IO
"a-wwunio", -- Ada.Wide_Text_IO.Wide_Unbounded_IO
"a-zchara", -- Ada.Wide_Wide_Characters
"a-zttest", -- Ada.Wide_Wide_Text_IO.Text_Streams
"a-ztexio", -- Ada.Wide_Wide_Text_IO
"a-zzboio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
"a-zzunio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
------------------------------------------------------
-- RM Required Additions to Ada 2005 for GNAT Types --
------------------------------------------------------
"a-lcteio", -- Ada.Long_Complex_Text_IO
"a-lfztio", -- Ada.Long_Float_Wide_Wide_Text_IO
"a-liztio", -- Ada.Long_Integer_Wide_Wide_Text_IO
"a-llctio", -- Ada.Long_Long_Complex_Text_IO
"a-llfzti", -- Ada.Long_Long_Float_Wide_Wide_Text_IO
"a-llizti", -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
"a-scteio", -- Ada.Short_Complex_Text_IO
"a-sfztio", -- Ada.Short_Float_Wide_Wide_Text_IO
"a-siztio", -- Ada.Short_Integer_Wide_Wide_Text_IO
"a-ssizti", -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
"a-ztcstr", -- Ada.Wide_Wide_Text_IO.C_Streams
----------------------------------------
-- GNAT Defined Additions to Ada 2005 --
----------------------------------------
"a-chzla1", -- Ada.Characters.Wide_Wide_Latin_1
"a-chzla9", -- Ada.Characters.Wide_Wide_Latin_9
"a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
"a-coormu", -- Ada.Containers.Ordered_Multisets
"a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
"a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
---------------------------
-- GNAT Special IO Units --
---------------------------
-- See Ada 95 section for further information. These packages are for the
-- implementation of the Wide_Wide_Text_IO generic packages.
"a-ztdeio", -- Ada.Wide_Wide_Text_IO.Decimal_IO
"a-ztenio", -- Ada.Wide_Wide_Text_IO.Enumeration_IO
"a-ztfiio", -- Ada.Wide_Wide_Text_IO.Fixed_IO
"a-ztflio", -- Ada.Wide_Wide_Text_IO.Float_IO
"a-ztinio", -- Ada.Wide_Wide_Text_IO.Integer_IO
"a-ztmoio", -- Ada.Wide_Wide_Text_IO.Modular_IO
------------------------
-- GNAT Library Units --
------------------------
"g-zstspl"); -- GNAT.Wide_Wide_String_Split
----------------------
-- Get_Kind_Of_Unit --
----------------------
function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
Fname : constant File_Name_Type := Unit_File_Name (U);
begin
-- If length of file name is greater than 12, not predefined.
-- The value 12 here is an 8 char name with extension .ads.
if Length_Of_Name (Fname) > 12 then
return Not_Predefined_Unit;
end if;
-- Otherwise test file name
Get_Name_String (Fname);
-- Not predefined if file name does not start with a- g- s- i-
if Name_Len < 3
or else Name_Buffer (2) /= '-'
or else (Name_Buffer (1) /= 'a'
and then
Name_Buffer (1) /= 'g'
and then
Name_Buffer (1) /= 'i'
and then
Name_Buffer (1) /= 's')
then
return Not_Predefined_Unit;
end if;
-- Not predefined if file name does not end in .ads. This can
-- happen when non-standard file names are being used.
if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
return Not_Predefined_Unit;
end if;
-- Otherwise normalize file name to 8 characters
Name_Len := Name_Len - 4;
while Name_Len < 8 loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := ' ';
end loop;
-- See if name is in 95 list
for J in Non_Imp_File_Names_95'Range loop
if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
return Ada_95_Unit;
end if;
end loop;
-- See if name is in 05 list
for J in Non_Imp_File_Names_05'Range loop
if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
return Ada_05_Unit;
end if;
end loop;
-- Only remaining special possibilities are children of System.RPC and
-- System.Garlic and special files of the form System.Aux...
Get_Name_String (Unit_Name (U));
if Name_Len > 12
and then Name_Buffer (1 .. 11) = "system.rpc."
then
return Ada_95_Unit;
end if;
if Name_Len > 15
and then Name_Buffer (1 .. 14) = "system.garlic."
then
return Ada_95_Unit;
end if;
if Name_Len > 11
and then Name_Buffer (1 .. 10) = "system.aux"
then
return Ada_95_Unit;
end if;
-- All tests failed, this is definitely an implementation unit
return Implementation_Unit;
end Get_Kind_Of_Unit;
end Impunit;
|
30,895
|
ada
| 7
|
best08618/asylo
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c7/c74302a.ada
|
<gh_stars>1-10
-- C74302A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT MULTIPLE DECLARATIONS MAY BE USED FOR DEFERRED CONSTANT
-- DECLARATIONS, EVEN IF THE FULL DECLARATIONS ARE GIVEN INDIVIDUALLY.
-- CHECK THAT MULTIPLE DECLARATIONS MAY BE USED FOR THE FULL
-- DECLARATIONS, EVEN IF THE DEFERRED CONSTANT DECLARATIONS ARE GIVEN
-- INDIVIDUALLY.
-- DSJ 5/09/83
-- SPS 10/24/83
-- EG 12/19/83
-- JRK 12/20/83
-- DTN 11/19/91 DELETED SUBPART (C).
WITH REPORT;
PROCEDURE C74302A IS
USE REPORT;
BEGIN
TEST("C74302A", "CHECK THAT MULTIPLE DECLARATIONS MAY BE USED " &
"FOR DEFERRED CONSTANT DECLARATIONS");
DECLARE
PACKAGE PACK1 IS
TYPE T IS PRIVATE;
B, E : CONSTANT T;
F : CONSTANT T;
PRIVATE
TYPE T IS NEW INTEGER;
E : CONSTANT T := T(IDENT_INT(4));
B, F : CONSTANT T := T(IDENT_INT(2));
END PACK1;
USE PACK1;
BEGIN
IF B/=F THEN
FAILED("VALUES OF DEFERRED CONSTANTS B AND F NOT EQUAL");
END IF;
END;
RESULT;
END C74302A;
|
30,896
|
ada
| 17
|
jrmarino/ravensource
|
bucket_4C/AdaBrowse/patches/patch-ad-driver.adb
|
<reponame>jrmarino/ravensource
--- ad-driver.adb.orig 2021-09-04 15:38:31 UTC
+++ ad-driver.adb
@@ -470,6 +470,7 @@ package body AD.Driver is
AIC.Set_File_Name
(AIC.Subprogram_Index, Canonical (S (S'First + 2 .. S'Last)));
elsif S = "-P" then
+ Error ("-P is disabled in Ravenports");
I := I + 1;
Check_Following (I, N, S);
if Has_Project then
|
30,897
|
ada
| 1
|
nenofite/ada-genetic
|
genetic.adb
|
<reponame>nenofite/ada-genetic
with Ada.Containers.Generic_Constrained_Array_Sort;
package body Genetic is
-- Determine the sum of each gene's fitness within the gene pool.
function Total_Fitness (P : in Pool) return Float is
-- We will add up each gene's individual fitness.
Result : Float := 0.0;
begin
-- For each gene in the pool
for I in P'Range loop
-- Add that gene's fitness.
Result := Result + Fitness_Of (P (I).G);
end loop;
-- Return the sum.
return Result;
end Total_Fitness;
-- Create a pool full of random genes. It will not be sorted yet.
procedure Randomize (P : out Pool) is
begin
-- For each gene in the pool
for I in P'Range loop
-- Create a random gene.
P (I).G := Random_Gene;
-- Since we have yet to evaluate the fitness of this gene, mark that
-- it is not cached.
P (I).Cached := False;
end loop;
end Randomize;
-- Get the most fit gene from the pool. The pool must be sorted before
-- calling this.
function Best_Gene (P : in Pool) return Gene is
-- Simply return the first element in the pool. Since the pool is
-- required to be sorted before calling this function, the first element
-- will be the most fit gene.
(P (P'First).G);
-- Compare the fitness of two genes. This function is used for sorting the
-- gene pool.
function Gene_Compare (Left, Right : in Fit_Gene) return Boolean is
-- Simply compare the two genes' fitness.
(Left.Fitness > Right.Fitness);
-- Sort a gene pool by the fitness of each gene. We use Ada's built-in
-- sorting procedure.
procedure Pool_Sort is new Ada.Containers.Generic_Constrained_Array_Sort (
Index_Type => Pool_Index,
Element_Type => Fit_Gene,
Array_Type => Pool,
"<" => Gene_Compare);
-- Advance the evolution of the genes. This first sorts the genes from most
-- to least fit, then replaces the least fit genes with mutations of fit
-- genes or random new genes.
procedure Evolve (P : in out Pool) is
-- The last part of the pool, called the foreign space, gets replaced
-- with new random genes. This is the first index of that part.
Foreign_Space : Natural := P'Last - (P'Length / 10);
-- The second half of the pool (not including the foreign space) gets
-- replaced with mutations of the most fit genes. This is the first index
-- of that part.
Halfway : Natural := (P'First + Foreign_Space) / 2;
-- The last index of the part of the pool being replaced by mutated
-- genes. We will use this index when copying and mutating the most fit
-- genes.
Other_End : Natural := Foreign_Space - 1;
begin
-- First, we must get the fitness of each gene in the pool and sort.
-- For each gene in the pool
for I in P'Range loop
-- Unless we already know the gene's fitness
if not P (I).Cached then
-- Calculate the gene's fitness.
P (I).Fitness := Fitness_Of (P (I).G);
-- Mark that we know this gene's fitness now.
P (I).Cached := True;
end if;
end loop;
-- Sort the gene pool so the most fit genes are at the front.
Pool_Sort (P);
-- Next, we will mutate the most fit genes.
-- For each of the most fit genes
for I in P'First .. Halfway loop
-- Copy the gene over into the second half. `Other_End` is the index
-- into which we copy the gene.
P (Other_End) := P (I);
-- Mutate the gene.
Mutate (P (Other_End).G);
-- Because we have changed the gene, its fitness will change too. Mark
-- that we no longer know its fitness.
P (Other_End).Cached := False;
-- Move the other end index to the next position.
Other_End := Other_End - 1;
end loop;
-- Finally, we will introduce some new random genes at the end of the
-- pool.
-- For each gene in the foreign space
for I in Foreign_Space .. P'Last loop
-- Replace the gene with a random new one.
P (I).G := Random_Gene;
-- Since this is a completely new gene, we don't know its fitness yet.
P (I).Cached := False;
end loop;
end Evolve;
end Genetic;
|
30,898
|
ada
| 1
|
LaudateCorpus1/RosettaCodeData
|
Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-3.ada
|
type Link is limited record
Next : not null access Link := Link'Unchecked_Access;
Prev : not null access Link := Link'Unchecked_Access;
Data : Integer;
end record;
|
30,899
|
ada
| 0
|
jrcarter/Gnoga_Bar_Codes
|
gnoga_bar_codes_test.adb
|
-- Test program for Gnoga_Bar_Codes
--
-- Copyright (C) 2018 by PragmAda Software Engineering
--
-- Released under the terms of the 3-Clause BSD License. See https://opensource.org/licenses/BSD-3-Clause
with Bar_Codes;
with Gnoga.Application.Singleton;
with Gnoga.Gui.Base;
with Gnoga.Gui.Element.Common;
with Gnoga.Gui.Element.Form;
with Gnoga.Gui.Window;
with Gnoga_Bar_Codes;
with Gnoga_Extra;
procedure Gnoga_Bar_Codes_Test is
Window : Gnoga.Gui.Window.Window_Type;
View : Gnoga.Gui.Element.Form.Form_Type;
Code_1D : Gnoga_Bar_Codes.Bar_Code;
Code_2D : Gnoga_Bar_Codes.Bar_Code;
Input : Gnoga_Extra.Text_Info;
Gen : Gnoga.Gui.Element.Common.Button_Type;
Quit : Gnoga.Gui.Element.Common.Button_Type;
procedure Generate (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
-- Empty
begin -- Generate
Code_2D.Generate (Kind => Bar_Codes.Code_QR_Low, Text => Input.Box.Value);
Code_1D.Generate (Kind => Bar_Codes.Code_128, Text => Input.Box.Value);
exception -- Generate
when Bar_Codes.Cannot_Encode =>
Code_1D.Generate (Kind => Bar_Codes.Code_128, Text => "");
end Generate;
procedure Quit_Now (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
-- Empty;
begin -- Quit_Now
Gnoga.Application.Singleton.End_Application;
end Quit_Now;
Box_1D : constant Bar_Codes.Module_Box := Bar_Codes.Fitting (Kind => Bar_Codes.Code_128, Text => (1 .. 50 => 'a') );
Box_2D : constant Bar_Codes.Module_Box := Bar_Codes.Fitting (Kind => Bar_Codes.Code_QR_Low, Text => (1 .. 50 => 'a') );
Code_Width : constant Positive := 2 * Box_1D.Width;
Code_Height : constant Positive := Code_Width / 4;
begin -- Gnoga_Bar_Codes_Test
Gnoga.Application.Title ("Gnoga Bar-Codes Test");
Gnoga.Application.HTML_On_Close ("Gnoga Bar-Codes Test ended.");
Gnoga.Application.Open_URL;
Gnoga.Application.Singleton.Initialize (Main_Window => Window);
View.Create (Parent => Window);
View.Text_Alignment (Value => Gnoga.Gui.Element.Center);
View.New_Line;
Code_1D.Create (Parent => View, Width => Code_Width, Height => Code_Height);
View.New_Line;
Code_2D.Create (Parent => View, Width => 8 * Box_2D.Width, Height => 8 * Box_2D.Width);
View.New_Line;
Input.Create (Form => View, Label => "Text :", Width => 20);
Gen.Create (Parent => View, Content => "Generate");
Gen.On_Click_Handler (Handler => Generate'Unrestricted_Access);
View.On_Submit_Handler (Handler => Generate'Unrestricted_Access);
View.New_Line;
Quit.Create (Parent => View, Content => "Quit");
Quit.On_Click_Handler (Handler => Quit_Now'Unrestricted_Access);
Gnoga.Application.Singleton.Message_Loop;
end Gnoga_Bar_Codes_Test;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.