repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
reznikmm/matreshka | Ada | 4,663 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Visible_Area_Left_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Visible_Area_Left_Attribute_Node is
begin
return Self : Draw_Visible_Area_Left_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Visible_Area_Left_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Visible_Area_Left_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Visible_Area_Left_Attribute,
Draw_Visible_Area_Left_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Visible_Area_Left_Attributes;
|
reznikmm/matreshka | Ada | 3,724 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Caption_Type_Attributes is
pragma Preelaborate;
type ODF_Draw_Caption_Type_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Caption_Type_Attribute_Access is
access all ODF_Draw_Caption_Type_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Caption_Type_Attributes;
|
reznikmm/gela | Ada | 1,227 | ads | with Gela.Types;
package Gela.Type_Categories is
pragma Preelaborate;
type Category_Kinds is
(A_Character,
A_Boolean,
An_Other_Enum,
An_Universal_Integer,
A_Signed_Integer,
A_Modular_Integer,
An_Universal_Real,
A_Float_Point,
An_Universal_Fixed,
A_Ordinary_Fixed_Point,
A_Decimal_Fixed_Point,
A_Constant_Access,
A_Variable_Access,
A_Pool_Access,
A_Procedure_Access,
A_Function_Access,
An_Universal_Access,
A_String,
An_Other_Array,
A_Untagged_Record,
A_Tagged,
A_Task,
A_Protected,
A_Private,
An_Incomplete);
-- type Category_Kind_Set is array (Category_Kinds) of Boolean with Pack;
subtype Any_Integer_Type is Category_Kinds
range An_Universal_Integer .. A_Modular_Integer;
subtype Any_Real_Type is Category_Kinds
range An_Universal_Real .. A_Decimal_Fixed_Point;
type Type_View is interface and Gela.Types.Type_View;
type Type_View_Access is access all Type_View'Class;
for Type_View_Access'Storage_Size use 0;
not overriding function Category
(Self : Type_View) return Category_Kinds is abstract;
end Gela.Type_Categories;
|
Fabien-Chouteau/samd51-hal | Ada | 4,728 | ads | pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.CoreDebug is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CoreDebug_DHCSR_DBGKEY_Field is HAL.UInt16;
-- Debug Halting Control and Status Register
type CoreDebug_DHCSR_Register is record
C_DEBUGEN : Boolean := False;
C_HALT : Boolean := False;
C_STEP : Boolean := False;
C_MASKINTS : Boolean := False;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
C_SNAPSTALL : Boolean := False;
-- unspecified
Reserved_6_15 : HAL.UInt10 := 16#0#;
-- Write-only.
DBGKEY : CoreDebug_DHCSR_DBGKEY_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CoreDebug_DHCSR_Register use record
C_DEBUGEN at 0 range 0 .. 0;
C_HALT at 0 range 1 .. 1;
C_STEP at 0 range 2 .. 2;
C_MASKINTS at 0 range 3 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
C_SNAPSTALL at 0 range 5 .. 5;
Reserved_6_15 at 0 range 6 .. 15;
DBGKEY at 0 range 16 .. 31;
end record;
subtype CoreDebug_DCRSR_REGSEL_Field is HAL.UInt5;
-- Debug Core Register Selector Register
type CoreDebug_DCRSR_Register is record
-- Write-only.
REGSEL : CoreDebug_DCRSR_REGSEL_Field := 16#0#;
-- unspecified
Reserved_5_15 : HAL.UInt11 := 16#0#;
-- Write-only.
REGWnR : Boolean := False;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CoreDebug_DCRSR_Register use record
REGSEL at 0 range 0 .. 4;
Reserved_5_15 at 0 range 5 .. 15;
REGWnR at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-- Debug Exception and Monitor Control Register
type CoreDebug_DEMCR_Register is record
VC_CORERESET : Boolean := False;
-- unspecified
Reserved_1_3 : HAL.UInt3 := 16#0#;
VC_MMERR : Boolean := False;
VC_NOCPERR : Boolean := False;
VC_CHKERR : Boolean := False;
VC_STATERR : Boolean := False;
VC_BUSERR : Boolean := False;
VC_INTERR : Boolean := False;
VC_HARDERR : Boolean := False;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
MON_EN : Boolean := False;
MON_PEND : Boolean := False;
MON_STEP : Boolean := False;
MON_REQ : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
TRCENA : Boolean := False;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CoreDebug_DEMCR_Register use record
VC_CORERESET at 0 range 0 .. 0;
Reserved_1_3 at 0 range 1 .. 3;
VC_MMERR at 0 range 4 .. 4;
VC_NOCPERR at 0 range 5 .. 5;
VC_CHKERR at 0 range 6 .. 6;
VC_STATERR at 0 range 7 .. 7;
VC_BUSERR at 0 range 8 .. 8;
VC_INTERR at 0 range 9 .. 9;
VC_HARDERR at 0 range 10 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
MON_EN at 0 range 16 .. 16;
MON_PEND at 0 range 17 .. 17;
MON_STEP at 0 range 18 .. 18;
MON_REQ at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
TRCENA at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Core Debug Register
type CoreDebug_Peripheral is record
-- Debug Halting Control and Status Register
DHCSR : aliased CoreDebug_DHCSR_Register;
-- Debug Core Register Selector Register
DCRSR : aliased CoreDebug_DCRSR_Register;
-- Debug Core Register Data Register
DCRDR : aliased HAL.UInt32;
-- Debug Exception and Monitor Control Register
DEMCR : aliased CoreDebug_DEMCR_Register;
end record
with Volatile;
for CoreDebug_Peripheral use record
DHCSR at 16#0# range 0 .. 31;
DCRSR at 16#4# range 0 .. 31;
DCRDR at 16#8# range 0 .. 31;
DEMCR at 16#C# range 0 .. 31;
end record;
-- Core Debug Register
CoreDebug_Periph : aliased CoreDebug_Peripheral
with Import, Address => CoreDebug_Base;
end SAM_SVD.CoreDebug;
|
reznikmm/matreshka | Ada | 4,090 | adb | -- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/verbose_file_body.a,v 1.1 88/08/08 14:44:42 arcadia Exp $
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to [email protected]
-- Send bug reports for ayacc to [email protected]
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : verbose_file_body.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:38:50
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxverbose_file_body.ada
-- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/verbose_file_body.a,v 1.1 88/08/08 14:44:42 arcadia Exp $
-- $Log: verbose_file_body.a,v $
--Revision 1.1 88/08/08 14:44:42 arcadia
--Initial revision
--
-- Revision 0.1 86/04/01 15:14:46 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:54:37 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by David Taback and Deepak Tolani.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
with Text_IO, Ayacc_File_Names;
use Text_IO;
package body Verbose_File is
SCCS_ID : constant String := "@(#) verbose_file_body.ada, Version 1.2";
Rcs_ID : constant String := "$Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/verbose_file_body.a,v 1.1 88/08/08 14:44:42 arcadia Exp $";
V_File : File_Type; -- The verbose file
procedure Open is
use Ayacc_File_Names;
begin
Create(V_File, Out_File, Get_Verbose_File_Name);
end Open;
procedure Close is
begin
Close(V_File);
end Close;
procedure Write(Ch : in Character) is
begin
Put(V_File, Ch);
end Write;
procedure Write(S : in String) is
begin
Put(V_File, S);
end Write;
procedure Write_Line(S : in String := "") is
begin
Put_Line(V_File, S);
end Write_Line;
procedure Print_Grammar_Symbol(Sym: in Grammar_Symbol) is
begin
Put(V_File, Get_Symbol_Name(Sym));
end;
procedure Print_Item(Item_1 : in Item) is
begin
Put(V_File, "(" & Rule'Image(Item_1.Rule_ID) & ") ");
Put(V_File, Get_Symbol_Name(Get_LHS(Item_1.Rule_ID)) & Ascii.Ht & ": ");
if Item_1.Dot_Position = 0 then
Put(V_File, "_ ");
end if;
for I in 1..Length_of(Item_1.Rule_ID) loop
Put(V_File, Get_Symbol_Name(Get_RHS(Item_1.Rule_ID, I)));
Put(V_File, " ");
if I = Item_1.Dot_Position then
Put(V_File, "_ ");
end if;
end loop;
end Print_Item;
procedure Print_Item_Set(Set_1: in Item_Set) is
use Item_Set_Pack;
Iterator : Item_Iterator;
Temp_Item : Item;
begin
Initialize(Iterator, Set_1);
while More(Iterator) loop
Next(Iterator, Temp_Item);
Print_Item(Temp_Item);
New_Line(V_File);
end loop;
end Print_Item_Set;
procedure Print_Rule(R : in Rule) is
begin
Put(V_File, "(" & Rule'Image(R) & ") ");
Put(V_File, Get_Symbol_Name(Get_LHS(R)) & Ascii.Ht & ": ");
for I in 1..Length_of(R) loop
Put(V_File, Get_Symbol_Name(Get_RHS(R, I)));
Put(V_File, " ");
end loop;
end Print_Rule;
end Verbose_File;
|
gerr135/ada_composition | Ada | 700 | adb | -- with Ada.Text_IO; use Ada.Text_IO;
package body Iface_Lists is
function Has_Element (Position : Cursor) return Boolean is
-- Ada's stock ACV checks for Position = No_Element here,
-- which requires much more bookkeeping, possibly type specific.
-- Here we deal with type hierarchy, with possibly different iteration implementation deltails
-- for each derived type. It makes way more sense to let the container handle this itself.
-- So we just redispatch here..
begin
-- Put("Cursor.Has_Element (" & Position.Index'Img & "); ");
return Position.Container.Has_Element(Position.Index);
end Has_Element;
end Iface_Lists;
|
AaronC98/PlaneSystem | Ada | 7,791 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2003-2013, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
-- Dispatch a specific request to a callback depending on current time
with Ada.Calendar.Formatting;
with AWS.Dispatchers;
with AWS.Response;
with AWS.Status;
private with Ada.Containers.Vectors;
private with Ada.Strings.Unbounded;
package AWS.Services.Dispatchers.Timer is
use Ada;
type Handler is new AWS.Dispatchers.Handler with private;
type Period is private;
subtype Year_Number is Calendar.Year_Number;
subtype Month_Number is Calendar.Month_Number;
subtype Day_Number is Calendar.Day_Number;
subtype Day_Name is Calendar.Formatting.Day_Name;
subtype Hour_Number is Calendar.Formatting.Hour_Number;
subtype Minute_Number is Calendar.Formatting.Minute_Number;
subtype Second_Number is Calendar.Formatting.Second_Number;
function Once
(From_Year : Year_Number;
From_Month : Month_Number;
From_Day : Day_Number;
From_Hour : Hour_Number;
From_Minute : Minute_Number;
From_Second : Second_Number;
To_Year : Year_Number;
To_Month : Month_Number;
To_Day : Day_Number;
To_Hour : Hour_Number;
To_Minute : Minute_Number;
To_Second : Second_Number)
return Period;
-- A period that is uniq in time
function Yearly
(From_Month : Month_Number;
From_Day : Day_Number;
From_Hour : Hour_Number;
From_Minute : Minute_Number;
From_Second : Second_Number;
To_Month : Month_Number;
To_Day : Day_Number;
To_Hour : Hour_Number;
To_Minute : Minute_Number;
To_Second : Second_Number)
return Period;
-- A period that repeats each year
function Monthly
(From_Day : Day_Number;
From_Hour : Hour_Number;
From_Minute : Minute_Number;
From_Second : Second_Number;
To_Day : Day_Number;
To_Hour : Hour_Number;
To_Minute : Minute_Number;
To_Second : Second_Number)
return Period;
-- A period that repeats each month
function Weekly
(From_Day : Day_Name;
From_Hour : Hour_Number;
From_Minute : Minute_Number;
From_Second : Second_Number;
To_Day : Day_Name;
To_Hour : Hour_Number;
To_Minute : Minute_Number;
To_Second : Second_Number)
return Period;
-- A period that repeats each week
function Daily
(From_Hour : Hour_Number;
From_Minute : Minute_Number;
From_Second : Second_Number;
To_Hour : Hour_Number;
To_Minute : Minute_Number;
To_Second : Second_Number)
return Period;
-- A period that repeats each day
function Hourly
(From_Minute : Minute_Number;
From_Second : Second_Number;
To_Minute : Minute_Number;
To_Second : Second_Number)
return Period;
-- A period that repeats each hour
function Minutely
(From_Second : Second_Number;
To_Second : Second_Number)
return Period;
-- A period that repeats each minute
procedure Register
(Dispatcher : in out Handler;
Name : String;
Period : Timer.Period;
Action : AWS.Dispatchers.Handler'Class);
-- Register a Period to use the specified dispatcher
procedure Register
(Dispatcher : in out Handler;
Name : String;
Period : Timer.Period;
Action : Response.Callback);
-- Idem as above but take a callback procedure as parameter
procedure Unregister
(Dispatcher : in out Handler;
Name : String);
-- Removes the period dispatcher named Name. Does nothing if Name is not
-- found.
procedure Register_Default_Callback
(Dispatcher : in out Handler;
Action : AWS.Dispatchers.Handler'Class);
-- Register the default callback. This will be used if no period
-- matches the current time.
private
use Ada.Strings.Unbounded;
overriding procedure Initialize (Dispatcher : in out Handler);
overriding procedure Finalize (Dispatcher : in out Handler);
overriding function Dispatch
(Dispatcher : Handler;
Request : Status.Data) return Response.Data;
-- Dispatch will call the time dispatcher that matches the current time.
-- Note that if a callback returns the Response.Empty message, Dispatch
-- will just continue to the next matching callback. In any cases, if no
-- handler matches it will call the default callback. If no default
-- callback is registered an error HTML message (code 404) is returned.
overriding function Clone (Dispatcher : Handler) return Handler;
-- Returns a deep copy of the dispatcher
type Kind is (Once, Yearly, Monthly, Weekly, Daily, Hourly, Minutely);
type Date_Time is record
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
N_Day : Day_Name;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
end record;
type Period is record
Mode : Kind;
From : Date_Time;
To : Date_Time;
end record;
type Node is record
Name : Unbounded_String;
Period : Timer.Period;
Action : AWS.Dispatchers.Handler_Class_Access;
end record;
type Node_Access is access Node;
package Period_Table is
new Ada.Containers.Vectors (Positive, Node_Access, "=");
type Handler is new AWS.Dispatchers.Handler with record
Action : AWS.Dispatchers.Handler_Class_Access;
Table : Period_Table.Vector;
end record;
end AWS.Services.Dispatchers.Timer;
|
reznikmm/matreshka | Ada | 6,800 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Caption_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Draw_Caption_Element_Node is
begin
return Self : Draw_Caption_Element_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Draw_Caption_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Draw_Caption
(ODF.DOM.Draw_Caption_Elements.ODF_Draw_Caption_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Caption_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Caption_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Draw_Caption_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Draw_Caption
(ODF.DOM.Draw_Caption_Elements.ODF_Draw_Caption_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Draw_Caption_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Draw_Caption
(Visitor,
ODF.DOM.Draw_Caption_Elements.ODF_Draw_Caption_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Caption_Element,
Draw_Caption_Element_Node'Tag);
end Matreshka.ODF_Draw.Caption_Elements;
|
yannickmoy/bbqueue-ada | Ada | 14,466 | ads | -- Based on James Munns' https://github.com/jamesmunns/bbqueue
--
-- BBQueue implements lock free, one producer one consumer, BipBuffers.
--
-- This unit only handles index offsets without having an internal buffer.
-- It can be used to allocate slices of an existing array, e.g.:
--
-- Buf : Storage_Array (8 .. 64) := (others => 0);
-- Q : aliased Offsets_Only (Buf'Length);
-- WG : Write_Grant := BBqueue.Empty;
-- S : Slice_Rec;
-- begin
-- Write_Grant (Q, WG, 8);
-- if State (WG) = Valid then
-- S := Slice (WG);
-- Buf (Buf'First + S.From .. Buf'First + S.To) := (others => 42);
-- end if;
-- Commit (Q, WG);
with System.Storage_Elements; use System.Storage_Elements;
private with Atomic.Generic_Signed64;
package BBqueue
with Preelaborate,
SPARK_Mode,
Abstract_State => null
is
type Result_Kind is (Valid, Grant_In_Progress, Insufficient_Size, Empty);
subtype Count is Storage_Count;
subtype Buffer_Size is Count range 1 .. Count'Last;
subtype Buffer_Offset is Storage_Offset range 0 .. Count'Last - 1;
type Offsets_Only (Size : Buffer_Size) is limited private;
-- Producer --
type Write_Grant is limited private;
procedure Grant (This : in out Offsets_Only;
G : in out Write_Grant;
Size : Count)
with Pre => State (G) /= Valid,
Post => State (G) in Valid | Empty | Grant_In_Progress | Insufficient_Size
and then
(if Size = 0 then State (G) = Empty)
and then
(if State (G) = Valid
then Write_Grant_In_Progress (This)
and then Slice (G).Length = Size
and then Valid_Slice (This, Slice (G))
and then Valid_Write_Slice (This, Slice (G)));
-- Request indexes of a contiguous writeable slice of exactly Size elements
procedure Commit (This : in out Offsets_Only;
G : in out Write_Grant;
Size : Count := Count'Last)
with Pre => State (G) = Valid,
Post => (if Write_Grant_In_Progress (This)'Old
then State (G) = Empty
else State (G) = Valid);
-- Commit a writeable slice. Size can be smaller than the granted slice for
-- partial commits. The commited slice is then available for Read.
-- Consumer --
type Read_Grant is limited private;
procedure Read (This : in out Offsets_Only;
G : in out Read_Grant;
Max : Count := Count'Last)
with Pre => State (G) /= Valid,
Post => State (G) in Valid | Empty | Grant_In_Progress
and then
(if State (G) = Valid
then Read_Grant_In_Progress (This)
and then Slice (G).Length <= Max
and then Valid_Slice (This, Slice (G))
and then Valid_Read_Slice (This, Slice (G)));
-- Request indexes of a contiguous readable slice of up to Max elements
procedure Release (This : in out Offsets_Only;
G : in out Read_Grant;
Size : Count := Count'Last)
with Pre => State (G) = Valid,
Post => (if Read_Grant_In_Progress (This)'Old
then State (G) = Empty
else State (G) = Valid);
-- Release a readable slice. Size can be smaller than the granted slice for
-- partial releases.
-- Utils --
function Empty return Write_Grant
with Post => State (Empty'Result) = Empty;
function Empty return Read_Grant
with Post => State (Empty'Result) = Empty;
-- Slices --
type Slice_Rec is record
Length : Count;
From : Buffer_Offset;
To : Buffer_Offset;
end record;
function State (G : Write_Grant) return Result_Kind;
function Slice (G : Write_Grant) return Slice_Rec
with Pre => State (G) = Valid;
function State (G : Read_Grant) return Result_Kind;
function Slice (G : Read_Grant) return Slice_Rec
with Pre => State (G) = Valid;
-- Contract helpers --
function Valid_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
is (Slice.From <= Slice.To
and then Slice.Length = Slice.To - Slice.From + 1
and then Slice.From in 0 .. This.Size - 1
and then Slice.To in 0 .. This.Size - 1)
with Ghost;
-- A valid slice contains offsets within the bounds of the array range.
-- This ensures that:
-- Arr (Arr'First + Start_Offset .. Arr'First + End_Offset)
-- will never be out of bounds.
function Valid_Write_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
with Ghost;
function Valid_Read_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
with Ghost;
function Write_Grant_In_Progress (This : Offsets_Only) return Boolean with Ghost;
function Read_Grant_In_Progress (This : Offsets_Only) return Boolean with Ghost;
private
function In_Readable_Area (This : Offsets_Only;
Offset : Buffer_Offset)
return Boolean
with Ghost;
function In_Writable_Area (This : Offsets_Only;
Offset : Buffer_Offset)
return Boolean
with Ghost;
package Atomic_Count is new Atomic.Generic_Signed64 (Count);
use Atomic_Count;
type Offsets_Only (Size : Buffer_Size) is limited record
Write : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Where the next byte will be written
Read : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Where the next byte will be read from
Last : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Used in the inverted case to mark the end of the
-- readable streak. Otherwise will == sizeof::<self.buf>().
-- Writer is responsible for placing this at the correct
-- place when entering an inverted condition, and Reader
-- is responsible for moving it back to sizeof::<self.buf>()
-- when exiting the inverted condition
--
-- Cooperatively owned
--
-- NOTE: This should generally be initialized as size_of::<self.buf>(),
-- however this would prevent the structure from being entirely
-- zero-initialized, and can cause the .data section to be much larger
-- than necessary. By forcing the `last` pointer to be zero initially, we
-- place the structure in an "inverted" condition, which will be resolved
-- on the first commited bytes that are written to the structure.
--
-- When read == last == write, no bytes will be allowed to be read
-- (good), but write grants can be given out (also good).
Reserve : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Used by the Writer to remember what bytes are currently
-- allowed to be written to, but are not yet ready to be
-- read from
Read_In_Progress : aliased Atomic.Flag := Atomic.Init (False);
-- Is there an active read grant?
Write_In_Progress : aliased Atomic.Flag := Atomic.Init (False);
-- Is there an active write grant?
Granted_Write_Size : Count := 0;
Granted_Read_Size : Count := 0;
end record
with Invariant =>
Size <= Buffer_Size'Last
and then Value (Write) in 0 .. Size
and then Value (Read) in 0 .. Size
and then Value (Last) in 0 .. Size
and then Value (Reserve) in 0 .. Size
and then Value (Last) >= Value (Read)
and then Value (Last) >= Value (Write)
and then Granted_Write_Size <= Buffer_Size'Last
and then Granted_Read_Size <= Buffer_Size'Last
-- Reserve can only be lower than Write when a write grant made an
-- inverted allocation (starting back at 0), but the grant is not
-- commited yet.
and then (if Value (Reserve) < Value (Write) then not Is_Inverted (Offsets_Only))
and then (if Value (Reserve) < Value (Write)
then not Is_Inverted (Offsets_Only)
and then Value (Write) >= Value (Read)
and then Value (Reserve) = Granted_Write_Size
else Value (Reserve) - Granted_Write_Size = Value (Write))
-- Reserve is always in a writable area or else = Size
and then (Value (Reserve) = Size
or else In_Writable_Area (Offsets_Only, Value (Reserve)))
and then (if Is_Inverted (Offsets_Only)
then (Value (Write) + Granted_Write_Size <= Value (Read)
and then
Value (Reserve) <= Value (Read))
else Value (Read) <= Value (Write) - Granted_Read_Size)
-- Read cannot be in reserved area
and then (Value (Read) = Value (Write)
or else
(not (Granted_Write_Size /= 0
and then
Value (Read) in Value (Reserve) - Granted_Write_Size .. Value (Reserve) - 1
)))
-- Write grant bounds
and then (if Is_Inverted (Offsets_Only)
then Granted_Write_Size <= Value (Read) - Value (Write)
else Granted_Write_Size <= Count'Max (Size - Value (Write),
Value (Read)))
-- Read grant bounds
and then (if Is_Inverted (Offsets_Only)
then Granted_Read_Size <= Value (Last) - Value (Read)
else Granted_Read_Size <= Value (Write) - Value (Read))
-- Reserve when about to invert
and then (if not Is_Inverted (Offsets_Only) and then Value (Reserve) < Value (Write) then
-- When Reserved wrapped around, we know that it is because we
-- needed more space than what is available between Write and
-- then end of the buffer
Value (Reserve) > (Size - Value (Write))
)
and then (Value (Read) + Granted_Read_Size in 0 .. Size)
and then (if not Atomic.Value (Write_In_Progress) then Granted_Write_Size = 0)
and then (if not Atomic.Value (Read_In_Progress) then Granted_Read_Size = 0)
-- and then (if Atomic.Value (Write_In_Progress) then Granted_Write_Size /= 0)
-- and then (if Atomic.Value (Read_In_Progress) then Granted_Read_Size /= 0)
;
function Is_Inverted (This : Offsets_Only) return Boolean
is (Value (This.Write) < Value (This.Read))
with Ghost;
Empty_Slice : constant Slice_Rec := (0, 0, 0);
type Write_Grant is limited record
Result : Result_Kind := Empty;
Slice : Slice_Rec := Empty_Slice;
end record;
-- with Invariant => (case Write_Grant.Result is
-- when Valid => not Slices.Empty (Write_Grant.Slice),
-- when others => Slices.Empty (Write_Grant.Slice));
type Read_Grant is limited record
Result : Result_Kind := Empty;
Slice : Slice_Rec := Empty_Slice;
end record;
-- with Invariant => (case Read_Grant.Result is
-- when Valid => not Slices.Empty (Read_Grant.Slice),
-- when others => Slices.Empty (Read_Grant.Slice));
function State (G : Write_Grant) return Result_Kind
is (G.Result);
function Empty return Write_Grant
is (Result => Empty, others => <>);
function Slice (G : Write_Grant) return Slice_Rec
is (G.Slice);
function State (G : Read_Grant) return Result_Kind
is (G.Result);
function Empty return Read_Grant
is (Result => Empty, others => <>);
function Slice (G : Read_Grant) return Slice_Rec
is (G.Slice);
-- Contract helpers --
----------------------
-- In_Readable_Area --
----------------------
function In_Readable_Area (This : Offsets_Only; Offset : Buffer_Offset) return Boolean
is (if Is_Inverted (This) then
-- Already inverted.
(if Value (This.Read) /= Value (This.Last) then
-- |===W-----------R==L..|
-- Data remaining before Last:
-- We can read between R .. L
Offset in Value (This.Read) .. Value (This.Last)
else
-- |===W--------------R..|
-- L
-- Read = Last, the next valid read is inverted:
-- We can read between 0 .. W - 1
Offset in 0 .. Value (This.Write) - 1)
else
-- |----R=========W-----|
-- Not Inverted (R <= W):
-- We can read between R .. W - 1
Offset in Value (This.Read) .. Value (This.Write) - 1);
----------------------
-- In_Writable_Area --
----------------------
function In_Writable_Area (This : Offsets_Only; Offset : Buffer_Offset) return Boolean
is (if Is_Inverted (This) then
-- Already inverted
-- |---W==========R----|
-- Inverted (R > W):
-- We can write between W .. R - 1
Offset in Value (This.Write) .. Value (This.Read) - 1
else (
-- |====R---------W=====|
-- Not Inverted (R <= W):
-- We can write between W .. Last - 1, or 0 .. R - 1 if we invert
(Offset in Value (This.Write) .. This.Size - 1)
or else
(Offset in 0 .. Value (This.Read) - 1)));
-----------------------
-- Valid_Write_Slice --
-----------------------
function Valid_Write_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
is (Valid_Slice (This, Slice)
and then In_Writable_Area (This, Slice.From)
and then In_Writable_Area (This, Slice.To));
function Valid_Read_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
is (Valid_Slice (This, Slice)
and then In_Readable_Area (This, Slice.From)
and then In_Readable_Area (This, Slice.To));
-----------------------------
-- Write_Grant_In_Progress --
-----------------------------
function Write_Grant_In_Progress (This : Offsets_Only) return Boolean
is (Atomic.Value (This.Write_In_Progress));
----------------------------
-- Read_Grant_In_Progress --
----------------------------
function Read_Grant_In_Progress (This : Offsets_Only) return Boolean
is (Atomic.Value (This.Read_In_Progress));
end BBqueue;
|
anshumang/cp-snucl | Ada | 448 | adb | -- RUN: %llvmgcc -S %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;
|
stcarrez/ada-awa | Ada | 29,575 | adb | -----------------------------------------------------------------------
-- AWA.Tags.Models -- AWA.Tags.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with Ada.Unchecked_Deallocation;
pragma Warnings (On);
package body AWA.Tags.Models is
pragma Style_Checks ("-mrIu");
pragma Warnings (Off, "formal parameter * is not referenced");
pragma Warnings (Off, "use clause for type *");
pragma Warnings (Off, "use clause for private type *");
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
function Tag_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function Tag_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAG_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tag_Key;
function "=" (Left, Right : Tag_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tag_Ref'Class;
Impl : out Tag_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tag_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Tag_Ref) is
Impl : Tag_Access;
begin
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tag
-- ----------------------------------------
procedure Set_Id (Object : in out Tag_Ref;
Value : in ADO.Identifier) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tag_Ref)
return ADO.Identifier is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Name (Object : in out Tag_Ref;
Value : in String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Tag_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Tag_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Tag_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Tag_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
-- Copy of the object.
procedure Copy (Object : in Tag_Ref;
Into : in out Tag_Ref) is
Result : Tag_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tag_Access
:= Tag_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tag_Access
:= new Tag_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tag_Access := new Tag_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tag_Access := new Tag_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tag_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Tag_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Tag_Impl) is
type Tag_Impl_Ptr is access all Tag_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tag_Impl, Tag_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tag_Impl_Ptr := Tag_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAG_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Tag_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAG_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tag_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tag_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tag_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAG_DEF'Access);
begin
Stmt.Execute;
Tag_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tag_Ref;
Impl : constant Tag_Access := new Tag_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tag_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Name := Stmt.Get_Unbounded_String (1);
ADO.Objects.Set_Created (Object);
end Load;
function Tagged_Entity_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function Tagged_Entity_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => TAGGED_ENTITY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Tagged_Entity_Key;
function "=" (Left, Right : Tagged_Entity_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Tagged_Entity_Ref'Class;
Impl : out Tagged_Entity_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Tagged_Entity_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Tagged_Entity_Ref) is
Impl : Tagged_Entity_Access;
begin
Impl := new Tagged_Entity_Impl;
Impl.For_Entity_Id := ADO.NO_IDENTIFIER;
Impl.Entity_Type := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Tagged_Entity
-- ----------------------------------------
procedure Set_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_For_Entity_Id (Object : in out Tagged_Entity_Ref;
Value : in ADO.Identifier) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 2, Impl.For_Entity_Id, Value);
end Set_For_Entity_Id;
function Get_For_Entity_Id (Object : in Tagged_Entity_Ref)
return ADO.Identifier is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.For_Entity_Id;
end Get_For_Entity_Id;
procedure Set_Entity_Type (Object : in out Tagged_Entity_Ref;
Value : in ADO.Entity_Type) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 3, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Tagged_Entity_Ref)
return ADO.Entity_Type is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
procedure Set_Tag (Object : in out Tagged_Entity_Ref;
Value : in Tag_Ref'Class) is
Impl : Tagged_Entity_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 4, Impl.Tag, Value);
end Set_Tag;
function Get_Tag (Object : in Tagged_Entity_Ref)
return Tag_Ref'Class is
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Tag;
end Get_Tag;
-- Copy of the object.
procedure Copy (Object : in Tagged_Entity_Ref;
Into : in out Tagged_Entity_Ref) is
Result : Tagged_Entity_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Tagged_Entity_Access
:= Tagged_Entity_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Tagged_Entity_Access
:= new Tagged_Entity_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.For_Entity_Id := Impl.For_Entity_Id;
Copy.Entity_Type := Impl.Entity_Type;
Copy.Tag := Impl.Tag;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Tagged_Entity_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Tagged_Entity_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Tagged_Entity_Impl) is
type Tagged_Entity_Impl_Ptr is access all Tagged_Entity_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Tagged_Entity_Impl, Tagged_Entity_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Tagged_Entity_Impl_Ptr := Tagged_Entity_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Object.Clear_Modified (4);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Query.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tagged_Entity_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Tagged_Entity_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Tagged_Entity_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "for_entity_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.For_Entity_Id));
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Tagged_Entity_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
Tagged_Entity_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tagged_Entity_Ref;
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Tagged_Entity_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.For_Entity_Id := Stmt.Get_Identifier (1);
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (2));
if not Stmt.Is_Null (3) then
Object.Tag.Set_Key_Value (Stmt.Get_Identifier (3), Session);
end if;
ADO.Objects.Set_Created (Object);
end Load;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Tag_Info;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "tag" then
return Util.Beans.Objects.To_Object (From.Tag);
elsif Name = "count" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Count));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Tag_Info;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "tag" then
Item.Tag := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "count" then
Item.Count := Util.Beans.Objects.To_Integer (Value);
end if;
end Set_Value;
-- --------------------
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
-- --------------------
procedure List (Object : in out Tag_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
begin
List (Object.List, Session, Context);
end List;
-- --------------------
-- The tag information.
-- --------------------
procedure List (Object : in out Tag_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
procedure Read (Into : in out Tag_Info);
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Context);
Pos : Positive := 1;
procedure Read (Into : in out Tag_Info) is
begin
Into.Tag := Stmt.Get_Unbounded_String (0);
Into.Count := Stmt.Get_Natural (1);
end Read;
begin
Stmt.Execute;
Tag_Info_Vectors.Clear (Object);
while Stmt.Has_Elements loop
Object.Insert_Space (Before => Pos);
Object.Update_Element (Index => Pos, Process => Read'Access);
Pos := Pos + 1;
Stmt.Next;
end loop;
end List;
end AWA.Tags.Models;
|
reznikmm/matreshka | Ada | 4,730 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Table_Table_Rows_Elements;
package Matreshka.ODF_Table.Table_Rows_Elements is
type Table_Table_Rows_Element_Node is
new Matreshka.ODF_Table.Abstract_Table_Element_Node
and ODF.DOM.Table_Table_Rows_Elements.ODF_Table_Table_Rows
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Table_Rows_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Table_Table_Rows_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Table_Table_Rows_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Table_Table_Rows_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Table_Table_Rows_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Table.Table_Rows_Elements;
|
AdaCore/gpr | Ada | 5,922 | ads | --
-- Copyright (C) 2020-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--
with Ada.Exceptions;
with GNATCOLL.JSON;
with GPR2.C.Utils; use GPR2.C.Utils;
with GPR2.Containers;
with GPR2.Message;
with GPR2.Path_Name.Set;
with GPR2.Project.Configuration;
package GPR2.C.JSON is
subtype JSON_Value is GNATCOLL.JSON.JSON_Value;
subtype JSON_Array is GNATCOLL.JSON.JSON_Array;
function Decode (Request : C_Request) return JSON_Value;
-- Decodes a C_Request (char * in C) into a JSON_Value
function Encode (Answer : JSON_Value) return C_Answer;
-- Encodes a JSON_Value into a C_Answer (char * in C)
type Bind_Handler is access procedure
(Request : JSON_Value; Result : JSON_Value);
function Bind
(Request : C_Request;
Answer : out C_Answer;
Handler : Bind_Handler) return C_Status;
-- Takes care of the boilerplate that decodes the incoming request and
-- encodes the answer. Handler function receives the decoded JSON and
-- returns the 'result' part of the answer.
-- Bind catches all exceptions and sets properly the error in the answer.
-- Note that Result is in fact an in/out parameter. When the handler is
-- called, the Result JSON_Value is initialized as an empty JSON object
-- (i.e. dictionary).
-----------------------
-- Decoding requests --
-----------------------
type GPR_Tree_Access is access all GPR_Tree;
pragma No_Strict_Aliasing (GPR_Tree_Access);
type Project_Configuration_Access is
access all GPR2.Project.Configuration.Object;
pragma No_Strict_Aliasing (Project_Configuration_Access);
function Get (Obj : JSON_Value; Key : String) return JSON_Value;
-- Returnes member Key of JSON object Obj. Return Null object if the member
-- cannot be found.
function To_Boolean (Obj : JSON_Value; Default : Boolean) return Boolean;
-- Returns member Key of JSON object Obj, assuming that member's value is
-- a boolean.
-- If Obj does not have a Key member then Default is returned.
-- If the Key member exists but is not a boolean then an exception is
-- raised.
function To_Context (Obj : JSON_Value) return GPR_Context;
-- Returns member Key of JSON object Obj, assuming that member's value is
-- a JSON object for which all members values are strings. The returned
-- object is a GPR_Context.
-- If the member does not exist or its value does not comply with the
-- expected structure an exception is raised.
function Get_GPR_Tree
(Obj : JSON_Value; Key : String) return GPR_Tree_Access;
-- Returns member Key of JSON object Obj, assuming that member's value is
-- a JSON string representing a project tree id. The returned object is an
-- access to a GPR_Tree.
-- If the member does not exist or its value does not comply with the
-- expected structure an exception is raised.
function Get_Status (Obj : JSON_Value) return C_Status;
-- Returns the "status" member of an answer JSON object
function Get_Result (Obj : JSON_Value) return JSON_Value;
-- Returns the "result" member of an answer JSON object. Note that the
-- returned value is mutable.
function Get_Level_Format
(Obj : JSON_Value; Key : String; Default : GPR2.Message.Level_Format)
return GPR2.Message.Level_Format;
-- Return the Level_Format corresponding to value found in JSON at 'Key'
function Get_Level_Output
(Obj : JSON_Value; Default : GPR2.Message.Level_Output)
return GPR2.Message.Level_Output;
-- Return the Level_Output encoded in JSON
function To_Path_Name (Obj : JSON_Value) return GPR_Path;
function To_Path_Name_Set
(Obj : JSON_Value) return GPR2.Path_Name.Set.Object;
-- Decode a JSON_Value into a Path_Name_Set. The JSON_Value is expected to
-- be an array of strings.
function To_Name_Value_Map
(Obj : JSON_Value) return GPR2.Containers.Name_Value_Map;
function To_Lang_Value_Map
(Obj : JSON_Value) return GPR2.Containers.Lang_Value_Map;
-- Decode a JSON_Value into a Lang_Value_Map object. the expected format is
-- { "lang1": "value1",
-- ...
-- "langN": "valueN"}
function To_GPR_View
(Tree : GPR_Tree; Obj : JSON_Value) return GPR_View;
-- Decode a JSON_Value into a View.Object. The JSON_Value should be a
-- which is an image of a valid view id.
function To_Filename
(Obj : JSON_Value) return GPR2.Filename_Type;
function To_Language
(Obj : JSON_Value) return GPR2.Language_Id;
function To_Unit_Index
(Obj : JSON_Value; Default : Unit_Index) return Unit_Index;
function To_String (Obj : JSON_Value) return String;
function To_String (Obj : JSON_Value; Default : String) return String;
function To_Name (Obj : JSON_Value) return Optional_Name_Type;
function Get_Name_Value_Map
(Obj : JSON_Value; Key : String) return GPR2.Containers.Name_Value_Map;
-- Return the name value map defined in Key dictionnary
---------------------
-- Encoding answer --
---------------------
function Initialize_Answer return JSON_Value;
-- Creates an answer JSON object:
-- {
-- "result": {},
-- "error_msg": "",
-- "error_name": "",
-- "status": 0
-- }
procedure Set_Status (Obj : JSON_Value; Value : C_Status);
-- Sets the status member of an answer JSON object Obj
procedure Set_Status
(Obj : JSON_Value;
Value : C_Status;
E : Ada.Exceptions.Exception_Occurrence);
-- Sets the status, error_msg and error_name of an answer JSON object Obj
-- Convertion functions to JSON values
procedure Set (Obj : JSON_Value; Key : String; Value : JSON_Value);
private
function To_Name (Obj : JSON_Value) return Optional_Name_Type is
(Optional_Name_Type (To_String (Obj)));
end GPR2.C.JSON;
|
reznikmm/matreshka | Ada | 4,866 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- 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.Generic_Collections;
package AMF.UML.Profiles.Collections is
pragma Preelaborate;
package UML_Profile_Collections is
new AMF.Generic_Collections
(UML_Profile,
UML_Profile_Access);
type Set_Of_UML_Profile is
new UML_Profile_Collections.Set with null record;
Empty_Set_Of_UML_Profile : constant Set_Of_UML_Profile;
type Ordered_Set_Of_UML_Profile is
new UML_Profile_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Profile : constant Ordered_Set_Of_UML_Profile;
type Bag_Of_UML_Profile is
new UML_Profile_Collections.Bag with null record;
Empty_Bag_Of_UML_Profile : constant Bag_Of_UML_Profile;
type Sequence_Of_UML_Profile is
new UML_Profile_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Profile : constant Sequence_Of_UML_Profile;
private
Empty_Set_Of_UML_Profile : constant Set_Of_UML_Profile
:= (UML_Profile_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Profile : constant Ordered_Set_Of_UML_Profile
:= (UML_Profile_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Profile : constant Bag_Of_UML_Profile
:= (UML_Profile_Collections.Bag with null record);
Empty_Sequence_Of_UML_Profile : constant Sequence_Of_UML_Profile
:= (UML_Profile_Collections.Sequence with null record);
end AMF.UML.Profiles.Collections;
|
zhmu/ananas | Ada | 209 | adb | -- { dg-do compile }
-- { dg-options "-gnat12" }
package body Cond_Expr2 is
function F (X : integer) return String is
begin
return (if X > 0 then "positive" else "negative");
end;
end Cond_Expr2;
|
fnarenji/BezierToSTL | Ada | 4,721 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics; use Ada.Numerics;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
with Helper; use Helper;
package body STL is
procedure Creation(
Segments : in out Liste_Points.Liste ;
Facettes : out Liste_Facettes.Liste;
Nombre_Facettes : Positive)
is
-- Angle de la rotation en radian
Angle_Radian : constant Float := (2.0 * PI) / Float(Nombre_Facettes);
-- Crée un "cercle" de facettes
procedure Creer_Facette(P_Cour, P_Suiv : in Point2D) is
-- Calcul du point suivant en effectuant une rotation autour
-- de l'axe x=0 à partir de P
function Calculer_Point(P : Point2D; Pas : Integer) return Point3D is
begin
return (
1 => P(P'First),
2 => P(P'Last) * Cos(Float(Pas) * Angle_Radian),
3 => P(P'Last) * Sin(Float(Pas) * Angle_Radian));
end;
begin
for Pas in 0 .. Nombre_Facettes loop
declare
F1 : constant Facette := (
P1 => Calculer_Point (P_Suiv, Pas),
P2 => Calculer_Point (P_Cour, Pas),
P3 => Calculer_Point (P_Cour, Pas + 1));
F2 : constant Facette := (
P1 => Calculer_Point (P_Suiv, Pas + 1),
P2 => Calculer_Point (P_Suiv, Pas),
P3 => Calculer_Point (P_Cour, Pas + 1));
begin
-- On ajoute une facette dans la liste (i.e. 3 points 3D)
Liste_Facettes.Insertion_Queue(Facettes, F1);
-- On ajoute la deuxième facette
Liste_Facettes.Insertion_Queue(Facettes, F2);
end;
end loop;
end;
-- Construit l'image 3D
procedure Construire_STL is new Liste_Points.Parcourir_Par_Couples(Creer_Facette);
begin
Debug("Projection avec angle: " & Float'Image(Angle_Radian));
Debug("Nombre de facettes: " & Integer'Image(Nombre_Facettes));
-- Mise en oeuvre :
-- On prend n dans 1..Taille(Segments) et on considère Pn un Point2D
-- Chaque pas k (k dans (0,M-1)) de l'angle de rotation alpha génère un couple de Facettes (en 3D)
-- Informellement, on a les facettes :
-- (Pn + k*alpha, Pn-1 + k*alpha, Pn-1 + (k+1)*alpha)
-- et
-- (Pn + k*alpha, Pn-1 + (k+1)*alpha, Pn + (k+1)*alpha)
-- Ensuite on construit les facettes
Construire_STL(Segments);
Debug("Fin projection");
Debug;
end;
procedure Sauvegarder(
Nom_Fichier : String ;
Facettes : Liste_Facettes.Liste)
is
Fichier : File_Type;
-- Ecrit le code STL pour une facette
procedure Display_Facette_STL(Triplet : in out Facette) is
begin
Put(Fichier, "facet");
New_Line (Fichier);
Put(Fichier, "outer loop");
New_Line (Fichier);
Put(Fichier, "vertex " & Float'Image(Triplet.P1(Triplet.P1'First)) &
" " & Float'Image(Triplet.P1(Triplet.P1'First+1)) &
" " & Float'Image(Triplet.P1(Triplet.P1'First+2)));
New_Line (Fichier);
Put(Fichier, "vertex " & Float'Image(Triplet.P2(Triplet.P2'First)) &
" " & Float'Image(Triplet.P2(Triplet.P2'First+1)) &
" " & Float'Image(Triplet.P2(Triplet.P2'First+2)));
New_Line (Fichier);
Put(Fichier, "vertex " & Float'Image(Triplet.P3(Triplet.P3'First)) &
" " & Float'Image(Triplet.P3(Triplet.P3'First+1)) &
" " & Float'Image(Triplet.P3(Triplet.P3'First+2)));
New_Line (Fichier);
Put(Fichier, "endloop");
New_Line (Fichier);
Put(Fichier, "endfacet");
New_Line (Fichier);
end;
procedure Affiche_Code_STL is new Liste_Facettes.Parcourir(Display_Facette_STL);
begin
Debug("Sauvegarde vers fichier: " & Nom_Fichier);
begin
Open (Fichier, Out_File, Nom_Fichier);
Debug("Fichier existe => tronqué");
exception
when Name_Error =>
-- Si le fichier n'existe pas
Create (Fichier, Out_File, Nom_Fichier);
Debug("Fichier crée");
end;
Put(Fichier, "solid " & Nom_Fichier);
New_Line (Fichier);
Affiche_Code_STL(Facettes);
Put(Fichier, "endsolid " & Nom_Fichier);
Close(Fichier);
Debug("Fin écriture");
end;
end;
|
reznikmm/matreshka | Ada | 4,666 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Number_Day_Elements;
package Matreshka.ODF_Number.Day_Elements is
type Number_Day_Element_Node is
new Matreshka.ODF_Number.Abstract_Number_Element_Node
and ODF.DOM.Number_Day_Elements.ODF_Number_Day
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Number_Day_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Number_Day_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Number_Day_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Number_Day_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Number_Day_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Number.Day_Elements;
|
hgrodriguez/rp2040_zfp | Ada | 439 | ads | with RP.ROM;
pragma Unreferenced (RP.ROM);
package Runtime is
-- crt0.S expects this symbol to exist. It is called after main returns.
procedure OS_Exit (Status : Integer)
with Export => True,
Convention => C,
External_Name => "exit";
procedure HardFault_Handler
with Export => True,
Convention => C,
External_Name => "isr_hardfault";
end Runtime;
|
reznikmm/matreshka | Ada | 19,533 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with XML.SAX.Input_Sources.Streams.Files;
with XML.SAX.Simple_Readers;
with AMF.CMOF.Data_Types;
with AMF.CMOF.Enumerations;
with AMF.CMOF.Primitive_Types;
with AMF.Extents;
with AMF.URI_Extents;
with Generator.Arguments;
with Generator.Names;
with Generator.Type_Mapping.Handlers;
package body Generator.Type_Mapping is
use Ada.Wide_Wide_Text_IO;
use Generator.Names;
use type League.Strings.Universal_String;
----------------------------------
-- Ada_Enumeration_Literal_Name --
----------------------------------
function Ada_Enumeration_Literal_Name
(Element : not null access
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal'Class)
return League.Strings.Universal_String
is
Position : constant Enumeration_Literal_Maps.Cursor
:= Literal.Find (AMF.CMOF.Elements.CMOF_Element_Access (Element));
begin
if Enumeration_Literal_Maps.Has_Element (Position)
and then
not Enumeration_Literal_Maps.Element (Position).Ada_Name.Is_Empty
then
return Enumeration_Literal_Maps.Element (Position).Ada_Name;
else
-- Generate name then it is not specified explicitly.
return
League.Strings.To_Universal_String
(To_Ada_Identifier (Element.Get_Name.Value));
end if;
end Ada_Enumeration_Literal_Name;
--------------------------------------------
-- Ada_Enumeration_Literal_Qualified_Name --
--------------------------------------------
function Ada_Enumeration_Literal_Qualified_Name
(Element : not null access
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal'Class)
return League.Strings.Universal_String is
begin
return
"AMF."
& Owning_Metamodel_Ada_Name (Element)
& "."
& Ada_Enumeration_Literal_Name (Element);
end Ada_Enumeration_Literal_Qualified_Name;
-----------------------------
-- Public_Ada_Package_Name --
-----------------------------
function Public_Ada_Package_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String
is
Type_Element : constant AMF.CMOF.Elements.CMOF_Element_Access
:= AMF.CMOF.Elements.CMOF_Element_Access (The_Type);
begin
-- Use user specified mapping if any.
if Mapping.Contains (Type_Element)
and then Mapping.Element
(Type_Element).Mapping (Representation) /= null
and then Mapping.Element
(Type_Element).Mapping (Representation).Has_Ada_Package
then
return
Mapping.Element
(Type_Element).Mapping (Representation).Ada_Package;
end if;
-- Otherwise synthesize it.
if The_Type.all in AMF.CMOF.Classes.CMOF_Class'Class then
if Representation in Value .. Holder then
return
"AMF."
& Owning_Metamodel_Ada_Name (The_Type)
& "."
& Plural (To_Ada_Identifier (The_Type.Get_Name.Value));
else
return
"AMF."
& Owning_Metamodel_Ada_Name (The_Type)
& "."
& Plural (To_Ada_Identifier (The_Type.Get_Name.Value))
& ".Collections";
end if;
else
return "AMF." & Owning_Metamodel_Ada_Name (The_Type);
end if;
end Public_Ada_Package_Name;
--------------------------
-- Public_Ada_Type_Name --
--------------------------
function Public_Ada_Type_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String is
begin
if The_Type.all in AMF.CMOF.Classes.CMOF_Class'Class then
case Representation is
when Value | Holder =>
return
Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value)
& "_Access";
when Set =>
return
"Set_Of_"
& Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value);
when Ordered_Set =>
return
"Ordered_Set_Of_"
& Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value);
when Bag =>
return
"Bag_Of_"
& Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value);
when Sequence =>
return
"Sequence_Of_"
& Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value);
end case;
else
if Mapping.Contains
(AMF.CMOF.Elements.CMOF_Element_Access (The_Type))
and then Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation) /= null
and then not Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping
(Representation).Ada_Type.Is_Empty
then
return
Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation).Ada_Type;
else
case Representation is
when Value =>
return
Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value);
when Holder =>
return
"Optional_"
& Owning_Metamodel_Ada_Name (The_Type)
& "_"
& To_Ada_Identifier (The_Type.Get_Name.Value);
when others =>
raise Program_Error;
end case;
end if;
end if;
end Public_Ada_Type_Name;
------------------------------------
-- Public_Ada_Type_Qualified_Name --
------------------------------------
function Public_Ada_Type_Qualified_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String
is
Package_Name : constant League.Strings.Universal_String
:= Public_Ada_Package_Name (The_Type, Representation);
begin
if Package_Name.Is_Empty then
return Public_Ada_Type_Name (The_Type, Representation);
else
return
Package_Name
& "."
& Public_Ada_Type_Name (The_Type, Representation);
end if;
end Public_Ada_Type_Qualified_Name;
-------------------------------
-- Internal_Ada_Package_Name --
-------------------------------
function Internal_Ada_Package_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String
is
Type_Element : constant AMF.CMOF.Elements.CMOF_Element_Access
:= AMF.CMOF.Elements.CMOF_Element_Access (The_Type);
begin
-- Use user specified mapping if any.
if Mapping.Contains (Type_Element)
and then Mapping.Element
(Type_Element).Mapping (Representation) /= null
and then Mapping.Element
(Type_Element).Mapping
(Representation).Has_Internal_Ada_Package
then
return
Mapping.Element
(Type_Element).Mapping (Representation).Internal_Ada_Package;
end if;
-- Otherwise synthesize it.
if The_Type.all in AMF.CMOF.Classes.CMOF_Class'Class then
-- Classes are represented by internal data types.
return +"AMF.Internals";
elsif The_Type.all in AMF.CMOF.Enumerations.CMOF_Enumeration'Class then
-- Enumeration types are declared in AMF.<metamodel> package.
return Public_Ada_Package_Name (The_Type, Representation);
elsif The_Type.all in AMF.CMOF.Data_Types.CMOF_Data_Type'Class then
-- Data types are mapped according to specified mapping rules.
if Mapping.Contains (AMF.CMOF.Elements.CMOF_Element_Access (The_Type))
and then Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation) /= null
and then not Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping
(Representation).Internal_Ada_Package.Is_Empty
then
return
Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation).Internal_Ada_Package;
else
return Public_Ada_Package_Name (The_Type, Representation);
end if;
else
raise Program_Error;
end if;
end Internal_Ada_Package_Name;
--------------------------------------
-- Internal_Ada_Type_Qualified_Name --
--------------------------------------
function Internal_Ada_Type_Qualified_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String is
begin
if The_Type.all in AMF.CMOF.Classes.CMOF_Class'Class then
-- Classes are represented by internal data types.
case Representation is
when Value | Holder =>
return +"AMF.Internals.AMF_Element";
when Set | Ordered_Set | Bag | Sequence =>
return +"AMF.Internals.AMF_Collection_Of_Element";
end case;
elsif The_Type.all in AMF.CMOF.Enumerations.CMOF_Enumeration'Class then
-- Enumeration types are declared in AMF.<metamodel> package and
-- has <metamodel>_<type> name.
return
Public_Ada_Package_Name (The_Type, Representation)
& "."
& Public_Ada_Type_Name (The_Type, Representation);
elsif The_Type.all in AMF.CMOF.Data_Types.CMOF_Data_Type'Class then
-- Data types are mapped according to specified mapping rules.
if Mapping.Contains (AMF.CMOF.Elements.CMOF_Element_Access(The_Type))
and then Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation) /= null
and then not Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping
(Representation).Internal_Ada_Type.Is_Empty
then
if not Internal_Ada_Package_Name
(The_Type, Representation).Is_Empty
then
return
Internal_Ada_Package_Name (The_Type, Representation)
& "."
& Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation).Internal_Ada_Type;
else
return
Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Type)).Mapping (Representation).Internal_Ada_Type;
end if;
else
return Public_Ada_Type_Qualified_Name (The_Type, Representation);
end if;
else
raise Program_Error;
end if;
end Internal_Ada_Type_Qualified_Name;
------------------
-- Load_Mapping --
------------------
procedure Load_Mapping is
Reader : aliased XML.SAX.Simple_Readers.Simple_Reader;
Input : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source;
Handler : aliased Generator.Type_Mapping.Handlers.Mapping_Handler;
begin
Input.Open_By_File_Name (Generator.Arguments.Type_Mapping_File);
Reader.Set_Content_Handler (Handler'Unchecked_Access);
-- Reader.Set_Error_Handler (Handler'Unchecked_Access);
Reader.Parse (Input'Unchecked_Access);
end Load_Mapping;
-----------------
-- Member_Name --
-----------------
function Member_Name
(Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String
is
Position : constant Mapping_Maps.Cursor
:= Mapping.Find (AMF.CMOF.Elements.CMOF_Element_Access (Element));
Ada_Name : constant League.Strings.Universal_String
:= +To_Ada_Identifier
(AMF.CMOF.Named_Elements.CMOF_Named_Element'Class
(Element.all).Get_Name.Value);
begin
if Mapping_Maps.Has_Element (Position)
and then Mapping_Maps.Element (Position).Mapping (Representation)
/= null
and then not Mapping_Maps.Element
(Position).Mapping (Representation).Member_Name.Is_Empty
then
return
Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access (Element)).Mapping
(Representation).Member_Name;
else
if Element.all in AMF.CMOF.Classes.CMOF_Class'Class then
case Representation is
when Value | Holder =>
return +"Link";
when Set | Ordered_Set | Bag | Sequence =>
return +"Collection";
end case;
else
case Representation is
when Value =>
return Ada_Name & "_Value";
when Holder =>
return Ada_Name & "_Holder";
when Set | Ordered_Set | Bag | Sequence =>
return Ada_Name & "_Collection";
end case;
end if;
end if;
end Member_Name;
----------------------
-- Member_Kind_Name --
----------------------
function Member_Kind_Name
(Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String
is
Position : constant Mapping_Maps.Cursor
:= Mapping.Find (AMF.CMOF.Elements.CMOF_Element_Access (Element));
Ada_Name : constant League.Strings.Universal_String
:= +To_Ada_Identifier
(AMF.CMOF.Named_Elements.CMOF_Named_Element'Class
(Element.all).Get_Name.Value);
begin
if Mapping_Maps.Has_Element (Position)
and then Mapping_Maps.Element (Position).Mapping (Representation)
/= null
and then not Mapping_Maps.Element
(Position).Mapping
(Representation).Member_Kind_Name.Is_Empty
then
return
Mapping.Element
(AMF.CMOF.Elements.CMOF_Element_Access (Element)).Mapping
(Representation).Member_Kind_Name;
else
if Element.all in AMF.CMOF.Classes.CMOF_Class'Class then
case Representation is
when Value | Holder =>
return +"M_Element";
when Set | Ordered_Set | Bag | Sequence =>
return +"M_Collection_Of_Element";
end case;
else
case Representation is
when Value =>
return "M_" & Ada_Name;
when Holder =>
return "M_Holder_Of_" & Ada_Name;
when Set | Ordered_Set | Bag | Sequence =>
return "M_Collection_Of_" & Ada_Name;
end case;
end if;
end if;
end Member_Kind_Name;
end Generator.Type_Mapping;
|
AdaCore/libadalang | Ada | 59 | ads | package Pkg.Foo.Pkg is
procedure Main;
end Pkg.Foo.Pkg;
|
alvaromb/Compilemon | Ada | 1,241 | adb | -- COMPILEMON.adb
-- Programa per compilar el compilador
with Ada.Text_IO,
Ada.Command_Line,
Decls.D_Taula_De_Noms,
Decls.Dgenerals,
Decls.Dtdesc,
Pk_Usintactica_Tokens,
Pk_Ulexica_Io,
U_Lexica,
Pk_Usintactica,
Decls.D_Atribut,
Semantica,
Decls.Dtnode,
Semantica.Ctipus,
Semantica.Declsc3a,
Semantica.Gci,
Semantica.Assemblador;
use Ada.Text_IO,
Ada.Command_Line,
Decls.D_Taula_De_Noms,
Decls.Dgenerals,
Decls.Dtdesc,
Pk_Usintactica_Tokens,
Pk_Ulexica_Io,
U_Lexica,
Pk_Usintactica,
Decls.D_Atribut,
Semantica,
Decls.Dtnode,
Semantica.Ctipus,
Semantica.Declsc3a,
Semantica.Gci,
Semantica.Assemblador;
procedure Compilemon is
begin
Open_Input(Argument(1));
Inicia_analisi(Argument(1));
yyparse;
--Comprovacio de tipus
Ct_Programa(Arbre);
if not esem then
-- Generacio de codi intermedi
Inicia_Generacio(Argument(1));
Gci_Programa(Arbre);
-- Generacio de codi assemblador
Genera_Assemblador(Argument(1));
end if;
Close_Input;
exception
when Syntax_Error =>
Put_Line("ERROR CompiLEMON: Error a la linea "
&yy_line_number'img&
" i columna "&yy_begin_column'img);
end compilemon;
|
joakim-strandberg/wayland_ada_binding | Ada | 9,645 | ads | with C_Binding.Linux.Sockets.TCP_Server;
package C_Binding.Linux.Event_Polls is
MAX_EPOLL_EVENTS : constant := 64;
subtype Epoll_Event_Index is Positive range 1 .. MAX_EPOLL_EVENTS;
type Check_For_Events_Result_Id is
(
Error_Occurred,
Timed_Out,
Event_Registered
);
type Check_For_Events_Result (Id : Check_For_Events_Result_Id) is record
case Id is
when Error_Occurred =>
null;
when Timed_Out =>
null;
when Event_Registered =>
Event_Count : Epoll_Event_Index;
end case;
end record;
type Event_List is limited private;
function Is_Epoll_Error
(This : Event_List;
Index : Epoll_Event_Index) return Boolean;
function Has_Hang_Up_Happened
(This : Event_List;
Index : Epoll_Event_Index) return Boolean;
function Is_Data_Available_For_Reading
(This : Event_List;
Index : Epoll_Event_Index) return Boolean;
procedure Get_Socket
(This : Event_List;
Index : Epoll_Event_Index;
Socket : out C_Binding.Linux.Sockets.General_Socket);
function Is_Event_Origin
(This : Event_List;
Index : Epoll_Event_Index;
Listener : C_Binding.Linux.Sockets.TCP_Server.Listener)
return Boolean;
type Read_Socket_Result_Id is
(
Read_Failure,
Read_Success
);
type Read_Socket_Result (Id : Read_Socket_Result_Id) is record
case Id is
when Read_Failure => null;
when Read_Success =>
Element_Count : Ada.Streams.Stream_Element_Offset;
end case;
end record;
function Read_Socket
(
This : Event_List;
Index : Epoll_Event_Index;
Buffer : access Ada.Streams.Stream_Element_Array
) return Read_Socket_Result;
type Event_Poll_Watcher is limited private;
function Initialize (This : in out Event_Poll_Watcher) return Success_Flag;
function Add
(This : in out Event_Poll_Watcher;
Listener : C_Binding.Linux.Sockets.TCP_Server.Listener)
return Success_Flag;
function Add
(This : in out Event_Poll_Watcher;
Socket : C_Binding.Linux.Sockets.General_Socket)
return Success_Flag;
function Delete
(This : in out Event_Poll_Watcher;
Listener : C_Binding.Linux.Sockets.TCP_Server.Listener)
return Success_Flag;
function Delete
(
This : in out Event_Poll_Watcher;
List : Event_List;
Index : Epoll_Event_Index
) return Success_Flag;
function Check_For_Events
(This : Event_Poll_Watcher;
List : in out Event_List;
Timeout : Integer) return Check_For_Events_Result;
private
EPOLL_CTL_ADD : constant := 1;
-- Add fd to the interest list and associate the settings
-- specified in event with the internal file linked to fd.
EPOLL_CTL_DEL : constant := 2;
-- Remove (deregister) the target file descriptor fd from the
-- interest list. The event argument is ignored and can be NULL
-- (but see BUGS below).
EPOLL_CTL_MOD : constant := 3;
-- Change the settings associated with fd in the interest list to
-- the new settings specified in event.
EPOLLIN : constant := 1;
-- The associated file is available for read(2) operations.
EPOLLPRI : constant Interfaces.C.unsigned := 2;
-- There is an exceptional condition on the file descriptor.
EPOLLOUT : constant Interfaces.C.unsigned := 4;
-- The associated file is available for write(2) operations.
EPOLLRDNORM : constant Interfaces.C.unsigned := 64;
EPOLLRDBAND : constant Interfaces.C.unsigned := 128;
EPOLLWRNORM : constant Interfaces.C.unsigned := 256;
EPOLLWRBAND : constant Interfaces.C.unsigned := 512;
EPOLLMSG : constant Interfaces.C.unsigned := 1024;
EPOLLERR : constant := 8;
-- Error condition happened on the associated file descriptor.
-- This event is also reported for the write end of a pipe when
-- the read end has been closed. epoll_wait(2) will always
-- report for this event; it is not necessary to set it in
-- events.
EPOLLHUP : constant := 16;
-- Hang up happened on the associated file descriptor.
-- epoll_wait(2) will always wait for this event; it is not
-- necessary to set it in events.
--
-- Note that when reading from a channel such as a pipe or a
-- stream socket, this event merely indicates that the peer
-- closed its end of the channel. Subsequent reads from the
-- channel will return 0 (end of file) only after all outstanding
-- data in the channel has been consumed.
EPOLLRDHUP : constant Interfaces.C.unsigned := 8192;
-- Stream socket peer closed connection, or shut down writing
-- half of connection. (This flag is especially useful for writ-
-- ing simple code to detect peer shutdown when using Edge Trig-
-- gered monitoring.)
EPOLLEXCLUSIVE : constant Interfaces.C.unsigned := 268435456;
EPOLLWAKEUP : constant Interfaces.C.unsigned := 536870912;
EPOLLONESHOT : constant Interfaces.C.unsigned := 1073741824;
EPOLLET : constant Interfaces.C.unsigned := 2147483648;
type Epoll_Data (discr : Interfaces.C.unsigned := 0) is record
case discr is
when 0 =>
ptr : System.Address;
when 1 =>
fd : aliased Interfaces.C.int;
when 2 =>
u32 : aliased Interfaces.Unsigned_32;
when others =>
u64 : aliased Interfaces.Unsigned_64;
end case;
end record;
pragma Convention (C_Pass_By_Copy, Epoll_Data);
pragma Unchecked_Union (Epoll_Data);
type Epoll_Event is record
Events : aliased Interfaces.C.unsigned;
Data : aliased Epoll_Data;
end record;
pragma Convention (C_Pass_By_Copy, Epoll_Event);
type Epoll_Event_Array is array (Epoll_Event_Index) of aliased Epoll_Event;
-- This array cannot be defined as
-- array (Positive range <>)
-- because it will then not be possible to pass an instance of this
-- array as a subprogram argument in an Ada binding to a C library
-- because the type definition would be incompatible with C.
type Event_Poll_Watcher is limited record
My_File_Descriptor : Interfaces.C.int := -1;
end record;
type Event_List is limited record
My_Events : aliased Epoll_Event_Array;
end record;
function C_Epoll_Create1
(Flags : Interfaces.C.int) return Interfaces.C.int with
Import => True,
Convention => C,
External_Name => "epoll_create1";
-- Creates an epoll instance.
--
-- If flags is 0, then, other than the fact that the obsolete size
-- argument is dropped, epoll_create1() is the same as epoll_create().
-- The following value can be included in flags
-- to obtain different behavior:
function C_Epoll_Control
(Epoll_Fd : Interfaces.C.int;
Operation : Interfaces.C.int;
File_Descriptor : Interfaces.C.int;
Event : access Epoll_Event) return Interfaces.C.int with
Import => True,
Convention => C,
External_Name => "epoll_ctl";
-- This system call is used to add, modify, or remove entries in the
-- interest list of the epoll(7) instance referred to by the file
-- descriptor epfd. It requests that the operation op be performed for
-- the target file descriptor, fd.
--
-- When successful, epoll_ctl() returns zero. When an error occurs,
-- epoll_ctl() returns -1 and errno is set appropriately.
function C_Epoll_Wait
(Epoll_Fd : Interfaces.C. int;
Events : access Epoll_Event_Array;
Max_Events : Interfaces.C.int;
Timeout : Interfaces.C.int) return Interfaces.C.int with
Import => True,
Convention => C,
External_Name => "epoll_wait";
-- The epoll_wait() system call waits for events on the epoll(7)
-- instance referred to by the file descriptor epfd. The memory area
-- pointed to by events will contain the events that will be available
-- for the caller. Up to maxevents are returned by epoll_wait(). The
-- maxevents argument must be greater than zero.
--
-- The timeout argument specifies the number of milliseconds that
-- epoll_wait() will block. Time is measured against the
-- CLOCK_MONOTONIC clock. The call will block until either:
--
-- * a file descriptor delivers an event;
-- * the call is interrupted by a signal handler; or
-- * the timeout expires.
--
-- Note that the timeout interval will be rounded up to the system clock
-- granularity, and kernel scheduling delays mean that the blocking
-- interval may overrun by a small amount. Specifying a timeout of -1
-- causes epoll_wait() to block indefinitely, while specifying a timeout
-- equal to zero cause epoll_wait() to return immediately, even if no
-- events are available.
--
-- When successful, epoll_wait() returns the number of file descriptors
-- ready for the requested I/O, or zero if no file descriptor became
-- ready during the requested timeout milliseconds. When an error
-- occurs, epoll_wait() returns -1 and errno is set appropriately.
function Is_Epoll_Error
(Event_Flags : Interfaces.C.unsigned) return Boolean;
function Has_Hang_Up_Happened
(Event_Flags : Interfaces.C.unsigned) return Boolean;
function Is_Data_Available_For_Reading
(Event_Flags : Interfaces.C.unsigned) return Boolean;
end C_Binding.Linux.Event_Polls;
|
RREE/build-avr-ada-toolchain | Ada | 5,142 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S T O R A G E _ E L E M E N T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2007, 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. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
package body System.Storage_Elements is
pragma Suppress (All_Checks);
function To_Address is
new Ada.Unchecked_Conversion (Storage_Offset, Address);
function To_Offset is
new Ada.Unchecked_Conversion (Address, Storage_Offset);
-- Conversion to/from integers
-- These functions must be place first because they are inlined_always
-- and are used and inlined in other subprograms defined in this unit.
----------------
-- To_Address --
----------------
function To_Address (Value : Integer_Address) return Address is
begin
return Address (Value);
end To_Address;
----------------
-- To_Integer --
----------------
function To_Integer (Value : Address) return Integer_Address is
begin
return Integer_Address (Value);
end To_Integer;
-- Address arithmetic
---------
-- "+" --
---------
function "+" (Left : Address; Right : Storage_Offset) return Address is
begin
return Storage_Elements.To_Address
(To_Integer (Left) + To_Integer (To_Address (Right)));
end "+";
function "+" (Left : Storage_Offset; Right : Address) return Address is
begin
return Storage_Elements.To_Address
(To_Integer (To_Address (Left)) + To_Integer (Right));
end "+";
---------
-- "-" --
---------
function "-" (Left : Address; Right : Storage_Offset) return Address is
begin
return Storage_Elements.To_Address
(To_Integer (Left) - To_Integer (To_Address (Right)));
end "-";
function "-" (Left, Right : Address) return Storage_Offset is
begin
return To_Offset (Storage_Elements.To_Address
(To_Integer (Left) - To_Integer (Right)));
end "-";
-----------
-- "mod" --
-----------
function "mod"
(Left : Address;
Right : Storage_Offset) return Storage_Offset
is
begin
if Right > 0 then
return Storage_Offset
(To_Integer (Left) mod Integer_Address (Right));
-- The negative case makes no sense since it is a case of a mod where
-- the left argument is unsigned and the right argument is signed. In
-- accordance with the (spirit of the) permission of RM 13.7.1(16),
-- we raise CE, and also include the zero case here. Yes, the RM says
-- PE, but this really is so obviously more like a constraint error.
else
-- raise Constraint_Error;
return -Storage_Offset (Address'(Left mod Address (-Right)));
end if;
end "mod";
end System.Storage_Elements;
|
reznikmm/matreshka | Ada | 6,934 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- 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 League.Holders;
package AMF.UML.Holders is
pragma Preelaborate;
-- AggregationKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Aggregation_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Aggregation_Kind)
return League.Holders.Holder;
-- CallConcurrencyKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Call_Concurrency_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Call_Concurrency_Kind)
return League.Holders.Holder;
-- ConnectorKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Connector_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Connector_Kind)
return League.Holders.Holder;
-- ExpansionKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Expansion_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Expansion_Kind)
return League.Holders.Holder;
-- InteractionOperatorKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Interaction_Operator_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Interaction_Operator_Kind)
return League.Holders.Holder;
-- MessageKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Message_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Message_Kind)
return League.Holders.Holder;
-- MessageSort [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Message_Sort;
function To_Holder
(Element : AMF.UML.Optional_UML_Message_Sort)
return League.Holders.Holder;
-- ObjectNodeOrderingKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Object_Node_Ordering_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Object_Node_Ordering_Kind)
return League.Holders.Holder;
-- ParameterDirectionKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Parameter_Direction_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Parameter_Direction_Kind)
return League.Holders.Holder;
-- ParameterEffectKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Parameter_Effect_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Parameter_Effect_Kind)
return League.Holders.Holder;
-- PseudostateKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Pseudostate_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Pseudostate_Kind)
return League.Holders.Holder;
-- TransitionKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Transition_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Transition_Kind)
return League.Holders.Holder;
-- VisibilityKind [0..1]
function Element
(Holder : League.Holders.Holder)
return AMF.UML.Optional_UML_Visibility_Kind;
function To_Holder
(Element : AMF.UML.Optional_UML_Visibility_Kind)
return League.Holders.Holder;
end AMF.UML.Holders;
|
reznikmm/matreshka | Ada | 3,642 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- 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.Elements.Generic_Hash;
function AMF.OCL.Collection_Literal_Exps.Hash is
new AMF.Elements.Generic_Hash (OCL_Collection_Literal_Exp, OCL_Collection_Literal_Exp_Access);
|
qeedquan/challenges | Ada | 1,870 | adb | --{
-- A good resolution for 2015 is to live more sustainably. We'll start by recycling. Recycling code, that is!
-- Your task is to print the number 2015 to STDOUT, with or without trailing newline (and only that). However, you have to do so by recycling some old code from PPCG. Here is how that works:
-- Pick any answer posted on CodeGolf.SE before 2014-12-16 00:00:00Z (the day I posted this in the sandbox). Exception: You may not use any answers from last year's New Year's challenge.
-- Choose one code block from that answer (not an inline code snippet, it has to be a on its own paragraph). This block must be advertised as actual code, e.g. you cannot use test cases or example output which happen to use monospace formatting.
-- Rearrange the characters in that code block to form your submission for this challenge. You may only change the order, not add or remove any characters. This includes newlines.
-- You must be able to show that the original source block is syntactically valid in your language.
-- In the best case you can do this by showing that it runs without compile-time or run-time errors.
-- So while the original code may have been Java, you could use it for a Whitespace answer (as every file is valid in Whitespace), but probably can't use it for a Python answer (as the original won't be valid Python syntax).
-- Note that your answer must ignore all input and external state (including the actual current date). It may read from STDIN, say, as long as it doesn't crash if it's empty, and produces the same output for all possible contents of the stream.
--
-- Your resulting code has to be a full program (not a function, nor a snippet which assumes a REPL environment).
--
-- This is code golf, so the shortest answer (in bytes) wins.
--
--}
with Ada.Text_IO;
use Ada.Text_IO;
procedure Main is
begin
Put_Line("2015");
end Main;
|
io7m/coreland-getopt-ada | Ada | 204 | adb | with Getopt;
procedure noarg1 is
char : Integer;
begin
char := Getopt.Process ("");
if char /= Getopt.Option_EOF then
raise Program_Error with "expected EOF from Getopt";
end if;
end noarg1;
|
usnistgov/rcslib | Ada | 46,074 | adb | -- with Ada.Text_IO;
-- with Ada.Integer_Text_IO;
with Ada.Finalization;
use Ada.Finalization;
with Unchecked_Deallocation;
with Unchecked_Conversion;
package body Cms is
pragma Linker_Options("-lrcs");
function Cms_Check_Type_Info (Ca : in Cms_Access;
Nml_Type : in Long;
Message : in Limited_Controlled_Access;
NameSpace : in Interfaces.C.Char_Array;
Slc : in Symbol_Lookup_Callback;
NameList : in Interfaces.C.Char_Array;
IdList : in Long_Array;
SizeList : in Size_T_Array;
List_Length : in Long;
Max_Name_Length: in Long) return Long;
pragma Import(C,Cms_Check_Type_Info);
function Check_Type_Info (Ca : in Cms_Access;
Nml_Type : in Long;
Message : in Limited_Controlled_Access;
NameSpace : in String;
Slc : in Symbol_Lookup_Callback;
NameList : in Interfaces.C.Char_Array;
IdList : in Long_Array;
SizeList : in Size_T_Array;
List_Length : in Long;
Max_Name_Length: in Long) return Long is
Rv : Interfaces.C.Long;
begin
Rv := Cms_Check_Type_Info(Ca,Nml_Type,Message,To_C(NameSpace),Slc,NameList,IdList,SizeList,List_Length,Max_Name_Length);
return Rv;
end Check_Type_Info;
-- Chars_Ptr already defined in Interfaces.C.Strings;
type Ints_Ptr is access all Interfaces.C.Int;
type Longs_Ptr is access all Interfaces.C.Long;
type Shorts_Ptr is access all Interfaces.C.Short;
type Unsigneds_Ptr is access all Interfaces.C.Unsigned;
type Unsigned_Longs_Ptr is access all Interfaces.C.Unsigned_Long;
type Unsigned_Shorts_Ptr is access all Interfaces.C.Unsigned_Short;
type Unsigned_Chars_Ptr is access all Interfaces.C.Unsigned_Char;
type C_Floats_Ptr is access all Interfaces.C.C_float;
type Doubles_Ptr is access all Interfaces.C.double;
type Booleans_Ptr is access all Interfaces.C.Signed_Char;
type Signed_Chars_Ptr is access all Interfaces.C.Signed_Char;
procedure Free is new Unchecked_Deallocation(Interfaces.C.Int, Ints_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Long, Longs_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Short, Shorts_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Unsigned, Unsigneds_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Unsigned_Long, Unsigned_Longs_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Unsigned_Short, Unsigned_Shorts_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Unsigned_Char, Unsigned_Chars_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.C_Float, C_Floats_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Double, Doubles_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Signed_Char, Booleans_Ptr);
procedure Free is new Unchecked_Deallocation(Interfaces.C.Signed_Char, Signed_Chars_Ptr);
procedure Cms_Update_Dla_Length(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Ints_Ptr);
pragma Import(C,Cms_Update_Dla_Length);
procedure Update_Dla_Length(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Int) is
Xptr : Ints_Ptr;
begin
Xptr := new Interfaces.C.Int;
Xptr.all := X;
-- Ada.Text_IO.Put("CmsUpdateInt X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Dla_Length(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateInt X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Free(Xptr);
end Update_Dla_Length;
-- Begin Int
procedure Cms_Update_Int(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Ints_Ptr);
pragma Import(C,Cms_Update_Int);
procedure Update_Int(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Int) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Ints_Ptr;
begin
Xptr := new Interfaces.C.Int;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateInt X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Int(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateInt X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Int;
procedure Cms_Update_Int_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Int_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Int_Array);
procedure Update_Int_Array(Ca : in Cms_Access; Name : in String; X : in out Int_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Int_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Int_Array;
procedure Cms_Update_Int_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Int_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Int_Dla);
procedure Update_Int_Dla(Ca : in Cms_Access; Name : in String; X : in out Int_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateIntDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Int_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateIntDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Int_Dla;
-- End int
-- Begin long
procedure Cms_Update_Long(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Longs_Ptr);
pragma Import(C,Cms_Update_Long);
procedure Update_Long(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Long) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Longs_Ptr;
begin
Xptr := new Interfaces.C.Long;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateLong X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Long(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateLong X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Long;
procedure Cms_Update_Long_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Long_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Long_Array);
procedure Update_Long_Array(Ca : in Cms_Access; Name : in String; X : in out Long_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Long_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Long_Array;
procedure Cms_Update_Long_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Long_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Long_Dla);
procedure Update_Long_Dla(Ca : in Cms_Access; Name : in String; X : in out Long_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateLongDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Long_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateLongDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Long_Dla;
-- End long
-- Begin short
procedure Cms_Update_Short(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Shorts_Ptr);
pragma Import(C,Cms_Update_Short);
procedure Update_Short(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Short) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Shorts_Ptr;
begin
Xptr := new Interfaces.C.Short;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateShort X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Short(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateShort X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Short;
procedure Cms_Update_Short_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Short_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Short_Array);
procedure Update_Short_Array(Ca : in Cms_Access; Name : in String; X : in out Short_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Short_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Short_Array;
procedure Cms_Update_Short_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Short_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Short_Dla);
procedure Update_Short_Dla(Ca : in Cms_Access; Name : in String; X : in out Short_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateShortDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Short_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateShortDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Short_Dla;
-- End short
-- Begin char
procedure Cms_Update_Char(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Signed_Chars_Ptr);
pragma Import(C,Cms_Update_Char);
function Char_To_Signed_Char is new Unchecked_Conversion(Interfaces.C.Char, Interfaces.C.Signed_Char);
function Signed_Char_To_Char is new Unchecked_Conversion(Interfaces.C.Signed_Char, Interfaces.C.Char);
procedure Update_Char(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Char) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Signed_Chars_Ptr;
Xa : Interfaces.C.Strings.Char_Array_Access := new Interfaces.C.Char_Array(1..2);
begin
Xptr := new Interfaces.C.Signed_Char;
Xptr.all := Char_To_Signed_Char(X);
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateChar X=");
-- Ada.Text_IO.Put(Character(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Char(Ca,To_C(Name),Xptr);
X := Signed_Char_To_Char(Xptr.all);
-- Ada.Text_IO.Put("CmsUpdateChar X=");
-- Ada.Text_IO.Put(Character(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Char;
procedure Cms_Update_Char_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Char_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Char_Array);
procedure Update_Char_Array(Ca : in Cms_Access; Name : in String; X : in out Char_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Char_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Char_Array;
procedure Cms_Update_Char_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Char_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Char_Dla);
procedure Update_Char_Dla(Ca : in Cms_Access; Name : in String; X : in out Char_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateCharDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Char_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateCharDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Char_Dla;
-- End char
-- Begin unsigned
procedure Cms_Update_Unsigned_Int(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Unsigneds_Ptr);
pragma Import(C,Cms_Update_Unsigned_Int);
procedure Update_Unsigned(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Unsigned) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Unsigneds_Ptr;
begin
Xptr := new Interfaces.C.Unsigned;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateUnsigned X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Unsigned_Int(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateUnsigned X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Unsigned;
procedure Cms_Update_Unsigned_Int_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Unsigned_Int_Array);
procedure Update_Unsigned_Array(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Int_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Array;
procedure Cms_Update_Unsigned_Int_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Unsigned_Int_Dla);
procedure Update_Unsigned_Dla(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateUnsignedDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Int_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateUnsignedDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Dla;
-- End unsigned
-- Begin unsigned_long
procedure Cms_Update_Unsigned_Long(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Unsigned_Longs_Ptr);
pragma Import(C,Cms_Update_Unsigned_Long);
procedure Update_Unsigned_Long(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Unsigned_Long) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Unsigned_Longs_Ptr;
begin
Xptr := new Interfaces.C.Unsigned_Long;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateUnsigned_Long X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Unsigned_Long(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateUnsigned_Long X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Unsigned_Long;
procedure Cms_Update_Unsigned_Long_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Long_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Unsigned_Long_Array);
procedure Update_Unsigned_Long_Array(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Long_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Long_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Long_Array;
procedure Cms_Update_Unsigned_Long_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Long_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Unsigned_Long_Dla);
procedure Update_Unsigned_Long_Dla(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Long_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateUnsigned_LongDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Long_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateUnsigned_LongDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Long_Dla;
-- End unsigned_long
-- Begin unsigned_short
procedure Cms_Update_Unsigned_Short(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Unsigned_Shorts_Ptr);
pragma Import(C,Cms_Update_Unsigned_Short);
procedure Update_Unsigned_Short(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Unsigned_Short) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Unsigned_Shorts_Ptr;
begin
Xptr := new Interfaces.C.Unsigned_Short;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateUnsigned_Short X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Unsigned_Short(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateUnsigned_Short X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Unsigned_Short;
procedure Cms_Update_Unsigned_Short_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Short_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Unsigned_Short_Array);
procedure Update_Unsigned_Short_Array(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Short_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Short_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Short_Array;
procedure Cms_Update_Unsigned_Short_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Short_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Unsigned_Short_Dla);
procedure Update_Unsigned_Short_Dla(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Short_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateUnsigned_ShortDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Short_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateUnsigned_ShortDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Short_Dla;
-- End unsigned_short
-- Begin unsigned_char
procedure Cms_Update_Unsigned_Char(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Unsigned_Chars_Ptr);
pragma Import(C,Cms_Update_Unsigned_Char);
procedure Update_Unsigned_Char(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Unsigned_Char) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Unsigned_Chars_Ptr;
begin
Xptr := new Interfaces.C.Unsigned_Char;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateUnsigned_Char X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Unsigned_Char(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateUnsigned_Char X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Unsigned_Char;
procedure Cms_Update_Unsigned_Char_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Char_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Unsigned_Char_Array);
procedure Update_Unsigned_Char_Array(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Char_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Char_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Char_Array;
procedure Cms_Update_Unsigned_Char_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Unsigned_Char_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Unsigned_Char_Dla);
procedure Update_Unsigned_Char_Dla(Ca : in Cms_Access; Name : in String; X : in out Unsigned_Char_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateUnsigned_CharDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Unsigned_Char_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateUnsigned_CharDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Unsigned_Char_Dla;
-- End unsigned_char
-- Begin c_float
procedure Cms_Update_Float(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in C_Floats_Ptr);
pragma Import(C,Cms_Update_Float);
procedure Update_C_Float(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.C_Float) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : C_Floats_Ptr;
begin
Xptr := new Interfaces.C.C_Float;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateC_Float X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Float(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateC_Float X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_C_Float;
procedure Cms_Update_Float_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out C_Float_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Float_Array);
procedure Update_C_Float_Array(Ca : in Cms_Access; Name : in String; X : in out C_Float_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Float_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_C_Float_Array;
procedure Cms_Update_Float_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out C_Float_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Float_Dla);
procedure Update_C_Float_Dla(Ca : in Cms_Access; Name : in String; X : in out C_Float_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateC_FloatDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Float_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateC_FloatDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_C_Float_Dla;
-- End c_float
-- Begin double
procedure Cms_Update_Double(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Doubles_Ptr);
pragma Import(C,Cms_Update_Double);
procedure Update_Double(Ca : in Cms_Access; Name : in String; X : in out Interfaces.C.Double) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Doubles_Ptr;
begin
Xptr := new Interfaces.C.Double;
Xptr.all := X;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateDouble X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Double(Ca,To_C(Name),Xptr);
X := Xptr.all;
-- Ada.Text_IO.Put("CmsUpdateDouble X=");
-- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Double;
procedure Cms_Update_Double_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Double_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Double_Array);
procedure Update_Double_Array(Ca : in Cms_Access; Name : in String; X : in out Double_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
begin
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Double_Array(Ca,To_C(Name),X,Len);
-- Interfaces.C.Strings.Free(Nc)
end Update_Double_Array;
procedure Cms_Update_Double_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Double_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
pragma Import (C,Cms_Update_Double_Dla);
procedure Update_Double_Dla(Ca : in Cms_Access; Name : in String; X : in out Double_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
LENptr : Ints_Ptr;
begin
LENptr := new Interfaces.C.Int;
LENptr.all := Len;
-- Ada.Text_IO.Put("CmsUpdateDoubleDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Double_Dla(Ca,To_C(Name),X,Lenptr,Maxlen);
Len := LENptr.all;
Free(LENptr);
-- Ada.Text_IO.Put("CmsUpdateDoubleDla Len=");
-- Ada.Integer_Text_IO.Put(Integer(Len));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
end Update_Double_Dla;
-- End double
-- Begin boolean
procedure Cms_Update_Bool(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in Booleans_Ptr);
pragma Import(C,Cms_Update_Bool);
procedure Update_Boolean(Ca : in Cms_Access; Name : in String; X : in out Boolean) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Booleans_Ptr;
begin
Xptr := new Interfaces.C.Signed_Char;
if True /= X then
Xptr.all := 0;
else
Xptr.all := 1;
end if;
-- Nc := Interfaces.C.Strings.New_String(Name);
-- Ada.Text_IO.Put("CmsUpdateBoolean X=");
---- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
Cms_Update_Bool(Ca,To_C(Name),Xptr);
if 0 /= Xptr.all then
X := True;
else
X := False;
end if;
-- Ada.Text_IO.Put("CmsUpdateBoolean X=");
---- Ada.Integer_Text_IO.Put(Integer(X));
-- Ada.Text_IO.New_Line;
-- Interfaces.C.Strings.Free(Nc)
Free(Xptr);
end Update_Boolean;
procedure Cms_Update_Bool_Array(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Signed_Char_Array; Len : in Interfaces.C.Unsigned );
pragma Import (C,Cms_Update_Bool_Array);
procedure Update_Boolean_Array(Ca : in Cms_Access; Name : in String; X : in out Boolean_Array; Len : in Interfaces.C.Unsigned ) is
-- Nc : Interfaces.C.Strings.Chars_Ptr;
Xptr : Signed_Char_Array(X'Range);
begin
for I in X'Range
loop
if True /= X(I) then
Xptr(I) := 0;
else
Xptr(I) := 1;
end if;
end loop;
-- Nc := Interfaces.C.Strings.New_String(Name);
Cms_Update_Bool_Array(Ca,To_C(Name),Xptr,Len);
for I in X'Range
loop
if 0 /= Xptr(I) then
X(I) := True;
else
X(I) := False;
end if;
end loop;
-- Interfaces.C.Strings.Free(Nc)
end Update_Boolean_Array;
-- C++ and C versions also missing equivalent of cms_update_bool_dla.
-- procedure Cms_Update_Bool_Dla(Ca : in Cms_Access; Name : in Interfaces.C.Char_Array; X : in out Signed_Char_Array; Len : Ints_Ptr; MaxLen : in Interfaces.C.Int );
-- pragma Import (C,Cms_Update_Bool_Dla);
--
-- procedure CmsUpdateBooleanDla(Ca : in Cms_Access; Name : in String; X : in out Boolean_Array; Len : in out Interfaces.C.Int; Maxlen : in Interfaces.C.Int ) is
-- -- Nc : Interfaces.C.Strings.Chars_Ptr;
-- LENptr : Ints_Ptr;
-- Xptr : Signed_Char_Array(X'Range);
-- begin
-- for I in X'Range
-- loop
-- if True /= X(I) then
-- Xptr(I) := 0;
-- else
-- Xptr(I) := 1;
-- end if;
-- end loop;
-- LENptr := new Interfaces.C.Int;
-- LENptr.all := Len;
-- -- Ada.Text_IO.Put("CmsUpdateBooleanDla Len=");
-- -- Ada.Integer_Text_IO.Put(Integer(Len));
-- -- Ada.Text_IO.New_Line;
-- -- Nc := Interfaces.C.Strings.New_String(Name);
-- Cms_Update_Boolean_Dla(Ca,To_C(Name),Xptr,Lenptr,Maxlen);
-- Len := LENptr.all;
-- Free(LENptr);
-- -- Ada.Text_IO.Put("CmsUpdateBooleanDla Len=");
-- -- Ada.Integer_Text_IO.Put(Integer(Len));
-- -- Ada.Text_IO.New_Line;
-- for I in X'Range
-- loop
-- if 0 /= Xptr(I) then
-- X(I) := True;
-- else
-- X(I) := False;
-- end if;
-- end loop;
-- -- Interfaces.C.Strings.Free(Nc)
-- end CmsUpdateBooleanDla;
-- End boolean
function Return_Symbol(Ca : Char_Array) return Interfaces.C.Strings.Chars_Ptr is
Rv: Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_Char_Array(Ca);
--S : String := Interfaces.C.Strings.Value(Rv);
begin
return Rv;
end Return_Symbol;
procedure Cms_Begin_Class(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr; Parent : Interfaces.C.Strings.Chars_Ptr);
pragma Import(C,Cms_Begin_Class);
procedure Begin_Class(Ca : in Cms_Access; Name : in String; Parent : in String) is
Np : Interfaces.C.Strings.Chars_Ptr;
Pp : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Pp := Interfaces.C.Strings.New_String(Parent);
Cms_Begin_Class(Ca,Np,Pp);
Interfaces.C.Strings.Free(Np);
Interfaces.C.Strings.Free(Pp);
end Begin_Class;
procedure Cms_End_Class(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr; Parent : Interfaces.C.Strings.Chars_Ptr);
pragma Import(C,Cms_End_Class);
procedure End_Class(Ca : in Cms_Access; Name : in String; Parent : in String) is
Np : Interfaces.C.Strings.Chars_Ptr;
Pp : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Pp := Interfaces.C.Strings.New_String(Parent);
Cms_End_Class(Ca,Np,Pp);
Interfaces.C.Strings.Free(Np);
Interfaces.C.Strings.Free(Pp);
end End_Class;
procedure Cms_Begin_Base_Class(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr);
pragma Import(C,Cms_Begin_Base_Class);
procedure Begin_Base_Class(Ca : in Cms_Access; Name : in String) is
Np : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Cms_Begin_Base_Class(Ca,Np);
Interfaces.C.Strings.Free(Np);
end Begin_Base_Class;
procedure Cms_End_Base_Class(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr);
pragma Import(C,Cms_End_Base_Class);
procedure End_Base_Class(Ca : in Cms_Access; Name : in String) is
Np : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Cms_End_Base_Class(Ca,Np);
Interfaces.C.Strings.Free(Np);
end End_Base_Class;
procedure Cms_Begin_Class_Var(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr);
pragma Import(C,Cms_Begin_Class_Var);
procedure Begin_Class_Var(Ca : in Cms_Access; Name : in String) is
Np : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Cms_Begin_Class_Var(Ca,Np);
Interfaces.C.Strings.Free(Np);
end Begin_Class_Var;
procedure Cms_End_Class_Var(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr);
pragma Import(C,Cms_End_Class_Var);
procedure End_Class_Var(Ca : in Cms_Access; Name : in String) is
Np : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Cms_End_Class_Var(Ca,Np);
Interfaces.C.Strings.Free(Np);
end End_Class_Var;
procedure Cms_Begin_Struct_Array_Elem(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr; Index :Interfaces.C.Int);
pragma Import(C,Cms_Begin_Struct_Array_Elem);
procedure Begin_Struct_Array_Elem(Ca : in Cms_Access; Name : in String; Index :Interfaces.C.Int) is
Np : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Cms_Begin_Struct_Array_Elem(Ca,Np,Index);
Interfaces.C.Strings.Free(Np);
end Begin_Struct_Array_Elem;
procedure Cms_End_Struct_Array_Elem(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr; Index :Interfaces.C.Int);
pragma Import(C,Cms_End_Struct_Array_Elem);
procedure End_Struct_Array_Elem(Ca : in Cms_Access; Name : in String; Index :Interfaces.C.Int) is
Np : Interfaces.C.Strings.Chars_Ptr;
begin
Np := Interfaces.C.Strings.New_String(Name);
Cms_End_Struct_Array_Elem(Ca,Np,Index);
Interfaces.C.Strings.Free(Np);
end End_Struct_Array_Elem;
procedure Cms_Begin_Struct_Dynamic_Array(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr; Len : Ints_Ptr;
Maxlen :Interfaces.C.Int);
pragma Import(C,Cms_Begin_Struct_Dynamic_Array);
procedure Begin_Struct_Dynamic_Array(Ca : in Cms_Access; Name : in String; Len : in out Interfaces.C.Int;
Maxlen : Interfaces.C.Int) is
Np : Interfaces.C.Strings.Chars_Ptr;
LenPtr : Ints_Ptr;
begin
LenPtr := new Interfaces.C.Int;
LenPtr.all := Len;
Np := Interfaces.C.Strings.New_String(Name);
Cms_Begin_Struct_Dynamic_Array(Ca,Np,LenPtr,Maxlen);
Len := LenPtr.all;
Free(LenPtr);
Interfaces.C.Strings.Free(Np);
end Begin_Struct_Dynamic_Array;
procedure Cms_End_Struct_Dynamic_Array(Ca : in Cms_Access; Name : Interfaces.C.Strings.Chars_Ptr; Len : Ints_Ptr;
Maxlen : Interfaces.C.Int);
pragma Import(C,Cms_End_Struct_Dynamic_Array);
procedure End_Struct_Dynamic_Array(Ca : in Cms_Access; Name : in String; Len : in out Interfaces.C.Int;
Maxlen : Interfaces.C.Int) is
Np : Interfaces.C.Strings.Chars_Ptr;
LenPtr : Ints_Ptr;
begin
LenPtr := new Interfaces.C.Int;
LenPtr.all := Len;
Np := Interfaces.C.Strings.New_String(Name);
Cms_End_Struct_Dynamic_Array(Ca,Np,LenPtr,Maxlen);
Len := LenPtr.all;
Free(LenPtr);
Interfaces.C.Strings.Free(Np);
end End_Struct_Dynamic_Array;
function Cms_Create_Cms_Enum_Info(NamePtr : in Interfaces.C.Strings.Chars_Ptr;
NameList : in Char_Array;
IntListPtr : in Int_Array;
MaxNameLen : in Int ;
ListLen : in Int;
Symbol_Lookup : in Symbol_Lookup_Callback
) return Cms_Enum_Info_C_Access;
pragma Import(C,Cms_Create_Cms_Enum_Info);
function New_Cms_Enum_Info(Name : in String;
NameList : in Char_Array;
IntList : in Int_Array;
MaxNameLen : in Int ;
ListLen : in Int;
Symbol_Lookup : in Symbol_Lookup_Callback)
return Cms_Enum_Info_Access is
NamePtr : Interfaces.C.Strings.Chars_Ptr;
--NameListPtr : Interfaces.C.Strings.Chars_Ptr;
Ceia : Cms_Enum_Info_Access := new Cms_Enum_Info;
begin
NamePtr := Interfaces.C.Strings.New_String(Name);
--NameListPtr := Interfaces.C.Strings.To_Chars_Ptr(NameList);
Ceia.Info := Cms_Create_Cms_Enum_Info(NamePtr,NameList, IntList,MaxNameLen,ListLen,Symbol_Lookup);
return Ceia;
end New_Cms_Enum_Info;
function Cms_Update_Enumeration(Ca : in Cms_Access;
Name : in Interfaces.C.Char_Array;
X : in Interfaces.C.Int;
Xaddr : in Ints_Ptr;
Info : in Cms_Enum_Info_C_Access) return Int;
pragma Import(C,Cms_Update_Enumeration);
function Update_Enumeration(Ca : in Cms_Access;
Name : in String;
X : in Interfaces.C.Int;
Info : in Cms_Enum_Info_Access) return Int is
Xptr : Ints_Ptr;
-- NamePtr : Interfaces.C.Strings.Chars_Ptr;
Rv : Int;
begin
Xptr := new Interfaces.C.Int;
Xptr.all := X;
-- NamePtr := Interfaces.C.Strings.New_String(Name);
Rv := Cms_Update_Enumeration(Ca,To_C(Name),Xptr.all,Xptr,Info.Info);
Free(Xptr);
-- Interfaces.C.Strings.Free(NamePtr);
return Rv;
end Update_Enumeration;
procedure Cms_Begin_Enumeration_Array (Ca : in Cms_Access;
Name : in Interfaces.C.Char_Array;
Info : in Cms_Enum_Info_C_Access;
Len : in Interfaces.C.Unsigned);
pragma Import(C,Cms_Begin_Enumeration_Array);
-- EnumArrayNamePtr: Interfaces.C.Strings.Chars_Ptr := Null_Ptr;
procedure Begin_Enumeration_Array (Ca : in Cms_Access;
Name : in String;
Info : in Cms_Enum_Info_Access;
Len : in Interfaces.C.Unsigned) is
begin
-- if EnumArrayNamePtr /= Null_Ptr then
-- Interfaces.C.Strings.Free(EnumArrayNamePtr);
-- EnumArrayNamePtr := Null_Ptr;
-- end if;
-- EnumArrayNamePtr :=Interfaces.C.Strings.New_String(Name);
Cms_Begin_Enumeration_Array(Ca,To_C(Name),Info.Info,Len);
-- Interfaces.C.Strings.Free(NamePtr);
end Begin_Enumeration_Array;
procedure Cms_Begin_Enumeration_DLA (Ca : in Cms_Access;
Name : in Interfaces.C.Char_Array;
Info : in Cms_Enum_Info_C_Access;
Len : in Ints_Ptr;
MaxLen : in Interfaces.C.Int);
pragma Import(C,Cms_Begin_Enumeration_Dla);
procedure Begin_Enumeration_Dla(Ca : in Cms_Access;
Name : in String;
Info : in Cms_Enum_Info_Access;
Len : in out Interfaces.C.Int;
MaxLen : in Interfaces.C.Int) is
LenPtr : Ints_Ptr;
begin
-- if EnumArrayNamePtr /= Null_Ptr then
-- Interfaces.C.Strings.Free(EnumArrayNamePtr);
-- EnumArrayNamePtr := Null_Ptr;
-- end if;
-- EnumArrayNamePtr :=Interfaces.C.Strings.New_String(Name);
LenPtr := new Interfaces.C.Int;
LenPtr.all := Len;
Cms_Begin_Enumeration_Dla(Ca,To_C(Name),Info.Info,LenPtr,MaxLen);
--Interfaces.C.Strings.Free(NamePtr);
Free(LenPtr);
end Begin_Enumeration_Dla;
function Cms_Update_Enumeration_Array_Elem(Ca : in Cms_Access;
X : in Interfaces.C.Int;
Xptr : in Ints_Ptr;
Elem : in Interfaces.C.Int) return Int;
pragma Import(C,Cms_Update_Enumeration_Array_Elem);
function Update_Enumeration_Array_Elem(Ca : in Cms_Access;
Name : in String;
X : in Interfaces.C.Int;
Elem : in Interfaces.C.Int) return Int is
Xptr : Ints_Ptr;
Rv : Int;
begin
Xptr := new Interfaces.C.Int;
Xptr.all := X;
Rv := Cms_Update_Enumeration_Array_Elem(Ca,X,Xptr,Elem);
Free(Xptr);
return Rv;
end Update_Enumeration_Array_Elem;
procedure Cms_End_Enumeration_Array (Ca : in Cms_Access;
Name : in Interfaces.C.Char_Array;
Info : in Cms_Enum_Info_C_Access;
Len : in Interfaces.C.Unsigned);
pragma Import(C,Cms_End_Enumeration_Array);
procedure End_Enumeration_Array (Ca : in Cms_Access;
Name : in String;
Info : in Cms_Enum_Info_Access;
Len : in Interfaces.C.Unsigned) is
--NamePtr: Interfaces.C.Strings.Chars_Ptr;
begin
--NamePtr :=Interfaces.C.Strings.New_String(Name);
Cms_End_Enumeration_Array(Ca,To_C(Name),Info.Info,Len);
--Interfaces.C.Strings.Free(NamePtr);
--if EnumArrayNamePtr /= Null_Ptr then
-- Interfaces.C.Strings.Free(EnumArrayNamePtr);
-- EnumArrayNamePtr := Null_Ptr;
--end if;
end End_Enumeration_Array;
procedure Cms_End_Enumeration_DLA (Ca : in Cms_Access;
Name : in Interfaces.C.Char_Array;
Info : in Cms_Enum_Info_C_Access;
Len : in Ints_Ptr;
MaxLen : in Interfaces.C.Int);
pragma Import(C,Cms_End_Enumeration_Dla);
procedure End_Enumeration_DLA (Ca : in Cms_Access;
Name : in String;
Info : in Cms_Enum_Info_Access;
Len : in out Interfaces.C.Int;
MaxLen : in Interfaces.C.Int) is
--NamePtr: Interfaces.C.Strings.Chars_Ptr;
LenPtr : Ints_Ptr;
begin
--NamePtr :=Interfaces.C.Strings.New_String(Name);
LenPtr := new Interfaces.C.Int;
LenPtr.all := Len;
Cms_End_Enumeration_Dla(Ca,To_C(Name),Info.Info,LenPtr,MaxLen);
--Interfaces.C.Strings.Free(NamePtr);
Free(LenPtr);
--if EnumArrayNamePtr /= Null_Ptr then
-- Interfaces.C.Strings.Free(EnumArrayNamePtr);
-- EnumArrayNamePtr := Null_Ptr;
--end if;
end End_Enumeration_Dla;
end Cms;
|
AdaCore/training_material | Ada | 806 | ads | with Radar_Internals;
package Devices.Radars is
type Event_T is record
Object : Radar_Internals.Object_Type_T;
Status : Radar_Internals.Object_Status_T;
end record;
protected Radar is
entry Wait_Event (Event : out Event_T);
procedure Ping (Object : Radar_Internals.Object_Type_T);
procedure Mark (Object : Radar_Internals.Object_Type_T);
procedure Lost (Object : Radar_Internals.Object_Type_T);
procedure Rotate;
function Angle return Radar_Internals.Angle_Degrees_T;
private
New_Event : Boolean := False;
Event : Event_T;
Rotation : Radar_Internals.Angle_Degrees_T;
end Radar;
task Radar_Detect is
end Radar_Detect;
task Radar_Rotate is
end Radar_Rotate;
end Devices.Radars;
|
AdaCore/Ada_Drivers_Library | Ada | 77,912 | ads | -- This spec has been automatically generated from STM32F46_79x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.TIM is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_CMS_Field is HAL.UInt2;
subtype CR1_CKD_Field is HAL.UInt2;
-- control register 1
type CR1_Register is record
-- Counter enable
CEN : Boolean := False;
-- Update disable
UDIS : Boolean := False;
-- Update request source
URS : Boolean := False;
-- One-pulse mode
OPM : Boolean := False;
-- Direction
DIR : Boolean := False;
-- Center-aligned mode selection
CMS : CR1_CMS_Field := 16#0#;
-- Auto-reload preload enable
ARPE : Boolean := False;
-- Clock division
CKD : CR1_CKD_Field := 16#0#;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
OPM at 0 range 3 .. 3;
DIR at 0 range 4 .. 4;
CMS at 0 range 5 .. 6;
ARPE at 0 range 7 .. 7;
CKD at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype CR2_MMS_Field is HAL.UInt3;
-- control register 2
type CR2_Register is record
-- Capture/compare preloaded control
CCPC : Boolean := False;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : Boolean := False;
-- Capture/compare DMA selection
CCDS : Boolean := False;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- TI1 selection
TI1S : Boolean := False;
-- Output Idle state 1
OIS1 : Boolean := False;
-- Output Idle state 1
OIS1N : Boolean := False;
-- Output Idle state 2
OIS2 : Boolean := False;
-- Output Idle state 2
OIS2N : Boolean := False;
-- Output Idle state 3
OIS3 : Boolean := False;
-- Output Idle state 3
OIS3N : Boolean := False;
-- Output Idle state 4
OIS4 : 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 CR2_Register use record
CCPC at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CCUS at 0 range 2 .. 2;
CCDS at 0 range 3 .. 3;
MMS at 0 range 4 .. 6;
TI1S at 0 range 7 .. 7;
OIS1 at 0 range 8 .. 8;
OIS1N at 0 range 9 .. 9;
OIS2 at 0 range 10 .. 10;
OIS2N at 0 range 11 .. 11;
OIS3 at 0 range 12 .. 12;
OIS3N at 0 range 13 .. 13;
OIS4 at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype SMCR_SMS_Field is HAL.UInt3;
subtype SMCR_TS_Field is HAL.UInt3;
subtype SMCR_ETF_Field is HAL.UInt4;
subtype SMCR_ETPS_Field is HAL.UInt2;
-- slave mode control register
type SMCR_Register is record
-- Slave mode selection
SMS : SMCR_SMS_Field := 16#0#;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- Trigger selection
TS : SMCR_TS_Field := 16#0#;
-- Master/Slave mode
MSM : Boolean := False;
-- External trigger filter
ETF : SMCR_ETF_Field := 16#0#;
-- External trigger prescaler
ETPS : SMCR_ETPS_Field := 16#0#;
-- External clock enable
ECE : Boolean := False;
-- External trigger polarity
ETP : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SMCR_Register use record
SMS at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TS at 0 range 4 .. 6;
MSM at 0 range 7 .. 7;
ETF at 0 range 8 .. 11;
ETPS at 0 range 12 .. 13;
ECE at 0 range 14 .. 14;
ETP at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register is record
-- Update interrupt enable
UIE : Boolean := False;
-- Capture/Compare 1 interrupt enable
CC1IE : Boolean := False;
-- Capture/Compare 2 interrupt enable
CC2IE : Boolean := False;
-- Capture/Compare 3 interrupt enable
CC3IE : Boolean := False;
-- Capture/Compare 4 interrupt enable
CC4IE : Boolean := False;
-- COM interrupt enable
COMIE : Boolean := False;
-- Trigger interrupt enable
TIE : Boolean := False;
-- Break interrupt enable
BIE : Boolean := False;
-- Update DMA request enable
UDE : Boolean := False;
-- Capture/Compare 1 DMA request enable
CC1DE : Boolean := False;
-- Capture/Compare 2 DMA request enable
CC2DE : Boolean := False;
-- Capture/Compare 3 DMA request enable
CC3DE : Boolean := False;
-- Capture/Compare 4 DMA request enable
CC4DE : Boolean := False;
-- COM DMA request enable
COMDE : Boolean := False;
-- Trigger DMA request enable
TDE : 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 DIER_Register use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
CC2IE at 0 range 2 .. 2;
CC3IE at 0 range 3 .. 3;
CC4IE at 0 range 4 .. 4;
COMIE at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
BIE at 0 range 7 .. 7;
UDE at 0 range 8 .. 8;
CC1DE at 0 range 9 .. 9;
CC2DE at 0 range 10 .. 10;
CC3DE at 0 range 11 .. 11;
CC4DE at 0 range 12 .. 12;
COMDE at 0 range 13 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register is record
-- Update interrupt flag
UIF : Boolean := False;
-- Capture/compare 1 interrupt flag
CC1IF : Boolean := False;
-- Capture/Compare 2 interrupt flag
CC2IF : Boolean := False;
-- Capture/Compare 3 interrupt flag
CC3IF : Boolean := False;
-- Capture/Compare 4 interrupt flag
CC4IF : Boolean := False;
-- COM interrupt flag
COMIF : Boolean := False;
-- Trigger interrupt flag
TIF : Boolean := False;
-- Break interrupt flag
BIF : Boolean := False;
-- unspecified
Reserved_8_8 : HAL.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : Boolean := False;
-- Capture/compare 2 overcapture flag
CC2OF : Boolean := False;
-- Capture/Compare 3 overcapture flag
CC3OF : Boolean := False;
-- Capture/Compare 4 overcapture flag
CC4OF : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
CC2IF at 0 range 2 .. 2;
CC3IF at 0 range 3 .. 3;
CC4IF at 0 range 4 .. 4;
COMIF at 0 range 5 .. 5;
TIF at 0 range 6 .. 6;
BIF at 0 range 7 .. 7;
Reserved_8_8 at 0 range 8 .. 8;
CC1OF at 0 range 9 .. 9;
CC2OF at 0 range 10 .. 10;
CC3OF at 0 range 11 .. 11;
CC4OF at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- event generation register
type EGR_Register is record
-- Write-only. Update generation
UG : Boolean := False;
-- Write-only. Capture/compare 1 generation
CC1G : Boolean := False;
-- Write-only. Capture/compare 2 generation
CC2G : Boolean := False;
-- Write-only. Capture/compare 3 generation
CC3G : Boolean := False;
-- Write-only. Capture/compare 4 generation
CC4G : Boolean := False;
-- Write-only. Capture/Compare control update generation
COMG : Boolean := False;
-- Write-only. Trigger generation
TG : Boolean := False;
-- Write-only. Break generation
BG : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
CC3G at 0 range 3 .. 3;
CC4G at 0 range 4 .. 4;
COMG at 0 range 5 .. 5;
TG at 0 range 6 .. 6;
BG at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CCMR1_Output_CC1S_Field is HAL.UInt2;
subtype CCMR1_Output_OC1M_Field is HAL.UInt3;
subtype CCMR1_Output_CC2S_Field is HAL.UInt2;
subtype CCMR1_Output_OC2M_Field is HAL.UInt3;
-- capture/compare mode register 1 (output mode)
type CCMR1_Output_Register is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Output_CC1S_Field := 16#0#;
-- Output Compare 1 fast enable
OC1FE : Boolean := False;
-- Output Compare 1 preload enable
OC1PE : Boolean := False;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- Output Compare 1 clear enable
OC1CE : Boolean := False;
-- Capture/Compare 2 selection
CC2S : CCMR1_Output_CC2S_Field := 16#0#;
-- Output Compare 2 fast enable
OC2FE : Boolean := False;
-- Output Compare 2 preload enable
OC2PE : Boolean := False;
-- Output Compare 2 mode
OC2M : CCMR1_Output_OC2M_Field := 16#0#;
-- Output Compare 2 clear enable
OC2CE : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Output_Register use record
CC1S at 0 range 0 .. 1;
OC1FE at 0 range 2 .. 2;
OC1PE at 0 range 3 .. 3;
OC1M at 0 range 4 .. 6;
OC1CE at 0 range 7 .. 7;
CC2S at 0 range 8 .. 9;
OC2FE at 0 range 10 .. 10;
OC2PE at 0 range 11 .. 11;
OC2M at 0 range 12 .. 14;
OC2CE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCMR1_Input_CC1S_Field is HAL.UInt2;
subtype CCMR1_Input_ICPCS_Field is HAL.UInt2;
subtype CCMR1_Input_IC1F_Field is HAL.UInt4;
subtype CCMR1_Input_CC2S_Field is HAL.UInt2;
subtype CCMR1_Input_IC2PCS_Field is HAL.UInt2;
subtype CCMR1_Input_IC2F_Field is HAL.UInt4;
-- capture/compare mode register 1 (input mode)
type CCMR1_Input_Register is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
ICPCS : CCMR1_Input_ICPCS_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_Field := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Input_CC2S_Field := 16#0#;
-- Input capture 2 prescaler
IC2PCS : CCMR1_Input_IC2PCS_Field := 16#0#;
-- Input capture 2 filter
IC2F : CCMR1_Input_IC2F_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Input_Register use record
CC1S at 0 range 0 .. 1;
ICPCS at 0 range 2 .. 3;
IC1F at 0 range 4 .. 7;
CC2S at 0 range 8 .. 9;
IC2PCS at 0 range 10 .. 11;
IC2F at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCMR2_Output_CC3S_Field is HAL.UInt2;
subtype CCMR2_Output_OC3M_Field is HAL.UInt3;
subtype CCMR2_Output_CC4S_Field is HAL.UInt2;
subtype CCMR2_Output_OC4M_Field is HAL.UInt3;
-- capture/compare mode register 2 (output mode)
type CCMR2_Output_Register is record
-- Capture/Compare 3 selection
CC3S : CCMR2_Output_CC3S_Field := 16#0#;
-- Output compare 3 fast enable
OC3FE : Boolean := False;
-- Output compare 3 preload enable
OC3PE : Boolean := False;
-- Output compare 3 mode
OC3M : CCMR2_Output_OC3M_Field := 16#0#;
-- Output compare 3 clear enable
OC3CE : Boolean := False;
-- Capture/Compare 4 selection
CC4S : CCMR2_Output_CC4S_Field := 16#0#;
-- Output compare 4 fast enable
OC4FE : Boolean := False;
-- Output compare 4 preload enable
OC4PE : Boolean := False;
-- Output compare 4 mode
OC4M : CCMR2_Output_OC4M_Field := 16#0#;
-- Output compare 4 clear enable
OC4CE : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR2_Output_Register use record
CC3S at 0 range 0 .. 1;
OC3FE at 0 range 2 .. 2;
OC3PE at 0 range 3 .. 3;
OC3M at 0 range 4 .. 6;
OC3CE at 0 range 7 .. 7;
CC4S at 0 range 8 .. 9;
OC4FE at 0 range 10 .. 10;
OC4PE at 0 range 11 .. 11;
OC4M at 0 range 12 .. 14;
OC4CE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCMR2_Input_CC3S_Field is HAL.UInt2;
subtype CCMR2_Input_IC3PSC_Field is HAL.UInt2;
subtype CCMR2_Input_IC3F_Field is HAL.UInt4;
subtype CCMR2_Input_CC4S_Field is HAL.UInt2;
subtype CCMR2_Input_IC4PSC_Field is HAL.UInt2;
subtype CCMR2_Input_IC4F_Field is HAL.UInt4;
-- capture/compare mode register 2 (input mode)
type CCMR2_Input_Register is record
-- Capture/compare 3 selection
CC3S : CCMR2_Input_CC3S_Field := 16#0#;
-- Input capture 3 prescaler
IC3PSC : CCMR2_Input_IC3PSC_Field := 16#0#;
-- Input capture 3 filter
IC3F : CCMR2_Input_IC3F_Field := 16#0#;
-- Capture/Compare 4 selection
CC4S : CCMR2_Input_CC4S_Field := 16#0#;
-- Input capture 4 prescaler
IC4PSC : CCMR2_Input_IC4PSC_Field := 16#0#;
-- Input capture 4 filter
IC4F : CCMR2_Input_IC4F_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR2_Input_Register use record
CC3S at 0 range 0 .. 1;
IC3PSC at 0 range 2 .. 3;
IC3F at 0 range 4 .. 7;
CC4S at 0 range 8 .. 9;
IC4PSC at 0 range 10 .. 11;
IC4F at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- capture/compare enable register
type CCER_Register is record
-- Capture/Compare 1 output enable
CC1E : Boolean := False;
-- Capture/Compare 1 output Polarity
CC1P : Boolean := False;
-- Capture/Compare 1 complementary output enable
CC1NE : Boolean := False;
-- Capture/Compare 1 output Polarity
CC1NP : Boolean := False;
-- Capture/Compare 2 output enable
CC2E : Boolean := False;
-- Capture/Compare 2 output Polarity
CC2P : Boolean := False;
-- Capture/Compare 2 complementary output enable
CC2NE : Boolean := False;
-- Capture/Compare 2 output Polarity
CC2NP : Boolean := False;
-- Capture/Compare 3 output enable
CC3E : Boolean := False;
-- Capture/Compare 3 output Polarity
CC3P : Boolean := False;
-- Capture/Compare 3 complementary output enable
CC3NE : Boolean := False;
-- Capture/Compare 3 output Polarity
CC3NP : Boolean := False;
-- Capture/Compare 4 output enable
CC4E : Boolean := False;
-- Capture/Compare 3 output Polarity
CC4P : Boolean := False;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
CC1NE at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
CC2E at 0 range 4 .. 4;
CC2P at 0 range 5 .. 5;
CC2NE at 0 range 6 .. 6;
CC2NP at 0 range 7 .. 7;
CC3E at 0 range 8 .. 8;
CC3P at 0 range 9 .. 9;
CC3NE at 0 range 10 .. 10;
CC3NP at 0 range 11 .. 11;
CC4E at 0 range 12 .. 12;
CC4P at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
subtype CNT_CNT_Field is HAL.UInt16;
-- counter
type CNT_Register is record
-- counter value
CNT : CNT_CNT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNT_Register use record
CNT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype PSC_PSC_Field is HAL.UInt16;
-- prescaler
type PSC_Register is record
-- Prescaler value
PSC : PSC_PSC_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PSC_Register use record
PSC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype ARR_ARR_Field is HAL.UInt16;
-- auto-reload register
type ARR_Register is record
-- Auto-reload value
ARR : ARR_ARR_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ARR_Register use record
ARR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype RCR_REP_Field is HAL.UInt8;
-- repetition counter register
type RCR_Register is record
-- Repetition counter value
REP : RCR_REP_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RCR_Register use record
REP at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CCR1_CCR1_Field is HAL.UInt16;
-- capture/compare register 1
type CCR1_Register is record
-- Capture/Compare 1 value
CCR1 : CCR1_CCR1_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR1_Register use record
CCR1 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCR2_CCR2_Field is HAL.UInt16;
-- capture/compare register 2
type CCR2_Register is record
-- Capture/Compare 2 value
CCR2 : CCR2_CCR2_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR2_Register use record
CCR2 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCR3_CCR3_Field is HAL.UInt16;
-- capture/compare register 3
type CCR3_Register is record
-- Capture/Compare value
CCR3 : CCR3_CCR3_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR3_Register use record
CCR3 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCR4_CCR4_Field is HAL.UInt16;
-- capture/compare register 4
type CCR4_Register is record
-- Capture/Compare value
CCR4 : CCR4_CCR4_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR4_Register use record
CCR4 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype BDTR_DTG_Field is HAL.UInt8;
subtype BDTR_LOCK_Field is HAL.UInt2;
-- break and dead-time register
type BDTR_Register is record
-- Dead-time generator setup
DTG : BDTR_DTG_Field := 16#0#;
-- Lock configuration
LOCK : BDTR_LOCK_Field := 16#0#;
-- Off-state selection for Idle mode
OSSI : Boolean := False;
-- Off-state selection for Run mode
OSSR : Boolean := False;
-- Break enable
BKE : Boolean := False;
-- Break polarity
BKP : Boolean := False;
-- Automatic output enable
AOE : Boolean := False;
-- Main output enable
MOE : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BDTR_Register use record
DTG at 0 range 0 .. 7;
LOCK at 0 range 8 .. 9;
OSSI at 0 range 10 .. 10;
OSSR at 0 range 11 .. 11;
BKE at 0 range 12 .. 12;
BKP at 0 range 13 .. 13;
AOE at 0 range 14 .. 14;
MOE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DCR_DBA_Field is HAL.UInt5;
subtype DCR_DBL_Field is HAL.UInt5;
-- DMA control register
type DCR_Register is record
-- DMA base address
DBA : DCR_DBA_Field := 16#0#;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
-- DMA burst length
DBL : DCR_DBL_Field := 16#0#;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCR_Register use record
DBA at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
DBL at 0 range 8 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype DMAR_DMAB_Field is HAL.UInt16;
-- DMA address for full transfer
type DMAR_Register is record
-- DMA register for burst accesses
DMAB : DMAR_DMAB_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DMAR_Register use record
DMAB at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register 2
type CR2_Register_1 is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Capture/compare DMA selection
CCDS : Boolean := False;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- TI1 selection
TI1S : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_1 use record
Reserved_0_2 at 0 range 0 .. 2;
CCDS at 0 range 3 .. 3;
MMS at 0 range 4 .. 6;
TI1S at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_1 is record
-- Update interrupt enable
UIE : Boolean := False;
-- Capture/Compare 1 interrupt enable
CC1IE : Boolean := False;
-- Capture/Compare 2 interrupt enable
CC2IE : Boolean := False;
-- Capture/Compare 3 interrupt enable
CC3IE : Boolean := False;
-- Capture/Compare 4 interrupt enable
CC4IE : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- Trigger interrupt enable
TIE : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Update DMA request enable
UDE : Boolean := False;
-- Capture/Compare 1 DMA request enable
CC1DE : Boolean := False;
-- Capture/Compare 2 DMA request enable
CC2DE : Boolean := False;
-- Capture/Compare 3 DMA request enable
CC3DE : Boolean := False;
-- Capture/Compare 4 DMA request enable
CC4DE : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- Trigger DMA request enable
TDE : 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 DIER_Register_1 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
CC2IE at 0 range 2 .. 2;
CC3IE at 0 range 3 .. 3;
CC4IE at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
UDE at 0 range 8 .. 8;
CC1DE at 0 range 9 .. 9;
CC2DE at 0 range 10 .. 10;
CC3DE at 0 range 11 .. 11;
CC4DE at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register_1 is record
-- Update interrupt flag
UIF : Boolean := False;
-- Capture/compare 1 interrupt flag
CC1IF : Boolean := False;
-- Capture/Compare 2 interrupt flag
CC2IF : Boolean := False;
-- Capture/Compare 3 interrupt flag
CC3IF : Boolean := False;
-- Capture/Compare 4 interrupt flag
CC4IF : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- Trigger interrupt flag
TIF : Boolean := False;
-- unspecified
Reserved_7_8 : HAL.UInt2 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : Boolean := False;
-- Capture/compare 2 overcapture flag
CC2OF : Boolean := False;
-- Capture/Compare 3 overcapture flag
CC3OF : Boolean := False;
-- Capture/Compare 4 overcapture flag
CC4OF : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_1 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
CC2IF at 0 range 2 .. 2;
CC3IF at 0 range 3 .. 3;
CC4IF at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TIF at 0 range 6 .. 6;
Reserved_7_8 at 0 range 7 .. 8;
CC1OF at 0 range 9 .. 9;
CC2OF at 0 range 10 .. 10;
CC3OF at 0 range 11 .. 11;
CC4OF at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- event generation register
type EGR_Register_1 is record
-- Write-only. Update generation
UG : Boolean := False;
-- Write-only. Capture/compare 1 generation
CC1G : Boolean := False;
-- Write-only. Capture/compare 2 generation
CC2G : Boolean := False;
-- Write-only. Capture/compare 3 generation
CC3G : Boolean := False;
-- Write-only. Capture/compare 4 generation
CC4G : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- Write-only. Trigger generation
TG : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_1 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
CC3G at 0 range 3 .. 3;
CC4G at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TG at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- capture/compare mode register 2 (output mode)
type CCMR2_Output_Register_1 is record
-- CC3S
CC3S : CCMR2_Output_CC3S_Field := 16#0#;
-- OC3FE
OC3FE : Boolean := False;
-- OC3PE
OC3PE : Boolean := False;
-- OC3M
OC3M : CCMR2_Output_OC3M_Field := 16#0#;
-- OC3CE
OC3CE : Boolean := False;
-- CC4S
CC4S : CCMR2_Output_CC4S_Field := 16#0#;
-- OC4FE
OC4FE : Boolean := False;
-- OC4PE
OC4PE : Boolean := False;
-- OC4M
OC4M : CCMR2_Output_OC4M_Field := 16#0#;
-- O24CE
O24CE : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR2_Output_Register_1 use record
CC3S at 0 range 0 .. 1;
OC3FE at 0 range 2 .. 2;
OC3PE at 0 range 3 .. 3;
OC3M at 0 range 4 .. 6;
OC3CE at 0 range 7 .. 7;
CC4S at 0 range 8 .. 9;
OC4FE at 0 range 10 .. 10;
OC4PE at 0 range 11 .. 11;
OC4M at 0 range 12 .. 14;
O24CE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- capture/compare enable register
type CCER_Register_1 is record
-- Capture/Compare 1 output enable
CC1E : Boolean := False;
-- Capture/Compare 1 output Polarity
CC1P : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : Boolean := False;
-- Capture/Compare 2 output enable
CC2E : Boolean := False;
-- Capture/Compare 2 output Polarity
CC2P : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : Boolean := False;
-- Capture/Compare 3 output enable
CC3E : Boolean := False;
-- Capture/Compare 3 output Polarity
CC3P : Boolean := False;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- Capture/Compare 3 output Polarity
CC3NP : Boolean := False;
-- Capture/Compare 4 output enable
CC4E : Boolean := False;
-- Capture/Compare 3 output Polarity
CC4P : Boolean := False;
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- Capture/Compare 4 output Polarity
CC4NP : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_1 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
CC2E at 0 range 4 .. 4;
CC2P at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
CC2NP at 0 range 7 .. 7;
CC3E at 0 range 8 .. 8;
CC3P at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
CC3NP at 0 range 11 .. 11;
CC4E at 0 range 12 .. 12;
CC4P at 0 range 13 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
CC4NP at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CNT_CNT_L_Field is HAL.UInt16;
subtype CNT_CNT_H_Field is HAL.UInt16;
-- counter
type CNT_Register_1 is record
-- Low counter value
CNT_L : CNT_CNT_L_Field := 16#0#;
-- High counter value
CNT_H : CNT_CNT_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNT_Register_1 use record
CNT_L at 0 range 0 .. 15;
CNT_H at 0 range 16 .. 31;
end record;
subtype ARR_ARR_L_Field is HAL.UInt16;
subtype ARR_ARR_H_Field is HAL.UInt16;
-- auto-reload register
type ARR_Register_1 is record
-- Low Auto-reload value
ARR_L : ARR_ARR_L_Field := 16#0#;
-- High Auto-reload value
ARR_H : ARR_ARR_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ARR_Register_1 use record
ARR_L at 0 range 0 .. 15;
ARR_H at 0 range 16 .. 31;
end record;
subtype CCR1_CCR1_L_Field is HAL.UInt16;
subtype CCR1_CCR1_H_Field is HAL.UInt16;
-- capture/compare register 1
type CCR1_Register_1 is record
-- Low Capture/Compare 1 value
CCR1_L : CCR1_CCR1_L_Field := 16#0#;
-- High Capture/Compare 1 value
CCR1_H : CCR1_CCR1_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR1_Register_1 use record
CCR1_L at 0 range 0 .. 15;
CCR1_H at 0 range 16 .. 31;
end record;
subtype CCR2_CCR2_L_Field is HAL.UInt16;
subtype CCR2_CCR2_H_Field is HAL.UInt16;
-- capture/compare register 2
type CCR2_Register_1 is record
-- Low Capture/Compare 2 value
CCR2_L : CCR2_CCR2_L_Field := 16#0#;
-- High Capture/Compare 2 value
CCR2_H : CCR2_CCR2_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR2_Register_1 use record
CCR2_L at 0 range 0 .. 15;
CCR2_H at 0 range 16 .. 31;
end record;
subtype CCR3_CCR3_L_Field is HAL.UInt16;
subtype CCR3_CCR3_H_Field is HAL.UInt16;
-- capture/compare register 3
type CCR3_Register_1 is record
-- Low Capture/Compare value
CCR3_L : CCR3_CCR3_L_Field := 16#0#;
-- High Capture/Compare value
CCR3_H : CCR3_CCR3_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR3_Register_1 use record
CCR3_L at 0 range 0 .. 15;
CCR3_H at 0 range 16 .. 31;
end record;
subtype CCR4_CCR4_L_Field is HAL.UInt16;
subtype CCR4_CCR4_H_Field is HAL.UInt16;
-- capture/compare register 4
type CCR4_Register_1 is record
-- Low Capture/Compare value
CCR4_L : CCR4_CCR4_L_Field := 16#0#;
-- High Capture/Compare value
CCR4_H : CCR4_CCR4_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR4_Register_1 use record
CCR4_L at 0 range 0 .. 15;
CCR4_H at 0 range 16 .. 31;
end record;
subtype OR_ITR1_RMP_Field is HAL.UInt2;
-- TIM5 option register
type OR_Register is record
-- unspecified
Reserved_0_9 : HAL.UInt10 := 16#0#;
-- Timer Input 4 remap
ITR1_RMP : OR_ITR1_RMP_Field := 16#0#;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register use record
Reserved_0_9 at 0 range 0 .. 9;
ITR1_RMP at 0 range 10 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype OR_IT4_RMP_Field is HAL.UInt2;
-- TIM5 option register
type OR_Register_1 is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Timer Input 4 remap
IT4_RMP : OR_IT4_RMP_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register_1 use record
Reserved_0_5 at 0 range 0 .. 5;
IT4_RMP at 0 range 6 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- control register 1
type CR1_Register_1 is record
-- Counter enable
CEN : Boolean := False;
-- Update disable
UDIS : Boolean := False;
-- Update request source
URS : Boolean := False;
-- One-pulse mode
OPM : Boolean := False;
-- unspecified
Reserved_4_6 : HAL.UInt3 := 16#0#;
-- Auto-reload preload enable
ARPE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register_1 use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
OPM at 0 range 3 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
ARPE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- control register 2
type CR2_Register_2 is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_2 use record
Reserved_0_3 at 0 range 0 .. 3;
MMS at 0 range 4 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_2 is record
-- Update interrupt enable
UIE : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
-- Update DMA request enable
UDE : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_2 use record
UIE at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
UDE at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- status register
type SR_Register_2 is record
-- Update interrupt flag
UIF : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_2 use record
UIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- event generation register
type EGR_Register_2 is record
-- Write-only. Update generation
UG : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_2 use record
UG at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- control register 1
type CR1_Register_2 is record
-- Counter enable
CEN : Boolean := False;
-- Update disable
UDIS : Boolean := False;
-- Update request source
URS : Boolean := False;
-- One-pulse mode
OPM : Boolean := False;
-- unspecified
Reserved_4_6 : HAL.UInt3 := 16#0#;
-- Auto-reload preload enable
ARPE : Boolean := False;
-- Clock division
CKD : CR1_CKD_Field := 16#0#;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register_2 use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
OPM at 0 range 3 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
ARPE at 0 range 7 .. 7;
CKD at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- slave mode control register
type SMCR_Register_1 is record
-- Slave mode selection
SMS : SMCR_SMS_Field := 16#0#;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- Trigger selection
TS : SMCR_TS_Field := 16#0#;
-- Master/Slave mode
MSM : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SMCR_Register_1 use record
SMS at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TS at 0 range 4 .. 6;
MSM at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_3 is record
-- Update interrupt enable
UIE : Boolean := False;
-- Capture/Compare 1 interrupt enable
CC1IE : Boolean := False;
-- Capture/Compare 2 interrupt enable
CC2IE : Boolean := False;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Trigger interrupt enable
TIE : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_3 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
CC2IE at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
TIE at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- status register
type SR_Register_3 is record
-- Update interrupt flag
UIF : Boolean := False;
-- Capture/compare 1 interrupt flag
CC1IF : Boolean := False;
-- Capture/Compare 2 interrupt flag
CC2IF : Boolean := False;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Trigger interrupt flag
TIF : Boolean := False;
-- unspecified
Reserved_7_8 : HAL.UInt2 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : Boolean := False;
-- Capture/compare 2 overcapture flag
CC2OF : Boolean := False;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_3 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
CC2IF at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
TIF at 0 range 6 .. 6;
Reserved_7_8 at 0 range 7 .. 8;
CC1OF at 0 range 9 .. 9;
CC2OF at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-- event generation register
type EGR_Register_3 is record
-- Write-only. Update generation
UG : Boolean := False;
-- Write-only. Capture/compare 1 generation
CC1G : Boolean := False;
-- Write-only. Capture/compare 2 generation
CC2G : Boolean := False;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Write-only. Trigger generation
TG : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_3 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
TG at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- capture/compare mode register 1 (output mode)
type CCMR1_Output_Register_1 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Output_CC1S_Field := 16#0#;
-- Output Compare 1 fast enable
OC1FE : Boolean := False;
-- Output Compare 1 preload enable
OC1PE : Boolean := False;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Output_CC2S_Field := 16#0#;
-- Output Compare 2 fast enable
OC2FE : Boolean := False;
-- Output Compare 2 preload enable
OC2PE : Boolean := False;
-- Output Compare 2 mode
OC2M : CCMR1_Output_OC2M_Field := 16#0#;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Output_Register_1 use record
CC1S at 0 range 0 .. 1;
OC1FE at 0 range 2 .. 2;
OC1PE at 0 range 3 .. 3;
OC1M at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CC2S at 0 range 8 .. 9;
OC2FE at 0 range 10 .. 10;
OC2PE at 0 range 11 .. 11;
OC2M at 0 range 12 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype CCMR1_Input_IC1F_Field_1 is HAL.UInt3;
subtype CCMR1_Input_IC2F_Field_1 is HAL.UInt3;
-- capture/compare mode register 1 (input mode)
type CCMR1_Input_Register_1 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
ICPCS : CCMR1_Input_ICPCS_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_Field_1 := 16#0#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Input_CC2S_Field := 16#0#;
-- Input capture 2 prescaler
IC2PCS : CCMR1_Input_IC2PCS_Field := 16#0#;
-- Input capture 2 filter
IC2F : CCMR1_Input_IC2F_Field_1 := 16#0#;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Input_Register_1 use record
CC1S at 0 range 0 .. 1;
ICPCS at 0 range 2 .. 3;
IC1F at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CC2S at 0 range 8 .. 9;
IC2PCS at 0 range 10 .. 11;
IC2F at 0 range 12 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- capture/compare enable register
type CCER_Register_2 is record
-- Capture/Compare 1 output enable
CC1E : Boolean := False;
-- Capture/Compare 1 output Polarity
CC1P : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : Boolean := False;
-- Capture/Compare 2 output enable
CC2E : Boolean := False;
-- Capture/Compare 2 output Polarity
CC2P : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_2 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
CC2E at 0 range 4 .. 4;
CC2P at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
CC2NP at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- control register 1
type CR1_Register_3 is record
-- Counter enable
CEN : Boolean := False;
-- Update disable
UDIS : Boolean := False;
-- Update request source
URS : Boolean := False;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- Auto-reload preload enable
ARPE : Boolean := False;
-- Clock division
CKD : CR1_CKD_Field := 16#0#;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register_3 use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
ARPE at 0 range 7 .. 7;
CKD at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_4 is record
-- Update interrupt enable
UIE : Boolean := False;
-- Capture/Compare 1 interrupt enable
CC1IE : Boolean := False;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_4 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- status register
type SR_Register_4 is record
-- Update interrupt flag
UIF : Boolean := False;
-- Capture/compare 1 interrupt flag
CC1IF : Boolean := False;
-- unspecified
Reserved_2_8 : HAL.UInt7 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_4 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
Reserved_2_8 at 0 range 2 .. 8;
CC1OF at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- event generation register
type EGR_Register_4 is record
-- Write-only. Update generation
UG : Boolean := False;
-- Write-only. Capture/compare 1 generation
CC1G : Boolean := False;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_4 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- capture/compare mode register 1 (output mode)
type CCMR1_Output_Register_2 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Output_CC1S_Field := 16#0#;
-- Output Compare 1 fast enable
OC1FE : Boolean := False;
-- Output Compare 1 preload enable
OC1PE : Boolean := False;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Output_Register_2 use record
CC1S at 0 range 0 .. 1;
OC1FE at 0 range 2 .. 2;
OC1PE at 0 range 3 .. 3;
OC1M at 0 range 4 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- capture/compare mode register 1 (input mode)
type CCMR1_Input_Register_2 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
ICPCS : CCMR1_Input_ICPCS_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Input_Register_2 use record
CC1S at 0 range 0 .. 1;
ICPCS at 0 range 2 .. 3;
IC1F at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- capture/compare enable register
type CCER_Register_3 is record
-- Capture/Compare 1 output enable
CC1E : Boolean := False;
-- Capture/Compare 1 output Polarity
CC1P : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : Boolean := False;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_3 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype OR_RMP_Field is HAL.UInt2;
-- option register
type OR_Register_2 is record
-- Input 1 remapping capability
RMP : OR_RMP_Field := 16#0#;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register_2 use record
RMP at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type TIM1_Disc is
(
Output,
Input);
-- Advanced-timers
type TIM1_Peripheral
(Discriminent : TIM1_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register;
-- slave mode control register
SMCR : aliased SMCR_Register;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register;
-- status register
SR : aliased SR_Register;
-- event generation register
EGR : aliased EGR_Register;
-- capture/compare enable register
CCER : aliased CCER_Register;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- repetition counter register
RCR : aliased RCR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- capture/compare register 2
CCR2 : aliased CCR2_Register;
-- capture/compare register 3
CCR3 : aliased CCR3_Register;
-- capture/compare register 4
CCR4 : aliased CCR4_Register;
-- break and dead-time register
BDTR : aliased BDTR_Register;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register 2 (output mode)
CCMR2_Output : aliased CCMR2_Output_Register;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register;
-- capture/compare mode register 2 (input mode)
CCMR2_Input : aliased CCMR2_Input_Register;
end case;
end record
with Unchecked_Union, Volatile;
for TIM1_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
RCR at 16#30# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCR3 at 16#3C# range 0 .. 31;
CCR4 at 16#40# range 0 .. 31;
BDTR at 16#44# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR2_Output at 16#1C# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
CCMR2_Input at 16#1C# range 0 .. 31;
end record;
-- Advanced-timers
TIM1_Periph : aliased TIM1_Peripheral
with Import, Address => System'To_Address (16#40010000#);
-- Advanced-timers
TIM8_Periph : aliased TIM1_Peripheral
with Import, Address => System'To_Address (16#40010400#);
type TIM2_Disc is
(
Output,
Input);
-- General purpose timers
type TIM2_Peripheral
(Discriminent : TIM2_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register_1;
-- slave mode control register
SMCR : aliased SMCR_Register;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_1;
-- status register
SR : aliased SR_Register_1;
-- event generation register
EGR : aliased EGR_Register_1;
-- capture/compare enable register
CCER : aliased CCER_Register_1;
-- counter
CNT : aliased CNT_Register_1;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register_1;
-- capture/compare register 1
CCR1 : aliased CCR1_Register_1;
-- capture/compare register 2
CCR2 : aliased CCR2_Register_1;
-- capture/compare register 3
CCR3 : aliased CCR3_Register_1;
-- capture/compare register 4
CCR4 : aliased CCR4_Register_1;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
-- TIM5 option register
OR_k : aliased OR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register 2 (output mode)
CCMR2_Output : aliased CCMR2_Output_Register_1;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register;
-- capture/compare mode register 2 (input mode)
CCMR2_Input : aliased CCMR2_Input_Register;
end case;
end record
with Unchecked_Union, Volatile;
for TIM2_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCR3 at 16#3C# range 0 .. 31;
CCR4 at 16#40# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
OR_k at 16#50# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR2_Output at 16#1C# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
CCMR2_Input at 16#1C# range 0 .. 31;
end record;
-- General purpose timers
TIM2_Periph : aliased TIM2_Peripheral
with Import, Address => System'To_Address (16#40000000#);
type TIM3_Disc is
(
Output,
Input);
-- General purpose timers
type TIM3_Peripheral
(Discriminent : TIM3_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register_1;
-- slave mode control register
SMCR : aliased SMCR_Register;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_1;
-- status register
SR : aliased SR_Register_1;
-- event generation register
EGR : aliased EGR_Register_1;
-- capture/compare enable register
CCER : aliased CCER_Register_1;
-- counter
CNT : aliased CNT_Register_1;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register_1;
-- capture/compare register 1
CCR1 : aliased CCR1_Register_1;
-- capture/compare register 2
CCR2 : aliased CCR2_Register_1;
-- capture/compare register 3
CCR3 : aliased CCR3_Register_1;
-- capture/compare register 4
CCR4 : aliased CCR4_Register_1;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register 2 (output mode)
CCMR2_Output : aliased CCMR2_Output_Register_1;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register;
-- capture/compare mode register 2 (input mode)
CCMR2_Input : aliased CCMR2_Input_Register;
end case;
end record
with Unchecked_Union, Volatile;
for TIM3_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCR3 at 16#3C# range 0 .. 31;
CCR4 at 16#40# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR2_Output at 16#1C# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
CCMR2_Input at 16#1C# range 0 .. 31;
end record;
-- General purpose timers
TIM3_Periph : aliased TIM3_Peripheral
with Import, Address => System'To_Address (16#40000400#);
-- General purpose timers
TIM4_Periph : aliased TIM3_Peripheral
with Import, Address => System'To_Address (16#40000800#);
type TIM5_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM5_Peripheral
(Discriminent : TIM5_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register_1;
-- slave mode control register
SMCR : aliased SMCR_Register;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_1;
-- status register
SR : aliased SR_Register_1;
-- event generation register
EGR : aliased EGR_Register_1;
-- capture/compare enable register
CCER : aliased CCER_Register_1;
-- counter
CNT : aliased CNT_Register_1;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register_1;
-- capture/compare register 1
CCR1 : aliased CCR1_Register_1;
-- capture/compare register 2
CCR2 : aliased CCR2_Register_1;
-- capture/compare register 3
CCR3 : aliased CCR3_Register_1;
-- capture/compare register 4
CCR4 : aliased CCR4_Register_1;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
-- TIM5 option register
OR_k : aliased OR_Register_1;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register 2 (output mode)
CCMR2_Output : aliased CCMR2_Output_Register_1;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register;
-- capture/compare mode register 2 (input mode)
CCMR2_Input : aliased CCMR2_Input_Register;
end case;
end record
with Unchecked_Union, Volatile;
for TIM5_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCR3 at 16#3C# range 0 .. 31;
CCR4 at 16#40# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
OR_k at 16#50# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR2_Output at 16#1C# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
CCMR2_Input at 16#1C# range 0 .. 31;
end record;
-- General-purpose-timers
TIM5_Periph : aliased TIM5_Peripheral
with Import, Address => System'To_Address (16#40000C00#);
-- Basic timers
type TIM6_Peripheral is record
-- control register 1
CR1 : aliased CR1_Register_1;
-- control register 2
CR2 : aliased CR2_Register_2;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_2;
-- status register
SR : aliased SR_Register_2;
-- event generation register
EGR : aliased EGR_Register_2;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
end record
with Volatile;
for TIM6_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
end record;
-- Basic timers
TIM6_Periph : aliased TIM6_Peripheral
with Import, Address => System'To_Address (16#40001000#);
-- Basic timers
TIM7_Periph : aliased TIM6_Peripheral
with Import, Address => System'To_Address (16#40001400#);
type TIM9_Disc is
(
Output,
Input);
-- General purpose timers
type TIM9_Peripheral
(Discriminent : TIM9_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_2;
-- slave mode control register
SMCR : aliased SMCR_Register_1;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_3;
-- status register
SR : aliased SR_Register_3;
-- event generation register
EGR : aliased EGR_Register_3;
-- capture/compare enable register
CCER : aliased CCER_Register_2;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- capture/compare register 2
CCR2 : aliased CCR2_Register;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_1;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_1;
end case;
end record
with Unchecked_Union, Volatile;
for TIM9_Peripheral use record
CR1 at 16#0# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General purpose timers
TIM9_Periph : aliased TIM9_Peripheral
with Import, Address => System'To_Address (16#40014000#);
-- General purpose timers
TIM12_Periph : aliased TIM9_Peripheral
with Import, Address => System'To_Address (16#40001800#);
type TIM10_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM10_Peripheral
(Discriminent : TIM10_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_3;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_4;
-- status register
SR : aliased SR_Register_4;
-- event generation register
EGR : aliased EGR_Register_4;
-- capture/compare enable register
CCER : aliased CCER_Register_3;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_2;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_2;
end case;
end record
with Unchecked_Union, Volatile;
for TIM10_Peripheral use record
CR1 at 16#0# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM10_Periph : aliased TIM10_Peripheral
with Import, Address => System'To_Address (16#40014400#);
-- General-purpose-timers
TIM13_Periph : aliased TIM10_Peripheral
with Import, Address => System'To_Address (16#40001C00#);
-- General-purpose-timers
TIM14_Periph : aliased TIM10_Peripheral
with Import, Address => System'To_Address (16#40002000#);
type TIM11_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM11_Peripheral
(Discriminent : TIM11_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_3;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_4;
-- status register
SR : aliased SR_Register_4;
-- event generation register
EGR : aliased EGR_Register_4;
-- capture/compare enable register
CCER : aliased CCER_Register_3;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- option register
OR_k : aliased OR_Register_2;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_2;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_2;
end case;
end record
with Unchecked_Union, Volatile;
for TIM11_Peripheral use record
CR1 at 16#0# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
OR_k at 16#50# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM11_Periph : aliased TIM11_Peripheral
with Import, Address => System'To_Address (16#40014800#);
end STM32_SVD.TIM;
|
Fabien-Chouteau/lvgl-ada | Ada | 6,701 | ads | pragma Style_Checks (Off);
with Lv.Style;
with System;
with Lv.Objx.Label;
with Lv.Objx.Page;
with Lv.Objx.Btn;
package Lv.Objx.List is
subtype Instance is Obj_T;
type Style_T is (Style_Bg,
Style_Scrl,
Style_Sb,
Style_Btn_Rel,
Style_Btn_Pr,
Style_Btn_Tgl_Rel,
Style_Btn_Tgl_Pr,
Style_Btn_Ina);
-- Create a list objects
-- @param par pointer to an object, it will be the parent of the new list
-- @param copy pointer to a list object, if not NULL then the new object will be copied from it
-- @return pointer to the created list
function Create (Par : Obj_T; Copy : Instance) return Instance;
-- Delete all children of the scrl object, without deleting scrl child.
-- @param obj pointer to an object
procedure Clean (Self : Instance);
-- Add a list element to the list
-- @param self pointer to list object
-- @param img_fn file name of an image before the text (NULL if unused)
-- @param txt text of the list element (NULL if unused)
-- @param rel_action pointer to release action function (like with lv_btn)
-- @return pointer to the new list element which can be customized (a button)
function Add
(Self : Instance;
Img_Gn : System.Address;
Txt : C_String_Ptr;
Rel_Action : Action_Func_T) return Btn.Instance;
----------------------
-- Setter functions --
----------------------
-- Make a button selected
-- @param self pointer to a list object
-- @param btn pointer to a button to select
procedure Set_Btn_Selected (Self : Instance; Btn : Obj_T);
-- Set scroll animation duration on 'list_up()' 'list_down()' 'list_focus()'
-- @param self pointer to a list object
-- @param anim_time duration of animation [ms]
procedure Set_Anim_Time (Self : Instance; Anim_Time : Uint16_T);
-- Set the scroll bar mode of a list
-- @param self pointer to a list object
-- @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
procedure Set_Sb_Mode (Self : Instance; Mode : Lv.Objx.Page.Mode_T);
-- Set a style of a list
-- @param self pointer to a list object
-- @param type which style should be set
-- @param style pointer to a style
procedure Set_Style
(Self : Instance;
Type_P : Style_T;
Style : Lv.Style.Style);
----------------------
-- Getter functions --
----------------------
-- Get the text of a list element
-- @param btn pointer to list element
-- @return pointer to the text
function Btn_Text
(Self : Instance) return C_String_Ptr;
-- Get the label object from a list element
-- @param self pointer to a list element (button)
-- @return pointer to the label from the list element or NULL if not found
function Btn_Label (Self : Instance) return Label.Instance;
-- Get the image object from a list element
-- @param self pointer to a list element (button)
-- @return pointer to the image from the list element or NULL if not found
function Btn_Img (Self : Instance) return Obj_T;
-- Get the next button from list. (Starts from the bottom button)
-- @param self pointer to a list object
-- @param prev_btn pointer to button. Search the next after it.
-- @return pointer to the next button or NULL when no more buttons
function Prev_Btn (Self : Instance; Prev : Obj_T) return Obj_T;
-- Get the previous button from list. (Starts from the top button)
-- @param self pointer to a list object
-- @param prev_btn pointer to button. Search the previous before it.
-- @return pointer to the previous button or NULL when no more buttons
function Next_Btn (Self : Instance; Next : Obj_T) return Obj_T;
-- Get the currently selected button
-- @param self pointer to a list object
-- @return pointer to the selected button
function Btn_Selected (Self : Instance) return Obj_T;
-- Get scroll animation duration
-- @param self pointer to a list object
-- @return duration of animation [ms]
function Anim_Time (Self : Instance) return Uint16_T;
-- Get the scroll bar mode of a list
-- @param self pointer to a list object
-- @return scrollbar mode from 'lv_page_sb_mode_t' enum
function Sb_Mode (Self : Instance) return Lv.Objx.Page.Mode_T;
-- Get a style of a list
-- @param self pointer to a list object
-- @param type which style should be get
-- @return style pointer to a style
function Style
(Self : Instance;
Type_P : Style_T) return Lv.Style.Style;
-- Other functions
-- Move the list elements up by one
-- @param self pointer a to list object
procedure Up (Self : Instance);
-- Move the list elements down by one
-- @param self pointer to a list object
procedure Down (Self : Instance);
-- Focus on a list button. It ensures that the button will be visible on the list.
-- @param self pointer to a list button to focus
-- @param anim_en true: scroll with animation, false: without animation
procedure Focus (Self : Instance; Anim_En : U_Bool);
-------------
-- Imports --
-------------
pragma Import (C, Create, "lv_list_create");
pragma Import (C, Clean, "lv_list_clean");
pragma Import (C, Add, "lv_list_add");
pragma Import (C, Set_Btn_Selected, "lv_list_set_btn_selected");
pragma Import (C, Set_Anim_Time, "lv_list_set_anim_time");
pragma Import (C, Set_Sb_Mode, "lv_list_set_sb_mode_inline");
pragma Import (C, Set_Style, "lv_list_set_style");
pragma Import (C, Btn_Text, "lv_list_get_btn_text");
pragma Import (C, Btn_Label, "lv_list_get_btn_label");
pragma Import (C, Btn_Img, "lv_list_get_btn_img");
pragma Import (C, Prev_Btn, "lv_list_get_prev_btn");
pragma Import (C, Next_Btn, "lv_list_get_next_btn");
pragma Import (C, Btn_Selected, "lv_list_get_btn_selected");
pragma Import (C, Anim_Time, "lv_list_get_anim_time");
pragma Import (C, Sb_Mode, "lv_list_get_sb_mode_inline");
pragma Import (C, Style, "lv_list_get_style");
pragma Import (C, Up, "lv_list_up");
pragma Import (C, Down, "lv_list_down");
pragma Import (C, Focus, "lv_list_focus");
for Style_T'Size use 8;
for Style_T use (Style_Bg => 0,
Style_Scrl => 1,
Style_Sb => 2,
Style_Btn_Rel => 3,
Style_Btn_Pr => 4,
Style_Btn_Tgl_Rel => 5,
Style_Btn_Tgl_Pr => 6,
Style_Btn_Ina => 7);
end Lv.Objx.List;
|
stcarrez/ada-lzma | Ada | 27,010 | ads | pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
with Ada.Streams;
package Lzma.Base is
-- unsupported macro: LZMA_STREAM_INIT { NULL, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM }
--*
-- * \file lzma/base.h
-- * \brief Data types and functions used in many places in liblzma API
--
-- * Author: Lasse Collin
-- *
-- * This file has been put into the public domain.
-- * You can do whatever you want with this file.
-- *
-- * See ../lzma.h for information about liblzma as a whole.
--
--*
-- * \brief Boolean
-- *
-- * This is here because C89 doesn't have stdbool.h. To set a value for
-- * variables having type lzma_bool, you can use
-- * - C99's `true' and `false' from stdbool.h;
-- * - C++'s internal `true' and `false'; or
-- * - integers one (true) and zero (false).
--
subtype lzma_bool is unsigned_char; -- /usr/include/lzma/base.h:29
--*
-- * \brief Type of reserved enumeration variable in structures
-- *
-- * To avoid breaking library ABI when new features are added, several
-- * structures contain extra variables that may be used in future. Since
-- * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may
-- * even vary depending on the range of enumeration constants, we specify
-- * a separate type to be used for reserved enumeration variables. All
-- * enumeration constants in liblzma API will be non-negative and less
-- * than 128, which should guarantee that the ABI won't break even when
-- * new constants are added to existing enumerations.
--
type lzma_reserved_enum_type is
(LZMA_RESERVED_ENUM);
pragma Convention (C, lzma_reserved_enum_type); -- /usr/include/lzma/base.h:46
--*
-- * \brief Return values used by several functions in liblzma
-- *
-- * Check the descriptions of specific functions to find out which return
-- * values they can return. With some functions the return values may have
-- * more specific meanings than described here; those differences are
-- * described per-function basis.
--
--*<
-- * \brief Operation completed successfully
--
--*<
-- * \brief End of stream was reached
-- *
-- * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or
-- * LZMA_FINISH was finished. In decoder, this indicates
-- * that all the data was successfully decoded.
-- *
-- * In all cases, when LZMA_STREAM_END is returned, the last
-- * output bytes should be picked from strm->next_out.
--
--*<
-- * \brief Input stream has no integrity check
-- *
-- * This return value can be returned only if the
-- * LZMA_TELL_NO_CHECK flag was used when initializing
-- * the decoder. LZMA_NO_CHECK is just a warning, and
-- * the decoding can be continued normally.
-- *
-- * It is possible to call lzma_get_check() immediately after
-- * lzma_code has returned LZMA_NO_CHECK. The result will
-- * naturally be LZMA_CHECK_NONE, but the possibility to call
-- * lzma_get_check() may be convenient in some applications.
--
--*<
-- * \brief Cannot calculate the integrity check
-- *
-- * The usage of this return value is different in encoders
-- * and decoders.
-- *
-- * Encoders can return this value only from the initialization
-- * function. If initialization fails with this value, the
-- * encoding cannot be done, because there's no way to produce
-- * output with the correct integrity check.
-- *
-- * Decoders can return this value only from lzma_code() and
-- * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when
-- * initializing the decoder. The decoding can still be
-- * continued normally even if the check type is unsupported,
-- * but naturally the check will not be validated, and possible
-- * errors may go undetected.
-- *
-- * With decoder, it is possible to call lzma_get_check()
-- * immediately after lzma_code() has returned
-- * LZMA_UNSUPPORTED_CHECK. This way it is possible to find
-- * out what the unsupported Check ID was.
--
--*<
-- * \brief Integrity check type is now available
-- *
-- * This value can be returned only by the lzma_code() function
-- * and only if the decoder was initialized with the
-- * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the
-- * application that it may now call lzma_get_check() to find
-- * out the Check ID. This can be used, for example, to
-- * implement a decoder that accepts only files that have
-- * strong enough integrity check.
--
--*<
-- * \brief Cannot allocate memory
-- *
-- * Memory allocation failed, or the size of the allocation
-- * would be greater than SIZE_MAX.
-- *
-- * Due to internal implementation reasons, the coding cannot
-- * be continued even if more memory were made available after
-- * LZMA_MEM_ERROR.
--
--*
-- * \brief Memory usage limit was reached
-- *
-- * Decoder would need more memory than allowed by the
-- * specified memory usage limit. To continue decoding,
-- * the memory usage limit has to be increased with
-- * lzma_memlimit_set().
--
--*<
-- * \brief File format not recognized
-- *
-- * The decoder did not recognize the input as supported file
-- * format. This error can occur, for example, when trying to
-- * decode .lzma format file with lzma_stream_decoder,
-- * because lzma_stream_decoder accepts only the .xz format.
--
--*<
-- * \brief Invalid or unsupported options
-- *
-- * Invalid or unsupported options, for example
-- * - unsupported filter(s) or filter options; or
-- * - reserved bits set in headers (decoder only).
-- *
-- * Rebuilding liblzma with more features enabled, or
-- * upgrading to a newer version of liblzma may help.
--
--*<
-- * \brief Data is corrupt
-- *
-- * The usage of this return value is different in encoders
-- * and decoders. In both encoder and decoder, the coding
-- * cannot continue after this error.
-- *
-- * Encoders return this if size limits of the target file
-- * format would be exceeded. These limits are huge, thus
-- * getting this error from an encoder is mostly theoretical.
-- * For example, the maximum compressed and uncompressed
-- * size of a .xz Stream is roughly 8 EiB (2^63 bytes).
-- *
-- * Decoders return this error if the input data is corrupt.
-- * This can mean, for example, invalid CRC32 in headers
-- * or invalid check of uncompressed data.
--
--*<
-- * \brief No progress is possible
-- *
-- * This error code is returned when the coder cannot consume
-- * any new input and produce any new output. The most common
-- * reason for this error is that the input stream being
-- * decoded is truncated or corrupt.
-- *
-- * This error is not fatal. Coding can be continued normally
-- * by providing more input and/or more output space, if
-- * possible.
-- *
-- * Typically the first call to lzma_code() that can do no
-- * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only
-- * the second consecutive call doing no progress will return
-- * LZMA_BUF_ERROR. This is intentional.
-- *
-- * With zlib, Z_BUF_ERROR may be returned even if the
-- * application is doing nothing wrong, so apps will need
-- * to handle Z_BUF_ERROR specially. The above hack
-- * guarantees that liblzma never returns LZMA_BUF_ERROR
-- * to properly written applications unless the input file
-- * is truncated or corrupt. This should simplify the
-- * applications a little.
--
--*<
-- * \brief Programming error
-- *
-- * This indicates that the arguments given to the function are
-- * invalid or the internal state of the decoder is corrupt.
-- * - Function arguments are invalid or the structures
-- * pointed by the argument pointers are invalid
-- * e.g. if strm->next_out has been set to NULL and
-- * strm->avail_out > 0 when calling lzma_code().
-- * - lzma_* functions have been called in wrong order
-- * e.g. lzma_code() was called right after lzma_end().
-- * - If errors occur randomly, the reason might be flaky
-- * hardware.
-- *
-- * If you think that your code is correct, this error code
-- * can be a sign of a bug in liblzma. See the documentation
-- * how to report bugs.
--
type lzma_ret is
(LZMA_OK,
LZMA_STREAM_END,
LZMA_NO_CHECK,
LZMA_UNSUPPORTED_CHECK,
LZMA_GET_CHECK,
LZMA_MEM_ERROR,
LZMA_MEMLIMIT_ERROR,
LZMA_FORMAT_ERROR,
LZMA_OPTIONS_ERROR,
LZMA_DATA_ERROR,
LZMA_BUF_ERROR,
LZMA_PROG_ERROR);
pragma Convention (C, lzma_ret); -- /usr/include/lzma/base.h:237
--*
-- * \brief The `action' argument for lzma_code()
-- *
-- * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or LZMA_FINISH,
-- * the same `action' must is used until lzma_code() returns LZMA_STREAM_END.
-- * Also, the amount of input (that is, strm->avail_in) must not be modified
-- * by the application until lzma_code() returns LZMA_STREAM_END. Changing the
-- * `action' or modifying the amount of input will make lzma_code() return
-- * LZMA_PROG_ERROR.
--
--*<
-- * \brief Continue coding
-- *
-- * Encoder: Encode as much input as possible. Some internal
-- * buffering will probably be done (depends on the filter
-- * chain in use), which causes latency: the input used won't
-- * usually be decodeable from the output of the same
-- * lzma_code() call.
-- *
-- * Decoder: Decode as much input as possible and produce as
-- * much output as possible.
--
--*<
-- * \brief Make all the input available at output
-- *
-- * Normally the encoder introduces some latency.
-- * LZMA_SYNC_FLUSH forces all the buffered data to be
-- * available at output without resetting the internal
-- * state of the encoder. This way it is possible to use
-- * compressed stream for example for communication over
-- * network.
-- *
-- * Only some filters support LZMA_SYNC_FLUSH. Trying to use
-- * LZMA_SYNC_FLUSH with filters that don't support it will
-- * make lzma_code() return LZMA_OPTIONS_ERROR. For example,
-- * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does.
-- *
-- * Using LZMA_SYNC_FLUSH very often can dramatically reduce
-- * the compression ratio. With some filters (for example,
-- * LZMA2), fine-tuning the compression options may help
-- * mitigate this problem significantly (for example,
-- * match finder with LZMA2).
-- *
-- * Decoders don't support LZMA_SYNC_FLUSH.
--
--*<
-- * \brief Finish encoding of the current Block
-- *
-- * All the input data going to the current Block must have
-- * been given to the encoder (the last bytes can still be
-- * pending in* next_in). Call lzma_code() with LZMA_FULL_FLUSH
-- * until it returns LZMA_STREAM_END. Then continue normally
-- * with LZMA_RUN or finish the Stream with LZMA_FINISH.
-- *
-- * This action is currently supported only by Stream encoder
-- * and easy encoder (which uses Stream encoder). If there is
-- * no unfinished Block, no empty Block is created.
--
--*<
-- * \brief Finish the coding operation
-- *
-- * All the input data must have been given to the encoder
-- * (the last bytes can still be pending in next_in).
-- * Call lzma_code() with LZMA_FINISH until it returns
-- * LZMA_STREAM_END. Once LZMA_FINISH has been used,
-- * the amount of input must no longer be changed by
-- * the application.
-- *
-- * When decoding, using LZMA_FINISH is optional unless the
-- * LZMA_CONCATENATED flag was used when the decoder was
-- * initialized. When LZMA_CONCATENATED was not used, the only
-- * effect of LZMA_FINISH is that the amount of input must not
-- * be changed just like in the encoder.
--
type lzma_action is
(LZMA_RUN,
LZMA_SYNC_FLUSH,
LZMA_FULL_FLUSH,
LZMA_FINISH);
pragma Convention (C, lzma_action); -- /usr/include/lzma/base.h:322
--*
-- * \brief Custom functions for memory handling
-- *
-- * A pointer to lzma_allocator may be passed via lzma_stream structure
-- * to liblzma, and some advanced functions take a pointer to lzma_allocator
-- * as a separate function argument. The library will use the functions
-- * specified in lzma_allocator for memory handling instead of the default
-- * malloc() and free(). C++ users should note that the custom memory
-- * handling functions must not throw exceptions.
-- *
-- * Single-threaded mode only: liblzma doesn't make an internal copy of
-- * lzma_allocator. Thus, it is OK to change these function pointers in
-- * the middle of the coding process, but obviously it must be done
-- * carefully to make sure that the replacement `free' can deallocate
-- * memory allocated by the earlier `alloc' function(s).
-- *
-- * Multithreaded mode: liblzma might internally store pointers to the
-- * lzma_allocator given via the lzma_stream structure. The application
-- * must not change the allocator pointer in lzma_stream or the contents
-- * of the pointed lzma_allocator structure until lzma_end() has been used
-- * to free the memory associated with that lzma_stream. The allocation
-- * functions might be called simultaneously from multiple threads, and
-- * thus they must be thread safe.
--
--*
-- * \brief Pointer to a custom memory allocation function
-- *
-- * If you don't want a custom allocator, but still want
-- * custom free(), set this to NULL and liblzma will use
-- * the standard malloc().
-- *
-- * \param opaque lzma_allocator.opaque (see below)
-- * \param nmemb Number of elements like in calloc(). liblzma
-- * will always set nmemb to 1, so it is safe to
-- * ignore nmemb in a custom allocator if you like.
-- * The nmemb argument exists only for
-- * compatibility with zlib and libbzip2.
-- * \param size Size of an element in bytes.
-- * liblzma never sets this to zero.
-- *
-- * \return Pointer to the beginning of a memory block of
-- * `size' bytes, or NULL if allocation fails
-- * for some reason. When allocation fails, functions
-- * of liblzma return LZMA_MEM_ERROR.
-- *
-- * The allocator should not waste time zeroing the allocated buffers.
-- * This is not only about speed, but also memory usage, since the
-- * operating system kernel doesn't necessarily allocate the requested
-- * memory in physical memory until it is actually used. With small
-- * input files, liblzma may actually need only a fraction of the
-- * memory that it requested for allocation.
-- *
-- * \note LZMA_MEM_ERROR is also used when the size of the
-- * allocation would be greater than SIZE_MAX. Thus,
-- * don't assume that the custom allocator must have
-- * returned NULL if some function from liblzma
-- * returns LZMA_MEM_ERROR.
--
type lzma_allocator is record
alloc : access function
(arg1 : System.Address;
arg2 : Interfaces.C.size_t;
arg3 : Interfaces.C.size_t) return System.Address; -- /usr/include/lzma/base.h:384
free : access procedure (arg1 : System.Address; arg2 : System.Address); -- /usr/include/lzma/base.h:398
opaque : System.Address; -- /usr/include/lzma/base.h:409
end record;
pragma Convention (C_Pass_By_Copy, lzma_allocator); -- /usr/include/lzma/base.h:411
-- skipped anonymous struct anon_4
--*
-- * \brief Pointer to a custom memory freeing function
-- *
-- * If you don't want a custom freeing function, but still
-- * want a custom allocator, set this to NULL and liblzma
-- * will use the standard free().
-- *
-- * \param opaque lzma_allocator.opaque (see below)
-- * \param ptr Pointer returned by lzma_allocator.alloc(),
-- * or when it is set to NULL, a pointer returned
-- * by the standard malloc().
--
--*
-- * \brief Pointer passed to .alloc() and .free()
-- *
-- * opaque is passed as the first argument to lzma_allocator.alloc()
-- * and lzma_allocator.free(). This intended to ease implementing
-- * custom memory allocation functions for use with liblzma.
-- *
-- * If you don't need this, you should set this to NULL.
--
--*
-- * \brief Internal data structure
-- *
-- * The contents of this structure is not visible outside the library.
--
-- skipped empty struct lzma_internal_s
-- skipped empty struct lzma_internal
--*
-- * \brief Passing data to and from liblzma
-- *
-- * The lzma_stream structure is used for
-- * - passing pointers to input and output buffers to liblzma;
-- * - defining custom memory hander functions; and
-- * - holding a pointer to coder-specific internal data structures.
-- *
-- * Typical usage:
-- *
-- * - After allocating lzma_stream (on stack or with malloc()), it must be
-- * initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).
-- *
-- * - Initialize a coder to the lzma_stream, for example by using
-- * lzma_easy_encoder() or lzma_auto_decoder(). Some notes:
-- * - In contrast to zlib, strm->next_in and strm->next_out are
-- * ignored by all initialization functions, thus it is safe
-- * to not initialize them yet.
-- * - The initialization functions always set strm->total_in and
-- * strm->total_out to zero.
-- * - If the initialization function fails, no memory is left allocated
-- * that would require freeing with lzma_end() even if some memory was
-- * associated with the lzma_stream structure when the initialization
-- * function was called.
-- *
-- * - Use lzma_code() to do the actual work.
-- *
-- * - Once the coding has been finished, the existing lzma_stream can be
-- * reused. It is OK to reuse lzma_stream with different initialization
-- * function without calling lzma_end() first. Old allocations are
-- * automatically freed.
-- *
-- * - Finally, use lzma_end() to free the allocated memory. lzma_end() never
-- * frees the lzma_stream structure itself.
-- *
-- * Application may modify the values of total_in and total_out as it wants.
-- * They are updated by liblzma to match the amount of data read and
-- * written, but aren't used for anything else.
--
--*< Pointer to the next input byte.
type lzma_stream is record
next_in : access Ada.Streams.Stream_Element; -- /usr/include/lzma/base.h:462
avail_in : aliased Interfaces.C.size_t; -- /usr/include/lzma/base.h:463
total_in : aliased Long_Long_Integer; -- /usr/include/lzma/base.h:464
next_out : access Ada.Streams.Stream_Element; -- /usr/include/lzma/base.h:466
avail_out : aliased Interfaces.C.size_t; -- /usr/include/lzma/base.h:467
total_out : aliased Long_Long_Integer; -- /usr/include/lzma/base.h:468
allocator : access lzma_allocator; -- /usr/include/lzma/base.h:476
internal : System.Address; -- /usr/include/lzma/base.h:479
reserved_ptr1 : System.Address; -- /usr/include/lzma/base.h:487
reserved_ptr2 : System.Address; -- /usr/include/lzma/base.h:488
reserved_ptr3 : System.Address; -- /usr/include/lzma/base.h:489
reserved_ptr4 : System.Address; -- /usr/include/lzma/base.h:490
reserved_int1 : aliased Long_Long_Integer; -- /usr/include/lzma/base.h:491
reserved_int2 : aliased Long_Long_Integer; -- /usr/include/lzma/base.h:492
reserved_int3 : aliased Interfaces.C.size_t; -- /usr/include/lzma/base.h:493
reserved_int4 : aliased Interfaces.C.size_t; -- /usr/include/lzma/base.h:494
reserved_enum1 : aliased lzma_reserved_enum_type; -- /usr/include/lzma/base.h:495
reserved_enum2 : aliased lzma_reserved_enum_type; -- /usr/include/lzma/base.h:496
end record;
pragma Convention (C_Pass_By_Copy, lzma_stream);
LZMA_STREAM_INIT : constant lzma_stream :=
(next_in => null, avail_in => 0, total_in => 0,
next_out => null, avail_out => 0, total_out => 0, allocator => null,
internal => System.Null_Address, reserved_ptr1 => System.Null_Address,
reserved_ptr2 => System.Null_Address, reserved_ptr3 => System.Null_Address,
reserved_ptr4 => System.Null_Address, reserved_enum1 => LZMA_RESERVED_ENUM,
reserved_enum2 => LZMA_RESERVED_ENUM, reserved_int1 => 0,
reserved_int2 => 0, others => 0); -- /usr/include/lzma/base.h:498
-- skipped anonymous struct anon_5
--*< Number of available input bytes in next_in.
--*< Total number of bytes read by liblzma.
--*< Pointer to the next output position.
--*< Amount of free space in next_out.
--*< Total number of bytes written by liblzma.
--*
-- * \brief Custom memory allocation functions
-- *
-- * In most cases this is NULL which makes liblzma use
-- * the standard malloc() and free().
--
--* Internal state is not visible to applications.
-- * Reserved space to allow possible future extensions without
-- * breaking the ABI. Excluding the initialization of this structure,
-- * you should not touch these, because the names of these variables
-- * may change.
--
--*
-- * \brief Initialization for lzma_stream
-- *
-- * When you declare an instance of lzma_stream, you can immediately
-- * initialize it so that initialization functions know that no memory
-- * has been allocated yet:
-- *
-- * lzma_stream strm = LZMA_STREAM_INIT;
-- *
-- * If you need to initialize a dynamically allocated lzma_stream, you can use
-- * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this
-- * violates the C standard since NULL may have different internal
-- * representation than zero, but it should be portable enough in practice.
-- * Anyway, for maximum portability, you can use something like this:
-- *
-- * lzma_stream tmp = LZMA_STREAM_INIT;
-- * *strm = tmp;
--
--*
-- * \brief Encode or decode data
-- *
-- * Once the lzma_stream has been successfully initialized (e.g. with
-- * lzma_stream_encoder()), the actual encoding or decoding is done
-- * using this function. The application has to update strm->next_in,
-- * strm->avail_in, strm->next_out, and strm->avail_out to pass input
-- * to and get output from liblzma.
-- *
-- * See the description of the coder-specific initialization function to find
-- * out what `action' values are supported by the coder.
--
function lzma_code (strm : access lzma_stream; action : lzma_action) return lzma_ret; -- /usr/include/lzma/base.h:537
pragma Import (C, lzma_code, "lzma_code");
--*
-- * \brief Free memory allocated for the coder data structures
-- *
-- * \param strm Pointer to lzma_stream that is at least initialized
-- * with LZMA_STREAM_INIT.
-- *
-- * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other
-- * members of the lzma_stream structure are touched.
-- *
-- * \note zlib indicates an error if application end()s unfinished
-- * stream structure. liblzma doesn't do this, and assumes that
-- * application knows what it is doing.
--
procedure lzma_end (strm : access lzma_stream); -- /usr/include/lzma/base.h:554
pragma Import (C, lzma_end, "lzma_end");
--*
-- * \brief Get the memory usage of decoder filter chain
-- *
-- * This function is currently supported only when *strm has been initialized
-- * with a function that takes a memlimit argument. With other functions, you
-- * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage()
-- * to estimate the memory requirements.
-- *
-- * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big
-- * the memory usage limit should have been to decode the input. Note that
-- * this may give misleading information if decoding .xz Streams that have
-- * multiple Blocks, because each Block can have different memory requirements.
-- *
-- * \return How much memory is currently allocated for the filter
-- * decoders. If no filter chain is currently allocated,
-- * some non-zero value is still returned, which is less than
-- * or equal to what any filter chain would indicate as its
-- * memory requirement.
-- *
-- * If this function isn't supported by *strm or some other error
-- * occurs, zero is returned.
--
function lzma_memusage (strm : access constant lzma_stream) return Long_Long_Integer; -- /usr/include/lzma/base.h:579
pragma Import (C, lzma_memusage, "lzma_memusage");
--*
-- * \brief Get the current memory usage limit
-- *
-- * This function is supported only when *strm has been initialized with
-- * a function that takes a memlimit argument.
-- *
-- * \return On success, the current memory usage limit is returned
-- * (always non-zero). On error, zero is returned.
--
function lzma_memlimit_get (strm : access constant lzma_stream) return Long_Long_Integer; -- /usr/include/lzma/base.h:592
pragma Import (C, lzma_memlimit_get, "lzma_memlimit_get");
--*
-- * \brief Set the memory usage limit
-- *
-- * This function is supported only when *strm has been initialized with
-- * a function that takes a memlimit argument.
-- *
-- * \return - LZMA_OK: New memory usage limit successfully set.
-- * - LZMA_MEMLIMIT_ERROR: The new limit is too small.
-- * The limit was not changed.
-- * - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
-- * support memory usage limit or memlimit was zero.
--
function lzma_memlimit_set (strm : access lzma_stream; memlimit : Long_Long_Integer) return lzma_ret; -- /usr/include/lzma/base.h:608
pragma Import (C, lzma_memlimit_set, "lzma_memlimit_set");
end Lzma.Base;
|
stcarrez/ada-awa | Ada | 3,840 | ads | -----------------------------------------------------------------------
-- awa-mail-components-recipients -- Mail UI Recipients
-- Copyright (C) 2012, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Contexts.Faces;
-- === Mail Messages ===
-- The `AWA.Mail.Components.Messages` package defines the UI components
-- to represent the email message with its recipients, subject and body.
--
-- The mail message is retrieved by looking at the parent UI component until a
-- `UIMailMessage` component is found. The mail message recipients are initialized
-- during the render response JSF phase, that is when `Encode_End` are called.
--
-- The `<mail:body>` component holds the message body. This component can
-- include a facelet labeled `alternative` in which case it will be used
-- to build the `text/plain` mail message. The default content type for
-- `<mail:body>` is `text/html` but this can be changed by using the
-- `type` attribute.
--
-- <mail:body type='text/html'>
-- <facet name='alternative'>
-- The text/plain mail message.
-- </facet>
-- The text/html mail message.
-- </mail:body>
package AWA.Mail.Components.Messages is
ALTERNATIVE_NAME : constant String := "alternative";
-- ------------------------------
-- The mail recipient
-- ------------------------------
type UIMailMessage is new UIMailComponent with private;
type UIMailMessage_Access is access all UIMailMessage'Class;
-- Set the mail message instance.
procedure Set_Message (UI : in out UIMailMessage;
Message : in AWA.Mail.Clients.Mail_Message_Access);
-- Get the mail message instance.
overriding
function Get_Message (UI : in UIMailMessage) return AWA.Mail.Clients.Mail_Message_Access;
-- Send the mail.
overriding
procedure Encode_End (UI : in UIMailMessage;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- Finalize and release the mail message.
overriding
procedure Finalize (UI : in out UIMailMessage);
-- ------------------------------
-- The mail subject
-- ------------------------------
type UIMailSubject is new UIMailComponent with private;
-- Render the mail subject and initializes the message with its content.
overriding
procedure Encode_Children (UI : in UIMailSubject;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- ------------------------------
-- The mail body
-- ------------------------------
type UIMailBody is new UIMailComponent with private;
-- Render the mail body and initializes the message with its content.
overriding
procedure Encode_Children (UI : in UIMailBody;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
private
type UIMailMessage is new UIMailComponent with record
Message : AWA.Mail.Clients.Mail_Message_Access;
end record;
type UIMailBody is new UIMailComponent with null record;
type UIMailSubject is new UIMailComponent with null record;
end AWA.Mail.Components.Messages;
|
AdaCore/Ada_Drivers_Library | Ada | 2,528 | ads | -- This spec has been automatically generated from FE310.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package FE310_SVD.RTC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CONFIG_SCALE_Field is HAL.UInt4;
-- RTC Configuration Register.
type CONFIG_Register is record
SCALE : CONFIG_SCALE_Field := 16#0#;
-- unspecified
Reserved_4_11 : HAL.UInt8 := 16#0#;
ENALWAYS : Boolean := False;
-- unspecified
Reserved_13_27 : HAL.UInt15 := 16#0#;
CMP_IP : Boolean := False;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG_Register use record
SCALE at 0 range 0 .. 3;
Reserved_4_11 at 0 range 4 .. 11;
ENALWAYS at 0 range 12 .. 12;
Reserved_13_27 at 0 range 13 .. 27;
CMP_IP at 0 range 28 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
subtype HI_CNT_Field is HAL.UInt16;
-- RTC Count Register High.
type HI_Register is record
CNT : HI_CNT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HI_Register use record
CNT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Real-Time Clock.
type RTC_Peripheral is record
-- RTC Configuration Register.
CONFIG : aliased CONFIG_Register;
-- RTC Count Register Low.
LO : aliased HAL.UInt32;
-- RTC Count Register High.
HI : aliased HI_Register;
-- RTC Scaled Counter Register.
SCALE_COUNT : aliased HAL.UInt32;
-- RTC Compare Register.
COMPARE : aliased HAL.UInt32;
end record
with Volatile;
for RTC_Peripheral use record
CONFIG at 16#0# range 0 .. 31;
LO at 16#8# range 0 .. 31;
HI at 16#C# range 0 .. 31;
SCALE_COUNT at 16#10# range 0 .. 31;
COMPARE at 16#20# range 0 .. 31;
end record;
-- Real-Time Clock.
RTC_Periph : aliased RTC_Peripheral
with Import, Address => System'To_Address (16#10000040#);
end FE310_SVD.RTC;
|
tum-ei-rcs/StratoX | Ada | 5,565 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . M A C H I N E _ C O D E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides machine code support, both for intrinsic machine
-- operations, and also for machine code statements. See GNAT documentation
-- for full details.
package System.Machine_Code is
pragma Pure;
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
type Asm_Input_Operand is private;
type Asm_Output_Operand is private;
-- These types are never used directly, they are declared only so that
-- the calls to Asm are type correct according to Ada semantic rules.
No_Input_Operands : constant Asm_Input_Operand;
No_Output_Operands : constant Asm_Output_Operand;
type Asm_Input_Operand_List is
array (Integer range <>) of Asm_Input_Operand;
type Asm_Output_Operand_List is
array (Integer range <>) of Asm_Output_Operand;
type Asm_Insn is private;
-- This type is not used directly. It is declared only so that the
-- aggregates used in code statements are type correct by Ada rules.
procedure Asm (
Template : String;
Outputs : Asm_Output_Operand_List;
Inputs : Asm_Input_Operand_List;
Clobber : String := "";
Volatile : Boolean := False);
procedure Asm (
Template : String;
Outputs : Asm_Output_Operand := No_Output_Operands;
Inputs : Asm_Input_Operand_List;
Clobber : String := "";
Volatile : Boolean := False);
procedure Asm (
Template : String;
Outputs : Asm_Output_Operand_List;
Inputs : Asm_Input_Operand := No_Input_Operands;
Clobber : String := "";
Volatile : Boolean := False);
procedure Asm (
Template : String;
Outputs : Asm_Output_Operand := No_Output_Operands;
Inputs : Asm_Input_Operand := No_Input_Operands;
Clobber : String := "";
Volatile : Boolean := False);
function Asm (
Template : String;
Outputs : Asm_Output_Operand_List;
Inputs : Asm_Input_Operand_List;
Clobber : String := "";
Volatile : Boolean := False) return Asm_Insn;
function Asm (
Template : String;
Outputs : Asm_Output_Operand := No_Output_Operands;
Inputs : Asm_Input_Operand_List;
Clobber : String := "";
Volatile : Boolean := False) return Asm_Insn;
function Asm (
Template : String;
Outputs : Asm_Output_Operand_List;
Inputs : Asm_Input_Operand := No_Input_Operands;
Clobber : String := "";
Volatile : Boolean := False) return Asm_Insn;
function Asm (
Template : String;
Outputs : Asm_Output_Operand := No_Output_Operands;
Inputs : Asm_Input_Operand := No_Input_Operands;
Clobber : String := "";
Volatile : Boolean := False) return Asm_Insn;
pragma Import (Intrinsic, Asm);
private
type Asm_Input_Operand is new Integer;
type Asm_Output_Operand is new Integer;
type Asm_Insn is new Integer;
-- All three of these types are dummy types, to meet the requirements of
-- type consistency. No values of these types are ever referenced.
No_Input_Operands : constant Asm_Input_Operand := 0;
No_Output_Operands : constant Asm_Output_Operand := 0;
end System.Machine_Code;
|
reznikmm/matreshka | Ada | 25,543 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with AMF.Internals.UML_Named_Elements;
with AMF.String_Collections;
with AMF.UML.Behaviors;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Element_Imports.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Operations.Collections;
with AMF.UML.Package_Imports.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Protocol_Transitions;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.Regions;
with AMF.UML.State_Machines;
with AMF.UML.String_Expressions;
with AMF.UML.Transitions;
with AMF.UML.Triggers.Collections;
with AMF.UML.Vertexs;
with AMF.Visitors;
package AMF.Internals.UML_Protocol_Transitions is
type UML_Protocol_Transition_Proxy is
limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy
and AMF.UML.Protocol_Transitions.UML_Protocol_Transition with null record;
overriding function Get_Post_Condition
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Constraints.UML_Constraint_Access;
-- Getter of ProtocolTransition::postCondition.
--
-- Specifies the post condition of the transition which is the condition
-- that should be obtained once the transition is triggered. This post
-- condition is part of the post condition of the operation connected to
-- the transition.
overriding procedure Set_Post_Condition
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Constraints.UML_Constraint_Access);
-- Setter of ProtocolTransition::postCondition.
--
-- Specifies the post condition of the transition which is the condition
-- that should be obtained once the transition is triggered. This post
-- condition is part of the post condition of the operation connected to
-- the transition.
overriding function Get_Pre_Condition
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Constraints.UML_Constraint_Access;
-- Getter of ProtocolTransition::preCondition.
--
-- Specifies the precondition of the transition. It specifies the
-- condition that should be verified before triggering the transition.
-- This guard condition added to the source state will be evaluated as
-- part of the precondition of the operation referred by the transition if
-- any.
overriding procedure Set_Pre_Condition
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Constraints.UML_Constraint_Access);
-- Setter of ProtocolTransition::preCondition.
--
-- Specifies the precondition of the transition. It specifies the
-- condition that should be verified before triggering the transition.
-- This guard condition added to the source state will be evaluated as
-- part of the precondition of the operation referred by the transition if
-- any.
overriding function Get_Referred
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Operations.Collections.Set_Of_UML_Operation;
-- Getter of ProtocolTransition::referred.
--
-- This association refers to the associated operation. It is derived from
-- the operation of the call trigger when applicable.
overriding function Get_Container
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Regions.UML_Region_Access;
-- Getter of Transition::container.
--
-- Designates the region that owns this transition.
overriding procedure Set_Container
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Regions.UML_Region_Access);
-- Setter of Transition::container.
--
-- Designates the region that owns this transition.
overriding function Get_Effect
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access;
-- Getter of Transition::effect.
--
-- Specifies an optional behavior to be performed when the transition
-- fires.
overriding procedure Set_Effect
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access);
-- Setter of Transition::effect.
--
-- Specifies an optional behavior to be performed when the transition
-- fires.
overriding function Get_Guard
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Constraints.UML_Constraint_Access;
-- Getter of Transition::guard.
--
-- A guard is a constraint that provides a fine-grained control over the
-- firing of the transition. The guard is evaluated when an event
-- occurrence is dispatched by the state machine. If the guard is true at
-- that time, the transition may be enabled, otherwise, it is disabled.
-- Guards should be pure expressions without side effects. Guard
-- expressions with side effects are ill formed.
overriding procedure Set_Guard
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Constraints.UML_Constraint_Access);
-- Setter of Transition::guard.
--
-- A guard is a constraint that provides a fine-grained control over the
-- firing of the transition. The guard is evaluated when an event
-- occurrence is dispatched by the state machine. If the guard is true at
-- that time, the transition may be enabled, otherwise, it is disabled.
-- Guards should be pure expressions without side effects. Guard
-- expressions with side effects are ill formed.
overriding function Get_Kind
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.UML_Transition_Kind;
-- Getter of Transition::kind.
--
-- Indicates the precise type of the transition.
overriding procedure Set_Kind
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.UML_Transition_Kind);
-- Setter of Transition::kind.
--
-- Indicates the precise type of the transition.
overriding function Get_Redefined_Transition
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Transitions.UML_Transition_Access;
-- Getter of Transition::redefinedTransition.
--
-- The transition that is redefined by this transition.
overriding procedure Set_Redefined_Transition
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Transitions.UML_Transition_Access);
-- Setter of Transition::redefinedTransition.
--
-- The transition that is redefined by this transition.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access;
-- Getter of Transition::redefinitionContext.
--
-- References the classifier in which context this element may be
-- redefined.
overriding function Get_Source
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Vertexs.UML_Vertex_Access;
-- Getter of Transition::source.
--
-- Designates the originating vertex (state or pseudostate) of the
-- transition.
overriding procedure Set_Source
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Vertexs.UML_Vertex_Access);
-- Setter of Transition::source.
--
-- Designates the originating vertex (state or pseudostate) of the
-- transition.
overriding function Get_Target
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Vertexs.UML_Vertex_Access;
-- Getter of Transition::target.
--
-- Designates the target vertex that is reached when the transition is
-- taken.
overriding procedure Set_Target
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.Vertexs.UML_Vertex_Access);
-- Setter of Transition::target.
--
-- Designates the target vertex that is reached when the transition is
-- taken.
overriding function Get_Trigger
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger;
-- Getter of Transition::trigger.
--
-- Specifies the triggers that may fire the transition.
overriding function Get_Element_Import
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
-- Getter of Namespace::elementImport.
--
-- References the ElementImports owned by the Namespace.
overriding function Get_Imported_Member
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Getter of Namespace::importedMember.
--
-- References the PackageableElements that are members of this Namespace
-- as a result of either PackageImports or ElementImports.
overriding function Get_Member
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::member.
--
-- A collection of NamedElements identifiable within the Namespace, either
-- by being owned or by being introduced by importing or inheritance.
overriding function Get_Owned_Member
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::ownedMember.
--
-- A collection of NamedElements owned by the Namespace.
overriding function Get_Owned_Rule
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Namespace::ownedRule.
--
-- Specifies a set of Constraints owned by this Namespace.
overriding function Get_Package_Import
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
-- Getter of Namespace::packageImport.
--
-- References the PackageImports owned by the Namespace.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Protocol_Transition_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Is_Leaf
(Self : not null access constant UML_Protocol_Transition_Proxy)
return Boolean;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding procedure Set_Is_Leaf
(Self : not null access UML_Protocol_Transition_Proxy;
To : Boolean);
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding function Get_Redefined_Element
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
overriding function Referred
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Operations.Collections.Set_Of_UML_Operation;
-- Operation ProtocolTransition::referred.
--
-- Missing derivation for ProtocolTransition::/referred : Operation
overriding function Containing_State_Machine
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.State_Machines.UML_State_Machine_Access;
-- Operation Transition::containingStateMachine.
--
-- The query containingStateMachine() returns the state machine that
-- contains the transition either directly or transitively.
overriding function Is_Consistent_With
(Self : not null access constant UML_Protocol_Transition_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation Transition::isConsistentWith.
--
-- The query isConsistentWith() specifies that a redefining transition is
-- consistent with a redefined transition provided that the redefining
-- transition has the following relation to the redefined transition: A
-- redefining transition redefines all properties of the corresponding
-- redefined transition, except the source state and the trigger.
overriding function Redefinition_Context
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access;
-- Operation Transition::redefinitionContext.
--
-- The redefinition context of a transition is the nearest containing
-- statemachine.
overriding function Exclude_Collisions
(Self : not null access constant UML_Protocol_Transition_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::excludeCollisions.
--
-- The query excludeCollisions() excludes from a set of
-- PackageableElements any that would not be distinguishable from each
-- other in this namespace.
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Protocol_Transition_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
-- Operation Namespace::getNamesOfMember.
--
-- The query getNamesOfMember() takes importing into account. It gives
-- back the set of names that an element would have in an importing
-- namespace, either because it is owned, or if not owned then imported
-- individually, or if not individually then from a package.
-- The query getNamesOfMember() gives a set of all of the names that a
-- member would have in a Namespace. In general a member can have multiple
-- names in a Namespace if it is imported more than once with different
-- aliases. The query takes account of importing. It gives back the set of
-- names that an element would have in an importing namespace, either
-- because it is owned, or if not owned then imported individually, or if
-- not individually then from a package.
overriding function Import_Members
(Self : not null access constant UML_Protocol_Transition_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importMembers.
--
-- The query importMembers() defines which of a set of PackageableElements
-- are actually imported into the namespace. This excludes hidden ones,
-- i.e., those which have names that conflict with names of owned members,
-- and also excludes elements which would have the same name when imported.
overriding function Imported_Member
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importedMember.
--
-- The importedMember property is derived from the ElementImports and the
-- PackageImports. References the PackageableElements that are members of
-- this Namespace as a result of either PackageImports or ElementImports.
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Protocol_Transition_Proxy)
return Boolean;
-- Operation Namespace::membersAreDistinguishable.
--
-- The Boolean query membersAreDistinguishable() determines whether all of
-- the namespace's members are distinguishable within it.
overriding function Owned_Member
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Namespace::ownedMember.
--
-- Missing derivation for Namespace::/ownedMember : NamedElement
overriding function All_Owning_Packages
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Protocol_Transition_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Protocol_Transition_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Protocol_Transition_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
overriding procedure Enter_Element
(Self : not null access constant UML_Protocol_Transition_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Protocol_Transition_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Protocol_Transition_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Protocol_Transitions;
|
AdaCore/Ada_Drivers_Library | Ada | 4,144 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2019-2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with HAL.UART; use HAL.UART;
with nRF.Device;
with nRF.UART; use nRF.UART;
package body MicroBit.Console is
UART : nRF.UART.UART_Device renames nRF.Device.UART_0;
---------
-- Get --
---------
procedure Get (C : out Character) is
Data : UART_Data_8b (1 .. 1);
Status : UART_Status;
begin
UART.Receive (Data, Status);
C := Character'Val (Data (Data'First));
end Get;
---------
-- Put --
---------
procedure Put (C : Character) is
Data : constant UART_Data_8b (1 .. 1) :=
(1 => UInt8 (Character'Pos (C)));
Status : UART_Status;
begin
UART.Transmit (Data, Status);
end Put;
---------
-- Put --
---------
procedure Put (Str : String) is
Data : UART_Data_8b (Str'First .. Str'Last);
Status : UART_Status;
begin
for Index in Str'Range loop
Data (Index) := UInt8 (Character'Pos (Str (Index)));
end loop;
UART.Transmit (Data, Status);
end Put;
--------------
-- Put_Line --
--------------
procedure Put_Line (Str : String) is
Data : UART_Data_8b (Str'First .. Str'Last + 2);
Status : UART_Status;
begin
for Index in Str'Range loop
Data (Index) := UInt8 (Character'Pos (Str (Index)));
end loop;
Data (Data'Last - 1) := Character'Pos (ASCII.CR);
Data (Data'Last) := Character'Pos (ASCII.LF);
UART.Transmit (Data, Status);
end Put_Line;
--------------
-- New_Line --
--------------
procedure New_Line is
begin
Put (ASCII.CR & ASCII.LF);
end New_Line;
begin
UART.Configure (nRF.UART.Baud115200, Parity => False);
UART.Enable (MB_UART_TX.Pin, MB_UART_RX.Pin);
end MicroBit.Console;
|
sungyeon/drake | Ada | 1,158 | adb | with System.Standard_Allocators;
with System.System_Allocators;
package body System.Storage_Pools.Standard_Pools is
pragma Suppress (All_Checks);
overriding procedure Allocate (
Pool : in out Standard_Pool;
Storage_Address : out Address;
Size_In_Storage_Elements : Storage_Elements.Storage_Count;
Alignment : Storage_Elements.Storage_Count)
is
pragma Unreferenced (Pool);
begin
Storage_Address :=
System_Allocators.Allocate (
Size_In_Storage_Elements,
Alignment => Alignment);
if Storage_Address = Null_Address then
Standard_Allocators.Raise_Heap_Exhausted;
end if;
end Allocate;
overriding procedure Deallocate (
Pool : in out Standard_Pool;
Storage_Address : Address;
Size_In_Storage_Elements : Storage_Elements.Storage_Count;
Alignment : Storage_Elements.Storage_Count)
is
pragma Unreferenced (Pool);
pragma Unreferenced (Size_In_Storage_Elements);
pragma Unreferenced (Alignment);
begin
System_Allocators.Free (Storage_Address);
end Deallocate;
end System.Storage_Pools.Standard_Pools;
|
stcarrez/ada-util | Ada | 1,156 | ads | -----------------------------------------------------------------------
-- util-commands-text_io -- Output using Ada.Text_IO
-- Copyright (C) 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- 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.Text_IO;
package Util.Commands.Text_IO is
new Util.Commands.IO (Count_Type => Ada.Text_IO.Positive_Count,
Put => Ada.Text_IO.Put,
Put_Line => Ada.Text_IO.Put_Line,
New_Line => Ada.Text_IO.New_Line);
|
sparre/Command-Line-Parser-Generator | Ada | 732 | adb | -- Copyright: JSA Research & Innovation <[email protected]>
-- License: Beer Ware
pragma License (Unrestricted);
package body Command_Line_Parser_Generator.Argument_Zsh_Pattern_Map is
procedure Append (Container : in out Instance;
Key : in Source_Text;
Pattern : in Zsh_Argument_Pattern.Instance) is
begin
if Container.Contains (Key) then
Container.Replace (Key => Key,
New_Item => Pattern or Container.Element (Key));
else
Container.Insert (Key => Key,
New_Item => Pattern);
end if;
end Append;
end Command_Line_Parser_Generator.Argument_Zsh_Pattern_Map;
|
reznikmm/matreshka | Ada | 4,741 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Style_Header_Left_Elements;
package Matreshka.ODF_Style.Header_Left_Elements is
type Style_Header_Left_Element_Node is
new Matreshka.ODF_Style.Abstract_Style_Element_Node
and ODF.DOM.Style_Header_Left_Elements.ODF_Style_Header_Left
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Style_Header_Left_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Header_Left_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Style_Header_Left_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Style_Header_Left_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Style_Header_Left_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Style.Header_Left_Elements;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 2,832 | ads | -- This spec has been automatically generated from STM32F303xE.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_T_Field is STM32_SVD.UInt7;
subtype CR_WDGA_Field is STM32_SVD.Bit;
-- Control register
type CR_Register is record
-- 7-bit counter
T : CR_T_Field := 16#7F#;
-- Activation bit
WDGA : CR_WDGA_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CFR_W_Field is STM32_SVD.UInt7;
subtype CFR_WDGTB_Field is STM32_SVD.UInt2;
subtype CFR_EWI_Field is STM32_SVD.Bit;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : CFR_W_Field := 16#7F#;
-- Timer base
WDGTB : CFR_WDGTB_Field := 16#0#;
-- Early wakeup interrupt
EWI : CFR_EWI_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype SR_EWIF_Field is STM32_SVD.Bit;
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : SR_EWIF_Field := 16#0#;
-- unspecified
Reserved_1_31 : STM32_SVD.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Window watchdog
type WWDG_Peripheral is record
-- Control register
CR : aliased CR_Register;
-- Configuration register
CFR : aliased CFR_Register;
-- Status register
SR : aliased SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 16#0# range 0 .. 31;
CFR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
end record;
-- Window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => System'To_Address (16#40002C00#);
end STM32_SVD.WWDG;
|
reznikmm/matreshka | Ada | 3,981 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with ODF.DOM.Fo_Max_Height_Attributes;
package Matreshka.ODF_Fo.Max_Height_Attributes is
type Fo_Max_Height_Attribute_Node is
new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node
and ODF.DOM.Fo_Max_Height_Attributes.ODF_Fo_Max_Height_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Max_Height_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Fo_Max_Height_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Fo.Max_Height_Attributes;
|
reznikmm/matreshka | Ada | 3,620 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
-- Root package for tables of all metamodels. Each metamodel has own tables
-- package as child of this package.
------------------------------------------------------------------------------
package AMF.Internals.Tables is
pragma Preelaborate;
end AMF.Internals.Tables;
|
dilawar/ahir | Ada | 279 | ads | -- RUN: %llvmgcc -c %s
package Non_Bitfield is
type SP is access String;
type E is (A, B, C);
type T (D : E) is record
case D is
when A => X : Boolean;
when B => Y : SP;
when C => Z : String (1 .. 2);
end case;
end record;
end;
|
miao1007/swaggy-jenkins | Ada | 21,963 | adb | -- Swaggy Jenkins
-- Jenkins API clients generated from Swagger / Open API specification
-- ------------ EDIT NOTE ------------
-- This file was generated with openapi-generator. You can modify it to implement
-- the server. After you modify this file, you should add the following line
-- to the .openapi-generator-ignore file:
--
-- src/-servers.adb
--
-- Then, you can drop this edit note comment.
-- ------------ EDIT NOTE ------------
package body .Servers is
--
-- Retrieve CSRF protection token
overriding
procedure Get_Crumb
(Server : in out Server_Type
;
Result : out .Models.DefaultCrumbIssuer_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Crumb;
--
-- Delete queue item from an organization pipeline queue
overriding
procedure Delete_Pipeline_Queue_Item
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Queue : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Delete_Pipeline_Queue_Item;
--
-- Retrieve authenticated user details for an organization
overriding
procedure Get_Authenticated_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Authenticated_User;
--
-- Get a list of class names supported by a given class
overriding
procedure Get_Classes
(Server : in out Server_Type;
Class : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Classes;
--
-- Retrieve JSON Web Key
overriding
procedure Get_Json_Web_Key
(Server : in out Server_Type;
Key : in Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Json_Web_Key;
--
-- Retrieve JSON Web Token
overriding
procedure Get_Json_Web_Token
(Server : in out Server_Type;
Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Max_Expiry_Time_In_Mins : in Swagger.Nullable_Integer;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Json_Web_Token;
--
-- Retrieve organization details
overriding
procedure Get_Organisation
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Organisation_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Organisation;
--
-- Retrieve all organizations details
overriding
procedure Get_Organisations
(Server : in out Server_Type
;
Result : out .Models.Organisations_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Organisations;
--
-- Retrieve pipeline details for an organization
overriding
procedure Get_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.Pipeline_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline;
--
-- Retrieve all activities details for an organization pipeline
overriding
procedure Get_Pipeline_Activities
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineActivities_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Activities;
--
-- Retrieve branch details for an organization pipeline
overriding
procedure Get_Pipeline_Branch
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Result : out .Models.BranchImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Branch;
--
-- Retrieve branch run details for an organization pipeline
overriding
procedure Get_Pipeline_Branch_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Branch : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Branch_Run;
--
-- Retrieve all branches details for an organization pipeline
overriding
procedure Get_Pipeline_Branches
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.MultibranchPipeline_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Branches;
--
-- Retrieve pipeline folder for an organization
overriding
procedure Get_Pipeline_Folder
(Server : in out Server_Type;
Organization : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineFolderImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Folder;
--
-- Retrieve pipeline details for an organization folder
overriding
procedure Get_Pipeline_Folder_Pipeline
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Folder : in Swagger.UString;
Result : out .Models.PipelineImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Folder_Pipeline;
--
-- Retrieve queue details for an organization pipeline
overriding
procedure Get_Pipeline_Queue
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineQueue_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Queue;
--
-- Retrieve run details for an organization pipeline
overriding
procedure Get_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run;
--
-- Get log for a pipeline run
overriding
procedure Get_Pipeline_Run_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Start : in Swagger.Nullable_Integer;
Download : in Swagger.Nullable_Boolean;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run_Log;
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineRunNode_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run_Node;
--
-- Retrieve run node details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Step
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out .Models.PipelineStepImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run_Node_Step;
--
-- Get log for a pipeline run node step
overriding
procedure Get_Pipeline_Run_Node_Step_Log
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Step : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run_Node_Step_Log;
--
-- Retrieve run node steps details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Node_Steps
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Node : in Swagger.UString;
Result : out .Models.PipelineRunNodeSteps_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run_Node_Steps;
--
-- Retrieve run nodes details for an organization pipeline
overriding
procedure Get_Pipeline_Run_Nodes
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.PipelineRunNodes_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Run_Nodes;
--
-- Retrieve all runs details for an organization pipeline
overriding
procedure Get_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.PipelineRuns_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipeline_Runs;
--
-- Retrieve all pipelines details for an organization
overriding
procedure Get_Pipelines
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.Pipelines_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Pipelines;
--
-- Retrieve SCM details for an organization
overriding
procedure Get_S_C_M
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Result : out .Models.GithubScm_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_S_C_M;
--
-- Retrieve SCM organization repositories details for an organization
overriding
procedure Get_S_C_M_Organisation_Repositories
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Page_Size : in Swagger.Nullable_Integer;
Page_Number : in Swagger.Nullable_Integer;
Result : out .Models.ScmOrganisations_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_S_C_M_Organisation_Repositories;
--
-- Retrieve SCM organization repository details for an organization
overriding
procedure Get_S_C_M_Organisation_Repository
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Scm_Organisation : in Swagger.UString;
Repository : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.ScmOrganisations_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_S_C_M_Organisation_Repository;
--
-- Retrieve SCM organizations details for an organization
overriding
procedure Get_S_C_M_Organisations
(Server : in out Server_Type;
Organization : in Swagger.UString;
Scm : in Swagger.UString;
Credential_Id : in Swagger.Nullable_UString;
Result : out .Models.ScmOrganisations_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_S_C_M_Organisations;
--
-- Retrieve user details for an organization
overriding
procedure Get_User
(Server : in out Server_Type;
Organization : in Swagger.UString;
User : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_User;
--
-- Retrieve user favorites details for an organization
overriding
procedure Get_User_Favorites
(Server : in out Server_Type;
User : in Swagger.UString;
Result : out .Models.UserFavorites_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_User_Favorites;
--
-- Retrieve users details for an organization
overriding
procedure Get_Users
(Server : in out Server_Type;
Organization : in Swagger.UString;
Result : out .Models.User_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Users;
--
-- Replay an organization pipeline run
overriding
procedure Post_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Pipeline_Run;
--
-- Start a build for an organization pipeline
overriding
procedure Post_Pipeline_Runs
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Result : out .Models.QueueItemImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Pipeline_Runs;
--
-- Favorite/unfavorite a pipeline
overriding
procedure Put_Pipeline_Favorite
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Body_Type : in Body_Type;
Result : out .Models.FavoriteImpl_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Put_Pipeline_Favorite;
--
-- Stop a build of an organization pipeline
overriding
procedure Put_Pipeline_Run
(Server : in out Server_Type;
Organization : in Swagger.UString;
Pipeline : in Swagger.UString;
Run : in Swagger.UString;
Blocking : in Swagger.Nullable_UString;
Time_Out_In_Secs : in Swagger.Nullable_Integer;
Result : out .Models.PipelineRun_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Put_Pipeline_Run;
--
-- Search for any resource details
overriding
procedure Search
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Search;
--
-- Get classes details
overriding
procedure Search_Classes
(Server : in out Server_Type;
Q : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Search_Classes;
--
-- Retrieve computer details
overriding
procedure Get_Computer
(Server : in out Server_Type;
Depth : in Integer;
Result : out .Models.ComputerSet_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Computer;
--
-- Retrieve Jenkins details
overriding
procedure Get_Jenkins
(Server : in out Server_Type
;
Result : out .Models.Hudson_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Jenkins;
--
-- Retrieve job details
overriding
procedure Get_Job
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleProject_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Job;
--
-- Retrieve job configuration
overriding
procedure Get_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Job_Config;
--
-- Retrieve job's last build details
overriding
procedure Get_Job_Last_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.FreeStyleBuild_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Job_Last_Build;
--
-- Retrieve job's build progressive text output
overriding
procedure Get_Job_Progressive_Text
(Server : in out Server_Type;
Name : in Swagger.UString;
Number : in Swagger.UString;
Start : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Job_Progressive_Text;
--
-- Retrieve queue details
overriding
procedure Get_Queue
(Server : in out Server_Type
;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Queue;
--
-- Retrieve queued item details
overriding
procedure Get_Queue_Item
(Server : in out Server_Type;
Number : in Swagger.UString;
Result : out .Models.Queue_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_Queue_Item;
--
-- Retrieve view details
overriding
procedure Get_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out .Models.ListView_Type;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_View;
--
-- Retrieve view configuration
overriding
procedure Get_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Get_View_Config;
--
-- Retrieve Jenkins headers
overriding
procedure Head_Jenkins
(Server : in out Server_Type
;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Head_Jenkins;
--
-- Create a new job using job configuration, or copied from an existing job
overriding
procedure Post_Create_Item
(Server : in out Server_Type;
Name : in Swagger.UString;
From : in Swagger.Nullable_UString;
Mode : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Create_Item;
--
-- Create a new view using view configuration
overriding
procedure Post_Create_View
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Content_Type : in Swagger.Nullable_UString;
P_Body : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Create_View;
--
-- Build a job
overriding
procedure Post_Job_Build
(Server : in out Server_Type;
Name : in Swagger.UString;
Json : in Swagger.UString;
Token : in Swagger.Nullable_UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Job_Build;
--
-- Update job configuration
overriding
procedure Post_Job_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Job_Config;
--
-- Delete a job
overriding
procedure Post_Job_Delete
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Job_Delete;
--
-- Disable a job
overriding
procedure Post_Job_Disable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Job_Disable;
--
-- Enable a job
overriding
procedure Post_Job_Enable
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Job_Enable;
--
-- Stop a job
overriding
procedure Post_Job_Last_Build_Stop
(Server : in out Server_Type;
Name : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_Job_Last_Build_Stop;
--
-- Update view configuration
overriding
procedure Post_View_Config
(Server : in out Server_Type;
Name : in Swagger.UString;
P_Body : in Swagger.UString;
Jenkins_Crumb : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type) is
begin
null;
end Post_View_Config;
end .Servers;
|
msrLi/portingSources | Ada | 1,119 | adb | -- Copyright 2007-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/>.
package body Pck is
procedure Break_Me is
begin
null;
end Break_Me;
procedure Call_Me (Int : Integer;
Flt : Float;
Bln : Boolean;
Ary : Arr;
Chr : Character;
Sad : System.Address;
Rec : Struct)
is
begin
Break_Me;
end Call_Me;
end Pck;
|
meowthsli/EVB1000 | Ada | 2,892 | adb | -------------------------------------------------------------------------------
-- Copyright (c) 2016 Daniel King
--
-- 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 STM32.GPIO;
with STM32.RCC;
package body EVB1000.S1
with SPARK_Mode => Off
is
procedure Read_Switch(Switch : in Switch_Number;
State : out Bit)
is
IDR : STM32.GPIO.IDR_Field;
begin
IDR := STM32.GPIO.GPIOC_Periph.IDR.IDR;
-- The switch is 'on' when the pin is low.
State := not Bit (IDR.Arr (Integer (Switch - 3)));
end Read_Switch;
procedure Read_All(Switches : out Switch_Bit_Array)
is
IDR : STM32.GPIO.IDR_Field;
begin
IDR := STM32.GPIO.GPIOC_Periph.IDR.IDR;
-- The switch is 'on' when the pin is low.
Switches := (3 => not Bit (IDR.Arr (0)),
4 => not Bit (IDR.Arr (1)),
5 => not Bit (IDR.Arr (2)),
6 => not Bit (IDR.Arr (3)),
7 => not Bit (IDR.Arr (4)),
8 => not Bit (IDR.Arr (5)));
end Read_All;
begin
-- Enable peripheral clock
STM32.RCC.RCC_Periph.APB2ENR.IOPCEN := 1;
-- Configure GPIOs (Floating input)
STM32.GPIO.GPIOC_Periph.CRL.MODE0 := 2#00#;
STM32.GPIO.GPIOC_Periph.CRL.MODE1 := 2#00#;
STM32.GPIO.GPIOC_Periph.CRL.MODE2 := 2#00#;
STM32.GPIO.GPIOC_Periph.CRL.MODE3 := 2#00#;
STM32.GPIO.GPIOC_Periph.CRL.MODE4 := 2#00#;
STM32.GPIO.GPIOC_Periph.CRL.MODE5 := 2#00#;
STM32.GPIO.GPIOC_Periph.CRL.CNF0 := 2#01#;
STM32.GPIO.GPIOC_Periph.CRL.CNF1 := 2#01#;
STM32.GPIO.GPIOC_Periph.CRL.CNF2 := 2#01#;
STM32.GPIO.GPIOC_Periph.CRL.CNF3 := 2#01#;
STM32.GPIO.GPIOC_Periph.CRL.CNF4 := 2#01#;
STM32.GPIO.GPIOC_Periph.CRL.CNF5 := 2#01#;
end EVB1000.S1;
|
AdaCore/gpr | Ada | 1,623 | adb | --
-- Copyright (C) 2019-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--
with Ada.Strings.Fixed;
with Ada.Text_IO;
with GPR2.Context;
with GPR2.Path_Name;
with GPR2.Project.Attribute.Set;
with GPR2.Project.Source.Set;
with GPR2.Project.Source.Artifact;
with GPR2.Project.Tree;
with GPR2.Project.Variable.Set;
with GPR2.Project.View;
procedure Main is
use Ada;
use GPR2;
use GPR2.Project;
procedure Display (Prj : Project.View.Object);
procedure Output_Filename (Filename : Path_Name.Full_Name);
-------------
-- Display --
-------------
procedure Display (Prj : Project.View.Object) is
use GPR2.Project.Attribute.Set;
use GPR2.Project.Variable.Set.Set;
begin
Text_IO.Put (String (Prj.Name) & " ");
Text_IO.Set_Col (10);
Text_IO.Put_Line (Prj.Qualifier'Img);
for S of Prj.Sources loop
Text_IO.Put_Line (" " & String (S.Path_Name.Base_Name));
for A of S.Artifacts.List loop
Text_IO.Put (" "); Output_Filename (A.Value);
end loop;
end loop;
end Display;
---------------------
-- Output_Filename --
---------------------
procedure Output_Filename (Filename : Path_Name.Full_Name) is
I : constant Positive :=
Strings.Fixed.Index (Filename, "aggregate-lib-2");
begin
Text_IO.Put_Line (" > " & Filename (I + 16 .. Filename'Last));
end Output_Filename;
Prj : Project.Tree.Object;
Ctx : Context.Object;
begin
Project.Tree.Load_Autoconf (Prj, Create ("demo.gpr"), Ctx);
for P of Prj loop
Display (P);
end loop;
end Main;
|
nenofite/ada-genetic | Ada | 2,009 | ads | generic
-- Contains the genetic information which will be evolved. Often this is a
-- record of floats, with each float determining a specific parameter to be
-- optimized.
type Gene is private;
-- Determine the fitness of a gene. The greater the number returned, the
-- better this gene is.
with function Fitness_Of (G : in Gene) return Float;
-- Randomly modify this gene in a subtle way. Successful genes will be
-- mutated to explore whether subtle changes make genes which are more fit.
with procedure Mutate (G : in out Gene);
-- Create a new, completely random gene.
with function Random_Gene return Gene;
-- How many genes to keep in the pool.
Pool_Size : Positive;
package Genetic is
-- The collection of all genes currently being evolved, usually sorted from
-- most to least fit.
type Pool is private;
-- Create a pool full of random genes. It will not be sorted yet.
procedure Randomize (P : out Pool);
-- Determine the sum of each gene's fitness within the gene pool.
function Total_Fitness (P : in Pool) return Float;
-- 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);
-- Get the most fit gene from the pool. The pool must be sorted before
-- calling this.
function Best_Gene (P : in Pool) return Gene;
private
-- A gene along with cached fitness information.
type Fit_Gene is record
-- The gene.
G : Gene;
-- Whether the fitness of this gene has already been determined.
Cached : Boolean;
-- The cached fitness value. If `Cached` is false, ignore this value.
Fitness : Float;
end record;
-- An index within a gene pool.
subtype Pool_Index is Integer range 1 .. Pool_Size;
-- The actual pool type.
type Pool is array (Pool_Index) of Fit_Gene;
end Genetic;
|
AaronC98/PlaneSystem | Ada | 3,941 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2003-2015, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
package body SOAP.Dispatchers.Callback is
-----------
-- Clone --
-----------
overriding function Clone (Dispatch : Handler) return Handler is
begin
return H : Handler do
H.Schema := Dispatch.Schema.Copy;
H.HTTP_Callback := Dispatch.HTTP_Callback;
H.SOAP_Callback := Dispatch.SOAP_Callback;
end return;
end Clone;
------------
-- Create --
------------
function Create
(HTTP_Callback : AWS.Response.Callback;
SOAP_Callback : Dispatchers.SOAP_Callback;
Schema : WSDL.Schema.Definition :=
WSDL.Schema.Empty) return Handler is
begin
return (AWS.Dispatchers.Handler
with Schema, HTTP_Callback, SOAP_Callback);
end Create;
-------------------
-- Dispatch_HTTP --
-------------------
overriding function Dispatch_HTTP
(Dispatcher : Handler;
Request : AWS.Status.Data) return AWS.Response.Data is
begin
return Dispatcher.HTTP_Callback (Request);
end Dispatch_HTTP;
-------------------
-- Dispatch_SOAP --
-------------------
overriding function Dispatch_SOAP
(Dispatcher : Handler;
SOAPAction : String;
Payload : Message.Payload.Object;
Request : AWS.Status.Data) return AWS.Response.Data is
begin
return Dispatcher.SOAP_Callback (SOAPAction, Payload, Request);
end Dispatch_SOAP;
------------
-- Schema --
------------
overriding function Schema
(Dispatcher : Handler;
SOAPAction : String)
return WSDL.Schema.Definition
is
pragma Unreferenced (SOAPAction);
begin
return Dispatcher.Schema;
end Schema;
end SOAP.Dispatchers.Callback;
|
HackInvent/Ada_Drivers_Library | Ada | 39,880 | ads | -- This spec has been automatically generated from STM32H7x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.EXTI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- RTSR1_TR array
type RTSR1_TR_Field_Array is array (0 .. 21) of Boolean
with Component_Size => 1, Size => 22;
-- Type definition for RTSR1_TR
type RTSR1_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : STM32_SVD.UInt22;
when True =>
-- TR as an array
Arr : RTSR1_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 22;
for RTSR1_TR_Field use record
Val at 0 range 0 .. 21;
Arr at 0 range 0 .. 21;
end record;
-- EXTI rising trigger selection register
type RTSR1_Register is record
-- Rising trigger event configuration bit of Configurable Event input
TR : RTSR1_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR1_Register use record
TR at 0 range 0 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- FTSR1_TR array
type FTSR1_TR_Field_Array is array (0 .. 21) of Boolean
with Component_Size => 1, Size => 22;
-- Type definition for FTSR1_TR
type FTSR1_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : STM32_SVD.UInt22;
when True =>
-- TR as an array
Arr : FTSR1_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 22;
for FTSR1_TR_Field use record
Val at 0 range 0 .. 21;
Arr at 0 range 0 .. 21;
end record;
-- EXTI falling trigger selection register
type FTSR1_Register is record
-- Rising trigger event configuration bit of Configurable Event input
TR : FTSR1_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR1_Register use record
TR at 0 range 0 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- SWIER1_SWIER array
type SWIER1_SWIER_Field_Array is array (0 .. 21) of Boolean
with Component_Size => 1, Size => 22;
-- Type definition for SWIER1_SWIER
type SWIER1_SWIER_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : STM32_SVD.UInt22;
when True =>
-- SWIER as an array
Arr : SWIER1_SWIER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 22;
for SWIER1_SWIER_Field use record
Val at 0 range 0 .. 21;
Arr at 0 range 0 .. 21;
end record;
-- EXTI software interrupt event register
type SWIER1_Register is record
-- Rising trigger event configuration bit of Configurable Event input
SWIER : SWIER1_SWIER_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER1_Register use record
SWIER at 0 range 0 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- D3PMR1_MR array
type D3PMR1_MR_Field_Array is array (0 .. 15) of Boolean
with Component_Size => 1, Size => 16;
-- Type definition for D3PMR1_MR
type D3PMR1_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt16;
when True =>
-- MR as an array
Arr : D3PMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for D3PMR1_MR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- D3PMR1_MR array
type D3PMR1_MR_Field_Array_1 is array (19 .. 21) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for D3PMR1_MR
type D3PMR1_MR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt3;
when True =>
-- MR as an array
Arr : D3PMR1_MR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 3;
for D3PMR1_MR_Field_1 use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- EXTI D3 pending mask register
type D3PMR1_Register is record
-- Rising trigger event configuration bit of Configurable Event input
MR : D3PMR1_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_18 : STM32_SVD.UInt3 := 16#0#;
-- Rising trigger event configuration bit of Configurable Event input
MR_1 : D3PMR1_MR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_24 : STM32_SVD.UInt3 := 16#0#;
-- Rising trigger event configuration bit of Configurable Event input
MR25 : Boolean := False;
-- unspecified
Reserved_26_31 : STM32_SVD.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PMR1_Register use record
MR at 0 range 0 .. 15;
Reserved_16_18 at 0 range 16 .. 18;
MR_1 at 0 range 19 .. 21;
Reserved_22_24 at 0 range 22 .. 24;
MR25 at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- D3PCR1L_PCS array element
subtype D3PCR1L_PCS_Element is STM32_SVD.UInt2;
-- D3PCR1L_PCS array
type D3PCR1L_PCS_Field_Array is array (0 .. 15) of D3PCR1L_PCS_Element
with Component_Size => 2, Size => 32;
-- EXTI D3 pending clear selection register low
type D3PCR1L_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PCS as a value
Val : STM32_SVD.UInt32;
when True =>
-- PCS as an array
Arr : D3PCR1L_PCS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PCR1L_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- D3PCR1H_PCS array element
subtype D3PCR1H_PCS_Element is STM32_SVD.UInt2;
-- D3PCR1H_PCS array
type D3PCR1H_PCS_Field_Array is array (19 .. 21) of D3PCR1H_PCS_Element
with Component_Size => 2, Size => 6;
-- Type definition for D3PCR1H_PCS
type D3PCR1H_PCS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PCS as a value
Val : STM32_SVD.UInt6;
when True =>
-- PCS as an array
Arr : D3PCR1H_PCS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for D3PCR1H_PCS_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
subtype D3PCR1H_PCS25_Field is STM32_SVD.UInt2;
-- EXTI D3 pending clear selection register high
type D3PCR1H_Register is record
-- unspecified
Reserved_0_5 : STM32_SVD.UInt6 := 16#0#;
-- D3 Pending request clear input signal selection on Event input x =
-- truncate ((n+32)/2)
PCS : D3PCR1H_PCS_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_12_17 : STM32_SVD.UInt6 := 16#0#;
-- D3 Pending request clear input signal selection on Event input x =
-- truncate ((n+32)/2)
PCS25 : D3PCR1H_PCS25_Field := 16#0#;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PCR1H_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PCS at 0 range 6 .. 11;
Reserved_12_17 at 0 range 12 .. 17;
PCS25 at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- EXTI rising trigger selection register
type RTSR2_Register is record
-- unspecified
Reserved_0_16 : STM32_SVD.UInt17 := 16#0#;
-- Rising trigger event configuration bit of Configurable Event input
-- x+32
TR49 : Boolean := False;
-- unspecified
Reserved_18_18 : STM32_SVD.Bit := 16#0#;
-- Rising trigger event configuration bit of Configurable Event input
-- x+32
TR51 : Boolean := False;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR2_Register use record
Reserved_0_16 at 0 range 0 .. 16;
TR49 at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
TR51 at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- EXTI falling trigger selection register
type FTSR2_Register is record
-- unspecified
Reserved_0_16 : STM32_SVD.UInt17 := 16#0#;
-- Falling trigger event configuration bit of Configurable Event input
-- x+32
TR49 : Boolean := False;
-- unspecified
Reserved_18_18 : STM32_SVD.Bit := 16#0#;
-- Falling trigger event configuration bit of Configurable Event input
-- x+32
TR51 : Boolean := False;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR2_Register use record
Reserved_0_16 at 0 range 0 .. 16;
TR49 at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
TR51 at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- EXTI software interrupt event register
type SWIER2_Register is record
-- unspecified
Reserved_0_16 : STM32_SVD.UInt17 := 16#0#;
-- Software interrupt on line x+32
SWIER49 : Boolean := False;
-- unspecified
Reserved_18_18 : STM32_SVD.Bit := 16#0#;
-- Software interrupt on line x+32
SWIER51 : Boolean := False;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER2_Register use record
Reserved_0_16 at 0 range 0 .. 16;
SWIER49 at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
SWIER51 at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- D3PMR2_MR array
type D3PMR2_MR_Field_Array is array (34 .. 35) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for D3PMR2_MR
type D3PMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt2;
when True =>
-- MR as an array
Arr : D3PMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for D3PMR2_MR_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- D3PMR2_MR array
type D3PMR2_MR_Field_Array_1 is array (48 .. 53) of Boolean
with Component_Size => 1, Size => 6;
-- Type definition for D3PMR2_MR
type D3PMR2_MR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt6;
when True =>
-- MR as an array
Arr : D3PMR2_MR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 6;
for D3PMR2_MR_Field_1 use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- EXTI D3 pending mask register
type D3PMR2_Register is record
-- unspecified
Reserved_0_1 : STM32_SVD.UInt2 := 16#0#;
-- D3 Pending Mask on Event input x+32
MR : D3PMR2_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_4_8 : STM32_SVD.UInt5 := 16#0#;
-- D3 Pending Mask on Event input x+32
MR41 : Boolean := False;
-- unspecified
Reserved_10_15 : STM32_SVD.UInt6 := 16#0#;
-- D3 Pending Mask on Event input x+32
MR_1 : D3PMR2_MR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PMR2_Register use record
Reserved_0_1 at 0 range 0 .. 1;
MR at 0 range 2 .. 3;
Reserved_4_8 at 0 range 4 .. 8;
MR41 at 0 range 9 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
MR_1 at 0 range 16 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- D3PCR2L_PCS array element
subtype D3PCR2L_PCS_Element is STM32_SVD.UInt2;
-- D3PCR2L_PCS array
type D3PCR2L_PCS_Field_Array is array (34 .. 35) of D3PCR2L_PCS_Element
with Component_Size => 2, Size => 4;
-- Type definition for D3PCR2L_PCS
type D3PCR2L_PCS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PCS as a value
Val : STM32_SVD.UInt4;
when True =>
-- PCS as an array
Arr : D3PCR2L_PCS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for D3PCR2L_PCS_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
subtype D3PCR2L_PCS41_Field is STM32_SVD.UInt2;
-- EXTI D3 pending clear selection register low
type D3PCR2L_Register is record
-- unspecified
Reserved_0_3 : STM32_SVD.UInt4 := 16#0#;
-- D3 Pending request clear input signal selection on Event input x =
-- truncate ((n+64)/2)
PCS : D3PCR2L_PCS_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_8_17 : STM32_SVD.UInt10 := 16#0#;
-- D3 Pending request clear input signal selection on Event input x =
-- truncate ((n+64)/2)
PCS41 : D3PCR2L_PCS41_Field := 16#0#;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PCR2L_Register use record
Reserved_0_3 at 0 range 0 .. 3;
PCS at 0 range 4 .. 7;
Reserved_8_17 at 0 range 8 .. 17;
PCS41 at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- D3PCR2H_PCS array element
subtype D3PCR2H_PCS_Element is STM32_SVD.UInt2;
-- D3PCR2H_PCS array
type D3PCR2H_PCS_Field_Array is array (48 .. 53) of D3PCR2H_PCS_Element
with Component_Size => 2, Size => 12;
-- Type definition for D3PCR2H_PCS
type D3PCR2H_PCS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PCS as a value
Val : STM32_SVD.UInt12;
when True =>
-- PCS as an array
Arr : D3PCR2H_PCS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 12;
for D3PCR2H_PCS_Field use record
Val at 0 range 0 .. 11;
Arr at 0 range 0 .. 11;
end record;
-- EXTI D3 pending clear selection register high
type D3PCR2H_Register is record
-- Pending request clear input signal selection on Event input x=
-- truncate ((n+96)/2)
PCS : D3PCR2H_PCS_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_12_31 : STM32_SVD.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PCR2H_Register use record
PCS at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-- RTSR3_TR array
type RTSR3_TR_Field_Array is array (84 .. 86) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for RTSR3_TR
type RTSR3_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : STM32_SVD.UInt3;
when True =>
-- TR as an array
Arr : RTSR3_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for RTSR3_TR_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- EXTI rising trigger selection register
type RTSR3_Register is record
-- unspecified
Reserved_0_17 : STM32_SVD.UInt18 := 16#0#;
-- Rising trigger event configuration bit of Configurable Event input
-- x+64
TR82 : Boolean := False;
-- unspecified
Reserved_19_19 : STM32_SVD.Bit := 16#0#;
-- Rising trigger event configuration bit of Configurable Event input
-- x+64
TR : RTSR3_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : STM32_SVD.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR3_Register use record
Reserved_0_17 at 0 range 0 .. 17;
TR82 at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
TR at 0 range 20 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- FTSR3_TR array
type FTSR3_TR_Field_Array is array (84 .. 86) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for FTSR3_TR
type FTSR3_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : STM32_SVD.UInt3;
when True =>
-- TR as an array
Arr : FTSR3_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for FTSR3_TR_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- EXTI falling trigger selection register
type FTSR3_Register is record
-- unspecified
Reserved_0_17 : STM32_SVD.UInt18 := 16#0#;
-- Falling trigger event configuration bit of Configurable Event input
-- x+64
TR82 : Boolean := False;
-- unspecified
Reserved_19_19 : STM32_SVD.Bit := 16#0#;
-- Falling trigger event configuration bit of Configurable Event input
-- x+64
TR : FTSR3_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : STM32_SVD.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR3_Register use record
Reserved_0_17 at 0 range 0 .. 17;
TR82 at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
TR at 0 range 20 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- SWIER3_SWIER array
type SWIER3_SWIER_Field_Array is array (84 .. 86) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for SWIER3_SWIER
type SWIER3_SWIER_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : STM32_SVD.UInt3;
when True =>
-- SWIER as an array
Arr : SWIER3_SWIER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for SWIER3_SWIER_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- EXTI software interrupt event register
type SWIER3_Register is record
-- unspecified
Reserved_0_17 : STM32_SVD.UInt18 := 16#0#;
-- Software interrupt on line x+64
SWIER82 : Boolean := False;
-- unspecified
Reserved_19_19 : STM32_SVD.Bit := 16#0#;
-- Software interrupt on line x+64
SWIER : SWIER3_SWIER_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : STM32_SVD.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER3_Register use record
Reserved_0_17 at 0 range 0 .. 17;
SWIER82 at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
SWIER at 0 range 20 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- EXTI D3 pending mask register
type D3PMR3_Register is record
-- unspecified
Reserved_0_23 : STM32_SVD.UInt24 := 16#0#;
-- D3 Pending Mask on Event input x+64
MR88 : Boolean := False;
-- unspecified
Reserved_25_31 : STM32_SVD.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PMR3_Register use record
Reserved_0_23 at 0 range 0 .. 23;
MR88 at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype D3PCR3H_PCS88_Field is STM32_SVD.UInt2;
-- EXTI D3 pending clear selection register high
type D3PCR3H_Register is record
-- unspecified
Reserved_0_17 : STM32_SVD.UInt18 := 16#0#;
-- D3 Pending request clear input signal selection on Event input x=
-- truncate N+160/2
PCS88 : D3PCR3H_PCS88_Field := 16#0#;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for D3PCR3H_Register use record
Reserved_0_17 at 0 range 0 .. 17;
PCS88 at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- CPUIMR1_MR array
type CPUIMR1_MR_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- EXTI interrupt mask register
type CPUIMR1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt32;
when True =>
-- MR as an array
Arr : CPUIMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUIMR1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- CPUEMR1_MR array
type CPUEMR1_MR_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- EXTI event mask register
type CPUEMR1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt32;
when True =>
-- MR as an array
Arr : CPUEMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUEMR1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- CPUPR1_PR array
type CPUPR1_PR_Field_Array is array (0 .. 21) of Boolean
with Component_Size => 1, Size => 22;
-- Type definition for CPUPR1_PR
type CPUPR1_PR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : STM32_SVD.UInt22;
when True =>
-- PR as an array
Arr : CPUPR1_PR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 22;
for CPUPR1_PR_Field use record
Val at 0 range 0 .. 21;
Arr at 0 range 0 .. 21;
end record;
-- EXTI pending register
type CPUPR1_Register is record
-- CPU Event mask on Event input x
PR : CPUPR1_PR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUPR1_Register use record
PR at 0 range 0 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- CPUIMR2_MR array
type CPUIMR2_MR_Field_Array is array (0 .. 12) of Boolean
with Component_Size => 1, Size => 13;
-- Type definition for CPUIMR2_MR
type CPUIMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt13;
when True =>
-- MR as an array
Arr : CPUIMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 13;
for CPUIMR2_MR_Field use record
Val at 0 range 0 .. 12;
Arr at 0 range 0 .. 12;
end record;
-- CPUIMR2_MR array
type CPUIMR2_MR_Field_Array_1 is array (14 .. 31) of Boolean
with Component_Size => 1, Size => 18;
-- Type definition for CPUIMR2_MR
type CPUIMR2_MR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt18;
when True =>
-- MR as an array
Arr : CPUIMR2_MR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 18;
for CPUIMR2_MR_Field_1 use record
Val at 0 range 0 .. 17;
Arr at 0 range 0 .. 17;
end record;
-- EXTI interrupt mask register
type CPUIMR2_Register is record
-- CPU Interrupt Mask on Direct Event input x+32
MR : CPUIMR2_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_13_13 : STM32_SVD.Bit := 16#0#;
-- CPU Interrupt Mask on Direct Event input x+32
MR_1 : CPUIMR2_MR_Field_1 :=
(As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUIMR2_Register use record
MR at 0 range 0 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
MR_1 at 0 range 14 .. 31;
end record;
-- CPUEMR2_MR array
type CPUEMR2_MR_Field_Array is array (32 .. 44) of Boolean
with Component_Size => 1, Size => 13;
-- Type definition for CPUEMR2_MR
type CPUEMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt13;
when True =>
-- MR as an array
Arr : CPUEMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 13;
for CPUEMR2_MR_Field use record
Val at 0 range 0 .. 12;
Arr at 0 range 0 .. 12;
end record;
-- CPUEMR2_MR array
type CPUEMR2_MR_Field_Array_1 is array (46 .. 63) of Boolean
with Component_Size => 1, Size => 18;
-- Type definition for CPUEMR2_MR
type CPUEMR2_MR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt18;
when True =>
-- MR as an array
Arr : CPUEMR2_MR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 18;
for CPUEMR2_MR_Field_1 use record
Val at 0 range 0 .. 17;
Arr at 0 range 0 .. 17;
end record;
-- EXTI event mask register
type CPUEMR2_Register is record
-- CPU Interrupt Mask on Direct Event input x+32
MR : CPUEMR2_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_13_13 : STM32_SVD.Bit := 16#0#;
-- CPU Interrupt Mask on Direct Event input x+32
MR_1 : CPUEMR2_MR_Field_1 :=
(As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUEMR2_Register use record
MR at 0 range 0 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
MR_1 at 0 range 14 .. 31;
end record;
-- EXTI pending register
type CPUPR2_Register is record
-- unspecified
Reserved_0_16 : STM32_SVD.UInt17;
-- Read-only. Configurable event inputs x+32 Pending bit
PR49 : Boolean;
-- unspecified
Reserved_18_18 : STM32_SVD.Bit;
-- Read-only. Configurable event inputs x+32 Pending bit
PR51 : Boolean;
-- unspecified
Reserved_20_31 : STM32_SVD.UInt12;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUPR2_Register use record
Reserved_0_16 at 0 range 0 .. 16;
PR49 at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
PR51 at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- CPUIMR3_MR array
type CPUIMR3_MR_Field_Array is array (64 .. 80) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for CPUIMR3_MR
type CPUIMR3_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt17;
when True =>
-- MR as an array
Arr : CPUIMR3_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for CPUIMR3_MR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- CPUIMR3_MR array
type CPUIMR3_MR_Field_Array_1 is array (84 .. 88) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for CPUIMR3_MR
type CPUIMR3_MR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt5;
when True =>
-- MR as an array
Arr : CPUIMR3_MR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for CPUIMR3_MR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- EXTI interrupt mask register
type CPUIMR3_Register is record
-- Read-only. CPU Interrupt Mask on Direct Event input x+64
MR : CPUIMR3_MR_Field;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit;
-- Read-only. CPU Interrupt Mask on Direct Event input x+64
MR82 : Boolean;
-- unspecified
Reserved_19_19 : STM32_SVD.Bit;
-- Read-only. CPU Interrupt Mask on Direct Event input x+64
MR_1 : CPUIMR3_MR_Field_1;
-- unspecified
Reserved_25_31 : STM32_SVD.UInt7;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUIMR3_Register use record
MR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
MR82 at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
MR_1 at 0 range 20 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-- CPUEMR3_MR array
type CPUEMR3_MR_Field_Array is array (64 .. 80) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for CPUEMR3_MR
type CPUEMR3_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt17;
when True =>
-- MR as an array
Arr : CPUEMR3_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for CPUEMR3_MR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- CPUEMR3_MR array
type CPUEMR3_MR_Field_Array_1 is array (84 .. 88) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for CPUEMR3_MR
type CPUEMR3_MR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : STM32_SVD.UInt5;
when True =>
-- MR as an array
Arr : CPUEMR3_MR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for CPUEMR3_MR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- EXTI event mask register
type CPUEMR3_Register is record
-- Read-only. CPU Event mask on Event input x+64
MR : CPUEMR3_MR_Field;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit;
-- Read-only. CPU Event mask on Event input x+64
MR82 : Boolean;
-- unspecified
Reserved_19_19 : STM32_SVD.Bit;
-- Read-only. CPU Event mask on Event input x+64
MR_1 : CPUEMR3_MR_Field_1;
-- unspecified
Reserved_25_31 : STM32_SVD.UInt7;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUEMR3_Register use record
MR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
MR82 at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
MR_1 at 0 range 20 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-- CPUPR3_PR array
type CPUPR3_PR_Field_Array is array (84 .. 86) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for CPUPR3_PR
type CPUPR3_PR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : STM32_SVD.UInt3;
when True =>
-- PR as an array
Arr : CPUPR3_PR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for CPUPR3_PR_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- EXTI pending register
type CPUPR3_Register is record
-- unspecified
Reserved_0_17 : STM32_SVD.UInt18;
-- Read-only. Configurable event inputs x+64 Pending bit
PR82 : Boolean;
-- unspecified
Reserved_19_19 : STM32_SVD.Bit;
-- Read-only. Configurable event inputs x+64 Pending bit
PR : CPUPR3_PR_Field;
-- unspecified
Reserved_23_31 : STM32_SVD.UInt9;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CPUPR3_Register use record
Reserved_0_17 at 0 range 0 .. 17;
PR82 at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
PR at 0 range 20 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- External interrupt/event controller
type EXTI_Peripheral is record
-- EXTI rising trigger selection register
RTSR1 : aliased RTSR1_Register;
-- EXTI falling trigger selection register
FTSR1 : aliased FTSR1_Register;
-- EXTI software interrupt event register
SWIER1 : aliased SWIER1_Register;
-- EXTI D3 pending mask register
D3PMR1 : aliased D3PMR1_Register;
-- EXTI D3 pending clear selection register low
D3PCR1L : aliased D3PCR1L_Register;
-- EXTI D3 pending clear selection register high
D3PCR1H : aliased D3PCR1H_Register;
-- EXTI rising trigger selection register
RTSR2 : aliased RTSR2_Register;
-- EXTI falling trigger selection register
FTSR2 : aliased FTSR2_Register;
-- EXTI software interrupt event register
SWIER2 : aliased SWIER2_Register;
-- EXTI D3 pending mask register
D3PMR2 : aliased D3PMR2_Register;
-- EXTI D3 pending clear selection register low
D3PCR2L : aliased D3PCR2L_Register;
-- EXTI D3 pending clear selection register high
D3PCR2H : aliased D3PCR2H_Register;
-- EXTI rising trigger selection register
RTSR3 : aliased RTSR3_Register;
-- EXTI falling trigger selection register
FTSR3 : aliased FTSR3_Register;
-- EXTI software interrupt event register
SWIER3 : aliased SWIER3_Register;
-- EXTI D3 pending mask register
D3PMR3 : aliased D3PMR3_Register;
-- EXTI D3 pending clear selection register high
D3PCR3H : aliased D3PCR3H_Register;
-- EXTI interrupt mask register
CPUIMR1 : aliased CPUIMR1_Register;
-- EXTI event mask register
CPUEMR1 : aliased CPUEMR1_Register;
-- EXTI pending register
CPUPR1 : aliased CPUPR1_Register;
-- EXTI interrupt mask register
CPUIMR2 : aliased CPUIMR2_Register;
-- EXTI event mask register
CPUEMR2 : aliased CPUEMR2_Register;
-- EXTI pending register
CPUPR2 : aliased CPUPR2_Register;
-- EXTI interrupt mask register
CPUIMR3 : aliased CPUIMR3_Register;
-- EXTI event mask register
CPUEMR3 : aliased CPUEMR3_Register;
-- EXTI pending register
CPUPR3 : aliased CPUPR3_Register;
end record
with Volatile;
for EXTI_Peripheral use record
RTSR1 at 16#0# range 0 .. 31;
FTSR1 at 16#4# range 0 .. 31;
SWIER1 at 16#8# range 0 .. 31;
D3PMR1 at 16#C# range 0 .. 31;
D3PCR1L at 16#10# range 0 .. 31;
D3PCR1H at 16#14# range 0 .. 31;
RTSR2 at 16#20# range 0 .. 31;
FTSR2 at 16#24# range 0 .. 31;
SWIER2 at 16#28# range 0 .. 31;
D3PMR2 at 16#2C# range 0 .. 31;
D3PCR2L at 16#30# range 0 .. 31;
D3PCR2H at 16#34# range 0 .. 31;
RTSR3 at 16#40# range 0 .. 31;
FTSR3 at 16#44# range 0 .. 31;
SWIER3 at 16#48# range 0 .. 31;
D3PMR3 at 16#4C# range 0 .. 31;
D3PCR3H at 16#54# range 0 .. 31;
CPUIMR1 at 16#80# range 0 .. 31;
CPUEMR1 at 16#84# range 0 .. 31;
CPUPR1 at 16#88# range 0 .. 31;
CPUIMR2 at 16#90# range 0 .. 31;
CPUEMR2 at 16#94# range 0 .. 31;
CPUPR2 at 16#98# range 0 .. 31;
CPUIMR3 at 16#A0# range 0 .. 31;
CPUEMR3 at 16#A4# range 0 .. 31;
CPUPR3 at 16#A8# range 0 .. 31;
end record;
-- External interrupt/event controller
EXTI_Periph : aliased EXTI_Peripheral
with Import, Address => EXTI_Base;
end STM32_SVD.EXTI;
|
sungyeon/drake | Ada | 277 | adb | with System.Native_Credentials;
package body Ada.Credentials is
function User_Name return String is
begin
-- User_Name has a default parameter in Darwin, but not in Windows
return System.Native_Credentials.User_Name;
end User_Name;
end Ada.Credentials;
|
persan/advent-of-code-2020 | Ada | 135 | adb | with Ada.Text_IO; use Ada.Text_IO;
procedure Adventofcode.Day_11.Main is
begin
Put_Line ("Day-11");
end Adventofcode.Day_11.Main;
|
charlie5/aShell | Ada | 219 | adb | with
Core_Tests,
Ahven.Framework,
Ahven.Text_Runner;
procedure Test_Core
is
use Ahven;
Suite : Framework.Test_Suite := Core_Tests.Get_Test_Suite;
begin
Text_Runner.Run (Suite);
end Test_Core;
|
Gabriel-Degret/adalib | Ada | 563 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Text_IO;
package Ada.Integer_Text_IO is new Ada.Text_IO.Integer_IO (Integer);
|
skordal/ada-regex | Ada | 14,670 | adb | -- Ada regular expression library
-- (c) Kristian Klomsten Skordal 2020-2021 <[email protected]>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
separate (Regex.Regular_Expressions) procedure Parse (Input : in String; Output : in out Regular_Expression) is
use Utilities.String_Buffers;
Buffer : String_Buffer := Create (Input);
-- Parse tree generation:
function Parse_Alternation return Syntax_Tree_Node_Access;
function Parse_Expression return Syntax_Tree_Node_Access;
function Parse_Expression_Prime return Syntax_Tree_Node_Access;
function Parse_Simple_Expression return Syntax_Tree_Node_Access;
function Parse_Single_Expression return Syntax_Tree_Node_Access;
function Parse_Element return Syntax_Tree_Node_Access;
function Parse_Bracket return Syntax_Tree_Node_Access;
function Parse_Range return Syntax_Tree_Node_Access;
-- Utility functions:
function Is_Escapable (C : in Character) return Boolean;
-- Character range functions:
type Character_Range_Array is array (Positive range <>) of Character;
function Range_Contents (Range_Start, Range_End : in Character) return Character_Range_Array;
function Parse_Alternation return Syntax_Tree_Node_Access is
Left, Right : Syntax_Tree_Node_Access;
begin
Left := Parse_Expression;
if not Buffer.At_End and then Buffer.Peek = '|' then
Buffer.Discard_Next;
Right := Parse_Alternation;
if Right = null then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected expression after '|' operator";
else
declare
Retval : constant Syntax_Tree_Node_Access := Create_Node (Alternation,
Output.Get_Next_Node_Id, Left, Right);
begin
return Retval;
end;
end if;
else
return Left;
end if;
end Parse_Alternation;
function Parse_Expression return Syntax_Tree_Node_Access is
Left, Right : Syntax_Tree_Node_Access;
begin
Left := Parse_Simple_Expression;
Right := Parse_Expression_Prime;
if Right = null then
return Left;
else
declare
Retval : constant Syntax_Tree_Node_Access := Create_Node (Concatenation,
Output.Get_Next_Node_Id, Left, Right);
begin
return Retval;
end;
end if;
end Parse_Expression;
function Parse_Expression_Prime return Syntax_Tree_Node_Access is
Left, Right : Syntax_Tree_Node_Access;
begin
Left := Parse_Simple_Expression;
if Left = null then
return null;
else
Right := Parse_Expression_Prime;
if Right = null then
return Left;
else
declare
Retval : constant Syntax_Tree_Node_Access := Create_Node (Concatenation,
Output.Get_Next_Node_Id, Left, Right);
begin
return Retval;
end;
end if;
end if;
end Parse_Expression_Prime;
function Parse_Simple_Expression return Syntax_Tree_Node_Access is
Left : constant Syntax_Tree_Node_Access := Parse_Single_Expression;
begin
if not Buffer.At_End and then Buffer.Peek = '*' then
declare
Retval : constant Syntax_Tree_Node_Access := Create_Node (Node_Type => Kleene_Star,
Id => Output.Get_Next_Node_Id,
Left_Child => Left);
begin
Buffer.Discard_Next;
return Retval;
end;
elsif not Buffer.At_End and then Buffer.Peek = '+' then
declare
Optional_Branch : constant Syntax_Tree_Node_Access := Clone_Tree (Left, Output.Syntax_Tree_Node_Count);
Right : constant Syntax_Tree_Node_Access := Create_Node (Node_Type => Kleene_Star,
Id => Output.Get_Next_Node_Id,
Left_Child => Optional_Branch);
Retval : constant Syntax_Tree_Node_Access := Create_Node (Node_Type => Concatenation,
Id => Output.Get_Next_Node_Id,
Left_Child => Left,
Right_Child => Right);
begin
Buffer.Discard_Next;
return Retval;
end;
elsif not Buffer.At_End and then Buffer.Peek = '?' then
declare
Right : constant Syntax_Tree_Node_Access := Create_Node (Node_Type => Empty_Node,
Id => Output.Get_Next_Node_Id);
Retval : constant Syntax_Tree_Node_Access := Create_Node (Node_Type => Alternation,
Id => Output.Get_Next_Node_Id,
Left_Child => Left,
Right_Child => Right);
begin
Buffer.Discard_Next;
return Retval;
end;
else
return Left;
end if;
end Parse_Simple_Expression;
function Parse_Single_Expression return Syntax_Tree_Node_Access is
begin
if not Buffer.At_End and then Buffer.Peek = '(' then
Buffer.Discard_Next;
declare
Retval : constant Syntax_Tree_Node_Access := Parse_Alternation;
begin
if Buffer.At_End or else Buffer.Get_Next /= ')' then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected ')' after expression";
else
return Retval;
end if;
end;
else
return Parse_Element;
end if;
end Parse_Single_Expression;
function Parse_Element return Syntax_Tree_Node_Access is
Escaped : Boolean := False;
begin
if Buffer.At_End or else (
Buffer.Peek = '(' or
Buffer.Peek = ')' or
Buffer.Peek = '|' or
Buffer.Peek = '*' or
Buffer.Peek = '+' or
Buffer.Peek = '?' or
Buffer.Peek = '-')
then
return null;
end if;
-- Check for a character range:
if Buffer.Peek = '[' then
return Parse_Bracket;
end if;
-- Check for escaped character:
if Buffer.Peek = '\' then
Buffer.Discard_Next;
if Buffer.At_End then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected character after '\'";
elsif not Is_Escapable (Buffer.Peek) then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": invalid escaped character " & Character'Image (Buffer.Peek);
else
Escaped := True;
end if;
end if;
declare
Char : constant Character := Buffer.Get_Next;
Retval : constant Syntax_Tree_Node_Access := Create_Node (
(if not Escaped and Char = '.' then Any_Character else Single_Character),
Output.Get_Next_Node_Id);
begin
if Retval.Node_Type = Single_Character then
if Escaped then
case Char is
when 'n' =>
Retval.Char := Ada.Characters.Latin_1.LF;
when 'r' =>
Retval.Char := Ada.Characters.Latin_1.CR;
when 't' =>
Retval.Char := Ada.Characters.Latin_1.HT;
when others =>
Retval.Char := Char;
end case;
elsif Char = '$' then
Retval.Char := Ada.Characters.Latin_1.LF; -- FIXME: The $ operator currently only expands to a newline
else
Retval.Char := Char;
end if;
end if;
return Retval;
end;
end Parse_Element;
function Parse_Bracket return Syntax_Tree_Node_Access is
Retval : Syntax_Tree_Node_Access := null;
begin
if Buffer.At_End or else Buffer.Peek /= '[' then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected opening bracket '['";
end if;
-- Discard the opening '['
Buffer.Discard_Next;
declare
First_Range : constant Syntax_Tree_Node_Access := Parse_Range;
begin
Retval := First_Range;
if First_Range = null then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected character range or single character";
end if;
loop
declare
Left : constant Syntax_Tree_Node_Access := Retval;
Right : constant Syntax_Tree_Node_Access := Parse_Range;
begin
exit when Right = null;
Retval := Create_Node (Node_Type => Alternation,
Id => Output.Get_Next_Node_Id,
Left_Child => Left,
Right_Child => Right);
end;
end loop;
end;
-- Expect a closing ']':
if Buffer.At_End or else Buffer.Get_Next /= ']' then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected end bracket ']'";
end if;
return Retval;
end Parse_Bracket;
function Parse_Range return Syntax_Tree_Node_Access is
Range_Start, Range_End : Character;
begin
if Buffer.At_End or else Buffer.Peek = ']' then
return null;
end if;
Range_Start := Buffer.Get_Next;
if Buffer.At_End or else Buffer.Peek = ']' then
return Create_Node (Node_Type => Single_Character,
Id => Output.Get_Next_Node_Id,
Char => Range_Start);
elsif Buffer.Peek = '-' then
Buffer.Discard_Next;
if Buffer.At_End then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected character after '-' in range";
elsif Buffer.Peek = '\' then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": character range cannot contain escaped characters";
else
Range_End := Buffer.Get_Next;
end if;
-- "Unwrap" the range: create nodes for each character:
declare
Retval : Syntax_Tree_Node_Access := null;
begin
for C of Range_Contents (Range_Start, Range_End) loop
if Retval = null then
Retval := Create_Node (Node_Type => Single_Character,
Id => Output.Get_Next_Node_Id,
Char => C);
else
Retval := Create_Node (Node_Type => Alternation,
Id => Output.Get_Next_Node_Id,
Left_Child => Retval,
Right_Child => Create_Node (
Node_Type => Single_Character,
Id => Output.Get_Next_Node_Id,
Char => C));
end if;
end loop;
return Retval;
end;
else -- Single character
if Range_Start = '\' then
Buffer.Discard_Next;
if Buffer.At_End then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": expected escaped character";
elsif not Is_Escapable (Buffer.Peek) then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": invalid escape sequence";
end if;
return Create_Node (Node_Type => Single_Character,
Id => Output.Get_Next_Node_Id,
Char => Buffer.Get_Next);
else
return Create_Node (Node_Type => Single_Character,
Id => Output.Get_Next_Node_Id,
Char => Range_Start);
end if;
end if;
end Parse_Range;
function Is_Escapable (C : in Character) return Boolean is
begin
return C = '(' or
C = ')' or
C = '[' or
C = ']' or
C = '*' or
C = '.' or
C = '|' or
C = '\' or
C = '+' or
C = '?' or
C = '-' or
C = '$' or
C = 'r' or
C = 'n' or
C = 't';
end Is_Escapable;
function Range_Contents (Range_Start, Range_End : in Character) return Character_Range_Array is
Start_Value : constant Integer := Character'Pos (Range_Start);
End_Value : constant Integer := Character'Pos (Range_End);
begin
if Start_Value > End_Value then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": invalid character range";
end if;
return Retval : Character_Range_Array (1 .. End_Value - Start_Value + 1) do
for I in 1 .. End_Value - Start_Value + 1 loop
Retval (I) := Character'Val (Start_Value + I - 1);
end loop;
end return;
end Range_Contents;
begin
Output.Syntax_Tree := Parse_Alternation;
if not Buffer.At_End then
raise Syntax_Error with "at index " & Natural'Image (Buffer.Get_Index)
& ": invalid trailing characters after regular expression";
end if;
-- Add the acceptance node:
declare
Acceptance_Node : constant Syntax_Tree_Node_Access := Create_Node (Acceptance,
Output.Get_Next_Node_Id);
Toplevel_Node : constant Syntax_Tree_Node_Access := Create_Node (Concatenation,
Output.Get_Next_Node_Id, Output.Syntax_Tree, Acceptance_Node);
begin
Output.Syntax_Tree := Toplevel_Node;
end;
end Parse;
|
charlie5/lace | Ada | 195 | adb |
package body physics.Motor.spring is
-- child packages are based on 'open physics abstraction layer' spring motors.
procedure dummy is begin null; end;
end physics.Motor.spring;
|
jamiepg1/sdlada | Ada | 19,736 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014 Luke A. Guest
--
-- 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.
--------------------------------------------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with Interfaces.C;
with Interfaces.C.Strings;
with SDL.Error;
package body SDL.Video.Windows is
package C renames Interfaces.C;
use type C.int;
use type System.Address;
-- Private functions for accessing the internal state of a surface.
function Get_Address (Self : in SDL.Video.Surfaces.Surface) return System.Address with
Import => True,
Convention => Ada;
procedure Set_Address (Self : in out SDL.Video.Surfaces.Surface; A : in System.Address) with
Import => True,
Convention => Ada;
procedure Increment_Windows is
begin
Total_Windows_Created := Total_Windows_Created + 1;
end Increment_Windows;
procedure Decrement_Windows is
begin
Total_Windows_Created := Total_Windows_Created + 1;
end Decrement_Windows;
procedure Create
(Self : in out Window;
Title : in Ada.Strings.UTF_Encoding.UTF_8_String;
X : in Integer;
Y : in Integer;
Width : in Integer;
Height : in Integer;
Flags : in Window_Flags := OpenGL) is
function SDL_Create
(Title : C.Strings.chars_ptr;
X, Y, W, H : in C.int;
F : in Window_Flags) return System.Address with
Import => True,
Convention => C,
External_Name => "SDL_CreateWindow";
C_Title_Str : C.Strings.chars_ptr := C.Strings.New_String (Title);
begin
Self.Internal := SDL_Create (C_Title_Str, C.int (X), C.int (Y), C.int (Width), C.int (Height), Flags);
C.Strings.Free (C_Title_Str);
if Self.Internal = System.Null_Address then
raise Window_Error with SDL.Error.Get;
end if;
Increment_Windows;
end Create;
procedure Create (Self : in out Window; Native : in Native_Window) is
function SDL_Create_Window_From (Native : Native_Window) return System.Address with
Import => True,
Convention => C,
External_Name => "SDL_CreateWindowFrom";
begin
Self.Internal := SDL_Create_Window_From (Native);
if Self.Internal = System.Null_Address then
raise Window_Error with SDL.Error.Get;
end if;
Increment_Windows;
end Create;
procedure Finalize (Self : in out Window) is
procedure SDL_Destroy (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_DestroyWindow";
begin
-- Make sure we don't delete this twice!
if Self.Internal /= System.Null_Address then
SDL_Destroy (Self.Internal);
Self.Internal := System.Null_Address;
Decrement_Windows;
end if;
end Finalize;
function Get_Brightness (Self : in Window) return Brightness is
function SDL_Get_Brightness (W : in System.Address) return C.C_float With
Import => True,
Convention => C,
External_Name => "SDL_GetWindowBrightness";
begin
return Brightness (SDL_Get_Brightness (Self.Internal));
end Get_Brightness;
procedure Set_Brightness (Self : in out Window; How_Bright : in Brightness) is
function SDL_Set_Brightness (W : in System.Address; B : in C.C_float) return C.int With
Import => True,
Convention => C,
External_Name => "SDL_SetWindowBrightness";
Result : C.int := SDL_Set_Brightness (Self.Internal, C.C_float (How_Bright));
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Set_Brightness;
function To_Data_Access is new Ada.Unchecked_Conversion (Source => System.Address, Target => User_Data_Access);
function To_Address is new Ada.Unchecked_Conversion (Source => User_Data_Access, Target => System.Address);
function Get_Data (Self : in Window; Name : in String) return User_Data_Access is
function SDL_Get_Window_Data (W : in System.Address; Name : in C.Strings.chars_ptr) return System.Address with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowData";
C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Name);
Item : User_Data_Access := To_Data_Access (SDL_Get_Window_Data (Self.Internal, C_Name_Str));
begin
C.Strings.Free (C_Name_Str);
return Item;
end Get_Data;
function Set_Data (Self : in out Window; Name : in String; Item : in User_Data_Access) return User_Data_Access is
function SDL_Set_Window_Data (W : in System.Address; Name : in C.Strings.chars_ptr; User_Data : in System.address)
return System.Address with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowData";
C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Name);
Previous_Data : User_Data_Access := To_Data_Access (SDL_Set_Window_Data (Self.Internal, C_Name_Str, To_Address (Item)));
begin
C.Strings.Free (C_Name_Str);
return Previous_Data;
end Set_Data;
function Display_Index (Self : in Window) return Positive is
function SDL_Get_Window_Display_Index (W : in System.Address) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowDisplayIndex";
Total : C.int := SDL_Get_Window_Display_Index (Self.Internal);
begin
if Total < 0 then
raise Window_Error with SDL.Error.Get;
end if;
return Positive (Total);
end Display_Index;
procedure Get_Display_Mode (Self : in Window; Mode : out SDL.Video.Displays.Mode) is
function SDL_Get_Window_Display_Mode (W : in System.Address; M : out SDL.Video.Displays.Mode) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowDisplayMode";
Result : C.int := SDL_Get_Window_Display_Mode (Self.Internal, Mode);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Get_Display_Mode;
procedure Set_Display_Mode (Self : in out Window; Mode : in SDL.Video.Displays.Mode) is
function SDL_Set_Window_Display_Mode (W : in System.Address; M : in SDL.Video.Displays.Mode) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowDisplayMode";
Result : C.int := SDL_Set_Window_Display_Mode (Self.Internal, Mode);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Set_Display_Mode;
function Get_Flags (Self : in Window) return Window_Flags is
function SDL_Get_Window_Flags (W : in System.Address) return Window_Flags with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowFlags";
begin
return SDL_Get_Window_Flags (Self.Internal);
end Get_Flags;
function From_ID (Window_ID : in ID) return Window is
function SDL_Get_Window_From_ID (W : in ID) return System.Address with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowFromID";
begin
return W : constant Window :=
(Ada.Finalization.Limited_Controlled with Internal => SDL_Get_Window_From_ID (Window_ID))
do
null;
end return;
end From_ID;
procedure Get_Gamma_Ramp (Self : in Window; Red, Green, Blue : out SDL.Video.Pixel_Formats.Gamma_Ramp) is
function SDL_Get_Window_Gamma_Ramp (W : in System.Address; R, G, B : out SDL.Video.Pixel_Formats.Gamma_Ramp)
return C.int with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowGammaRamp";
Result : C.int := SDL_Get_Window_Gamma_Ramp (Self.Internal, Red, Green, Blue);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Get_Gamma_Ramp;
procedure Set_Gamma_Ramp (Self : in out Window; Red, Green, Blue : in SDL.Video.Pixel_Formats.Gamma_Ramp) is
function SDL_Set_Window_Gamma_Ramp (W : in System.Address; R, G, B : in SDL.Video.Pixel_Formats.Gamma_Ramp)
return C.int with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowGammaRamp";
Result : C.int := SDL_Set_Window_Gamma_Ramp (Self.Internal, Red, Green, Blue);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Set_Gamma_Ramp;
function Is_Grabbed (Self : in Window) return Boolean is
function SDL_Get_Window_Grab (W : in System.Address) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowGrab";
begin
return (SDL_Get_Window_Grab(Self.Internal) = SDL_True);
end Is_Grabbed;
procedure Set_Grabbed (Self : in out Window; Grabbed : in Boolean := True) is
procedure SDL_Set_Window_Grab (W : in System.Address; G : in C.int) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowGrab";
begin
SDL_Set_Window_Grab (Self.Internal, (if Grabbed = True then SDL_True else SDL_False));
end Set_Grabbed;
function Get_ID (Self : in Window) return ID is
function SDL_Get_Window_ID (W : in System.Address) return ID with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowID";
begin
return SDL_Get_Window_ID (Self.Internal);
end Get_ID;
function Get_Maximum_Size (Self : in Window) return Sizes is
procedure SDL_Get_Window_Maximum_Size (Win : in System.Address; W, H : out C.int) with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowMaximumSize";
W, H : C.int := 0;
begin
SDL_Get_Window_Maximum_Size (Self.Internal, W, H);
return Sizes'(Width => Positive (W), height => Positive (H));
end Get_Maximum_Size;
procedure Set_Maximum_Size (Self : in out Window; Size : in Sizes) is
procedure SDL_Get_Window_Maximum_Size (Win : in System.Address; W, H : in C.int) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowMaximumSize";
begin
SDL_Get_Window_Maximum_Size (Self.Internal, C.int (Size.Width), C.int (Size.Height));
end Set_Maximum_Size;
function Get_Minimum_Size (Self : in Window) return Sizes is
procedure SDL_Get_Window_Minimum_Size (Win : in System.Address; W, H : out C.int) with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowMinimumSize";
W, H : C.int := 0;
begin
SDL_Get_Window_Minimum_Size (Self.Internal, W, H);
return Sizes'(Width => Positive (W), height => Positive (H));
end Get_Minimum_Size;
procedure Set_Minimum_Size (Self : in out Window; Size : in Sizes) is
procedure SDL_Get_Window_Minimum_Size (Win : in System.Address; W, H : in C.int) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowMinimumSize";
begin
SDL_Get_Window_Minimum_Size (Self.Internal, C.int (Size.Width), C.int (Size.Height));
end Set_Minimum_Size;
function Pixel_Format (Self : in Window) return SDL.Video.Pixel_Formats.Pixel_Format is
function SDL_Get_Window_Pixel_Format (W : in System.Address) return SDL.Video.Pixel_Formats.Pixel_Format with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowPixelFormat";
begin
return SDL_Get_Window_Pixel_Format (Self.Internal);
end Pixel_Format;
function Get_Position (Self : in Window) return Positions is
procedure SDL_Get_Window_Position (W : in System.Address; X, Y : out C.int) with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowPosition";
X, Y : C.int := 0;
begin
SDL_Get_Window_Position (Self.Internal, X, Y);
return Positions'(Positive (X), Positive (Y));
end Get_Position;
procedure Set_Position (Self : in out window; Position : Positions) is
procedure SDL_Set_Window_Position (W : in System.Address; X, Y : in C.int) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowPosition";
begin
SDL_Set_Window_Position (Self.Internal, C.int (Position.X), C.int (Position.Y));
end Set_Position;
function Get_Size (Self : in Window) return Sizes is
procedure SDL_Get_Window_Size (Win : in System.Address; W, H : out C.int) with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowSize";
W, H : C.int := 0;
begin
SDL_Get_Window_Size (Self.Internal, W, H);
return Sizes'(Width => Positive (W), height => Positive (H));
end Get_Size;
procedure Set_Size (Self : in out Window; Size : in Sizes) is
procedure SDL_Get_Window_Size (Win : in System.Address; W, H : in C.int) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowSize";
begin
SDL_Get_Window_Size (Self.Internal, C.int (Size.Width), C.int (Size.Height));
end Set_Size;
procedure Get_Surface (Self : in Window; Surface : out SDL.Video.Surfaces.Surface) is
function SDL_Get_Window_Surface (W : in System.Address) return System.Address with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowSurface";
A : System.Address := SDL_Get_Window_Surface (Self.Internal);
begin
if A = System.Null_Address then
raise Window_Error with SDL.Error.Get;
end if;
Set_Address (Surface, A);
end Get_Surface;
function Get_Title (Self : in Window) return Ada.Strings.UTF_Encoding.UTF_8_String is
function SDL_Get_Window_Title (W : in System.Address) return C.Strings.chars_Ptr with
Import => True,
Convention => C,
External_Name => "SDL_GetWindowTitle";
begin
return C.Strings.Value (SDL_Get_Window_Title (Self.Internal));
end Get_Title;
procedure Set_Title (Self : in Window; Title : in Ada.Strings.UTF_Encoding.UTF_8_String) is
procedure SDL_Set_Window_Title (W : in System.Address; C_Str : in C.char_Array) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowTitle";
begin
SDL_Set_Window_Title (Self.Internal, C.To_C (Title));
end Set_Title;
procedure Hide (Self : in Window) is
procedure SDL_Hide_Window (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_HideWindow";
begin
SDL_Hide_Window (Self.Internal);
end Hide;
procedure Show (Self : in Window) is
procedure SDL_Show_Window (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_ShowWindow";
begin
SDL_Show_Window (Self.Internal);
end Show;
procedure Maximise (Self : in Window) is
procedure SDL_Maximise_Window (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_MaximizeWindow";
begin
SDL_Maximise_Window (Self.Internal);
end Maximise;
procedure Minimise (Self : in Window) is
procedure SDL_Minimise_Window (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_MinimizeWindow";
begin
SDL_Minimise_Window (Self.Internal);
end Minimise;
procedure Raise_And_Focus (Self : in Window) is
procedure SDL_Raise_Window (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_RaiseWindow";
begin
SDL_Raise_Window (Self.Internal);
end Raise_And_Focus;
procedure Restore (Self : in Window) is
procedure SDL_Restore_Window (W : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_RestoreWindow";
begin
SDL_Restore_Window (Self.Internal);
end Restore;
procedure Set_Mode (Self : in out Window; Flags : in Full_Screen_Flags) is
function SDL_Window_Full_Screen (W : in System.Address; F : in Full_Screen_Flags) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowFullscreen";
Result : C.int := SDL_Window_Full_Screen (Self.Internal, Flags);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Set_Mode;
procedure Set_Icon (Self : in out Window; Icon : in SDL.Video.Surfaces.Surface) is
procedure SDL_Set_Window_Icon (W, I : in System.Address) with
Import => True,
Convention => C,
External_Name => "SDL_SetWindowIcon";
begin
SDL_Set_Window_Icon (Self.Internal, Get_Address (Icon));
end Set_Icon;
procedure Update_Surface (Self : in Window) is
function SDL_Update_Window_Surface (W : in System.Address) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_UpdateWindowSurface";
Result : C.int := SDL_Update_Window_Surface (Self.Internal);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Update_Surface;
procedure Update_Surface_Rectangles (Self : in Window; Rectangles : SDL.Video.Rectangles.Rectangle_Arrays) is
function SDL_Update_Window_Surface_Rects (W : in System.Address;
R : in SDL.Video.Rectangles.Rectangle_Arrays;
L : in C.int) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_UpdateWindowSurfaceRects";
Result : C.int := SDL_Update_Window_Surface_Rects (Self.Internal, Rectangles, Rectangles'Length);
begin
if Result /= Success then
raise Window_Error with SDL.Error.Get;
end if;
end Update_Surface_Rectangles;
function Exist return Boolean is
begin
if Total_Windows_Created /= Natural'First then
return True;
end if;
return False;
end Exist;
function Get_Address (Self : in Window) return System.Address is
begin
return Self.Internal;
end Get_Address;
end SDL.Video.Windows;
|
AdaCore/Ada_Drivers_Library | Ada | 6,666 | ads | -- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.NVIC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype ICTR_INTLINESNUM_Field is HAL.UInt4;
-- Interrupt Controller Type Register
type ICTR_Register is record
-- Read-only. Total number of interrupt lines in groups
INTLINESNUM : ICTR_INTLINESNUM_Field;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICTR_Register use record
INTLINESNUM at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- IPR_IPR_N array element
subtype IPR_IPR_N_Element is HAL.UInt8;
-- IPR_IPR_N array
type IPR_IPR_N_Field_Array is array (0 .. 3) of IPR_IPR_N_Element
with Component_Size => 8, Size => 32;
-- Interrupt Priority Register
type IPR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- IPR_N as a value
Val : HAL.UInt32;
when True =>
-- IPR_N as an array
Arr : IPR_IPR_N_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for IPR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
subtype STIR_INTID_Field is HAL.UInt9;
-- Software Triggered Interrupt Register
type STIR_Register is record
-- Write-only. interrupt to be triggered
INTID : STIR_INTID_Field := 16#0#;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for STIR_Register use record
INTID at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Nested Vectored Interrupt Controller
type NVIC_Peripheral is record
-- Interrupt Controller Type Register
ICTR : aliased ICTR_Register;
-- Interrupt Set-Enable Register
ISER0 : aliased HAL.UInt32;
-- Interrupt Set-Enable Register
ISER1 : aliased HAL.UInt32;
-- Interrupt Set-Enable Register
ISER2 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER0 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER1 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER2 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR0 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR1 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR2 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR0 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR1 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR2 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR0 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR1 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR2 : aliased HAL.UInt32;
-- Interrupt Priority Register
IPR0 : aliased IPR_Register;
-- Interrupt Priority Register
IPR1 : aliased IPR_Register;
-- Interrupt Priority Register
IPR2 : aliased IPR_Register;
-- Interrupt Priority Register
IPR3 : aliased IPR_Register;
-- Interrupt Priority Register
IPR4 : aliased IPR_Register;
-- Interrupt Priority Register
IPR5 : aliased IPR_Register;
-- Interrupt Priority Register
IPR6 : aliased IPR_Register;
-- Interrupt Priority Register
IPR7 : aliased IPR_Register;
-- Interrupt Priority Register
IPR8 : aliased IPR_Register;
-- Interrupt Priority Register
IPR9 : aliased IPR_Register;
-- Interrupt Priority Register
IPR10 : aliased IPR_Register;
-- Interrupt Priority Register
IPR11 : aliased IPR_Register;
-- Interrupt Priority Register
IPR12 : aliased IPR_Register;
-- Interrupt Priority Register
IPR13 : aliased IPR_Register;
-- Interrupt Priority Register
IPR14 : aliased IPR_Register;
-- Interrupt Priority Register
IPR15 : aliased IPR_Register;
-- Interrupt Priority Register
IPR16 : aliased IPR_Register;
-- Interrupt Priority Register
IPR17 : aliased IPR_Register;
-- Interrupt Priority Register
IPR18 : aliased IPR_Register;
-- Interrupt Priority Register
IPR19 : aliased IPR_Register;
-- Software Triggered Interrupt Register
STIR : aliased STIR_Register;
end record
with Volatile;
for NVIC_Peripheral use record
ICTR at 16#4# range 0 .. 31;
ISER0 at 16#100# range 0 .. 31;
ISER1 at 16#104# range 0 .. 31;
ISER2 at 16#108# range 0 .. 31;
ICER0 at 16#180# range 0 .. 31;
ICER1 at 16#184# range 0 .. 31;
ICER2 at 16#188# range 0 .. 31;
ISPR0 at 16#200# range 0 .. 31;
ISPR1 at 16#204# range 0 .. 31;
ISPR2 at 16#208# range 0 .. 31;
ICPR0 at 16#280# range 0 .. 31;
ICPR1 at 16#284# range 0 .. 31;
ICPR2 at 16#288# range 0 .. 31;
IABR0 at 16#300# range 0 .. 31;
IABR1 at 16#304# range 0 .. 31;
IABR2 at 16#308# range 0 .. 31;
IPR0 at 16#400# range 0 .. 31;
IPR1 at 16#404# range 0 .. 31;
IPR2 at 16#408# range 0 .. 31;
IPR3 at 16#40C# range 0 .. 31;
IPR4 at 16#410# range 0 .. 31;
IPR5 at 16#414# range 0 .. 31;
IPR6 at 16#418# range 0 .. 31;
IPR7 at 16#41C# range 0 .. 31;
IPR8 at 16#420# range 0 .. 31;
IPR9 at 16#424# range 0 .. 31;
IPR10 at 16#428# range 0 .. 31;
IPR11 at 16#42C# range 0 .. 31;
IPR12 at 16#430# range 0 .. 31;
IPR13 at 16#434# range 0 .. 31;
IPR14 at 16#438# range 0 .. 31;
IPR15 at 16#43C# range 0 .. 31;
IPR16 at 16#440# range 0 .. 31;
IPR17 at 16#444# range 0 .. 31;
IPR18 at 16#448# range 0 .. 31;
IPR19 at 16#44C# range 0 .. 31;
STIR at 16#F00# range 0 .. 31;
end record;
-- Nested Vectored Interrupt Controller
NVIC_Periph : aliased NVIC_Peripheral
with Import, Address => System'To_Address (16#E000E000#);
end STM32_SVD.NVIC;
|
Rodeo-McCabe/orka | Ada | 1,304 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <[email protected]>
--
-- 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 GL.Helpers is
function Float_Array (Value : Colors.Color) return Low_Level.Single_Array is
use GL.Types.Colors;
begin
return Low_Level.Single_Array'(1 => Value (R),
2 => Value (G),
3 => Value (B),
4 => Value (A));
end Float_Array;
function Color (Value : Low_Level.Single_Array) return Colors.Color is
use GL.Types.Colors;
begin
return Colors.Color'(R => Value (1), G => Value (2), B => Value (3),
A => Value (4));
end Color;
end GL.Helpers;
|
reznikmm/matreshka | Ada | 5,328 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- 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.Generic_Collections;
package AMF.UMLDI.UML_Redefines_Labels.Collections is
pragma Preelaborate;
package UMLDI_UML_Redefines_Label_Collections is
new AMF.Generic_Collections
(UMLDI_UML_Redefines_Label,
UMLDI_UML_Redefines_Label_Access);
type Set_Of_UMLDI_UML_Redefines_Label is
new UMLDI_UML_Redefines_Label_Collections.Set with null record;
Empty_Set_Of_UMLDI_UML_Redefines_Label : constant Set_Of_UMLDI_UML_Redefines_Label;
type Ordered_Set_Of_UMLDI_UML_Redefines_Label is
new UMLDI_UML_Redefines_Label_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UMLDI_UML_Redefines_Label : constant Ordered_Set_Of_UMLDI_UML_Redefines_Label;
type Bag_Of_UMLDI_UML_Redefines_Label is
new UMLDI_UML_Redefines_Label_Collections.Bag with null record;
Empty_Bag_Of_UMLDI_UML_Redefines_Label : constant Bag_Of_UMLDI_UML_Redefines_Label;
type Sequence_Of_UMLDI_UML_Redefines_Label is
new UMLDI_UML_Redefines_Label_Collections.Sequence with null record;
Empty_Sequence_Of_UMLDI_UML_Redefines_Label : constant Sequence_Of_UMLDI_UML_Redefines_Label;
private
Empty_Set_Of_UMLDI_UML_Redefines_Label : constant Set_Of_UMLDI_UML_Redefines_Label
:= (UMLDI_UML_Redefines_Label_Collections.Set with null record);
Empty_Ordered_Set_Of_UMLDI_UML_Redefines_Label : constant Ordered_Set_Of_UMLDI_UML_Redefines_Label
:= (UMLDI_UML_Redefines_Label_Collections.Ordered_Set with null record);
Empty_Bag_Of_UMLDI_UML_Redefines_Label : constant Bag_Of_UMLDI_UML_Redefines_Label
:= (UMLDI_UML_Redefines_Label_Collections.Bag with null record);
Empty_Sequence_Of_UMLDI_UML_Redefines_Label : constant Sequence_Of_UMLDI_UML_Redefines_Label
:= (UMLDI_UML_Redefines_Label_Collections.Sequence with null record);
end AMF.UMLDI.UML_Redefines_Labels.Collections;
|
ulises-jeremias/informatica-unlp | Ada | 1,132 | adb | procedure Estadistica is
task type Sede is
entry calcularCantidadParaEnfermedad(e: IN String);
end Sede;
type Sedes is array(1..15) of Sede;
task Central is
entry enviarCantidad(cant: IN Integer);
end Central;
task Central is
e: String;
total: Integer := 0;
cant: Integer;
begin
loop
e := ElegirEnfermedad();
for I in 1..15 loop
Sedes(I).calcularCantidadParaEnfermedad(e);
end loop;
for I in 1..15 loop
accept enviarCantidad(cant: IN Integer) is
total += cantidad;
end;
end loop;
end loop;
end;
task Sede is
cant: Integer;
begin
loop
accept calcularCantidadParaEnfermedad(e: IN String);
cant := ElegirEnfermedad(e);
Central.enviarCantidad(cant);
end loop;
end;
begin -- ${1/([a-zA-Z0-9_]*).*$/Estadistica/}
null;
end ${1/([a-zA-Z0-9_]*).*$/Estadistica/};
|
zhmu/ananas | Ada | 3,895 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 3 4 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, 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. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 34
package System.Pack_34 is
pragma Preelaborate;
Bits : constant := 34;
type Bits_34 is mod 2 ** Bits;
for Bits_34'Size use Bits;
-- In all subprograms below, Rev_SSO is set True if the array has the
-- non-default scalar storage order.
function Get_34
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_34 with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_34
(Arr : System.Address;
N : Natural;
E : Bits_34;
Rev_SSO : Boolean) with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
function GetU_34
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_34 with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned. This version
-- is used when Arr may represent an unaligned address.
procedure SetU_34
(Arr : System.Address;
N : Natural;
E : Bits_34;
Rev_SSO : Boolean) with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value. This version
-- is used when Arr may represent an unaligned address
end System.Pack_34;
|
ytomino/zlib-ada | Ada | 2,134 | adb | with Ada.Command_Line;
with Ada.Streams;
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with zlib.Strings;
procedure test_strings is
use type Ada.Streams.Stream_Element_Offset;
Verbose : Boolean := False;
Text : constant String := "Hello, zlib!";
Buffer : Ada.Streams.Stream_Element_Array (0 .. 1023);
Buffer_Last : Ada.Streams.Stream_Element_Offset := Buffer'First - 1;
Extracted : String (1 .. 1024);
Extracted_Last : Natural := Extracted'First - 1;
begin
for I in 1 .. Ada.Command_Line.Argument_Count loop
if Ada.Command_Line.Argument (I) = "-v" then
Verbose := True;
end if;
end loop;
declare
Stream : zlib.Stream := zlib.Deflate_Init (Header => zlib.GZip);
Text_Last : Natural := Text'First - 1;
Finished : Boolean;
begin
loop
zlib.Strings.Deflate (
Stream,
Text (Text_Last + 1 .. Text'Last),
Text_Last,
Buffer (Buffer_Last + 1 .. Buffer'Last),
Buffer_Last,
Finish => True,
Finished => Finished);
exit when Finished;
end loop;
end;
declare
Stream : zlib.Stream := zlib.Inflate_Init (Header => zlib.GZip);
Infl_Buffer_Last : Ada.Streams.Stream_Element_Offset := Buffer'First - 1;
Finished : Boolean;
begin
loop
zlib.Strings.Inflate (
Stream,
Buffer (Infl_Buffer_Last + 1 .. Buffer_Last),
Infl_Buffer_Last,
Extracted (Extracted_Last + 1 .. Extracted'Last),
Extracted_Last,
Finish => True,
Finished => Finished);
exit when Finished;
end loop;
end;
declare
use Ada.Text_IO, Ada.Integer_Text_IO;
Compressed_Length : constant Natural :=
Integer (Buffer_Last - Buffer'First + 1);
Extracted_Length : constant Natural := Extracted_Last - Extracted'First + 1;
begin
if Verbose then
Ada.Integer_Text_IO.Default_Width := 0;
Put ("source length = ");
Put (Text'Length);
New_Line;
Put ("compressed length = ");
Put (Compressed_Length);
New_Line;
Put ("extracted length = ");
Put (Extracted_Length);
New_Line;
end if;
pragma Assert (Extracted (Extracted'First .. Extracted_Last) = Text);
end;
-- finish
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error.all, "ok");
end test_strings;
|
stcarrez/helios | Ada | 4,312 | adb | -----------------------------------------------------------------------
-- helios-monitor -- Helios monitor
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- 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 Helios.Tools.Files;
package body Helios.Monitor.CPU is
-- ------------------------------
-- Start the agent and build the definition tree.
-- ------------------------------
overriding
procedure Start (Agent : in out Agent_Type;
Config : in Util.Properties.Manager) is
Values : constant String := Config.Get ("values");
begin
Agent.User_Time := Agent.Create_Definition ("user", Values);
Agent.Nice_Time := Agent.Create_Definition ("nice", Values);
Agent.Sys_Time := Agent.Create_Definition ("system", Values);
Agent.Idle_Time := Agent.Create_Definition ("idle", Values);
Agent.Iowait_Time := Agent.Create_Definition ("iowait", Values);
Agent.Irq_Time := Agent.Create_Definition ("irq", Values);
Agent.Softirq_Time := Agent.Create_Definition ("softirq", Values);
Agent.Steal_Time := Agent.Create_Definition ("steal", Values);
Agent.Guest_Time := Agent.Create_Definition ("guest", Values);
Agent.Guest_Nice_Time := Agent.Create_Definition ("guest_nice", Values);
Agent.Ctx_Count := Agent.Create_Definition ("context", Values);
Agent.Processes_Count := Agent.Create_Definition ("processes", Values);
Agent.Blocked_Count := Agent.Create_Definition ("procs_blocked", Values);
Agent.Running_Count := Agent.Create_Definition ("procs_running", Values);
Agent.Softirq_Count := Agent.Create_Definition ("softirq_count", Values);
Agent.Intr_Count := Agent.Create_Definition ("intr", Values);
end Start;
-- ------------------------------
-- Collect the values in the snapshot.
-- ------------------------------
overriding
procedure Collect (Agent : in out Agent_Type;
Values : in out Datas.Snapshot_Type) is
Line : Helios.Tools.Files.File_Extractor;
begin
Line.Open ("/proc/stat");
loop
Line.Read;
exit when Line.Is_Eof;
if Line.Is_Field ("cpu") then
Values.Set_Value (Agent.User_Time, Line.Get_Value (2));
Values.Set_Value (Agent.Nice_Time, Line.Get_Value (3));
Values.Set_Value (Agent.Sys_Time, Line.Get_Value (4));
Values.Set_Value (Agent.Idle_Time, Line.Get_Value (5));
Values.Set_Value (Agent.Iowait_Time, Line.Get_Value (6));
Values.Set_Value (Agent.Irq_Time, Line.Get_Value (7));
Values.Set_Value (Agent.Softirq_Time, Line.Get_Value (8));
Values.Set_Value (Agent.Steal_Time, Line.Get_Value (9));
Values.Set_Value (Agent.Guest_Time, Line.Get_Value (10));
Values.Set_Value (Agent.Guest_Nice_Time, Line.Get_Value (11));
elsif Line.Is_Field ("ctxt") then
Values.Set_Value (Agent.Ctx_Count, Line.Get_Value (2));
elsif Line.Is_Field ("processes") then
Values.Set_Value (Agent.Processes_Count, Line.Get_Value (2));
elsif Line.Is_Field ("softirq") then
Values.Set_Value (Agent.Softirq_Count, Line.Get_Value (2));
elsif Line.Is_Field ("procs_running") then
Values.Set_Value (Agent.Running_Count, Line.Get_Value (2));
elsif Line.Is_Field ("procs_blocked") then
Values.Set_Value (Agent.Blocked_Count, Line.Get_Value (2));
elsif Line.Is_Field ("intr") then
Values.Set_Value (Agent.Intr_Count, Line.Get_Value (2));
end if;
end loop;
end Collect;
end Helios.Monitor.CPU;
|
reznikmm/gela | Ada | 1,871 | ads | ------------------------------------------------------------------------------
-- G E L A G R A M M A R S --
-- Library for dealing with tests for for Gela project, --
-- a portable Ada compiler --
-- http://gela.ada-ru.org/ --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license in gela.ads file --
------------------------------------------------------------------------------
package Gela.Test_Cases.Base is
type Test_Case is abstract new Test_Cases.Test_Case with private;
type Test_Case_Access is access all Test_Case'Class;
not overriding procedure Execute (Self : in out Test_Case) is abstract;
overriding procedure Run (Self : in out Test_Case);
overriding function Duration
(Self : Test_Case) return League.Calendars.Time;
overriding function Name
(Self : Test_Case) return League.Strings.Universal_String;
overriding function Fixture
(Self : Test_Case) return League.Strings.Universal_String;
overriding function File
(Self : Test_Case) return League.Strings.Universal_String;
type Base_Information is record
Name : League.Strings.Universal_String;
Fixture : League.Strings.Universal_String;
File : League.Strings.Universal_String;
end record;
No_Info : constant Base_Information;
procedure Set_Information
(Self : in out Test_Case;
Info : Base_Information);
private
type Test_Case is abstract new Test_Cases.Test_Case with record
Info : Base_Information;
Spent : League.Calendars.Time;
end record;
No_Info : constant Base_Information := (others => <>);
end Gela.Test_Cases.Base;
|
damaki/libkeccak | Ada | 4,379 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- 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.
-- * The name of the copyright holder may not 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 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 Keccak.Generic_Parallel_Sponge;
with Keccak.Padding;
pragma Elaborate_All (Keccak.Generic_Parallel_Sponge);
package Keccak.Parallel_Keccak_1600.Rounds_24
with SPARK_Mode => On
is
procedure Permute_All_P2 is new KeccakF_1600_P2.Permute_All
(First_Round => 0,
Num_Rounds => 24);
procedure Permute_All_P4 is new KeccakF_1600_P4.Permute_All
(Permute_All_P2);
procedure Permute_All_P8 is new KeccakF_1600_P8.Permute_All
(Permute_All_P2);
package Parallel_Sponge_P2 is new Keccak.Generic_Parallel_Sponge
(State_Size => 1600,
State_Type => KeccakF_1600_P2.Parallel_State,
Parallelism => 2,
Init => KeccakF_1600_P2.Init,
Permute_All => Permute_All_P2,
XOR_Bits_Into_State_Separate => KeccakF_1600_P2.XOR_Bits_Into_State_Separate,
XOR_Bits_Into_State_All => KeccakF_1600_P2.XOR_Bits_Into_State_All,
Extract_Bytes => KeccakF_1600_P2.Extract_Bytes,
Pad => Keccak.Padding.Pad101_Single_Block,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
package Parallel_Sponge_P4 is new Keccak.Generic_Parallel_Sponge
(State_Size => 1600,
State_Type => KeccakF_1600_P4.Parallel_State,
Parallelism => 4,
Init => KeccakF_1600_P4.Init,
Permute_All => Permute_All_P4,
XOR_Bits_Into_State_Separate => KeccakF_1600_P4.XOR_Bits_Into_State_Separate,
XOR_Bits_Into_State_All => KeccakF_1600_P4.XOR_Bits_Into_State_All,
Extract_Bytes => KeccakF_1600_P4.Extract_Bytes,
Pad => Keccak.Padding.Pad101_Single_Block,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
package Parallel_Sponge_P8 is new Keccak.Generic_Parallel_Sponge
(State_Size => 1600,
State_Type => KeccakF_1600_P8.Parallel_State,
Parallelism => 8,
Init => KeccakF_1600_P8.Init,
Permute_All => Permute_All_P8,
XOR_Bits_Into_State_Separate => KeccakF_1600_P8.XOR_Bits_Into_State_Separate,
XOR_Bits_Into_State_All => KeccakF_1600_P8.XOR_Bits_Into_State_All,
Extract_Bytes => KeccakF_1600_P8.Extract_Bytes,
Pad => Keccak.Padding.Pad101_Single_Block,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
end Keccak.Parallel_Keccak_1600.Rounds_24;
|
AaronC98/PlaneSystem | Ada | 2,612 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2012-2014, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with Interfaces.C;
package AWS.Net.SSL.Certificate.Impl is
function Get (Socket : Socket_Type) return Object;
-- Read certificate from peer socket
function Load (Filename : String) return Object;
-- Load certificate data from file
function Status_String (Status : Interfaces.C.long) return String;
-- Returns the message string for status
end AWS.Net.SSL.Certificate.Impl;
|
AdaCore/training_material | Ada | 11,970 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
limited with SDL_SDL_version_h;
with Interfaces.C.Strings;
with System;
limited with SDL_SDL_rwops_h;
with SDL_SDL_stdinc_h;
with SDL_SDL_video_h;
package SDL_SDL_ttf_h is
SDL_TTF_MAJOR_VERSION : constant := 2; -- ../include/SDL/SDL_ttf.h:40
SDL_TTF_MINOR_VERSION : constant := 0; -- ../include/SDL/SDL_ttf.h:41
SDL_TTF_PATCHLEVEL : constant := 11; -- ../include/SDL/SDL_ttf.h:42
-- arg-macro: procedure SDL_TTF_VERSION (X)
-- { (X).major := SDL_TTF_MAJOR_VERSION; (X).minor := SDL_TTF_MINOR_VERSION; (X).patch := SDL_TTF_PATCHLEVEL; }
-- unsupported macro: TTF_MAJOR_VERSION SDL_TTF_MAJOR_VERSION
-- unsupported macro: TTF_MINOR_VERSION SDL_TTF_MINOR_VERSION
-- unsupported macro: TTF_PATCHLEVEL SDL_TTF_PATCHLEVEL
-- arg-macro: procedure TTF_VERSION (X)
-- SDL_TTF_VERSION(X)
UNICODE_BOM_NATIVE : constant := 16#FEFF#; -- ../include/SDL/SDL_ttf.h:67
UNICODE_BOM_SWAPPED : constant := 16#FFFE#; -- ../include/SDL/SDL_ttf.h:68
TTF_STYLE_NORMAL : constant := 16#00#; -- ../include/SDL/SDL_ttf.h:92
TTF_STYLE_BOLD : constant := 16#01#; -- ../include/SDL/SDL_ttf.h:93
TTF_STYLE_ITALIC : constant := 16#02#; -- ../include/SDL/SDL_ttf.h:94
TTF_STYLE_UNDERLINE : constant := 16#04#; -- ../include/SDL/SDL_ttf.h:95
TTF_STYLE_STRIKETHROUGH : constant := 16#08#; -- ../include/SDL/SDL_ttf.h:96
TTF_HINTING_NORMAL : constant := 0; -- ../include/SDL/SDL_ttf.h:103
TTF_HINTING_LIGHT : constant := 1; -- ../include/SDL/SDL_ttf.h:104
TTF_HINTING_MONO : constant := 2; -- ../include/SDL/SDL_ttf.h:105
TTF_HINTING_NONE : constant := 3; -- ../include/SDL/SDL_ttf.h:106
-- arg-macro: procedure TTF_RenderText (font, text, fg,TTF_RenderText_Shaded(font, text, fg, bg)
-- TTF_RenderText_Shaded(font, text, fg, bg)
-- arg-macro: procedure TTF_RenderUTF8 (font, text, fg,TTF_RenderUTF8_Shaded(font, text, fg, bg)
-- TTF_RenderUTF8_Shaded(font, text, fg, bg)
-- arg-macro: procedure TTF_RenderUNICODE (font, text, fg,TTF_RenderUNICODE_Shaded(font, text, fg, bg)
-- TTF_RenderUNICODE_Shaded(font, text, fg, bg)
-- unsupported macro: TTF_SetError SDL_SetError
-- unsupported macro: TTF_GetError SDL_GetError
function TTF_Linked_Version return access constant SDL_SDL_version_h.SDL_version; -- ../include/SDL/SDL_ttf.h:64
pragma Import (C, TTF_Linked_Version, "TTF_Linked_Version");
procedure TTF_ByteSwappedUNICODE (swapped : int); -- ../include/SDL/SDL_ttf.h:74
pragma Import (C, TTF_ByteSwappedUNICODE, "TTF_ByteSwappedUNICODE");
-- skipped empty struct u_TTF_Font
-- skipped empty struct TTF_Font
function TTF_Init return int; -- ../include/SDL/SDL_ttf.h:80
pragma Import (C, TTF_Init, "TTF_Init");
function TTF_OpenFont (file : Interfaces.C.Strings.chars_ptr; ptsize : int) return System.Address; -- ../include/SDL/SDL_ttf.h:86
pragma Import (C, TTF_OpenFont, "TTF_OpenFont");
function TTF_OpenFontIndex
(file : Interfaces.C.Strings.chars_ptr;
ptsize : int;
index : long) return System.Address; -- ../include/SDL/SDL_ttf.h:87
pragma Import (C, TTF_OpenFontIndex, "TTF_OpenFontIndex");
function TTF_OpenFontRW
(src : access SDL_SDL_rwops_h.SDL_RWops;
freesrc : int;
ptsize : int) return System.Address; -- ../include/SDL/SDL_ttf.h:88
pragma Import (C, TTF_OpenFontRW, "TTF_OpenFontRW");
function TTF_OpenFontIndexRW
(src : access SDL_SDL_rwops_h.SDL_RWops;
freesrc : int;
ptsize : int;
index : long) return System.Address; -- ../include/SDL/SDL_ttf.h:89
pragma Import (C, TTF_OpenFontIndexRW, "TTF_OpenFontIndexRW");
function TTF_GetFontStyle (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:97
pragma Import (C, TTF_GetFontStyle, "TTF_GetFontStyle");
procedure TTF_SetFontStyle (font : System.Address; style : int); -- ../include/SDL/SDL_ttf.h:98
pragma Import (C, TTF_SetFontStyle, "TTF_SetFontStyle");
function TTF_GetFontOutline (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:99
pragma Import (C, TTF_GetFontOutline, "TTF_GetFontOutline");
procedure TTF_SetFontOutline (font : System.Address; outline : int); -- ../include/SDL/SDL_ttf.h:100
pragma Import (C, TTF_SetFontOutline, "TTF_SetFontOutline");
function TTF_GetFontHinting (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:107
pragma Import (C, TTF_GetFontHinting, "TTF_GetFontHinting");
procedure TTF_SetFontHinting (font : System.Address; hinting : int); -- ../include/SDL/SDL_ttf.h:108
pragma Import (C, TTF_SetFontHinting, "TTF_SetFontHinting");
function TTF_FontHeight (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:111
pragma Import (C, TTF_FontHeight, "TTF_FontHeight");
function TTF_FontAscent (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:116
pragma Import (C, TTF_FontAscent, "TTF_FontAscent");
function TTF_FontDescent (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:121
pragma Import (C, TTF_FontDescent, "TTF_FontDescent");
function TTF_FontLineSkip (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:124
pragma Import (C, TTF_FontLineSkip, "TTF_FontLineSkip");
function TTF_GetFontKerning (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:127
pragma Import (C, TTF_GetFontKerning, "TTF_GetFontKerning");
procedure TTF_SetFontKerning (font : System.Address; allowed : int); -- ../include/SDL/SDL_ttf.h:128
pragma Import (C, TTF_SetFontKerning, "TTF_SetFontKerning");
function TTF_FontFaces (font : System.Address) return long; -- ../include/SDL/SDL_ttf.h:131
pragma Import (C, TTF_FontFaces, "TTF_FontFaces");
function TTF_FontFaceIsFixedWidth (font : System.Address) return int; -- ../include/SDL/SDL_ttf.h:134
pragma Import (C, TTF_FontFaceIsFixedWidth, "TTF_FontFaceIsFixedWidth");
function TTF_FontFaceFamilyName (font : System.Address) return Interfaces.C.Strings.chars_ptr; -- ../include/SDL/SDL_ttf.h:135
pragma Import (C, TTF_FontFaceFamilyName, "TTF_FontFaceFamilyName");
function TTF_FontFaceStyleName (font : System.Address) return Interfaces.C.Strings.chars_ptr; -- ../include/SDL/SDL_ttf.h:136
pragma Import (C, TTF_FontFaceStyleName, "TTF_FontFaceStyleName");
function TTF_GlyphIsProvided (font : System.Address; ch : SDL_SDL_stdinc_h.Uint16) return int; -- ../include/SDL/SDL_ttf.h:139
pragma Import (C, TTF_GlyphIsProvided, "TTF_GlyphIsProvided");
function TTF_GlyphMetrics
(font : System.Address;
ch : SDL_SDL_stdinc_h.Uint16;
minx : access int;
maxx : access int;
miny : access int;
maxy : access int;
advance : access int) return int; -- ../include/SDL/SDL_ttf.h:145
pragma Import (C, TTF_GlyphMetrics, "TTF_GlyphMetrics");
function TTF_SizeText
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
w : access int;
h : access int) return int; -- ../include/SDL/SDL_ttf.h:150
pragma Import (C, TTF_SizeText, "TTF_SizeText");
function TTF_SizeUTF8
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
w : access int;
h : access int) return int; -- ../include/SDL/SDL_ttf.h:151
pragma Import (C, TTF_SizeUTF8, "TTF_SizeUTF8");
function TTF_SizeUNICODE
(font : System.Address;
text : access SDL_SDL_stdinc_h.Uint16;
w : access int;
h : access int) return int; -- ../include/SDL/SDL_ttf.h:152
pragma Import (C, TTF_SizeUNICODE, "TTF_SizeUNICODE");
function TTF_RenderText_Solid
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:160
pragma Import (C, TTF_RenderText_Solid, "TTF_RenderText_Solid");
function TTF_RenderUTF8_Solid
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:162
pragma Import (C, TTF_RenderUTF8_Solid, "TTF_RenderUTF8_Solid");
function TTF_RenderUNICODE_Solid
(font : System.Address;
text : access SDL_SDL_stdinc_h.Uint16;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:164
pragma Import (C, TTF_RenderUNICODE_Solid, "TTF_RenderUNICODE_Solid");
function TTF_RenderGlyph_Solid
(font : System.Address;
ch : SDL_SDL_stdinc_h.Uint16;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:174
pragma Import (C, TTF_RenderGlyph_Solid, "TTF_RenderGlyph_Solid");
function TTF_RenderText_Shaded
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
fg : SDL_SDL_video_h.SDL_Color;
bg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:182
pragma Import (C, TTF_RenderText_Shaded, "TTF_RenderText_Shaded");
function TTF_RenderUTF8_Shaded
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
fg : SDL_SDL_video_h.SDL_Color;
bg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:184
pragma Import (C, TTF_RenderUTF8_Shaded, "TTF_RenderUTF8_Shaded");
function TTF_RenderUNICODE_Shaded
(font : System.Address;
text : access SDL_SDL_stdinc_h.Uint16;
fg : SDL_SDL_video_h.SDL_Color;
bg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:186
pragma Import (C, TTF_RenderUNICODE_Shaded, "TTF_RenderUNICODE_Shaded");
function TTF_RenderGlyph_Shaded
(font : System.Address;
ch : SDL_SDL_stdinc_h.Uint16;
fg : SDL_SDL_video_h.SDL_Color;
bg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:196
pragma Import (C, TTF_RenderGlyph_Shaded, "TTF_RenderGlyph_Shaded");
function TTF_RenderText_Blended
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:203
pragma Import (C, TTF_RenderText_Blended, "TTF_RenderText_Blended");
function TTF_RenderUTF8_Blended
(font : System.Address;
text : Interfaces.C.Strings.chars_ptr;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:205
pragma Import (C, TTF_RenderUTF8_Blended, "TTF_RenderUTF8_Blended");
function TTF_RenderUNICODE_Blended
(font : System.Address;
text : access SDL_SDL_stdinc_h.Uint16;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:207
pragma Import (C, TTF_RenderUNICODE_Blended, "TTF_RenderUNICODE_Blended");
function TTF_RenderGlyph_Blended
(font : System.Address;
ch : SDL_SDL_stdinc_h.Uint16;
fg : SDL_SDL_video_h.SDL_Color) return access SDL_SDL_video_h.SDL_Surface; -- ../include/SDL/SDL_ttf.h:216
pragma Import (C, TTF_RenderGlyph_Blended, "TTF_RenderGlyph_Blended");
procedure TTF_CloseFont (font : System.Address); -- ../include/SDL/SDL_ttf.h:228
pragma Import (C, TTF_CloseFont, "TTF_CloseFont");
procedure TTF_Quit; -- ../include/SDL/SDL_ttf.h:231
pragma Import (C, TTF_Quit, "TTF_Quit");
function TTF_WasInit return int; -- ../include/SDL/SDL_ttf.h:234
pragma Import (C, TTF_WasInit, "TTF_WasInit");
function TTF_GetFontKerningSize
(font : System.Address;
prev_index : int;
index : int) return int; -- ../include/SDL/SDL_ttf.h:237
pragma Import (C, TTF_GetFontKerningSize, "TTF_GetFontKerningSize");
end SDL_SDL_ttf_h;
|
reznikmm/matreshka | Ada | 3,682 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2015, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Uaflex.Nodes;
package Parser_Tokens is
subtype YYSType is UAFLEX.Nodes.Node;
YYLVal, YYVal : YYSType;
type Token is
(End_Of_Input, Error, Name, Name_List_End,
Start, Excl_Start, Section_End,
Regexp, Action );
subtype Token_Kind is Token;
Syntax_Error : exception;
end Parser_Tokens;
|
msrLi/portingSources | Ada | 789 | adb | -- Copyright 2008-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;
procedure Foo is
begin
Pck.Watch := Pck.Watch + 1;
end Foo;
|
sparre/Command-Line-Parser-Generator | Ada | 675 | ads | -- Copyright: JSA Research & Innovation <[email protected]>
-- License: Beer Ware
pragma License (Unrestricted);
with Ada.Containers.Vectors;
with Command_Line_Parser_Generator.Formal_Parameter;
package Command_Line_Parser_Generator.Formal_Parameter_List is
package Vectors is
new Ada.Containers.Vectors (Element_Type => Formal_Parameter.Instance,
Index_Type => Positive,
"=" => Formal_Parameter."=");
type Instance is new Vectors.Vector with null record;
function Image (Item : in Instance) return Wide_String;
end Command_Line_Parser_Generator.Formal_Parameter_List;
|
AdaCore/Ada_Drivers_Library | Ada | 32,452 | ads | -- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without modification,
-- are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, must reproduce the above copyright notice, this list of
-- conditions and the following disclaimer in the documentation and/or other
-- materials provided with the distribution.
--
-- 3. Neither the name of Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be reverse
-- engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
--
-- This spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.POWER is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Write '1' to Enable interrupt for POFWARN event
type INTENSET_POFWARN_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_POFWARN_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for POFWARN event
type INTENSET_POFWARN_Field_1 is
(-- Reset value for the field
Intenset_Pofwarn_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_POFWARN_Field_1 use
(Intenset_Pofwarn_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for SLEEPENTER event
type INTENSET_SLEEPENTER_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_SLEEPENTER_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for SLEEPENTER event
type INTENSET_SLEEPENTER_Field_1 is
(-- Reset value for the field
Intenset_Sleepenter_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_SLEEPENTER_Field_1 use
(Intenset_Sleepenter_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for SLEEPEXIT event
type INTENSET_SLEEPEXIT_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_SLEEPEXIT_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for SLEEPEXIT event
type INTENSET_SLEEPEXIT_Field_1 is
(-- Reset value for the field
Intenset_Sleepexit_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_SLEEPEXIT_Field_1 use
(Intenset_Sleepexit_Field_Reset => 0,
Set => 1);
-- Enable interrupt
type INTENSET_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Write '1' to Enable interrupt for POFWARN event
POFWARN : INTENSET_POFWARN_Field_1 :=
Intenset_Pofwarn_Field_Reset;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Write '1' to Enable interrupt for SLEEPENTER event
SLEEPENTER : INTENSET_SLEEPENTER_Field_1 :=
Intenset_Sleepenter_Field_Reset;
-- Write '1' to Enable interrupt for SLEEPEXIT event
SLEEPEXIT : INTENSET_SLEEPEXIT_Field_1 :=
Intenset_Sleepexit_Field_Reset;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
Reserved_0_1 at 0 range 0 .. 1;
POFWARN at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
SLEEPENTER at 0 range 5 .. 5;
SLEEPEXIT at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- Write '1' to Disable interrupt for POFWARN event
type INTENCLR_POFWARN_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_POFWARN_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for POFWARN event
type INTENCLR_POFWARN_Field_1 is
(-- Reset value for the field
Intenclr_Pofwarn_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_POFWARN_Field_1 use
(Intenclr_Pofwarn_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for SLEEPENTER event
type INTENCLR_SLEEPENTER_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_SLEEPENTER_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for SLEEPENTER event
type INTENCLR_SLEEPENTER_Field_1 is
(-- Reset value for the field
Intenclr_Sleepenter_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_SLEEPENTER_Field_1 use
(Intenclr_Sleepenter_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for SLEEPEXIT event
type INTENCLR_SLEEPEXIT_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_SLEEPEXIT_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for SLEEPEXIT event
type INTENCLR_SLEEPEXIT_Field_1 is
(-- Reset value for the field
Intenclr_Sleepexit_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_SLEEPEXIT_Field_1 use
(Intenclr_Sleepexit_Field_Reset => 0,
Clear => 1);
-- Disable interrupt
type INTENCLR_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Write '1' to Disable interrupt for POFWARN event
POFWARN : INTENCLR_POFWARN_Field_1 :=
Intenclr_Pofwarn_Field_Reset;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Write '1' to Disable interrupt for SLEEPENTER event
SLEEPENTER : INTENCLR_SLEEPENTER_Field_1 :=
Intenclr_Sleepenter_Field_Reset;
-- Write '1' to Disable interrupt for SLEEPEXIT event
SLEEPEXIT : INTENCLR_SLEEPEXIT_Field_1 :=
Intenclr_Sleepexit_Field_Reset;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
POFWARN at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
SLEEPENTER at 0 range 5 .. 5;
SLEEPEXIT at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- Reset from pin-reset detected
type RESETREAS_RESETPIN_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_RESETPIN_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from watchdog detected
type RESETREAS_DOG_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_DOG_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from soft reset detected
type RESETREAS_SREQ_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_SREQ_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from CPU lock-up detected
type RESETREAS_LOCKUP_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_LOCKUP_Field use
(Notdetected => 0,
Detected => 1);
-- Reset due to wake up from System OFF mode when wakeup is triggered from
-- DETECT signal from GPIO
type RESETREAS_OFF_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_OFF_Field use
(Notdetected => 0,
Detected => 1);
-- Reset due to wake up from System OFF mode when wakeup is triggered from
-- ANADETECT signal from LPCOMP
type RESETREAS_LPCOMP_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_LPCOMP_Field use
(Notdetected => 0,
Detected => 1);
-- Reset due to wake up from System OFF mode when wakeup is triggered from
-- entering into debug interface mode
type RESETREAS_DIF_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_DIF_Field use
(Notdetected => 0,
Detected => 1);
-- Reset due to wake up from System OFF mode by NFC field detect
type RESETREAS_NFC_Field is
(-- Not detected
Notdetected,
-- Detected
Detected)
with Size => 1;
for RESETREAS_NFC_Field use
(Notdetected => 0,
Detected => 1);
-- Reset reason
type RESETREAS_Register is record
-- Reset from pin-reset detected
RESETPIN : RESETREAS_RESETPIN_Field := NRF_SVD.POWER.Notdetected;
-- Reset from watchdog detected
DOG : RESETREAS_DOG_Field := NRF_SVD.POWER.Notdetected;
-- Reset from soft reset detected
SREQ : RESETREAS_SREQ_Field := NRF_SVD.POWER.Notdetected;
-- Reset from CPU lock-up detected
LOCKUP : RESETREAS_LOCKUP_Field := NRF_SVD.POWER.Notdetected;
-- unspecified
Reserved_4_15 : HAL.UInt12 := 16#0#;
-- Reset due to wake up from System OFF mode when wakeup is triggered
-- from DETECT signal from GPIO
OFF : RESETREAS_OFF_Field := NRF_SVD.POWER.Notdetected;
-- Reset due to wake up from System OFF mode when wakeup is triggered
-- from ANADETECT signal from LPCOMP
LPCOMP : RESETREAS_LPCOMP_Field := NRF_SVD.POWER.Notdetected;
-- Reset due to wake up from System OFF mode when wakeup is triggered
-- from entering into debug interface mode
DIF : RESETREAS_DIF_Field := NRF_SVD.POWER.Notdetected;
-- Reset due to wake up from System OFF mode by NFC field detect
NFC : RESETREAS_NFC_Field := NRF_SVD.POWER.Notdetected;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RESETREAS_Register use record
RESETPIN at 0 range 0 .. 0;
DOG at 0 range 1 .. 1;
SREQ at 0 range 2 .. 2;
LOCKUP at 0 range 3 .. 3;
Reserved_4_15 at 0 range 4 .. 15;
OFF at 0 range 16 .. 16;
LPCOMP at 0 range 17 .. 17;
DIF at 0 range 18 .. 18;
NFC at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- RAM block 0 is on or off/powering up
type RAMSTATUS_RAMBLOCK0_Field is
(-- Off
Off,
-- On
On)
with Size => 1;
for RAMSTATUS_RAMBLOCK0_Field use
(Off => 0,
On => 1);
-- RAMSTATUS_RAMBLOCK array
type RAMSTATUS_RAMBLOCK_Field_Array is array (0 .. 3)
of RAMSTATUS_RAMBLOCK0_Field
with Component_Size => 1, Size => 4;
-- Type definition for RAMSTATUS_RAMBLOCK
type RAMSTATUS_RAMBLOCK_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- RAMBLOCK as a value
Val : HAL.UInt4;
when True =>
-- RAMBLOCK as an array
Arr : RAMSTATUS_RAMBLOCK_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for RAMSTATUS_RAMBLOCK_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Deprecated register - RAM status register
type RAMSTATUS_Register is record
-- Read-only. RAM block 0 is on or off/powering up
RAMBLOCK : RAMSTATUS_RAMBLOCK_Field;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RAMSTATUS_Register use record
RAMBLOCK at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Enable System OFF mode
type SYSTEMOFF_SYSTEMOFF_Field is
(-- Reset value for the field
Systemoff_Systemoff_Field_Reset,
-- Enable System OFF mode
Enter)
with Size => 1;
for SYSTEMOFF_SYSTEMOFF_Field use
(Systemoff_Systemoff_Field_Reset => 0,
Enter => 1);
-- System OFF register
type SYSTEMOFF_Register is record
-- Write-only. Enable System OFF mode
SYSTEMOFF : SYSTEMOFF_SYSTEMOFF_Field :=
Systemoff_Systemoff_Field_Reset;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SYSTEMOFF_Register use record
SYSTEMOFF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Enable or disable power failure comparator
type POFCON_POF_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for POFCON_POF_Field use
(Disabled => 0,
Enabled => 1);
-- Power failure comparator threshold setting
type POFCON_THRESHOLD_Field is
(-- Reset value for the field
Pofcon_Threshold_Field_Reset,
-- Set threshold to 1.7 V
V17,
-- Set threshold to 1.8 V
V18,
-- Set threshold to 1.9 V
V19,
-- Set threshold to 2.0 V
V20,
-- Set threshold to 2.1 V
V21,
-- Set threshold to 2.2 V
V22,
-- Set threshold to 2.3 V
V23,
-- Set threshold to 2.4 V
V24,
-- Set threshold to 2.5 V
V25,
-- Set threshold to 2.6 V
V26,
-- Set threshold to 2.7 V
V27,
-- Set threshold to 2.8 V
V28)
with Size => 4;
for POFCON_THRESHOLD_Field use
(Pofcon_Threshold_Field_Reset => 0,
V17 => 4,
V18 => 5,
V19 => 6,
V20 => 7,
V21 => 8,
V22 => 9,
V23 => 10,
V24 => 11,
V25 => 12,
V26 => 13,
V27 => 14,
V28 => 15);
-- Power failure comparator configuration
type POFCON_Register is record
-- Enable or disable power failure comparator
POF : POFCON_POF_Field := NRF_SVD.POWER.Disabled;
-- Power failure comparator threshold setting
THRESHOLD : POFCON_THRESHOLD_Field := Pofcon_Threshold_Field_Reset;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POFCON_Register use record
POF at 0 range 0 .. 0;
THRESHOLD at 0 range 1 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype GPREGRET_GPREGRET_Field is HAL.UInt8;
-- General purpose retention register
type GPREGRET_Register is record
-- General purpose retention register
GPREGRET : GPREGRET_GPREGRET_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for GPREGRET_Register use record
GPREGRET at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Keep RAM block 0 on or off in system ON Mode
type RAMON_ONRAM0_Field is
(-- Off
Ram0Off,
-- On
Ram0On)
with Size => 1;
for RAMON_ONRAM0_Field use
(Ram0Off => 0,
Ram0On => 1);
-- Keep RAM block 1 on or off in system ON Mode
type RAMON_ONRAM1_Field is
(-- Off
Ram1Off,
-- On
Ram1On)
with Size => 1;
for RAMON_ONRAM1_Field use
(Ram1Off => 0,
Ram1On => 1);
-- Keep retention on RAM block 0 when RAM block is switched off
type RAMON_OFFRAM0_Field is
(-- Off
Ram0Off,
-- On
Ram0On)
with Size => 1;
for RAMON_OFFRAM0_Field use
(Ram0Off => 0,
Ram0On => 1);
-- Keep retention on RAM block 1 when RAM block is switched off
type RAMON_OFFRAM1_Field is
(-- Off
Ram1Off,
-- On
Ram1On)
with Size => 1;
for RAMON_OFFRAM1_Field use
(Ram1Off => 0,
Ram1On => 1);
-- Deprecated register - RAM on/off register (this register is retained)
type RAMON_Register is record
-- Keep RAM block 0 on or off in system ON Mode
ONRAM0 : RAMON_ONRAM0_Field := NRF_SVD.POWER.Ram0On;
-- Keep RAM block 1 on or off in system ON Mode
ONRAM1 : RAMON_ONRAM1_Field := NRF_SVD.POWER.Ram1On;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Keep retention on RAM block 0 when RAM block is switched off
OFFRAM0 : RAMON_OFFRAM0_Field := NRF_SVD.POWER.Ram0Off;
-- Keep retention on RAM block 1 when RAM block is switched off
OFFRAM1 : RAMON_OFFRAM1_Field := NRF_SVD.POWER.Ram1Off;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RAMON_Register use record
ONRAM0 at 0 range 0 .. 0;
ONRAM1 at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
OFFRAM0 at 0 range 16 .. 16;
OFFRAM1 at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Keep RAM block 2 on or off in system ON Mode
type RAMONB_ONRAM2_Field is
(-- Off
Ram2Off,
-- On
Ram2On)
with Size => 1;
for RAMONB_ONRAM2_Field use
(Ram2Off => 0,
Ram2On => 1);
-- Keep RAM block 3 on or off in system ON Mode
type RAMONB_ONRAM3_Field is
(-- Off
Ram3Off,
-- On
Ram3On)
with Size => 1;
for RAMONB_ONRAM3_Field use
(Ram3Off => 0,
Ram3On => 1);
-- Keep retention on RAM block 2 when RAM block is switched off
type RAMONB_OFFRAM2_Field is
(-- Off
Ram2Off,
-- On
Ram2On)
with Size => 1;
for RAMONB_OFFRAM2_Field use
(Ram2Off => 0,
Ram2On => 1);
-- Keep retention on RAM block 3 when RAM block is switched off
type RAMONB_OFFRAM3_Field is
(-- Off
Ram3Off,
-- On
Ram3On)
with Size => 1;
for RAMONB_OFFRAM3_Field use
(Ram3Off => 0,
Ram3On => 1);
-- Deprecated register - RAM on/off register (this register is retained)
type RAMONB_Register is record
-- Keep RAM block 2 on or off in system ON Mode
ONRAM2 : RAMONB_ONRAM2_Field := NRF_SVD.POWER.Ram2On;
-- Keep RAM block 3 on or off in system ON Mode
ONRAM3 : RAMONB_ONRAM3_Field := NRF_SVD.POWER.Ram3On;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Keep retention on RAM block 2 when RAM block is switched off
OFFRAM2 : RAMONB_OFFRAM2_Field := NRF_SVD.POWER.Ram2Off;
-- Keep retention on RAM block 3 when RAM block is switched off
OFFRAM3 : RAMONB_OFFRAM3_Field := NRF_SVD.POWER.Ram3Off;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RAMONB_Register use record
ONRAM2 at 0 range 0 .. 0;
ONRAM3 at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
OFFRAM2 at 0 range 16 .. 16;
OFFRAM3 at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Enable or disable DC/DC converter
type DCDCEN_DCDCEN_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for DCDCEN_DCDCEN_Field use
(Disabled => 0,
Enabled => 1);
-- DC/DC enable register
type DCDCEN_Register is record
-- Enable or disable DC/DC converter
DCDCEN : DCDCEN_DCDCEN_Field := NRF_SVD.POWER.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DCDCEN_Register use record
DCDCEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------------------
-- RAM cluster's Registers --
-----------------------------
-- Keep RAM section S0 ON or OFF in System ON mode.
type POWER_S0POWER_Field is
(-- Off
Off,
-- On
On)
with Size => 1;
for POWER_S0POWER_Field use
(Off => 0,
On => 1);
-- Keep RAM section S1 ON or OFF in System ON mode.
type POWER_S1POWER_Field is
(-- Off
Off,
-- On
On)
with Size => 1;
for POWER_S1POWER_Field use
(Off => 0,
On => 1);
-- Keep retention on RAM section S0 when RAM section is in OFF
type POWER_S0RETENTION_Field is
(-- Off
Off,
-- On
On)
with Size => 1;
for POWER_S0RETENTION_Field use
(Off => 0,
On => 1);
-- Keep retention on RAM section S1 when RAM section is in OFF
type POWER_S1RETENTION_Field is
(-- Off
Off,
-- On
On)
with Size => 1;
for POWER_S1RETENTION_Field use
(Off => 0,
On => 1);
-- Description cluster[0]: RAM0 power control register
type POWER_RAM_Register is record
-- Keep RAM section S0 ON or OFF in System ON mode.
S0POWER : POWER_S0POWER_Field := NRF_SVD.POWER.On;
-- Keep RAM section S1 ON or OFF in System ON mode.
S1POWER : POWER_S1POWER_Field := NRF_SVD.POWER.On;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#3FFF#;
-- Keep retention on RAM section S0 when RAM section is in OFF
S0RETENTION : POWER_S0RETENTION_Field := NRF_SVD.POWER.Off;
-- Keep retention on RAM section S1 when RAM section is in OFF
S1RETENTION : POWER_S1RETENTION_Field := NRF_SVD.POWER.Off;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POWER_RAM_Register use record
S0POWER at 0 range 0 .. 0;
S1POWER at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
S0RETENTION at 0 range 16 .. 16;
S1RETENTION at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Keep RAM section S0 of RAM0 on or off in System ON mode
type POWERSET_S0POWER_Field is
(-- On
On)
with Size => 1;
for POWERSET_S0POWER_Field use
(On => 1);
-- Keep RAM section S1 of RAM0 on or off in System ON mode
type POWERSET_S1POWER_Field is
(-- On
On)
with Size => 1;
for POWERSET_S1POWER_Field use
(On => 1);
-- Keep retention on RAM section S0 when RAM section is switched off
type POWERSET_S0RETENTION_Field is
(-- Reset value for the field
Powerset_S0Retention_Field_Reset,
-- On
On)
with Size => 1;
for POWERSET_S0RETENTION_Field use
(Powerset_S0Retention_Field_Reset => 0,
On => 1);
-- Keep retention on RAM section S1 when RAM section is switched off
type POWERSET_S1RETENTION_Field is
(-- Reset value for the field
Powerset_S1Retention_Field_Reset,
-- On
On)
with Size => 1;
for POWERSET_S1RETENTION_Field use
(Powerset_S1Retention_Field_Reset => 0,
On => 1);
-- Description cluster[0]: RAM0 power control set register
type POWERSET_RAM_Register is record
-- Write-only. Keep RAM section S0 of RAM0 on or off in System ON mode
S0POWER : POWERSET_S0POWER_Field := NRF_SVD.POWER.On;
-- Write-only. Keep RAM section S1 of RAM0 on or off in System ON mode
S1POWER : POWERSET_S1POWER_Field := NRF_SVD.POWER.On;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#3FFF#;
-- Write-only. Keep retention on RAM section S0 when RAM section is
-- switched off
S0RETENTION : POWERSET_S0RETENTION_Field :=
Powerset_S0Retention_Field_Reset;
-- Write-only. Keep retention on RAM section S1 when RAM section is
-- switched off
S1RETENTION : POWERSET_S1RETENTION_Field :=
Powerset_S1Retention_Field_Reset;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POWERSET_RAM_Register use record
S0POWER at 0 range 0 .. 0;
S1POWER at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
S0RETENTION at 0 range 16 .. 16;
S1RETENTION at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Keep RAM section S0 of RAM0 on or off in System ON mode
type POWERCLR_S0POWER_Field is
(-- Off
Off)
with Size => 1;
for POWERCLR_S0POWER_Field use
(Off => 1);
-- Keep RAM section S1 of RAM0 on or off in System ON mode
type POWERCLR_S1POWER_Field is
(-- Off
Off)
with Size => 1;
for POWERCLR_S1POWER_Field use
(Off => 1);
-- Keep retention on RAM section S0 when RAM section is switched off
type POWERCLR_S0RETENTION_Field is
(-- Reset value for the field
Powerclr_S0Retention_Field_Reset,
-- Off
Off)
with Size => 1;
for POWERCLR_S0RETENTION_Field use
(Powerclr_S0Retention_Field_Reset => 0,
Off => 1);
-- Keep retention on RAM section S1 when RAM section is switched off
type POWERCLR_S1RETENTION_Field is
(-- Reset value for the field
Powerclr_S1Retention_Field_Reset,
-- Off
Off)
with Size => 1;
for POWERCLR_S1RETENTION_Field use
(Powerclr_S1Retention_Field_Reset => 0,
Off => 1);
-- Description cluster[0]: RAM0 power control clear register
type POWERCLR_RAM_Register is record
-- Write-only. Keep RAM section S0 of RAM0 on or off in System ON mode
S0POWER : POWERCLR_S0POWER_Field := NRF_SVD.POWER.Off;
-- Write-only. Keep RAM section S1 of RAM0 on or off in System ON mode
S1POWER : POWERCLR_S1POWER_Field := NRF_SVD.POWER.Off;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#3FFF#;
-- Write-only. Keep retention on RAM section S0 when RAM section is
-- switched off
S0RETENTION : POWERCLR_S0RETENTION_Field :=
Powerclr_S0Retention_Field_Reset;
-- Write-only. Keep retention on RAM section S1 when RAM section is
-- switched off
S1RETENTION : POWERCLR_S1RETENTION_Field :=
Powerclr_S1Retention_Field_Reset;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POWERCLR_RAM_Register use record
S0POWER at 0 range 0 .. 0;
S1POWER at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
S0RETENTION at 0 range 16 .. 16;
S1RETENTION at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Unspecified
type RAM_Cluster is record
-- Description cluster[0]: RAM0 power control register
POWER : aliased POWER_RAM_Register;
-- Description cluster[0]: RAM0 power control set register
POWERSET : aliased POWERSET_RAM_Register;
-- Description cluster[0]: RAM0 power control clear register
POWERCLR : aliased POWERCLR_RAM_Register;
end record
with Size => 96;
for RAM_Cluster use record
POWER at 16#0# range 0 .. 31;
POWERSET at 16#4# range 0 .. 31;
POWERCLR at 16#8# range 0 .. 31;
end record;
-- Unspecified
type RAM_Clusters is array (0 .. 7) of RAM_Cluster;
-----------------
-- Peripherals --
-----------------
-- Power control
type POWER_Peripheral is record
-- Enable constant latency mode
TASKS_CONSTLAT : aliased HAL.UInt32;
-- Enable low power mode (variable latency)
TASKS_LOWPWR : aliased HAL.UInt32;
-- Power failure warning
EVENTS_POFWARN : aliased HAL.UInt32;
-- CPU entered WFI/WFE sleep
EVENTS_SLEEPENTER : aliased HAL.UInt32;
-- CPU exited WFI/WFE sleep
EVENTS_SLEEPEXIT : aliased HAL.UInt32;
-- Enable interrupt
INTENSET : aliased INTENSET_Register;
-- Disable interrupt
INTENCLR : aliased INTENCLR_Register;
-- Reset reason
RESETREAS : aliased RESETREAS_Register;
-- Deprecated register - RAM status register
RAMSTATUS : aliased RAMSTATUS_Register;
-- System OFF register
SYSTEMOFF : aliased SYSTEMOFF_Register;
-- Power failure comparator configuration
POFCON : aliased POFCON_Register;
-- General purpose retention register
GPREGRET : aliased GPREGRET_Register;
-- General purpose retention register
GPREGRET2 : aliased GPREGRET_Register;
-- Deprecated register - RAM on/off register (this register is retained)
RAMON : aliased RAMON_Register;
-- Deprecated register - RAM on/off register (this register is retained)
RAMONB : aliased RAMONB_Register;
-- DC/DC enable register
DCDCEN : aliased DCDCEN_Register;
-- Unspecified
RAM : aliased RAM_Clusters;
end record
with Volatile;
for POWER_Peripheral use record
TASKS_CONSTLAT at 16#78# range 0 .. 31;
TASKS_LOWPWR at 16#7C# range 0 .. 31;
EVENTS_POFWARN at 16#108# range 0 .. 31;
EVENTS_SLEEPENTER at 16#114# range 0 .. 31;
EVENTS_SLEEPEXIT at 16#118# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
RESETREAS at 16#400# range 0 .. 31;
RAMSTATUS at 16#428# range 0 .. 31;
SYSTEMOFF at 16#500# range 0 .. 31;
POFCON at 16#510# range 0 .. 31;
GPREGRET at 16#51C# range 0 .. 31;
GPREGRET2 at 16#520# range 0 .. 31;
RAMON at 16#524# range 0 .. 31;
RAMONB at 16#554# range 0 .. 31;
DCDCEN at 16#578# range 0 .. 31;
RAM at 16#900# range 0 .. 767;
end record;
-- Power control
POWER_Periph : aliased POWER_Peripheral
with Import, Address => POWER_Base;
end NRF_SVD.POWER;
|
reznikmm/matreshka | Ada | 18,362 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with AMF.CMOF.Elements;
with AMF.DI.Styles;
with AMF.Internals.UMLDI_UML_Diagrams;
with AMF.UML.Comments.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements;
with AMF.UML.String_Expressions;
with AMF.UML.Template_Parameters;
with AMF.UMLDI.UML_Labels;
with AMF.UMLDI.UML_Package_Diagrams;
with AMF.UMLDI.UML_Styles;
with AMF.Visitors;
with League.Strings;
package AMF.Internals.UMLDI_UML_Package_Diagrams is
type UMLDI_UML_Package_Diagram_Proxy is
limited new AMF.Internals.UMLDI_UML_Diagrams.UMLDI_UML_Diagram_Proxy
and AMF.UMLDI.UML_Package_Diagrams.UMLDI_UML_Package_Diagram with null record;
overriding function Get_Heading
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access;
-- Getter of UMLDiagram::heading.
--
overriding procedure Set_Heading
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access);
-- Setter of UMLDiagram::heading.
--
overriding function Get_Is_Frame
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return Boolean;
-- Getter of UMLDiagram::isFrame.
--
-- Indicates when diagram frames shall be shown.
overriding procedure Set_Is_Frame
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : Boolean);
-- Setter of UMLDiagram::isFrame.
--
-- Indicates when diagram frames shall be shown.
overriding function Get_Is_Iso
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return Boolean;
-- Getter of UMLDiagram::isIso.
--
-- Indicate when ISO notation rules shall be followed.
overriding procedure Set_Is_Iso
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : Boolean);
-- Setter of UMLDiagram::isIso.
--
-- Indicate when ISO notation rules shall be followed.
overriding function Get_Is_Icon
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return Boolean;
-- Getter of UMLDiagramElement::isIcon.
--
-- For modelElements that have an option to be shown with shapes other
-- than rectangles, such as Actors, or with other identifying shapes
-- inside them, such as arrows distinguishing InputPins and OutputPins, or
-- edges that have an option to be shown with lines other than solid with
-- open arrow heads, such as Realization. A value of true for isIcon
-- indicates the alternative notation shall be shown.
overriding procedure Set_Is_Icon
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : Boolean);
-- Setter of UMLDiagramElement::isIcon.
--
-- For modelElements that have an option to be shown with shapes other
-- than rectangles, such as Actors, or with other identifying shapes
-- inside them, such as arrows distinguishing InputPins and OutputPins, or
-- edges that have an option to be shown with lines other than solid with
-- open arrow heads, such as Realization. A value of true for isIcon
-- indicates the alternative notation shall be shown.
overriding function Get_Local_Style
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access;
-- Getter of UMLDiagramElement::localStyle.
--
-- Restricts owned styles to UMLStyles.
overriding procedure Set_Local_Style
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access);
-- Setter of UMLDiagramElement::localStyle.
--
-- Restricts owned styles to UMLStyles.
overriding function Get_Model_Element
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of UMLDiagramElement::modelElement.
--
-- Restricts UMLDiagramElements to show UML Elements, rather than other
-- language elements.
overriding function Get_Model_Element
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.CMOF.Elements.CMOF_Element_Access;
-- Getter of DiagramElement::modelElement.
--
-- a reference to a depicted model element, which can be any MOF-based
-- element
overriding function Get_Local_Style
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.DI.Styles.DI_Style_Access;
-- Getter of DiagramElement::localStyle.
--
-- a reference to an optional locally-owned style for this diagram element.
overriding procedure Set_Local_Style
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.DI.Styles.DI_Style_Access);
-- Setter of DiagramElement::localStyle.
--
-- a reference to an optional locally-owned style for this diagram element.
overriding function Get_Name
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return League.Strings.Universal_String;
-- Getter of Diagram::name.
--
-- the name of the diagram.
overriding procedure Set_Name
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : League.Strings.Universal_String);
-- Setter of Diagram::name.
--
-- the name of the diagram.
overriding function Get_Documentation
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return League.Strings.Universal_String;
-- Getter of Diagram::documentation.
--
-- the documentation of the diagram.
overriding procedure Set_Documentation
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : League.Strings.Universal_String);
-- Setter of Diagram::documentation.
--
-- the documentation of the diagram.
overriding function Get_Resolution
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.Real;
-- Getter of Diagram::resolution.
--
-- the resolution of the diagram expressed in user units per inch.
overriding procedure Set_Resolution
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.Real);
-- Setter of Diagram::resolution.
--
-- the resolution of the diagram expressed in user units per inch.
overriding function Get_Client_Dependency
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::name.
--
-- The name of the NamedElement.
overriding procedure Set_Name
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.Optional_String);
-- Setter of NamedElement::name.
--
-- The name of the NamedElement.
overriding function Get_Name_Expression
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Owned_Comment
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Comments.Collections.Set_Of_UML_Comment;
-- Getter of Element::ownedComment.
--
-- The Comments owned by this element.
overriding function Get_Owned_Element
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of Element::ownedElement.
--
-- The Elements owned by this element.
overriding function Get_Owner
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Elements.UML_Element_Access;
-- Getter of Element::owner.
--
-- The Element that owns this element.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UMLDI_UML_Package_Diagram_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function All_Namespaces
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace;
-- Operation NamedElement::allNamespaces.
--
-- The query allNamespaces() gives the sequence of namespaces in which the
-- NamedElement is nested, working outwards.
overriding function All_Owning_Packages
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Qualified_Name
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return League.Strings.Universal_String;
-- Operation NamedElement::qualifiedName.
--
-- When there is a name, and all of the containing namespaces have a name,
-- the qualified name is constructed from the names of the containing
-- namespaces.
overriding function Separator
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return League.Strings.Universal_String;
-- Operation NamedElement::separator.
--
-- The query separator() gives the string that is used to separate names
-- when constructing a qualified name.
overriding function All_Owned_Elements
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Operation Element::allOwnedElements.
--
-- The query allOwnedElements() gives all of the direct and indirect owned
-- elements of an element.
overriding function Is_Compatible_With
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ParameterableElement::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. Subclasses
-- should override this operation to specify different compatibility
-- constraints.
overriding function Is_Template_Parameter
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding procedure Enter_Element
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant UMLDI_UML_Package_Diagram_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.UMLDI_UML_Package_Diagrams;
|
Componolit/libsparkcrypto | Ada | 5,667 | ads | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- 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 nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with LSC.Internal.Types;
use type LSC.Internal.Types.Index;
use type LSC.Internal.Types.Word32;
use type LSC.Internal.Types.Word64;
-------------------------------------------------------------------------------
-- The SHA-256 hash algorithm
--
-- <ul>
-- <li>
-- <a href="http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf">
-- FIPS PUB 180-3, Secure Hash Standard (SHS), National Institute of Standards
-- and Technology, U.S. Department of Commerce, October 2008. </a>
-- </li>
-- </ul>
-------------------------------------------------------------------------------
package LSC.Internal.SHA256 is
pragma Pure;
-- SHA-256 context
type Context_Type is private;
-- Index for SHA-256 block
subtype Block_Index is Types.Index range 0 .. 15;
-- SHA-256 block
subtype Block_Type is Types.Word32_Array_Type (Block_Index);
-- SHA-256 block size
Block_Size : constant := 512;
-- Index for SHA-256 hash
subtype SHA256_Hash_Index is Types.Index range 0 .. 7;
-- SHA-256 hash
subtype SHA256_Hash_Type is Types.Word32_Array_Type (SHA256_Hash_Index);
-- SHA-256 block length
subtype Block_Length_Type is Types.Word32 range 0 .. Block_Size - 1;
-- Index for SHA-256 message
--
-- A SHA-256 message can be at most 2^64 bit long. As one block has 512 bit,
-- this makes 2^55 blocks.
type Message_Index is range 0 .. 2 ** 55 - 1;
-- SHA-256 message
type Message_Type is array (Message_Index range <>) of Block_Type;
-- Initialize SHA-256 context.
function SHA256_Context_Init return Context_Type;
-- Update SHA-256 @Context@ with message block @Block@.
procedure Context_Update
(Context : in out Context_Type;
Block : in Block_Type)
with Depends => (Context =>+ Block);
pragma Inline (Context_Update);
-- Finalize SHA-256 @Context@ using @Length@ bits of final message block
-- @Block@.
procedure Context_Finalize
(Context : in out Context_Type;
Block : in Block_Type;
Length : in Block_Length_Type)
with Depends => (Context =>+ (Block, Length));
-- Return SHA-256 hash from @Context@.
function SHA256_Get_Hash (Context : Context_Type) return SHA256_Hash_Type;
procedure Hash_Context
(Message : in Message_Type;
Length : in LSC.Internal.SHA256.Message_Index;
Ctx : in out Context_Type)
with
Depends => (Ctx =>+ (Message, Length)),
Pre =>
Message'First <= Message'Last and
Length / Block_Size +
(if Length mod Block_Size = 0 then 0 else 1) <= Message'Length;
-- Compute hash value of @Length@ bits of @Message@.
function Hash
(Message : Message_Type;
Length : LSC.Internal.SHA256.Message_Index) return SHA256_Hash_Type
with
Pre =>
Message'First <= Message'Last and
Length / Block_Size +
(if Length mod Block_Size = 0 then 0 else 1) <= Message'Length;
-- Empty block
Null_Block : constant Block_Type;
-- Empty Hash
SHA256_Null_Hash : constant SHA256_Hash_Type;
private
type Data_Length is record
LSW : Types.Word32;
MSW : Types.Word32;
end record;
subtype Schedule_Index is Types.Index range 0 .. 63;
subtype Schedule_Type is Types.Word32_Array_Type (Schedule_Index);
Null_Schedule : constant Schedule_Type :=
Schedule_Type'(Schedule_Index => 0);
type Context_Type is record
Length : Data_Length;
H : SHA256_Hash_Type;
W : Schedule_Type;
end record;
Null_Block : constant Block_Type :=
Block_Type'(Block_Index => 0);
SHA256_Null_Hash : constant SHA256_Hash_Type :=
SHA256_Hash_Type'(SHA256_Hash_Index => 0);
end LSC.Internal.SHA256;
|
reznikmm/matreshka | Ada | 3,765 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with ODF.Constants;
package body Matreshka.ODF_Attributes.Style.Adjustment is
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Adjustment_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Adjustment_Name;
end Get_Local_Name;
end Matreshka.ODF_Attributes.Style.Adjustment;
|
compiler-explorer/compiler-explorer | Ada | 748 | adb | -- This pragma will remove the warning produced by the default
-- CE filename and the procedure name differing,
-- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName
pragma Source_File_Name (Square, Body_File_Name => "example.adb");
-- Type your code here, or load an example.
function Square(num : Integer) return Integer is
begin
return num**2;
end Square;
-- Ada 2012 also provides Expression Functions
-- (http://www.ada-auth.org/standards/12rm/html/RM-6-8.html)
-- as a short hand for functions whose body consists of a
-- single return statement. However they cannot be used as a
-- compilation unit.
-- function Square(num : Integer) return Integer is (num**2);
|
reznikmm/matreshka | Ada | 4,739 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Text_Bookmark_Ref_Elements;
package Matreshka.ODF_Text.Bookmark_Ref_Elements is
type Text_Bookmark_Ref_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_Bookmark_Ref_Elements.ODF_Text_Bookmark_Ref
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Bookmark_Ref_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Bookmark_Ref_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_Bookmark_Ref_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Text_Bookmark_Ref_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Text_Bookmark_Ref_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Text.Bookmark_Ref_Elements;
|
charlie5/lace | Ada | 5,573 | adb | package body gel.remote.World
is
function refined (Self : in coarse_Vector_3) return math.Vector_3
is
begin
return [math.Real (Self (1)),
math.Real (Self (2)),
math.Real (Self (3))];
end refined;
function coarsen (Self : in math.Vector_3) return coarse_Vector_3
is
Result : coarse_Vector_3;
begin
begin
Result (1) := coarse_Real (Self (1));
exception
when constraint_Error =>
if Self (1) > 0.0 then
Result (1) := coarse_Real'Last;
else
Result (1) := coarse_Real'First;
end if;
end;
begin
Result (2) := coarse_Real (Self (2));
exception
when constraint_Error =>
if Self (2) > 0.0 then
Result (2) := coarse_Real'Last;
else
Result (2) := coarse_Real'First;
end if;
end;
begin
Result (3) := coarse_Real (Self (3));
exception
when constraint_Error =>
if Self (3) > 0.0 then
Result (3) := coarse_Real'Last;
else
Result (3) := coarse_Real'First;
end if;
end;
return Result;
end coarsen;
function refined (Self : in coarse_Quaternion) return math.Quaternion
is
begin
return (R => math.Real (Self (1)),
V => [math.Real (Self (2)),
math.Real (Self (3)),
math.Real (Self (4))]);
end refined;
function coarsen (Self : in math.Quaternion) return coarse_Quaternion
is
Result : coarse_Quaternion;
begin
begin
Result (1) := coarse_Real2 (Self.R);
exception
when constraint_Error =>
if Self.R > 0.0 then
Result (1) := coarse_Real2'Last;
else
Result (1) := coarse_Real2'First;
end if;
end;
begin
Result (2) := coarse_Real2 (Self.V (1));
exception
when constraint_Error =>
if Self.V (1) > 0.0 then
Result (2) := coarse_Real2'Last;
else
Result (2) := coarse_Real2'First;
end if;
end;
begin
Result (3) := coarse_Real2 (Self.V (2));
exception
when constraint_Error =>
if Self.V (2) > 0.0 then
Result (3) := coarse_Real2'Last;
else
Result (3) := coarse_Real2'First;
end if;
end;
begin
Result (4) := coarse_Real2 (Self.V (3));
exception
when Constraint_Error =>
if Self.V (3) > 0.0 then
Result (4) := coarse_Real2'Last;
else
Result (4) := coarse_Real2'First;
end if;
end;
return Result;
end coarsen;
-----------
--- Streams
--
use ada.Streams;
number_of_stream_Elements_for_a_motion_Update : constant Stream_Element_Offset
:= motion_Update'Size / Stream_Element'Size;
procedure motion_Updates_write (Stream : access ada.Streams.Root_Stream_type'Class; Item : in motion_Updates)
is
stream_element_array_Length : constant Stream_Element_Offset
:= Item'Length * number_of_stream_Elements_for_a_Motion_Update;
subtype the_Stream_Element_Array is Stream_Element_Array (1 .. stream_element_array_Length);
function to_Stream_Element_Array is new ada.unchecked_Conversion (motion_Updates, the_Stream_Element_Array);
begin
write (Stream.all, to_Stream_Element_Array (Item));
end motion_Updates_write;
procedure motion_Updates_read (Stream : access ada.Streams.Root_Stream_type'Class; Item : out motion_Updates)
is
subtype the_Stream_Element_Array
is Stream_Element_Array (1 .. Item'Length * number_of_stream_Elements_for_a_motion_Update);
subtype the_motion_Updates is motion_Updates (1 .. Item'Length);
function to_motion_Updates is new ada.unchecked_Conversion (the_Stream_Element_Array, the_motion_Updates);
the_Stream_Array : the_Stream_Element_Array;
Last : Stream_Element_Offset;
begin
read (Stream.all, the_Stream_Array, Last);
pragma assert (Last = the_Stream_Array'Last);
Item := to_motion_Updates (the_Stream_Array (1 .. Last));
end motion_Updates_read;
procedure Write (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : in new_model_Event)
is
begin
openGL.remote_Model.item'Class'Output (Stream,
the_Event.Model.all);
end Write;
procedure Read (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : out new_model_Event)
is
begin
the_Event.Model := new openGL.remote_Model.item'Class' (openGL.remote_Model.item'Class'Input (Stream));
end Read;
procedure Write (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : in new_physics_model_Event)
is
begin
physics.Remote.Model.item'Class'Output (Stream, the_Event.Model.all);
end Write;
procedure Read (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : out new_physics_model_Event)
is
begin
the_Event.Model := new physics.remote.Model.item'Class' (physics.remote.Model.item'Class'Input (Stream));
end Read;
end gel.remote.World;
|
optikos/oasis | Ada | 4,245 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Simple_Return_Statements is
function Create
(Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Simple_Return_Statement is
begin
return Result : Simple_Return_Statement :=
(Return_Token => Return_Token, Expression => Expression,
Semicolon_Token => Semicolon_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Expression : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Simple_Return_Statement is
begin
return Result : Implicit_Simple_Return_Statement :=
(Expression => Expression, Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Expression
(Self : Base_Simple_Return_Statement)
return Program.Elements.Expressions.Expression_Access is
begin
return Self.Expression;
end Expression;
overriding function Return_Token
(Self : Simple_Return_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Return_Token;
end Return_Token;
overriding function Semicolon_Token
(Self : Simple_Return_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Simple_Return_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Simple_Return_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Simple_Return_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Simple_Return_Statement'Class) is
begin
if Self.Expression.Assigned then
Set_Enclosing_Element (Self.Expression, Self'Unchecked_Access);
end if;
null;
end Initialize;
overriding function Is_Simple_Return_Statement_Element
(Self : Base_Simple_Return_Statement)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Simple_Return_Statement_Element;
overriding function Is_Statement_Element
(Self : Base_Simple_Return_Statement)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Statement_Element;
overriding procedure Visit
(Self : not null access Base_Simple_Return_Statement;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Simple_Return_Statement (Self);
end Visit;
overriding function To_Simple_Return_Statement_Text
(Self : aliased in out Simple_Return_Statement)
return Program.Elements.Simple_Return_Statements
.Simple_Return_Statement_Text_Access is
begin
return Self'Unchecked_Access;
end To_Simple_Return_Statement_Text;
overriding function To_Simple_Return_Statement_Text
(Self : aliased in out Implicit_Simple_Return_Statement)
return Program.Elements.Simple_Return_Statements
.Simple_Return_Statement_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Simple_Return_Statement_Text;
end Program.Nodes.Simple_Return_Statements;
|
stcarrez/ada-awa | Ada | 35,698 | adb | -----------------------------------------------------------------------
-- AWA.Images.Models -- AWA.Images.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
with ASF.Events.Faces.Actions;
pragma Warnings (On);
package body AWA.Images.Models is
pragma Style_Checks ("-mrIu");
pragma Warnings (Off, "formal parameter * is not referenced");
pragma Warnings (Off, "use clause for type *");
pragma Warnings (Off, "use clause for private type *");
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
function Image_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => IMAGE_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Image_Key;
function Image_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => IMAGE_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Image_Key;
function "=" (Left, Right : Image_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Image_Ref'Class;
Impl : out Image_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Image_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Image_Ref) is
Impl : Image_Access;
begin
Impl := new Image_Impl;
Impl.Width := 0;
Impl.Height := 0;
Impl.Thumb_Width := 0;
Impl.Thumb_Height := 0;
Impl.Public := False;
Impl.Version := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Image
-- ----------------------------------------
procedure Set_Id (Object : in out Image_Ref;
Value : in ADO.Identifier) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Image_Ref)
return ADO.Identifier is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Width (Object : in out Image_Ref;
Value : in Integer) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 2, Impl.Width, Value);
end Set_Width;
function Get_Width (Object : in Image_Ref)
return Integer is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Width;
end Get_Width;
procedure Set_Height (Object : in out Image_Ref;
Value : in Integer) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 3, Impl.Height, Value);
end Set_Height;
function Get_Height (Object : in Image_Ref)
return Integer is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Height;
end Get_Height;
procedure Set_Thumb_Width (Object : in out Image_Ref;
Value : in Integer) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 4, Impl.Thumb_Width, Value);
end Set_Thumb_Width;
function Get_Thumb_Width (Object : in Image_Ref)
return Integer is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Thumb_Width;
end Get_Thumb_Width;
procedure Set_Thumb_Height (Object : in out Image_Ref;
Value : in Integer) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 5, Impl.Thumb_Height, Value);
end Set_Thumb_Height;
function Get_Thumb_Height (Object : in Image_Ref)
return Integer is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Thumb_Height;
end Get_Thumb_Height;
procedure Set_Path (Object : in out Image_Ref;
Value : in String) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 6, Impl.Path, Value);
end Set_Path;
procedure Set_Path (Object : in out Image_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 6, Impl.Path, Value);
end Set_Path;
function Get_Path (Object : in Image_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Path);
end Get_Path;
function Get_Path (Object : in Image_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Path;
end Get_Path;
procedure Set_Public (Object : in out Image_Ref;
Value : in Boolean) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Boolean (Impl.all, 7, Impl.Public, Value);
end Set_Public;
function Get_Public (Object : in Image_Ref)
return Boolean is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Public;
end Get_Public;
function Get_Version (Object : in Image_Ref)
return Integer is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Thumbnail (Object : in out Image_Ref;
Value : in AWA.Storages.Models.Storage_Ref'Class) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 9, Impl.Thumbnail, Value);
end Set_Thumbnail;
function Get_Thumbnail (Object : in Image_Ref)
return AWA.Storages.Models.Storage_Ref'Class is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Thumbnail;
end Get_Thumbnail;
procedure Set_Folder (Object : in out Image_Ref;
Value : in AWA.Storages.Models.Storage_Folder_Ref'Class) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 10, Impl.Folder, Value);
end Set_Folder;
function Get_Folder (Object : in Image_Ref)
return AWA.Storages.Models.Storage_Folder_Ref'Class is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Folder;
end Get_Folder;
procedure Set_Owner (Object : in out Image_Ref;
Value : in AWA.Users.Models.User_Ref'Class) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 11, Impl.Owner, Value);
end Set_Owner;
function Get_Owner (Object : in Image_Ref)
return AWA.Users.Models.User_Ref'Class is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Owner;
end Get_Owner;
procedure Set_Storage (Object : in out Image_Ref;
Value : in AWA.Storages.Models.Storage_Ref'Class) is
Impl : Image_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 12, Impl.Storage, Value);
end Set_Storage;
function Get_Storage (Object : in Image_Ref)
return AWA.Storages.Models.Storage_Ref'Class is
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Storage;
end Get_Storage;
-- Copy of the object.
procedure Copy (Object : in Image_Ref;
Into : in out Image_Ref) is
Result : Image_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Image_Access
:= Image_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Image_Access
:= new Image_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Width := Impl.Width;
Copy.Height := Impl.Height;
Copy.Thumb_Width := Impl.Thumb_Width;
Copy.Thumb_Height := Impl.Thumb_Height;
Copy.Path := Impl.Path;
Copy.Public := Impl.Public;
Copy.Version := Impl.Version;
Copy.Thumbnail := Impl.Thumbnail;
Copy.Folder := Impl.Folder;
Copy.Owner := Impl.Owner;
Copy.Storage := Impl.Storage;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Image_Access := new Image_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Image_Access := new Image_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Image_Access := new Image_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Reload (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean) is
Result : ADO.Objects.Object_Record_Access;
Impl : Image_Access;
Query : ADO.SQL.Query;
Id : ADO.Identifier;
begin
if Object.Is_Null then
raise ADO.Objects.NULL_ERROR;
end if;
Object.Prepare_Modify (Result);
Impl := Image_Impl (Result.all)'Access;
Id := ADO.Objects.Get_Key_Value (Impl.all);
Query.Bind_Param (Position => 1, Value => Id);
Query.Bind_Param (Position => 2, Value => Impl.Version);
Query.Set_Filter ("id = ? AND version != ?");
declare
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, IMAGE_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Updated := True;
Impl.Load (Stmt, Session);
else
Updated := False;
end if;
end;
end Reload;
overriding
procedure Save (Object : in out Image_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Image_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Image_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Image_Impl) is
type Image_Impl_Ptr is access all Image_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Image_Impl, Image_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Image_Impl_Ptr := Image_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Image_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, IMAGE_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Image_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (IMAGE_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- width
Value => Object.Width);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- height
Value => Object.Height);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_1_NAME, -- thumb_width
Value => Object.Thumb_Width);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_1_NAME, -- thumb_height
Value => Object.Thumb_Height);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- path
Value => Object.Path);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_1_NAME, -- public
Value => Object.Public);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (9) then
Stmt.Save_Field (Name => COL_8_1_NAME, -- thumbnail_id
Value => Object.Thumbnail);
Object.Clear_Modified (9);
end if;
if Object.Is_Modified (10) then
Stmt.Save_Field (Name => COL_9_1_NAME, -- folder_id
Value => Object.Folder);
Object.Clear_Modified (10);
end if;
if Object.Is_Modified (11) then
Stmt.Save_Field (Name => COL_10_1_NAME, -- owner_id
Value => Object.Owner);
Object.Clear_Modified (11);
end if;
if Object.Is_Modified (12) then
Stmt.Save_Field (Name => COL_11_1_NAME, -- storage_id
Value => Object.Storage);
Object.Clear_Modified (12);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (IMAGE_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- width
Value => Object.Width);
Query.Save_Field (Name => COL_2_1_NAME, -- height
Value => Object.Height);
Query.Save_Field (Name => COL_3_1_NAME, -- thumb_width
Value => Object.Thumb_Width);
Query.Save_Field (Name => COL_4_1_NAME, -- thumb_height
Value => Object.Thumb_Height);
Query.Save_Field (Name => COL_5_1_NAME, -- path
Value => Object.Path);
Query.Save_Field (Name => COL_6_1_NAME, -- public
Value => Object.Public);
Query.Save_Field (Name => COL_7_1_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_8_1_NAME, -- thumbnail_id
Value => Object.Thumbnail);
Query.Save_Field (Name => COL_9_1_NAME, -- folder_id
Value => Object.Folder);
Query.Save_Field (Name => COL_10_1_NAME, -- owner_id
Value => Object.Owner);
Query.Save_Field (Name => COL_11_1_NAME, -- storage_id
Value => Object.Storage);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (IMAGE_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Image_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Image_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Image_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "width" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Width));
elsif Name = "height" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Height));
elsif Name = "thumb_width" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Thumb_Width));
elsif Name = "thumb_height" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Thumb_Height));
elsif Name = "path" then
return Util.Beans.Objects.To_Object (Impl.Path);
elsif Name = "public" then
return Util.Beans.Objects.To_Object (Impl.Public);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Image_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, IMAGE_DEF'Access);
begin
Stmt.Execute;
Image_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Image_Ref;
Impl : constant Image_Access := new Image_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Image_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Width := Stmt.Get_Integer (1);
Object.Height := Stmt.Get_Integer (2);
Object.Thumb_Width := Stmt.Get_Integer (3);
Object.Thumb_Height := Stmt.Get_Integer (4);
Object.Path := Stmt.Get_Unbounded_String (5);
Object.Public := Stmt.Get_Boolean (6);
if not Stmt.Is_Null (8) then
Object.Thumbnail.Set_Key_Value (Stmt.Get_Identifier (8), Session);
end if;
if not Stmt.Is_Null (9) then
Object.Folder.Set_Key_Value (Stmt.Get_Identifier (9), Session);
end if;
if not Stmt.Is_Null (10) then
Object.Owner.Set_Key_Value (Stmt.Get_Identifier (10), Session);
end if;
if not Stmt.Is_Null (11) then
Object.Storage.Set_Key_Value (Stmt.Get_Identifier (11), Session);
end if;
Object.Version := Stmt.Get_Integer (7);
ADO.Objects.Set_Created (Object);
end Load;
procedure Op_Load (Bean : in out Image_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
procedure Op_Load (Bean : in out Image_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
Image_Bean'Class (Bean).Load (Outcome);
end Op_Load;
package Binding_Image_Bean_1 is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Image_Bean,
Method => Op_Load,
Name => "load");
Binding_Image_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (1 => Binding_Image_Bean_1.Proxy'Access
);
-- ------------------------------
-- This bean provides some methods that can be used in a Method_Expression.
-- ------------------------------
overriding
function Get_Method_Bindings (From : in Image_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Image_Bean_Array'Access;
end Get_Method_Bindings;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Image_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "folder_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Folder_Id));
elsif Name = "folder_name" then
return Util.Beans.Objects.To_Object (From.Folder_Name);
elsif Name = "id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id));
elsif Name = "name" then
return Util.Beans.Objects.To_Object (From.Name);
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (From.Create_Date);
elsif Name = "uri" then
return Util.Beans.Objects.To_Object (From.Uri);
elsif Name = "storage" then
return AWA.Storages.Models.Storage_Type_Objects.To_Object (From.Storage);
elsif Name = "mime_type" then
return Util.Beans.Objects.To_Object (From.Mime_Type);
elsif Name = "file_size" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.File_Size));
elsif Name = "is_public" then
return Util.Beans.Objects.To_Object (From.Is_Public);
elsif Name = "width" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Width));
elsif Name = "height" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Height));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Image_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "folder_id" then
Item.Folder_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value));
elsif Name = "folder_name" then
Item.Folder_Name := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "id" then
Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value));
elsif Name = "name" then
Item.Name := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "create_date" then
Item.Create_Date := Util.Beans.Objects.Time.To_Time (Value);
elsif Name = "uri" then
Item.Uri := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "storage" then
Item.Storage := AWA.Storages.Models.Storage_Type_Objects.To_Value (Value);
elsif Name = "mime_type" then
Item.Mime_Type := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "file_size" then
Item.File_Size := Util.Beans.Objects.To_Integer (Value);
elsif Name = "is_public" then
Item.Is_Public := Util.Beans.Objects.To_Boolean (Value);
elsif Name = "width" then
Item.Width := Util.Beans.Objects.To_Integer (Value);
elsif Name = "height" then
Item.Height := Util.Beans.Objects.To_Integer (Value);
end if;
end Set_Value;
-- --------------------
-- Read in the object the data from the query result and prepare to read the next row.
-- If there is no row, raise the ADO.NOT_FOUND exception.
-- --------------------
procedure Read (Into : in out Image_Bean;
Stmt : in out ADO.Statements.Query_Statement'Class) is
begin
if not Stmt.Has_Elements then
raise ADO.Objects.NOT_FOUND;
end if;
Into.Folder_Id := Stmt.Get_Identifier (0);
Into.Folder_Name := Stmt.Get_Unbounded_String (1);
Into.Id := Stmt.Get_Identifier (2);
Into.Name := Stmt.Get_Unbounded_String (3);
Into.Create_Date := Stmt.Get_Time (4);
Into.Uri := Stmt.Get_Unbounded_String (5);
Into.Storage := AWA.Storages.Models.Storage_Type'Enum_Val (Stmt.Get_Integer (6));
Into.Mime_Type := Stmt.Get_Unbounded_String (7);
Into.File_Size := Stmt.Get_Integer (8);
Into.Is_Public := Stmt.Get_Boolean (9);
Into.Width := Stmt.Get_Integer (10);
Into.Height := Stmt.Get_Integer (11);
Stmt.Next;
end Read;
-- --------------------
-- Run the query controlled by <b>Context</b> and load the result in <b>Object</b>.
-- --------------------
procedure Load (Object : in out Image_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context);
begin
Stmt.Execute;
Read (Object, Stmt);
if Stmt.Has_Elements then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Image_Info;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id));
elsif Name = "name" then
return Util.Beans.Objects.To_Object (From.Name);
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (From.Create_Date);
elsif Name = "uri" then
return Util.Beans.Objects.To_Object (From.Uri);
elsif Name = "storage" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Storage));
elsif Name = "mime_type" then
return Util.Beans.Objects.To_Object (From.Mime_Type);
elsif Name = "file_size" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.File_Size));
elsif Name = "width" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Width));
elsif Name = "height" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Height));
elsif Name = "thumb_width" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Thumb_Width));
elsif Name = "thumb_height" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Thumb_Height));
elsif Name = "thumbnail_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Thumbnail_Id));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Image_Info;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "id" then
Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value));
elsif Name = "name" then
Item.Name := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "create_date" then
Item.Create_Date := Util.Beans.Objects.Time.To_Time (Value);
elsif Name = "uri" then
Item.Uri := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "storage" then
Item.Storage := Util.Beans.Objects.To_Integer (Value);
elsif Name = "mime_type" then
Item.Mime_Type := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "file_size" then
Item.File_Size := Util.Beans.Objects.To_Integer (Value);
elsif Name = "width" then
Item.Width := Util.Beans.Objects.To_Integer (Value);
elsif Name = "height" then
Item.Height := Util.Beans.Objects.To_Integer (Value);
elsif Name = "thumb_width" then
Item.Thumb_Width := Util.Beans.Objects.To_Integer (Value);
elsif Name = "thumb_height" then
Item.Thumb_Height := Util.Beans.Objects.To_Integer (Value);
elsif Name = "thumbnail_id" then
Item.Thumbnail_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value));
end if;
end Set_Value;
-- --------------------
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
-- --------------------
procedure List (Object : in out Image_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
begin
List (Object.List, Session, Context);
end List;
-- --------------------
-- The list of images for a given folder.
-- --------------------
procedure List (Object : in out Image_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
procedure Read (Into : in out Image_Info);
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Context);
Pos : Positive := 1;
procedure Read (Into : in out Image_Info) is
begin
Into.Id := Stmt.Get_Identifier (0);
Into.Name := Stmt.Get_Unbounded_String (1);
Into.Create_Date := Stmt.Get_Time (2);
Into.Uri := Stmt.Get_Unbounded_String (3);
Into.Storage := Stmt.Get_Integer (4);
Into.Mime_Type := Stmt.Get_Unbounded_String (5);
Into.File_Size := Stmt.Get_Integer (6);
Into.Width := Stmt.Get_Integer (7);
Into.Height := Stmt.Get_Integer (8);
Into.Thumb_Width := Stmt.Get_Integer (9);
Into.Thumb_Height := Stmt.Get_Integer (10);
Into.Thumbnail_Id := Stmt.Get_Identifier (11);
end Read;
begin
Stmt.Execute;
Image_Info_Vectors.Clear (Object);
while Stmt.Has_Elements loop
Object.Insert_Space (Before => Pos);
Object.Update_Element (Index => Pos, Process => Read'Access);
Pos := Pos + 1;
Stmt.Next;
end loop;
end List;
end AWA.Images.Models;
|
AdaCore/Ada_Drivers_Library | Ada | 8,904 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This is a driver for the PCD8544 monochrome LCD controller --
-- --
-- Datasheet: --
-- https://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf --
-- --
-- Use a SPI clock of 4 MHz or less. The SPI peripheral should be --
-- configured to transmit MSB-first, 8 bit data size, CPOL=0, CPHA=1 --
-- This is sometimes referred to as a "Mode 1" SPI configuration. --
-- --
-- Minimum transition time for RST, CS, and DC is 100ns. HAL.Time doesn't --
-- support nanosecond delays, so this module uses a delay of 1 microsecond --
-- instead. --
-- --
-- CS may be null if it's connected to the SPI controller or tied to --
-- ground. --
-- --
-- RST may be null if it's controlled externally or you only expect to --
-- Initialize once per power cycle. --
------------------------------------------------------------------------------
with HAL; use HAL;
with HAL.GPIO; use HAL.GPIO;
with HAL.SPI; use HAL.SPI;
with HAL.Framebuffer; use HAL.Framebuffer;
with HAL.Bitmap; use HAL.Bitmap;
with HAL.Time; use HAL.Time;
with Memory_Mapped_Bitmap; use Memory_Mapped_Bitmap;
with PCD8544_Reg; use PCD8544_Reg;
package PCD8544 is
type PCD8544_Device
(Port : not null Any_SPI_Port;
DC : not null Any_GPIO_Point;
RST, CS : Any_GPIO_Point;
Time : not null HAL.Time.Any_Delays)
is limited new HAL.Framebuffer.Frame_Buffer_Display with private;
type Any_PCD8544_Device is access all PCD8544_Device'Class;
-- See datasheet section 8.9 for contrast (Vop) values
subtype PCD8544_Contrast is UInt8 range 0 .. 127;
PCD8544_Default_Contrast : constant PCD8544_Contrast := 48;
-- See datasheet Table 4 for bias mux rate values. We default to 1:48 as
-- that reportedly works well on most LCDs.
subtype PCD8544_Bias is UInt8 range 0 .. 4;
PCD8544_Default_Bias : constant PCD8544_Bias := 3;
-- See datasheet Figure 7 for TC values. Use higher values at lower
-- temperatures.
subtype PCD8544_Temperature_Coefficient is UInt8 range 0 .. 3;
PCD8544_Default_Temperature_Coefficient :
constant PCD8544_Temperature_Coefficient := 0;
SPI_Error : exception;
Device_Width : constant := 48;
Device_Height : constant := 84;
procedure Initialize
(This : in out PCD8544_Device);
procedure Set_Contrast
(This : in out PCD8544_Device;
Contrast : in PCD8544_Contrast);
procedure Set_Bias
(This : in out PCD8544_Device;
Bias : in PCD8544_Bias);
procedure Set_Temperature
(This : in out PCD8544_Device;
TC : in PCD8544_Temperature_Coefficient);
procedure Set_Display_Mode
(This : in out PCD8544_Device;
Enable : in Boolean;
Invert : in Boolean);
overriding
function Max_Layers (This : PCD8544_Device) return Positive;
overriding
function Supported
(This : PCD8544_Device;
Mode : FB_Color_Mode)
return Boolean;
overriding
procedure Set_Orientation
(This : in out PCD8544_Device;
Orientation : Display_Orientation);
overriding
procedure Set_Mode
(This : in out PCD8544_Device;
Mode : Wait_Mode);
overriding
function Initialized
(This : PCD8544_Device) return Boolean;
overriding
function Width
(This : PCD8544_Device) return Positive;
overriding
function Height
(This : PCD8544_Device) return Positive;
overriding
function Swapped
(This : PCD8544_Device) return Boolean;
overriding
procedure Set_Background
(This : PCD8544_Device;
R, G, B : UInt8);
overriding
procedure Initialize_Layer
(This : in out PCD8544_Device;
Layer : Positive;
Mode : FB_Color_Mode;
X, Y : Natural := 0;
Width, Height : Positive := Positive'Last);
overriding
function Initialized
(This : PCD8544_Device;
Layer : Positive) return Boolean;
overriding
procedure Update_Layer
(This : in out PCD8544_Device;
Layer : Positive;
Copy_Back : Boolean := False);
overriding
procedure Update_Layers
(This : in out PCD8544_Device);
overriding
function Color_Mode
(This : PCD8544_Device;
Layer : Positive) return FB_Color_Mode;
overriding
function Hidden_Buffer
(This : in out PCD8544_Device;
Layer : Positive)
return not null HAL.Bitmap.Any_Bitmap_Buffer;
overriding
function Pixel_Size
(Display : PCD8544_Device;
Layer : Positive) return Positive;
private
type PCD8544_Bitmap_Buffer is new Memory_Mapped_Bitmap_Buffer
with record
Data : UInt8_Array (1 .. ((Device_Width * Device_Height) / UInt8'Size));
end record;
type PCD8544_Device
(Port : not null Any_SPI_Port;
DC : not null Any_GPIO_Point;
RST, CS : Any_GPIO_Point;
Time : not null HAL.Time.Any_Delays)
is limited new HAL.Framebuffer.Frame_Buffer_Display with
record
Memory_Layer : aliased PCD8544_Bitmap_Buffer;
Device_Initialized : Boolean := False;
Layer_Initialized : Boolean := False;
FR : PCD8544_Function_Register;
DR : PCD8544_Display_Register;
end record;
procedure Chip_Select (This : PCD8544_Device; Enabled : in Boolean);
procedure Reset (This : in out PCD8544_Device);
procedure Transmit (This : PCD8544_Device; Data : in UInt8);
procedure Transmit (This : PCD8544_Device; Data : in UInt8_Array);
procedure Extended_Mode (This : in out PCD8544_Device);
procedure Basic_Mode (This : in out PCD8544_Device);
procedure Write_Raw_Pixels (This : in out PCD8544_Device; Data : in UInt8_Array);
end PCD8544;
|
Rodeo-McCabe/orka | Ada | 4,988 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2013 Felix Krause <[email protected]>
--
-- 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 Glfw.API;
with Glfw.Enums;
package body Glfw.Windows.Hints is
procedure Reset_To_Defaults renames API.Default_Window_Hints;
procedure Set_Focused (Value : Boolean) is
begin
API.Window_Hint (Enums.Focused, Bool (Value));
end Set_Focused;
procedure Set_Floating (Value : Boolean) is
begin
API.Window_Hint (Enums.Floating, Bool (Value));
end Set_Floating;
procedure Set_Maximized (Value : Boolean) is
begin
API.Window_Hint (Enums.Maximized, Bool (Value));
end Set_Maximized;
procedure Set_Resizable (Value : Boolean) is
begin
API.Window_Hint (Enums.Resizable, Bool (Value));
end Set_Resizable;
procedure Set_Visible (Value : Boolean) is
begin
API.Window_Hint (Enums.Visible, Bool (Value));
end Set_Visible;
procedure Set_Decorated (Value : Boolean) is
begin
API.Window_Hint (Enums.Decorated, Bool (Value));
end Set_Decorated;
procedure Set_Focus_On_Show (Value : Boolean) is
begin
API.Window_Hint (Enums.Focus_On_Show, Bool (Value));
end Set_Focus_On_Show;
procedure Set_Auto_Iconify (Value : Boolean) is
begin
API.Window_Hint (Enums.Auto_Iconify, Bool (Value));
end Set_Auto_Iconify;
procedure Set_Center_On_Cursor (Value : Boolean) is
begin
API.Window_Hint (Enums.Center_Cursor, Bool (Value));
end Set_Center_On_Cursor;
procedure Set_Scale_To_Monitor (Value : Boolean) is
begin
API.Window_Hint (Enums.Scale_To_Monitor, Bool (Value));
end Set_Scale_To_Monitor;
procedure Set_Transparent_Framebuffer (Value : Boolean) is
begin
API.Window_Hint (Enums.Transparent, Bool (Value));
end Set_Transparent_Framebuffer;
procedure Set_Color_Bits (Red, Green, Blue, Alpha : Natural) is
begin
API.Window_Hint (Enums.Red_Bits, Interfaces.C.int (Red));
API.Window_Hint (Enums.Green_Bits, Interfaces.C.int (Green));
API.Window_Hint (Enums.Blue_Bits, Interfaces.C.int (Blue));
API.Window_Hint (Enums.Alpha_Bits, Interfaces.C.int (Alpha));
end Set_Color_Bits;
procedure Set_Depth_Bits (Value : Natural) is
begin
API.Window_Hint (Enums.Depth_Bits, Interfaces.C.int (Value));
end Set_Depth_Bits;
procedure Set_Stencil_Bits (Value : Natural) is
begin
API.Window_Hint (Enums.Stencil_Bits, Interfaces.C.int (Value));
end Set_Stencil_Bits;
procedure Set_Stereo (Value : Boolean) is
begin
API.Window_Hint (Enums.Stereo, Bool (Value));
end Set_Stereo;
procedure Set_Samples (Value : Natural) is
begin
API.Window_Hint (Enums.Samples, Interfaces.C.int (Value));
end Set_Samples;
procedure Set_SRGB_Capable (Value : Boolean) is
begin
API.Window_Hint (Enums.SRGB_Capable, Bool (Value));
end Set_SRGB_Capable;
procedure Set_Refresh_Rate (Value : Natural) is
begin
API.Window_Hint (Enums.Refresh_Rate, Interfaces.C.int (Value));
end Set_Refresh_Rate;
procedure Set_Client_API (Value : Context.API_Kind) is
begin
API.Window_Hint (Enums.Client_API, Value);
end Set_Client_API;
procedure Set_Minimum_OpenGL_Version (Major : Positive; Minor : Natural) is
begin
API.Window_Hint (Enums.Context_Version_Major, Interfaces.C.int (Major));
API.Window_Hint (Enums.Context_Version_Minor, Interfaces.C.int (Minor));
end Set_Minimum_OpenGL_Version;
procedure Set_Robustness (Value : Context.Robustness_Kind) is
begin
API.Window_Hint (Enums.Context_Robustness, Value);
end Set_Robustness;
procedure Set_Forward_Compat (Value : Boolean) is
begin
API.Window_Hint (Enums.OpenGL_Forward_Compat, Bool (Value));
end Set_Forward_Compat;
procedure Set_Debug_Context (Value : Boolean) is
begin
API.Window_Hint (Enums.OpenGL_Debug_Context, Bool (Value));
end Set_Debug_Context;
procedure Set_Profile (Value : Context.OpenGL_Profile_Kind) is
begin
API.Window_Hint (Enums.OpenGL_Profile, Value);
end Set_Profile;
procedure Set_Release_Behavior (Value : Context.Release_Behavior) is
begin
API.Window_Hint (Enums.Context_Rel_Behavior, Value);
end Set_Release_Behavior;
procedure Set_No_Error_Context (Value : Boolean) is
begin
API.Window_Hint (Enums.Context_No_Error, Bool (Value));
end Set_No_Error_Context;
end Glfw.Windows.Hints;
|
reznikmm/matreshka | Ada | 4,309 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Matreshka.DOM_Nodes;
with XML.DOM.Attributes.Internals;
package body ODF.DOM.Attributes.Style.Next_Style_Name.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Attributes.Style.Next_Style_Name.Style_Next_Style_Name_Access)
return ODF.DOM.Attributes.Style.Next_Style_Name.ODF_Style_Next_Style_Name is
begin
return
(XML.DOM.Attributes.Internals.Create
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Create;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.ODF_Attributes.Style.Next_Style_Name.Style_Next_Style_Name_Access)
return ODF.DOM.Attributes.Style.Next_Style_Name.ODF_Style_Next_Style_Name is
begin
return
(XML.DOM.Attributes.Internals.Wrap
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Attributes.Style.Next_Style_Name.Internals;
|
stcarrez/ada-util | Ada | 17,147 | ads | -- Generated by gperfhash
package Util.Perfect_Hash is
function Hash (S : String) return Natural;
-- Returns true if the string <b>S</b> is a keyword.
function Is_Keyword (S : in String) return Boolean;
type Name_Access is access constant String;
type Keyword_Array is array (Natural range <>) of Name_Access;
Keywords : constant Keyword_Array;
private
K_0 : aliased constant String := "ACCESSIBLE";
K_1 : aliased constant String := "ADD";
K_2 : aliased constant String := "ALL";
K_3 : aliased constant String := "ALTER";
K_4 : aliased constant String := "ANALYZE";
K_5 : aliased constant String := "AND";
K_6 : aliased constant String := "AS";
K_7 : aliased constant String := "ASC";
K_8 : aliased constant String := "ASENSITIVE";
K_9 : aliased constant String := "BEFORE";
K_10 : aliased constant String := "BETWEEN";
K_11 : aliased constant String := "BIGINT";
K_12 : aliased constant String := "BINARY";
K_13 : aliased constant String := "BLOB";
K_14 : aliased constant String := "BOTH";
K_15 : aliased constant String := "BY";
K_16 : aliased constant String := "CALL";
K_17 : aliased constant String := "CASCADE";
K_18 : aliased constant String := "CASE";
K_19 : aliased constant String := "CHANGE";
K_20 : aliased constant String := "CHAR";
K_21 : aliased constant String := "CHARACTER";
K_22 : aliased constant String := "CHECK";
K_23 : aliased constant String := "COLLATE";
K_24 : aliased constant String := "COLUMN";
K_25 : aliased constant String := "CONDITION";
K_26 : aliased constant String := "CONSTRAINT";
K_27 : aliased constant String := "CONTINUE";
K_28 : aliased constant String := "CONVERT";
K_29 : aliased constant String := "CREATE";
K_30 : aliased constant String := "CROSS";
K_31 : aliased constant String := "CURRENT_DATE";
K_32 : aliased constant String := "CURRENT_TIME";
K_33 : aliased constant String := "CURRENT_TIMESTAMP";
K_34 : aliased constant String := "CURRENT_USER";
K_35 : aliased constant String := "CURSOR";
K_36 : aliased constant String := "DATABASE";
K_37 : aliased constant String := "DATABASES";
K_38 : aliased constant String := "DAY_HOUR";
K_39 : aliased constant String := "DAY_MICROSECOND";
K_40 : aliased constant String := "DAY_MINUTE";
K_41 : aliased constant String := "DAY_SECOND";
K_42 : aliased constant String := "DEC";
K_43 : aliased constant String := "DECIMAL";
K_44 : aliased constant String := "DECLARE";
K_45 : aliased constant String := "DEFAULT";
K_46 : aliased constant String := "DELAYED";
K_47 : aliased constant String := "DELETE";
K_48 : aliased constant String := "DESC";
K_49 : aliased constant String := "DESCRIBE";
K_50 : aliased constant String := "DETERMINISTIC";
K_51 : aliased constant String := "DISTINCT";
K_52 : aliased constant String := "DISTINCTROW";
K_53 : aliased constant String := "DIV";
K_54 : aliased constant String := "DOUBLE";
K_55 : aliased constant String := "DROP";
K_56 : aliased constant String := "DUAL";
K_57 : aliased constant String := "EACH";
K_58 : aliased constant String := "ELSE";
K_59 : aliased constant String := "ELSEIF";
K_60 : aliased constant String := "ENCLOSED";
K_61 : aliased constant String := "ESCAPED";
K_62 : aliased constant String := "EXISTS";
K_63 : aliased constant String := "EXIT";
K_64 : aliased constant String := "EXPLAIN";
K_65 : aliased constant String := "FALSE";
K_66 : aliased constant String := "FETCH";
K_67 : aliased constant String := "FLOAT";
K_68 : aliased constant String := "FLOAT4";
K_69 : aliased constant String := "FLOAT8";
K_70 : aliased constant String := "FOR";
K_71 : aliased constant String := "FORCE";
K_72 : aliased constant String := "FOREIGN";
K_73 : aliased constant String := "FROM";
K_74 : aliased constant String := "FULLTEXT";
K_75 : aliased constant String := "GRANT";
K_76 : aliased constant String := "GROUP";
K_77 : aliased constant String := "HAVING";
K_78 : aliased constant String := "HIGH_PRIORITY";
K_79 : aliased constant String := "HOUR_MICROSECOND";
K_80 : aliased constant String := "HOUR_MINUTE";
K_81 : aliased constant String := "HOUR_SECOND";
K_82 : aliased constant String := "IF";
K_83 : aliased constant String := "IGNORE";
K_84 : aliased constant String := "IN";
K_85 : aliased constant String := "INDEX";
K_86 : aliased constant String := "INFILE";
K_87 : aliased constant String := "INNER";
K_88 : aliased constant String := "INOUT";
K_89 : aliased constant String := "INSENSITIVE";
K_90 : aliased constant String := "INSERT";
K_91 : aliased constant String := "INT";
K_92 : aliased constant String := "INT1";
K_93 : aliased constant String := "INT2";
K_94 : aliased constant String := "INT3";
K_95 : aliased constant String := "INT4";
K_96 : aliased constant String := "INT8";
K_97 : aliased constant String := "INTEGER";
K_98 : aliased constant String := "INTERVAL";
K_99 : aliased constant String := "INTO";
K_100 : aliased constant String := "IS";
K_101 : aliased constant String := "ITERATE";
K_102 : aliased constant String := "JOIN";
K_103 : aliased constant String := "KEY";
K_104 : aliased constant String := "KEYS";
K_105 : aliased constant String := "KILL";
K_106 : aliased constant String := "LEADING";
K_107 : aliased constant String := "LEAVE";
K_108 : aliased constant String := "LEFT";
K_109 : aliased constant String := "LIKE";
K_110 : aliased constant String := "LIMIT";
K_111 : aliased constant String := "LINEAR";
K_112 : aliased constant String := "LINES";
K_113 : aliased constant String := "LOAD";
K_114 : aliased constant String := "LOCALTIME";
K_115 : aliased constant String := "LOCALTIMESTAMP";
K_116 : aliased constant String := "LOCK";
K_117 : aliased constant String := "LONG";
K_118 : aliased constant String := "LONGBLOB";
K_119 : aliased constant String := "LONGTEXT";
K_120 : aliased constant String := "LOOP";
K_121 : aliased constant String := "LOW_PRIORITY";
K_122 : aliased constant String := "MASTER_SSL_VERIFY_SERVER_CERT";
K_123 : aliased constant String := "MATCH";
K_124 : aliased constant String := "MAXVALUE";
K_125 : aliased constant String := "MEDIUMBLOB";
K_126 : aliased constant String := "MEDIUMINT";
K_127 : aliased constant String := "MEDIUMTEXT";
K_128 : aliased constant String := "MIDDLEINT";
K_129 : aliased constant String := "MINUTE_MICROSECOND";
K_130 : aliased constant String := "MINUTE_SECOND";
K_131 : aliased constant String := "MOD";
K_132 : aliased constant String := "MODIFIES";
K_133 : aliased constant String := "NATURAL";
K_134 : aliased constant String := "NOT";
K_135 : aliased constant String := "NO_WRITE_TO_BINLOG";
K_136 : aliased constant String := "NULL";
K_137 : aliased constant String := "NUMERIC";
K_138 : aliased constant String := "ON";
K_139 : aliased constant String := "OPTIMIZE";
K_140 : aliased constant String := "OPTION";
K_141 : aliased constant String := "OPTIONALLY";
K_142 : aliased constant String := "OR";
K_143 : aliased constant String := "ORDER";
K_144 : aliased constant String := "OUT";
K_145 : aliased constant String := "OUTER";
K_146 : aliased constant String := "OUTFILE";
K_147 : aliased constant String := "PRECISION";
K_148 : aliased constant String := "PRIMARY";
K_149 : aliased constant String := "PROCEDURE";
K_150 : aliased constant String := "PURGE";
K_151 : aliased constant String := "RANGE";
K_152 : aliased constant String := "READ";
K_153 : aliased constant String := "READS";
K_154 : aliased constant String := "READ_WRITE";
K_155 : aliased constant String := "REAL";
K_156 : aliased constant String := "REFERENCES";
K_157 : aliased constant String := "REGEXP";
K_158 : aliased constant String := "RELEASE";
K_159 : aliased constant String := "RENAME";
K_160 : aliased constant String := "REPEAT";
K_161 : aliased constant String := "REPLACE";
K_162 : aliased constant String := "REQUIRE";
K_163 : aliased constant String := "RESIGNAL";
K_164 : aliased constant String := "RESTRICT";
K_165 : aliased constant String := "RETURN";
K_166 : aliased constant String := "REVOKE";
K_167 : aliased constant String := "RIGHT";
K_168 : aliased constant String := "RLIKE";
K_169 : aliased constant String := "SCHEMA";
K_170 : aliased constant String := "SCHEMAS";
K_171 : aliased constant String := "SECOND_MICROSECOND";
K_172 : aliased constant String := "SELECT";
K_173 : aliased constant String := "SENSITIVE";
K_174 : aliased constant String := "SEPARATOR";
K_175 : aliased constant String := "SET";
K_176 : aliased constant String := "SHOW";
K_177 : aliased constant String := "SIGNAL";
K_178 : aliased constant String := "SMALLINT";
K_179 : aliased constant String := "SPATIAL";
K_180 : aliased constant String := "SPECIFIC";
K_181 : aliased constant String := "SQL";
K_182 : aliased constant String := "SQLEXCEPTION";
K_183 : aliased constant String := "SQLSTATE";
K_184 : aliased constant String := "SQLWARNING";
K_185 : aliased constant String := "SQL_BIG_RESULT";
K_186 : aliased constant String := "SQL_CALC_FOUND_ROWS";
K_187 : aliased constant String := "SQL_SMALL_RESULT";
K_188 : aliased constant String := "SSL";
K_189 : aliased constant String := "STARTING";
K_190 : aliased constant String := "STRAIGHT_JOIN";
K_191 : aliased constant String := "TABLE";
K_192 : aliased constant String := "TERMINATED";
K_193 : aliased constant String := "THEN";
K_194 : aliased constant String := "TINYBLOB";
K_195 : aliased constant String := "TINYINT";
K_196 : aliased constant String := "TINYTEXT";
K_197 : aliased constant String := "TO";
K_198 : aliased constant String := "TRAILING";
K_199 : aliased constant String := "TRIGGER";
K_200 : aliased constant String := "TRUE";
K_201 : aliased constant String := "UNDO";
K_202 : aliased constant String := "UNION";
K_203 : aliased constant String := "UNIQUE";
K_204 : aliased constant String := "UNLOCK";
K_205 : aliased constant String := "UNSIGNED";
K_206 : aliased constant String := "UPDATE";
K_207 : aliased constant String := "USAGE";
K_208 : aliased constant String := "USE";
K_209 : aliased constant String := "USING";
K_210 : aliased constant String := "UTC_DATE";
K_211 : aliased constant String := "UTC_TIME";
K_212 : aliased constant String := "UTC_TIMESTAMP";
K_213 : aliased constant String := "VALUES";
K_214 : aliased constant String := "VARBINARY";
K_215 : aliased constant String := "VARCHAR";
K_216 : aliased constant String := "VARCHARACTER";
K_217 : aliased constant String := "VARYING";
K_218 : aliased constant String := "WHEN";
K_219 : aliased constant String := "WHERE";
K_220 : aliased constant String := "WHILE";
K_221 : aliased constant String := "WITH";
K_222 : aliased constant String := "WRITE";
K_223 : aliased constant String := "XOR";
K_224 : aliased constant String := "YEAR_MONTH";
K_225 : aliased constant String := "ZEROFILL";
Keywords : constant Keyword_Array := (
K_0'Access, K_1'Access, K_2'Access, K_3'Access,
K_4'Access, K_5'Access, K_6'Access, K_7'Access,
K_8'Access, K_9'Access, K_10'Access, K_11'Access,
K_12'Access, K_13'Access, K_14'Access, K_15'Access,
K_16'Access, K_17'Access, K_18'Access, K_19'Access,
K_20'Access, K_21'Access, K_22'Access, K_23'Access,
K_24'Access, K_25'Access, K_26'Access, K_27'Access,
K_28'Access, K_29'Access, K_30'Access, K_31'Access,
K_32'Access, K_33'Access, K_34'Access, K_35'Access,
K_36'Access, K_37'Access, K_38'Access, K_39'Access,
K_40'Access, K_41'Access, K_42'Access, K_43'Access,
K_44'Access, K_45'Access, K_46'Access, K_47'Access,
K_48'Access, K_49'Access, K_50'Access, K_51'Access,
K_52'Access, K_53'Access, K_54'Access, K_55'Access,
K_56'Access, K_57'Access, K_58'Access, K_59'Access,
K_60'Access, K_61'Access, K_62'Access, K_63'Access,
K_64'Access, K_65'Access, K_66'Access, K_67'Access,
K_68'Access, K_69'Access, K_70'Access, K_71'Access,
K_72'Access, K_73'Access, K_74'Access, K_75'Access,
K_76'Access, K_77'Access, K_78'Access, K_79'Access,
K_80'Access, K_81'Access, K_82'Access, K_83'Access,
K_84'Access, K_85'Access, K_86'Access, K_87'Access,
K_88'Access, K_89'Access, K_90'Access, K_91'Access,
K_92'Access, K_93'Access, K_94'Access, K_95'Access,
K_96'Access, K_97'Access, K_98'Access, K_99'Access,
K_100'Access, K_101'Access, K_102'Access, K_103'Access,
K_104'Access, K_105'Access, K_106'Access, K_107'Access,
K_108'Access, K_109'Access, K_110'Access, K_111'Access,
K_112'Access, K_113'Access, K_114'Access, K_115'Access,
K_116'Access, K_117'Access, K_118'Access, K_119'Access,
K_120'Access, K_121'Access, K_122'Access, K_123'Access,
K_124'Access, K_125'Access, K_126'Access, K_127'Access,
K_128'Access, K_129'Access, K_130'Access, K_131'Access,
K_132'Access, K_133'Access, K_134'Access, K_135'Access,
K_136'Access, K_137'Access, K_138'Access, K_139'Access,
K_140'Access, K_141'Access, K_142'Access, K_143'Access,
K_144'Access, K_145'Access, K_146'Access, K_147'Access,
K_148'Access, K_149'Access, K_150'Access, K_151'Access,
K_152'Access, K_153'Access, K_154'Access, K_155'Access,
K_156'Access, K_157'Access, K_158'Access, K_159'Access,
K_160'Access, K_161'Access, K_162'Access, K_163'Access,
K_164'Access, K_165'Access, K_166'Access, K_167'Access,
K_168'Access, K_169'Access, K_170'Access, K_171'Access,
K_172'Access, K_173'Access, K_174'Access, K_175'Access,
K_176'Access, K_177'Access, K_178'Access, K_179'Access,
K_180'Access, K_181'Access, K_182'Access, K_183'Access,
K_184'Access, K_185'Access, K_186'Access, K_187'Access,
K_188'Access, K_189'Access, K_190'Access, K_191'Access,
K_192'Access, K_193'Access, K_194'Access, K_195'Access,
K_196'Access, K_197'Access, K_198'Access, K_199'Access,
K_200'Access, K_201'Access, K_202'Access, K_203'Access,
K_204'Access, K_205'Access, K_206'Access, K_207'Access,
K_208'Access, K_209'Access, K_210'Access, K_211'Access,
K_212'Access, K_213'Access, K_214'Access, K_215'Access,
K_216'Access, K_217'Access, K_218'Access, K_219'Access,
K_220'Access, K_221'Access, K_222'Access, K_223'Access,
K_224'Access, K_225'Access);
end Util.Perfect_Hash;
|
kjseefried/The-Dice-Roller | Ada | 1,025 | ads | -------------------------------------------------------------------------------
-- Dice.Random (spec)
--
-- Random number generator. Generates the actual dice rolls.
--
-- Author: Thomas LÝcke
-- Copyleft 2010. You may freely do with this source as you wish.
-------------------------------------------------------------------------------
package Dice.Random is
procedure Get_Random (A_Low : in Natural;
A_High : in Natural;
A_Dice_Amount : in Natural;
A_Total : in out Natural;
A_Result_List : in out Result_Container.Vector);
-- Get_Random builds a list of dice roll results and appends them to the
-- Result_Container.Vector.
-- The results are random numbers in the range A_Low .. A_High.
-- An A_Dice_Amount of results are calculated, along with the A_Total,
-- which is the sum of all the individual dice rolls.
-- EXCEPTIONS:
-- none
end Dice.Random;
|
reznikmm/matreshka | Ada | 3,445 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with WUI.Widgets.Buttons.Check_Boxes;
package WUI.Check_Boxes renames WUI.Widgets.Buttons.Check_Boxes;
|
stcarrez/ada-ado | Ada | 1,800 | adb | -----------------------------------------------------------------------
-- ado-mysql -- Database Drivers
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO.Configs;
with ADO.Connections.Mysql;
package body ADO.Mysql is
-- ------------------------------
-- Initialize the Mysql driver.
-- ------------------------------
procedure Initialize is
begin
ADO.Connections.Mysql.Initialize;
end Initialize;
-- ------------------------------
-- Initialize the drivers and the library by reading the property file
-- and configure the runtime with it.
-- ------------------------------
procedure Initialize (Config : in String) is
begin
ADO.Configs.Initialize (Config);
Initialize;
end Initialize;
-- ------------------------------
-- Initialize the drivers and the library and configure the runtime with the given properties.
-- ------------------------------
procedure Initialize (Config : in Util.Properties.Manager'Class) is
begin
ADO.Configs.Initialize (Config);
Initialize;
end Initialize;
end ADO.Mysql;
|
sonneveld/adazmq | Ada | 1,436 | adb | -- Task worker
-- Connects PULL socket to tcp://localhost:5557
-- Collects workloads from ventilator via that socket
-- Connects PUSH socket to tcp://localhost:5558
-- Sends results to sink via that socket
with Ada.Command_Line;
with Ada.Text_IO;
with GNAT.Formatted_String;
with ZMQ;
procedure TaskWork is
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;
-- Socket to receive messages on
Receiver : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_PULL);
-- Socket to send messages to
Sender : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_PUSH);
begin
Receiver.Connect ("tcp://localhost:5557");
Sender.Connect ("tcp://localhost:5558");
-- Process tasks forever
loop
declare
Buf : constant String := Receiver.Recv;
begin
Ada.Text_IO.Put (Buf &"."); -- Show progress
Ada.Text_IO.Flush;
delay Duration'Value (Buf) / 1000.0; -- Do the work
Sender.Send ("");
end;
end loop;
Receiver.Close;
Sender.Close;
Context.Term;
end;
return 0;
end Main;
begin
Ada.Command_Line.Set_Exit_Status (Main);
end TaskWork;
|
AdaCore/gpr | Ada | 2,109 | adb | ------------------------------------------------------------------------------
-- --
-- GPR2 PROJECT MANAGER --
-- --
-- Copyright (C) 2019-2023, AdaCore --
-- --
-- This 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. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY 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, --
-- see <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
-- Representation of Time Stamps
with Ada.Calendar.Time_Zones;
with GNAT.Calendar.Time_IO;
package body GPR2.Time_Stamp is
use GNAT.Calendar.Time_IO;
---------------
-- From_Time --
---------------
function From_Time
(Time : Calendar.Time) return Data is
begin
return Data (Image (Time, "%Y%m%d%H%M%S"));
end From_Time;
--------------
-- UTC_Time --
--------------
function UTC_Time return Data is
use type Ada.Calendar.Time;
Now : constant Calendar.Time :=
Calendar.Clock
- Duration (Calendar.Time_Zones.UTC_Time_Offset) * 60;
-- The UTC_Time_Offset is in minutes
begin
return Data (Image (Now, "%Y%m%d%H%M%S"));
end UTC_Time;
end GPR2.Time_Stamp;
|
reznikmm/matreshka | Ada | 4,765 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Office_Presentation_Elements;
package Matreshka.ODF_Office.Presentation_Elements is
type Office_Presentation_Element_Node is
new Matreshka.ODF_Office.Abstract_Office_Element_Node
and ODF.DOM.Office_Presentation_Elements.ODF_Office_Presentation
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Office_Presentation_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Office_Presentation_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Office_Presentation_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Office_Presentation_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Office_Presentation_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Office.Presentation_Elements;
|
reznikmm/matreshka | Ada | 4,671 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Anchor_Page_Number_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Anchor_Page_Number_Attribute_Node is
begin
return Self : Text_Anchor_Page_Number_Attribute_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Anchor_Page_Number_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Anchor_Page_Number_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Anchor_Page_Number_Attribute,
Text_Anchor_Page_Number_Attribute_Node'Tag);
end Matreshka.ODF_Text.Anchor_Page_Number_Attributes;
|
glencornell/ada-object-framework | Ada | 2,281 | ads | -- Copyright (C) 2020 Glen Cornell <[email protected]>
--
-- 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 Aof.Core.Root_Objects;
with Aof.Core.Generic_Properties;
with Ada.Strings.Unbounded;
package Aof.Core.Properties is
pragma Preelaborate;
-- Instantiations of the Generic_Properties package of commonly
-- used types.
package Unbounded_Strings is new Aof.Core.Generic_Properties
(Object => Aof.Core.Root_Objects.Root_Object,
Access_Object => Aof.Core.Root_Objects.Access_Object,
T => Ada.Strings.Unbounded.Unbounded_String);
package Booleans is new Aof.Core.Generic_Properties
(Object => Aof.Core.Root_Objects.Root_Object,
Access_Object => Aof.Core.Root_Objects.Access_Object,
T => Boolean);
package Naturals is new Aof.Core.Generic_Properties
(Object => Aof.Core.Root_Objects.Root_Object,
Access_Object => Aof.Core.Root_Objects.Access_Object,
T => Natural);
package Integers is new Aof.Core.Generic_Properties
(Object => Aof.Core.Root_Objects.Root_Object,
Access_Object => Aof.Core.Root_Objects.Access_Object,
T => Integer);
package Floats is new Aof.Core.Generic_Properties
(Object => Aof.Core.Root_Objects.Root_Object,
Access_Object => Aof.Core.Root_Objects.Access_Object,
T => Float);
package Long_Floats is new Aof.Core.Generic_Properties
(Object => Aof.Core.Root_Objects.Root_Object,
Access_Object => Aof.Core.Root_Objects.Access_Object,
T => Long_Float);
end Aof.Core.Properties;
|
reznikmm/matreshka | Ada | 4,322 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2015, Vadim Godunko <[email protected]> --
-- 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$
------------------------------------------------------------------------------
with Ada.Streams;
with League.Strings;
with Servlet.Write_Listeners;
package Servlet.Output_Streams is
pragma Preelaborate;
type Servlet_Output_Stream is limited interface;
not overriding function Is_Ready
(Self : Servlet_Output_Stream) return Boolean is abstract;
-- This method can be used to determine if data can be written without
-- blocking.
not overriding procedure Set_Write_Listener
(Self : in out Servlet_Output_Stream;
Listener : not null access Servlet.Write_Listeners.Write_Listener'Class)
is abstract;
-- Instructs the ServletOutputStream to invoke the provided WriteListener
-- when it is possible to write.
not overriding procedure Write
(Self : in out Servlet_Output_Stream;
Item : Ada.Streams.Stream_Element_Array) is abstract;
not overriding procedure Write
(Self : in out Servlet_Output_Stream;
Item : League.Strings.Universal_String) is abstract;
end Servlet.Output_Streams;
|
reznikmm/gela | Ada | 2,427 | ads | with Gela.Contexts;
with Gela.Element_Factories;
with Gela.Elements.Association_Lists;
with Gela.Elements.Compilations;
with Gela.Elements.Defining_Program_Unit_Names;
with Gela.Elements.Expressions;
with Gela.Elements.Function_Calls;
with Gela.Elements.Scalar_Constraints;
with Gela.Elements.Selected_Identifiers;
with Gela.Elements.Subtype_Indications;
with Gela.Lexical_Types;
with Gela.Parsers;
package Gela.LARL_Parsers is
pragma Preelaborate;
type Parser (Context : access Gela.Contexts.Context'Class) is
limited new Gela.Parsers.Parser with private;
overriding procedure Parse
(Self : in out Parser;
Input : not null access Gela.Parsers.Parser_Input'Class;
Factory : not null Gela.Element_Factories.Element_Factory_Access;
Root : out Gela.Elements.Compilations.Compilation_Access;
Last_Token : out Gela.Lexical_Types.Token_Index);
private
type Parser (Context : access Gela.Contexts.Context'Class) is
limited new Gela.Parsers.Parser with null record;
type Parser_Context is tagged record
Factory : not null Gela.Element_Factories.Element_Factory_Access;
end record;
function Infix_Call
(Self : access Parser_Context;
Prefix : Gela.Lexical_Types.Token_Count;
Left : Gela.Elements.Expressions.Expression_Access;
Right : Gela.Elements.Expressions.Expression_Access := null)
return Gela.Elements.Function_Calls.Function_Call_Access;
function To_Defining_Program_Unit_Name
(Self : access Parser_Context;
Value : Gela.Elements.Selected_Identifiers.Selected_Identifier_Access)
return Gela.Elements.Defining_Program_Unit_Names.
Defining_Program_Unit_Name_Access;
function To_Subtype_Indication
(Self : access Parser_Context;
Not_Token : Gela.Lexical_Types.Token_Count;
Null_Token : Gela.Lexical_Types.Token_Count;
Mark : Gela.Elements.Element_Access;
Constraint : Gela.Elements.Scalar_Constraints.Scalar_Constraint_Access)
return Gela.Elements.Subtype_Indications.Subtype_Indication_Access;
function To_Aggregate_Or_Expression
(Self : access Parser_Context;
Value : Gela.Elements.Association_Lists.Association_List_Access)
return Gela.Elements.Expressions.Expression_Access;
-- If Value is (X) return Parenthesized_Expression else
-- return Record_Aggregate
end Gela.LARL_Parsers;
|
sbksba/Concurrence-LI330 | Ada | 3,191 | adb | with Ada.Text_IO, Ada.Numerics.Discrete_Random;
use Ada.Text_IO;
procedure anneau_double is
NBSITES : constant positive := 5;
type tache;
type acc_tache is access tache;
-- type des taches de l'anneau
-- l'identite (id) de la tache est unique
-- l'entier qui lui est associe (Valeur) est choisi aleatoirement
task type tache(id : Natural; Valeur : natural) is
-- permet de recuperer les pointeurs sur les taches suivante et precedente
entry init (succ : in acc_tache ; pred : in acc_tache);
entry modif_pred(ptr : in acc_tache);
entry modif_succs(ptr : in acc_tache);
end tache;
task Creer_Anneau;
-- la tache Creer_Anneau doit posseder un acces a la premiere tache creee
task body Creer_Anneau is
package Random_Natural is new Ada.Numerics.Discrete_Random (Natural);
use Random_Natural;
G : Generator;
tab : array (0..NBSITES-1) of acc_tache;
faute : integer := -1;
value : integer;
begin
Reset (G);
value := random(g) mod 100;
if (random(g) mod 2) = 0 then
faute := (random(g) mod NBSITES);
put_line("faute sur tache : "&Integer'Image(Faute));
end if;
for i in 0..NBSITES-1 loop
if i = faute
then
tab(i):=new tache(i,Value*2); -- On multiplie par deux value pour etre sur que la valeur de la faute est differente de value
else
tab(i):=new tache(i,value);
end if;
end loop;
for i in 0..NBSITES-1 loop
tab(i).init(tab((i+1) mod NBSITES),tab((i-1) mod NBSITES));
end loop;
end Creer_Anneau;
task body tache is
succs : acc_tache;
preds : acc_tache;
begin
accept init(succ : in acc_tache; pred : in acc_tache) do
succs := succ;
preds := pred;
end init;
Put_line("Tache : "&natural'image(id)&" (val: "&natural'image(valeur)&") ---- Succ : "&natural'image(succs.all.id)&" (val: "&natural'image(succs.all.valeur)&") ---- Pred : "&natural'image(preds.all.id)&" (val: "&natural'image(preds.all.valeur)&")");
if succs.all.valeur /= valeur and preds.all.valeur /= valeur then
put_line(Natural'Image(Id)&" est fautive");
succs.modif_pred(preds);
preds.modif_succs(succs);
else
if succs.all.valeur /= valeur then
accept modif_succs(ptr : in acc_tache) do
succs:=ptr;
put("Modif: ");
put("Tache : "&natural'image(id)&" (val: "&natural'image(valeur)&") ----");
put("succ : "&natural'image(succs.all.id)&" (val: "&natural'image(succs.all.valeur)&") ----");
put_line("pred : "&natural'image(preds.all.id)&" (val: "&natural'image(preds.all.valeur)&")");
end modif_succs;
end if;
if preds.all.valeur /= valeur then
accept modif_pred(ptr : in acc_tache) do
preds := ptr;
put("modif: ");
put("tache : "&natural'image(id)&" (val: "&natural'image(valeur)&") ----");
put("succ : "&natural'image(succs.all.id)&" (val: "&natural'image(succs.all.valeur)&") ----");
put_line("pred : "&natural'image(preds.all.id)&" (val: "&natural'image(preds.all.valeur)&")");
end modif_pred;
end if;
end if;
end tache;
begin
null;
end anneau_double;
|
ecofast/asphyre-cpp | Ada | 3,478 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-thin.adb,v 1.1 2010/08/18 14:11:29 Administrator Exp $
package body ZLib.Thin is
ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
--------------
-- Avail_In --
--------------
function Avail_In (Strm : in Z_Stream) return UInt is
begin
return Strm.Avail_In;
end Avail_In;
---------------
-- Avail_Out --
---------------
function Avail_Out (Strm : in Z_Stream) return UInt is
begin
return Strm.Avail_Out;
end Avail_Out;
------------------
-- Deflate_Init --
------------------
function Deflate_Init
(strm : Z_Streamp;
level : Int;
method : Int;
windowBits : Int;
memLevel : Int;
strategy : Int)
return Int is
begin
return deflateInit2
(strm,
level,
method,
windowBits,
memLevel,
strategy,
ZLIB_VERSION,
Z_Stream_Size);
end Deflate_Init;
------------------
-- Inflate_Init --
------------------
function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
begin
return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
end Inflate_Init;
------------------------
-- Last_Error_Message --
------------------------
function Last_Error_Message (Strm : in Z_Stream) return String is
use Interfaces.C.Strings;
begin
if Strm.msg = Null_Ptr then
return "";
else
return Value (Strm.msg);
end if;
end Last_Error_Message;
------------
-- Set_In --
------------
procedure Set_In
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt) is
begin
Strm.Next_In := Buffer;
Strm.Avail_In := Size;
end Set_In;
------------------
-- Set_Mem_Func --
------------------
procedure Set_Mem_Func
(Strm : in out Z_Stream;
Opaque : in Voidp;
Alloc : in alloc_func;
Free : in free_func) is
begin
Strm.opaque := Opaque;
Strm.zalloc := Alloc;
Strm.zfree := Free;
end Set_Mem_Func;
-------------
-- Set_Out --
-------------
procedure Set_Out
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt) is
begin
Strm.Next_Out := Buffer;
Strm.Avail_Out := Size;
end Set_Out;
--------------
-- Total_In --
--------------
function Total_In (Strm : in Z_Stream) return ULong is
begin
return Strm.Total_In;
end Total_In;
---------------
-- Total_Out --
---------------
function Total_Out (Strm : in Z_Stream) return ULong is
begin
return Strm.Total_Out;
end Total_Out;
end ZLib.Thin;
|
kayachnn/Amass | Ada | 1,660 | ads | -- Copyright 2017 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "CIRCL"
type = "api"
function start()
setratelimit(2)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.username ~= nil and
c.password ~= nil and c.username ~= "" and c.password ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.username == "" or c.password == "") then
return
end
local page, err = request({
url=buildurl(domain),
headers={['Content-Type']="application/json"},
id=api['username'],
pass=api['password'],
})
if (err ~= nil and err ~= "") then
return
end
for line in page:gmatch("([^\n]*)\n?") do
local j = json.decode(line)
if (j ~= nil and j.rrname ~= "") then
newname(ctx, j.rrname)
if (j.rrtype == "A" or j.rrtype == "AAAA") then
newaddr(ctx, j.rdata, domain)
else
sendnames(ctx, j.rdata)
end
end
end
end
function buildurl(domain)
return "https://www.circl.lu/pdns/query/" .. domain
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
for i, v in pairs(names) do
newname(ctx, v)
end
end
|
Fabien-Chouteau/Ada_Drivers_Library | Ada | 3,024 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with NRF51_SVD.TEMP; use NRF51_SVD.TEMP;
with HAL; use HAL;
package body nRF51.Temperature is
type RAW_Temp is delta 0.25 range
Temp_Celcius'First * 4.0 .. Temp_Celcius'Last * 4.0;
----------
-- Read --
----------
function Read return Temp_Celcius is
Raw : RAW_Temp;
begin
-- Clear event
TEMP_Periph.EVENTS_DATARDY := 0;
-- Start temperature measurement
TEMP_Periph.TASKS_START := 1;
while TEMP_Periph.EVENTS_DATARDY = 0 loop
null;
end loop;
Raw := RAW_Temp (TEMP_Periph.TEMP);
return Temp_Celcius (Raw / 4);
end Read;
end nRF51.Temperature;
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.