repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
zhmu/ananas | Ada | 4,253 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . V X W O R K S . E X T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-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/>. --
-- --
------------------------------------------------------------------------------
-- This package provides vxworks specific support functions needed
-- by System.OS_Interface.
-- This is the VxWorks 6 SMP kernel version of this package
package body System.VxWorks.Ext is
IERR : constant := -1;
--------------
-- Int_Lock --
--------------
function Int_Lock return int is
begin
return IERR;
end Int_Lock;
----------------
-- Int_Unlock --
----------------
procedure Int_Unlock (Old : int) is
pragma Unreferenced (Old);
begin
null;
end Int_Unlock;
---------------
-- semDelete --
---------------
function semDelete (Sem : SEM_ID) return STATUS is
function Os_Sem_Delete (Sem : SEM_ID) return STATUS;
pragma Import (C, Os_Sem_Delete, "semDelete");
begin
return Os_Sem_Delete (Sem);
end semDelete;
------------------------
-- taskCpuAffinitySet --
------------------------
function taskCpuAffinitySet (tid : t_id; CPU : int) return int
is
function Set_Affinity (tid : t_id; CPU : int) return int;
pragma Import (C, Set_Affinity, "__gnat_set_affinity");
begin
return Set_Affinity (tid, CPU);
end taskCpuAffinitySet;
-------------------------
-- taskMaskAffinitySet --
-------------------------
function taskMaskAffinitySet (tid : t_id; CPU_Set : unsigned) return int is
function Set_Affinity (tid : t_id; CPU_Set : unsigned) return int;
pragma Import (C, Set_Affinity, "__gnat_set_affinity_mask");
begin
return Set_Affinity (tid, CPU_Set);
end taskMaskAffinitySet;
---------------
-- Task_Cont --
---------------
function Task_Cont (tid : t_id) return STATUS is
function taskCont (tid : t_id) return STATUS;
pragma Import (C, taskCont, "taskCont");
begin
return taskCont (tid);
end Task_Cont;
---------------
-- Task_Stop --
---------------
function Task_Stop (tid : t_id) return STATUS is
function taskStop (tid : t_id) return STATUS;
pragma Import (C, taskStop, "taskStop");
begin
return taskStop (tid);
end Task_Stop;
end System.VxWorks.Ext;
|
zhmu/ananas | Ada | 274 | adb | -- { dg-do run }
-- { dg-options "-gnat05 -O2" }
with Enum2_Pkg; use Enum2_Pkg;
procedure Enum2 is
type Enum is (A, B, C, D);
Table : array (B .. C, 1 .. 1) of F_String := (others => (others => Null_String));
begin
Table := (others => (others => Null_String));
end;
|
ytomino/gnat4drake | Ada | 822 | adb | package body GNAT.Regpat is
function Compile (Expression : String; Flags : Regexp_Flags := No_Flags)
return Pattern_Matcher is
begin
raise Program_Error; -- unimplemented
return Compile (Expression, Flags);
end Compile;
function Match (
Self : Pattern_Matcher;
Data : String;
Data_First : Integer := -1;
Data_Last : Positive := Positive'Last)
return Boolean is
begin
raise Program_Error; -- unimplemented
return Match (Self, Data, Data_First, Data_Last);
end Match;
procedure Match (
Self : Pattern_Matcher;
Data : String;
Matches : out Match_Array;
Data_First : Integer := -1;
Data_Last : Positive := Positive'Last) is
begin
raise Program_Error; -- unimplemented
end Match;
end GNAT.Regpat;
|
sparre/Command-Line-Parser-Generator | Ada | 174 | adb | with Ada.Text_IO;
package body Good_Example is
procedure No_Arguments is
begin
Ada.Text_IO.Put_Line (" No_Arguments;");
end No_Arguments;
end Good_Example;
|
Rodeo-McCabe/orka | Ada | 3,365 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[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.Unchecked_Deallocation;
with GL.API;
with GL.Debug_Types;
with GL.Enums.Getter;
package body GL.Debug.Logs is
function Message_Log return Message_Array is
use GL.Debug_Types;
Length : Size := 0;
Number_Messages : constant Size := Logged_Messages;
Log_Length : constant Size := Number_Messages * Max_Message_Length;
Sources : Source_Array_Access := new Source_Array (1 .. Number_Messages);
Types : Type_Array_Access := new Type_Array (1 .. Number_Messages);
Levels : Severity_Array_Access := new Severity_Array (1 .. Number_Messages);
IDs : UInt_Array_Access := new UInt_Array (1 .. Number_Messages);
Lengths : Size_Array_Access := new Size_Array (1 .. Number_Messages);
Log : Debug_Types.String_Access := new String'(1 .. Natural (Log_Length) => ' ');
procedure Free is new Ada.Unchecked_Deallocation
(Object => String, Name => Debug_Types.String_Access);
procedure Free is new Ada.Unchecked_Deallocation
(Object => Source_Array, Name => Source_Array_Access);
procedure Free is new Ada.Unchecked_Deallocation
(Object => Type_Array, Name => Type_Array_Access);
procedure Free is new Ada.Unchecked_Deallocation
(Object => Severity_Array, Name => Severity_Array_Access);
procedure Free is new Ada.Unchecked_Deallocation
(Object => UInt_Array, Name => UInt_Array_Access);
procedure Free is new Ada.Unchecked_Deallocation
(Object => Size_Array, Name => Size_Array_Access);
begin
Length := Size (API.Get_Debug_Message_Log.Ref
(UInt (Number_Messages), Log_Length,
Sources, Types, IDs, Levels, Lengths, Log));
pragma Assert (Length <= Number_Messages);
declare
Messages : Message_Array (1 .. Length);
Offset : Natural := 1;
begin
for Index in 1 .. Length loop
Messages (Index) :=
(From => Sources (Index),
Kind => Types (Index),
Level => Levels (Index),
ID => IDs (Index),
Message => String_Holder.To_Holder (Log (Offset .. Offset + Natural (Lengths (Index)) - 1)));
Offset := Offset + Natural (Lengths (Index));
end loop;
Free (Sources);
Free (Types);
Free (Levels);
Free (IDs);
Free (Lengths);
Free (Log);
return Messages;
end;
end Message_Log;
function Logged_Messages return Size is
Result : Int := 0;
begin
API.Get_Integer.Ref (Enums.Getter.Debug_Logged_Messages, Result);
return Result;
end Logged_Messages;
end GL.Debug.Logs;
|
tum-ei-rcs/StratoX | Ada | 34,160 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics 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 file is based on: --
-- --
-- @file stm32f4xx_hal_i2c.c --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief I2C HAL module driver. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with STM32_SVD.I2C; use STM32_SVD.I2C;
with STM32.Device; use STM32.Device;
package body STM32.I2C is
use type HAL.I2C.I2C_Status;
type I2C_Status_Flag is
(Start_Bit,
Address_Sent,
Byte_Transfer_Finished,
Address_Sent_10bit,
Stop_Detection,
Rx_Data_Register_Not_Empty,
Tx_Data_Register_Empty,
Bus_Error,
Arbitration_Lost,
Ack_Failure,
UnderOverrun,
Packet_Error,
Timeout,
SMB_Alert,
Master_Slave_Mode,
Busy,
Transmitter_Receiver_Mode,
General_Call,
SMB_Default,
SMB_Host,
Dual_Flag);
-- Low level flag handling
function Flag_Status (Port : I2C_Port;
Flag : I2C_Status_Flag)
return Boolean;
procedure Clear_Address_Sent_Status (Port : I2C_Port);
-- Higher level flag handling
procedure Wait_Flag
(Handle : in out I2C_Port;
Flag : I2C_Status_Flag;
F_State : Boolean;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
procedure Wait_Master_Flag
(Handle : in out I2C_Port;
Flag : I2C_Status_Flag;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
procedure Master_Request_Write
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
procedure Master_Request_Read
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
procedure Mem_Request_Write
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
procedure Mem_Request_Read
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status);
---------------
-- Configure --
---------------
procedure Configure
(Handle : in out I2C_Port;
Conf : I2C_Configuration)
is
CR1 : CR1_Register;
CCR : CCR_Register;
OAR1 : OAR1_Register;
PCLK1 : constant Word := System_Clock_Frequencies.PCLK1;
Freq_Range : constant Short := Short (PCLK1 / 1_000_000);
begin
if Handle.State /= Reset then
return;
end if;
Handle.Config := Conf;
-- Enable_Clock (Handle.Periph.all);
-- Disable the I2C port
if Freq_Range < 2 or else Freq_Range > 45 then
raise Program_Error with
"PCLK1 too high or too low: expected 2-45 MHz, current" &
Freq_Range'Img & " MHz";
end if;
Set_State (Handle, False);
-- Load CR2 and clear FREQ
Handle.Periph.CR2 :=
(LAST => False,
DMAEN => False,
ITBUFEN => False,
ITEVTEN => False,
ITERREN => False,
FREQ => UInt6 (Freq_Range),
others => <>);
-- Set the port timing
if Conf.Clock_Speed <= 100_000 then
-- Mode selection to Standard Mode
CCR.F_S := False;
CCR.CCR := UInt12 (PCLK1 / (Conf.Clock_Speed * 2));
if CCR.CCR < 4 then
CCR.CCR := 4;
end if;
Handle.Periph.TRISE.TRISE := UInt6 (Freq_Range + 1);
else
-- Fast mode
CCR.F_S := True;
if Conf.Duty_Cycle = DutyCycle_2 then
CCR.CCR := UInt12 (PCLK1 / (Conf.Clock_Speed * 3));
else
CCR.CCR := UInt12 (PCLK1 / (Conf.Clock_Speed * 25));
CCR.DUTY := True;
end if;
if CCR.CCR = 0 then
CCR.CCR := 1;
end if;
CCR.CCR := CCR.CCR or 16#80#;
Handle.Periph.TRISE.TRISE :=
UInt6 ((Word (Freq_Range) * 300) / 1000 + 1);
end if;
Handle.Periph.CCR := CCR;
-- CR1 configuration
case Conf.Mode is
when I2C_Mode =>
CR1.SMBUS := False;
CR1.SMBTYPE := False;
when SMBusDevice_Mode =>
CR1.SMBUS := True;
CR1.SMBTYPE := False;
when SMBusHost_Mode =>
CR1.SMBUS := True;
CR1.SMBTYPE := True;
end case;
CR1.ENGC := Conf.General_Call_Enabled;
CR1.NOSTRETCH := not Conf.Clock_Stretching_Enabled;
Handle.Periph.CR1 := CR1;
-- Address mode (slave mode) configuration
OAR1.ADDMODE := Conf.Addressing_Mode = Addressing_Mode_10bit;
case Conf.Addressing_Mode is
when Addressing_Mode_7bit =>
OAR1.ADD0 := False;
OAR1.ADD7 := UInt7 (Conf.Own_Address / 2);
OAR1.ADD10 := 0;
when Addressing_Mode_10bit =>
OAR1.ADD0 := (Conf.Own_Address and 2#1#) /= 0;
OAR1.ADD7 := UInt7 ((Conf.Own_Address / 2) and 2#1111111#);
OAR1.ADD10 := UInt2 (Conf.Own_Address / 2 ** 8);
end case;
Handle.Periph.OAR1 := OAR1;
Set_State (Handle, True);
Handle.State := Ready;
end Configure;
-----------------
-- Flag_Status --
-----------------
function Flag_Status
(Port : I2C_Port; Flag : I2C_Status_Flag) return Boolean
is
begin
case Flag is
when Start_Bit =>
return Port.Periph.SR1.SB;
when Address_Sent =>
return Port.Periph.SR1.ADDR;
when Byte_Transfer_Finished =>
return Port.Periph.SR1.BTF;
when Address_Sent_10bit =>
return Port.Periph.SR1.ADD10;
when Stop_Detection =>
return Port.Periph.SR1.STOPF;
when Rx_Data_Register_Not_Empty =>
return Port.Periph.SR1.RxNE;
when Tx_Data_Register_Empty =>
return Port.Periph.SR1.TxE;
when Bus_Error =>
return Port.Periph.SR1.BERR;
when Arbitration_Lost =>
return Port.Periph.SR1.ARLO;
when Ack_Failure =>
return Port.Periph.SR1.AF;
when UnderOverrun =>
return Port.Periph.SR1.OVR;
when Packet_Error =>
return Port.Periph.SR1.PECERR;
when Timeout =>
return Port.Periph.SR1.TIMEOUT;
when SMB_Alert =>
return Port.Periph.SR1.SMBALERT;
when Master_Slave_Mode =>
return Port.Periph.SR2.MSL;
when Busy =>
return Port.Periph.SR2.BUSY;
when Transmitter_Receiver_Mode =>
return Port.Periph.SR2.TRA;
when General_Call =>
return Port.Periph.SR2.GENCALL;
when SMB_Default =>
return Port.Periph.SR2.SMBDEFAULT;
when SMB_Host =>
return Port.Periph.SR2.SMBHOST;
when Dual_Flag =>
return Port.Periph.SR2.DUALF;
end case;
end Flag_Status;
-- ----------------
-- -- Clear_Flag --
-- ----------------
--
-- procedure Clear_Flag
-- (Port : in out I2C_Port;
-- Target : Clearable_I2C_Status_Flag)
-- is
-- Unref : Bit with Unreferenced;
-- begin
-- case Target is
-- when Bus_Error =>
-- Port.SR1.BERR := 0;
-- when Arbitration_Lost =>
-- Port.SR1.ARLO := 0;
-- when Ack_Failure =>
-- Port.SR1.AF := 0;
-- when UnderOverrun =>
-- Port.SR1.OVR := 0;
-- when Packet_Error =>
-- Port.SR1.PECERR := 0;
-- when Timeout =>
-- Port.SR1.TIMEOUT := 0;
-- when SMB_Alert =>
-- Port.SR1.SMBALERT := 0;
-- end case;
-- end Clear_Flag;
-------------------------------
-- Clear_Address_Sent_Status --
-------------------------------
procedure Clear_Address_Sent_Status (Port : I2C_Port)
is
Unref : Boolean with Volatile, Unreferenced;
begin
-- ADDR is cleared after reading both SR1 and SR2
Unref := Port.Periph.SR1.ADDR;
Unref := Port.Periph.SR2.MSL;
end Clear_Address_Sent_Status;
-- ---------------------------------
-- -- Clear_Stop_Detection_Status --
-- ---------------------------------
--
-- procedure Clear_Stop_Detection_Status (Port : in out I2C_Port) is
-- Unref : Bit with Volatile, Unreferenced;
-- begin
-- Unref := Port.SR1.STOPF;
-- Port.CR1.PE := True;
-- end Clear_Stop_Detection_Status;
---------------
-- Wait_Flag --
---------------
procedure Wait_Flag
(Handle : in out I2C_Port;
Flag : I2C_Status_Flag;
F_State : Boolean;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status)
is
Start : constant Time := Clock;
begin
while Flag_Status (Handle, Flag) = F_State loop
if Clock - Start > Milliseconds (Timeout) then
Handle.State := Ready;
Status := HAL.I2C.Err_Timeout;
return;
end if;
end loop;
Status := HAL.I2C.Ok;
end Wait_Flag;
----------------------
-- Wait_Master_Flag --
----------------------
procedure Wait_Master_Flag
(Handle : in out I2C_Port;
Flag : I2C_Status_Flag;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status)
is
Start : constant Time := Clock;
begin
while not Flag_Status (Handle, Flag) loop
if Handle.Periph.SR1.AF then
-- Generate STOP
Handle.Periph.CR1.STOP := True;
-- Clear the AF flag
Handle.Periph.SR1.AF := False;
Handle.State := Ready;
Status := HAL.I2C.Err_Error;
return;
end if;
if Clock - Start > Milliseconds (Timeout) then
Handle.State := Ready;
Status := HAL.I2C.Err_Timeout;
return;
end if;
end loop;
Status := HAL.I2C.Ok;
end Wait_Master_Flag;
--------------------------
-- Master_Request_Write --
--------------------------
procedure Master_Request_Write
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status)
is
begin
Handle.Periph.CR1.START := True;
Wait_Flag (Handle, Start_Bit, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
if Handle.Config.Addressing_Mode = Addressing_Mode_7bit then
Handle.Periph.DR.DR := Byte (Addr) and not 2#1#;
else
declare
MSB : constant Byte :=
Byte (Shift_Right (Short (Addr) and 16#300#, 7));
LSB : constant Byte :=
Byte (Addr and 16#FF#);
begin
-- We need to send 2#1111_MSB0# when MSB are the 3 most
-- significant bits of the address
Handle.Periph.DR.DR := MSB or 16#F0#;
Wait_Master_Flag (Handle, Address_Sent_10bit, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.DR.DR := LSB;
end;
end if;
Wait_Master_Flag (Handle, Address_Sent, Timeout, Status);
end Master_Request_Write;
--------------------------
-- Master_Request_Write --
--------------------------
procedure Master_Request_Read
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status)
is
begin
Handle.Periph.CR1.ACK := True;
Handle.Periph.CR1.START := True;
Wait_Flag (Handle, Start_Bit, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
if Handle.Config.Addressing_Mode = Addressing_Mode_7bit then
Handle.Periph.DR.DR := Byte (Addr) or 2#1#;
else
declare
MSB : constant Byte :=
Byte (Shift_Right (Short (Addr) and 16#300#, 7));
LSB : constant Byte :=
Byte (Addr and 16#FF#);
begin
-- We need to write the address bit. So let's start with a
-- write header
-- We need to send 2#1111_MSB0# when MSB are the 3 most
-- significant bits of the address
Handle.Periph.DR.DR := MSB or 16#F0#;
Wait_Master_Flag (Handle, Address_Sent_10bit, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.DR.DR := LSB;
Wait_Master_Flag (Handle, Address_Sent, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Clear_Address_Sent_Status (Handle);
-- Generate a re-start
Handle.Periph.CR1.START := True;
Wait_Flag (Handle, Start_Bit, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
-- resend the MSB with the read bit set.
Handle.Periph.DR.DR := MSB or 16#F1#;
end;
end if;
Wait_Master_Flag (Handle, Address_Sent, Timeout, Status);
end Master_Request_Read;
-----------------------
-- Mem_Request_Write --
-----------------------
procedure Mem_Request_Write
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status)
is
begin
Handle.Periph.CR1.START := True;
Wait_Flag (Handle, Start_Bit, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
-- Send slave address
Handle.Periph.DR.DR := Byte (Addr) and not 2#1#;
Wait_Master_Flag (Handle, Address_Sent, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Clear_Address_Sent_Status (Handle);
-- Wait until TXE flag is set
Wait_Flag (Handle, Tx_Data_Register_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
case Mem_Addr_Size is
when HAL.I2C.Memory_Size_8b =>
Handle.Periph.DR.DR := Byte (Mem_Addr);
when HAL.I2C.Memory_Size_16b =>
Handle.Periph.DR.DR := Byte (Shift_Right (Mem_Addr, 8));
Wait_Flag (Handle, Tx_Data_Register_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.DR.DR := Byte (Mem_Addr and 16#FF#);
end case;
end Mem_Request_Write;
----------------------
-- Mem_Request_Read --
----------------------
procedure Mem_Request_Read
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Timeout : Natural;
Status : out HAL.I2C.I2C_Status)
is
begin
Handle.Periph.CR1.ACK := True;
Handle.Periph.CR1.START := True;
Wait_Flag (Handle, Start_Bit, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
-- Send slave address in write mode
Handle.Periph.DR.DR := Byte (Addr) and not 16#1#;
Wait_Master_Flag (Handle, Address_Sent, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Clear_Address_Sent_Status (Handle);
-- Wait until TXE flag is set
Wait_Flag (Handle, Tx_Data_Register_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
case Mem_Addr_Size is
when HAL.I2C.Memory_Size_8b =>
Handle.Periph.DR.DR := Byte (Mem_Addr);
when HAL.I2C.Memory_Size_16b =>
Handle.Periph.DR.DR := Byte (Shift_Right (Mem_Addr, 8));
Wait_Flag (Handle, Tx_Data_Register_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.DR.DR := Byte (Mem_Addr and 16#FF#);
end case;
-- We now need to reset and send the slave address in read mode
Handle.Periph.CR1.START := True;
Wait_Flag (Handle, Start_Bit, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
-- Send slave address in read mode
Handle.Periph.DR.DR := Byte (Addr) or 16#1#;
Wait_Master_Flag (Handle, Address_Sent, Timeout, Status);
end Mem_Request_Read;
---------------------
-- Master_Transmit --
---------------------
overriding
procedure Master_Transmit
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Data : HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000)
is
Idx : Natural := Data'First;
begin
if Handle.State = Reset then
Status := HAL.I2C.Err_Error;
return;
elsif Data'Length = 0 then
Status := HAL.I2C.Err_Error;
return;
end if;
Wait_Flag (Handle, Busy, True, Timeout, Status);
if Status /= HAL.I2C.Ok then
Status := HAL.I2C.Busy;
return;
end if;
if Handle.State /= Ready then
Status := HAL.I2C.Busy;
return;
end if;
Handle.State := Master_Busy_Tx;
Handle.Periph.CR1.POS := False;
Master_Request_Write (Handle, Addr, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Clear_Address_Sent_Status (Handle);
while Idx <= Data'Last loop
Wait_Flag (Handle, Tx_Data_Register_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.DR.DR := Data (Idx);
Idx := Idx + 1;
if Idx <= Data'Last then
Wait_Flag (Handle, Byte_Transfer_Finished, True, Timeout, Status);
if Status = HAL.I2C.Ok then
Handle.Periph.DR.DR := Data (Idx);
Idx := Idx + 1;
end if;
end if;
end loop;
Wait_Flag (Handle, Tx_Data_Register_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
-- Generate STOP
Handle.Periph.CR1.STOP := True;
Handle.State := Ready;
end Master_Transmit;
--------------------
-- Master_Receive --
--------------------
overriding
procedure Master_Receive
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Data : out HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000)
is
Idx : Natural := Data'First;
begin
if Handle.State = Reset then
Status := HAL.I2C.Err_Error;
return;
elsif Data'Length = 0 then
Status := HAL.I2C.Err_Error;
return;
end if;
Wait_Flag (Handle, Busy, True, Timeout, Status);
if Status /= HAL.I2C.Ok then
Status := HAL.I2C.Busy;
return;
end if;
if Handle.State /= Ready then
Status := HAL.I2C.Busy;
return;
end if;
Handle.State := Master_Busy_Rx;
Handle.Periph.CR1.POS := False;
Master_Request_Read (Handle, Addr, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
if Data'Length = 1 then
Handle.Periph.CR1.ACK := False;
Clear_Address_Sent_Status (Handle);
Handle.Periph.CR1.STOP := True;
elsif Data'Length = 2 then
Handle.Periph.CR1.ACK := False;
Handle.Periph.CR1.POS := True;
Clear_Address_Sent_Status (Handle);
else
-- Automatic acknowledge
Handle.Periph.CR1.ACK := True;
Clear_Address_Sent_Status (Handle);
end if;
while Idx <= Data'Last loop
if Idx = Data'Last then
-- One byte to read
Wait_Flag
(Handle,
Rx_Data_Register_Not_Empty,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
elsif Idx + 1 = Data'Last then
-- Two bytes to read
Wait_Flag (Handle,
Byte_Transfer_Finished,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.CR1.STOP := True;
-- read the data from DR
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
elsif Idx + 2 = Data'Last then
-- Three bytes to read
Wait_Flag (Handle,
Byte_Transfer_Finished,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.CR1.ACK := False;
-- read the data from DR
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Wait_Flag (Handle,
Byte_Transfer_Finished,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.CR1.STOP := True;
-- read the data from DR
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
else
-- One byte to read
Wait_Flag
(Handle,
Rx_Data_Register_Not_Empty,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Wait_Flag (Handle,
Byte_Transfer_Finished,
False,
Timeout,
Status);
if Status = HAL.I2C.Ok then
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
end if;
end if;
end loop;
Handle.State := Ready;
end Master_Receive;
---------------
-- Mem_Write --
---------------
overriding
procedure Mem_Write
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Data : HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000)
is
Idx : Natural := Data'First;
begin
if Handle.State = Reset then
Status := HAL.I2C.Err_Error;
return;
elsif Data'Length = 0 then
Status := HAL.I2C.Err_Error;
return;
end if;
Wait_Flag (Handle, Busy, True, Timeout, Status);
if Status /= HAL.I2C.Ok then
Status := HAL.I2C.Busy;
return;
end if;
if Handle.State /= Ready then
Status := HAL.I2C.Busy;
return;
end if;
Handle.State := Mem_Busy_Tx;
Handle.Periph.CR1.POS := False;
Mem_Request_Write
(Handle, Addr, Mem_Addr, Mem_Addr_Size, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
while Idx <= Data'Last loop
Wait_Flag (Handle,
Tx_Data_Register_Empty,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.DR.DR := Data (Idx);
Idx := Idx + 1;
if Idx <= Data'Last then
Wait_Flag (Handle,
Byte_Transfer_Finished,
True,
Timeout,
Status);
if Status = HAL.I2C.Ok then
Handle.Periph.DR.DR := Data (Idx);
Idx := Idx + 1;
end if;
end if;
end loop;
Wait_Flag (Handle,
Tx_Data_Register_Empty,
False,
Timeout,
Status);
if Status /= HAL.I2C.Ok then
return;
end if;
-- Generate STOP
Handle.Periph.CR1.STOP := True;
Handle.State := Ready;
end Mem_Write;
--------------
-- Mem_Read --
--------------
overriding
procedure Mem_Read
(Handle : in out I2C_Port;
Addr : HAL.I2C.I2C_Address;
Mem_Addr : Short;
Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size;
Data : out HAL.I2C.I2C_Data;
Status : out HAL.I2C.I2C_Status;
Timeout : Natural := 1000)
is
Idx : Natural := Data'First;
begin
if Handle.State = Reset then
Status := HAL.I2C.Err_Error;
return;
elsif Data'Length = 0 then
Status := HAL.I2C.Err_Error;
return;
end if;
Wait_Flag (Handle, Busy, True, Timeout, Status);
if Status /= HAL.I2C.Ok then
Status := HAL.I2C.Busy;
return;
end if;
if Handle.State /= Ready then
Status := HAL.I2C.Busy;
return;
end if;
Handle.State := Mem_Busy_Rx;
Handle.Periph.CR1.POS := False;
Mem_Request_Read
(Handle, Addr, Mem_Addr, Mem_Addr_Size, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
if Data'Length = 1 then
Handle.Periph.CR1.ACK := False;
Clear_Address_Sent_Status (Handle);
Handle.Periph.CR1.STOP := True;
elsif Data'Length = 2 then
Handle.Periph.CR1.ACK := False;
Handle.Periph.CR1.POS := True;
Clear_Address_Sent_Status (Handle);
else
-- Automatic acknowledge
Handle.Periph.CR1.ACK := True;
Clear_Address_Sent_Status (Handle);
end if;
while Idx <= Data'Last loop
if Idx = Data'Last then
-- One byte to read
Wait_Flag
(Handle, Rx_Data_Register_Not_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
elsif Idx + 1 = Data'Last then
-- Two bytes to read
-- Ack auf aus schalten?
Handle.Periph.CR1.ACK := False;
Wait_Flag (Handle, Byte_Transfer_Finished, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.CR1.STOP := True;
-- read the data from DR
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
elsif Idx + 2 = Data'Last then
-- Three bytes to read
Wait_Flag (Handle, Byte_Transfer_Finished, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.CR1.ACK := False;
-- read the data from DR
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Wait_Flag (Handle, Byte_Transfer_Finished, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Handle.Periph.CR1.STOP := True;
-- read the data from DR
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
else
-- One byte to read
Wait_Flag
(Handle, Rx_Data_Register_Not_Empty, False, Timeout, Status);
if Status /= HAL.I2C.Ok then
return;
end if;
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
Wait_Flag (Handle, Byte_Transfer_Finished, False, Timeout, Status);
if Status = HAL.I2C.Ok then
Data (Idx) := Handle.Periph.DR.DR;
Idx := Idx + 1;
end if;
end if;
end loop;
Handle.State := Ready;
end Mem_Read;
---------------
-- Set_State --
---------------
procedure Set_State (This : in out I2C_Port; Enabled : Boolean)
is
begin
This.Periph.CR1.PE := Enabled;
end Set_State;
------------------
-- Port_Enabled --
------------------
function Port_Enabled (This : I2C_Port) return Boolean
is
begin
return This.Periph.CR1.PE;
end Port_Enabled;
----------------------
-- Enable_Interrupt --
----------------------
procedure Enable_Interrupt
(This : in out I2C_Port;
Source : I2C_Interrupt)
is
begin
case Source is
when Error_Interrupt =>
This.Periph.CR2.ITERREN := True;
when Event_Interrupt =>
This.Periph.CR2.ITEVTEN := True;
when Buffer_Interrupt =>
This.Periph.CR2.ITBUFEN := True;
end case;
end Enable_Interrupt;
-----------------------
-- Disable_Interrupt --
-----------------------
procedure Disable_Interrupt
(This : in out I2C_Port;
Source : I2C_Interrupt)
is
begin
case Source is
when Error_Interrupt =>
This.Periph.CR2.ITERREN := False;
when Event_Interrupt =>
This.Periph.CR2.ITEVTEN := False;
when Buffer_Interrupt =>
This.Periph.CR2.ITBUFEN := False;
end case;
end Disable_Interrupt;
-------------
-- Enabled --
-------------
function Enabled
(This : I2C_Port;
Source : I2C_Interrupt)
return Boolean
is
begin
case Source is
when Error_Interrupt =>
return This.Periph.CR2.ITERREN;
when Event_Interrupt =>
return This.Periph.CR2.ITEVTEN;
when Buffer_Interrupt =>
return This.Periph.CR2.ITBUFEN;
end case;
end Enabled;
end STM32.I2C;
|
reznikmm/matreshka | Ada | 3,979 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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$
------------------------------------------------------------------------------
-- This package for internal use only.
------------------------------------------------------------------------------
with Matreshka.Internals.SQL_Drivers;
package SQL.Queries.Internals is
-- function Internal
-- (Self : SQL_Query'Class)
-- return Matreshka.Internals.SQL_Queries.Query_Access;
-- pragma Inline (Internal);
-- Returns internal object. Reference counter is untouched.
function Wrap
(Data : not null Matreshka.Internals.SQL_Drivers.Query_Access)
return SQL_Query;
-- Wrap specified internal object into user's object. Reference counter is
-- untouched.
end SQL.Queries.Internals;
|
ivanhawkes/Chrysalis | Ada | 5,334 | adb | <AnimDB FragDef="chrysalis/characters/human/male/male_fragment_ids.xml" TagDef="chrysalis/characters/human/male/male_tags.xml">
<FragmentList>
<Idle>
<Fragment BlendOutDuration="0.2" Tags="Alerted+ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="Unaware">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="stand_relaxed_idle" flags="Loop"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="Crouching+ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="Crouching">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="crouch_idle"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="Crouching">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="crouch_idle_v2"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="stand_relaxed_idle" flags="Loop"/>
</AnimLayer>
</Fragment>
</Idle>
<Move>
<Fragment BlendOutDuration="0.2" Tags="Crouching">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="bspace_2d_move_strafe_crouch" flags="Loop"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="bspace_2d_move_strafe" flags="Loop"/>
</AnimLayer>
</Fragment>
</Move>
<Interaction>
<Fragment BlendOutDuration="0.2" Tags="ScopeSlave">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="crouchwalk_l"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="picking_up_object"/>
</AnimLayer>
</Fragment>
</Interaction>
<Emote>
<Fragment BlendOutDuration="0.2" Tags="Awe">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="crouch_r_90"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="Apathy">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="crouch_l_135"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags="">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="crouch_to_crouchwalk_b"/>
</AnimLayer>
</Fragment>
</Emote>
<Looking>
<Fragment BlendOutDuration="0.2" Tags="ScopeLooking">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags=""/>
</Looking>
<LookPose>
<Fragment BlendOutDuration="0.2" Tags="ScopeLookPose">
<ProcLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.30000001"/>
<Procedural type="Looking">
<ProceduralParams CryXmlVersion="2"/>
</Procedural>
</ProcLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags=""/>
</LookPose>
</FragmentList>
</AnimDB>
|
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_Dr3d.Normals_Direction_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Dr3d_Normals_Direction_Attribute_Node is
begin
return Self : Dr3d_Normals_Direction_Attribute_Node do
Matreshka.ODF_Dr3d.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Dr3d_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Dr3d_Normals_Direction_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Normals_Direction_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Dr3d_URI,
Matreshka.ODF_String_Constants.Normals_Direction_Attribute,
Dr3d_Normals_Direction_Attribute_Node'Tag);
end Matreshka.ODF_Dr3d.Normals_Direction_Attributes;
|
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.Table_Label_Range_Elements;
package Matreshka.ODF_Table.Label_Range_Elements is
type Table_Label_Range_Element_Node is
new Matreshka.ODF_Table.Abstract_Table_Element_Node
and ODF.DOM.Table_Label_Range_Elements.ODF_Table_Label_Range
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Label_Range_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Table_Label_Range_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Table_Label_Range_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_Label_Range_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_Label_Range_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.Label_Range_Elements;
|
GPUWorks/lumen2 | Ada | 2,485 | ads |
-- Lumen.Events.Animate -- Event loop with frame-animation callback
--
-- Chip Richards, NiEstu, Phoenix AZ, Spring 2010
-- This code is covered by the ISC License:
--
-- Copyright © 2010, NiEstu
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- The software is provided "as is" and the author disclaims all warranties
-- with regard to this software including all implied warranties of
-- merchantability and fitness. In no event shall the author be liable for any
-- special, direct, indirect, or consequential damages or any damages
-- whatsoever resulting from loss of use, data or profits, whether in an
-- action of contract, negligence or other tortious action, arising out of or
-- in connection with the use or performance of this software.
with Lumen.Window; use Lumen.Window;
package Lumen.Events.Animate is
---------------------------------------------------------------------------
-- Count of frames displayed from Animate
type Frame_Count is new Long_Integer range 0 .. Long_Integer'Last;
-- Means "display frames as fast as you can"
Flat_Out : constant Frame_Count := 0;
---------------------------------------------------------------------------
-- An animate-frame callback procedure
type Animate_Callback is access procedure (Frame_Delta : in Duration);
No_Callback : constant Animate_Callback := null;
---------------------------------------------------------------------------
-- Procedure to change FPS after window creation
procedure Set_FPS (Win : in Window_Handle;
FPS : in Frame_Count);
-- Type of frames-per-second count to fetch. "Overall" means since the app
-- started; "Since_Prior" means since the last time you called FPS.
type FPS_Type is (FPS_Overall, FPS_Since_Prior);
-- Function to fetch FPS (and reset rolling average if necessary)
function FPS (Win : Window_Handle;
Since : FPS_Type := FPS_Since_Prior)
return Float;
---------------------------------------------------------------------------
type Event_Frame is
access function
(Frame_Delta : in Duration)
return Boolean;
procedure Run (Win : in Window_Handle;
FPS : in Frame_Count;
Frame : in Event_Frame);
end Lumen.Events.Animate;
|
reznikmm/matreshka | Ada | 3,674 | 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.Elements;
package ODF.DOM.Table_Detective_Elements is
pragma Preelaborate;
type ODF_Table_Detective is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Detective_Access is
access all ODF_Table_Detective'Class
with Storage_Size => 0;
end ODF.DOM.Table_Detective_Elements;
|
reznikmm/matreshka | Ada | 10,528 | adb | ------------------------------------------------------------------------------
-- --
-- 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.Elements;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
package body AMF.Internals.UML_Connector_Ends is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Connector_End_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Connector_End
(AMF.UML.Connector_Ends.UML_Connector_End_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Connector_End_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Connector_End
(AMF.UML.Connector_Ends.UML_Connector_End_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Connector_End_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Connector_End
(Visitor,
AMF.UML.Connector_Ends.UML_Connector_End_Access (Self),
Control);
end if;
end Visit_Element;
----------------------
-- Get_Defining_End --
----------------------
overriding function Get_Defining_End
(Self : not null access constant UML_Connector_End_Proxy)
return AMF.UML.Properties.UML_Property_Access is
begin
return
AMF.UML.Properties.UML_Property_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Defining_End
(Self.Element)));
end Get_Defining_End;
------------------------
-- Get_Part_With_Port --
------------------------
overriding function Get_Part_With_Port
(Self : not null access constant UML_Connector_End_Proxy)
return AMF.UML.Properties.UML_Property_Access is
begin
return
AMF.UML.Properties.UML_Property_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Part_With_Port
(Self.Element)));
end Get_Part_With_Port;
------------------------
-- Set_Part_With_Port --
------------------------
overriding procedure Set_Part_With_Port
(Self : not null access UML_Connector_End_Proxy;
To : AMF.UML.Properties.UML_Property_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Part_With_Port
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Part_With_Port;
--------------
-- Get_Role --
--------------
overriding function Get_Role
(Self : not null access constant UML_Connector_End_Proxy)
return AMF.UML.Connectable_Elements.UML_Connectable_Element_Access is
begin
return
AMF.UML.Connectable_Elements.UML_Connectable_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Role
(Self.Element)));
end Get_Role;
--------------
-- Set_Role --
--------------
overriding procedure Set_Role
(Self : not null access UML_Connector_End_Proxy;
To : AMF.UML.Connectable_Elements.UML_Connectable_Element_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Role
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Role;
------------------
-- Defining_End --
------------------
overriding function Defining_End
(Self : not null access constant UML_Connector_End_Proxy)
return AMF.UML.Properties.UML_Property_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Defining_End unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connector_End_Proxy.Defining_End";
return Defining_End (Self);
end Defining_End;
---------------------
-- Compatible_With --
---------------------
overriding function Compatible_With
(Self : not null access constant UML_Connector_End_Proxy;
Other : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connector_End_Proxy.Compatible_With";
return Compatible_With (Self, Other);
end Compatible_With;
--------------------------
-- Includes_Cardinality --
--------------------------
overriding function Includes_Cardinality
(Self : not null access constant UML_Connector_End_Proxy;
C : Integer)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Includes_Cardinality unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connector_End_Proxy.Includes_Cardinality";
return Includes_Cardinality (Self, C);
end Includes_Cardinality;
---------------------------
-- Includes_Multiplicity --
---------------------------
overriding function Includes_Multiplicity
(Self : not null access constant UML_Connector_End_Proxy;
M : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Includes_Multiplicity unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connector_End_Proxy.Includes_Multiplicity";
return Includes_Multiplicity (Self, M);
end Includes_Multiplicity;
---------
-- Iss --
---------
overriding function Iss
(Self : not null access constant UML_Connector_End_Proxy;
Lowerbound : Integer;
Upperbound : Integer)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Iss unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connector_End_Proxy.Iss";
return Iss (Self, Lowerbound, Upperbound);
end Iss;
end AMF.Internals.UML_Connector_Ends;
|
tj800x/SPARKNaCl | Ada | 11,850 | adb | package body SPARKNaCl.Car
with SPARK_Mode => On
is
--===============================================
-- Functions supporting normalization
-- of GF values following "+", "-" or "*"
-- operations.
--
-- The core algorithm in _all_ of these
-- is the same, but the type signature of
-- each function differs to suit its usage
-- and to prove that repeated application
-- of these functions do eventually yield
-- a "Normal_GF"
--
-- The core algorithm is actually a variant
-- of that used in the TweetNaCl sources, as
-- suggested by Jason Donenfeld and used in
-- WireGuard (See the "Embeddable WG Library"
-- in the WireGuard sources for full details.)
--
-- This algorithm is simpler and avoids the need
-- for a left-shift of a signed integer
-- (which is, strictly speaking, an undefined
-- behaviour in C, so best avoided.)
--===============================================
function Product_To_Seminormal
(X : in Product_GF)
return Seminormal_GF
is
subtype Carry_Adjustment is I64 range 0 .. (MGFLC * MGFLP) / LM;
Carry : Carry_Adjustment;
R : GF with Relaxed_Initialization;
begin
Carry := ASR_16 (X (0));
R (0) := X (0) mod LM;
R (1) := X (1) + Carry;
pragma Assert
(R (0)'Initialized and then R (0) in GF_Normal_Limb);
pragma Assert
(R (1)'Initialized and then R (1) in 0 .. MGFLC * MGFLP);
for I in Index_16 range 1 .. 14 loop
Carry := ASR_16 (R (I));
pragma Assert
(X (I + 1) <= (MGFLC - 37 * GF_Any_Limb (I + 1)) * MGFLP);
pragma Assert
(X (I) <= (MGFLC - 37 * GF_Any_Limb (I)) * MGFLP);
R (I) := R (I) mod LM;
R (I + 1) := X (I + 1) + Carry;
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => R (K)'Initialized);
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => (R (K) in GF_Normal_Limb));
pragma Loop_Invariant (R (I + 1)'Initialized);
pragma Loop_Invariant (R (I + 1) >= 0);
pragma Loop_Invariant
(R (I + 1) <= (MGFLC - 37 * GF_Any_Limb (I)) * MGFLP);
end loop;
-- Substitute I = 14 into the above loop invariant
-- and simplify to yield:
pragma Assert (R'Initialized);
pragma Assert
(for all K in Index_16 range 0 .. 14 => (R (K) in GF_Normal_Limb));
pragma Assert (R (15) in 0 .. 53 * MGFLP);
Carry := ASR_16 (R (15));
pragma Assert (Carry <= ((53 * MGFLP) / LM));
R (0) := R (0) + R2256 * Carry;
pragma Assert (R (0) in Seminormal_GF_LSL);
R (15) := R (15) mod LM;
return Seminormal_GF (R);
end Product_To_Seminormal;
function Seminormal_To_Nearlynormal
(X : in Seminormal_GF)
return Nearlynormal_GF
is
subtype First_Carry_T is I64 range
0 .. Seminormal_GF_LSL'Last / LM;
First_Carry : First_Carry_T;
Carry : I64_Bit;
R : GF with Relaxed_Initialization;
begin
First_Carry := ASR_16 (X (0));
R (0) := X (0) mod LM;
R (1) := X (1) + First_Carry;
pragma Assert (R (0)'Initialized);
pragma Assert (R (0) in GF_Normal_Limb);
pragma Assert (R (1)'Initialized);
pragma Assert (R (1) in 0 .. GF_Normal_Limb'Last + First_Carry_T'Last);
for I in Index_16 range 1 .. 14 loop
Carry := ASR_16 (R (I));
R (I) := R (I) mod LM;
R (I + 1) := X (I + 1) + Carry;
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => R (K)'Initialized);
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => (R (K) in GF_Normal_Limb));
pragma Loop_Invariant (R (I + 1)'Initialized);
pragma Loop_Invariant (R (I + 1) in 0 .. LM);
end loop;
pragma Assert (R'Initialized);
pragma Assert
(for all K in Index_16 range 0 .. 14 => (R (K) in GF_Normal_Limb));
pragma Assert (R (15) in 0 .. LM);
Carry := ASR_16 (R (15));
R (0) := R (0) + R2256 * Carry;
R (15) := R (15) mod LM;
return Nearlynormal_GF (R);
end Seminormal_To_Nearlynormal;
function Sum_To_Nearlynormal
(X : in Sum_GF)
return Nearlynormal_GF
is
Carry : Boolean;
R : GF with Relaxed_Initialization;
begin
Carry := X (0) >= LM;
R (0) := X (0) mod LM;
R (1) := X (1) + Boolean'Pos (Carry);
pragma Assert
(R (0)'Initialized and then R (0) in GF_Normal_Limb);
pragma Assert
(R (1)'Initialized and then R (1) in 0 .. GF_Sum_Limb'Last + 1);
for I in Index_16 range 1 .. 14 loop
Carry := R (I) >= LM;
R (I) := R (I) mod LM;
R (I + 1) := X (I + 1) + Boolean'Pos (Carry);
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I + 1 => (R (K)'Initialized));
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => (R (K) in GF_Normal_Limb));
pragma Loop_Invariant (R (I + 1) in 0 .. GF_Sum_Limb'Last + 1);
end loop;
pragma Assert (R'Initialized);
pragma Assert
(for all K in Index_16 range 0 .. 14 => (R (K) in GF_Normal_Limb));
pragma Assert (R (15) in 0 .. GF_Sum_Limb'Last + 1);
Carry := R (15) >= LM;
R (0) := R (0) + R2256 * Boolean'Pos (Carry);
R (15) := R (15) mod LM;
return Nearlynormal_GF (R);
end Sum_To_Nearlynormal;
function Difference_To_Nearlynormal
(X : in Difference_GF)
return Nearlynormal_GF
is
-- Note that Carry can be negative in this case
subtype Carry_T is I64 range -1 .. 1;
Carry : Carry_T;
R : GF with Relaxed_Initialization;
begin
Carry := ASR_16 (X (0));
R (0) := X (0) mod LM;
R (1) := X (1) + Carry;
pragma Assert (R (0)'Initialized);
pragma Assert (R (1)'Initialized);
for I in Index_16 range 1 .. 14 loop
Carry := ASR_16 (R (I));
R (I) := R (I) mod LM;
R (I + 1) := X (I + 1) + Carry;
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => R (K)'Initialized);
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => (R (K) in GF_Normal_Limb));
pragma Loop_Invariant (R (I + 1)'Initialized);
pragma Loop_Invariant (R (I + 1) in -1 .. 131071);
end loop;
pragma Assert (R'Initialized);
pragma Assert
(for all K in Index_16 range 0 .. 14 => (R (K) in GF_Normal_Limb));
pragma Assert (R (15) in -1 .. 131071);
Carry := ASR_16 (R (15));
R (0) := R (0) + R2256 * Carry;
R (15) := R (15) mod LM;
pragma Assert (R in Nearlynormal_GF);
return Nearlynormal_GF (R);
end Difference_To_Nearlynormal;
function Nearlynormal_To_Normal
(X : in Nearlynormal_GF)
return Normal_GF
is
-- True iff the initial value of X and the current
-- state of G are necessary and sufficient for Carry = 1 after
-- the I'th loop iteration
function Carrying_Plus_One (G : in GF;
X : in Nearlynormal_GF;
I : in Index_16) return Boolean
is ((X (0) in LM .. LMM1 + R2256) and -- X (O) will carry +1
-- ...therefore G (0) will be in 0 .. 37 ...
(G (0) = X (0) mod LM) and
(G (0) in 0 .. R2256 - 1) and
-- ... AND all values of X (K) between 1 and I
-- are LMM1 and G (K) = (X (K) + Carry) mod LM = 0
(for all K in Index_16 range 1 .. I =>
(G (K) = 0 and X (K) = LMM1)))
with Relaxed_Initialization => G,
Pre => G (0)'Initialized and
(for all K in Index_16 range 1 .. I => G (K)'Initialized);
-- True iff the initial value of X and the current
-- state of G are necessary and sufficient for Carry = -1 after
-- the I'th loop iteration
function Carrying_Minus_One (G : in GF;
X : in Nearlynormal_GF;
I : in Index_16) return Boolean
is ((X (0) in -R2256 .. -1) and -- X (O) will carry -1
-- ...therefore G (0) will be in 65498 .. 65535 ...
(G (0) = X (0) mod LM) and
(G (0) in (LM - R2256) .. LMM1) and
-- ... AND all values of X (K) between 1 and I
-- are 0 and G (K) = (X (K) + Carry) mod LM = LMM1
(for all K in Index_16 range 1 .. I =>
(G (K) = LMM1 and X (K) = 0)))
with Relaxed_Initialization => G,
Pre => G (0)'Initialized and
(for all K in Index_16 range 1 .. I => G (K)'Initialized);
subtype Carry_T is I64 range -1 .. 1;
Carry : Carry_T;
R : GF with Relaxed_Initialization;
begin
-- Expand X's subtype predicate
pragma Assert
((X (0) in -R2256 .. LMM1 + R2256) and
(for all K in Index_16 range 1 .. 15 =>
(X (K) in GF_Normal_Limb)));
-- Carry and normalize limb 0
Carry := ASR_16 (X (0));
R (0) := X (0) mod LM;
R (1) := X (1) + Carry;
pragma Assert (R (0)'Initialized);
pragma Assert (R (0) in GF_Normal_Limb);
pragma Assert (R (0) = X (0) mod LM);
pragma Assert (R (1)'Initialized);
pragma Assert (R (1) in -1 .. LM);
-- Establish the crux invariant
pragma Assert
((Carry = 1) = Carrying_Plus_One (R, X, 0));
pragma Assert
((Carry = -1) = Carrying_Minus_One (R, X, 0));
for I in Index_16 range 1 .. 14 loop
Carry := ASR_16 (R (I));
R (I) := R (I) mod LM;
R (I + 1) := X (I + 1) + Carry;
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => R (K)'Initialized);
pragma Loop_Invariant
(for all K in Index_16 range 0 .. I => (R (K) in GF_Normal_Limb));
pragma Loop_Invariant (R (I + 1)'Initialized);
pragma Loop_Invariant (R (I + 1) in -1 .. LM);
pragma Loop_Invariant (R (I + 1) = X (I + 1) + Carry);
-- The crux of the invariant - relate the current value
-- of Carry after I loop iterations to the _initial_
-- value of X, and therefore the value of R (0)
pragma Loop_Invariant
((Carry = 1) = Carrying_Plus_One (R, X, I));
pragma Loop_Invariant
((Carry = -1) = Carrying_Minus_One (R, X, I));
end loop;
-- Expand loop invariant with I = 14
pragma Assert (R'Initialized);
pragma Assert
(for all K in Index_16 range 0 .. 14 => (R (K) in GF_Normal_Limb));
pragma Assert (R (15) in -1 .. LM);
pragma Assert (R (15) = X (15) + Carry);
pragma Assert
((Carry = 1) = Carrying_Plus_One (R, X, 14));
pragma Assert
((Carry = -1) = Carrying_Minus_One (R, X, 14));
-- Finally, deal with limb 15
Carry := ASR_16 (R (15));
R (15) := R (15) mod LM;
pragma Assert
((Carry = 1) = Carrying_Plus_One (R, X, 15));
pragma Assert
((Carry = -1) = Carrying_Minus_One (R, X, 15));
pragma Assert
(for all K in Index_16 range 0 .. 15 => (R (K) in GF_Normal_Limb));
-- At last, we know that:
-- if Carry = +1, then R (0) in 0 .. 37
-- if Carry = -1, then R (0) in 65498 .. 65535
-- if Carry = 0, then it doesn't matter since R (0) in GF_Normal_Limb
-- Therefore this multiplication and assignment will never overflow and
-- R (0) remains in GF_Normal_Limb. Phew!
R (0) := R (0) + R2256 * Carry;
pragma Assert (R (0) in GF_Normal_Limb);
return Normal_GF (R);
end Nearlynormal_To_Normal;
end SPARKNaCl.Car;
|
AdaCore/libadalang | Ada | 122 | ads | generic
package Pkg_G is
type Test_Generic_Pkg is private;
private
type Test_Generic_Pkg is null record;
end Pkg_G;
|
stcarrez/ada-asf | Ada | 920 | ads | -----------------------------------------------------------------------
-- asf-filters -- ASF Filters
-- Copyright (C) 2010, 2015, 2018 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 Servlet.Filters;
package ASF.Filters renames Servlet.Filters;
|
reznikmm/matreshka | Ada | 3,619 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2016, 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$
------------------------------------------------------------------------------
function SQL.Queries.Is_Alive (Self : SQL.Queries.SQL_Query) return Boolean is
use type Matreshka.Internals.SQL_Drivers.Query_Access;
begin
return Self.Data /= null and
Self.Data /= Matreshka.Internals.SQL_Drivers.Dummy.Empty_Query'Access;
end SQL.Queries.Is_Alive;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 404 | ads | with STM32GD.GPIO.Pin;
generic
with package Pin is new STM32GD.GPIO.Pin (<>);
package STM32GD.GPIO.Polled is
pragma Preelaborate;
procedure Configure_Trigger (Event : Boolean := False; Rising : Boolean := False; Falling : Boolean := False);
procedure Wait_For_Trigger;
procedure Clear_Trigger;
function Triggered return Boolean;
procedure Cancel_Wait;
end STM32GD.GPIO.Polled;
|
jorge-real/TTS-Runtime-Ravenscar | Ada | 1,342 | ads |
package Logging_Support is
------------------------------------------------------------------------
-- | Package Giving Operations Useful for logging tasks activity
-- | WITH-ed by the body of a package to provide an easy way to
-- | trace events related to task activation and completion
-- | Implemented as a modification to the Debugging_Support package
-- | from Michael B. Feldman, The George Washington University
-- | Author: Jorge Real
-- | Last Modified: October 1998
------------------------------------------------------------------------
-- type Switch is (Off, On);
type Event_Type is (No_Event, Start_Task, Stop_Task, Mode_Change,
Start_Resource, Stop_Resource, Missed_Deadline);
-- procedure Set_Log(Which_Way: in Switch; File_Name: String := "");
-- -- Pre: WhichWay is defined
-- -- Post: Logging support is turned On or Off, as the case may be;
-- -- If FileName = "", logging output goes to Standard_Output;
-- -- otherwise, debugging output goes to the given file.
procedure Log (Event : in Event_Type; Message : in String := "");
-- Pre: Event is defined
-- Post: Writes a message to Standard_Output or an external file
-- that registers the activation of the specified event
end Logging_Support;
|
albinjal/ada_basic | Ada | 4,923 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
package body Date_Package is
function "="(Date1, Date2: Date_Type)
return Boolean is
begin
if Date1.Year = Date2.Year and Date1.Month = Date2.Month and Date1.Day = Date2.Day then
return True;
else
return False;
end if;
end;
function "<"(Date2, Date1: Date_Type)
return Boolean is
begin
if Date1.Year >= Date2.Year then
if Date1.Year > Date2.Year then
return True;
else
if Date1.Month >= Date2.Month then
if Date1.Month > Date2.Month then
return True;
else
if Date1.Day > Date2.Day then
return True;
else
return False;
end if;
end if;
else
return False;
end if;
end if;
else
return False;
end if;
end;
function ">"(Date1, Date2: Date_Type)
return Boolean is
begin
if Date1.Year >= Date2.Year then
if Date1.Year > Date2.Year then
return True;
else
if Date1.Month >= Date2.Month then
if Date1.Month > Date2.Month then
return True;
else
if Date1.Day > Date2.Day then
return True;
else
return False;
end if;
end if;
else
return False;
end if;
end if;
else
return False;
end if;
end;
function Is_Leap_Year(Year: in Integer)
return Boolean is
begin
if Year mod 4 = 0 and Year mod 100 /= 0 then
return True;
elsif Year mod 400 = 0 then
return True;
else
return False;
end if;
end Is_Leap_Year;
procedure Test_Leap_Years is
begin
for I in 1800..2400 loop
Put(I); Put(" ");
if Is_Leap_Year(I) then
Put("SKOTT");
end if;
New_Line;
end loop;
end Test_Leap_Years;
function Last_Day_Of_Month(Month, Year: in Integer)
return Integer is
febleap: Integer;
begin
if Is_Leap_Year(Year) then
febleap := 29;
else
febleap := 28;
end if;
case Month is
when 1 => return 31;
when 2 => return febleap;
when 3 => return 31;
when 4 => return 30;
when 5 => return 31;
when 6 => return 30;
when 7 => return 31;
when 8 => return 31;
when 9 => return 30;
when 10 => return 31;
when 11 => return 30;
when 12 => return 31;
when others => -- Errorhantering
return 0;
end case;
end Last_Day_Of_Month;
-- Tar in ett datum från terminalen
procedure Get(Date: out Date_Type) is
Ins: String(1..10);
begin
Get(Ins);
for I in Ins'Range loop
if I = 5 or I = 8 then
if Ins(I) /= '-' then
raise FORMAT_ERROR;
end if;
end if;
if I in 1..4 then
if Ins(I) not in '0'..'9' then
raise FORMAT_ERROR;
end if;
end if;
if I in 6..7 then
if Ins(I) not in '0'..'9' then
raise FORMAT_ERROR;
end if;
end if;
if I in 9..10 then
if Ins(I) not in '0'..'9' then
raise FORMAT_ERROR;
end if;
end if;
end loop;
Date.Year := Integer'Value(Ins(1..4));
Date.Month := Integer'Value(Ins(6..7));
Date.Day := Integer'Value(Ins(9..10));
if Date.Year > 9999 or Date.Year < 0 then
raise YEAR_ERROR;
end if;
if Date.Month > 12 or Date.Month < 1 then
raise MONTH_ERROR;
end if;
if Date.Day > Last_Day_Of_Month(Date.Month, Date.Year) or Date.Day < 1 then
raise DAY_ERROR;
end if;
--if Date.Year < 0 or Date.Year > 9999 then
-- raise YEAR_ERROR;
--end if;
end Get;
-- Skriver ut datum
procedure Put(Date: in Date_Type) is
begin
Put(Date.Year, 4);
Put("-");
if Date.Month < 10 then
Put("0");
end if;
Put(Date.Month,1);
Put("-");
if Date.Day < 10 then
Put("0");
end if;
Put(Date.Day,1);
end Put;
-- Returnerar nästkommande datum
function Next_Date(Date: in Date_Type)
return Date_Type is
Temp_Date: Date_Type;
begin
Temp_Date := Date;
if Temp_Date.Day = Last_Day_Of_Month(Temp_Date.Month, Temp_Date.Year) then
if Temp_Date.Month = 12 then
Temp_Date.Year := Temp_Date.Year + 1; Temp_Date.Month := 1; Temp_Date.Day := 1;
else
Temp_Date.Month := Temp_Date.Month + 1; Temp_Date.Day := 1;
end if;
else
Temp_Date.Day := Temp_Date.Day + 1;
end if;
return Temp_Date;
end Next_Date;
-- Returnerar föregående datum
function Previous_Date(Date: in Date_Type)
return Date_Type is
Temp_Date: Date_Type;
begin
Temp_Date := Date;
-- Om dagen inte är 1, ta bara bort en dag
if Temp_Date.Day /= 1 then
Temp_Date.Day := Temp_Date.Day - 1;
else
-- Beroende på vilken månad vi är i ska nya dagen bli olika.
if Temp_Date.Month = 1 then
Temp_Date.Year := Temp_Date.Year - 1; Temp_Date.Month := 12; Temp_Date.Day := 31;
else
Temp_Date.Month := Temp_Date.Month - 1;
Temp_Date.Day := Last_Day_Of_Month(Temp_Date.Month, Temp_Date.Year); -- Tar in månad och år så att funktionen kan ta hänsyn till skottår
end if;
end if;
--Temp_Date.Year := Temp_Date.Year - 1;
return Temp_Date;
end Previous_Date;
end Date_Package;
|
AdaCore/gpr | Ada | 2,865 | ads | --
-- Copyright (C) 2014-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
with Ada.Containers;
private with Ada.Strings.Unbounded;
private with Ada.Strings.Unbounded.Hash;
with Gpr_Parser_Support.Text; use Gpr_Parser_Support.Text;
-- This package provides helpers to deal with names regarding of casing
-- conventions (camel case, lower case, ...). What we call a "name" here is a
-- sequence of at least one word, a word being a sequence of at least one
-- non-blank ASCII alphanumericals. In addition, the first word must start
-- with a letter, and each first alphanumerical in a word must be upper case.
package Gpr_Parser_Support.Names is
type Casing_Convention is (Camel_With_Underscores, Camel, Lower, Upper);
-- Designate a specific casing convention for names formatting. For
-- instance, to format the ``HTML_Document_Root`` name::
--
-- Camel_With_Underscores: HTML_Document_Root
-- Camel: HTMLDocumentRoot
-- Lower: html_document_root
-- Upper: HTML_DOCUMENT_ROOT
--
-- Note that ``Camel_With_Underscores`` is the convention which preserves
-- the most information about a name: for instance it is not possible to
-- know from ``HTML_DOCUMENT_ROOT`` (an ``Upper`` formatted name) whether
-- its ``Camel_With_Underscores`` format is ``HTML_Document_ROOT``,
-- ``Html_Document_Root`` or any other casing variation, while the
-- reciprocal is true.
--
-- Because of this, different names can have different formattings in some
-- conventions and same formattings in other conventions.
type Name_Type is private;
Invalid_Name_Error : exception;
function Is_Valid_Name
(Name : Text_Type;
Casing : Casing_Convention := Camel_With_Underscores) return Boolean;
-- Return whether ``Name`` is a valid name in the given casing convention
function Create_Name
(Name : Text_Type;
Casing : Casing_Convention := Camel_With_Underscores) return Name_Type;
-- Create a name, decoding ``Name`` according to the given casing
-- convention. Raise an ``Invalid_Name_Error`` exception if Name is not a
-- valid in this convention.
function Format_Name
(Name : Name_Type; Casing : Casing_Convention) return Text_Type;
-- Format a name to the given casing convention. Raise an
-- ``Invalid_Name_Error`` exception if ``Name`` is not initialized.
function Hash (Name : Name_Type) return Ada.Containers.Hash_Type;
private
use Ada.Strings.Unbounded;
type Name_Type is new Unbounded_String;
-- Internally, we represent names in the equivalent ASCII string in
-- camel-with-underscores convention.
function Hash (Name : Name_Type) return Ada.Containers.Hash_Type
is (Hash (Unbounded_String (Name)));
end Gpr_Parser_Support.Names;
|
AdaCore/Ada_Drivers_Library | Ada | 5,435 | ads | -- This spec has been automatically generated from cm0.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
-- 24Bit System Tick Timer for use in RTOS
package Cortex_M_SVD.SysTick is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Enable SysTick Timer
type CSR_ENABLE_Field is
(
-- counter disabled
Disable,
-- counter enabled
Enable)
with Size => 1;
for CSR_ENABLE_Field use
(Disable => 0,
Enable => 1);
-- Generate Tick Interrupt
type CSR_TICKINT_Field is
(-- Counting down to zero asserts the SysTick exception request
Disable,
-- Counting down to zero does not assert the SysTick exception request
Enable)
with Size => 1;
for CSR_TICKINT_Field use
(Disable => 0,
Enable => 1);
-- Source to count from
type CSR_CLKSOURCE_Field is
(
-- External Clock
External_Clk,
-- CPU Clock
Cpu_Clk)
with Size => 1;
for CSR_CLKSOURCE_Field use
(External_Clk => 0,
Cpu_Clk => 1);
-- SysTick Control and Status Register
type SYST_CSR_Register is record
-- Enable SysTick Timer
ENABLE : CSR_ENABLE_Field := Cortex_M_SVD.SysTick.Disable;
-- Generate Tick Interrupt
TICKINT : CSR_TICKINT_Field := Cortex_M_SVD.SysTick.Disable;
-- Source to count from
CLKSOURCE : CSR_CLKSOURCE_Field :=
Cortex_M_SVD.SysTick.External_Clk;
-- unspecified
Reserved_3_15 : HAL.UInt13 := 16#0#;
-- SysTick counted to zero
COUNTFLAG : Boolean := False;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SYST_CSR_Register use record
ENABLE at 0 range 0 .. 0;
TICKINT at 0 range 1 .. 1;
CLKSOURCE at 0 range 2 .. 2;
Reserved_3_15 at 0 range 3 .. 15;
COUNTFLAG at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
subtype SYST_RVR_RELOAD_Field is HAL.UInt24;
-- SysTick Reload Value Register
type SYST_RVR_Register is record
-- Value to auto reload SysTick after reaching zero
RELOAD : SYST_RVR_RELOAD_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SYST_RVR_Register use record
RELOAD at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype SYST_CVR_CURRENT_Field is HAL.UInt24;
-- SysTick Current Value Register
type SYST_CVR_Register is record
-- Current value
CURRENT : SYST_CVR_CURRENT_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SYST_CVR_Register use record
CURRENT at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype SYST_CALIB_TENMS_Field is HAL.UInt24;
-- Clock Skew
type CALIB_SKEW_Field is
(
-- 10ms calibration value is exact
Exact,
-- 10ms calibration value is inexact, because of the clock frequency
Inexact)
with Size => 1;
for CALIB_SKEW_Field use
(Exact => 0,
Inexact => 1);
-- No Ref
type CALIB_NOREF_Field is
(
-- Ref Clk available
Ref_Clk_Available,
-- Ref Clk not available
Ref_Clk_Unavailable)
with Size => 1;
for CALIB_NOREF_Field use
(Ref_Clk_Available => 0,
Ref_Clk_Unavailable => 1);
-- SysTick Calibration Value Register
type SYST_CALIB_Register is record
-- Read-only. Reload value to use for 10ms timing
TENMS : SYST_CALIB_TENMS_Field;
-- unspecified
Reserved_24_29 : HAL.UInt6;
-- Read-only. Clock Skew
SKEW : CALIB_SKEW_Field;
-- Read-only. No Ref
NOREF : CALIB_NOREF_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SYST_CALIB_Register use record
TENMS at 0 range 0 .. 23;
Reserved_24_29 at 0 range 24 .. 29;
SKEW at 0 range 30 .. 30;
NOREF at 0 range 31 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- 24Bit System Tick Timer for use in RTOS
type SysTick_Peripheral is record
-- SysTick Control and Status Register
CSR : aliased SYST_CSR_Register;
-- SysTick Reload Value Register
RVR : aliased SYST_RVR_Register;
-- SysTick Current Value Register
CVR : aliased SYST_CVR_Register;
-- SysTick Calibration Value Register
CALIB : aliased SYST_CALIB_Register;
end record
with Volatile;
for SysTick_Peripheral use record
CSR at 16#0# range 0 .. 31;
RVR at 16#4# range 0 .. 31;
CVR at 16#8# range 0 .. 31;
CALIB at 16#C# range 0 .. 31;
end record;
-- 24Bit System Tick Timer for use in RTOS
SysTick_Periph : aliased SysTick_Peripheral
with Import, Address => SysTick_Base;
end Cortex_M_SVD.SysTick;
|
zhmu/ananas | Ada | 384 | adb | -- { dg-do compile }
-- { dg-options "-O -gnatws -fdump-tree-optimized" }
with Pure_Function3_Pkg; use Pure_Function3_Pkg;
procedure Pure_Function3b is
V : T;
begin
if F (V) = 1 then
raise Program_Error;
end if;
Set (V);
if F (V) = 2 then
raise Program_Error;
end if;
end;
-- { dg-final { scan-tree-dump-times "pure_function3_pkg.f" 2 "optimized" } }
|
dshadrin/AProxy | Ada | 3,422 | adb | ----------------------------------------
-- Copyright (C) 2019 Dmitriy Shadrin --
-- All rights reserved. --
----------------------------------------
with Ada.Unchecked_Deallocation;
with Ada.Text_IO; use Ada.Text_IO;
with ConfigTree; use ConfigTree;
with TimeStamp;
--------------------------------------------------------------------------------
package body Proxy is
procedure Free is new Ada.Unchecked_Deallocation (Configurator, ConfiguratorPtr);
procedure Free is new Ada.Unchecked_Deallocation (Manager, ManagerPtr);
---------------------------------
-- Configurator implementation --
---------------------------------
procedure Initialize (Object : in out Configurator) is
begin
Put_Line ("Init Configurator");
end Initialize;
-----------------------------------------------------------------------------
procedure Finalize (Object : in out Configurator) is
begin
Put_Line ("Delete Configurator");
end Finalize;
-----------------------------------------------------------------------------
function GetChild (ptr : in out Configurator; path : in String) return NodePtr is
begin
return ptr.data.GetChild (path);
end GetChild;
-----------------------------------------------------------------------------
function GetValue (ptr : in out Configurator; path : in String; default : in String := "") return String is
begin
return ptr.data.GetValue (path, default);
end GetValue;
---------------------------------
-- Manager implementation --
---------------------------------
procedure Initialize (Object : in out Manager) is
loggerConfig : NodePtr;
begin
Put_Line ("Init Manager");
Object.config := new Configurator;
loggerConfig := Object.config.GetChild ("proxy.logger");
TimeStamp.SetTimeCorrectValue (Long_Integer'Value (Object.config.GetValue ("proxy.system.tz")));
Object.logger := Logging.StartLogger (loggerConfig);
end Initialize;
-----------------------------------------------------------------------------
procedure Finalize (Object : in out Manager) is
begin
Logging.StopLogger;
Free (Object.config);
Put_Line ("Delete Manager");
end Finalize;
-----------------------------------------------------------------------------
procedure Start (Object : in out Manager) is
actors : NodePtr := GetConfig.data.GetChild ("proxy.actors");
begin
if not IsNull (actors) then
actors := null;
end if;
end Start;
---------------------------------
-- Package free functions --
---------------------------------
function GetManager return ManagerPtr is
begin
if mgrPtr = null then
mgrPtr := new Manager;
end if;
return mgrPtr;
end GetManager;
-----------------------------------------------------------------------------
function GetConfig return ConfiguratorPtr is
begin
return mgrPtr.config;
end GetConfig;
-----------------------------------------------------------------------------
procedure DeleteManager is
begin
Free (mgrPtr);
end DeleteManager;
-----------------------------------------------------------------------------
function GetLogger return Logging.LoggerPtr is
begin
return mgrPtr.logger;
end GetLogger;
end Proxy;
|
Skyfold/aws_sorter | Ada | 1,078 | adb | with common_types;
with Job_Types_Package.Sort; use Job_Types_Package.Sort;
with Job_Types_Package.Merge; use Job_Types_Package.Merge;
package body job_types_helper is
-----------------
-- Receive_Job --
-----------------
function Receive_Job
(Channel : GNAT.Sockets.Stream_Access)
return Job_Types_Package.Job_Record'Class
is
Job_Type_Swap : common_types.Job_Types;
begin
common_types.Job_Types'Read (Channel, Job_Type_Swap);
case Job_Type_Swap is
when common_types.Merge_Job =>
declare
E : Job_Types_Package.Merge.Job_Record_Merge :=
Receive_Job (Channel);
begin
return Job_Types_Package.Job_Record'Class (E);
end;
when common_types.Sort_Job =>
declare
E : Job_Types_Package.Merge.Job_Record_Merge :=
Receive_Job (Channel);
begin
return Job_Types_Package.Job_Record'Class (E);
end;
end case;
end Receive_Job;
end job_types_helper;
|
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.Chart_Symbol_Type_Attributes is
pragma Preelaborate;
type ODF_Chart_Symbol_Type_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Chart_Symbol_Type_Attribute_Access is
access all ODF_Chart_Symbol_Type_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Chart_Symbol_Type_Attributes;
|
reznikmm/matreshka | Ada | 3,729 | 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.Table_End_Position_Attributes is
pragma Preelaborate;
type ODF_Table_End_Position_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Table_End_Position_Attribute_Access is
access all ODF_Table_End_Position_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Table_End_Position_Attributes;
|
onox/sdlada | Ada | 4,465 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2018 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 SDL.Error;
package body SDL.Video.Rectangles is
use type C.int;
function Enclose (Points : in Point_Arrays; Clip : in Rectangle; Enclosed : out Rectangle) return Boolean is
function SDL_Enclose_Points (P : in Point_Arrays;
L : in C.int;
Clip : in Rectangle;
R : out Rectangle) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_EnclosePoints";
Result : SDL_Bool := SDL_Enclose_Points (Points, C.int (Points'Length), Clip, Enclosed);
begin
return (Result = SDL_True);
end Enclose;
procedure Enclose (Points : in Point_Arrays; Enclosed : out Rectangle) is
function SDL_Enclose_Points (P : in Point_Arrays;
L : in C.int;
Clip : in Rectangle_Access;
R : out Rectangle) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_EnclosePoints";
Result : SDL_Bool := SDL_Enclose_Points (Points, C.int (Points'Length), null, Enclosed);
begin
if Result /= SDL_True then
raise Rectangle_Error with SDL.Error.Get;
end if;
end Enclose;
function Has_Intersected (A, B : in Rectangle) return Boolean is
function SDL_Has_Intersection (A, B : in Rectangle) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_HasIntersection";
Result : SDL_Bool := SDL_Has_Intersection (A, B);
begin
return (Result = SDL_True);
end Has_Intersected;
function Intersects (A, B : in Rectangle; Intersection : out Rectangle) return Boolean is
function SDL_Intersect_Rect (A, B : in Rectangle; R : out Rectangle) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_IntersectRect";
Result : SDL_Bool := SDL_Intersect_Rect (A, B, R => Intersection);
begin
return (Result = SDL_True);
end Intersects;
function Clip_To (Clip_Area : in Rectangle; Line : in out Line_Segment) return Boolean is
function SDL_Intersect_Rect_And_Line (R : in Rectangle; X1, Y1, X2, Y2 : in out C.int) return SDL_Bool with
Import => True,
Convention => C,
External_Name => "SDL_IntersectRectAndLine";
Result : SDL_Bool := SDL_Intersect_Rect_And_Line (Clip_Area,
Line.Start.X,
Line.Start.Y,
Line.Finish.X,
Line.Finish.Y);
begin
return (Result = SDL_True);
end Clip_To;
function Union (A, B : in Rectangle) return Rectangle is
procedure SDL_Union_Rect (A, B : in Rectangle; R : out Rectangle) with
Import => True,
Convention => C,
External_Name => "SDL_UnionRect";
Result : Rectangle;
begin
SDL_Union_Rect (A, B, Result);
return Result;
end Union;
end SDL.Video.Rectangles;
|
reznikmm/matreshka | Ada | 3,719 | 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_Filter_Name_Attributes is
pragma Preelaborate;
type ODF_Draw_Filter_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Filter_Name_Attribute_Access is
access all ODF_Draw_Filter_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Filter_Name_Attributes;
|
python36/0xfa | Ada | 1,710 | adb | package body getter.file is
procedure close is
begin
ada.text_io.close(current_ptr.all);
free(current_ptr);
files_stack.delete_last;
if not files_stack_t.is_empty(files_stack) then
current_ptr := files_stack_t.last_element(files_stack).descriptor;
current_line := files_stack_t.last_element(files_stack).line;
set_line(current_line);
end if;
end close;
function get return character is
use type pos_count;
c : character;
begin
if ada.text_io.end_of_file(current_ptr.all) then
if not sended_last_lf then
sended_last_lf := true;
-- return ' ';
return ascii.lf;
end if;
sended_last_lf := false;
close;
return ascii.nul;
end if;
ada.text_io.get_immediate(current_ptr.all, c);
if c = ';' then
ada.text_io.get_immediate(current_ptr.all, c);
while c /= ascii.lf loop
if ada.text_io.end_of_file(current_ptr.all) then
c := ' ';
exit;
end if;
ada.text_io.get_immediate(current_ptr.all, c);
end loop;
end if;
if c = ascii.lf then
current_line := current_line + 1;
set_line(current_line);
-- return ' ';
elsif c = ascii.nul then
return ' ';
end if;
return c;
end get;
procedure open (path : string) is
begin
if not files_stack_t.is_empty(files_stack) then
files_stack.replace_element(files_stack_t.last(files_stack), (current_ptr, current_line));
end if;
current_ptr := new ada.text_io.file_type;
ada.text_io.open(current_ptr.all, ada.text_io.in_file, path);
files_stack.append((current_ptr, 1));
getter.push(get'access);
end open;
end getter.file; |
PThierry/ewok-kernel | Ada | 20,181 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- 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.unchecked_conversion;
with ewok.ipc; use ewok.ipc;
with ewok.tasks; use ewok.tasks;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.sanitize;
with ewok.perm;
with ewok.sleep;
with ewok.debug;
with ewok.mpu;
with types.c; use types.c;
package body ewok.syscalls.ipc
with spark_mode => off
is
--pragma debug_policy (IGNORE);
package TSK renames ewok.tasks;
procedure svc_ipc_do_recv
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
blocking : in boolean;
mode : in ewok.tasks_shared.t_task_mode)
is
ep_id : ewok.ipc.t_extended_endpoint_id;
----------------
-- Parameters --
----------------
-- Who is the sender ?
expected_sender : ewok.ipc.t_extended_task_id
with address => to_address (params(1));
-- Listening to any id ?
listen_any : boolean;
-- Listening to a specific id ?
id_sender : ewok.tasks_shared.t_task_id;
-- Buffer size
size : unsigned_8
with address => to_address (params(2));
-- Input buffer
buf : c_buffer (1 .. unsigned_32 (size))
with address => to_address (params(3));
begin
--if expected_sender = ewok.ipc.ANY_APP then
-- pragma DEBUG (debug.log (debug.DEBUG, "recv(): "
-- & TSK.tasks_list(caller_id).name & " <- ANY");
--else
-- pragma DEBUG (debug.log (debug.DEBUG, "recv(): "
-- & TSK.tasks_list(caller_id).name & " <- "
-- & TSK.tasks_list(ewok.ipc.to_task_id(expected_sender)).name);
--end if;
--------------------------
-- Verifying parameters --
--------------------------
if mode /= TASK_MODE_MAINTHREAD then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): IPCs in ISR mode not allowed!"));
goto ret_denied;
end if;
if not expected_sender'valid then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): invalid id_sender"));
goto ret_inval;
end if;
-- Task initialization is complete ?
if not TSK.is_init_done (caller_id) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): initialization not completed"));
goto ret_denied;
end if;
-- Does &size is in the caller address space ?
if not ewok.sanitize.is_word_in_data_slot
(to_system_address (size'address), caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): 'size' parameter not in task's address space"));
goto ret_inval;
end if;
-- Does &expected_sender is in the caller address space ?
if not ewok.sanitize.is_word_in_data_slot
(to_system_address (expected_sender'address), caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): 'expected_sender' parameter not in task's address space"));
goto ret_inval;
end if;
-- Does &buf is in the caller address space ?
if not ewok.sanitize.is_range_in_data_slot
(to_system_address (buf'address), unsigned_32 (size), caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): 'buffer' parameter not in task's address space"));
goto ret_inval;
end if;
-- The expected sender might be a particular task or any of them
if expected_sender = ewok.ipc.ANY_APP then
listen_any := true;
else
id_sender := ewok.ipc.to_task_id (expected_sender);
listen_any := false;
end if;
-- When the sender is a task, we have to do some additional checks
if not listen_any then
-- Is the sender is an existing user task?
if not TSK.is_real_user (id_sender) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): invalid id_sender"));
goto ret_inval;
end if;
-- Defensive programming test: should *never* be true
if TSK.get_state (id_sender, TASK_MODE_MAINTHREAD)
= TASK_STATE_EMPTY
then
raise program_error;
end if;
-- A task can't send a message to itself
if caller_id = id_sender then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): sender and receiver are the same"));
goto ret_inval;
end if;
-- Is the sender in the same domain?
#if CONFIG_KERNEL_DOMAIN
if not ewok.perm.is_same_domain (id_sender, caller_id) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): sender's domain not granted"));
goto ret_denied;
end if;
#end if;
-- Are ipc granted?
if not ewok.perm.ipc_is_granted (id_sender, caller_id) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): not granted to listen task "
& TSK.tasks_list(id_sender).name));
goto ret_denied;
end if;
end if;
------------------------------
-- Defining an IPC EndPoint --
------------------------------
ep_id := ID_ENDPOINT_UNUSED;
-- Special case: listening to ANY_APP and already have a pending message
if listen_any then
for id of TSK.tasks_list(caller_id).ipc_endpoint_id loop
if id /= ID_ENDPOINT_UNUSED
and then
ewok.ipc.ipc_endpoints(id).state = ewok.ipc.WAIT_FOR_RECEIVER
and then
ewok.ipc.to_task_id (ewok.ipc.ipc_endpoints(id).to) = caller_id
then
ep_id := id;
exit;
end if;
end loop;
-- Special case: listening to a given sender and already have a pending
-- message
else
declare
id : constant ewok.ipc.t_extended_endpoint_id
:= TSK.tasks_list(caller_id).ipc_endpoint_id(id_sender);
begin
if id /= ID_ENDPOINT_UNUSED
and then
ewok.ipc.ipc_endpoints(id).state = ewok.ipc.WAIT_FOR_RECEIVER
and then
ewok.ipc.to_task_id (ewok.ipc.ipc_endpoints(id).to) = caller_id
then
ep_id := id;
end if;
end;
end if;
-------------------------
-- Reading the message --
-------------------------
-- No pending message to read: we terminate here
if ep_id = ID_ENDPOINT_UNUSED then
-- Wake up idle senders
if not listen_any and then
TSK.get_state (id_sender, TASK_MODE_MAINTHREAD) = TASK_STATE_IDLE
then
TSK.set_state
(id_sender, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
end if;
-- Receiver is blocking until it receives a message or it returns
-- E_SYS_BUSY
if blocking then
TSK.set_state
(caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_IPC_RECV_BLOCKED);
return;
else
goto ret_busy;
end if;
end if;
-- The syscall returns sender's ID
expected_sender := ewok.ipc.ipc_endpoints(ep_id).from;
id_sender := ewok.ipc.to_task_id (expected_sender);
-- Defensive programming test: should *never* happen
if not TSK.is_real_user (id_sender) then
raise program_error;
end if;
-- Copying the message in the receiver's buffer
if ewok.ipc.ipc_endpoints(ep_id).size > size then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": recv(): IPC message overflows, buffer is too small"));
goto ret_inval;
end if;
-- Returning the data size
size := ewok.ipc.ipc_endpoints(ep_id).size;
-- Copying data
-- Note: we don't use 'first attribute. By convention, array indexes
-- begin with '1' value
buf(1 .. unsigned_32 (size)) := ewok.ipc.ipc_endpoints(ep_id).data(1 .. unsigned_32 (size));
-- The EndPoint is ready for another use
ewok.ipc.ipc_endpoints(ep_id).state := READY;
ewok.ipc.ipc_endpoints(ep_id).size := 0;
-- Free sender from it's blocking state
case TSK.get_state (id_sender, TASK_MODE_MAINTHREAD) is
when TASK_STATE_IPC_WAIT_ACK =>
-- The kernel need to update sender syscall's return value, but
-- as we are currently managing the receiver's syscall, sender's
-- data region in memory can not be accessed (even by the kernel).
-- The following temporary open the access to every task's data
-- region, perform the writing, and then restore the MPU.
ewok.mpu.enable_unrestricted_kernel_access;
set_return_value (id_sender, TASK_MODE_MAINTHREAD, SYS_E_DONE);
ewok.mpu.disable_unrestricted_kernel_access;
TSK.set_state
(id_sender, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
when TASK_STATE_IPC_SEND_BLOCKED =>
-- The sender will reexecute the SVC instruction to fulfill its syscall
TSK.set_state
(id_sender, TASK_MODE_MAINTHREAD, TASK_STATE_FORCED);
TSK.tasks_list(id_sender).ctx.frame_a.all.PC :=
TSK.tasks_list(id_sender).ctx.frame_a.all.PC - 2;
when others =>
null;
end case;
set_return_value (caller_id, mode, SYS_E_DONE);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_busy>>
set_return_value (caller_id, mode, SYS_E_BUSY);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end svc_ipc_do_recv;
procedure svc_ipc_do_send
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
blocking : in boolean;
mode : in ewok.tasks_shared.t_task_mode)
is
type t_task_access is access all TSK.t_task;
receiver_a : t_task_access;
ep_id : ewok.ipc.t_extended_endpoint_id;
ok : boolean;
----------------
-- Parameters --
----------------
-- Who is the receiver ?
id_receiver : ewok.tasks_shared.t_task_id
with address => params(1)'address;
-- Buffer size
size : unsigned_8
with address => params(2)'address;
-- Output buffer
buf : c_buffer (1 .. unsigned_32 (size))
with address => to_address (params(3));
begin
--pragma DEBUG (debug.log (debug.DEBUG, "send(): "
-- & TSK.tasks_list(caller_id).name & " -> "
-- & TSK.tasks_list(id_receiver).name);
--------------------------
-- Verifying parameters --
--------------------------
if mode /= TASK_MODE_MAINTHREAD then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): making IPCs while in ISR mode is not allowed!"));
goto ret_denied;
end if;
if not id_receiver'valid then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): invalid id_receiver"));
goto ret_inval;
end if;
-- Task initialization is complete ?
if not is_init_done (caller_id) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): initialization not completed"));
goto ret_denied;
end if;
-- Does &buf is in the caller address space ?
if not ewok.sanitize.is_range_in_data_slot
(to_unsigned_32 (buf'address), unsigned_32 (size), caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): 'buffer' not in caller space"));
goto ret_inval;
end if;
-- Verifying that the receiver id corresponds to a user application
if not TSK.is_real_user (id_receiver) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): id_receiver must be a user task"));
goto ret_inval;
end if;
receiver_a := TSK.tasks_list(id_receiver)'access;
-- Defensive programming test: should *never* be true
if TSK.get_state (id_receiver, TASK_MODE_MAINTHREAD)
= TASK_STATE_EMPTY
then
raise program_error;
end if;
-- A task can't send a message to itself
if caller_id = id_receiver then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): receiver and sender are the same"));
goto ret_inval;
end if;
-- Is size valid ?
if size > ewok.ipc.MAX_IPC_MSG_SIZE then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): invalid size"));
goto ret_inval;
end if;
--
-- Verifying permissions
--
#if CONFIG_KERNEL_DOMAIN
if not ewok.perm.is_same_domain (id_receiver, caller_id) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send() to "
& TSK.tasks_list(id_receiver).name
& ": domain not granted"));
goto ret_denied;
end if;
#end if;
if not ewok.perm.ipc_is_granted (caller_id, id_receiver) then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send() to "
& TSK.tasks_list(id_receiver).name
& " not granted"));
goto ret_denied;
end if;
------------------------------
-- Defining an IPC EndPoint --
------------------------------
ep_id := ID_ENDPOINT_UNUSED;
-- Creating a new EndPoint between the sender and the receiver
if TSK.tasks_list(caller_id).ipc_endpoint_id(id_receiver) = ID_ENDPOINT_UNUSED
then
-- Defensive programming test: should *never* happen
if receiver_a.all.ipc_endpoint_id(caller_id) /= ID_ENDPOINT_UNUSED then
raise program_error;
end if;
ewok.ipc.get_endpoint (ep_id, ok);
if not ok then
-- FIXME
debug.panic ("send(): EndPoint starvation !O_+");
end if;
TSK.tasks_list(caller_id).ipc_endpoint_id(id_receiver) := ep_id;
TSK.tasks_list(id_receiver).ipc_endpoint_id(caller_id) := ep_id;
else
ep_id := TSK.tasks_list(caller_id).ipc_endpoint_id(id_receiver);
end if;
-----------------------
-- Sending a message --
-----------------------
-- Wake up idle receivers
if ewok.sleep.is_sleeping (id_receiver) then
ewok.sleep.try_waking_up (id_receiver);
elsif receiver_a.all.state = TASK_STATE_IDLE then
TSK.set_state
(id_receiver, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
end if;
-- The receiver has already a pending message and the endpoint is already
-- in use.
if ewok.ipc.ipc_endpoints(ep_id).state = ewok.ipc.WAIT_FOR_RECEIVER and
ewok.ipc.to_task_id (ewok.ipc.ipc_endpoints(ep_id).to) = id_receiver
then
if blocking then
TSK.set_state
(caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_IPC_SEND_BLOCKED);
#if CONFIG_SCHED_SUPPORT_FIPC
if TSK.get_state (id_receiver, TASK_MODE_MAINTHREAD)
= TASK_STATE_RUNNABLE
or
TSK.get_state (id_receiver, TASK_MODE_MAINTHREAD)
= TASK_STATE_IDLE
then
TSK.set_state
(id_receiver, TASK_MODE_MAINTHREAD, TASK_STATE_FORCED);
end if;
#end if;
return;
else
goto ret_busy;
end if;
end if;
if ewok.ipc.ipc_endpoints(ep_id).state /= ewok.ipc.READY then
pragma DEBUG (debug.log (debug.ERROR,
TSK.tasks_list(caller_id).name
& ": send(): invalid endpoint state - maybe a dead lock"));
goto ret_denied;
end if;
ewok.ipc.ipc_endpoints(ep_id).from := ewok.ipc.to_ext_task_id (caller_id);
ewok.ipc.ipc_endpoints(ep_id).to := ewok.ipc.to_ext_task_id (id_receiver);
-- We copy the message in the IPC buffer
-- Note: we don't use 'first attribute. By convention, array indexes
-- begin with '1' value
ewok.ipc.ipc_endpoints(ep_id).size := size;
ewok.ipc.ipc_endpoints(ep_id).data(1 .. unsigned_32 (size)) := buf(1 .. unsigned_32 (size));
-- Adjusting the EndPoint state
ewok.ipc.ipc_endpoints(ep_id).state := ewok.ipc.WAIT_FOR_RECEIVER;
-- If the receiver was blocking, it can be 'freed' from its blocking
-- state.
if TSK.get_state (id_receiver, TASK_MODE_MAINTHREAD)
= TASK_STATE_IPC_RECV_BLOCKED
then
-- The receiver will reexecute the SVC instruction to fulfill its syscall
TSK.set_state
(id_receiver, TASK_MODE_MAINTHREAD, TASK_STATE_FORCED);
-- Unrestrict kernel access to memory to change a value located
-- in the receiver's stack frame
ewok.mpu.enable_unrestricted_kernel_access;
receiver_a.all.ctx.frame_a.all.PC :=
receiver_a.all.ctx.frame_a.all.PC - 2;
ewok.mpu.disable_unrestricted_kernel_access;
end if;
if blocking then
TSK.set_state
(caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_IPC_WAIT_ACK);
#if CONFIG_SCHED_SUPPORT_FIPC
if receiver_a.all.state = TASK_STATE_RUNNABLE or
receiver_a.all.state = TASK_STATE_IDLE
then
TSK.set_state
(id_receiver, TASK_MODE_MAINTHREAD, TASK_STATE_FORCED);
end if;
#end if;
return;
else
set_return_value (caller_id, mode, SYS_E_DONE);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end if;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_busy>>
set_return_value (caller_id, mode, SYS_E_BUSY);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
TSK.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end svc_ipc_do_send;
end ewok.syscalls.ipc;
|
AdaCore/Ada_Drivers_Library | Ada | 1,939 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Architecture : constant String := "ARM"; -- From board definition
Board : constant String := "Feather_STM32F405"; -- From command line
CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition
Device_Family : constant String := "STM32F4"; -- From board definition
Device_Name : constant String := "STM32F405RGTx"; -- From board definition
Has_Ravenscar_Full_Runtime : constant String := "True"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "True"; -- From board definition
Has_ZFP_Runtime : constant String := "False"; -- From board definition
High_Speed_External_Clock : constant := 12000000; -- From board definition
Max_Mount_Name_Length : constant := 128; -- From default value
Max_Mount_Points : constant := 2; -- From default value
Max_Path_Length : constant := 1024; -- From default value
Number_Of_Interrupts : constant := 0; -- From default value
Runtime_Name : constant String := "light-tasking-feather_stm32f405"; -- From default value
Runtime_Name_Suffix : constant String := "feather_stm32f405"; -- From board definition
Runtime_Profile : constant String := "light-tasking"; -- From command line
Use_Startup_Gen : constant Boolean := False; -- From command line
Vendor : constant String := "STMicro"; -- From board definition
end ADL_Config;
|
jscparker/math_packages | Ada | 5,998 | ads |
-------------------------------------------------------------------------------
-- package Disorderly.Basic_Rand, Linear Random Number Generator
-- Copyright (C) 1995-2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------------------
-- PACKAGE Disorderly.Basic_Rand
--
-- Procedure Disorderly.Basic_Rand.Get_Random is a linear pseudo random number
-- generator designed to be task-safe, and optimized for high statistical quality.
-- Its design is similar to that of the original version of Marsaglia's
-- KISS generator, except that it is 64 bit, uses component generators with
-- prime number periods, and the Shift-XOR generator does 8 rather than
-- 3 stages of shifting and XORing.
--
-- It is a stripped down version of Disorderly.Random.Get_Random. It is designed
-- for speed. It has no known detectable statistical weaknesses.
-- Disorderly.Basic_Rand is more than 2 times faster than Disorderly.Random but
-- the non-linear Disorderly.Random has better guarantees on statistical quality
-- and should be used whenever possible.
--
--
-- Procedure Disorderly.Basic_Rand.Get_Random:
--
-- 1. Uniform output in the range 0 .. 2**61-1. (i.e. 61 random bits per call).
-- 2. Period of the generator is near 0.9999999960 * 2**185.
-- More precisely, period is the product of 3 large primes:
-- 3625455516735504383 * 5866200191975030783 * (2^61-1).
-- However, the individual bits have periods of order 2**123, rather than 2**185.
-- 3. Generator is pure - designed for convenient use in
-- multi-tasking simulations.
-- 4. CPU time per call is constant (again for multi-tasking simulations).
-- 5. Size of state is 3 x 64 bits.
-- 6. Speed: Typical benchmarks (on a 64-bit intel PC) measure CPU time per call
-- to be around 1/8 to 1/4 that of a call to a 64-bit Sin(x).
-- 7. The State can be initialized by a version of procedure Reset that calls
-- Ada.Calendar.Clock. This version of Reset is confined to a child package,
-- since its not pure. The child package is called Basic_Rand.Clock_Entropy.
--
--
-- For a general RATIONALE, see the parent package: Disorderly.ads
--
package Disorderly.Basic_Rand
with Spark_Mode => On
is
pragma Pure;
type Parent_Random_Int is mod 2**64;
-- Internally, all arithmetic is done on this type. The generator
-- is designed for machines with efficient 64-bit integer arithmetic.
Bits_per_Random_Number : constant := 61;
subtype Random_Int is Parent_Random_Int range 0 .. 2**Bits_per_Random_Number-1;
-- The random number generator returns Ints of this type. It's
-- best to think of these Ints as 61 bins, each containing a random bit.
-- Notice that it is *not* a mod 2**61 type.
--
-- The number p = 61 is a special kind of prime that makes 2**p-1 a
-- prime number. Primality of 2**p-1 is a basic requirement of the
-- algorithm that generates the random numbers.
--
-- The number of bits returned by a RNG is rarely the actual
-- number required by a particular application. Additional
-- work is necessary to put the random stream into the desired range,
-- and numeric type.
subtype Seed_Random_Int is Random_Int range 1 .. Random_Int'Last;
-- Seeds (Initiators) should not be 0.
type State is private;
procedure Get_Random
(Random_x : out Random_Int;
S : in out State);
procedure Reset
(S : out State;
Initiator1 : in Seed_Random_Int := 1111;
Initiator2 : in Seed_Random_Int := 2222;
Initiator3 : in Seed_Random_Int := 3333);
-- procedure Reset initializes State S.
-- There are no calls to Calendar, so it is reproducible: use the same
-- seeds each time and you get the same state S each time.
-- The following routines translate state S into text, and back again.
-- Useful for saving state S on HDD in text format.
No_Of_Seeds : constant := 3;
Rand_Image_Width : constant := 20; -- 2^64-1 = 1.8446744073709551615 * 10^19
Max_Image_Width : constant := Rand_Image_Width * No_Of_Seeds;
subtype State_String is String(1 .. Max_Image_Width);
function Value (Coded_State : State_String) return State with
Pre => (for all i in State_String'Range => Coded_State(i) in '0' .. '9');
function Image (Of_State : State) return State_String;
-- Detect invalid States, for example after input from HDD.
function Valid_State (S : in State) return Boolean;
-- Make an easier to read version of State_String by putting a space in front
-- of each of the 20 digit numbers: Formatted_Image().
Leading_Spaces : constant := 1;
Formatted_State_String_Width : constant := (Rand_Image_Width + Leading_Spaces)*No_Of_Seeds;
subtype Formatted_State_String is String(1 .. Formatted_State_String_Width);
function Formatted_Image (Of_State : State) return Formatted_State_String;
function Are_Equal (State_1, State_2 : State) return Boolean;
private
subtype State_Index is Natural range 0 .. No_Of_Seeds-1;
type Vals is array(State_Index) of Parent_Random_Int;
type State is record
X : Vals := (others => 701);
end Record;
end Disorderly.Basic_Rand;
|
godunko/adawebui | Ada | 5,350 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017-2020, 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: 5716 $ $Date: 2017-01-24 16:35:18 +0300 (Tue, 24 Jan 2017) $
------------------------------------------------------------------------------
package body Web.Core.Connectables.Slots_0.Slots_1.Generic_Emitters is
-------------
-- Connect --
-------------
overriding procedure Connect
(Self : in out Emitter;
Slot : Slots_0.Slot'Class)
is
Slot_End : Slot_End_Access := Slot.Create_Slot_End;
Signal_End : Signal_End_Access
:= new Signal_End_0 (Self'Unchecked_Access);
begin
Slot_End.Attach;
Signal_End.Attach;
Signal_End.Slot_End := Slot_End;
end Connect;
-------------
-- Connect --
-------------
overriding procedure Connect
(Self : in out Emitter;
Slot : Slots_1.Slot'Class)
is
Slot_End : Slot_End_Access := Slot.Create_Slot_End;
Signal_End : Signal_End_Access
:= new Signal_End_1 (Self'Unchecked_Access);
begin
Slot_End.Attach;
Signal_End.Attach;
Signal_End.Slot_End := Slot_End;
end Connect;
----------
-- Emit --
----------
procedure Emit
(Self : in out Emitter'Class;
Parameter_1 : Parameter_1_Type)
is
Current : Signal_End_Access := Self.Head;
begin
while Current /= null loop
begin
Signal_End'Class (Current.all).Invoke (Parameter_1);
exception
when others =>
null;
end;
Current := Current.Next;
end loop;
end Emit;
------------
-- Invoke --
------------
overriding procedure Invoke
(Self : in out Signal_End_0;
Parameter_1 : Parameter_1_Type)
is
pragma Unreferenced (Parameter_1);
begin
Slot_End_0'Class (Self.Slot_End.all).Invoke;
end Invoke;
------------
-- Invoke --
------------
overriding procedure Invoke
(Self : in out Signal_End_1;
Parameter_1 : Parameter_1_Type) is
begin
Slot_End_1'Class (Self.Slot_End.all).Invoke (Parameter_1);
end Invoke;
end Web.Core.Connectables.Slots_0.Slots_1.Generic_Emitters;
|
reznikmm/matreshka | Ada | 3,699 | 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.Form_Enctype_Attributes is
pragma Preelaborate;
type ODF_Form_Enctype_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Form_Enctype_Attribute_Access is
access all ODF_Form_Enctype_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Form_Enctype_Attributes;
|
srunr/Continued-Fractions | Ada | 3,810 | adb | with Ada.Text_IO;
with Ada.Real_Time; use Ada.Real_Time;
with Extended_Real;
with Extended_Real.IO;
procedure Contfrac4 is
type Real is digits 15;
Start_time, End_time : Time;
Exec_time : Time_Span;
package rio is new Ada.Text_IO.Float_IO (Real);
use rio;
generic
type Scalar is digits <>;
with function A (N : in Natural) return Scalar;
with function B (N : in Positive) return Scalar;
with package Ext_Real is new Extended_Real(Scalar);
function Continued_Fraction (Steps : in Natural) return Ext_Real.e_Real;
function Continued_Fraction (Steps : in Natural) return Ext_Real.e_Real is
use Ext_Real;
function A (N : in Natural) return e_Real is (Make_Extended(A(N)));
function B (N : in Positive) return e_Real is (Make_Extended(B(N)));
Fraction : e_Real := Make_Extended(0.0);
begin
for N in reverse Natural range 1 .. Steps loop
Fraction := B(N) / (A(N) + Fraction);
end loop;
return A (0) + Fraction;
end Continued_Fraction;
generic
type Scalar is digits <>;
with package Ext_Real is new Extended_Real(Scalar);
package Square_Root_Of_2 is
function A (N : in Natural) return Scalar is (Scalar((if N = 0 then 1 else 2)));
function B (N : in Positive) return Scalar is (Scalar(1));
function Estimate is new Continued_Fraction(Scalar, A, B, Ext_Real);
end Square_Root_Of_2;
package Ext_Real_Square_Root_Of_2 is new Extended_Real(Real);
package Ext_Real_Square_Root_Of_2_IO is new Ext_Real_Square_Root_Of_2.IO; use Ext_Real_Square_Root_Of_2_IO;
package Ext_Square_Root_Of_2 is new Square_Root_Of_2(Real, Ext_Real_Square_Root_Of_2);
generic
type Scalar is digits <>;
with package Ext_Real is new Extended_Real(Scalar);
package Napiers_Constant is
function A (N : in Natural) return Scalar is (Scalar(if N = 0 then 2 else N));
function B (N : in Positive) return Scalar is (Scalar(if N = 1 then 1 else N-1));
function Estimate is new Continued_Fraction(Scalar, A, B, Ext_Real);
end Napiers_Constant;
package Ext_Real_Napiers_Constant is new Extended_Real(Real);
package Ext_Real_Napiers_Constant_IO is new Ext_Real_Napiers_Constant.IO; use Ext_Real_Napiers_Constant_IO;
package Ext_Napiers_Constant is new Napiers_Constant(Real, Ext_Real_Napiers_Constant);
generic
type Scalar is digits <>;
with package Ext_Real is new Extended_Real(Scalar);
package Pi is
function A (N : in Natural) return Scalar is (Scalar(if N = 0 then 3 else 6));
function B (N : in Positive) return Scalar is (Scalar(((2 * N - 1) ** 2)));
function Estimate is new Continued_Fraction(Scalar, A, B, Ext_Real);
end Pi;
package Ext_Real_Pi is new Extended_Real(Real);
package Ext_Real_Pi_IO is new Ext_Real_Pi.IO; use Ext_Real_Pi_IO;
package Ext_Pi is new Pi(Real, Ext_Real_Pi);
-- package Scalar_Text_IO is new Ada.Text_IO.Float_IO (Scalar);
use Ada.Text_IO;
begin -- Contfrac
Put("Square_Root_Of_2 = ");
Start_time := clock;
Put(e_Real_Image(Ext_Square_Root_Of_2.Estimate (200)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put("Napiers_Constant = ");
Start_time := clock;
Put (e_Real_Image(Ext_Napiers_Constant.Estimate (200)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put("Pi = ");
Start_time := clock;
Put (e_Real_Image(Ext_Pi.Estimate (10000)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
end Contfrac4;
|
reznikmm/matreshka | Ada | 4,139 | 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.Table_Number_Matrix_Rows_Spanned_Attributes;
package Matreshka.ODF_Table.Number_Matrix_Rows_Spanned_Attributes is
type Table_Number_Matrix_Rows_Spanned_Attribute_Node is
new Matreshka.ODF_Table.Abstract_Table_Attribute_Node
and ODF.DOM.Table_Number_Matrix_Rows_Spanned_Attributes.ODF_Table_Number_Matrix_Rows_Spanned_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Number_Matrix_Rows_Spanned_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Table_Number_Matrix_Rows_Spanned_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Table.Number_Matrix_Rows_Spanned_Attributes;
|
persan/advent-of-code-2020 | Ada | 3,973 | adb | pragma Ada_2012;
with Adventofcode.File_Line_Readers;
with Ada.Strings.Fixed;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Source_Info; use GNAT.Source_Info;
package body Adventofcode.Day_8 is
----------
-- Load --
----------
procedure Load (Memory : in out Memory_Type; From_Path : String) is
begin
Memory.Clear;
for Line of Adventofcode.File_Line_Readers.Read_Lines (From_Path) loop
Memory.Assemble (Line);
end loop;
end Load;
----------
-- Load --
----------
overriding procedure Load (Self : in out Computer_Type; From_Path : String) is
begin
Self.Reset;
Self.Storage.Load (From_Path);
end Load;
--------------
-- Assemble --
--------------
procedure Assemble (Self : in out Memory_Type; Line : String)
is
Index : constant Natural := Ada.Strings.Fixed.Index (Line, " ");
begin
Self.Append (Instruction_Type'
(Executed => False,
Code => Op_Code'Value (Line (Line'First .. Index - 1)),
Value => Integer'Value (Line (Index + 1 .. Line'Last))));
end Assemble;
-----------
-- Reset --
-----------
procedure Reset (Self : in out Computer_Type) is
begin
Self.Print_Trace;
Self.Runing := True;
Self.Execution_OK := False;
Self.Accumulator := 0;
Self.Program_Counter := 0;
for I of Self.Storage loop
I.Executed := False;
end loop;
end Reset;
------------
-- Acc_Op --
------------
procedure Acc_Op (Self : in out Computer_Type) is
begin
Self.Print_Trace;
Self.Storage (Self.Program_Counter).Executed := True;
Self.Accumulator := Self.Accumulator + Self.Storage (Self.Program_Counter).Value;
Self.Program_Counter := Self.Program_Counter + 1;
end Acc_Op;
------------
-- Jmp_Op --
------------
procedure Jmp_Op (Self : in out Computer_Type) is
begin
Self.Print_Trace;
Self.Storage (Self.Program_Counter).Executed := True;
if Self.Storage (Self.Program_Counter).Value /= 0 then
Self.Program_Counter := Self.Program_Counter + Self.Storage (Self.Program_Counter).Value;
else
Self.Program_Counter := Self.Program_Counter + 1;
end if;
end Jmp_Op;
------------
-- Nop_Op --
------------
procedure Nop_Op (Self : in out Computer_Type) is
begin
Self.Print_Trace;
Self.Storage (Self.Program_Counter).Executed := True;
Self.Program_Counter := Self.Program_Counter + 1;
end Nop_Op;
----------
-- Step --
----------
procedure Step (Self : in out Computer_Type) is
begin
Self.Print_Trace;
if not Self.Storage (Self.Program_Counter).Executed or else Self.Program_Counter > Integer (Self.Storage.Length) then
Decoder (Self.Storage (Self.Program_Counter).Code) (Self);
else
if Self.Program_Counter > Integer (Self.Storage.Length) then
Self.Execution_OK := True;
end if;
Self.Runing := False;
end if;
end Step;
---------
-- Run --
---------
overriding procedure Run (Self : in out Computer_Type) is
begin
Self.Print_Trace;
while Self.Runing loop
Self.Step;
end loop;
end Run;
-----------
-- Print --
-----------
overriding procedure Print (Self : in out Computer_Type) is
begin
Put_Line ("Accumulator =>" & Self.Accumulator'Img);
Put_Line ("Program_Counter =>" & Self.Program_Counter'Img);
Put_Line ("Execution_OK =>" & Self.Execution_OK'Img);
end Print;
procedure Print_Trace (Self : in out Computer_Type; Location : String := GNAT.Source_Info.Enclosing_Entity) is
begin
if Self.Trace then
Put_Line (Location &
"(PC => " & Self.Program_Counter'Img &
",ACC => " & Self.Accumulator'Img & ")");
end if;
end;
end Adventofcode.Day_8;
|
mfkiwl/ewok-kernel-security-OS | Ada | 1,020 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- 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 ewok.rng
with spark_mode => on
is
procedure random_array
(tab : out unsigned_8_array;
success : out boolean);
procedure random
(rand : out unsigned_32;
success : out boolean);
end ewok.rng;
|
reznikmm/ada-pretty | Ada | 2,166 | adb | -- Copyright (c) 2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Ada_Pretty.Units is
--------------
-- Document --
--------------
overriding function Document
(Self : Compilation_Unit;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
if not Self.License.Is_Empty then
Result.New_Line;
Result.Put (Self.License);
end if;
if Self.Clauses /= null then
Result.Append (Self.Clauses.Document (Printer, Pad));
Result.New_Line;
end if;
Result.Append (Self.Root.Document (Printer, Pad));
return Result;
end Document;
--------------
-- Document --
--------------
overriding function Document
(Self : Subunit;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
Result.New_Line;
Result.Put ("separate (");
Result.Append (Self.Parent_Name.Document (Printer, Pad));
Result.Put (")");
Result.Append (Self.Proper_Body.Document (Printer, Pad));
return Result;
end Document;
--------------------------
-- New_Compilation_Unit --
--------------------------
function New_Compilation_Unit
(Root : not null Node_Access;
Clauses : Node_Access := null;
License : League.Strings.Universal_String)
return Node'Class is
begin
return Compilation_Unit'(Root, Clauses, License);
end New_Compilation_Unit;
-----------------
-- New_Subunit --
-----------------
function New_Subunit
(Parent_Name : not null Node_Access;
Proper_Body : not null Node_Access) return Node'Class is
begin
return Subunit'(Parent_Name, Proper_Body);
end New_Subunit;
end Ada_Pretty.Units;
|
DrenfongWong/tkm-rpc | Ada | 409 | ads | with Ada.Unchecked_Conversion;
package Tkmrpc.Response.Ike.Cc_Check_Ca.Convert is
function To_Response is new Ada.Unchecked_Conversion (
Source => Cc_Check_Ca.Response_Type,
Target => Response.Data_Type);
function From_Response is new Ada.Unchecked_Conversion (
Source => Response.Data_Type,
Target => Cc_Check_Ca.Response_Type);
end Tkmrpc.Response.Ike.Cc_Check_Ca.Convert;
|
persan/A-gst | Ada | 15,092 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with glib;
with System;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixer_h is
-- unsupported macro: GST_TYPE_MIXER (gst_mixer_get_type ())
-- arg-macro: function GST_MIXER (obj)
-- return GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer);
-- arg-macro: function GST_MIXER_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass);
-- arg-macro: function GST_IS_MIXER (obj)
-- return GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER);
-- arg-macro: function GST_IS_MIXER_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER);
-- arg-macro: function GST_MIXER_GET_CLASS (inst)
-- return G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass);
-- arg-macro: function GST_MIXER_TYPE (klass)
-- return klass.mixer_type;
-- GStreamer Mixer
-- * Copyright (C) 2003 Ronald Bultje <[email protected]>
-- *
-- * mixer.h: mixer interface design
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- skipped empty struct u_GstMixer
-- skipped empty struct GstMixer
type GstMixerClass;
-- type GstMixerFlags;
type u_GstMixerClass_u_gst_reserved_array is array (0 .. 2) of System.Address;
--subtype GstMixerClass is u_GstMixerClass; -- gst/interfaces/mixer.h:48
--*
-- * GstMixerType:
-- * @GST_MIXER_HARDWARE: mixing is implemented with dedicated hardware.
-- * @GST_MIXER_SOFTWARE: mixing is implemented via software processing.
-- *
-- * Mixer classification.
--
type GstMixerType is
(GST_MIXER_HARDWARE,
GST_MIXER_SOFTWARE);
pragma Convention (C, GstMixerType); -- gst/interfaces/mixer.h:61
--*
-- * GstMixerMessageType:
-- * @GST_MIXER_MESSAGE_INVALID: Not a GstMixer message
-- * @GST_MIXER_MESSAGE_MUTE_TOGGLED: A mute-toggled GstMixer message
-- * @GST_MIXER_MESSAGE_RECORD_TOGGLED: A record-toggled GstMixer message
-- * @GST_MIXER_MESSAGE_VOLUME_CHANGED: A volume-changed GstMixer message
-- * @GST_MIXER_MESSAGE_OPTION_CHANGED: An option-changed GstMixer message
-- * @GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED: An options-list-changed
-- * GstMixer message, posted when the list of available options for a
-- * GstMixerOptions object has changed (Since: 0.10.18)
-- * @GST_MIXER_MESSAGE_MIXER_CHANGED: A mixer-changed GstMixer message, posted
-- * when the list of available mixer tracks has changed. The application
-- * should re-build its interface in this case (Since: 0.10.18)
-- *
-- * An enumeration for the type of a GstMixer message received on the bus
-- *
-- * Since: 0.10.14
--
type GstMixerMessageType is
(GST_MIXER_MESSAGE_INVALID,
GST_MIXER_MESSAGE_MUTE_TOGGLED,
GST_MIXER_MESSAGE_RECORD_TOGGLED,
GST_MIXER_MESSAGE_VOLUME_CHANGED,
GST_MIXER_MESSAGE_OPTION_CHANGED,
GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
GST_MIXER_MESSAGE_MIXER_CHANGED);
pragma Convention (C, GstMixerMessageType); -- gst/interfaces/mixer.h:90
--*
-- * GstMixerFlags:
-- * @GST_MIXER_FLAG_NONE: No flags
-- * @GST_MIXER_FLAG_AUTO_NOTIFICATIONS: The mixer implementation automatically
-- * sends notification messages.
-- * @GST_MIXER_FLAG_HAS_WHITELIST: The mixer implementation flags tracks that
-- * should be displayed by default (whitelisted). Since: 0.10.23
-- * @GST_MIXER_FLAG_GROUPING: The mixer implementation will leave some controls
-- * marked without either input or output. Controls marked as input or
-- * output should be grouped with input & output sliders, even if they
-- * are options or bare switches. Since: 0.10.23
-- *
-- * Flags indicating which optional features are supported by a mixer
-- * implementation.
-- *
-- * Since: 0.10.14
--
subtype GstMixerFlags is unsigned;
GST_MIXER_FLAG_NONE : constant GstMixerFlags := 0;
GST_MIXER_FLAG_AUTO_NOTIFICATIONS : constant GstMixerFlags := 1;
GST_MIXER_FLAG_HAS_WHITELIST : constant GstMixerFlags := 2;
GST_MIXER_FLAG_GROUPING : constant GstMixerFlags := 4; -- gst/interfaces/mixer.h:115
type GstMixerClass is record
klass : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/mixer.h:118
mixer_type : aliased GstMixerType; -- gst/interfaces/mixer.h:120
list_tracks : access function (arg1 : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/interfaces/mixer.h:123
set_volume : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : access GLIB.gint); -- gst/interfaces/mixer.h:127
get_volume : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : access GLIB.gint); -- gst/interfaces/mixer.h:130
set_mute : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:134
set_record : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:137
mute_toggled : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:142
record_toggled : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : GLIB.gboolean); -- gst/interfaces/mixer.h:145
volume_changed : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
arg3 : access GLIB.gint); -- gst/interfaces/mixer.h:148
set_option : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
arg3 : access GLIB.gchar); -- gst/interfaces/mixer.h:155
get_option : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions) return access GLIB.gchar; -- gst/interfaces/mixer.h:157
option_changed : access procedure
(arg1 : System.Address;
arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
arg3 : access GLIB.gchar); -- gst/interfaces/mixer.h:162
get_mixer_flags : access function (arg1 : System.Address) return GstMixerFlags; -- gst/interfaces/mixer.h:167
u_gst_reserved : u_GstMixerClass_u_gst_reserved_array; -- gst/interfaces/mixer.h:170
end record;
pragma Convention (C_Pass_By_Copy, GstMixerClass); -- gst/interfaces/mixer.h:117
-- virtual functions
-- signals (deprecated)
--< private >
function gst_mixer_get_type return GLIB.GType; -- gst/interfaces/mixer.h:173
pragma Import (C, gst_mixer_get_type, "gst_mixer_get_type");
-- virtual class function wrappers
function gst_mixer_list_tracks (mixer : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/interfaces/mixer.h:176
pragma Import (C, gst_mixer_list_tracks, "gst_mixer_list_tracks");
procedure gst_mixer_set_volume
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
volumes : access GLIB.gint); -- gst/interfaces/mixer.h:177
pragma Import (C, gst_mixer_set_volume, "gst_mixer_set_volume");
procedure gst_mixer_get_volume
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
volumes : access GLIB.gint); -- gst/interfaces/mixer.h:180
pragma Import (C, gst_mixer_get_volume, "gst_mixer_get_volume");
procedure gst_mixer_set_mute
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
mute : GLIB.gboolean); -- gst/interfaces/mixer.h:183
pragma Import (C, gst_mixer_set_mute, "gst_mixer_set_mute");
procedure gst_mixer_set_record
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
c_record : GLIB.gboolean); -- gst/interfaces/mixer.h:186
pragma Import (C, gst_mixer_set_record, "gst_mixer_set_record");
procedure gst_mixer_set_option
(mixer : System.Address;
opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
value : access GLIB.gchar); -- gst/interfaces/mixer.h:189
pragma Import (C, gst_mixer_set_option, "gst_mixer_set_option");
function gst_mixer_get_option (mixer : System.Address; opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions) return access GLIB.gchar; -- gst/interfaces/mixer.h:192
pragma Import (C, gst_mixer_get_option, "gst_mixer_get_option");
-- trigger bus messages
procedure gst_mixer_mute_toggled
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
mute : GLIB.gboolean); -- gst/interfaces/mixer.h:196
pragma Import (C, gst_mixer_mute_toggled, "gst_mixer_mute_toggled");
procedure gst_mixer_record_toggled
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
c_record : GLIB.gboolean); -- gst/interfaces/mixer.h:199
pragma Import (C, gst_mixer_record_toggled, "gst_mixer_record_toggled");
procedure gst_mixer_volume_changed
(mixer : System.Address;
track : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixertrack_h.GstMixerTrack;
volumes : access GLIB.gint); -- gst/interfaces/mixer.h:202
pragma Import (C, gst_mixer_volume_changed, "gst_mixer_volume_changed");
procedure gst_mixer_option_changed
(mixer : System.Address;
opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions;
value : access GLIB.gchar); -- gst/interfaces/mixer.h:205
pragma Import (C, gst_mixer_option_changed, "gst_mixer_option_changed");
procedure gst_mixer_mixer_changed (mixer : System.Address); -- gst/interfaces/mixer.h:209
pragma Import (C, gst_mixer_mixer_changed, "gst_mixer_mixer_changed");
procedure gst_mixer_options_list_changed (mixer : System.Address; opts : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixeroptions_h.GstMixerOptions); -- gst/interfaces/mixer.h:211
pragma Import (C, gst_mixer_options_list_changed, "gst_mixer_options_list_changed");
function gst_mixer_get_mixer_type (mixer : System.Address) return GstMixerType; -- gst/interfaces/mixer.h:214
pragma Import (C, gst_mixer_get_mixer_type, "gst_mixer_get_mixer_type");
function gst_mixer_get_mixer_flags (mixer : System.Address) return GstMixerFlags; -- gst/interfaces/mixer.h:216
pragma Import (C, gst_mixer_get_mixer_flags, "gst_mixer_get_mixer_flags");
-- Functions for recognising and parsing GstMixerMessages on the bus
function gst_mixer_message_get_type (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage) return GstMixerMessageType; -- gst/interfaces/mixer.h:219
pragma Import (C, gst_mixer_message_get_type, "gst_mixer_message_get_type");
procedure gst_mixer_message_parse_mute_toggled
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
track : System.Address;
mute : access GLIB.gboolean); -- gst/interfaces/mixer.h:220
pragma Import (C, gst_mixer_message_parse_mute_toggled, "gst_mixer_message_parse_mute_toggled");
procedure gst_mixer_message_parse_record_toggled
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
track : System.Address;
c_record : access GLIB.gboolean); -- gst/interfaces/mixer.h:223
pragma Import (C, gst_mixer_message_parse_record_toggled, "gst_mixer_message_parse_record_toggled");
procedure gst_mixer_message_parse_volume_changed
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
track : System.Address;
volumes : System.Address;
num_channels : access GLIB.gint); -- gst/interfaces/mixer.h:226
pragma Import (C, gst_mixer_message_parse_volume_changed, "gst_mixer_message_parse_volume_changed");
procedure gst_mixer_message_parse_option_changed
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
options : System.Address;
value : System.Address); -- gst/interfaces/mixer.h:230
pragma Import (C, gst_mixer_message_parse_option_changed, "gst_mixer_message_parse_option_changed");
procedure gst_mixer_message_parse_options_list_changed (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; options : System.Address); -- gst/interfaces/mixer.h:233
pragma Import (C, gst_mixer_message_parse_options_list_changed, "gst_mixer_message_parse_options_list_changed");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_mixer_h;
|
1Crazymoney/LearnAda | Ada | 904 | adb | package body Linked_List_Pkg is
procedure Push( L : in out Linked_List; E : in Elem ) is
begin
if Is_Empty(L) then
L.back := new Vertex'(E, null);
L.front := L.back;
else
L.back.next := new Vertex'(E, null);
L.back := L.back.next;
end if;
L.size := L.size + 1;
end;
procedure Pop( L : in out Linked_List; E : out Elem ) is
begin
if Is_Empty(L) = false then
E := L.front.data;
L.front := L.front.next;
L.size := L.size - 1;
end if;
-- TODO: Exception hadling
end;
function Is_Empty( L : Linked_List ) return Boolean is
begin
return L.size = 0;
end;
function Size( L : Linked_List ) return Natural is
begin
return L.size;
end;
end Linked_List_Pkg;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 85,127 | ads | -- This spec has been automatically generated from STM32F030.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.TIM is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_CEN_Field is STM32_SVD.Bit;
subtype CR1_UDIS_Field is STM32_SVD.Bit;
subtype CR1_URS_Field is STM32_SVD.Bit;
subtype CR1_OPM_Field is STM32_SVD.Bit;
subtype CR1_DIR_Field is STM32_SVD.Bit;
subtype CR1_CMS_Field is STM32_SVD.UInt2;
subtype CR1_ARPE_Field is STM32_SVD.Bit;
subtype CR1_CKD_Field is STM32_SVD.UInt2;
-- control register 1
type CR1_Register is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- One-pulse mode
OPM : CR1_OPM_Field := 16#0#;
-- Direction
DIR : CR1_DIR_Field := 16#0#;
-- Center-aligned mode selection
CMS : CR1_CMS_Field := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- Clock division
CKD : CR1_CKD_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 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_CCPC_Field is STM32_SVD.Bit;
subtype CR2_CCUS_Field is STM32_SVD.Bit;
subtype CR2_CCDS_Field is STM32_SVD.Bit;
subtype CR2_MMS_Field is STM32_SVD.UInt3;
subtype CR2_TI1S_Field is STM32_SVD.Bit;
subtype CR2_OIS1_Field is STM32_SVD.Bit;
subtype CR2_OIS1N_Field is STM32_SVD.Bit;
subtype CR2_OIS2_Field is STM32_SVD.Bit;
subtype CR2_OIS2N_Field is STM32_SVD.Bit;
subtype CR2_OIS3_Field is STM32_SVD.Bit;
subtype CR2_OIS3N_Field is STM32_SVD.Bit;
subtype CR2_OIS4_Field is STM32_SVD.Bit;
-- control register 2
type CR2_Register is record
-- Capture/compare preloaded control
CCPC : CR2_CCPC_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : CR2_CCUS_Field := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- TI1 selection
TI1S : CR2_TI1S_Field := 16#0#;
-- Output Idle state 1
OIS1 : CR2_OIS1_Field := 16#0#;
-- Output Idle state 1
OIS1N : CR2_OIS1N_Field := 16#0#;
-- Output Idle state 2
OIS2 : CR2_OIS2_Field := 16#0#;
-- Output Idle state 2
OIS2N : CR2_OIS2N_Field := 16#0#;
-- Output Idle state 3
OIS3 : CR2_OIS3_Field := 16#0#;
-- Output Idle state 3
OIS3N : CR2_OIS3N_Field := 16#0#;
-- Output Idle state 4
OIS4 : CR2_OIS4_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.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 STM32_SVD.UInt3;
subtype SMCR_TS_Field is STM32_SVD.UInt3;
subtype SMCR_MSM_Field is STM32_SVD.Bit;
subtype SMCR_ETF_Field is STM32_SVD.UInt4;
subtype SMCR_ETPS_Field is STM32_SVD.UInt2;
subtype SMCR_ECE_Field is STM32_SVD.Bit;
subtype SMCR_ETP_Field is STM32_SVD.Bit;
-- slave mode control register
type SMCR_Register is record
-- Slave mode selection
SMS : SMCR_SMS_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Trigger selection
TS : SMCR_TS_Field := 16#0#;
-- Master/Slave mode
MSM : SMCR_MSM_Field := 16#0#;
-- External trigger filter
ETF : SMCR_ETF_Field := 16#0#;
-- External trigger prescaler
ETPS : SMCR_ETPS_Field := 16#0#;
-- External clock enable
ECE : SMCR_ECE_Field := 16#0#;
-- External trigger polarity
ETP : SMCR_ETP_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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;
subtype DIER_UIE_Field is STM32_SVD.Bit;
subtype DIER_CC1IE_Field is STM32_SVD.Bit;
subtype DIER_CC2IE_Field is STM32_SVD.Bit;
subtype DIER_CC3IE_Field is STM32_SVD.Bit;
subtype DIER_CC4IE_Field is STM32_SVD.Bit;
subtype DIER_COMIE_Field is STM32_SVD.Bit;
subtype DIER_TIE_Field is STM32_SVD.Bit;
subtype DIER_BIE_Field is STM32_SVD.Bit;
subtype DIER_UDE_Field is STM32_SVD.Bit;
subtype DIER_CC1DE_Field is STM32_SVD.Bit;
subtype DIER_CC2DE_Field is STM32_SVD.Bit;
subtype DIER_CC3DE_Field is STM32_SVD.Bit;
subtype DIER_CC4DE_Field is STM32_SVD.Bit;
subtype DIER_COMDE_Field is STM32_SVD.Bit;
subtype DIER_TDE_Field is STM32_SVD.Bit;
-- DMA/Interrupt enable register
type DIER_Register is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- Capture/Compare 2 interrupt enable
CC2IE : DIER_CC2IE_Field := 16#0#;
-- Capture/Compare 3 interrupt enable
CC3IE : DIER_CC3IE_Field := 16#0#;
-- Capture/Compare 4 interrupt enable
CC4IE : DIER_CC4IE_Field := 16#0#;
-- COM interrupt enable
COMIE : DIER_COMIE_Field := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- Break interrupt enable
BIE : DIER_BIE_Field := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- Capture/Compare 2 DMA request enable
CC2DE : DIER_CC2DE_Field := 16#0#;
-- Capture/Compare 3 DMA request enable
CC3DE : DIER_CC3DE_Field := 16#0#;
-- Capture/Compare 4 DMA request enable
CC4DE : DIER_CC4DE_Field := 16#0#;
-- Reserved
COMDE : DIER_COMDE_Field := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.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;
subtype SR_UIF_Field is STM32_SVD.Bit;
subtype SR_CC1IF_Field is STM32_SVD.Bit;
subtype SR_CC2IF_Field is STM32_SVD.Bit;
subtype SR_CC3IF_Field is STM32_SVD.Bit;
subtype SR_CC4IF_Field is STM32_SVD.Bit;
subtype SR_COMIF_Field is STM32_SVD.Bit;
subtype SR_TIF_Field is STM32_SVD.Bit;
subtype SR_BIF_Field is STM32_SVD.Bit;
subtype SR_CC1OF_Field is STM32_SVD.Bit;
subtype SR_CC2OF_Field is STM32_SVD.Bit;
subtype SR_CC3OF_Field is STM32_SVD.Bit;
subtype SR_CC4OF_Field is STM32_SVD.Bit;
-- status register
type SR_Register is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- Capture/Compare 2 interrupt flag
CC2IF : SR_CC2IF_Field := 16#0#;
-- Capture/Compare 3 interrupt flag
CC3IF : SR_CC3IF_Field := 16#0#;
-- Capture/Compare 4 interrupt flag
CC4IF : SR_CC4IF_Field := 16#0#;
-- COM interrupt flag
COMIF : SR_COMIF_Field := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- Break interrupt flag
BIF : SR_BIF_Field := 16#0#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- Capture/compare 2 overcapture flag
CC2OF : SR_CC2OF_Field := 16#0#;
-- Capture/Compare 3 overcapture flag
CC3OF : SR_CC3OF_Field := 16#0#;
-- Capture/Compare 4 overcapture flag
CC4OF : SR_CC4OF_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.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;
subtype EGR_UG_Field is STM32_SVD.Bit;
subtype EGR_CC1G_Field is STM32_SVD.Bit;
subtype EGR_CC2G_Field is STM32_SVD.Bit;
subtype EGR_CC3G_Field is STM32_SVD.Bit;
subtype EGR_CC4G_Field is STM32_SVD.Bit;
subtype EGR_COMG_Field is STM32_SVD.Bit;
subtype EGR_TG_Field is STM32_SVD.Bit;
subtype EGR_BG_Field is STM32_SVD.Bit;
-- event generation register
type EGR_Register is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- Write-only. Capture/compare 2 generation
CC2G : EGR_CC2G_Field := 16#0#;
-- Write-only. Capture/compare 3 generation
CC3G : EGR_CC3G_Field := 16#0#;
-- Write-only. Capture/compare 4 generation
CC4G : EGR_CC4G_Field := 16#0#;
-- Write-only. Capture/Compare control update generation
COMG : EGR_COMG_Field := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- Write-only. Break generation
BG : EGR_BG_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 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 STM32_SVD.UInt2;
subtype CCMR1_Output_OC1FE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC1PE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC1M_Field is STM32_SVD.UInt3;
subtype CCMR1_Output_OC1CE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_CC2S_Field is STM32_SVD.UInt2;
subtype CCMR1_Output_OC2FE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC2PE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC2M_Field is STM32_SVD.UInt3;
subtype CCMR1_Output_OC2CE_Field is STM32_SVD.Bit;
-- capture/compare mode register (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 : CCMR1_Output_OC1FE_Field := 16#0#;
-- Output Compare 1 preload enable
OC1PE : CCMR1_Output_OC1PE_Field := 16#0#;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- Output Compare 1 clear enable
OC1CE : CCMR1_Output_OC1CE_Field := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Output_CC2S_Field := 16#0#;
-- Output Compare 2 fast enable
OC2FE : CCMR1_Output_OC2FE_Field := 16#0#;
-- Output Compare 2 preload enable
OC2PE : CCMR1_Output_OC2PE_Field := 16#0#;
-- Output Compare 2 mode
OC2M : CCMR1_Output_OC2M_Field := 16#0#;
-- Output Compare 2 clear enable
OC2CE : CCMR1_Output_OC2CE_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt2;
subtype CCMR1_Input_IC1PCS_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC1F_Field is STM32_SVD.UInt4;
subtype CCMR1_Input_CC2S_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC2PCS_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC2F_Field is STM32_SVD.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
IC1PCS : CCMR1_Input_IC1PCS_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 : STM32_SVD.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;
IC1PCS 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 STM32_SVD.UInt2;
subtype CCMR2_Output_OC3FE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC3PE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC3M_Field is STM32_SVD.UInt3;
subtype CCMR2_Output_OC3CE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_CC4S_Field is STM32_SVD.UInt2;
subtype CCMR2_Output_OC4FE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC4PE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC4M_Field is STM32_SVD.UInt3;
subtype CCMR2_Output_OC4CE_Field is STM32_SVD.Bit;
-- capture/compare mode register (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 : CCMR2_Output_OC3FE_Field := 16#0#;
-- Output compare 3 preload enable
OC3PE : CCMR2_Output_OC3PE_Field := 16#0#;
-- Output compare 3 mode
OC3M : CCMR2_Output_OC3M_Field := 16#0#;
-- Output compare 3 clear enable
OC3CE : CCMR2_Output_OC3CE_Field := 16#0#;
-- Capture/Compare 4 selection
CC4S : CCMR2_Output_CC4S_Field := 16#0#;
-- Output compare 4 fast enable
OC4FE : CCMR2_Output_OC4FE_Field := 16#0#;
-- Output compare 4 preload enable
OC4PE : CCMR2_Output_OC4PE_Field := 16#0#;
-- Output compare 4 mode
OC4M : CCMR2_Output_OC4M_Field := 16#0#;
-- Output compare 4 clear enable
OC4CE : CCMR2_Output_OC4CE_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt2;
subtype CCMR2_Input_IC3PSC_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC3F_Field is STM32_SVD.UInt4;
subtype CCMR2_Input_CC4S_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC4PSC_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC4F_Field is STM32_SVD.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 : STM32_SVD.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;
subtype CCER_CC1E_Field is STM32_SVD.Bit;
subtype CCER_CC1P_Field is STM32_SVD.Bit;
subtype CCER_CC1NE_Field is STM32_SVD.Bit;
subtype CCER_CC1NP_Field is STM32_SVD.Bit;
subtype CCER_CC2E_Field is STM32_SVD.Bit;
subtype CCER_CC2P_Field is STM32_SVD.Bit;
subtype CCER_CC2NE_Field is STM32_SVD.Bit;
subtype CCER_CC2NP_Field is STM32_SVD.Bit;
subtype CCER_CC3E_Field is STM32_SVD.Bit;
subtype CCER_CC3P_Field is STM32_SVD.Bit;
subtype CCER_CC3NE_Field is STM32_SVD.Bit;
subtype CCER_CC3NP_Field is STM32_SVD.Bit;
subtype CCER_CC4E_Field is STM32_SVD.Bit;
subtype CCER_CC4P_Field is STM32_SVD.Bit;
-- capture/compare enable register
type CCER_Register is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- Capture/Compare 1 complementary output enable
CC1NE : CCER_CC1NE_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- Capture/Compare 2 output enable
CC2E : CCER_CC2E_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2P : CCER_CC2P_Field := 16#0#;
-- Capture/Compare 2 complementary output enable
CC2NE : CCER_CC2NE_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : CCER_CC2NP_Field := 16#0#;
-- Capture/Compare 3 output enable
CC3E : CCER_CC3E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC3P : CCER_CC3P_Field := 16#0#;
-- Capture/Compare 3 complementary output enable
CC3NE : CCER_CC3NE_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC3NP : CCER_CC3NP_Field := 16#0#;
-- Capture/Compare 4 output enable
CC4E : CCER_CC4E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC4P : CCER_CC4P_Field := 16#0#;
-- unspecified
Reserved_14_31 : STM32_SVD.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 STM32_SVD.UInt16;
-- counter
type CNT_Register is record
-- counter value
CNT : CNT_CNT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt16;
-- prescaler
type PSC_Register is record
-- Prescaler value
PSC : PSC_PSC_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt16;
-- auto-reload register
type ARR_Register is record
-- Auto-reload value
ARR : ARR_ARR_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.Byte;
-- repetition counter register
type RCR_Register is record
-- Repetition counter value
REP : RCR_REP_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 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 STM32_SVD.UInt16;
-- capture/compare register 1
type CCR1_Register is record
-- Capture/Compare 1 value
CCR1 : CCR1_CCR1_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt16;
-- capture/compare register 2
type CCR2_Register is record
-- Capture/Compare 2 value
CCR2 : CCR2_CCR2_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt16;
-- capture/compare register 3
type CCR3_Register is record
-- Capture/Compare 3 value
CCR3 : CCR3_CCR3_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt16;
-- capture/compare register 4
type CCR4_Register is record
-- Capture/Compare 3 value
CCR4 : CCR4_CCR4_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.Byte;
subtype BDTR_LOCK_Field is STM32_SVD.UInt2;
subtype BDTR_OSSI_Field is STM32_SVD.Bit;
subtype BDTR_OSSR_Field is STM32_SVD.Bit;
subtype BDTR_BKE_Field is STM32_SVD.Bit;
subtype BDTR_BKP_Field is STM32_SVD.Bit;
subtype BDTR_AOE_Field is STM32_SVD.Bit;
subtype BDTR_MOE_Field is STM32_SVD.Bit;
-- 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 : BDTR_OSSI_Field := 16#0#;
-- Off-state selection for Run mode
OSSR : BDTR_OSSR_Field := 16#0#;
-- Break enable
BKE : BDTR_BKE_Field := 16#0#;
-- Break polarity
BKP : BDTR_BKP_Field := 16#0#;
-- Automatic output enable
AOE : BDTR_AOE_Field := 16#0#;
-- Main output enable
MOE : BDTR_MOE_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt5;
subtype DCR_DBL_Field is STM32_SVD.UInt5;
-- DMA control register
type DCR_Register is record
-- DMA base address
DBA : DCR_DBA_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- DMA burst length
DBL : DCR_DBL_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.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 STM32_SVD.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 : STM32_SVD.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 : STM32_SVD.UInt3 := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- TI1 selection
TI1S : CR2_TI1S_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 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 : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- Capture/Compare 2 interrupt enable
CC2IE : DIER_CC2IE_Field := 16#0#;
-- Capture/Compare 3 interrupt enable
CC3IE : DIER_CC3IE_Field := 16#0#;
-- Capture/Compare 4 interrupt enable
CC4IE : DIER_CC4IE_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- Capture/Compare 2 DMA request enable
CC2DE : DIER_CC2DE_Field := 16#0#;
-- Capture/Compare 3 DMA request enable
CC3DE : DIER_CC3DE_Field := 16#0#;
-- Capture/Compare 4 DMA request enable
CC4DE : DIER_CC4DE_Field := 16#0#;
-- Reserved
COMDE : DIER_COMDE_Field := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.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;
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_1 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- Capture/Compare 2 interrupt flag
CC2IF : SR_CC2IF_Field := 16#0#;
-- Capture/Compare 3 interrupt flag
CC3IF : SR_CC3IF_Field := 16#0#;
-- Capture/Compare 4 interrupt flag
CC4IF : SR_CC4IF_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- unspecified
Reserved_7_8 : STM32_SVD.UInt2 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- Capture/compare 2 overcapture flag
CC2OF : SR_CC2OF_Field := 16#0#;
-- Capture/Compare 3 overcapture flag
CC3OF : SR_CC3OF_Field := 16#0#;
-- Capture/Compare 4 overcapture flag
CC4OF : SR_CC4OF_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.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 : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- Write-only. Capture/compare 2 generation
CC2G : EGR_CC2G_Field := 16#0#;
-- Write-only. Capture/compare 3 generation
CC3G : EGR_CC3G_Field := 16#0#;
-- Write-only. Capture/compare 4 generation
CC4G : EGR_CC4G_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.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;
subtype CCMR1_Input_IC1PSC_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC2PSC_Field is STM32_SVD.UInt2;
-- 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
IC1PSC : CCMR1_Input_IC1PSC_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
IC2PSC : CCMR1_Input_IC2PSC_Field := 16#0#;
-- Input capture 2 filter
IC2F : CCMR1_Input_IC2F_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 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;
IC1PSC at 0 range 2 .. 3;
IC1F at 0 range 4 .. 7;
CC2S at 0 range 8 .. 9;
IC2PSC at 0 range 10 .. 11;
IC2F at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCER_CC4NP_Field is STM32_SVD.Bit;
-- capture/compare enable register
type CCER_Register_1 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- unspecified
Reserved_2_2 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- Capture/Compare 2 output enable
CC2E : CCER_CC2E_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2P : CCER_CC2P_Field := 16#0#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : CCER_CC2NP_Field := 16#0#;
-- Capture/Compare 3 output enable
CC3E : CCER_CC3E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC3P : CCER_CC3P_Field := 16#0#;
-- unspecified
Reserved_10_10 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 3 output Polarity
CC3NP : CCER_CC3NP_Field := 16#0#;
-- Capture/Compare 4 output enable
CC4E : CCER_CC4E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC4P : CCER_CC4P_Field := 16#0#;
-- unspecified
Reserved_14_14 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 4 output Polarity
CC4NP : CCER_CC4NP_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.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 STM32_SVD.UInt16;
subtype CNT_CNT_H_Field is STM32_SVD.UInt16;
-- counter
type CNT_Register_1 is record
-- Low counter value
CNT_L : CNT_CNT_L_Field := 16#0#;
-- High counter value (TIM2 only)
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 STM32_SVD.UInt16;
subtype ARR_ARR_H_Field is STM32_SVD.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 (TIM2 only)
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 STM32_SVD.UInt16;
subtype CCR1_CCR1_H_Field is STM32_SVD.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 (TIM2 only)
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 STM32_SVD.UInt16;
subtype CCR2_CCR2_H_Field is STM32_SVD.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 (TIM2 only)
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 STM32_SVD.UInt16;
subtype CCR3_CCR3_H_Field is STM32_SVD.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 (TIM2 only)
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 STM32_SVD.UInt16;
subtype CCR4_CCR4_H_Field is STM32_SVD.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 (TIM2 only)
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 DMAR_DMAR_Field is STM32_SVD.UInt16;
-- DMA address for full transfer
type DMAR_Register_1 is record
-- DMA register for burst accesses
DMAR : DMAR_DMAR_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DMAR_Register_1 use record
DMAR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register 1
type CR1_Register_1 is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- One-pulse mode
OPM : CR1_OPM_Field := 16#0#;
-- unspecified
Reserved_4_6 : STM32_SVD.UInt3 := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_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 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 : STM32_SVD.UInt4 := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.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 : DIER_UIE_Field := 16#0#;
-- unspecified
Reserved_1_7 : STM32_SVD.UInt7 := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- unspecified
Reserved_9_31 : STM32_SVD.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 : SR_UIF_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_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 : EGR_UG_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 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 : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- unspecified
Reserved_3_6 : STM32_SVD.UInt4 := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- Clock division
CKD : CR1_CKD_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 CR1_Register_2 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_3 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 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;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- status register
type SR_Register_3 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- unspecified
Reserved_2_8 : STM32_SVD.UInt7 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_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 SR_Register_3 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_3 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 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;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- capture/compare mode register (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 : CCMR1_Output_OC1FE_Field := 16#0#;
-- Output Compare 1 preload enable
OC1PE : CCMR1_Output_OC1PE_Field := 16#0#;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.UInt25 := 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_31 at 0 range 7 .. 31;
end record;
-- capture/compare mode register (input mode)
type CCMR1_Input_Register_2 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
IC1PSC : CCMR1_Input_IC1PSC_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_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 CCMR1_Input_Register_2 use record
CC1S at 0 range 0 .. 1;
IC1PSC 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_2 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- unspecified
Reserved_2_2 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- unspecified
Reserved_4_31 : STM32_SVD.UInt28 := 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;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype OR_RMP_Field is STM32_SVD.UInt2;
-- option register
type OR_Register is record
-- Timer input 1 remap
RMP : OR_RMP_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register use record
RMP at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- control register 1
type CR1_Register_3 is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- One-pulse mode
OPM : CR1_OPM_Field := 16#0#;
-- unspecified
Reserved_4_6 : STM32_SVD.UInt3 := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- Clock division
CKD : CR1_CKD_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 CR1_Register_3 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;
-- control register 2
type CR2_Register_3 is record
-- Capture/compare preloaded control
CCPC : CR2_CCPC_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : CR2_CCUS_Field := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Output Idle state 1
OIS1 : CR2_OIS1_Field := 16#0#;
-- Output Idle state 1
OIS1N : CR2_OIS1N_Field := 16#0#;
-- Output Idle state 2
OIS2 : CR2_OIS2_Field := 16#0#;
-- unspecified
Reserved_11_31 : STM32_SVD.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_3 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;
Reserved_7_7 at 0 range 7 .. 7;
OIS1 at 0 range 8 .. 8;
OIS1N at 0 range 9 .. 9;
OIS2 at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 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 : STM32_SVD.Bit := 16#0#;
-- Trigger selection
TS : SMCR_TS_Field := 16#0#;
-- Master/Slave mode
MSM : SMCR_MSM_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 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_4 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- Capture/Compare 2 interrupt enable
CC2IE : DIER_CC2IE_Field := 16#0#;
-- unspecified
Reserved_3_4 : STM32_SVD.UInt2 := 16#0#;
-- COM interrupt enable
COMIE : DIER_COMIE_Field := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- Break interrupt enable
BIE : DIER_BIE_Field := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- Capture/Compare 2 DMA request enable
CC2DE : DIER_CC2DE_Field := 16#0#;
-- unspecified
Reserved_11_13 : STM32_SVD.UInt3 := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 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;
CC2IE at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 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;
Reserved_11_13 at 0 range 11 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register_4 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- Capture/Compare 2 interrupt flag
CC2IF : SR_CC2IF_Field := 16#0#;
-- unspecified
Reserved_3_4 : STM32_SVD.UInt2 := 16#0#;
-- COM interrupt flag
COMIF : SR_COMIF_Field := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- Break interrupt flag
BIF : SR_BIF_Field := 16#0#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- Capture/compare 2 overcapture flag
CC2OF : SR_CC2OF_Field := 16#0#;
-- unspecified
Reserved_11_31 : STM32_SVD.UInt21 := 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;
CC2IF at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 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;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-- event generation register
type EGR_Register_4 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- Write-only. Capture/compare 2 generation
CC2G : EGR_CC2G_Field := 16#0#;
-- unspecified
Reserved_3_4 : STM32_SVD.UInt2 := 16#0#;
-- Write-only. Capture/Compare control update generation
COMG : EGR_COMG_Field := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- Write-only. Break generation
BG : EGR_BG_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 EGR_Register_4 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 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;
-- capture/compare mode register (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 : CCMR1_Output_OC1FE_Field := 16#0#;
-- Output Compare 1 preload enable
OC1PE : CCMR1_Output_OC1PE_Field := 16#0#;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Output_CC2S_Field := 16#0#;
-- Output Compare 2 fast enable
OC2FE : CCMR1_Output_OC2FE_Field := 16#0#;
-- Output Compare 2 preload enable
OC2PE : CCMR1_Output_OC2PE_Field := 16#0#;
-- Output Compare 2 mode
OC2M : CCMR1_Output_OC2M_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 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_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;
-- capture/compare enable register
type CCER_Register_3 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- Capture/Compare 1 complementary output enable
CC1NE : CCER_CC1NE_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- Capture/Compare 2 output enable
CC2E : CCER_CC2E_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2P : CCER_CC2P_Field := 16#0#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : CCER_CC2NP_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 CCER_Register_3 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;
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 2
type CR2_Register_4 is record
-- Capture/compare preloaded control
CCPC : CR2_CCPC_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : CR2_CCUS_Field := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- unspecified
Reserved_4_7 : STM32_SVD.UInt4 := 16#0#;
-- Output Idle state 1
OIS1 : CR2_OIS1_Field := 16#0#;
-- Output Idle state 1
OIS1N : CR2_OIS1N_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 CR2_Register_4 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;
Reserved_4_7 at 0 range 4 .. 7;
OIS1 at 0 range 8 .. 8;
OIS1N at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_5 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- COM interrupt enable
COMIE : DIER_COMIE_Field := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- Break interrupt enable
BIE : DIER_BIE_Field := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- unspecified
Reserved_10_13 : STM32_SVD.UInt4 := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_5 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 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;
Reserved_10_13 at 0 range 10 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register_5 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- COM interrupt flag
COMIF : SR_COMIF_Field := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- Break interrupt flag
BIF : SR_BIF_Field := 16#0#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_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 SR_Register_5 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 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;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- event generation register
type EGR_Register_5 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- Write-only. Capture/Compare control update generation
COMG : EGR_COMG_Field := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- Write-only. Break generation
BG : EGR_BG_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 EGR_Register_5 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 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;
-- capture/compare enable register
type CCER_Register_4 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- Capture/Compare 1 complementary output enable
CC1NE : CCER_CC1NE_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- unspecified
Reserved_4_31 : STM32_SVD.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_4 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;
Reserved_4_31 at 0 range 4 .. 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 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register (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#40012C00#);
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_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;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_1;
-- 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#);
-- 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#);
type TIM14_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM14_Peripheral
(Discriminent : TIM14_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_2;
-- 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;
-- option register
OR_k : aliased OR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_1;
when Input =>
-- capture/compare mode register (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_2;
end case;
end record
with Unchecked_Union, Volatile;
for TIM14_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
TIM14_Periph : aliased TIM14_Peripheral
with Import, Address => System'To_Address (16#40002000#);
type TIM15_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM15_Peripheral
(Discriminent : TIM15_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_3;
-- control register 2
CR2 : aliased CR2_Register_3;
-- slave mode control register
SMCR : aliased SMCR_Register_1;
-- 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;
-- repetition counter register
RCR : aliased RCR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- capture/compare register 2
CCR2 : aliased CCR2_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 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_2;
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 TIM15_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;
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;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM15_Periph : aliased TIM15_Peripheral
with Import, Address => System'To_Address (16#40014000#);
type TIM16_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM_Peripheral
(Discriminent : TIM16_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_3;
-- control register 2
CR2 : aliased CR2_Register_4;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_5;
-- status register
SR : aliased SR_Register_5;
-- event generation register
EGR : aliased EGR_Register_5;
-- capture/compare enable register
CCER : aliased CCER_Register_4;
-- 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;
-- 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 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_1;
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 TIM_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;
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;
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;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM16_Periph : aliased TIM_Peripheral
with Import, Address => System'To_Address (16#40014400#);
-- General-purpose-timers
TIM17_Periph : aliased TIM_Peripheral
with Import, Address => System'To_Address (16#40014800#);
end STM32_SVD.TIM;
|
Rodeo-McCabe/orka | Ada | 9,858 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[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 GL.Objects.Buffers;
with GL.Types.Indirect;
with Orka.Types;
package Orka.Rendering.Buffers is
pragma Preelaborate;
subtype Storage_Bits is GL.Objects.Buffers.Storage_Bits;
use GL.Types;
use all type Orka.Types.Element_Type;
-----------------------------------------------------------------------------
type Bindable_Buffer is interface;
type Indexed_Buffer_Target is (Atomic_Counter, Shader_Storage, Uniform);
-- Buffer targets that can be read/written in shaders
type Buffer_Target is
(Index, Dispatch_Indirect, Draw_Indirect, Parameter, Pixel_Pack, Pixel_Unpack, Query);
procedure Bind
(Object : Bindable_Buffer;
Target : Indexed_Buffer_Target;
Index : Natural) is abstract;
-- Bind the buffer object to the binding point at the given index of
-- the target
procedure Bind
(Object : Bindable_Buffer;
Target : Buffer_Target) is abstract;
-- Bind the buffer object to the target
function Length (Object : Bindable_Buffer) return Natural is abstract;
-----------------------------------------------------------------------------
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with private;
function Create_Buffer
(Flags : Storage_Bits;
Kind : Types.Element_Type;
Length : Natural) return Buffer;
-----------------------------------------------------------------------------
function Create_Buffer
(Flags : Storage_Bits;
Data : Half_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Single_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Double_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Int_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : UInt_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Singles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Vector4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Orka.Types.Doubles.Matrix4_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Arrays_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Elements_Indirect_Command_Array) return Buffer;
function Create_Buffer
(Flags : Storage_Bits;
Data : Indirect.Dispatch_Indirect_Command_Array) return Buffer;
-----------------------------------------------------------------------------
function GL_Buffer (Object : Buffer) return GL.Objects.Buffers.Buffer
with Inline;
overriding
function Length (Object : Buffer) return Natural
with Inline;
overriding
procedure Bind (Object : Buffer; Target : Indexed_Buffer_Target; Index : Natural);
-- Bind the buffer object to the binding point at the given index of
-- the target
overriding
procedure Bind (Object : Buffer; Target : Buffer_Target);
-- Bind the buffer object to the target
-----------------------------------------------------------------------------
procedure Set_Data
(Object : Buffer;
Data : Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Arrays_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Arrays_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Elements_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Elements_Command_Type and Offset + Data'Length <= Object.Length;
procedure Set_Data
(Object : Buffer;
Data : Indirect.Dispatch_Indirect_Command_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Dispatch_Command_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Half_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Half_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Single_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Double_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Int_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Int_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out UInt_Array;
Offset : Natural := 0)
with Pre => Object.Kind = UInt_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Singles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Single_Matrix_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Vector4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Vector_Type and Offset + Data'Length <= Object.Length;
procedure Get_Data
(Object : Buffer;
Data : in out Orka.Types.Doubles.Matrix4_Array;
Offset : Natural := 0)
with Pre => Object.Kind = Double_Matrix_Type and Offset + Data'Length <= Object.Length;
-----------------------------------------------------------------------------
procedure Clear_Data
(Object : Buffer;
Data : Int_Array)
with Pre => Object.Kind = Int_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : UInt_Array)
with Pre => Object.Kind = UInt_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Single_Array)
with Pre => Object.Kind = Single_Type
and Data'Length in 1 .. 4
and Object.Length mod Data'Length = 0;
procedure Clear_Data
(Object : Buffer;
Data : Orka.Types.Singles.Vector4)
with Pre => Object.Kind = Single_Vector_Type
or else (Object.Kind = Single_Type and Object.Length mod 4 = 0);
-----------------------------------------------------------------------------
procedure Copy_Data
(Object : Buffer;
Target : Buffer)
with Pre => Object.Kind = Target.Kind and then Object.Length = Target.Length;
private
type Buffer (Kind : Types.Element_Type) is new Bindable_Buffer with record
Buffer : GL.Objects.Buffers.Buffer;
Length : Natural;
end record;
end Orka.Rendering.Buffers;
|
zhmu/ananas | Ada | 6,246 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 7 7 --
-- --
-- B o d y --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_77 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_77;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
------------
-- Get_77 --
------------
function Get_77
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_77
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_77;
------------
-- Set_77 --
------------
procedure Set_77
(Arr : System.Address;
N : Natural;
E : Bits_77;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_77;
end System.Pack_77;
|
reznikmm/matreshka | Ada | 3,603 | 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.Elements.Generic_Hash;
function AMF.UML.Extensions.Hash is
new AMF.Elements.Generic_Hash (UML_Extension, UML_Extension_Access);
|
skordal/cupcake | Ada | 4,136 | ads | -- The Cupcake GUI Toolkit
-- (c) Kristian Klomsten Skordal 2012 <[email protected]>
-- Report bugs and issues on <http://github.com/skordal/cupcake/issues>
-- vim:ts=3:sw=3:et:si:sta
with Ada.Numerics;
with System;
with Cupcake.Colors;
with Cupcake.Primitives;
package Cupcake.Backends is
use Ada.Numerics;
-- Interface implemented by backends:
type Backend is limited interface;
type Backend_Access is access all Backend'Class;
-- Backend exceptions:
Initialization_Error : exception;
-- Gets and sets the backend to be used for operations:
function Get_Backend return Backend_Access with Inline, Pure_Function;
procedure Set_Backend (Use_Backend : in Backend_Access) with Inline;
---- GENERAL BACKEND OPERATIONS: ----
-- Gets the name of the backend:
function Get_Name (This : in Backend) return String is abstract;
-- Initializes the backend:
procedure Initialize (This : in out Backend) is abstract;
-- Checks if the backend has been initialized:
function Is_Initialized (This : in Backend) return Boolean is abstract;
-- Finalizes the backend:
procedure Finalize (This : in out Backend) is abstract;
-- Enters the main loop:
procedure Enter_Main_Loop (This : in out Backend) is abstract;
-- Exits the main loop:
procedure Exit_Main_Loop (This : in out Backend) is abstract;
---- BACKEND WINDOW OPERATIONS: ----
-- Backend window type:
type Window_Data_Pointer is new System.Address;
Null_Window_Data_Pointer : constant Window_Data_Pointer
:= Window_Data_Pointer (System.Null_Address);
-- Type used for window IDs:
type Window_ID_Type is mod 2**32;
for Window_ID_Type'Size use 32;
-- Creates a new window:
function New_Window (This : in Backend;
Title : in String;
Size : in Primitives.Dimension;
Position : in Primitives.Point := (0, 0);
Parent : in Window_Data_Pointer := Null_Window_Data_Pointer)
return Window_Data_Pointer is abstract;
-- Destroys a window:
procedure Destroy_Window (This : in out Backend;
Window_Data : in out Window_Data_Pointer)
is abstract;
-- Gets the ID of a window:
function Get_Window_ID (This : in Backend;
Window_Data : in Window_Data_Pointer)
return Window_ID_Type is abstract;
-- Sets the title of a window:
procedure Set_Window_Title (This : in Backend;
Window_Data : in Window_Data_Pointer;
Title : in String) is abstract;
-- Sets the size of a window:
procedure Set_Window_Size (This : in Backend;
Window_Data : in Window_Data_Pointer;
Size : in Primitives.Dimension) is abstract;
-- Sets the window visibility on screen:
procedure Set_Window_Visibility (This : in Backend;
Window_Data : in Window_Data_Pointer;
Visibility : in Boolean) is abstract;
---- WINDOW DRAWING OPERATIONS: ----
-- Draws a straight line between two points:
procedure Draw_Line (This : in out Backend;
Window_Data : in Window_Data_Pointer;
Origin, Destination : in Primitives.Point;
Color : in Colors.Color := Colors.BLACK;
Line_Width : in Float := 1.0) is abstract;
-- Draws a circle with specified centre and radius; draws the circle
-- between 0 and the specified amount of radians. This value can be
-- negative, in which case the circle will be drawn counter-clockwise:
procedure Draw_Circle (This : in out Backend;
Window_Data : in Window_Data_Pointer;
Origin : in Primitives.Point;
Radius : in Float; Arc : in Float := 2.0 * Pi;
Color : in Colors.Color := Colors.BLACK;
Line_Width : in Float := 1.0) is abstract;
-- Fills the specified area with the specified color:
procedure Fill_Area (This : in out Backend;
Window_Data : in Window_Data_Pointer;
Area : in Primitives.Rectangle;
Color : in Colors.Color) is abstract;
---- FONT OPERATIONS: ----
-- Backend font type:
type Font_Data_Pointer is new System.Address;
private
-- The active backend:
Active_Backend : Backend_Access := null;
end Cupcake.Backends;
|
OhYea777/Minix | Ada | 4,328 | ads | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-streams.ads,v 1.1 2005/09/23 22:39:01 beng Exp $
package ZLib.Streams is
type Stream_Mode is (In_Stream, Out_Stream, Duplex);
type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
type Stream_Type is
new Ada.Streams.Root_Stream_Type with private;
procedure Read
(Stream : in out Stream_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
procedure Write
(Stream : in out Stream_Type;
Item : in Ada.Streams.Stream_Element_Array);
procedure Flush
(Stream : in out Stream_Type;
Mode : in Flush_Mode := Sync_Flush);
-- Flush the written data to the back stream,
-- all data placed to the compressor is flushing to the Back stream.
-- Should not be used untill necessary, becouse it is decreasing
-- compression.
function Read_Total_In (Stream : in Stream_Type) return Count;
pragma Inline (Read_Total_In);
-- Return total number of bytes read from back stream so far.
function Read_Total_Out (Stream : in Stream_Type) return Count;
pragma Inline (Read_Total_Out);
-- Return total number of bytes read so far.
function Write_Total_In (Stream : in Stream_Type) return Count;
pragma Inline (Write_Total_In);
-- Return total number of bytes written so far.
function Write_Total_Out (Stream : in Stream_Type) return Count;
pragma Inline (Write_Total_Out);
-- Return total number of bytes written to the back stream.
procedure Create
(Stream : out Stream_Type;
Mode : in Stream_Mode;
Back : in Stream_Access;
Back_Compressed : in Boolean;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Header : in Header_Type := Default;
Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size;
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size);
-- Create the Comression/Decompression stream.
-- If mode is In_Stream then Write operation is disabled.
-- If mode is Out_Stream then Read operation is disabled.
-- If Back_Compressed is true then
-- Data written to the Stream is compressing to the Back stream
-- and data read from the Stream is decompressed data from the Back stream.
-- If Back_Compressed is false then
-- Data written to the Stream is decompressing to the Back stream
-- and data read from the Stream is compressed data from the Back stream.
-- !!! When the Need_Header is False ZLib-Ada is using undocumented
-- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
function Is_Open (Stream : Stream_Type) return Boolean;
procedure Close (Stream : in out Stream_Type);
private
use Ada.Streams;
type Buffer_Access is access all Stream_Element_Array;
type Stream_Type
is new Root_Stream_Type with
record
Mode : Stream_Mode;
Buffer : Buffer_Access;
Rest_First : Stream_Element_Offset;
Rest_Last : Stream_Element_Offset;
-- Buffer for Read operation.
-- We need to have this buffer in the record
-- becouse not all read data from back stream
-- could be processed during the read operation.
Buffer_Size : Stream_Element_Offset;
-- Buffer size for write operation.
-- We do not need to have this buffer
-- in the record becouse all data could be
-- processed in the write operation.
Back : Stream_Access;
Reader : Filter_Type;
Writer : Filter_Type;
end record;
end ZLib.Streams;
|
Spohn/LegendOfZelba | Ada | 2,392 | ads | package NPC_PC is
-------------------------------
-- Name: Jon Spohn
-- David Rogina
-- Hero and enemy stats package
-------------------------------
type HeroClass is private;
Type EnemyClass is private;
--Set hero x,y coordinates
procedure SetHeroCoord( X: in integer; Y: in integer; Hero : in out HeroClass);
--set hero health
procedure SetHeroHealth( H : in integer; Hero : in out HeroClass);
--set hero armor
procedure SetHeroArmor( A : in integer; Hero : in out HeroClass);
--set hero strength
procedure SetHeroStrength( S : in integer; Hero : in out HeroClass);
--get hero X coordinate
function GetHeroX(Hero : in HeroClass) return integer;
--get hero Y coordinate
function GetHeroY(Hero : in HeroClass) return integer;
--get hero health
function GetHeroH(Hero : in HeroClass) return integer;
--get hero armor
function GetHeroA(Hero : in HeroClass) return integer;
--get hero strength
function GetHeroS(Hero : in HeroClass) return integer;
--Set enemy x,y coordinates
procedure SetEnemyCoord( X: in integer; Y: in integer; Enemy : in out EnemyClass);
--set enemy health
procedure SetEnemyHealth( H : in integer; Enemy : in out EnemyClass);
--set enemy armor
procedure SetEnemyArmor( A : in integer; Enemy : in out EnemyClass);
--set enemy strength
procedure SetEnemyStrength( S : in integer; Enemy : in out EnemyClass);
--get enemy X coordinate
function GetEnemyX(Enemy : in EnemyClass) return integer;
--get enemy Y coordinate
function GetEnemyY(Enemy : in EnemyClass) return integer;
--get enemy health
function GetEnemyH(Enemy : in EnemyClass) return integer;
--get enemy armor
function GetEnemyA(Enemy : in EnemyClass) return integer;
--get enemy strength
function GetEnemyS(Enemy : in EnemyClass) return integer;
--view hero stats
procedure viewstats(Hero: in HeroClass);
private
type HeroClass is record
HeroX : integer;
HeroY : integer;
Health : integer := 100;
Armor : integer := 10;
Strength : integer := 10;
end record;
type EnemyClass is record
EnemyX: integer;
EnemyY: integer;
Health : integer := 100;
Armor : integer := 0;
Strength : integer := 0;
end record;
end NPC_PC;
|
charlie5/lace | Ada | 4,861 | adb | with
ada.unchecked_Deallocation;
package body openGL.Visual
is
package body Forge
is
function new_Visual (Model : in openGL.Model.view;
Scale : in Vector_3 := [1.0, 1.0, 1.0];
is_Terrain : in Boolean := False) return openGL.Visual.view
is
begin
return new Visual.item' (Model => Model,
model_Transform => Identity_4x4,
camera_Transform => Identity_4x4,
Transform => Identity_4x4,
mvp_Transform => Identity_4x4,
Scale => Scale,
program_Parameters => null,
is_Terrain => is_Terrain,
face_Count => 1,
apparent_Size => <>);
end new_Visual;
end Forge;
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
deallocate (Self);
end free;
function Model (Self : in Item) return openGL.Model.view
is
begin
return Self.Model;
end Model;
procedure Model_is (Self : in out Item; Now : in openGL.Model.view)
is
begin
Self.Model := Now;
end Model_is;
function Scale (Self : in Item) return Vector_3
is
begin
return Self.Scale;
end Scale;
procedure Scale_is (Self : in out Item; Now : in Vector_3)
is
begin
Self.Scale := Now;
end Scale_is;
function is_Terrain (Self : in Item) return Boolean
is
begin
return Self.is_Terrain;
end is_Terrain;
procedure is_Terrain (Self : in out Item; Now : in Boolean := True)
is
begin
Self.is_Terrain := Now;
end is_Terrain;
function face_Count (Self : in Item) return Natural
is
begin
return Self.face_Count;
end face_Count;
procedure face_Count_is (Self : in out Item; Now : in Natural)
is
begin
Self.face_Count := Now;
end face_Count_is;
function apparent_Size (Self : in Item) return Real
is
begin
return Self.apparent_Size;
end apparent_Size;
procedure apparent_Size_is (Self : in out Item; Now : in Real)
is
begin
Self.apparent_Size := Now;
end apparent_Size_is;
function Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.Transform;
end Transform;
procedure Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.Transform := Now;
end Transform_is;
function mvp_Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.mvp_Transform;
end mvp_Transform;
procedure mvp_Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.mvp_Transform := Now;
end mvp_Transform_is;
function model_Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.model_Transform;
end model_Transform;
procedure model_Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.model_Transform := Now;
end model_Transform_is;
function camera_Transform (Self : in Item) return Matrix_4x4
is
begin
return Self.camera_Transform;
end camera_Transform;
procedure camera_Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.camera_Transform := Now;
end camera_Transform_is;
procedure Spin_is (Self : in out Item; Now : in Matrix_3x3)
is
use linear_Algebra_3d;
begin
set_Rotation (Self.Transform, Now);
-- set_Rotation (Self.model_Transform, Now);
end Spin_is;
function Spin_of (Self : in Item) return Matrix_3x3
is
use linear_Algebra_3d;
begin
return get_Rotation (Self.Transform);
-- return get_Rotation (Self.model_Transform);
end Spin_of;
procedure Site_is (Self : in out Item; Now : in Vector_3)
is
use linear_Algebra_3d;
begin
set_Translation (Self.Transform, Now);
-- set_Translation (Self.model_Transform, Now);
end Site_is;
function Site_of (Self : in Item) return Vector_3
is
use linear_Algebra_3d;
begin
return get_Translation (Self.Transform);
-- return get_Translation (Self.model_Transform);
end Site_of;
function program_Parameters (Self : in Item) return program.Parameters_view
is
begin
return Self.program_Parameters;
end program_Parameters;
procedure program_Parameters_are (Self : in out Item; Now : in program.Parameters_view)
is
begin
Self.program_Parameters := Now;
end program_Parameters_are;
end openGL.Visual;
|
zhmu/ananas | Ada | 4,656 | adb | -- { dg-do run }
-- { dg-options "-gnata" }
with Ada.Strings.Hash;
with Ada.Containers.Hashed_Sets;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Indefinite_Hashed_Sets;
with Ada.Containers.Indefinite_Hashed_Maps;
procedure Containers2 is
-- Check that Cursors of the hashed containers follow the correct
-- predefined equality rules - that two Cursors to the same element
-- are equal, one one is obtained through, for example, iteration,
-- and the other is obtained through a search
subtype Definite_Name is String (1 .. 5);
type Named_Item is
record
Name : Definite_Name;
Item : Integer := 0;
end record;
function Equivalent_Item (Left, Right: Named_Item) return Boolean
is (Left.Name = Right.Name);
function DI_Hash (Item: Named_Item) return Ada.Containers.Hash_Type
is (Ada.Strings.Hash (Item.Name));
package HS is new Ada.Containers.Hashed_Sets
(Element_Type => Named_Item,
Hash => DI_Hash,
Equivalent_Elements => Equivalent_Item);
package IHS is new Ada.Containers.Indefinite_Hashed_Sets
(Element_Type => Named_Item,
Hash => DI_Hash,
Equivalent_Elements => Equivalent_Item);
package HM is new Ada.Containers.Hashed_Maps
(Key_Type => Definite_Name,
Element_Type => Integer,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "=");
package IHM is new Ada.Containers.Indefinite_Hashed_Maps
(Key_Type => Definite_Name,
Element_Type => Integer,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "=");
Item_Data : constant array (1 .. 5) of Named_Item
:= ((Name => "ABCDE", others => <>),
(Name => "FGHIJ", others => <>),
(Name => "KLMNO", others => <>),
(Name => "PQRST", others => <>),
(Name => "UVWXY", others => <>));
use type HS.Cursor;
use type IHS.Cursor;
use type HM.Cursor;
use type IHM.Cursor;
type HS_Cursor_Vec is array (Item_Data'Range) of HS.Cursor;
type IHS_Cursor_Vec is array (Item_Data'Range) of IHS.Cursor;
type HM_Cursor_Vec is array (Item_Data'Range) of HM.Cursor;
type IHM_Cursor_Vec is array (Item_Data'Range) of IHM.Cursor;
HSC : HS.Set;
IHSC : IHS.Set;
HMC : HM.Map;
IHMC : IHM.Map;
HS_Create_Cursors : HS_Cursor_Vec;
IHS_Create_Cursors : IHS_Cursor_Vec;
HM_Create_Cursors : HM_Cursor_Vec;
IHM_Create_Cursors : IHM_Cursor_Vec;
HS_Index : HS.Cursor;
IHS_Index : IHS.Cursor;
HM_Index : HM.Cursor;
IHM_Index : IHM.Cursor;
HS_Find : HS.Cursor;
IHS_Find : IHS.Cursor;
HM_Find : HM.Cursor;
IHM_Find : IHM.Cursor;
Inserted : Boolean;
begin
for I in Item_Data'Range loop
HSC.Insert (New_Item => Item_Data(I),
Position => HS_Create_Cursors(I),
Inserted => Inserted);
pragma Assert (Inserted);
IHSC.Insert (New_Item => Item_Data(I),
Position => IHS_Create_Cursors(I),
Inserted => Inserted);
pragma Assert (Inserted);
HMC.Insert (New_Item => Item_Data(I).Item,
Key => Item_Data(I).Name,
Position => HM_Create_Cursors(I),
Inserted => Inserted);
pragma Assert (Inserted);
IHMC.Insert (New_Item => Item_Data(I).Item,
Key => Item_Data(I).Name,
Position => IHM_Create_Cursors(I),
Inserted => Inserted);
pragma Assert (Inserted);
end loop;
HS_Index := HSC.First;
IHS_Index := IHSC.First;
HM_Index := HMC.First;
IHM_Index := IHMC.First;
for I in Item_Data'Range loop
pragma Assert (HS.Has_Element (HS_Index));
pragma Assert (IHS.Has_Element (IHS_Index));
pragma Assert (HM.Has_Element (HM_Index));
pragma Assert (IHM.Has_Element (IHM_Index));
HS_Find := HSC.Find (Item_Data(I));
pragma Assert (HS_Create_Cursors(I) = HS_Index);
pragma Assert (HS_Find = HS_Index);
IHS_Find := IHSC.Find (Item_Data(I));
pragma Assert (IHS_Create_Cursors(I) = IHS_Index);
pragma Assert (IHS_Find = IHS_Index);
HM_Find := HMC.Find (Item_Data(I).Name);
pragma Assert (HM_Create_Cursors(I) = HM_Index);
pragma Assert (HM_Find = HM_Index);
IHM_Find := IHMC.Find (Item_Data(I).Name);
pragma Assert (IHM_Create_Cursors(I) = IHM_Index);
pragma Assert (IHM_Find = IHM_Index);
HS.Next (HS_Index);
IHS.Next (IHS_Index);
HM.Next (HM_Index);
IHM.Next (IHM_Index);
end loop;
end;
|
reznikmm/matreshka | Ada | 4,004 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Tools 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 Qt4.Dock_Widgets;
private with Qt4.Dock_Widgets.Directors;
with Qt4.Widgets;
package Modeler.Containment_Tree_Docks is
type Containment_Tree_Dock is
limited new Qt4.Dock_Widgets.Q_Dock_Widget with private;
type Containment_Tree_Dock_Access is access all Containment_Tree_Dock'Class;
package Constructors is
function Create
(Parent : access Qt4.Widgets.Q_Widget'Class := null)
return not null Containment_Tree_Dock_Access;
end Constructors;
private
type Containment_Tree_Dock is
limited new Qt4.Dock_Widgets.Directors.Q_Dock_Widget_Director
with null record;
end Modeler.Containment_Tree_Docks;
|
stcarrez/ada-ado | Ada | 981 | adb | -----------------------------------------------------------------------
-- ADO Drivers Initialize -- Initialize the drivers for the shared library implementation
-- Copyright (C) 2013 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.
-----------------------------------------------------------------------
separate (ADO.Drivers)
procedure Initialize is
begin
null;
end Initialize;
|
faelys/natools | Ada | 8,863 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2013-2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
package body Natools.S_Expressions.Dynamic_Interpreters is
-----------------
-- Interpreter --
-----------------
procedure Add_Command
(Self : in out Interpreter;
Name : in Atom;
Cmd : in Command'Class) is
begin
Self.Commands.Insert (Name, Cmd);
Self.Max_Length := Count'Max (Self.Max_Length, Name'Length);
end Add_Command;
procedure Add
(Self : in out Interpreter;
Name : in String;
Cmd : in Command'Class) is
begin
Self.Add_Command (To_Atom (Name), Cmd);
end Add;
function Has_Command (Self : Interpreter; Name : Atom) return Boolean is
begin
return Self.Commands.Contains (Name);
end Has_Command;
function Is_Empty (Self : Interpreter) return Boolean is
begin
return Self.Commands.Is_Empty;
end Is_Empty;
procedure Set_Fallback
(Self : in out Interpreter;
Name : in Atom)
is
function Create return Atom;
function Create return Atom is
begin
return Name;
end Create;
begin
Self.Fallback_Name.Replace (Create'Access);
end Set_Fallback;
procedure Reset_Fallback (Self : in out Interpreter) is
begin
Self.Fallback_Name.Reset;
end Reset_Fallback;
not overriding procedure Execute
(Self : in out Interpreter;
Expression : in out Lockable.Descriptor'Class;
State : in out Shared_State;
Context : in Shared_Context)
is
Event : Events.Event := Expression.Current_Event;
Lock_State : Lockable.Lock_State;
begin
loop
case Event is
when Events.Add_Atom =>
Self.Execute (State, Context, Expression.Current_Atom);
when Events.Open_List =>
Expression.Lock (Lock_State);
begin
Expression.Next (Event);
if Event = Events.Add_Atom then
Self.Execute (State, Context, Expression);
end if;
exception
when others =>
Expression.Unlock (Lock_State, False);
raise;
end;
Expression.Unlock (Lock_State);
when Events.Close_List | Events.End_Of_Input | Events.Error =>
exit;
end case;
Expression.Next (Event);
end loop;
end Execute;
not overriding procedure Execute
(Self : in out Interpreter;
Fallback : in out Command'Class;
Expression : in out Lockable.Descriptor'Class;
State : in out Shared_State;
Context : in Shared_Context)
is
procedure Dispatch (Process : not null access procedure
(Name : in Atom; Cmd : in out Command'Class));
procedure Process_Atom (Name : in Atom; Cmd : in out Command'Class);
procedure Process_Exp (Name : in Atom; Cmd : in out Command'Class);
procedure Dispatch (Process : not null access procedure
(Name : in Atom; Cmd : in out Command'Class))
is
procedure Process_Fallback (Name : in Atom);
procedure Process_Fallback (Name : in Atom) is
begin
Process (Name, Fallback);
end Process_Fallback;
Buffer : Atom (1 .. Self.Max_Length);
Length : Count;
Cursor : Command_Maps.Cursor;
begin
Expression.Read_Atom (Buffer, Length);
if Length > Self.Max_Length then
Expression.Query_Atom (Process_Fallback'Access);
else
Cursor := Self.Commands.Find (Buffer (1 .. Length));
if Command_Maps.Has_Element (Cursor) then
Self.Commands.Update_Element (Cursor, Process);
else
Process (Buffer (1 .. Length), Fallback);
end if;
end if;
end Dispatch;
procedure Process_Atom (Name : in Atom; Cmd : in out Command'Class) is
begin
Cmd.Execute (State, Context, Name);
end Process_Atom;
procedure Process_Exp (Name : in Atom; Cmd : in out Command'Class) is
pragma Unreferenced (Name);
begin
Cmd.Execute (State, Context, Expression);
end Process_Exp;
Event : Events.Event := Expression.Current_Event;
Lock_State : Lockable.Lock_State;
begin
loop
case Event is
when Events.Add_Atom =>
Dispatch (Process_Atom'Access);
when Events.Open_List =>
Expression.Lock (Lock_State);
begin
Expression.Next (Event);
if Event = Events.Add_Atom then
Dispatch (Process_Exp'Access);
end if;
exception
when others =>
Expression.Unlock (Lock_State, False);
raise;
end;
Expression.Unlock (Lock_State);
when Events.Close_List | Events.End_Of_Input | Events.Error =>
exit;
end case;
Expression.Next (Event);
end loop;
end Execute;
overriding procedure Execute
(Self : in out Interpreter;
State : in out Shared_State;
Context : in Shared_Context;
Name : in Atom)
is
procedure Process_Atom (Key : in Atom; Cmd : in out Command'Class);
procedure Process_Atom (Key : in Atom; Cmd : in out Command'Class) is
pragma Unreferenced (Key);
begin
Cmd.Execute (State, Context, Name);
end Process_Atom;
Cursor : Command_Maps.Cursor;
begin
if Name'Length <= Self.Max_Length then
Cursor := Self.Commands.Find (Name);
if Command_Maps.Has_Element (Cursor) then
Self.Commands.Update_Element (Cursor, Process_Atom'Access);
return;
end if;
end if;
if not Self.Fallback_Name.Is_Empty then
Cursor := Self.Commands.Find (Self.Fallback_Name.Query.Data.all);
if Command_Maps.Has_Element (Cursor) then
Self.Commands.Update_Element (Cursor, Process_Atom'Access);
return;
end if;
end if;
raise Command_Not_Found
with "Unknown command """ & To_String (Name) & '"';
end Execute;
overriding procedure Execute
(Self : in out Interpreter;
State : in out Shared_State;
Context : in Shared_Context;
Cmd : in out Lockable.Descriptor'Class)
is
procedure Process_Exp (Name : in Atom; Actual : in out Command'Class);
procedure Process_Exp (Name : in Atom; Actual : in out Command'Class) is
pragma Unreferenced (Name);
begin
Actual.Execute (State, Context, Cmd);
end Process_Exp;
Buffer : Atom (1 .. Self.Max_Length);
Length : Count;
Cursor : Command_Maps.Cursor;
begin
if Cmd.Current_Event /= Events.Add_Atom then
return;
end if;
Cmd.Read_Atom (Buffer, Length);
if Length <= Self.Max_Length then
Cursor := Self.Commands.Find (Buffer (1 .. Length));
if Command_Maps.Has_Element (Cursor) then
Self.Commands.Update_Element (Cursor, Process_Exp'Access);
return;
end if;
end if;
if not Self.Fallback_Name.Is_Empty then
Cursor := Self.Commands.Find (Self.Fallback_Name.Query.Data.all);
if Command_Maps.Has_Element (Cursor) then
Self.Commands.Update_Element (Cursor, Process_Exp'Access);
return;
end if;
end if;
raise Command_Not_Found
with "Unknown command """ & To_String (Cmd.Current_Atom) & '"';
end Execute;
end Natools.S_Expressions.Dynamic_Interpreters;
|
reznikmm/matreshka | Ada | 3,689 | 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.Xlink_Href_Attributes is
pragma Preelaborate;
type ODF_Xlink_Href_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Xlink_Href_Attribute_Access is
access all ODF_Xlink_Href_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Xlink_Href_Attributes;
|
AdaCore/gpr | Ada | 415 | ads | --
-- Copyright (C) 2019-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--
-- This package represents an entity source reference with an associated
-- message. This is mostly to report warnings/errors while parsing sources.
with GPR2.Source_Reference.Scalar_Value;
package GPR2.Source_Reference.Pack is
new GPR2.Source_Reference.Scalar_Value (Package_Id, Project_Level_Scope);
|
reznikmm/matreshka | Ada | 3,670 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools 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 Ada.Containers.Vectors;
with League.Strings;
package CSMIB is
pragma Preelaborate;
type MIB_Record is record
Name : League.Strings.Universal_String;
MIB : Positive;
end record;
package MIB_Vectors is new Ada.Containers.Vectors (Positive, MIB_Record);
MIBs : MIB_Vectors.Vector;
end CSMIB;
|
yannickmoy/StratoX | Ada | 4,520 | ads | -- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Author: Martin Becker ([email protected])
with Ada.Real_Time;
with Interfaces;
with HIL;
-- @summary
-- Implements the structure andserialization of log objects
-- according to the self-describing ULOG file format used
-- in PX4.
-- The serialized byte array is returned.
--
-- Polymorphism with tagged type fails, because we cannot
-- copy a polymorphic object in SPARK.
-- TODO: offer a project-wide Ulog.Register_Parameter() function.
--
-- How to add a new message 'FOO':
-- 1. add another enum value 'FOO' to Message_Type
-- 2. extend record 'Message' with the case 'FOO'
-- 3. add procedure 'Serialize_Ulog_FOO' and only handle the components for your new type
package ULog with SPARK_Mode is
-- types of log messages. Add new ones when needed.
type Message_Type is (NONE, TEXT, GPS, BARO, IMU, MAG, CONTROLLER, NAV, LOG_QUEUE);
type GPS_fixtype is (NOFIX, DEADR, FIX2D, FIX3D, FIX3DDEADR, FIXTIME);
-- polymorphism via variant record. Everything must be initialized
type Message (Typ : Message_Type := NONE) is record
t : Ada.Real_Time.Time := Ada.Real_Time.Time_First; -- time of data capture set by caller
case Typ is
when NONE => null;
when TEXT =>
-- text message with up to 128 characters
txt : String (1 .. 128) := (others => Character'Val (0));
txt_last : Integer := 0; -- points to last valid char
when GPS =>
-- GPS message
gps_year : Interfaces.Unsigned_16 := 0;
gps_month : Interfaces.Unsigned_8 := 0;
gps_day : Interfaces.Unsigned_8 := 0;
gps_hour : Interfaces.Unsigned_8 := 0;
gps_min : Interfaces.Unsigned_8 := 0;
gps_sec : Interfaces.Unsigned_8 := 0;
fix : Interfaces.Unsigned_8 := 0;
nsat : Interfaces.Unsigned_8 := 0;
lat : Float := 0.0;
lon : Float := 0.0;
alt : Float := 0.0;
vel : Float := 0.0;
pos_acc : Float := 0.0;
when BARO =>
pressure : Float := 0.0;
temp : Float := 0.0;
press_alt : Float := 0.0;
when IMU =>
accX : Float := 0.0;
accY : Float := 0.0;
accZ : Float := 0.0;
gyroX : Float := 0.0;
gyroY : Float := 0.0;
gyroZ : Float := 0.0;
roll : Float := 0.0;
pitch : Float := 0.0;
yaw : Float := 0.0;
when MAG =>
magX : Float := 0.0;
magY : Float := 0.0;
magZ : Float := 0.0;
when CONTROLLER =>
ctrl_mode : Interfaces.Unsigned_8 := 0;
target_yaw : Float := 0.0;
target_roll : Float := 0.0;
target_pitch : Float := 0.0;
elevon_left : Float := 0.0;
elevon_right : Float := 0.0;
when NAV =>
home_dist : Float := 0.0;
home_course : Float := 0.0;
home_altdiff : Float := 0.0;
when LOG_QUEUE =>
-- logging queue info
n_overflows : Interfaces.Unsigned_16 := 0;
n_queued : Interfaces.Unsigned_8 := 0;
max_queued : Interfaces.Unsigned_8 := 0;
end case;
end record;
--------------------------
-- Primitive operations
--------------------------
procedure Serialize_Ulog (msg : in Message; len : out Natural; bytes : out HIL.Byte_Array)
with Post => len < 256 and -- ulog messages cannot be longer
then len <= bytes'Length;
-- turn object into ULOG byte array
-- @return len=number of bytes written in 'bytes'
-- procedure Serialize_CSV (msg : in Message; len : out Natural; bytes : out HIL.Byte_Array);
-- turn object into CSV string/byte array
procedure Get_Header_Ulog (bytes : in out HIL.Byte_Array;
len : out Natural; valid : out Boolean)
with Post => len <= bytes'Length;
-- every ULOG file starts with a header, which is generated here
-- for all known message types
-- @return If true, you must keep calling this. If false, then all message defs have been
-- delivered
private
subtype ULog_Label is HIL.Byte_Array (1 .. 64);
subtype ULog_Format is HIL.Byte_Array (1 .. 16);
subtype ULog_Name is HIL.Byte_Array (1 .. 4);
end ULog;
|
bhayward93/Ada-Traffic-Light-Sim | Ada | 1,259 | adb | with PedestrianLightSwitcher;
with EmergencyVehicleOverride;
with HWIF;use HWIF;
with HWIF_Types; use HWIF_Types;
with TrafficLightSwitcher;
with Ada.Text_IO; use Ada.Text_IO;
with Light_Rotator;
procedure Controller is
task Init;
task body Init is
task SouthSwitch;
task body SouthSwitch is
begin
TrafficLightSwitcher(South);
end SouthSwitch;
task NorthSwitch;
task body NorthSwitch is
begin
TrafficLightSwitcher(North);
end NorthSwitch;
begin
Put_Line("Initialized");
end init;
task Light_Looper;
task body Light_Looper is begin
loop
Light_Rotator;
end loop;
end Light_Looper;
begin --I think this should be a task, where the north and south are switched to east and west every 45 or so seconds, WHILST the below is going on. ll
--Loop.
loop
for dir in Direction loop
if Pedestrian_Button(dir) = 1 then -- Check all buttons, and if they're pressed trigger the PedLightSwitcher
PedestrianLightSwitcher(dir);
end if;
end loop;
if Emergency_Vehicle_Sensor(North) = 1 then
EmergencyVehicleOverride(North);
end if;
end loop;
end Controller;
|
persan/A-gst | Ada | 11,771 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbus_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h;
with System;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gthreadpool_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h;
with glib;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbin_h is
-- unsupported macro: GST_TYPE_BIN (gst_bin_get_type ())
-- arg-macro: function GST_IS_BIN (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BIN);
-- arg-macro: function GST_IS_BIN_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BIN);
-- arg-macro: function GST_BIN_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BIN, GstBinClass);
-- arg-macro: function GST_BIN (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BIN, GstBin);
-- arg-macro: function GST_BIN_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BIN, GstBinClass);
-- arg-macro: function GST_BIN_CAST (obj)
-- return (GstBin*)(obj);
-- arg-macro: function GST_BIN_NUMCHILDREN (bin)
-- return GST_BIN_CAST(bin).numchildren;
-- arg-macro: function GST_BIN_CHILDREN (bin)
-- return GST_BIN_CAST(bin).children;
-- arg-macro: function GST_BIN_CHILDREN_COOKIE (bin)
-- return GST_BIN_CAST(bin).children_cookie;
-- GStreamer
-- * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
-- * 2000 Wim Taymans <[email protected]>
-- *
-- * gstbin.h: Header for GstBin container object
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
--*
-- * GstBinFlags:
-- * @GST_BIN_FLAG_LAST: the last enum in the series of flags for bins.
-- * Derived classes can use this as first value in a list of flags.
-- *
-- * GstBinFlags are a set of flags specific to bins. Most are set/used
-- * internally. They can be checked using the GST_OBJECT_FLAG_IS_SET () macro,
-- * and (un)set using GST_OBJECT_FLAG_SET () and GST_OBJECT_FLAG_UNSET ().
--
-- padding
subtype GstBinFlags is unsigned;
GST_BIN_FLAG_LAST : constant GstBinFlags := 33554432; -- gst/gstbin.h:53
type GstBin;
type u_GstBin_u_gst_reserved_array is array (0 .. 2) of System.Address;
--subtype GstBin is u_GstBin; -- gst/gstbin.h:55
type GstBinClass;
type u_GstBinClass_u_gst_reserved_array is array (0 .. 2) of System.Address;
--subtype GstBinClass is u_GstBinClass; -- gst/gstbin.h:56
-- skipped empty struct u_GstBinPrivate
-- skipped empty struct GstBinPrivate
--*
-- * GST_BIN_NUMCHILDREN:
-- * @bin: a #GstBin
-- *
-- * Gets the number of children in a bin.
--
--*
-- * GST_BIN_CHILDREN:
-- * @bin: a #GstBin
-- *
-- * Gets the list with children in a bin.
--
--*
-- * GST_BIN_CHILDREN_COOKIE:
-- * @bin: a #GstBin
-- *
-- * Gets the children cookie that watches the children list.
--
--*
-- * GstBin:
-- * @numchildren: the number of children in this bin
-- * @children: the list of children in this bin
-- * @children_cookie: updated whenever @children changes
-- * @child_bus: internal bus for handling child messages
-- * @messages: queued and cached messages
-- * @polling: the bin is currently calculating its state
-- * @state_dirty: the bin needs to recalculate its state (deprecated)
-- * @clock_dirty: the bin needs to select a new clock
-- * @provided_clock: the last clock selected
-- * @clock_provider: the element that provided @provided_clock
-- *
-- * The GstBin base class. Subclasses can access these fields provided
-- * the LOCK is taken.
--
type GstBin is record
element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstbin.h:98
numchildren : aliased GLIB.gint; -- gst/gstbin.h:103
children : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/gstbin.h:104
children_cookie : aliased GLIB.guint32; -- gst/gstbin.h:105
child_bus : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbus_h.GstBus; -- gst/gstbin.h:107
messages : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/gstbin.h:108
polling : aliased GLIB.gboolean; -- gst/gstbin.h:110
state_dirty : aliased GLIB.gboolean; -- gst/gstbin.h:111
clock_dirty : aliased GLIB.gboolean; -- gst/gstbin.h:113
provided_clock : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock; -- gst/gstbin.h:114
clock_provider : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstbin.h:115
priv : System.Address; -- gst/gstbin.h:118
u_gst_reserved : u_GstBin_u_gst_reserved_array; -- gst/gstbin.h:120
end record;
pragma Convention (C_Pass_By_Copy, GstBin); -- gst/gstbin.h:97
--< public >
-- with LOCK
-- our children, subclass are supposed to update these
-- * fields to reflect their state with _iterate_*()
--< private >
--*
-- * GstBinClass:
-- * @parent_class: bin parent class
-- * @add_element: method to add an element to a bin
-- * @remove_element: method to remove an element from a bin
-- * @handle_message: method to handle a message from the children
-- *
-- * Subclasses can override the @add_element and @remove_element to
-- * update the list of children in the bin.
-- *
-- * The @handle_message method can be overridden to implement custom
-- * message handling. @handle_message takes ownership of the message, just like
-- * #gst_element_post_message.
--
type GstBinClass is record
parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/gstbin.h:138
pool : access GStreamer.GST_Low_Level.glib_2_0_glib_gthreadpool_h.GThreadPool; -- gst/gstbin.h:141
element_added : access procedure (arg1 : access GstBin; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement); -- gst/gstbin.h:144
element_removed : access procedure (arg1 : access GstBin; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement); -- gst/gstbin.h:145
add_element : access function (arg1 : access GstBin; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement) return GLIB.gboolean; -- gst/gstbin.h:149
remove_element : access function (arg1 : access GstBin; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement) return GLIB.gboolean; -- gst/gstbin.h:150
handle_message : access procedure (arg1 : access GstBin; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage); -- gst/gstbin.h:152
do_latency : access function (arg1 : access GstBin) return GLIB.gboolean; -- gst/gstbin.h:156
u_gst_reserved : u_GstBinClass_u_gst_reserved_array; -- gst/gstbin.h:159
end record;
pragma Convention (C_Pass_By_Copy, GstBinClass); -- gst/gstbin.h:137
--< private >
-- signals
--< public >
-- virtual methods for subclasses
--< private >
-- signal added 0.10.22
--< private >
function gst_bin_get_type return GLIB.GType; -- gst/gstbin.h:162
pragma Import (C, gst_bin_get_type, "gst_bin_get_type");
function gst_bin_new (name : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstbin.h:163
pragma Import (C, gst_bin_new, "gst_bin_new");
-- add and remove elements from the bin
function gst_bin_add (bin : access GstBin; element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement) return GLIB.gboolean; -- gst/gstbin.h:166
pragma Import (C, gst_bin_add, "gst_bin_add");
function gst_bin_remove (bin : access GstBin; element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement) return GLIB.gboolean; -- gst/gstbin.h:167
pragma Import (C, gst_bin_remove, "gst_bin_remove");
-- retrieve a single child
function gst_bin_get_by_name (bin : access GstBin; name : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstbin.h:170
pragma Import (C, gst_bin_get_by_name, "gst_bin_get_by_name");
function gst_bin_get_by_name_recurse_up (bin : access GstBin; name : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstbin.h:171
pragma Import (C, gst_bin_get_by_name_recurse_up, "gst_bin_get_by_name_recurse_up");
function gst_bin_get_by_interface (bin : access GstBin; iface : GLIB.GType) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstbin.h:172
pragma Import (C, gst_bin_get_by_interface, "gst_bin_get_by_interface");
-- retrieve multiple children
function gst_bin_iterate_elements (bin : access GstBin) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstbin.h:175
pragma Import (C, gst_bin_iterate_elements, "gst_bin_iterate_elements");
function gst_bin_iterate_sorted (bin : access GstBin) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstbin.h:176
pragma Import (C, gst_bin_iterate_sorted, "gst_bin_iterate_sorted");
function gst_bin_iterate_recurse (bin : access GstBin) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstbin.h:177
pragma Import (C, gst_bin_iterate_recurse, "gst_bin_iterate_recurse");
function gst_bin_iterate_sinks (bin : access GstBin) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstbin.h:179
pragma Import (C, gst_bin_iterate_sinks, "gst_bin_iterate_sinks");
function gst_bin_iterate_sources (bin : access GstBin) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstbin.h:180
pragma Import (C, gst_bin_iterate_sources, "gst_bin_iterate_sources");
function gst_bin_iterate_all_by_interface (bin : access GstBin; iface : GLIB.GType) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstbin.h:181
pragma Import (C, gst_bin_iterate_all_by_interface, "gst_bin_iterate_all_by_interface");
-- latency
function gst_bin_recalculate_latency (bin : access GstBin) return GLIB.gboolean; -- gst/gstbin.h:184
pragma Import (C, gst_bin_recalculate_latency, "gst_bin_recalculate_latency");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbin_h;
|
PThierry/ewok-kernel | Ada | 33 | adb | ../stm32f439/default_handlers.adb |
stcarrez/dynamo | Ada | 9,331 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . U _ C O N V --
-- --
-- B o d y --
-- --
-- Copyright (c) 1995-2006, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adaccore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Namet; use Namet;
with Fname; use Fname;
with Krunch;
with Opt; use Opt;
package body A4G.U_Conv is
---------------------------------
-- Local Types and Subprograms --
---------------------------------
-- We use the trivial finite state automata to analyse and to transform
-- strings passed as parameters to ASIS interfaces and processed by ASIS
-- itself below there are type and routines definitions for various
-- versions of this automata
type State is (Beg_Ident, Mid_Ident, Und_Line);
-- The states of the automata. Some versions may use only a part of the
-- whole set of states.
procedure Normalize_Char (In_Char : Character;
Curr_State : in out State;
Out_Char : out Character;
OK : out Boolean);
-- One step of the finite-state-automata analyzing the string which is
-- supposed to be an Ada unit name and producind the "normalized"
-- version of the name. If In_Char under in the state Curr_State may be
-- considered as belonging to the Ada unit name, the "low-case version"
-- of this character is assigned to Out_Char, and OK is ste True,
-- otherwise OK is set false
function Convert_Char (Ch : Character) return Character;
-- performs upper case -> lover case conversion in the GNAT file
-- name style (see GNAT Document INTRO and Fnames.ads - only letters
-- from the A .. Z range are folded to lower case)
------------------
-- Convert_Char --
------------------
function Convert_Char (Ch : Character) return Character is
begin
if Ch = '.' then
return '-';
else
return To_Lower (Ch);
end if;
end Convert_Char;
------------------------
-- Get_Norm_Unit_Name --
------------------------
procedure Get_Norm_Unit_Name
(U_Name : String;
N_U_Name : out String;
Spec : Boolean;
May_Be_Unit_Name : out Boolean)
is
Current_State : State := Beg_Ident;
begin
May_Be_Unit_Name := False;
for I in U_Name'Range loop
Normalize_Char (U_Name (I), Current_State,
N_U_Name (I), May_Be_Unit_Name);
exit when not May_Be_Unit_Name;
end loop;
if not May_Be_Unit_Name then
return;
elsif N_U_Name (U_Name'Last) = '_' or else
N_U_Name (U_Name'Last) = '.'
then
-- something like "Ab_" -> "ab_" or "Ab_Cd." -> "ab_cd."
May_Be_Unit_Name := False;
return;
end if;
-- here we have all the content of U_Name parced and
-- May_Be_Unit_Name is True. All we have to do is to append
-- the "%s" or "%b" suffix
N_U_Name (N_U_Name'Last - 1) := '%';
if Spec then
N_U_Name (N_U_Name'Last) := 's';
else
N_U_Name (N_U_Name'Last) := 'b';
end if;
end Get_Norm_Unit_Name;
-----------------------------
-- Is_Predefined_File_Name --
-----------------------------
function Is_Predefined_File_Name (S : String_Access) return Boolean is
begin
Namet.Name_Len := S'Length - 1;
-- "- 1" is for trailing ASCII.NUL in the file name
Namet.Name_Buffer (1 .. Namet.Name_Len) := To_String (S);
return Fname.Is_Predefined_File_Name (Namet.Name_Enter);
end Is_Predefined_File_Name;
--------------------
-- Normalize_Char --
--------------------
procedure Normalize_Char
(In_Char : Character;
Curr_State : in out State;
Out_Char : out Character;
OK : out Boolean)
is
begin
OK := True;
case Curr_State is
when Beg_Ident =>
if Is_Letter (In_Char) then
Curr_State := Mid_Ident;
else
OK := False;
end if;
when Mid_Ident =>
if Is_Letter (In_Char) or else
Is_Digit (In_Char)
then
null;
elsif In_Char = '_' then
Curr_State := Und_Line;
elsif In_Char = '.' then
Curr_State := Beg_Ident;
else
OK := False;
end if;
when Und_Line =>
if Is_Letter (In_Char) or else
Is_Digit (In_Char)
then
Curr_State := Mid_Ident;
else
OK := False;
end if;
end case;
Out_Char := To_Lower (In_Char);
end Normalize_Char;
---------------------------
-- Source_From_Unit_Name --
---------------------------
function Source_From_Unit_Name
(S : String;
Spec : Boolean)
return String_Access
is
Result_Prefix : String (1 .. S'Length);
Result_Selector : String (1 .. 4) := ".adb";
Initial_Length : constant Natural := S'Length;
Result_Length : Natural := Initial_Length;
-- this is for the name krunching
begin
for I in S'Range loop
Result_Prefix (I) := Convert_Char (S (I));
end loop;
Krunch
(Buffer => Result_Prefix,
Len => Result_Length,
Maxlen => Integer (Maximum_File_Name_Length),
No_Predef => False);
if Spec then
Result_Selector (4) := 's';
end if;
return new String'(Result_Prefix (1 .. Result_Length)
& Result_Selector
& ASCII.NUL);
end Source_From_Unit_Name;
---------------
-- To_String --
---------------
function To_String (S : String_Access) return String is
begin
return S.all (S'First .. S'Last - 1);
end To_String;
---------------------------
-- Tree_From_Source_Name --
---------------------------
function Tree_From_Source_Name (S : String_Access) return String_Access is
Return_Val : String_Access;
begin
Return_Val := new String'(S.all);
-- the content of S should be "*.ad?" & ASCII.NUL
Return_Val (Return_Val'Last - 1) := 't'; -- ".ad?" -> ".adt"
return Return_Val;
end Tree_From_Source_Name;
end A4G.U_Conv;
|
zhmu/ananas | Ada | 3,240 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . W I D _ L L L I --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Width attribute for signed integers larger than Long_Long_Integer
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
-- setting the corresponding assertion policy to Ignore. Postconditions and
-- contract cases should not be executed at runtime as well, in order not to
-- slow down the execution of these functions.
pragma Assertion_Policy (Pre => Ignore,
Post => Ignore,
Contract_Cases => Ignore,
Ghost => Ignore);
with System.Width_I;
package System.Wid_LLLI
with SPARK_Mode
is
function Width_Long_Long_Long_Integer is
new Width_I (Long_Long_Long_Integer);
pragma Pure_Function (Width_Long_Long_Long_Integer);
end System.Wid_LLLI;
|
Rodeo-McCabe/orka | Ada | 15,227 | ads | -- 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.
with GL.Low_Level;
private package GL.Enums is
pragma Preelaborate;
type Shader_Param is (Shader_Type, Delete_Status, Compile_Status,
Info_Log_Length, Shader_Source_Length);
type Program_Param is (Program_Binary_Retrievable_Hint, Program_Separable,
Compute_Work_Group_Size, Program_Binary_Length,
Geometry_Vertices_Out,
Geometry_Input_Type, Geometry_Output_Type,
Active_Uniform_Block_Max_Name_Length,
Active_Uniform_Blocks, Delete_Status,
Link_Status, Validate_Status, Info_Log_Length,
Attached_Shaders,
Active_Uniforms, Active_Uniform_Max_Length,
Active_Attributes, Active_Attribute_Max_Length,
Active_Atomic_Counter_Buffers);
type Program_Set_Param is (Program_Binary_Retrievable_Hint, Program_Separable);
type Program_Pipeline_Param is (Active_Program,
Fragment_Shader, Vertex_Shader,
Validate_Status, Info_Log_Length,
Geometry_Shader,
Tess_Evaluation_Shader, Tess_Control_Shader);
type Program_Interface is (Atomic_Counter_Buffer,
Uniform,
Uniform_Block,
Program_Input,
Program_Output,
Buffer_Variable,
Shader_Storage_Block,
Vertex_Subroutine,
Tess_Control_Subroutine,
Tess_Evaluation_Subroutine,
Geometry_Subroutine,
Fragment_Subroutine,
Compute_Subroutine,
Vertex_Subroutine_Uniform,
Tess_Control_Subroutine_Uniform,
Tess_Evaluation_Subroutine_Uniform,
Geometry_Subroutine_Uniform,
Fragment_Subroutine_Uniform,
Compute_Subroutine_Uniform);
type Program_Interface_Param is (Active_Resources, Max_Name_Length,
Max_Num_Active_Variables, Max_Num_Compatible_Subroutines);
type Program_Resource_Param is (Num_Compatible_Subroutines,
Compatible_Subroutines,
Is_Per_Patch,
Name_Length, Resource_Type,
Array_Size, Offset, Block_Index,
Array_Stride, Matrix_Stride, Is_Row_Major,
Atomic_Counter_Buffer_Index,
Buffer_Binding, Buffer_Data_Size,
Num_Active_Variables, Active_Variables,
Referenced_By_Vertex_Shader,
Referenced_By_Tess_Control_Shader,
Referenced_By_Tess_Evaluation_Shader,
Referenced_By_Geometry_Shader,
Referenced_By_Fragment_Shader,
Referenced_By_Compute_Shader,
Top_Level_Array_Size,
Top_Level_Array_Stride,
Location, Location_Index);
type Program_Resource_Array is array (Positive range <>) of Program_Resource_Param;
type Pixel_Store_Param is (Unpack_Alignment, Pack_Alignment,
Unpack_Compressed_Block_Width, Unpack_Compressed_Block_Height,
Unpack_Compressed_Block_Depth, Unpack_Compressed_Block_Size,
Pack_Compressed_Block_Width, Pack_Compressed_Block_Height,
Pack_Compressed_Block_Depth, Pack_Compressed_Block_Size);
-- Table 8.1 and 18.1 of the OpenGL specification
type Framebuffer_Param is (Default_Width, Default_Height, Default_Layers,
Default_Samples, Default_Fixed_Sample_Locations);
-----------------------------------------------------------------------------
type Framebuffer_Kind is (Read, Draw);
type Buffer_Kind is (Parameter_Buffer, Element_Array_Buffer,
Pixel_Pack_Buffer, Pixel_Unpack_Buffer, Uniform_Buffer,
Draw_Indirect_Buffer,
Shader_Storage_Buffer, Dispatch_Indirect_Buffer,
Query_Buffer, Atomic_Counter_Buffer);
type Only_Depth_Buffer is (Depth_Buffer);
type Only_Stencil_Buffer is (Stencil_Buffer);
type Only_Depth_Stencil_Buffer is (Depth_Stencil_Buffer);
type Only_Color_Buffer is (Color_Buffer);
private
for Shader_Param use (Shader_Type => 16#8B4F#,
Delete_Status => 16#8B80#,
Compile_Status => 16#8B81#,
Info_Log_Length => 16#8B84#,
Shader_Source_Length => 16#8B88#);
for Shader_Param'Size use Low_Level.Enum'Size;
for Program_Param use (Program_Binary_Retrievable_Hint => 16#8257#,
Program_Separable => 16#8258#,
Compute_Work_Group_Size => 16#8267#,
Program_Binary_Length => 16#8741#,
Geometry_Vertices_Out => 16#8916#,
Geometry_Input_Type => 16#8917#,
Geometry_Output_Type => 16#8918#,
Active_Uniform_Block_Max_Name_Length => 16#8A35#,
Active_Uniform_Blocks => 16#8A36#,
Delete_Status => 16#8B4F#,
Link_Status => 16#8B82#,
Validate_Status => 16#8B83#,
Info_Log_Length => 16#8B84#,
Attached_Shaders => 16#8B85#,
Active_Uniforms => 16#8B86#,
Active_Uniform_Max_Length => 16#8B87#,
Active_Attributes => 16#8B89#,
Active_Attribute_Max_Length => 16#8B8A#,
Active_Atomic_Counter_Buffers => 16#92D9#);
for Program_Param'Size use Low_Level.Enum'Size;
for Program_Set_Param use (Program_Binary_Retrievable_Hint => 16#8257#,
Program_Separable => 16#8258#);
for Program_Set_Param'Size use Low_Level.Enum'Size;
for Program_Pipeline_Param use (Active_Program => 16#8259#,
Fragment_Shader => 16#8B30#,
Vertex_Shader => 16#8B31#,
Validate_Status => 16#8B83#,
Info_Log_Length => 16#8B84#,
Geometry_Shader => 16#8DD9#,
Tess_Evaluation_Shader => 16#8E87#,
Tess_Control_Shader => 16#8E88#);
for Program_Pipeline_Param'Size use Low_Level.Enum'Size;
for Program_Interface use (Atomic_Counter_Buffer => 16#92C0#,
Uniform => 16#92E1#,
Uniform_Block => 16#92E2#,
Program_Input => 16#92E3#,
Program_Output => 16#92E4#,
Buffer_Variable => 16#92E5#,
Shader_Storage_Block => 16#92E6#,
Vertex_Subroutine => 16#92E8#,
Tess_Control_Subroutine => 16#92E9#,
Tess_Evaluation_Subroutine => 16#92EA#,
Geometry_Subroutine => 16#92EB#,
Fragment_Subroutine => 16#92EC#,
Compute_Subroutine => 16#92ED#,
Vertex_Subroutine_Uniform => 16#92EE#,
Tess_Control_Subroutine_Uniform => 16#92EF#,
Tess_Evaluation_Subroutine_Uniform => 16#92F0#,
Geometry_Subroutine_Uniform => 16#92F1#,
Fragment_Subroutine_Uniform => 16#92F2#,
Compute_Subroutine_Uniform => 16#92F3#);
for Program_Interface'Size use Low_Level.Enum'Size;
for Program_Interface_Param use (Active_Resources => 16#92F5#,
Max_Name_Length => 16#92F6#,
Max_Num_Active_Variables => 16#92F7#,
Max_Num_Compatible_Subroutines => 16#92F8#);
for Program_Interface_Param'Size use Low_Level.Enum'Size;
for Program_Resource_Param use (Num_Compatible_Subroutines => 16#8E4A#,
Compatible_Subroutines => 16#8E4B#,
Is_Per_Patch => 16#92E7#,
Name_Length => 16#92F9#,
Resource_Type => 16#92FA#,
Array_Size => 16#92FB#,
Offset => 16#92FC#,
Block_Index => 16#92FD#,
Array_Stride => 16#92FE#,
Matrix_Stride => 16#92FF#,
Is_Row_Major => 16#9300#,
Atomic_Counter_Buffer_Index => 16#9301#,
Buffer_Binding => 16#9302#,
Buffer_Data_Size => 16#9303#,
Num_Active_Variables => 16#9304#,
Active_Variables => 16#9305#,
Referenced_By_Vertex_Shader => 16#9306#,
Referenced_By_Tess_Control_Shader => 16#9307#,
Referenced_By_Tess_Evaluation_Shader => 16#9308#,
Referenced_By_Geometry_Shader => 16#9309#,
Referenced_By_Fragment_Shader => 16#930A#,
Referenced_By_Compute_Shader => 16#930B#,
Top_Level_Array_Size => 16#930C#,
Top_Level_Array_Stride => 16#930D#,
Location => 16#930E#,
Location_Index => 16#930F#);
for Program_Resource_Param'Size use Low_Level.Enum'Size;
for Pixel_Store_Param use (Unpack_Alignment => 16#0CF5#,
Pack_Alignment => 16#0D05#,
Unpack_Compressed_Block_Width => 16#9127#,
Unpack_Compressed_Block_Height => 16#9128#,
Unpack_Compressed_Block_Depth => 16#9129#,
Unpack_Compressed_Block_Size => 16#912A#,
Pack_Compressed_Block_Width => 16#912B#,
Pack_Compressed_Block_Height => 16#912C#,
Pack_Compressed_Block_Depth => 16#912D#,
Pack_Compressed_Block_Size => 16#912E#);
for Pixel_Store_Param'Size use Low_Level.Enum'Size;
for Framebuffer_Param use (Default_Width => 16#9310#,
Default_Height => 16#9311#,
Default_Layers => 16#9312#,
Default_Samples => 16#9313#,
Default_Fixed_Sample_Locations => 16#9314#);
for Framebuffer_Param'Size use Low_Level.Enum'Size;
-----------------------------------------------------------------------------
for Framebuffer_Kind use (Read => 16#8CA8#,
Draw => 16#8CA9#);
for Framebuffer_Kind'Size use Low_Level.Enum'Size;
for Buffer_Kind use (Parameter_Buffer => 16#80EE#,
Element_Array_Buffer => 16#8893#,
Pixel_Pack_Buffer => 16#88EB#,
Pixel_Unpack_Buffer => 16#88EC#,
Uniform_Buffer => 16#8A11#,
Draw_Indirect_Buffer => 16#8F3F#,
Shader_Storage_Buffer => 16#90D2#,
Dispatch_Indirect_Buffer => 16#90EE#,
Query_Buffer => 16#9192#,
Atomic_Counter_Buffer => 16#92C0#);
for Buffer_Kind'Size use Low_Level.Enum'Size;
for Only_Depth_Buffer use (Depth_Buffer => 16#1801#);
for Only_Depth_Buffer'Size use Low_Level.Enum'Size;
for Only_Stencil_Buffer use (Stencil_Buffer => 16#1802#);
for Only_Stencil_Buffer'Size use Low_Level.Enum'Size;
for Only_Depth_Stencil_Buffer use (Depth_Stencil_Buffer => 16#84F9#);
for Only_Depth_Stencil_Buffer'Size use Low_Level.Enum'Size;
for Only_Color_Buffer use (Color_Buffer => 16#1800#);
for Only_Color_Buffer'Size use Low_Level.Enum'Size;
end GL.Enums;
|
stcarrez/ada-awa | Ada | 1,665 | ads | -----------------------------------------------------------------------
-- awa-comments -- Comments module
-- Copyright (C) 2009, 2010, 2011, 2014, 2015, 2018 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.
-----------------------------------------------------------------------
-- = Comments Module =
-- The `Comments` module is a general purpose module that allows to associate user comments
-- to any database entity. The module defines several bean types that allow to display a list
-- of comments or edit and publish a new comment.
--
-- @include awa-comments-modules.ads
-- @include awa-comments-beans.ads
-- @include-query comment-queries.xml
--
-- == Data model ==
-- The database model is generic and it uses the `Entity_Type` provided by
-- Ada Database Objects to associate a comment to entities stored in
-- different tables. The `Entity_Type` identifies the database table and the stored
-- identifier in `for_entity_id` defines the entity in that table.
--
-- [images/awa_comments_model.png]
--
package AWA.Comments is
end AWA.Comments;
|
reznikmm/matreshka | Ada | 11,673 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite 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$
------------------------------------------------------------------------------
package body Test_245_Handlers is
Characters_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by Characters callback");
End_Document_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by End_Document callback");
End_Element_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by End_Element callback");
End_Prefix_Mapping_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by End_Prefix_Mapping callback");
Ignorable_Whitespace_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by Ignorable_Whitespace callback");
Processing_Instruction_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by Processing_Instruction callback");
Start_Document_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by Start_Document callback");
Start_Element_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by Start_Element callback");
Start_Prefix_Mapping_Error : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("Error is reported by Start_Prefix_Mapping callback");
----------------
-- Characters --
----------------
overriding procedure Characters
(Self : in out Test_Handler;
Text : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Testcase = Characters then
Success := False;
end if;
end Characters;
------------------
-- End_Document --
------------------
overriding procedure End_Document
(Self : in out Test_Handler;
Success : in out Boolean) is
begin
if Self.Testcase = End_Document then
Success := False;
end if;
end End_Document;
-----------------
-- End_Element --
-----------------
overriding procedure End_Element
(Self : in out Test_Handler;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Testcase = End_Element then
Success := False;
end if;
end End_Element;
------------------------
-- End_Prefix_Mapping --
------------------------
overriding procedure End_Prefix_Mapping
(Self : in out Test_Handler;
Prefix : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Testcase = End_Prefix_Mapping then
Success := False;
end if;
end End_Prefix_Mapping;
------------------
-- Error_String --
------------------
overriding function Error_String
(Self : Test_Handler) return League.Strings.Universal_String is
begin
case Self.Testcase is
when Characters =>
return Characters_Error;
when End_Document =>
return End_Document_Error;
when End_Element =>
return End_Element_Error;
when End_Prefix_Mapping =>
return End_Prefix_Mapping_Error;
when Ignorable_Whitespace =>
return Ignorable_Whitespace_Error;
when Processing_Instruction =>
return Processing_Instruction_Error;
when Start_Document =>
return Start_Document_Error;
when Start_Element =>
return Start_Element_Error;
when Start_Prefix_Mapping =>
return Start_Prefix_Mapping_Error;
end case;
end Error_String;
-----------------
-- Fatal_Error --
-----------------
overriding procedure Fatal_Error
(Self : in out Test_Handler;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception)
is
use type League.Strings.Universal_String;
begin
case Self.Testcase is
when Characters =>
if Occurrence.Message = Characters_Error then
Self.Passed := True;
end if;
when End_Document =>
if Occurrence.Message = End_Document_Error then
Self.Passed := True;
end if;
when End_Element =>
if Occurrence.Message = End_Element_Error then
Self.Passed := True;
end if;
when End_Prefix_Mapping =>
if Occurrence.Message = End_Prefix_Mapping_Error then
Self.Passed := True;
end if;
when Ignorable_Whitespace =>
if Occurrence.Message = Ignorable_Whitespace_Error then
Self.Passed := True;
end if;
when Processing_Instruction =>
if Occurrence.Message = Processing_Instruction_Error then
Self.Passed := True;
end if;
when Start_Document =>
if Occurrence.Message = Start_Document_Error then
Self.Passed := True;
end if;
when Start_Element =>
if Occurrence.Message = Start_Element_Error then
Self.Passed := True;
end if;
when Start_Prefix_Mapping =>
if Occurrence.Message = Start_Prefix_Mapping_Error then
Self.Passed := True;
end if;
end case;
end Fatal_Error;
--------------------------
-- Ignorable_Whitespace --
--------------------------
overriding procedure Ignorable_Whitespace
(Self : in out Test_Handler;
Text : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Testcase = Ignorable_Whitespace then
Success := False;
end if;
end Ignorable_Whitespace;
---------------
-- Is_Passed --
---------------
function Is_Passed (Self : Test_Handler'Class) return Boolean is
begin
return Self.Passed;
end Is_Passed;
----------------------------
-- Processing_Instruction --
----------------------------
overriding procedure Processing_Instruction
(Self : in out Test_Handler;
Target : League.Strings.Universal_String;
Data : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Testcase = Processing_Instruction then
Success := False;
end if;
end Processing_Instruction;
------------------
-- Set_Testcase --
------------------
procedure Set_Testcase
(Self : in out Test_Handler'Class;
Testcase : Testcases) is
begin
Self.Testcase := Testcase;
Self.Passed := False;
end Set_Testcase;
--------------------
-- Start_Document --
--------------------
overriding procedure Start_Document
(Self : in out Test_Handler;
Success : in out Boolean) is
begin
if Self.Testcase = Start_Document then
Success := False;
end if;
end Start_Document;
-------------------
-- Start_Element --
-------------------
overriding procedure Start_Element
(Self : in out Test_Handler;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean) is
begin
if Self.Testcase = Start_Element then
Success := False;
end if;
end Start_Element;
--------------------------
-- Start_Prefix_Mapping --
--------------------------
overriding procedure Start_Prefix_Mapping
(Self : in out Test_Handler;
Prefix : League.Strings.Universal_String;
Namespace_URI : League.Strings.Universal_String;
Success : in out Boolean) is
begin
if Self.Testcase = Start_Prefix_Mapping then
Success := False;
end if;
end Start_Prefix_Mapping;
end Test_245_Handlers;
|
charlie5/cBound | Ada | 1,671 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_polygon_stipple_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
pad1 : aliased swig.int8_t_Array (0 .. 23);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_polygon_stipple_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_polygon_stipple_reply_t.Item,
Element_Array => xcb.xcb_glx_get_polygon_stipple_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_polygon_stipple_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_polygon_stipple_reply_t.Pointer,
Element_Array => xcb.xcb_glx_get_polygon_stipple_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_polygon_stipple_reply_t;
|
Fabien-Chouteau/GESTE | Ada | 3,868 | ads | ------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2019 Fabien Chouteau --
-- --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
package GESTE.Sprite.Animated is
type Frame_Counter is new Natural;
type Animation_Step is record
Tile : GESTE_Config.Tile_Index;
Frame_Cnt : Frame_Counter;
end record;
type Animation_Array is array (Natural range <>) of Animation_Step;
type Animation is not null access constant Animation_Array;
No_Animation_Array : aliased Animation_Array :=
(1 .. 0 => (GESTE_Config.No_Tile,
Frame_Counter'Last));
No_Animation : Animation := No_Animation_Array'Access;
subtype Parent is Sprite.Instance;
type Instance is new Parent with private;
procedure Set_Animation
(This : in out Instance;
Anim : Animation;
Looping : Boolean);
function Anim_Done (This : Instance) return Boolean;
-- Return True if there is no animation running
procedure Signal_Frame (This : in out Instance);
-- Signal to the animated sprite that a new frame is rendered
private
type Instance is new Parent with record
Anim : Animation := No_Animation;
Current_Step : Natural := No_Animation_Array'First;
TTL : Frame_Counter := Frame_Counter'Last;
Looping : Boolean := False;
end record;
end GESTE.Sprite.Animated;
|
optikos/oasis | Ada | 2,987 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Lexical_Elements;
with Program.Element_Vectors;
with Program.Elements.Defining_Names;
with Program.Elements.Parameter_Specifications;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Generic_Procedure_Declarations is
pragma Pure (Program.Elements.Generic_Procedure_Declarations);
type Generic_Procedure_Declaration is
limited interface and Program.Elements.Declarations.Declaration;
type Generic_Procedure_Declaration_Access is
access all Generic_Procedure_Declaration'Class with Storage_Size => 0;
not overriding function Formal_Parameters
(Self : Generic_Procedure_Declaration)
return Program.Element_Vectors.Element_Vector_Access is abstract;
not overriding function Name
(Self : Generic_Procedure_Declaration)
return not null Program.Elements.Defining_Names.Defining_Name_Access
is abstract;
not overriding function Parameters
(Self : Generic_Procedure_Declaration)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Aspects
(Self : Generic_Procedure_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
type Generic_Procedure_Declaration_Text is limited interface;
type Generic_Procedure_Declaration_Text_Access is
access all Generic_Procedure_Declaration_Text'Class
with Storage_Size => 0;
not overriding function To_Generic_Procedure_Declaration_Text
(Self : aliased in out Generic_Procedure_Declaration)
return Generic_Procedure_Declaration_Text_Access is abstract;
not overriding function Generic_Token
(Self : Generic_Procedure_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Procedure_Token
(Self : Generic_Procedure_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Generic_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Generic_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function With_Token
(Self : Generic_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Generic_Procedure_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Generic_Procedure_Declarations;
|
ytomino/zlib-ada | Ada | 1,373 | ads | package zlib.Strings is
pragma Preelaborate;
procedure Deflate (
Stream : in out zlib.Stream;
In_Item : in String;
In_Last : out Natural;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Finish : in Boolean;
Finished : out Boolean);
procedure Deflate (
Stream : in out zlib.Stream;
In_Item : in String;
In_Last : out Natural;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset);
procedure Deflate (
Stream : in out zlib.Stream;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Finish : in Boolean;
Finished : out Boolean)
renames zlib.Deflate;
procedure Inflate (
Stream : in out zlib.Stream;
In_Item : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Item : out String;
Out_Last : out Natural;
Finish : in Boolean;
Finished : out Boolean);
procedure Inflate (
Stream : in out zlib.Stream;
In_Item : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Item : out String;
Out_Last : out Natural);
procedure Inflate (
Stream : in out zlib.Stream;
Out_Item : out String;
Out_Last : out Natural;
Finish : in Boolean;
Finished : out Boolean);
end zlib.Strings;
|
reznikmm/matreshka | Ada | 3,674 | 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.Elements;
package ODF.DOM.Text_Meta_Field_Elements is
pragma Preelaborate;
type ODF_Text_Meta_Field is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_Meta_Field_Access is
access all ODF_Text_Meta_Field'Class
with Storage_Size => 0;
end ODF.DOM.Text_Meta_Field_Elements;
|
tum-ei-rcs/StratoX | Ada | 3,431 | ads | -- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Author: Martin Becker ([email protected])
with Interfaces;
with HIL;
-- @summary
-- Implements a serialization of log objects (records,
-- string messages, etc.) according to the self-describing
-- ULOG file format used in PX4.
-- The serialized byte array is returned.
--
-- We cannot make this abstract, because it would require
-- access types to use polymorphism, and that's not SPARK.
package ULog with SPARK_Mode is
-- root type/base class for polymorphism. all visible to clients.
type Message is tagged record
Timestamp : Interfaces.Unsigned_64 := 0;
Length : Interfaces.Unsigned_16 := 0;
end record;
---------------------------------------------------------------------
-- Non-Primitive operations --
-- (not inherited; available for all members of class-wide type) --
---------------------------------------------------------------------
procedure Serialize (msg : in Message'Class; bytes : out HIL.Byte_Array);
-- turn object into ULOG byte array
-- indefinite argument (class-wide type)
-- FIXME: maybe overload attribute Output?
procedure Format (msg : in Message'Class; bytes : out HIL.Byte_Array);
-- turn object's format description into ULOG byte array
procedure Get_Header (bytes : out HIL.Byte_Array);
-- every ULOG file starts with a header, which is generated here
-- for all known message types
procedure Describe (msg : in Message'Class; namestring : out String); -- is abstract
-- return a readable string identifying message type
function Describe_Func (msg : in Message) return String; -- dispatching op
-- same as above, but as function. REquired because of string.
function Copy (msg : in Message) return Message'Class;
-- what happens if we have two class-wide types in the signature?
-- it works!
function Size (msg : in Message'Class)
return Interfaces.Unsigned_16; -- is abstract;
-- return length of serialized object in bytes
-- Note that this has nothing to do with the size of the struct, since
-- the representation in ULOG format may be different.
------------------------------------
-- Primitive operations --
-- (inherited in Message'Class) --
------------------------------------
-- those are NOT dispatched
private
function Self (msg : in Message) return ULog.Message'Class;
-- factory function to convert to specific child view
--------------------------------------------
-- Primitive operations --
-- (inherited by types in Message'Class) --
--------------------------------------------
procedure Get_Serialization (msg : in Message; bytes : out HIL.Byte_Array);
-- the actual serialization
function Get_Size (msg : in Message) return Interfaces.Unsigned_16;
procedure Get_Format
(msg : in Message;
bytes : out HIL.Byte_Array); -- is abstract
-- for a specific message type, generate the FMT header.
--
-- FIXME: we actually don't need an instance of the message.
-- Actually we want the equivalent to a static member function
-- in C++. Maybe a type attribute?
--
-- FIXME: we want it private, but abstract does not support this.
end ULog;
|
reznikmm/matreshka | Ada | 3,649 | 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.Elements;
package ODF.DOM.Form_Frame_Elements is
pragma Preelaborate;
type ODF_Form_Frame is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Form_Frame_Access is
access all ODF_Form_Frame'Class
with Storage_Size => 0;
end ODF.DOM.Form_Frame_Elements;
|
reznikmm/slimp | Ada | 2,543 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Slim.Message_Visiters;
package body Slim.Messages.grfg is
List : constant Field_Description_Array :=
((Uint_16_Field, 1), -- Screen
(Uint_16_Field, 1), -- width of scrollable area
(Custom_Field, 1)); -- Data
----------
-- Data --
----------
not overriding function Data
(Self : Grfg_Message) return Ada.Streams.Stream_Element_Array is
begin
return Self.Data.To_Stream_Element_Array;
end Data;
----------
-- Read --
----------
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return Grfg_Message is
begin
return Result : Grfg_Message do
Read_Fields (Result, List, Data.all);
end return;
end Read;
-----------------------
-- Read_Custom_Field --
-----------------------
overriding procedure Read_Custom_Field
(Self : in out Grfg_Message;
Index : Positive;
Input : in out Ada.Streams.Stream_Element_Offset;
Data : League.Stream_Element_Vectors.Stream_Element_Vector)
is
use type Ada.Streams.Stream_Element_Offset;
Content : constant Ada.Streams.Stream_Element_Array (1 .. Data.Length) :=
Data.To_Stream_Element_Array;
begin
pragma Assert (Index = 1);
Self.Data.Clear;
Self.Data.Append (Content (Input .. Content'Last));
Input := Content'Last + 1;
end Read_Custom_Field;
-----------
-- Visit --
-----------
overriding procedure Visit
(Self : not null access Grfg_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class) is
begin
Visiter.grfg (Self);
end Visit;
-----------
-- Write --
-----------
overriding procedure Write
(Self : Grfg_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector) is
begin
Tag := "grfg";
Write_Fields (Self, List, Data);
end Write;
------------------------
-- Write_Custom_Field --
------------------------
overriding procedure Write_Custom_Field
(Self : Grfg_Message;
Index : Positive;
Data : in out League.Stream_Element_Vectors.Stream_Element_Vector)
is
begin
pragma Assert (Index = 1);
Data.Append (Self.Data);
end Write_Custom_Field;
end Slim.Messages.grfg;
|
stcarrez/mat | Ada | 7,572 | adb | -----------------------------------------------------------------------
-- mat-targets-gtkmat - Gtk target management
-- Copyright (C) 2014 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 Glib.Error;
with Glib.Object;
with Gtk.Main;
with Gtk.Label;
with Gtk.Frame;
with Gtk.Scrolled_Window;
with Gtk.Viewport;
with MAT.Callbacks;
with MAT.Consoles.Text;
with MAT.Consoles.Gtkmat;
package body MAT.Targets.Gtkmat is
-- ------------------------------
-- Initialize the target instance.
-- ------------------------------
overriding
procedure Initialize (Target : in out Target_Type) is
begin
Target.Options.Interactive := False;
Target.Options.Graphical := True;
Target.Console := new MAT.Consoles.Text.Console_Type;
end Initialize;
-- ------------------------------
-- Release the storage.
-- ------------------------------
overriding
procedure Finalize (Target : in out Target_Type) is
use type Gtk.Widget.Gtk_Widget;
begin
if Target.Main /= null then
Target.Main.Destroy;
Target.About.Destroy;
Target.Chooser.Destroy;
end if;
end Finalize;
-- Load the glade XML definition.
procedure Load_UI (Target : in out Target_Type) is separate;
-- ------------------------------
-- Initialize the widgets and create the Gtk gui.
-- ------------------------------
procedure Initialize_Widget (Target : in out Target_Type;
Widget : out Gtk.Widget.Gtk_Widget) is
Error : aliased Glib.Error.GError;
Result : Glib.Guint;
Timeline : Gtk.Widget.Gtk_Widget;
Scrolled : Gtk.Scrolled_Window.Gtk_Scrolled_Window;
Viewport : Gtk.Viewport.Gtk_Viewport;
begin
if Target.Options.Graphical then
Gtk.Main.Init;
Gtkada.Builder.Gtk_New (Target.Builder);
-- Result := Target.Builder.Add_From_File ("mat.glade", Error'Access);
Load_UI (Target);
MAT.Callbacks.Initialize (Target'Unchecked_Access, Target.Builder);
Target.Builder.Do_Connect;
Widget := Gtk.Widget.Gtk_Widget (Target.Builder.Get_Object ("main"));
Target.Main := Widget;
Target.About := Gtk.Widget.Gtk_Widget (Target.Builder.Get_Object ("about"));
Target.Chooser := Gtk.Widget.Gtk_Widget (Target.Builder.Get_Object ("filechooser"));
Target.Gtk_Console := new MAT.Consoles.Gtkmat.Console_Type;
Target.Gtk_Console.Initialize
(Gtk.Frame.Gtk_Frame (Target.Builder.Get_Object ("consoleFrame")));
Target.Console := Target.Gtk_Console.all'Access;
MAT.Events.Gtkmat.Create (Target.Events);
Timeline := Gtk.Widget.Gtk_Widget (Target.Builder.Get_Object ("scrolledTimeline"));
Scrolled := Gtk.Scrolled_Window.Gtk_Scrolled_Window (Timeline);
Timeline := Gtk.Widget.Gtk_Widget (Target.Builder.Get_Object ("viewport1"));
Viewport := Gtk.Viewport.Gtk_Viewport (Timeline);
Viewport.Add (Target.Events.Drawing);
else
Widget := null;
end if;
end Initialize_Widget;
-- ------------------------------
-- Enter in the interactive loop reading the commands from the standard input
-- and executing the commands.
-- ------------------------------
overriding
procedure Interactive (Target : in out Target_Type) is
Main : Gtk.Widget.Gtk_Widget;
begin
if Target.Options.Graphical then
Main := Gtk.Widget.Gtk_Widget (Target.Builder.Get_Object ("main"));
Main.Show_All;
end if;
if Target.Options.Interactive and Target.Options.Graphical then
Target.Gui_Task.Start (Target'Unchecked_Access);
end if;
if Target.Options.Graphical then
Gtk.Main.Main;
else
MAT.Targets.Target_Type (Target).Interactive;
end if;
end Interactive;
task body Gtk_Loop is
Main : Target_Type_Access;
begin
select
accept Start (Target : in Target_Type_Access) do
Main := Target;
end Start;
MAT.Targets.Target_Type (Main.all).Interactive;
or
terminate;
end select;
end Gtk_Loop;
-- ------------------------------
-- Set the UI label with the given value.
-- ------------------------------
procedure Set_Label (Target : in Target_Type;
Name : in String;
Value : in String) is
use type Glib.Object.GObject;
Object : constant Glib.Object.GObject := Target.Builder.Get_Object (Name);
Label : Gtk.Label.Gtk_Label;
begin
if Object /= null then
Label := Gtk.Label.Gtk_Label (Object);
Label.Set_Label (Value);
end if;
end Set_Label;
-- ------------------------------
-- Create a process instance to hold and keep track of memory and other information about
-- the given process ID.
-- ------------------------------
overriding
procedure Create_Process (Target : in out Target_Type;
Pid : in MAT.Types.Target_Process_Ref;
Path : in Ada.Strings.Unbounded.Unbounded_String;
Process : out Target_Process_Type_Access) is
begin
MAT.Targets.Target_Type (Target).Create_Process (Pid, Path, Process);
Target.Set_Label ("process_info", "Pid:" & MAT.Types.Target_Process_Ref'Image (Pid));
end Create_Process;
-- ------------------------------
-- Refresh the information about the current process.
-- ------------------------------
procedure Refresh_Process (Target : in out Target_Type) is
use type MAT.Events.Targets.Target_Events_Access;
Counter : Integer;
Stats : MAT.Memory.Targets.Memory_Stat;
begin
if Target.Current = null or else Target.Current.Events = null then
return;
end if;
Counter := Target.Current.Events.Get_Event_Counter;
if Counter = Target.Previous_Event_Counter then
return;
end if;
Target.Previous_Event_Counter := Counter;
Target.Set_Label ("event_info", "Events:" & Integer'Image (Counter));
Target.Current.Memory.Stat_Information (Stats);
Target.Set_Label ("thread_info", "Threads:"
& Natural'Image (Stats.Thread_Count));
Target.Set_Label ("mem_used_info", "Used:"
& MAT.Types.Target_Size'Image (Stats.Total_Alloc));
Target.Set_Label ("mem_free_info", "Free:"
& MAT.Types.Target_Size'Image (Stats.Total_Free));
Target.Refresh_Events;
end Refresh_Process;
procedure Refresh_Events (Target : in out Target_Type) is
begin
-- Target.Events.List.Clear;
-- MAT.Events.Targets.Get_Events (Target.Current.Events.all, 0, 0, Target.Events.List);
null;
end Refresh_Events;
end MAT.Targets.Gtkmat;
|
io7m/coreland-stack-ada | Ada | 533 | adb | with Ada.Text_IO;
package body Test is
package IO renames Ada.Text_IO;
procedure sys_exit (ecode : Integer);
pragma Import (C, sys_exit, "exit");
procedure Assert
(Check : in Boolean;
Pass_Message : in String := "Assertion passed";
Fail_Message : in String := "Assertion failed") is
begin
if Check then
IO.Put_Line (IO.Current_Error, "pass: " & Pass_Message);
else
IO.Put_Line (IO.Current_Error, "fail: " & Fail_Message);
sys_exit (1);
end if;
end Assert;
end Test;
|
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_Column_Gap_Attributes;
package Matreshka.ODF_Fo.Column_Gap_Attributes is
type Fo_Column_Gap_Attribute_Node is
new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node
and ODF.DOM.Fo_Column_Gap_Attributes.ODF_Fo_Column_Gap_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Column_Gap_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Fo_Column_Gap_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Fo.Column_Gap_Attributes;
|
Rodeo-McCabe/orka | Ada | 3,162 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[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.
private with GL.Objects.Queries;
private with GL.Types;
package Orka.Timers is
pragma Preelaborate;
type State_Type is (Idle, Busy, Waiting);
type Timer is tagged private;
function Create_Timer return Timer;
function State (Object : Timer) return State_Type
with Inline;
procedure Start (Object : in out Timer)
with Pre => Object.State in Idle | Waiting,
Post => (case Object.State'Old is
when Idle => Object.State = Busy,
when Waiting => Object.State in Waiting | Busy,
when Busy => raise Program_Error);
-- Start measuring the duration of rendering commands on the GPU
--
-- If the timer is currently waiting for the GPU duration to become
-- available, then this procedure is a no-op.
procedure Stop (Object : in out Timer)
with Pre => Object.State in Busy | Waiting,
Post => Object.State = Waiting;
-- Stop measuring the duration of rendering commands on the GPU
--
-- If the timer is already waiting for the GPU duration to become
-- available, then this procedure is a no-op.
--
-- After this procedure has been called, the next restart of the timer
-- will update the GPU duration if the result has become available by
-- then.
--
-- If the timer is used once (not started and stopped repeatedly),
-- then procedure Wait_For_Result needs to be called to wait for the
-- result of the GPU duration to become available.
procedure Wait_For_Result (Object : in out Timer)
with Pre => Object.State = Waiting,
Post => Object.State = Idle;
-- Wait and stall the CPU until the result of the GPU duration is
-- available
--
-- This function is only needed for one-shot timers. If a timer is
-- started and stopped repeatedly (once per frame), then the GPU
-- duration will become available a few frames after the timer was
-- started.
function CPU_Duration (Object : Timer) return Duration;
function GPU_Duration (Object : Timer) return Duration;
private
type Timer is tagged record
Query_Start, Query_Stop : GL.Objects.Queries.Query (GL.Objects.Queries.Timestamp);
State : State_Type := Idle;
CPU_Start : GL.Types.Long := 0;
CPU_Duration : Duration := 0.0;
GPU_Duration : Duration := 0.0;
end record;
function State (Object : Timer) return State_Type is (Object.State);
end Orka.Timers;
|
zhmu/ananas | Ada | 6,246 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 1 3 --
-- --
-- B o d y --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_13 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_13;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
------------
-- Get_13 --
------------
function Get_13
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_13
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_13;
------------
-- Set_13 --
------------
procedure Set_13
(Arr : System.Address;
N : Natural;
E : Bits_13;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_13;
end System.Pack_13;
|
twdroeger/ada-awa | Ada | 30,005 | ads | -----------------------------------------------------------------------
-- AWA.Countries.Models -- AWA.Countries.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 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 ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
pragma Warnings (On);
package AWA.Countries.Models is
pragma Style_Checks ("-mr");
type Country_Ref is new ADO.Objects.Object_Ref with null record;
type City_Ref is new ADO.Objects.Object_Ref with null record;
type Country_Neighbor_Ref is new ADO.Objects.Object_Ref with null record;
type Region_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The country model is a system data model for the application.
-- In theory, it never changes.
-- --------------------
-- Create an object key for Country.
function Country_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Country from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Country_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Country : constant Country_Ref;
function "=" (Left, Right : Country_Ref'Class) return Boolean;
-- Set the country identifier
procedure Set_Id (Object : in out Country_Ref;
Value : in ADO.Identifier);
-- Get the country identifier
function Get_Id (Object : in Country_Ref)
return ADO.Identifier;
-- Set the country name
procedure Set_Name (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Country_Ref;
Value : in String);
-- Get the country name
function Get_Name (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Country_Ref)
return String;
-- Set the continent name
procedure Set_Continent (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Continent (Object : in out Country_Ref;
Value : in String);
-- Get the continent name
function Get_Continent (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Continent (Object : in Country_Ref)
return String;
-- Set the currency used in the country
procedure Set_Currency (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Currency (Object : in out Country_Ref;
Value : in String);
-- Get the currency used in the country
function Get_Currency (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Currency (Object : in Country_Ref)
return String;
-- Set the country ISO code
procedure Set_Iso_Code (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Iso_Code (Object : in out Country_Ref;
Value : in String);
-- Get the country ISO code
function Get_Iso_Code (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Iso_Code (Object : in Country_Ref)
return String;
-- Set the country geoname id
procedure Set_Geonameid (Object : in out Country_Ref;
Value : in Integer);
-- Get the country geoname id
function Get_Geonameid (Object : in Country_Ref)
return Integer;
-- Set the country main language
procedure Set_Languages (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Languages (Object : in out Country_Ref;
Value : in String);
-- Get the country main language
function Get_Languages (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Languages (Object : in Country_Ref)
return String;
-- Set the TLD associated with this country
procedure Set_Tld (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Tld (Object : in out Country_Ref;
Value : in String);
-- Get the TLD associated with this country
function Get_Tld (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Tld (Object : in Country_Ref)
return String;
-- Set the currency code
procedure Set_Currency_Code (Object : in out Country_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Currency_Code (Object : in out Country_Ref;
Value : in String);
-- Get the currency code
function Get_Currency_Code (Object : in Country_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Currency_Code (Object : in Country_Ref)
return String;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Country_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Country_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Country_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Country_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Country_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Country_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
COUNTRY_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Country_Ref);
-- Copy of the object.
procedure Copy (Object : in Country_Ref;
Into : in out Country_Ref);
-- Create an object key for City.
function City_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for City from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function City_Key (Id : in String) return ADO.Objects.Object_Key;
Null_City : constant City_Ref;
function "=" (Left, Right : City_Ref'Class) return Boolean;
-- Set the city identifier
procedure Set_Id (Object : in out City_Ref;
Value : in ADO.Identifier);
-- Get the city identifier
function Get_Id (Object : in City_Ref)
return ADO.Identifier;
-- Set the city name
procedure Set_Name (Object : in out City_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out City_Ref;
Value : in String);
-- Get the city name
function Get_Name (Object : in City_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in City_Ref)
return String;
-- Set the city ZIP code
procedure Set_Zip_Code (Object : in out City_Ref;
Value : in Integer);
-- Get the city ZIP code
function Get_Zip_Code (Object : in City_Ref)
return Integer;
-- Set the city latitude
procedure Set_Latitude (Object : in out City_Ref;
Value : in Integer);
-- Get the city latitude
function Get_Latitude (Object : in City_Ref)
return Integer;
-- Set the city longitude
procedure Set_Longitude (Object : in out City_Ref;
Value : in Integer);
-- Get the city longitude
function Get_Longitude (Object : in City_Ref)
return Integer;
-- Set the region that this city belongs to
procedure Set_Region (Object : in out City_Ref;
Value : in AWA.Countries.Models.Region_Ref'Class);
-- Get the region that this city belongs to
function Get_Region (Object : in City_Ref)
return AWA.Countries.Models.Region_Ref'Class;
-- Set the country that this city belongs to
procedure Set_Country (Object : in out City_Ref;
Value : in AWA.Countries.Models.Country_Ref'Class);
-- Get the country that this city belongs to
function Get_Country (Object : in City_Ref)
return AWA.Countries.Models.Country_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out City_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out City_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out City_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out City_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out City_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in City_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
CITY_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out City_Ref);
-- Copy of the object.
procedure Copy (Object : in City_Ref;
Into : in out City_Ref);
-- --------------------
-- The country neighbor defines what countries
-- are neigbors with each other
-- --------------------
-- Create an object key for Country_Neighbor.
function Country_Neighbor_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Country_Neighbor from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Country_Neighbor_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Country_Neighbor : constant Country_Neighbor_Ref;
function "=" (Left, Right : Country_Neighbor_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Country_Neighbor_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Country_Neighbor_Ref)
return ADO.Identifier;
--
procedure Set_Neighbor_Of (Object : in out Country_Neighbor_Ref;
Value : in AWA.Countries.Models.Country_Ref'Class);
--
function Get_Neighbor_Of (Object : in Country_Neighbor_Ref)
return AWA.Countries.Models.Country_Ref'Class;
--
procedure Set_Neighbor (Object : in out Country_Neighbor_Ref;
Value : in AWA.Countries.Models.Country_Ref'Class);
--
function Get_Neighbor (Object : in Country_Neighbor_Ref)
return AWA.Countries.Models.Country_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Country_Neighbor_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Country_Neighbor_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Country_Neighbor_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Country_Neighbor_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Country_Neighbor_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Country_Neighbor_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
COUNTRY_NEIGHBOR_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Country_Neighbor_Ref);
-- Copy of the object.
procedure Copy (Object : in Country_Neighbor_Ref;
Into : in out Country_Neighbor_Ref);
-- --------------------
-- Region defines an area within a country.
-- --------------------
-- Create an object key for Region.
function Region_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Region from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Region_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Region : constant Region_Ref;
function "=" (Left, Right : Region_Ref'Class) return Boolean;
-- Set the region identifier
procedure Set_Id (Object : in out Region_Ref;
Value : in ADO.Identifier);
-- Get the region identifier
function Get_Id (Object : in Region_Ref)
return ADO.Identifier;
-- Set the region name
procedure Set_Name (Object : in out Region_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Region_Ref;
Value : in String);
-- Get the region name
function Get_Name (Object : in Region_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Region_Ref)
return String;
-- Set the region geonameid
procedure Set_Geonameid (Object : in out Region_Ref;
Value : in Integer);
-- Get the region geonameid
function Get_Geonameid (Object : in Region_Ref)
return Integer;
-- Set the country that this region belongs to
procedure Set_Country (Object : in out Region_Ref;
Value : in AWA.Countries.Models.Country_Ref'Class);
-- Get the country that this region belongs to
function Get_Country (Object : in Region_Ref)
return AWA.Countries.Models.Country_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Region_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Region_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Region_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Region_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Region_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Region_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
REGION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Region_Ref);
-- Copy of the object.
procedure Copy (Object : in Region_Ref;
Into : in out Region_Ref);
private
COUNTRY_NAME : aliased constant String := "awa_country";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "name";
COL_2_1_NAME : aliased constant String := "continent";
COL_3_1_NAME : aliased constant String := "currency";
COL_4_1_NAME : aliased constant String := "iso_code";
COL_5_1_NAME : aliased constant String := "geonameid";
COL_6_1_NAME : aliased constant String := "languages";
COL_7_1_NAME : aliased constant String := "tld";
COL_8_1_NAME : aliased constant String := "currency_code";
COUNTRY_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 9,
Table => COUNTRY_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access)
);
COUNTRY_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= COUNTRY_DEF'Access;
Null_Country : constant Country_Ref
:= Country_Ref'(ADO.Objects.Object_Ref with null record);
type Country_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => COUNTRY_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Continent : Ada.Strings.Unbounded.Unbounded_String;
Currency : Ada.Strings.Unbounded.Unbounded_String;
Iso_Code : Ada.Strings.Unbounded.Unbounded_String;
Geonameid : Integer;
Languages : Ada.Strings.Unbounded.Unbounded_String;
Tld : Ada.Strings.Unbounded.Unbounded_String;
Currency_Code : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Country_Access is access all Country_Impl;
overriding
procedure Destroy (Object : access Country_Impl);
overriding
procedure Find (Object : in out Country_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Country_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Country_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Country_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Country_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Country_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Country_Ref'Class;
Impl : out Country_Access);
CITY_NAME : aliased constant String := "awa_city";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "name";
COL_2_2_NAME : aliased constant String := "zip_code";
COL_3_2_NAME : aliased constant String := "latitude";
COL_4_2_NAME : aliased constant String := "longitude";
COL_5_2_NAME : aliased constant String := "region_id";
COL_6_2_NAME : aliased constant String := "country_id";
CITY_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 7,
Table => CITY_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access,
6 => COL_5_2_NAME'Access,
7 => COL_6_2_NAME'Access)
);
CITY_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= CITY_DEF'Access;
Null_City : constant City_Ref
:= City_Ref'(ADO.Objects.Object_Ref with null record);
type City_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => CITY_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Zip_Code : Integer;
Latitude : Integer;
Longitude : Integer;
Region : AWA.Countries.Models.Region_Ref;
Country : AWA.Countries.Models.Country_Ref;
end record;
type City_Access is access all City_Impl;
overriding
procedure Destroy (Object : access City_Impl);
overriding
procedure Find (Object : in out City_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out City_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out City_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out City_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out City_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out City_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out City_Ref'Class;
Impl : out City_Access);
COUNTRY_NEIGHBOR_NAME : aliased constant String := "awa_country_neighbor";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "neighbor_of_id";
COL_2_3_NAME : aliased constant String := "neighbor_id";
COUNTRY_NEIGHBOR_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => COUNTRY_NEIGHBOR_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access)
);
COUNTRY_NEIGHBOR_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= COUNTRY_NEIGHBOR_DEF'Access;
Null_Country_Neighbor : constant Country_Neighbor_Ref
:= Country_Neighbor_Ref'(ADO.Objects.Object_Ref with null record);
type Country_Neighbor_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => COUNTRY_NEIGHBOR_DEF'Access)
with record
Neighbor_Of : AWA.Countries.Models.Country_Ref;
Neighbor : AWA.Countries.Models.Country_Ref;
end record;
type Country_Neighbor_Access is access all Country_Neighbor_Impl;
overriding
procedure Destroy (Object : access Country_Neighbor_Impl);
overriding
procedure Find (Object : in out Country_Neighbor_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Country_Neighbor_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Country_Neighbor_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Country_Neighbor_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Country_Neighbor_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Country_Neighbor_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Country_Neighbor_Ref'Class;
Impl : out Country_Neighbor_Access);
REGION_NAME : aliased constant String := "awa_region";
COL_0_4_NAME : aliased constant String := "id";
COL_1_4_NAME : aliased constant String := "name";
COL_2_4_NAME : aliased constant String := "geonameid";
COL_3_4_NAME : aliased constant String := "country_id";
REGION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => REGION_NAME'Access,
Members => (
1 => COL_0_4_NAME'Access,
2 => COL_1_4_NAME'Access,
3 => COL_2_4_NAME'Access,
4 => COL_3_4_NAME'Access)
);
REGION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= REGION_DEF'Access;
Null_Region : constant Region_Ref
:= Region_Ref'(ADO.Objects.Object_Ref with null record);
type Region_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => REGION_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Geonameid : Integer;
Country : AWA.Countries.Models.Country_Ref;
end record;
type Region_Access is access all Region_Impl;
overriding
procedure Destroy (Object : access Region_Impl);
overriding
procedure Find (Object : in out Region_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Region_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Region_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Region_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Region_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Region_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Region_Ref'Class;
Impl : out Region_Access);
end AWA.Countries.Models;
|
gerr135/kdevelop_templates | Ada | 1,282 | ads | {% load kdev_filters %}
{% block license_header %}
{% if license %}
--
{{ license|lines_prepend:"-- " }}
--
{% endif %}
{% endblock license_header %}
generic
{% for m in members %}
type {{ m.name }} is {{ m.type|default:"private" }};
{% endfor %}
with function Img(E : Key_Type) return String;
package {{ name }} is
Debug : Boolean := False;
-- set this to True to get some reporting on the go..
type {{ name }} is {% if base_classes %}new {% for inh in base_classes %}{{ inh.baseType }}{% if not forloop.last %} and {% endif %}{% endfor %} with {% endif %}private;
{% for f in functions %}
{% with f.arguments as arguments %}
{% if f.returnType %}
function {{ f.name }} ({% include "arguments_types_names.txt" %}) return {{ f.returnType }};
{% else %}
procedure {{ f.name }}({% include "arguments_types_names.txt" %});
{% endif %}
{% endwith %}
{% endfor %}
private
type {{ name }} is {% if base_classes %}new {% for inh in base_classes %}{{ inh.baseType }}{% if not forloop.last %} and {% endif %}{% endfor %} with {% endif %}record
-- entries here
end record;
{% for method in methods %}
procedure {{ method.name }}({% include "arguments_names.txt" %});
{% endfor %}
end {{ name }};
|
kjseefried/coreland-cgbc | Ada | 798 | adb | with Ada.Strings;
with CGBC.Bounded_Wide_Wide_Strings;
with Test;
procedure T_WWBstr_Append_R01 is
package BS renames CGBC.Bounded_Wide_Wide_Strings;
TC : Test.Context_t;
S1 : BS.Bounded_String (8);
begin
Test.Initialize
(Test_Context => TC,
Program => "t_wwbstr_append_r01",
Test_DB => "TEST_DB",
Test_Results => "TEST_RESULTS");
BS.Append (S1, "ABCD");
-- Right requires truncation.
BS.Append
(Source => S1,
New_Item => "012345678",
Drop => Ada.Strings.Right);
Test.Check (TC, 2283, BS.Length (S1) = 8, "BS.Length (S1) = 8");
Test.Check (TC, 2284, BS.Maximum_Length (S1) = 8, "BS.Maximum_Length (S1) = 8");
Test.Check (TC, 2285, BS.To_String (S1) = "ABCD0123", "BS.To_String (S1) = ""ABCD0123""");
end T_WWBstr_Append_R01;
|
AdaCore/langkit | Ada | 697 | adb | with Langkit_Support.Adalog.Main_Support;
use Langkit_Support.Adalog.Main_Support;
-- Test N predicates - in this case a predicate applying on two logic
-- variables.
procedure Main is
use T_Solver, Refs, Solver_Ifc;
function Double_Of (Vals : Value_Array) return Boolean
is (Vals (1) = Vals (2) * 2);
X : constant Refs.Logic_Var := Create ("X");
Y : constant Refs.Logic_Var := Create ("Y");
R3 : constant Relation :=
"and" (+Create_N_Predicate
((X, Y),
N_Predicate (Double_Of'Access, 2, "Double_Of")),
"and" (Domain (X, (1, 2, 3, 4, 5, 6)),
Domain (Y, (1, 2, 3, 4, 5, 6))));
begin
Solve_All (R3);
end Main;
|
AdaCore/Ada_Drivers_Library | Ada | 5,072 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- The file declares the main procedure for the demonstration. The
-- demonstration copies memory from one location to another, using DMA.
with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
-- The "last chance handler" is an AdaCore-defined routine that is called when
-- an exception is propagated. This specific version is an overriding of the
-- predefined version. We need it in the executable but never call it directly
-- so it must be somewhere in the closure of the context clauses.
with STM32.Board; use STM32.Board;
with STM32.Device; use STM32.Device;
with Ada.Real_Time; use Ada.Real_Time;
with STM32.DMA; use STM32.DMA;
with STM32.GPIO; use STM32.GPIO;
with Peripherals; use Peripherals;
procedure Demo_DMA_Interrupts is
type Data is array (1 .. 100) of Integer; -- arbitrary size and type
Source_Block : constant Data := (others => 42);
Destination_Block : Data := (others => 0);
Config : DMA_Stream_Configuration;
Event_Kind : DMA_Interrupt;
begin
Initialize_LEDs;
-- just to signal that we are indeed running...
for K in 1 .. 3 loop
All_LEDs_On;
delay until Clock + Milliseconds (200);
All_LEDs_Off;
delay until Clock + Milliseconds (200);
end loop;
Enable_Clock (Controller);
Reset (Controller, Stream);
Config.Channel := Channel_0;
Config.Direction := Memory_To_Memory;
Config.Operation_Mode := Normal_Mode;
Config.Priority := Priority_Medium;
Config.Memory_Data_Format := Words;
Config.Peripheral_Data_Format := Words;
Config.Increment_Memory_Address := True;
Configure (Controller, Stream, Config);
-- note the controller is disabled by the call to Configure
Clear_All_Status (Controller, Stream);
-- disabling the stream sets the Transfer Complete bit
Start_Transfer_with_Interrupts
(Controller,
Stream,
Source => Source_Block'Address,
Destination => Destination_Block'Address,
Data_Count => Data'Length); -- Integer is same size as Word
IRQ_Handler.Await_Event (Event_Kind);
-- NB: the TC interrupt is now disabled if we are not in Circular mode
if Event_Kind in Direct_Mode_Error_Interrupt | FIFO_Error_Interrupt | Transfer_Error_Interrupt then
-- signal the problem and loop forever
loop
Green_LED.Toggle;
delay until Clock + Milliseconds (200);
end loop;
end if;
if Source_Block = Destination_Block then
Turn_On (Green_LED);
else
Turn_On (Red_LED);
end if;
loop
null; -- normal completion
end loop;
end Demo_DMA_Interrupts;
|
reznikmm/matreshka | Ada | 21,123 | 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_Composite_Structure_Diagrams;
with AMF.UMLDI.UML_Labels;
with AMF.UMLDI.UML_Styles;
with AMF.Visitors;
with League.Strings;
package AMF.Internals.UMLDI_UML_Composite_Structure_Diagrams is
type UMLDI_UML_Composite_Structure_Diagram_Proxy is
limited new AMF.Internals.UMLDI_UML_Diagrams.UMLDI_UML_Diagram_Proxy
and AMF.UMLDI.UML_Composite_Structure_Diagrams.UMLDI_UML_Composite_Structure_Diagram with null record;
overriding function Get_Is_Association_Dot_Shown
(Self : not null access constant UMLDI_UML_Composite_Structure_Diagram_Proxy)
return Boolean;
-- Getter of UMLClassOrCompositeStructureDiagram::isAssociationDotShown.
--
-- Indicates whether dot notation for associations shall be used.
overriding procedure Set_Is_Association_Dot_Shown
(Self : not null access UMLDI_UML_Composite_Structure_Diagram_Proxy;
To : Boolean);
-- Setter of UMLClassOrCompositeStructureDiagram::isAssociationDotShown.
--
-- Indicates whether dot notation for associations shall be used.
overriding function Get_Navigability_Notation
(Self : not null access constant UMLDI_UML_Composite_Structure_Diagram_Proxy)
return AMF.UMLDI.UMLDI_UML_Navigability_Notation_Kind;
-- Getter of UMLClassOrCompositeStructureDiagram::navigabilityNotation.
--
-- Indicates when to show navigability of associations or connectors typed
-- by associations.
overriding procedure Set_Navigability_Notation
(Self : not null access UMLDI_UML_Composite_Structure_Diagram_Proxy;
To : AMF.UMLDI.UMLDI_UML_Navigability_Notation_Kind);
-- Setter of UMLClassOrCompositeStructureDiagram::navigabilityNotation.
--
-- Indicates when to show navigability of associations or connectors typed
-- by associations.
overriding function Get_Non_Navigability_Notation
(Self : not null access constant UMLDI_UML_Composite_Structure_Diagram_Proxy)
return AMF.UMLDI.UMLDI_UML_Navigability_Notation_Kind;
-- Getter of UMLClassOrCompositeStructureDiagram::nonNavigabilityNotation.
--
-- Indicates when to show non-navigability of associations or connectors
-- typed by associations.
overriding procedure Set_Non_Navigability_Notation
(Self : not null access UMLDI_UML_Composite_Structure_Diagram_Proxy;
To : AMF.UMLDI.UMLDI_UML_Navigability_Notation_Kind);
-- Setter of UMLClassOrCompositeStructureDiagram::nonNavigabilityNotation.
--
-- Indicates when to show non-navigability of associations or connectors
-- typed by associations.
overriding function Get_Heading
(Self : not null access constant UMLDI_UML_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_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_Composite_Structure_Diagrams;
|
aeszter/sharepoint2ics | Ada | 5,285 | adb | with Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Strings.Fixed;
with POSIX;
with DOM.Core;
with DOM.Core.Documents;
with DOM.Readers;
with Sax.Readers;
with CGI;
with Convert;
with Pipe_Streams; use Pipe_Streams;
with Utils;
procedure Seminar.Main is
use Ada.Command_Line;
procedure Append (Source : in out POSIX.POSIX_String_List;
New_Item : String);
procedure Append (Source : in out POSIX.POSIX_String_List;
New_Item : Unbounded_String);
Version : constant String := "v0.3";
Config_File : Ada.Text_IO.File_Type;
Wget_Command : Pipe_Stream;
Reader : DOM.Readers.Tree_Reader;
Sharepoint_Reply : DOM.Core.Document;
Wget_Path : Unbounded_String;
User_Name, Password : Unbounded_String;
URL, Request : Unbounded_String;
Arguments : POSIX.POSIX_String_List;
Config_Path : constant String := CGI.Get_Environment ("CONFIG_FILE");
Config_Error, Parser_Error : exception;
procedure Append (Source : in out POSIX.POSIX_String_List;
New_Item : String) is
use POSIX;
begin
Append (Source, To_POSIX_String (New_Item));
end Append;
procedure Append (Source : in out POSIX.POSIX_String_List;
New_Item : Unbounded_String) is
use POSIX;
begin
Append (Source, To_POSIX_String (To_String (New_Item)));
end Append;
-- AWS does not support NTLM, so we rely on wget to perform the actual SOAP call;
--
begin
if Argument_Count = 0 and then
Config_Path /= ""
then
-- read config:
Open (Config_File, In_File, Config_Path);
while not Ada.Text_IO.End_Of_File (Config_File) loop
declare
use Ada.Strings;
use Ada.Strings.Fixed;
Config_Line : constant String := Get_Line (Config_File);
Separator : constant Natural := Index (Source => Config_Line,
Pattern => "=");
Name : constant String :=
Trim (Config_Line (1 .. Separator - 1), Right);
Value : constant String :=
Trim (Config_Line (Separator + 1 .. Config_Line'Last),
Left);
begin
if Name = "" then
null; -- empty line
elsif Name (1) = '#' then
null; -- comment
elsif Name = "wget" then
Wget_Path := To_Unbounded_String (Value);
elsif Name = "username" then
User_Name := To_Unbounded_String (Value);
elsif Name = "password" then
Password := To_Unbounded_String (Value);
elsif Name = "url" then
URL := To_Unbounded_String (Value);
elsif Name = "request" then
Request := To_Unbounded_String (Value);
elsif Name = "timezone" then
Utils.Timezone := To_Unbounded_String (Value);
else
raise Config_Error with
"Unknown name """ & Name & """";
end if;
end;
end loop;
Ada.Text_IO.Close (Config_File);
-- call wget:
Wget_Command.Set_Public_Id (To_String (Wget_Path));
Append (Arguments, Wget_Path);
Append (Arguments, "--user=" & User_Name);
Append (Arguments, "--password=" & Password);
Append (Arguments, "--post-file=" & Request);
Append (Arguments, "--header=Content-Type: text/xml;charset=UTF-8");
Append (Arguments, "--header=SOAPAction: ""http://schemas.microsoft.com/sharepoint/soap/GetListItems""");
Append (Arguments, URL);
Append (Arguments, "-O-");
Wget_Command.Execute (Command => To_String (Wget_Path),
Arguments => Arguments);
Reader.Set_Feature (Sax.Readers.Validation_Feature, False);
Reader.Set_Feature (Sax.Readers.Namespace_Feature, False);
Reader.Parse (Wget_Command);
Wget_Command.Close;
Sharepoint_Reply := Reader.Get_Tree;
CGI.Put_CGI_Header ("Content-type: text/calendar");
Convert (DOM.Core.Documents.Get_Elements_By_Tag_Name (
Sharepoint_Reply, "rs:data"),
Ada.Text_IO.Standard_Output);
DOM.Readers.Free (Reader);
else
Ada.Text_IO.Put_Line ("sharepoint2ics " & Version & " config_file");
Ada.Text_IO.Put_Line ("Usage: " & Command_Name);
Ada.Text_IO.Put_Line (" config is read from the file at $CONFIG_FILE ");
end if;
exception
when Pipe_Streams.Failed_Creation_Error =>
raise Parser_Error with "Failed to spawn """ & To_String (Wget_Path);
when Pipe_Streams.Exception_Error =>
raise Parser_Error with """" & To_String (Wget_Path)
& """ terminated because of an unhandled exception";
when E : Sax.Readers.XML_Fatal_Error =>
raise Parser_Error with "Fatal XML error: " & Exception_Message (E);
when E : others => raise Parser_Error with "Error when calling "
& To_String (Wget_Path) & ": "
& Exception_Message (E);
end Seminar.Main;
|
zhmu/ananas | Ada | 2,838 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . E N C O D E _ U T F 8 _ S T R I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 2007-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a pre-instantiation of GNAT.Encode_String for the
-- common case of UTF-8 encoding. As noted in the documentation of that
-- package, this UTF-8 instantiation is efficient and specialized so that
-- it has only the code for the UTF-8 case. See g-encstr.ads for full
-- documentation on this package.
with GNAT.Encode_String;
with System.WCh_Con;
package GNAT.Encode_UTF8_String is
new GNAT.Encode_String (System.WCh_Con.WCEM_UTF8);
|
reznikmm/matreshka | Ada | 3,759 | 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.Elements;
package ODF.DOM.Text_Alphabetical_Index_Mark_End_Elements is
pragma Preelaborate;
type ODF_Text_Alphabetical_Index_Mark_End is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_Alphabetical_Index_Mark_End_Access is
access all ODF_Text_Alphabetical_Index_Mark_End'Class
with Storage_Size => 0;
end ODF.DOM.Text_Alphabetical_Index_Mark_End_Elements;
|
MinimSecure/unum-sdk | Ada | 889 | adb | -- Copyright 2015-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo_NA09_042 is
R1 : Record_Type := Ident (A1 (3));
begin
Do_Nothing (A1'Address); -- STOP
Do_Nothing (R1'Address);
end Foo_NA09_042;
|
io7m/coreland-serial_io | Ada | 1,479 | adb | with Ada.Streams.Stream_IO;
with Serial_IO;
with Test;
procedure T_16_01 is
package Stream_IO renames Ada.Streams.Stream_IO;
use type Serial_IO.Unsigned_16_t;
Output : Stream_IO.File_Type;
Input : Stream_IO.File_Type;
V : Serial_IO.Unsigned_16_t;
begin
Stream_IO.Create
(Name => "t_16_01.dat",
Mode => Stream_IO.Out_File,
File => Output);
Serial_IO.Unsigned_16_t'Output (Stream_IO.Stream (Output), 16#ffff#);
Serial_IO.Unsigned_16_t'Output (Stream_IO.Stream (Output), 16#7fff#);
Serial_IO.Unsigned_16_t'Output (Stream_IO.Stream (Output), 16#00ff#);
Serial_IO.Unsigned_16_t'Output (Stream_IO.Stream (Output), 16#007f#);
Serial_IO.Unsigned_16_t'Output (Stream_IO.Stream (Output), 16#0000#);
pragma Warnings (Off);
Stream_IO.Close (Output);
pragma Warnings (On);
Stream_IO.Open
(Name => "t_16_01.dat",
Mode => Stream_IO.In_File,
File => Input);
V := Serial_IO.Unsigned_16_t'Input (Stream_IO.Stream (Input));
Test.Assert (V = 16#ffff#);
V := Serial_IO.Unsigned_16_t'Input (Stream_IO.Stream (Input));
Test.Assert (V = 16#7fff#);
V := Serial_IO.Unsigned_16_t'Input (Stream_IO.Stream (Input));
Test.Assert (V = 16#00ff#);
V := Serial_IO.Unsigned_16_t'Input (Stream_IO.Stream (Input));
Test.Assert (V = 16#007f#);
V := Serial_IO.Unsigned_16_t'Input (Stream_IO.Stream (Input));
Test.Assert (V = 16#0000#);
pragma Warnings (Off);
Stream_IO.Close (Input);
pragma Warnings (On);
end T_16_01;
|
io7m/coreland-jack-ada-doc | Ada | 6,248 | adb | with Jack.Client;
with Jack.Port;
pragma Elaborate_All (Jack.Client);
package body Simple_Client is
use type Jack.Client.Client_t;
use type Jack.Client.Port_t;
--
-- Various data declarations.
--
Jack_Client : Jack.Client.Client_t;
Port_Input : Jack.Client.Port_t;
Port_Output : Jack.Client.Port_t;
Input_Ports : Jack.Client.Port_Name_Set_t;
Output_Ports : Jack.Client.Port_Name_Set_t;
--
-- Declarations for a generic 'Process' callback. This callback is called
-- by the JACK library whenever any processing is required. The original
-- C version lacked type-safety, but this version remains type-safe through
-- the use of generics.
--
-- User_Data_t can be anything.
--
type User_Data_t is new Integer;
type User_Data_Access_t is access User_Data_t;
package Callbacks is new Jack.Client.Generic_Callbacks
(User_Data_Type => User_Data_t,
User_Data_Access_Type => User_Data_Access_t);
--
-- Process_Callback simply copies an input buffer to an output buffer. The
-- addresses returned by Jack.Port.Get_Buffer_Address come from the JACK
-- library itself and likely point to a region of POSIX of SysV shared memory.
-- The use of address overlays was necessary for efficiency and is entirely
-- safe in this context.
--
procedure Process_Callback
(Number_Of_Frames : in Jack.Client.Number_Of_Frames_t;
User_Data : in User_Data_Access_t)
is
type Buffer_t is array (0 .. Number_Of_Frames) of Float;
Input_Buffer : Buffer_t;
Output_Buffer : Buffer_t;
for Input_Buffer'Address use Jack.Port.Get_Buffer_Address (Port_Input, Number_Of_Frames);
for Output_Buffer'Address use Jack.Port.Get_Buffer_Address (Port_Output, Number_Of_Frames);
begin
pragma Assert (User_Data.all = 10);
Output_Buffer := Input_Buffer;
end Process_Callback;
Callback_State : constant Callbacks.Process_Callback_State_Access_t :=
new Callbacks.Process_Callback_State_t'
(Callback => Process_Callback'Access,
User_Data => new User_Data_t'(10));
--
-- All JACK setup happens here.
--
procedure Init_Jack is
Status : Jack.Client.Status_t := (others => False);
Failed : Boolean;
begin
--
-- Open a session to the JACK server. Specify that the server should
-- NOT be started if it's not already running.
--
Jack.Client.Open
(Client_Name => "simple_client_ada",
Options => Jack.Client.Options_t'
(Jack.Client.Do_Not_Start_Server => True,
others => False),
Client => Jack_Client,
Status => Status);
if Jack_Client = Jack.Client.Invalid_Client then
raise Program_Error with "could not open client";
end if;
--
-- Tell the library to call Process_Callback whenever there is processing
-- work to be done.
--
Callbacks.Set_Process_Callback
(Client => Jack_Client,
State => Callback_State,
Failed => Failed);
if Failed then
raise Program_Error with "could not set process callback";
end if;
--
-- Register a single input and output port with the server.
--
Jack.Client.Port_Register
(Client => Jack_Client,
Port => Port_Input,
Port_Name => Jack.Client.To_Port_Name ("input"),
Port_Type => Jack.Client.Default_Audio_Type,
Port_Flags => Jack.Client.Port_Flags_t'(Jack.Client.Port_Is_Input => True, others => False));
if Port_Input = Jack.Client.Invalid_Port then
raise Program_Error with "could not open input port";
end if;
Jack.Client.Port_Register
(Client => Jack_Client,
Port => Port_Output,
Port_Name => Jack.Client.To_Port_Name ("output"),
Port_Type => Jack.Client.Default_Audio_Type,
Port_Flags => Jack.Client.Port_Flags_t'(Jack.Client.Port_Is_Output => True, others => False));
if Port_Output = Jack.Client.Invalid_Port then
raise Program_Error with "could not open output port";
end if;
--
-- Inform the server that the client is ready for processing.
--
Jack.Client.Activate
(Client => Jack_Client,
Failed => Failed);
if Failed then
raise Program_Error with "could not activate client";
end if;
--
-- In order to give the client some actual work to do, Get_Ports is used
-- to locate all physical input and output ports (eg. sound hardware).
--
Jack.Client.Get_Ports
(Client => Jack_Client,
Port_Flags => Jack.Client.Port_Flags_t'
(Jack.Client.Port_Is_Physical => True,
Jack.Client.Port_Is_Input => True,
others => False),
Ports => Input_Ports);
Jack.Client.Get_Ports
(Client => Jack_Client,
Port_Flags => Jack.Client.Port_Flags_t'
(Jack.Client.Port_Is_Physical => True,
Jack.Client.Port_Is_Output => True,
others => False),
Ports => Output_Ports);
--
-- The client now connects it's own input port to the first physical
-- "output" port it found. An "output" in JACK terminology is something
-- like a microphone input.
--
Jack.Client.Connect
(Client => Jack_Client,
Source_Port => Jack.Client.Port_Name_Sets.First_Element (Output_Ports),
Destination_Port => Jack.Port.Name (Port_Input),
Failed => Failed);
if Failed then
raise Program_Error with "could not connect input port";
end if;
--
-- Connect the client output port to the first available physical "input".
-- In JACK terminology, an "input" is something like a soundcard output.
--
Jack.Client.Connect
(Client => Jack_Client,
Source_Port => Jack.Port.Name (Port_Output),
Destination_Port => Jack.Client.Port_Name_Sets.First_Element (Input_Ports),
Failed => Failed);
if Failed then
raise Program_Error with "could not connect output port";
end if;
--
-- Do 30 seconds of processing.
--
delay 30.0;
end Init_Jack;
procedure Run is
begin
Init_Jack;
end Run;
end Simple_Client;
|
reznikmm/matreshka | Ada | 6,940 | 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_Form.Formatted_Text_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Form_Formatted_Text_Element_Node is
begin
return Self : Form_Formatted_Text_Element_Node do
Matreshka.ODF_Form.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Form_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Form_Formatted_Text_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_Form_Formatted_Text
(ODF.DOM.Form_Formatted_Text_Elements.ODF_Form_Formatted_Text_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 Form_Formatted_Text_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Formatted_Text_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Form_Formatted_Text_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_Form_Formatted_Text
(ODF.DOM.Form_Formatted_Text_Elements.ODF_Form_Formatted_Text_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 Form_Formatted_Text_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_Form_Formatted_Text
(Visitor,
ODF.DOM.Form_Formatted_Text_Elements.ODF_Form_Formatted_Text_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.Form_URI,
Matreshka.ODF_String_Constants.Formatted_Text_Element,
Form_Formatted_Text_Element_Node'Tag);
end Matreshka.ODF_Form.Formatted_Text_Elements;
|
sparre/Command-Line-Parser-Generator | Ada | 838 | adb | package body An_Application.Command_Line_Parser.Key_List is
function "+" (Left : in Instance;
Right : in String) return Instance is
begin
return Result : Instance := Left do
Result.Insert (Right);
end return;
end "+";
function "+" (Right : in String) return Instance is
begin
return Result : Instance do
Result.Insert (Right);
end return;
end "+";
function "=" (Left : in Argument_List.Instance;
Right : in Instance) return Boolean is
use type Ada.Containers.Count_Type;
begin
for Key of Right loop
if not Left.Contains (Key) then
return False;
end if;
end loop;
return Left.Length = Right.Length;
end "=";
end An_Application.Command_Line_Parser.Key_List;
|
burratoo/Acton | Ada | 2,715 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAK CORE SUPPORT PACKAGE --
-- ARM CORTEX M4F --
-- --
-- ISA.ARM.CORTEX_M4.DWT --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with System; use System;
package ISA.ARM.Cortex_M4.DWT with Preelaborate is
--------------------------
-- DWT Memory Addresses --
--------------------------
DWT_Base_Address : constant := 16#E000_1000#;
CTRL_Offset_Address : constant := 16#0#;
CYCCNT_Offset_Address : constant := 16#4#;
-----------------------
-- Hardware Features --
-----------------------
type Comparator_Count is mod 2 ** 4;
---------------
-- DWT Types --
---------------
type Support_Type is (Supported, Not_Supported);
type Sync_Counter_Tap is (None, Clock_Divide_By_16M, Clock_Divide_By_64M,
Clock_Divide_By_256M);
type Control_Type is record
Number_Of_Comparitors : Comparator_Count;
Exception_Trace : Enable_Type;
Sync_Counter_Tap_At : Sync_Counter_Tap;
Cycle_Count : Enable_Type;
end record;
type Cycle_Count is mod 2 ** 32;
type Cycle_Count_Type is record
Count : Cycle_Count;
end record;
------------------------------
-- Hardware Representations --
------------------------------
for Control_Type use record
Number_Of_Comparitors at 0 range 28 .. 31;
Exception_Trace at 0 range 16 .. 16;
Sync_Counter_Tap_At at 0 range 10 .. 11;
Cycle_Count at 0 range 0 .. 0;
end record;
for Cycle_Count_Type use record
Count at 0 range 0 .. 31;
end record;
-------------------
-- DWT Registers --
-------------------
Control_Register : Control_Type
with Address =>
System'To_Address (DWT_Base_Address + CTRL_Offset_Address);
Cycle_Count_Register : Cycle_Count_Type
with Address =>
System'To_Address (DWT_Base_Address + CYCCNT_Offset_Address);
end ISA.ARM.Cortex_M4.DWT;
|
zhmu/ananas | Ada | 128 | ads | package Opt64_PKG is
type Hash is new string (1 .. 1);
Last_Hash : Hash;
procedure Encode (X : Integer);
end;
|
riccardo-bernardini/eugen | Ada | 3,234 | ads | -- -*- Mode: Ada -*-
-- Filename : tokenize.ads
-- Description : Ruby-like split
-- Author : Finta Tartaruga
-- Created On : Tue Sep 11 22:05:53 2007
-- Last Modified By: R. Bernardini
-- Last Modified On: November 14, 2007
-- Update Count : 1
-- Status : <TESTED>
--
-- This package provides a function Split which divides its input
-- string in smaller strings, separated by a "separator" (much as the
-- split function in Perl, Ruby, and so on...). Function Split returns
-- a Token_List (defined by this package) whose elements can be accessed
-- by the function Element.
--
-- Function Split can accept a third Boolean value Collate_Separator.
-- If Collate_Separator is true, consecutive istances of the separator are
-- considered as a single one. If Collate_Separator is False, for every
-- pair of consecutive separator characters an empty string will be returned.
-- Moreover, if Collate_Separator is True, any separator at the beginning of
-- the string is ignored. Separators at the end are always ignored.
--
-- The default value of Collate_Separator is true if the separator
-- is the space, false otherwise.
--
-- Examples:
--
-- Split("Hello there") returns "Hello" and "there"
-- Split("Hello there", ' ', False) returns "Hello", "" and "there"
-- Split("Hello::there", ':') returns "Hello", "" and "there"
-- Split("Hello::there", ':', True) returns "Hello" and "there"
--
with Ada.Containers.Indefinite_Vectors;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
package Tokenize is
package String_Vectors is
new Ada.Containers.Indefinite_Vectors(Index_Type => Positive,
Element_Type => String);
subtype Token_List is String_Vectors.Vector;
type Token_Array is array (Positive range <>) of Unbounded_String;
--
-- Split string To_Be_Splitted in substring separated by
-- Separator. If Collate_Separator is true consider consecutive
-- istances of Separator as a single one
--
function Split(To_Be_Splitted : String;
Separator : Character;
Collate_Separator : Boolean) return Token_List;
function Split (To_Be_Splitted : String;
Separators : String;
Collate_Separator : Boolean) return Token_List;
--
-- Similar to the three-parameter version, but the Separator
-- char defaults to the space and Collate_Separator is True
-- if Separator is the space, false otherwise
--
function Split(To_Be_Splitted : String;
Separator : Character := ' ') return Token_List;
function Split (To_Be_Splitted : String;
Separator : Character := ' ') return Token_Array;
--
-- Return the Index-th token
--
function Element (Container : Token_List;
Index : Positive) return String
renames String_Vectors.Element;
--
-- Return the number of tokens
--
function Length(Container : Token_List) return Natural;
function To_Array (List : Token_List) return Token_Array;
end Tokenize;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 9,704 | ads | -- This spec has been automatically generated from STM32F0xx.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.CEC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_CECEN_Field is STM32_SVD.Bit;
subtype CR_TXSOM_Field is STM32_SVD.Bit;
subtype CR_TXEOM_Field is STM32_SVD.Bit;
-- control register
type CR_Register is record
-- CEC Enable
CECEN : CR_CECEN_Field := 16#0#;
-- Tx start of message
TXSOM : CR_TXSOM_Field := 16#0#;
-- Tx End Of Message
TXEOM : CR_TXEOM_Field := 16#0#;
-- unspecified
Reserved_3_31 : STM32_SVD.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
CECEN at 0 range 0 .. 0;
TXSOM at 0 range 1 .. 1;
TXEOM at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype CFGR_OAR_Field is STM32_SVD.UInt4;
subtype CFGR_LSTN_Field is STM32_SVD.Bit;
subtype CFGR_SFT_Field is STM32_SVD.UInt3;
subtype CFGR_RXTOL_Field is STM32_SVD.Bit;
subtype CFGR_BRESTP_Field is STM32_SVD.Bit;
subtype CFGR_BREGEN_Field is STM32_SVD.Bit;
subtype CFGR_LBPEGEN_Field is STM32_SVD.Bit;
-- configuration register
type CFGR_Register is record
-- Own Address
OAR : CFGR_OAR_Field := 16#0#;
-- Listen mode
LSTN : CFGR_LSTN_Field := 16#0#;
-- Signal Free Time
SFT : CFGR_SFT_Field := 16#0#;
-- Rx-Tolerance
RXTOL : CFGR_RXTOL_Field := 16#0#;
-- Rx-stop on bit rising error
BRESTP : CFGR_BRESTP_Field := 16#0#;
-- Generate error-bit on bit rising error
BREGEN : CFGR_BREGEN_Field := 16#0#;
-- Generate Error-Bit on Long Bit Period Error
LBPEGEN : CFGR_LBPEGEN_Field := 16#0#;
-- unspecified
Reserved_12_31 : STM32_SVD.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFGR_Register use record
OAR at 0 range 0 .. 3;
LSTN at 0 range 4 .. 4;
SFT at 0 range 5 .. 7;
RXTOL at 0 range 8 .. 8;
BRESTP at 0 range 9 .. 9;
BREGEN at 0 range 10 .. 10;
LBPEGEN at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype TXDR_TXD_Field is STM32_SVD.Byte;
-- Tx data register
type TXDR_Register is record
-- Write-only. Tx Data register
TXD : TXDR_TXD_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 TXDR_Register use record
TXD at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype RXDR_RXDR_Field is STM32_SVD.Byte;
-- Rx Data Register
type RXDR_Register is record
-- Read-only. CEC Rx Data Register
RXDR : RXDR_RXDR_Field;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RXDR_Register use record
RXDR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype ISR_RXBR_Field is STM32_SVD.Bit;
subtype ISR_RXEND_Field is STM32_SVD.Bit;
subtype ISR_RXOVR_Field is STM32_SVD.Bit;
subtype ISR_BRE_Field is STM32_SVD.Bit;
subtype ISR_SBPE_Field is STM32_SVD.Bit;
subtype ISR_LBPE_Field is STM32_SVD.Bit;
subtype ISR_RXACKE_Field is STM32_SVD.Bit;
subtype ISR_ARBLST_Field is STM32_SVD.Bit;
subtype ISR_TXBR_Field is STM32_SVD.Bit;
subtype ISR_TXEND_Field is STM32_SVD.Bit;
subtype ISR_TXUDR_Field is STM32_SVD.Bit;
subtype ISR_TXERR_Field is STM32_SVD.Bit;
subtype ISR_TXACKE_Field is STM32_SVD.Bit;
-- Interrupt and Status Register
type ISR_Register is record
-- Rx-Byte Received
RXBR : ISR_RXBR_Field := 16#0#;
-- End Of Reception
RXEND : ISR_RXEND_Field := 16#0#;
-- Rx-Overrun
RXOVR : ISR_RXOVR_Field := 16#0#;
-- Rx-Bit rising error
BRE : ISR_BRE_Field := 16#0#;
-- Rx-Short Bit period error
SBPE : ISR_SBPE_Field := 16#0#;
-- Rx-Long Bit Period Error
LBPE : ISR_LBPE_Field := 16#0#;
-- Rx-Missing Acknowledge
RXACKE : ISR_RXACKE_Field := 16#0#;
-- Arbitration Lost
ARBLST : ISR_ARBLST_Field := 16#0#;
-- Tx-Byte Request
TXBR : ISR_TXBR_Field := 16#0#;
-- End of Transmission
TXEND : ISR_TXEND_Field := 16#0#;
-- Tx-Buffer Underrun
TXUDR : ISR_TXUDR_Field := 16#0#;
-- Tx-Error
TXERR : ISR_TXERR_Field := 16#0#;
-- Tx-Missing acknowledge error
TXACKE : ISR_TXACKE_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
RXBR at 0 range 0 .. 0;
RXEND at 0 range 1 .. 1;
RXOVR at 0 range 2 .. 2;
BRE at 0 range 3 .. 3;
SBPE at 0 range 4 .. 4;
LBPE at 0 range 5 .. 5;
RXACKE at 0 range 6 .. 6;
ARBLST at 0 range 7 .. 7;
TXBR at 0 range 8 .. 8;
TXEND at 0 range 9 .. 9;
TXUDR at 0 range 10 .. 10;
TXERR at 0 range 11 .. 11;
TXACKE at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype IER_RXBRIE_Field is STM32_SVD.Bit;
subtype IER_RXENDIE_Field is STM32_SVD.Bit;
subtype IER_RXOVRIE_Field is STM32_SVD.Bit;
subtype IER_BREIE_Field is STM32_SVD.Bit;
subtype IER_SBPEIE_Field is STM32_SVD.Bit;
subtype IER_LBPEIE_Field is STM32_SVD.Bit;
subtype IER_RXACKIE_Field is STM32_SVD.Bit;
subtype IER_ARBLSTIE_Field is STM32_SVD.Bit;
subtype IER_TXBRIE_Field is STM32_SVD.Bit;
subtype IER_TXENDIE_Field is STM32_SVD.Bit;
subtype IER_TXUDRIE_Field is STM32_SVD.Bit;
subtype IER_TXERRIE_Field is STM32_SVD.Bit;
subtype IER_TXACKIE_Field is STM32_SVD.Bit;
-- interrupt enable register
type IER_Register is record
-- Rx-Byte Received Interrupt Enable
RXBRIE : IER_RXBRIE_Field := 16#0#;
-- End Of Reception Interrupt Enable
RXENDIE : IER_RXENDIE_Field := 16#0#;
-- Rx-Buffer Overrun Interrupt Enable
RXOVRIE : IER_RXOVRIE_Field := 16#0#;
-- Bit Rising Error Interrupt Enable
BREIE : IER_BREIE_Field := 16#0#;
-- Short Bit Period Error Interrupt Enable
SBPEIE : IER_SBPEIE_Field := 16#0#;
-- Long Bit Period Error Interrupt Enable
LBPEIE : IER_LBPEIE_Field := 16#0#;
-- Rx-Missing Acknowledge Error Interrupt Enable
RXACKIE : IER_RXACKIE_Field := 16#0#;
-- Arbitration Lost Interrupt Enable
ARBLSTIE : IER_ARBLSTIE_Field := 16#0#;
-- Tx-Byte Request Interrupt Enable
TXBRIE : IER_TXBRIE_Field := 16#0#;
-- Tx-End of message interrupt enable
TXENDIE : IER_TXENDIE_Field := 16#0#;
-- Tx-Underrun interrupt enable
TXUDRIE : IER_TXUDRIE_Field := 16#0#;
-- Tx-Error Interrupt Enable
TXERRIE : IER_TXERRIE_Field := 16#0#;
-- Tx-Missing Acknowledge Error Interrupt Enable
TXACKIE : IER_TXACKIE_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
RXBRIE at 0 range 0 .. 0;
RXENDIE at 0 range 1 .. 1;
RXOVRIE at 0 range 2 .. 2;
BREIE at 0 range 3 .. 3;
SBPEIE at 0 range 4 .. 4;
LBPEIE at 0 range 5 .. 5;
RXACKIE at 0 range 6 .. 6;
ARBLSTIE at 0 range 7 .. 7;
TXBRIE at 0 range 8 .. 8;
TXENDIE at 0 range 9 .. 9;
TXUDRIE at 0 range 10 .. 10;
TXERRIE at 0 range 11 .. 11;
TXACKIE at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- HDMI-CEC controller
type CEC_Peripheral is record
-- control register
CR : aliased CR_Register;
-- configuration register
CFGR : aliased CFGR_Register;
-- Tx data register
TXDR : aliased TXDR_Register;
-- Rx Data Register
RXDR : aliased RXDR_Register;
-- Interrupt and Status Register
ISR : aliased ISR_Register;
-- interrupt enable register
IER : aliased IER_Register;
end record
with Volatile;
for CEC_Peripheral use record
CR at 16#0# range 0 .. 31;
CFGR at 16#4# range 0 .. 31;
TXDR at 16#8# range 0 .. 31;
RXDR at 16#C# range 0 .. 31;
ISR at 16#10# range 0 .. 31;
IER at 16#14# range 0 .. 31;
end record;
-- HDMI-CEC controller
CEC_Periph : aliased CEC_Peripheral
with Import, Address => System'To_Address (16#40007800#);
end STM32_SVD.CEC;
|
KLOC-Karsten/ada_projects | Ada | 7,406 | adb | -- Copyright (c) 2021, Karsten Lueth ([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:
--
-- 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.
--
--
-- Initial contribution by:
-- AdaCore
-- Ada Drivers Library (https://github.com/AdaCore/Ada_Drivers_Library)
-- Package: MMA8653
with Ada.Unchecked_Conversion;
package body LSM303AGR is
function Read_Register (This : LSM303AGR_Accelerometer'Class;
Addr : Register_Addresss) return UInt8;
procedure Write_Register (This : LSM303AGR_Accelerometer'Class;
Addr : Register_Addresss;
Val : UInt8);
-------------------
-- Read_Register --
-------------------
function Read_Register (This : LSM303AGR_Accelerometer'Class;
Addr : Register_Addresss) return UInt8
is
Data : I2C_Data (1 .. 1);
Status : I2C_Status;
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
return Data (Data'First);
end Read_Register;
--------------------
-- Write_Register --
--------------------
procedure Write_Register (This : LSM303AGR_Accelerometer'Class;
Addr : Register_Addresss;
Val : UInt8)
is
Status : I2C_Status;
begin
This.Port.Mem_Write (Addr => Device_Address,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => (1 => Val),
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
end Write_Register;
procedure Configure (This : in out LSM303AGR_Accelerometer;
Dyna_Range : Dynamic_Range;
Rate : Data_Rate) is
begin
-- Place the device into normal (10 bit) mode, with all axes enabled at
-- the nearest supported data rate to that requested.
Write_Register (This, CTRL_REG1_A, Rate'Enum_Rep + 16#07#);
-- Enable the DRDY1 interrupt on INT1 pin.
Write_Register (This, CTRL_REG3_A, 16#10#);
-- Select the g range to that requested, using little endian data format
-- and disable self-test and high rate functions.
Write_Register (This, CTRL_REG4_A, 16#80# + Dyna_Range'Enum_Rep);
end Configure;
---------------------
-- Check_Device_Id --
---------------------
function Check_Device_Id (This : LSM303AGR_Accelerometer) return Boolean is
begin
return Read_Register (This, Who_Am_I) = Device_Id;
exception
when Program_Error => return False;
end Check_Device_Id;
---------------------------------
-- Enable_Temperature_Sensor --
---------------------------------
procedure Enable_Temperature_Sensor
(This : LSM303AGR_Accelerometer; Enabled : Boolean)
is
Val : UInt8 := 0;
begin
if Enabled then
Val := 2#1100_0000#;
end if;
Write_Register (This, TEMP_CFG_REG_A, Val);
end Enable_Temperature_Sensor;
function Get_Temp_Config
(This : LSM303AGR_Accelerometer) return Uint8
is
begin
return Read_Register (This, TEMP_CFG_REG_A);
end Get_Temp_Config;
function Get_Ctrl_Reg_4
(This : LSM303AGR_Accelerometer) return Uint8
is
begin
return Read_Register (This, CTRL_REG4_A);
end Get_Ctrl_Reg_4;
------------------------
-- Read_Temperature --
------------------------
function To_Temperature is new Ada.Unchecked_Conversion (UInt8, Integer_8);
function Read_Temperature
(This : LSM303AGR_Accelerometer) return Temp_Celsius
is
Status : I2C_Status;
Data : I2C_Data (1 .. 2);
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (OUT_TEMP_L_A + 16#80#),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
return Temp_Celsius (25 + To_Temperature (Data (2)));
end Read_Temperature;
---------------
-- Read_Data --
---------------
function To_Axis_Data is new Ada.Unchecked_Conversion (UInt10, Axis_Data);
function Read_Data (This : LSM303AGR_Accelerometer) return All_Axes_Data is
function Convert (MSB, LSB : UInt8) return Axis_Data;
-------------
-- Convert --
-------------
function Convert (MSB, LSB : UInt8) return Axis_Data is
Tmp : UInt10;
begin
Tmp := UInt10 (Shift_Right (LSB, 6));
Tmp := Tmp or UInt10 (MSB) * 2**2;
return To_Axis_Data (Tmp);
end Convert;
Status : I2C_Status;
Data : I2C_Data (1 .. 7);
Ret : All_Axes_Data;
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (DATA_STATUS + 16#80#),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
Ret.X := Convert (Data (3), Data (2));
Ret.Y := Convert (Data (5), Data (4));
Ret.Z := Convert (Data (7), Data (6));
return Ret;
end Read_Data;
end LSM303AGR;
|
stcarrez/ada-util | Ada | 7,621 | ads | -----------------------------------------------------------------------
-- util-http-cookies -- HTTP Cookies
-- Copyright (C) 2011, 2012, 2022 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.Strings.Unbounded;
package Util.Http.Cookies is
-- Exception raised if the value contains an invalid character.
Invalid_Value : exception;
type Cookie is private;
type Cookie_Array is array (Natural range <>) of Cookie;
type Cookie_Array_Access is access all Cookie_Array;
-- Constructs a cookie with a specified name and value.
--
-- The name must conform to RFC 2109. That means it can contain only ASCII alphanumeric
-- characters and cannot contain commas, semicolons, or white space or begin with
-- a $ character. The cookie's name cannot be changed after creation.
--
-- The value can be anything the server chooses to send. Its value is probably
-- of interest only to the server. The cookie's value can be changed after creation
-- with the setValue method.
--
-- By default, cookies are created according to the Netscape cookie specification.
-- The version can be changed with the setVersion method.
function Create (Name : in String;
Value : in String) return Cookie;
-- Returns the name of the cookie. The name cannot be changed after creation.
function Get_Name (Object : in Cookie) return String;
-- Returns the value of the cookie.
function Get_Value (Object : in Cookie) return String;
-- Assigns a new value to a cookie after the cookie is created.
-- If you use a binary value, you may want to use BASE64 encoding.
--
-- With Version 0 cookies, values should not contain white space, brackets,
-- parentheses, equals signs, commas, double quotes, slashes, question marks,
-- at signs, colons, and semicolons. Empty values may not behave
-- the same way on all browsers.
procedure Set_Value (Object : in out Cookie;
Value : in String);
-- Returns the comment describing the purpose of this cookie,
-- or null if the cookie has no comment.
function Get_Comment (Object : in Cookie) return String;
-- Specifies a comment that describes a cookie's purpose. The comment is useful if
-- the browser presents the cookie to the user. Comments are not supported by
-- Netscape Version 0 cookies.
procedure Set_Comment (Object : in out Cookie;
Comment : in String);
-- Returns the domain name set for this cookie. The form of the domain name
-- is set by RFC 2109.
function Get_Domain (Object : in Cookie) return String;
-- Specifies the domain within which this cookie should be presented.
--
-- The form of the domain name is specified by RFC 2109. A domain name begins with
-- a dot (.foo.com) and means that the cookie is visible to servers in a specified
-- Domain Name System (DNS) zone (for example, www.foo.com, but not a.b.foo.com).
-- By default, cookies are only returned to the server that sent them.
procedure Set_Domain (Object : in out Cookie;
Domain : in String);
-- Returns the maximum age of the cookie, specified in seconds.
-- By default, -1 indicating the cookie will persist until browser shutdown.
function Get_Max_Age (Object : in Cookie) return Integer;
-- Sets the maximum age of the cookie in seconds.
--
-- A positive value indicates that the cookie will expire after that many seconds
-- have passed. Note that the value is the maximum age when the cookie will expire,
-- not the cookie's current age.
--
-- A negative value means that the cookie is not stored persistently and will be
-- deleted when the Web browser exits. A zero value causes the cookie to be deleted.
procedure Set_Max_Age (Object : in out Cookie;
Max_Age : in Integer);
-- Returns the path on the server to which the browser returns this cookie.
-- The cookie is visible to all subpaths on the server.
function Get_Path (Object : in Cookie) return String;
-- Specifies a path for the cookie to which the client should return the cookie.
--
-- The cookie is visible to all the pages in the directory you specify,
-- and all the pages in that directory's subdirectories. A cookie's path
-- must include the servlet that set the cookie, for example, /catalog,
-- which makes the cookie visible to all directories on the server under /catalog.
--
-- Consult RFC 2109 (available on the Internet) for more information on setting
-- path names for cookies.
procedure Set_Path (Object : in out Cookie;
Path : in String);
-- Returns true if the browser is sending cookies only over a secure protocol,
-- or false if the browser can send cookies using any protocol.
function Is_Secure (Object : in Cookie) return Boolean;
-- Indicates to the browser whether the cookie should only be sent using
-- a secure protocol, such as HTTPS or SSL.
procedure Set_Secure (Object : in out Cookie;
Secure : in Boolean);
-- Returns the version of the protocol this cookie complies with.
-- Version 1 complies with RFC 2109, and version 0 complies with the original
-- cookie specification drafted by Netscape. Cookies provided by a browser use
-- and identify the browser's cookie version.
function Get_Version (Object : in Cookie) return Natural;
-- Sets the version of the cookie protocol this cookie complies with.
-- Version 0 complies with the original Netscape cookie specification.
-- Version 1 complies with RFC 2109.
procedure Set_Version (Object : in out Cookie;
Version : in Natural);
-- Returns True if the cookie has the http-only-flag.
function Is_Http_Only (Object : in Cookie) return Boolean;
-- Sets the http-only-flag associated with the cookie. When the http-only-flag is
-- set, the cookie is only for http protocols and not exposed to Javascript API.
procedure Set_Http_Only (Object : in out Cookie;
Http_Only : in Boolean);
-- Get the cookie definition
function To_Http_Header (Object : in Cookie) return String;
-- Parse the header and return an array of cookies.
function Get_Cookies (Header : in String) return Cookie_Array_Access;
private
type Cookie is record
Name : Ada.Strings.Unbounded.Unbounded_String;
Value : Ada.Strings.Unbounded.Unbounded_String;
Domain : Ada.Strings.Unbounded.Unbounded_String;
Path : Ada.Strings.Unbounded.Unbounded_String;
Comment : Ada.Strings.Unbounded.Unbounded_String;
Max_Age : Integer := -1;
Secure : Boolean := False;
Http_Only : Boolean := False;
Version : Natural := 0;
end record;
end Util.Http.Cookies;
|
Subsets and Splits