repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
stcarrez/ada-ado
Ada
1,115
ads
----------------------------------------------------------------------- -- ado-schemas-sqlite -- SQLite Database Schemas -- Copyright (C) 2015, 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Connections; package ADO.Schemas.Sqlite is -- Load the database schema procedure Load_Schema (C : in ADO.Connections.Database_Connection'Class; Schema : out Schema_Definition); end ADO.Schemas.Sqlite;
zhmu/ananas
Ada
6,246
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 7 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_73 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_73; 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_73 -- ------------ function Get_73 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_73 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_73; ------------ -- Set_73 -- ------------ procedure Set_73 (Arr : System.Address; N : Natural; E : Bits_73; 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_73; end System.Pack_73;
godunko/adawebui
Ada
3,485
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2018-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: 5901 $ $Date: 2018-12-26 21:09:54 +0300 (Wed, 26 Dec 2018) $ ------------------------------------------------------------------------------ with Web.UI.Slots.Integers; package Web.UI.Integer_Slots renames Web.UI.Slots.Integers;
sungyeon/drake
Ada
36
ads
../machine-apple-darwin/s-natcre.ads
stcarrez/swagger-ada
Ada
1,633
ads
-- REST API Validation -- API to validate -- ------------ EDIT NOTE ------------ -- This file was generated with openapi-generator. You can modify it to implement -- the server. After you modify this file, you should add the following line -- to the .openapi-generator-ignore file: -- -- src/testbinary-servers.ads -- -- Then, you can drop this edit note comment. -- ------------ EDIT NOTE ------------ with Swagger.Servers; with TestBinary.Models; with TestBinary.Skeletons; with External; package TestBinary.Servers is pragma Warnings (Off, "*use clause for package*"); use TestBinary.Models; type Server_Type is limited new TestBinary.Skeletons.Server_Type with null record; -- Get an image -- Get an image overriding procedure Do_Get_Image (Server : in out Server_Type; Status : in Status_Type; Owner : in Swagger.Nullable_UString; Result : out Swagger.Blob_Ref; Context : in out Swagger.Servers.Context_Type); -- Get some stat from external struct overriding procedure Do_Get_Stats (Server : in out Server_Type; Status : in Status_Type; Result : out External.Stat_Vector; Context : in out Swagger.Servers.Context_Type); -- Get an object overriding procedure Do_Get_Object (Server : in out Server_Type; Status : in Status_Type; Owner : in Swagger.Nullable_UString; Result : out Swagger.Object; Context : in out Swagger.Servers.Context_Type); package Server_Impl is new TestBinary.Skeletons.Shared_Instance (Server_Type); end TestBinary.Servers;
charlie5/cBound
Ada
1,666
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_mapping_notify_event_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; request : aliased Interfaces.Unsigned_8; first_keycode : aliased xcb.xcb_keycode_t; count : aliased Interfaces.Unsigned_8; pad1 : aliased Interfaces.Unsigned_8; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_mapping_notify_event_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_mapping_notify_event_t.Item, Element_Array => xcb.xcb_mapping_notify_event_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_mapping_notify_event_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_mapping_notify_event_t.Pointer, Element_Array => xcb.xcb_mapping_notify_event_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_mapping_notify_event_t;
AdaCore/Ada_Drivers_Library
Ada
12,823
ads
-- This spec has been automatically generated from STM32F46_79x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.I2C is pragma Preelaborate; --------------- -- Registers -- --------------- -- Control register 1 type CR1_Register is record -- Peripheral enable PE : Boolean := False; -- SMBus mode SMBUS : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- SMBus type SMBTYPE : Boolean := False; -- ARP enable ENARP : Boolean := False; -- PEC enable ENPEC : Boolean := False; -- General call enable ENGC : Boolean := False; -- Clock stretching disable (Slave mode) NOSTRETCH : Boolean := False; -- Start generation START : Boolean := False; -- Stop generation STOP : Boolean := False; -- Acknowledge enable ACK : Boolean := False; -- Acknowledge/PEC Position (for data reception) POS : Boolean := False; -- Packet error checking PEC : Boolean := False; -- SMBus alert ALERT : Boolean := False; -- unspecified Reserved_14_14 : HAL.Bit := 16#0#; -- Software reset SWRST : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record PE at 0 range 0 .. 0; SMBUS at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; SMBTYPE at 0 range 3 .. 3; ENARP at 0 range 4 .. 4; ENPEC at 0 range 5 .. 5; ENGC at 0 range 6 .. 6; NOSTRETCH at 0 range 7 .. 7; START at 0 range 8 .. 8; STOP at 0 range 9 .. 9; ACK at 0 range 10 .. 10; POS at 0 range 11 .. 11; PEC at 0 range 12 .. 12; ALERT at 0 range 13 .. 13; Reserved_14_14 at 0 range 14 .. 14; SWRST at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CR2_FREQ_Field is HAL.UInt6; -- Control register 2 type CR2_Register is record -- Peripheral clock frequency FREQ : CR2_FREQ_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Error interrupt enable ITERREN : Boolean := False; -- Event interrupt enable ITEVTEN : Boolean := False; -- Buffer interrupt enable ITBUFEN : Boolean := False; -- DMA requests enable DMAEN : Boolean := False; -- DMA last transfer LAST : Boolean := False; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record FREQ at 0 range 0 .. 5; Reserved_6_7 at 0 range 6 .. 7; ITERREN at 0 range 8 .. 8; ITEVTEN at 0 range 9 .. 9; ITBUFEN at 0 range 10 .. 10; DMAEN at 0 range 11 .. 11; LAST at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; subtype OAR1_ADD7_Field is HAL.UInt7; subtype OAR1_ADD10_Field is HAL.UInt2; -- Own address register 1 type OAR1_Register is record -- Interface address ADD0 : Boolean := False; -- Interface address ADD7 : OAR1_ADD7_Field := 16#0#; -- Interface address ADD10 : OAR1_ADD10_Field := 16#0#; -- unspecified Reserved_10_14 : HAL.UInt5 := 16#0#; -- Addressing mode (slave mode) ADDMODE : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OAR1_Register use record ADD0 at 0 range 0 .. 0; ADD7 at 0 range 1 .. 7; ADD10 at 0 range 8 .. 9; Reserved_10_14 at 0 range 10 .. 14; ADDMODE at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype OAR2_ADD2_Field is HAL.UInt7; -- Own address register 2 type OAR2_Register is record -- Dual addressing mode enable ENDUAL : Boolean := False; -- Interface address ADD2 : OAR2_ADD2_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OAR2_Register use record ENDUAL at 0 range 0 .. 0; ADD2 at 0 range 1 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DR_DR_Field is HAL.UInt8; -- Data register type DR_Register is record -- 8-bit data register DR : DR_DR_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DR_Register use record DR at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Status register 1 type SR1_Register is record -- Read-only. Start bit (Master mode) SB : Boolean := False; -- Read-only. Address sent (master mode)/matched (slave mode) ADDR : Boolean := False; -- Read-only. Byte transfer finished BTF : Boolean := False; -- Read-only. 10-bit header sent (Master mode) ADD10 : Boolean := False; -- Read-only. Stop detection (slave mode) STOPF : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Read-only. Data register not empty (receivers) RxNE : Boolean := False; -- Read-only. Data register empty (transmitters) TxE : Boolean := False; -- Bus error BERR : Boolean := False; -- Arbitration lost (master mode) ARLO : Boolean := False; -- Acknowledge failure AF : Boolean := False; -- Overrun/Underrun OVR : Boolean := False; -- PEC Error in reception PECERR : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- Timeout or Tlow error TIMEOUT : Boolean := False; -- SMBus alert SMBALERT : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR1_Register use record SB at 0 range 0 .. 0; ADDR at 0 range 1 .. 1; BTF at 0 range 2 .. 2; ADD10 at 0 range 3 .. 3; STOPF at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; RxNE at 0 range 6 .. 6; TxE at 0 range 7 .. 7; BERR at 0 range 8 .. 8; ARLO at 0 range 9 .. 9; AF at 0 range 10 .. 10; OVR at 0 range 11 .. 11; PECERR at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; TIMEOUT at 0 range 14 .. 14; SMBALERT at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype SR2_PEC_Field is HAL.UInt8; -- Status register 2 type SR2_Register is record -- Read-only. Master/slave MSL : Boolean; -- Read-only. Bus busy BUSY : Boolean; -- Read-only. Transmitter/receiver TRA : Boolean; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. General call address (Slave mode) GENCALL : Boolean; -- Read-only. SMBus device default address (Slave mode) SMBDEFAULT : Boolean; -- Read-only. SMBus host header (Slave mode) SMBHOST : Boolean; -- Read-only. Dual flag (Slave mode) DUALF : Boolean; -- Read-only. acket error checking register PEC : SR2_PEC_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR2_Register use record MSL at 0 range 0 .. 0; BUSY at 0 range 1 .. 1; TRA at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; GENCALL at 0 range 4 .. 4; SMBDEFAULT at 0 range 5 .. 5; SMBHOST at 0 range 6 .. 6; DUALF at 0 range 7 .. 7; PEC at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCR_CCR_Field is HAL.UInt12; -- Clock control register type CCR_Register is record -- Clock control register in Fast/Standard mode (Master mode) CCR : CCR_CCR_Field := 16#0#; -- unspecified Reserved_12_13 : HAL.UInt2 := 16#0#; -- Fast mode duty cycle DUTY : Boolean := False; -- I2C master mode selection F_S : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR_Register use record CCR at 0 range 0 .. 11; Reserved_12_13 at 0 range 12 .. 13; DUTY at 0 range 14 .. 14; F_S at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TRISE_TRISE_Field is HAL.UInt6; -- TRISE register type TRISE_Register is record -- Maximum rise time in Fast/Standard mode (Master mode) TRISE : TRISE_TRISE_Field := 16#2#; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TRISE_Register use record TRISE at 0 range 0 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; subtype FLTR_DNF_Field is HAL.UInt4; -- I2C FLTR register type FLTR_Register is record -- Digital noise filter DNF : FLTR_DNF_Field := 16#0#; -- Analog noise filter OFF ANOFF : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FLTR_Register use record DNF at 0 range 0 .. 3; ANOFF at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Inter-integrated circuit type I2C_Peripheral is record -- Control register 1 CR1 : aliased CR1_Register; -- Control register 2 CR2 : aliased CR2_Register; -- Own address register 1 OAR1 : aliased OAR1_Register; -- Own address register 2 OAR2 : aliased OAR2_Register; -- Data register DR : aliased DR_Register; -- Status register 1 SR1 : aliased SR1_Register; -- Status register 2 SR2 : aliased SR2_Register; -- Clock control register CCR : aliased CCR_Register; -- TRISE register TRISE : aliased TRISE_Register; -- I2C FLTR register FLTR : aliased FLTR_Register; end record with Volatile; for I2C_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; OAR1 at 16#8# range 0 .. 31; OAR2 at 16#C# range 0 .. 31; DR at 16#10# range 0 .. 31; SR1 at 16#14# range 0 .. 31; SR2 at 16#18# range 0 .. 31; CCR at 16#1C# range 0 .. 31; TRISE at 16#20# range 0 .. 31; FLTR at 16#24# range 0 .. 31; end record; -- Inter-integrated circuit I2C1_Periph : aliased I2C_Peripheral with Import, Address => System'To_Address (16#40005400#); -- Inter-integrated circuit I2C2_Periph : aliased I2C_Peripheral with Import, Address => System'To_Address (16#40005800#); -- Inter-integrated circuit I2C3_Periph : aliased I2C_Peripheral with Import, Address => System'To_Address (16#40005C00#); end STM32_SVD.I2C;
reznikmm/matreshka
Ada
4,615
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_Smil.RepeatCount_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Smil_RepeatCount_Attribute_Node is begin return Self : Smil_RepeatCount_Attribute_Node do Matreshka.ODF_Smil.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Smil_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Smil_RepeatCount_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.RepeatCount_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Smil_URI, Matreshka.ODF_String_Constants.RepeatCount_Attribute, Smil_RepeatCount_Attribute_Node'Tag); end Matreshka.ODF_Smil.RepeatCount_Attributes;
reznikmm/matreshka
Ada
3,749
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.Svg_Overline_Thickness_Attributes is pragma Preelaborate; type ODF_Svg_Overline_Thickness_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Svg_Overline_Thickness_Attribute_Access is access all ODF_Svg_Overline_Thickness_Attribute'Class with Storage_Size => 0; end ODF.DOM.Svg_Overline_Thickness_Attributes;
charlie5/lace
Ada
6,149
adb
package body any_Math.any_Algebra.any_linear.any_d2 is ----------- -- Vector_2 -- function Angle_between_pre_Norm (U, V : in Vector_2) return Radians is use Functions, Vectors; Val : Real := U * V; -- Dot product. begin if val < -1.0 then val := -1.0; -- Clamp to avoid rounding errors. arcCos will elsif val > 1.0 then val := 1.0; -- fail with values outside this range. end if; return arcCos (Val); end Angle_between_pre_Norm; function Midpoint (From, To : in Vector_2) return Vector_2 is begin return [(From (1) + To (1)) * 0.5, (From (2) + To (2)) * 0.5]; end Midpoint; function Distance (From, To : in Vector_2) return Real is begin return abs (From - To); end Distance; function Interpolated (From, To : in Vector_2; Percent : in unit_Percentage) return Vector_2 is P : constant Real := to_Real (Percent); S : constant Real := 1.0 - P; begin return [S * From (1) + P * To (1), S * From (2) + P * To (2)]; end Interpolated; ------------- -- Matrix_2x2 -- function to_Matrix (Row_1, Row_2 : in Vector_2) return Matrix_2x2 is begin return [[Row_1 (1), Row_1 (2)], [Row_2 (1), Row_2 (2)]]; end to_Matrix; function to_rotation_Matrix (Angle : in Radians ) return Matrix_2x2 is use Functions; begin return [[ cos (Angle), sin (Angle)], [-sin (Angle), cos (Angle)]]; end to_rotation_Matrix; function up_Direction (Self : in Matrix_2x2) return Vector_2 is begin return Normalised (Row (Self, 2)); end up_Direction; function right_Direction (Self : in Matrix_2x2) return Vector_2 is begin return Normalised (Row (Self, 1)); end right_Direction; function to_rotation_Transform (Rotation : in Matrix_2x2) return Matrix_3x3 is begin return [[Rotation (1, 1), Rotation (1, 2), 0.0], [Rotation (2, 1), Rotation (2, 2), 0.0], [ 0.0, 0.0, 1.0]]; end to_rotation_Transform; ------------- -- Transform -- function to_Transform_2d (From : in Matrix_3x3) return Transform_2d is begin return (Rotation => get_Rotation (From), Translation => get_Translation (From)); end to_Transform_2d; function to_Transform (From : in Transform_2d) return Matrix_3x3 is begin return to_rotation_Transform (From.Rotation) * to_translation_Transform (From.Translation); end to_Transform; function to_translation_Transform (Translation : Vector_2) return Matrix_3x3 is begin return [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [Translation (1), Translation (2), 1.0]]; end to_translation_Transform; function to_rotation_Transform (Angle : in Radians) return Matrix_3x3 is use Functions; begin return [[ cos (Angle), sin (Angle), 0.0], [-sin (Angle), cos (Angle), 0.0], [ 0.0, 0.0, 1.0]]; end to_rotation_Transform; function to_scale_Transform (Scale : in Vector_2) return Matrix_3x3 is begin return [[Scale (1), 0.0, 0.0], [ 0.0, Scale (2), 0.0], [ 0.0, 0.0, 1.0]]; end to_scale_Transform; function to_Transform (Rotation : in Matrix_2x2; Translation : in Vector_2) return Matrix_3x3 is begin return [[Rotation (1, 1), Rotation (1, 2), 0.0], [Rotation (2, 1), Rotation (2, 2), 0.0], [Translation (1), Translation (2), 1.0]]; end to_Transform; function to_Transform_2d (Rotation : in Radians; Translation : in Vector_2) return Transform_2d is begin return (to_rotation_Matrix (Rotation), Translation); end to_Transform_2d; function "*" (Left : in Vector_2; Right : in Transform_2d) return Vector_2 is Pad : constant Vector_3 := [Left (1), Left (2), 1.0]; Result : constant Vector_3 := Pad * to_Transform (Right); begin return Vector_2 (Result (1 .. 2)); end "*"; function "*" (Left : in Vector_2; Right : in Matrix_3x3) return Vector_2 is use Vectors; Result : constant Vector := Vector (Left & 1.0) * Matrix (Right); begin return Vector_2 (Result (1 .. 2)); end "*"; function Invert (Transform : in Transform_2d) return Transform_2d is inverse_Rotation : constant Matrix_2x2 := Transpose (Transform.Rotation); begin return (Translation => inverse_Rotation * (-Transform.Translation), Rotation => inverse_Rotation); end Invert; function inverse_Transform (Transform : in Transform_2d; Vector : in Vector_2) return Vector_2 is V : constant Vector_2 := Vector - Transform.Translation; begin return Transpose (Transform.Rotation) * V; end inverse_Transform; function get_Rotation (Transform : in Matrix_3x3) return Matrix_2x2 is begin return [[Transform (1, 1), Transform (1, 2)], [Transform (2, 1), Transform (2, 2)]]; end get_Rotation; procedure set_Rotation (Transform : in out Matrix_3x3; To : in Matrix_2x2) is begin Transform (1, 1) := To (1, 1); Transform (1, 2) := To (1, 2); Transform (1, 3) := 0.0; Transform (2, 1) := To (2, 1); Transform (2, 2) := To (2, 2); Transform (2, 3) := 0.0; end set_Rotation; function get_Translation (Transform : in Matrix_3x3) return Vector_2 is begin return [Transform (3, 1), Transform (3, 2)]; end get_Translation; procedure set_Translation (Transform : in out Matrix_3x3; To : in Vector_2) is begin Transform (3, 1) := To (1); Transform (3, 2) := To (2); Transform (3, 3) := 1.0; end set_Translation; end any_Math.any_Algebra.any_linear.any_d2;
google-code/ada-security
Ada
2,900
ads
----------------------------------------------------------------------- -- Security-policies-tests - Unit tests for Security.Permissions -- Copyright (C) 2011, 2012, 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. ----------------------------------------------------------------------- with Util.Tests; with Util.Strings; with Security.Policies.Roles; package Security.Policies.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test Create_Role and Get_Role_Name procedure Test_Create_Role (T : in out Test); -- Test Set_Roles procedure Test_Set_Roles (T : in out Test); -- Test Set_Roles on an invalid role name procedure Test_Set_Invalid_Roles (T : in out Test); -- Test the Get_Policy, Get_Role_Policy and Add_Policy operations. procedure Test_Get_Role_Policy (T : in out Test); -- Test Has_Permission procedure Test_Has_Permission (T : in out Test); -- Test reading an empty policy file procedure Test_Read_Empty_Policy (T : in out Test); -- Test reading policy files procedure Test_Read_Policy (T : in out Test); -- Test reading policy files and using the <role-permission> controller procedure Test_Role_Policy (T : in out Test); -- Test anonymous users and permissions. procedure Test_Anonymous_Permission (T : in out Test); -- Read the policy file <b>File</b> and perform a test on the given URI -- with a user having the given role. procedure Check_Policy (T : in out Test; File : in String; Role : in String; URL : in String; Anonymous : in Boolean := False; Granted : in Boolean := True); type Test_Principal is new Principal and Roles.Role_Principal_Context with record Name : Util.Strings.String_Ref; Roles : Security.Policies.Roles.Role_Map := (others => False); end record; -- Get the roles assigned to the user. overriding function Get_Roles (User : in Test_Principal) return Roles.Role_Map; -- Get the principal name. function Get_Name (From : in Test_Principal) return String; end Security.Policies.Tests;
AdaCore/langkit
Ada
561
adb
with Ada.Text_IO; use Ada.Text_IO; with Libfoolang.Analysis; use Libfoolang.Analysis; procedure Main is Ctx : constant Analysis_Context := Create_Context; U : constant Analysis_Unit := Ctx.Get_From_Buffer (Filename => "main.txt", Buffer => "example"); N : constant Foo_Node := U.Root; begin if U.Has_Diagnostics then for D of U.Diagnostics loop Put_Line (U.Format_GNU_Diagnostic (D)); end loop; raise Program_Error; end if; Put_Line ("P_Check (" & N.Image & ") = " & N.P_Check'Image); end Main;
reznikmm/matreshka
Ada
4,750
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Text_Reference_Ref_Elements; package Matreshka.ODF_Text.Reference_Ref_Elements is type Text_Reference_Ref_Element_Node is new Matreshka.ODF_Text.Abstract_Text_Element_Node and ODF.DOM.Text_Reference_Ref_Elements.ODF_Text_Reference_Ref with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Reference_Ref_Element_Node; overriding function Get_Local_Name (Self : not null access constant Text_Reference_Ref_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Text_Reference_Ref_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Text_Reference_Ref_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Text_Reference_Ref_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Text.Reference_Ref_Elements;
BrickBot/Bound-T-H8-300
Ada
2,788
ads
-- Bounds.Recursing (decl) -- -- Bounding recursive calls. -- -- Currently we do not support recursion in the target program, so -- we provide only an operation to report (one of) the cycles of -- recursive calls detected in the target program. -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- 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. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.2 $ -- $Date: 2015/10/24 19:36:47 $ -- -- $Log: bounds-recursing.ads,v $ -- Revision 1.2 2015/10/24 19:36:47 niklas -- Moved to free licence. -- -- Revision 1.1 2005-02-16 21:11:39 niklas -- BT-CH-0002. -- with Programs; package Bounds.Recursing is procedure Report_Cycle ( Recursive : in Programs.Subprogram_Set_T; Non_Recursive : in Programs.Subprogram_List_T); -- -- Prints one recursion cycle from a recursive set of subprograms. -- -- Recursive -- The set of subprograms that contains recursion. -- Non_Recursive -- A subset of Recursive that does not contain recursion, as -- determined by topological sorting of the call-graph. end Bounds.Recursing;
AdaCore/training_material
Ada
153
ads
generic Name : String; with procedure Run_Test (TC : Test_Case_T'Class) is <>; package Test_Suite.Test with Elaborate_Body is end Test_Suite.Test;
AdaCore/libadalang
Ada
308
ads
package Absent_Base_Type is type T1_Parent (B : Boolean) is tagged limited record case B is when False => null; when True => I : Integer; end case; end record; type T1_Child is new T1_Parent with null record; type T2_Child is null record; end Absent_Base_Type;
dshadrin/AProxy
Ada
8,959
adb
---------------------------------------- -- Copyright (C) 2019 Dmitriy Shadrin -- -- All rights reserved. -- ---------------------------------------- with Logging_Message; use Logging_Message; with TimeStamp; with Ada.Characters.Handling; with Ada.Unchecked_Deallocation; with Ada.Text_IO; use Ada.Text_IO; with Formatted_Output; use Formatted_Output; with Formatted_Output.Enumeration_Output; package body Sinks is package ASU renames Ada.Strings.Unbounded; ----------------------------------------------------------------------------- use all type ASU.Unbounded_String; type SinkTypeValueArray is array (ESinkType) of ASU.Unbounded_String; sinkTypesStr : constant SinkTypeValueArray := (To_Unbounded_String ("CONSOLE"), To_Unbounded_String ("FILE")); type SeverityConfigureString is array (ESeverity) of ASU.Unbounded_String; sinkSeverityStr : constant SeverityConfigureString := (To_Unbounded_String ("TRACE"), To_Unbounded_String ("DEBUG"), To_Unbounded_String ("INFO"), To_Unbounded_String ("TEST"), To_Unbounded_String ("WARN"), To_Unbounded_String ("ERROR"), To_Unbounded_String ("CRIT")); type SeverityValueArray is array (ESeverity) of String (1 .. 4); severityLogOutput : constant SeverityValueArray := ("TRAC", "DBG ", "INFO", "TEST", "WARN", "ERR ", "CRIT"); ----------------------------------------------------------------------------- function SinkTypeStr (sev : ESinkType) return Ada.Strings.Unbounded.Unbounded_String with inline is begin return sinkTypesStr (sev); end SinkTypeStr; ----------------------------------------------------------------------------- function SeverityFromStr (str : String) return ESeverity is begin for i in ESeverity'Range loop if To_Unbounded_String (str) = sinkSeverityStr (i) then return i; end if; end loop; raise Program_Error; end SeverityFromStr; ----------------------------------------------------------------------------- function SeverityStr (sev : ESeverity) return String with inline is begin return severityLogOutput (sev); end SeverityStr; ----------------------------------------------------------------------------- function FormatMessage (ptr : SLogPackagePtr) return String is use Formatted_Output; begin return To_String (+"[%s][%s][%s] - %s" & TimeStamp.GetTimestampStr (ptr.tm_stamp) & ptr.tag & SeverityStr (ptr.severity) & Ada.Strings.Unbounded.To_String (ptr.message)); end FormatMessage; ----------------------------------------------------------------------------- procedure MakeSink (self : out Sink; name : in String; cfg : in ConfigTree.NodePtr) is package Formatter_SinkType is new Formatted_Output.Enumeration_Output (Sinks.ESinkType); use Ada.Strings.Unbounded; use Formatter_SinkType; use Logging_Message.Formatter_Channel; sinkName : Unbounded_String := Trim ( To_Unbounded_String (Ada.Characters.Handling.To_Upper (name)), Ada.Strings.Both); severity : ESeverity := SeverityFromStr (cfg.GetValue ("severity")); channel : LogChannel := LogChannel'Value (cfg.GetValue ("channel")); begin self.severity := severity; self.channel := channel; if sinkName = SinkTypeStr (CONSOLE_SINK) then self.SinkType := CONSOLE_SINK; elsif sinkName = SinkTypeStr (FILE_SINK) then declare template : Unbounded_String := Null_Unbounded_String; prefix : Unbounded_String := Null_Unbounded_String; suffix : Unbounded_String := Null_Unbounded_String; demand : Pal.bool := false; nd : ConfigTree.NodePtr := cfg.GetFirst; begin while not ConfigTree.IsNull (nd) loop if nd.GetName = "template" then template := To_Unbounded_String (nd.GetValue); elsif nd.GetName = "prefix" then prefix := To_Unbounded_String (nd.GetValue); elsif nd.GetName = "suffix" then suffix := To_Unbounded_String (nd.GetValue); elsif nd.GetName = "open_by_demand" and then Ada.Characters.Handling.To_Upper (nd.GetValue) = "TRUE" then demand := true; end if; nd := nd.GetNext; end loop; self.SinkType := FILE_SINK; self.template := template; self.prefix := prefix; self.suffix := suffix; self.filename := Null_Unbounded_String; self.open_by_demand := demand; if demand = false then self.filename := MakeFilename(self); end if; end; else Put_Line ("Unknown sink :" & To_String (sinkName)); raise Program_Error; end if; self.handler := new SinkOutputer; self.handler.Start (self.SinkType, severity, channel); --LOG_INFO ("SINK", To_String (+"Created sink with channel %d : %s" & channel & self.SinkType)); end MakeSink; ----------------------------------------------------------------------------- function Channel (self : access Sink) return Logging_Message.LogChannel is begin return self.channel; end Channel; ----------------------------------------------------------------------------- procedure WriteLogs (self : access Sink; logs : in LogMessages) is begin self.handler.Write (logs, self.filename); end WriteLogs; ----------------------------------------------------------------------------- procedure Close (self : access Sink) is procedure Free is new Ada.Unchecked_Deallocation (SinkOutputer, SinkOutputerPtr); begin self.handler.Stop; Free (self.handler); end Close; ----------------------------------------------------------------------------- task body SinkOutputer is isWorked : Pal.bool := true; sinkTag : ESinkType; severity : Logging_Message.ESeverity; channel : Logging_Message.LogChannel; var : Pal.uint32_t; begin accept Start (tag : ESinkType; sev : Logging_Message.ESeverity; ch : Logging_Message.LogChannel) do sinkTag := tag; severity := sev; channel := ch; end Start; while isWorked loop select accept Write (logs : in LogMessages; file : in ASU.Unbounded_String := ASU.Null_Unbounded_String) do for i in logs.Get.First_Index .. logs.Get.Last_Index loop declare msg : Logging_Message.LogMessage := logs.Get.Element (i); begin if msg.Get.lchannel = channel and then msg.Get.severity >= severity and then msg.Get.command = Logging_Message.eMessage then if sinkTag = CONSOLE_SINK then Put_Line (FormatMessage (msg.Get)); elsif sinkTag = FILE_SINK then -- TODO: implement null; end if; end if; end; end loop; var := Pal.Atomic_Sub_Fetch_32 (activeSinksCounter'Access, 1); end Write; or accept Stop do isWorked := false; end Stop; end select; end loop; end SinkOutputer; ----------------------------------------------------------------------------- function MakeFilename (self : in out Sink) return Ada.Strings.Unbounded.Unbounded_String is outStr : ASU.Unbounded_String := ASU.Null_Unbounded_String; posDot : Natural := 0; begin if self.SinkType = FILE_SINK then outStr := self.prefix; if ASU.Length (outStr) > 0 then ASU.Append (outStr, "_"); end if; ASU.Append (outStr, self.template); if ASU.Length (self.suffix) > 0 then posDot := ASU.Index (outStr, ".", 1); if posDot > 0 then ASU.Insert (outStr, Positive (posDot), ASU.To_String (ASU.To_Unbounded_String ("_") & self.suffix)); else ASU.Append (outStr, "_"); ASU.Append (outStr, self.suffix); end if; end if; end if; return outStr; end MakeFilename; end Sinks;
reznikmm/matreshka
Ada
4,289
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.FO.Background_Color.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.FO.Background_Color.FO_Background_Color_Access) return ODF.DOM.Attributes.FO.Background_Color.ODF_FO_Background_Color is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.FO.Background_Color.FO_Background_Color_Access) return ODF.DOM.Attributes.FO.Background_Color.ODF_FO_Background_Color is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.FO.Background_Color.Internals;
reznikmm/matreshka
Ada
3,669
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.Svg_Ry_Attributes is pragma Preelaborate; type ODF_Svg_Ry_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Svg_Ry_Attribute_Access is access all ODF_Svg_Ry_Attribute'Class with Storage_Size => 0; end ODF.DOM.Svg_Ry_Attributes;
tum-ei-rcs/StratoX
Ada
1,523
adb
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- -- Authors: Emanuel Regnath ([email protected]) -- @summary -- target-independent functions of HIL. package body HIL with SPARK_Mode => Off is procedure set_Bits( register : in out Unsigned_16; bit_mask : Unsigned_16_Mask) is begin register := register or Unsigned_16( bit_mask ); end set_Bits; procedure clear_Bits( register : in out Unsigned_16; bit_mask : Unsigned_16_Mask) is begin register := register and not Unsigned_16( bit_mask ); end clear_Bits; procedure write_Bits( register : in out Unsigned_8; start_index : Unsigned_8_Bit_Index; length : Positive; value : Integer) is bits_mask : constant Unsigned_8 := (2**length - 1) * 2**Natural(start_index); value_mask : constant Unsigned_8 := Unsigned_8( value * 2**Natural(start_index) ); begin register := (register and not bits_mask ) or (bits_mask or value_mask); end write_Bits; function read_Bits( register : in Unsigned_8; start_index : Unsigned_8_Bit_Index; length : Positive) return Unsigned_8 is bits_mask : constant Unsigned_8 := (2**length - 1) * 2**Natural(start_index); value : constant Unsigned_8 := (bits_mask and register) / 2**Natural(start_index); begin return value; end read_Bits; end HIL;
rbkmoney/swagger-codegen
Ada
13,910
adb
-- Swagger Petstore -- This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. -- -- OpenAPI spec version: 1.0.0 -- Contact: [email protected] -- -- NOTE: This package is auto generated by the swagger code generator 2.3.0-SNAPSHOT. -- https://github.com/swagger-api/swagger-codegen.git -- Do not edit the class manually. with Swagger.Streams; package body Samples.Petstore.Clients is -- Add a new pet to the store procedure Add_Pet (Client : in out Client_Type; P_Body : in Samples.Petstore.Models.Pet_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON, Swagger.Clients.APPLICATION_XML)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/pet"); Client.Call (Swagger.Clients.POST, URI, Req); end Add_Pet; -- Deletes a pet procedure Delete_Pet (Client : in out Client_Type; Pet_Id : in Swagger.Long; Api_Key : in Swagger.UString) is URI : Swagger.Clients.URI_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/pet/{petId}"); URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id)); Client.Call (Swagger.Clients.DELETE, URI); end Delete_Pet; -- Finds Pets by status -- Multiple status values can be provided with comma separated strings procedure Find_Pets_By_Status (Client : in out Client_Type; Status : in Swagger.UString_Vectors.Vector; Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("status", Status); URI.Set_Path ("/pet/findByStatus"); Client.Call (Swagger.Clients.GET, URI, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Find_Pets_By_Status; -- Finds Pets by tags -- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. procedure Find_Pets_By_Tags (Client : in out Client_Type; Tags : in Swagger.UString_Vectors.Vector; Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("tags", Tags); URI.Set_Path ("/pet/findByTags"); Client.Call (Swagger.Clients.GET, URI, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Find_Pets_By_Tags; -- Find pet by ID -- Returns a single pet procedure Get_Pet_By_Id (Client : in out Client_Type; Pet_Id : in Swagger.Long; Result : out Samples.Petstore.Models.Pet_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/pet/{petId}"); URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id)); Client.Call (Swagger.Clients.GET, URI, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Get_Pet_By_Id; -- Update an existing pet procedure Update_Pet (Client : in out Client_Type; P_Body : in Samples.Petstore.Models.Pet_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON, Swagger.Clients.APPLICATION_XML)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/pet"); Client.Call (Swagger.Clients.PUT, URI, Req); end Update_Pet; -- Updates a pet in the store with form data procedure Update_Pet_With_Form (Client : in out Client_Type; Pet_Id : in Swagger.Long; Name : in Swagger.UString; Status : in Swagger.UString) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM)); Req.Stream.Write_Entity ("name", Name); Req.Stream.Write_Entity ("status", Status); URI.Set_Path ("/pet/{petId}"); URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id)); Client.Call (Swagger.Clients.POST, URI); end Update_Pet_With_Form; -- uploads an image procedure Upload_File (Client : in out Client_Type; Pet_Id : in Swagger.Long; Additional_Metadata : in Swagger.UString; File : in Swagger.Http_Content_Type; Result : out Samples.Petstore.Models.ApiResponse_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM)); Req.Stream.Write_Entity ("additionalMetadata", Additional_Metadata); Req.Stream.Write_Entity ("file", File); URI.Set_Path ("/pet/{petId}/uploadImage"); URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id)); Client.Call (Swagger.Clients.POST, URI, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Upload_File; -- Delete purchase order by ID -- For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors procedure Delete_Order (Client : in out Client_Type; Order_Id : in Swagger.UString) is URI : Swagger.Clients.URI_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/store/order/{orderId}"); URI.Set_Path_Param ("orderId", Order_Id); Client.Call (Swagger.Clients.DELETE, URI); end Delete_Order; -- Returns pet inventories by status -- Returns a map of status codes to quantities procedure Get_Inventory (Client : in out Client_Type; Result : out Swagger.Integer_Map) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/store/inventory"); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Inventory; -- Find purchase order by ID -- For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions procedure Get_Order_By_Id (Client : in out Client_Type; Order_Id : in Swagger.Long; Result : out Samples.Petstore.Models.Order_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/store/order/{orderId}"); URI.Set_Path_Param ("orderId", Swagger.To_String (Order_Id)); Client.Call (Swagger.Clients.GET, URI, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Get_Order_By_Id; -- Place an order for a pet procedure Place_Order (Client : in out Client_Type; P_Body : in Samples.Petstore.Models.Order_Type; Result : out Samples.Petstore.Models.Order_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/store/order"); Client.Call (Swagger.Clients.POST, URI, Req, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Place_Order; -- Create user -- This can only be done by the logged in user. procedure Create_User (Client : in out Client_Type; P_Body : in Samples.Petstore.Models.User_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/user"); Client.Call (Swagger.Clients.POST, URI, Req); end Create_User; -- Creates list of users with given input array procedure Create_Users_With_Array_Input (Client : in out Client_Type; P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/user/createWithArray"); Client.Call (Swagger.Clients.POST, URI, Req); end Create_Users_With_Array_Input; -- Creates list of users with given input array procedure Create_Users_With_List_Input (Client : in out Client_Type; P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/user/createWithList"); Client.Call (Swagger.Clients.POST, URI, Req); end Create_Users_With_List_Input; -- Delete user -- This can only be done by the logged in user. procedure Delete_User (Client : in out Client_Type; Username : in Swagger.UString) is URI : Swagger.Clients.URI_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/user/{username}"); URI.Set_Path_Param ("username", Username); Client.Call (Swagger.Clients.DELETE, URI); end Delete_User; -- Get user by user name procedure Get_User_By_Name (Client : in out Client_Type; Username : in Swagger.UString; Result : out Samples.Petstore.Models.User_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/user/{username}"); URI.Set_Path_Param ("username", Username); Client.Call (Swagger.Clients.GET, URI, Reply); Samples.Petstore.Models.Deserialize (Reply, "", Result); end Get_User_By_Name; -- Logs user into the system procedure Login_User (Client : in out Client_Type; Username : in Swagger.UString; Password : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("username", Username); URI.Add_Param ("password", Password); URI.Set_Path ("/user/login"); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Login_User; -- Logs out current logged in user session procedure Logout_User (Client : in out Client_Type) is URI : Swagger.Clients.URI_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/user/logout"); Client.Call (Swagger.Clients.GET, URI); end Logout_User; -- Updated user -- This can only be done by the logged in user. procedure Update_User (Client : in out Client_Type; Username : in Swagger.UString; P_Body : in Samples.Petstore.Models.User_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body); URI.Set_Path ("/user/{username}"); URI.Set_Path_Param ("username", Username); Client.Call (Swagger.Clients.PUT, URI, Req); end Update_User; end Samples.Petstore.Clients;
reznikmm/matreshka
Ada
4,840
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_Calculation_Settings_Elements; package Matreshka.ODF_Table.Calculation_Settings_Elements is type Table_Calculation_Settings_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Calculation_Settings_Elements.ODF_Table_Calculation_Settings with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Calculation_Settings_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Calculation_Settings_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Calculation_Settings_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_Calculation_Settings_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_Calculation_Settings_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.Calculation_Settings_Elements;
reznikmm/matreshka
Ada
3,568
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$ ------------------------------------------------------------------------------ -- AMF module for CMOF metamodel. ------------------------------------------------------------------------------ package AMF.Internals.Modules.CMOF_Module is pragma Elaborate_Body; end AMF.Internals.Modules.CMOF_Module;
ekoeppen/MSP430_Generic_Ada_Drivers
Ada
553
ads
-- This spec has been automatically generated from msp430g2553.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package MSP430_SVD.INTERRUPTS is pragma Preelaborate; ----------------- -- Peripherals -- ----------------- type INTERRUPTS_Peripheral is record end record with Volatile; for INTERRUPTS_Peripheral use record end record; INTERRUPTS_Periph : aliased _INTERRUPTS_Peripheral with Import, Address => _INTERRUPTS_Base; end MSP430_SVD.INTERRUPTS;
onox/orka
Ada
761
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2022 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. package Orka.SIMD.AVX.Integers.Arithmetic is pragma Pure; end Orka.SIMD.AVX.Integers.Arithmetic;
reznikmm/matreshka
Ada
4,043
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.Chart_Label_Position_Attributes; package Matreshka.ODF_Chart.Label_Position_Attributes is type Chart_Label_Position_Attribute_Node is new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node and ODF.DOM.Chart_Label_Position_Attributes.ODF_Chart_Label_Position_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Label_Position_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Chart_Label_Position_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Chart.Label_Position_Attributes;
AdaCore/gpr
Ada
1,589
adb
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Strings.Fixed; with Ada.Text_IO; with GPR2.Context; with GPR2.Path_Name; with GPR2.Project.Tree; with GPR2.Project.View; procedure Main is use Ada; use GPR2; use GPR2.Project; procedure Display (Prj : Project.View.Object); function Filter_Path (Filename : Path_Name.Full_Name) return String; ------------- -- Display -- ------------- procedure Display (Prj : Project.View.Object) is begin Text_IO.Put (String (Prj.Name) & " "); Text_IO.Set_Col (10); Text_IO.Put_Line (Prj.Qualifier'Img); Text_IO.Put_Line (Filter_Path (Prj.Executable_Directory.Value)); end Display; ----------------- -- Filter_Path -- ----------------- function Filter_Path (Filename : Path_Name.Full_Name) return String is D : constant String := "executable-directory"; I : constant Positive := Strings.Fixed.Index (Filename, D); begin return Filename (I .. Filename'Last); end Filter_Path; Prj : Project.Tree.Object; Ctx : Context.Object; begin Project.Tree.Load (Prj, Create ("demo1.gpr"), Ctx); Display (Prj.Root_Project); Project.Tree.Load (Prj, Create ("demo2.gpr"), Ctx); Display (Prj.Root_Project); Project.Tree.Load (Prj, Create ("demo3.gpr"), Ctx); Display (Prj.Root_Project); Project.Tree.Load (Prj, Create ("demo4.gpr"), Ctx); Display (Prj.Root_Project); Project.Tree.Load (Prj, Create ("demo1.gpr"), Ctx, Subdirs => "experiment"); Display (Prj.Root_Project); end Main;
reznikmm/matreshka
Ada
4,704
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_Chart.Japanese_Candle_Stick_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Japanese_Candle_Stick_Attribute_Node is begin return Self : Chart_Japanese_Candle_Stick_Attribute_Node do Matreshka.ODF_Chart.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Chart_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Chart_Japanese_Candle_Stick_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Japanese_Candle_Stick_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Chart_URI, Matreshka.ODF_String_Constants.Japanese_Candle_Stick_Attribute, Chart_Japanese_Candle_Stick_Attribute_Node'Tag); end Matreshka.ODF_Chart.Japanese_Candle_Stick_Attributes;
reznikmm/matreshka
Ada
4,118
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- 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$ ------------------------------------------------------------------------------ with League.Strings; with Matreshka.XML_Catalogs.Entry_Files; package Matreshka.XML_Catalogs.Resolver is procedure Resolve_External_Identifier (List : not null Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_List_Access; Public_Id : League.Strings.Universal_String; System_Id : League.Strings.Universal_String; Resolved_URI : out League.Strings.Universal_String; Success : out Boolean); procedure Resolve_URI (List : not null Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_List_Access; URI : League.Strings.Universal_String; Resolved_URI : out League.Strings.Universal_String; Success : out Boolean); end Matreshka.XML_Catalogs.Resolver;
onox/orka
Ada
10,952
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2013 Felix Krause <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Unchecked_Conversion; with GL.API; with GL.Enums.Getter; with GL.Pixels.Queries; package body GL.Objects.Framebuffers is function Valid_Attachment (Attachment : Attachment_Point; Texture : Textures.Texture) return Boolean is Format : GL.Pixels.Internal_Format renames Texture.Internal_Format; begin case Attachment is when Depth_Stencil_Attachment => return GL.Pixels.Extensions.Depth_Stencil_Format (Format); when Depth_Attachment => return GL.Pixels.Extensions.Depth_Format (Format); when Stencil_Attachment => return GL.Pixels.Extensions.Stencil_Format (Format); when others => return GL.Pixels.Queries.Color_Renderable (Format, Texture.Kind); end case; end Valid_Attachment; function Status (Object : Framebuffer; Target : Framebuffer_Target'Class) return Framebuffer_Status is begin return API.Check_Named_Framebuffer_Status.Ref (Object.Reference.GL_Id, Target.Kind); end Status; procedure Set_Draw_Buffer (Object : Framebuffer; Selector : Buffers.Color_Buffer_Selector) is subtype Index_Type is Buffers.Draw_Buffer_Index; begin Object.Set_Draw_Buffers ((Index_Type'First => Selector, Index_Type'First + 1 .. Index_Type'Last => Buffers.None)); end Set_Draw_Buffer; procedure Set_Draw_Buffers (Object : Framebuffer; List : Buffers.Color_Buffer_List) is begin API.Named_Framebuffer_Draw_Buffers.Ref (Object.Reference.GL_Id, List'Length, List); end Set_Draw_Buffers; procedure Set_Read_Buffer (Object : Framebuffer; Selector : Buffers.Color_Buffer_Selector) is begin API.Named_Framebuffer_Read_Buffer.Ref (Object.Reference.GL_Id, Selector); end Set_Read_Buffer; procedure Attach_Texture (Object : Framebuffer; Attachment : Attachment_Point; Texture : Textures.Texture; Level : Textures.Mipmap_Level) is begin API.Named_Framebuffer_Texture.Ref (Object.Reference.GL_Id, Attachment, Texture.Raw_Id, Level); end Attach_Texture; procedure Attach_Texture_Layer (Object : Framebuffer; Attachment : Attachment_Point; Texture : Textures.Texture; Level : Textures.Mipmap_Level; Layer : Natural) is begin API.Named_Framebuffer_Texture_Layer.Ref (Object.Reference.GL_Id, Attachment, Texture.Raw_Id, Level, Int (Layer)); end Attach_Texture_Layer; procedure Detach (Object : Framebuffer; Attachment : Attachment_Point) is begin API.Named_Framebuffer_Texture.Ref (Object.Reference.GL_Id, Attachment, 0, 0); end Detach; procedure Invalidate_Data (Object : Framebuffer; Attachments : Attachment_List) is begin API.Invalidate_Named_Framebuffer_Data.Ref (Object.Reference.GL_Id, Attachments'Length, Attachments); end Invalidate_Data; procedure Invalidate_Sub_Data (Object : Framebuffer; Attachments : Attachment_List; X, Y : Int; Width, Height : Size) is begin API.Invalidate_Named_Framebuffer_Sub_Data.Ref (Object.Reference.GL_Id, Attachments'Length, Attachments, X, Y, Width, Height); end Invalidate_Sub_Data; procedure Invalidate_Data (Object : Framebuffer; Attachments : Default_Attachment_List) is begin API.Invalidate_Named_Framebuffer_Data_Default.Ref (Object.Reference.GL_Id, Attachments'Length, Attachments); end Invalidate_Data; procedure Invalidate_Sub_Data (Object : Framebuffer; Attachments : Default_Attachment_List; X, Y : Int; Width, Height : Size) is begin API.Invalidate_Named_Framebuffer_Sub_Data_Default.Ref (Object.Reference.GL_Id, Attachments'Length, Attachments, X, Y, Width, Height); end Invalidate_Sub_Data; procedure Blit (Read_Object, Draw_Object : Framebuffer; Src_X0, Src_Y0, Src_X1, Src_Y1, Dst_X0, Dst_Y0, Dst_X1, Dst_Y1 : Int; Mask : Buffers.Buffer_Bits; Filter : Interpolation_Function) is use type Low_Level.Bitfield; function Convert is new Ada.Unchecked_Conversion (Buffers.Buffer_Bits, Low_Level.Bitfield); Raw_Bits : constant Low_Level.Bitfield := Convert (Mask) and 2#0100010100000000#; begin API.Blit_Named_Framebuffer.Ref (Read_Object.Reference.GL_Id, Draw_Object.Reference.GL_Id, Src_X0, Src_Y0, Src_X1, Src_Y1, Dst_X0, Dst_Y0, Dst_X1, Dst_Y1, Raw_Bits, Filter); end Blit; procedure Set_Default_Width (Object : Framebuffer; Value : Size) is begin API.Named_Framebuffer_Parameter_Size.Ref (Object.Reference.GL_Id, Enums.Default_Width, Value); end Set_Default_Width; function Max_Framebuffer_Width return Size is Ret : Size := 16_384; begin API.Get_Size.Ref (Enums.Getter.Max_Framebuffer_Width, Ret); return Ret; end Max_Framebuffer_Width; procedure Set_Default_Height (Object : Framebuffer; Value : Size) is begin API.Named_Framebuffer_Parameter_Size.Ref (Object.Reference.GL_Id, Enums.Default_Height, Value); end Set_Default_Height; function Max_Framebuffer_Height return Size is Ret : Size := 16_384; begin API.Get_Size.Ref (Enums.Getter.Max_Framebuffer_Height, Ret); return Ret; end Max_Framebuffer_Height; procedure Set_Default_Layers (Object : Framebuffer; Value : Size) is begin API.Named_Framebuffer_Parameter_Size.Ref (Object.Reference.GL_Id, Enums.Default_Layers, Value); end Set_Default_Layers; function Max_Framebuffer_Layers return Size is Ret : Size := 2_048; begin API.Get_Size.Ref (Enums.Getter.Max_Framebuffer_Layers, Ret); return Ret; end Max_Framebuffer_Layers; procedure Set_Default_Samples (Object : Framebuffer; Value : Size) is begin API.Named_Framebuffer_Parameter_Size.Ref (Object.Reference.GL_Id, Enums.Default_Samples, Value); end Set_Default_Samples; function Max_Framebuffer_Samples return Size is Ret : Size := 4; begin API.Get_Size.Ref (Enums.Getter.Max_Framebuffer_Samples, Ret); return Ret; end Max_Framebuffer_Samples; procedure Set_Default_Fixed_Sample_Locations (Object : Framebuffer; Value : Boolean) is begin API.Named_Framebuffer_Parameter_Bool.Ref (Object.Reference.GL_Id, Enums.Default_Fixed_Sample_Locations, Low_Level.Bool (Value)); end Set_Default_Fixed_Sample_Locations; overriding procedure Initialize_Id (Object : in out Framebuffer) is New_Id : UInt := 0; begin API.Create_Framebuffers.Ref (1, New_Id); Object.Reference.GL_Id := New_Id; end Initialize_Id; overriding procedure Delete_Id (Object : in out Framebuffer) is Arr : constant Low_Level.UInt_Array := (1 => Object.Reference.GL_Id); begin API.Delete_Framebuffers.Ref (1, Arr); Object.Reference.GL_Id := 0; end Delete_Id; procedure Bind (Target : Framebuffer_Target; Object : Framebuffer'Class) is begin API.Bind_Framebuffer.Ref (Target.Kind, Object.Reference.GL_Id); end Bind; procedure Clear_Color_Buffer (Object : Framebuffer; Index : Buffers.Draw_Buffer_Index; Format_Type : Pixels.Extensions.Format_Type; Value : Colors.Color) is use all type GL.Pixels.Extensions.Format_Type; begin case Format_Type is when Float_Or_Normalized_Type => API.Clear_Named_Framebuffer_Color_Real.Ref (Object.Reference.GL_Id, Enums.Color_Buffer, Index, Value); when Int_Type => API.Clear_Named_Framebuffer_Color_Signed_Int.Ref (Object.Reference.GL_Id, Enums.Color_Buffer, Index, Value); when Unsigned_Int_Type => API.Clear_Named_Framebuffer_Color_Unsigned_Int.Ref (Object.Reference.GL_Id, Enums.Color_Buffer, Index, Value); when Depth_Type => raise Constraint_Error; end case; end Clear_Color_Buffer; procedure Clear_Depth_Buffer (Object : Framebuffer; Value : Buffers.Depth) is Aliased_Value : aliased Buffers.Depth := Value; begin API.Clear_Named_Framebuffer_Depth.Ref (Object.Reference.GL_Id, Enums.Depth_Buffer, 0, Aliased_Value); end Clear_Depth_Buffer; procedure Clear_Stencil_Buffer (Object : Framebuffer; Value : Buffers.Stencil_Index) is Aliased_Value : aliased Buffers.Stencil_Index := Value; begin API.Clear_Named_Framebuffer_Stencil.Ref (Object.Reference.GL_Id, Enums.Stencil_Buffer, 0, Aliased_Value); end Clear_Stencil_Buffer; procedure Clear_Depth_And_Stencil_Buffer (Object : Framebuffer; Depth_Value : Buffers.Depth; Stencil_Value : Buffers.Stencil_Index) is begin API.Clear_Named_Framebuffer_Depth_Stencil.Ref (Object.Reference.GL_Id, Enums.Depth_Stencil_Buffer, 0, Depth_Value, Stencil_Value); end Clear_Depth_And_Stencil_Buffer; ----------------------------------------------------------------------------- type Default_Framebuffer_Type is new Framebuffer with null record; overriding procedure Initialize_Id (Object : in out Default_Framebuffer_Type) is null; overriding procedure Delete_Id (Object : in out Default_Framebuffer_Type) is null; Default_FB : constant Default_Framebuffer_Type := Default_Framebuffer_Type'(GL_Object with null record); function Default_Framebuffer return Framebuffer is (Framebuffer (Default_FB)); end GL.Objects.Framebuffers;
Fabien-Chouteau/AGATE
Ada
2,776
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018-2020, 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. -- -- -- ------------------------------------------------------------------------------ with HAL; package AGATE_Arch_Parameters is subtype Word is HAL.UInt32; type Trap_ID is range 0 .. 32; type Trap_Priority is range 0 .. 32; type Task_Context is array (4 .. 12) of Word with Pack, Size => 9 * 32; -- For armvX-m, the context contans the registers that are not saved by the -- CPU during a trap. Timer_Frequency : constant := 1000; end AGATE_Arch_Parameters;
reznikmm/matreshka
Ada
3,971
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.ODF_Attributes.Table.Number_Columns_Spanned; package ODF.DOM.Attributes.Table.Number_Columns_Spanned.Internals is function Create (Node : Matreshka.ODF_Attributes.Table.Number_Columns_Spanned.Table_Number_Columns_Spanned_Access) return ODF.DOM.Attributes.Table.Number_Columns_Spanned.ODF_Table_Number_Columns_Spanned; function Wrap (Node : Matreshka.ODF_Attributes.Table.Number_Columns_Spanned.Table_Number_Columns_Spanned_Access) return ODF.DOM.Attributes.Table.Number_Columns_Spanned.ODF_Table_Number_Columns_Spanned; end ODF.DOM.Attributes.Table.Number_Columns_Spanned.Internals;
stcarrez/dynamo
Ada
5,610
ads
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT COMPONENTS -- -- -- -- A S I S . E X T E N S I O N S . I T E R A T O R -- -- -- -- S p e c -- -- -- -- Copyright (c) 2003-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.adacore.com). -- -- -- ------------------------------------------------------------------------------ -- This package encapsulates the generic procedure Traverse_Unit which -- is a generalization of the standard ASIS Asis.Iterator.Traverse_Element -- procedure. Traverse_Unit traverses all the syntactical components of the -- argument ASIS Compilation Unit. package Asis.Extensions.Iterator is generic type State_Information is limited private; with procedure Pre_Operation (Element : Asis.Element; Control : in out Traverse_Control; State : in out State_Information) is <>; with procedure Post_Operation (Element : Asis.Element; Control : in out Traverse_Control; State : in out State_Information) is <>; procedure Traverse_Unit (Unit : Asis.Compilation_Unit; Control : in out Traverse_Control; State : in out State_Information); -- Traverses all the syntactical structure of the argument Compilation -- Unit. In ASIS, a Compilation Unit consists of context clause Elements -- and of the Element representing the program unit, and these syntax -- elements does not have a common root. Traverse_Unit instantiates -- Asis.Iterator.Traverse_Element passing its own formal parameters as -- actuals for Traverse_Element. Then it goes into all the -- first-depth-level structural components of the argument Compilation -- Unit by applying this instance of Traverse_Element to it. -- -- If the value of traverse Control becomes Terminate_Immediately, -- traversing of all the unit components is terminated (that is, if it -- happens in some context clause Element, the Unit declaration Element -- will not be traversed. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- -- A_Procedure_Body -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit end Asis.Extensions.Iterator;
reznikmm/matreshka
Ada
4,419
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.FO.Hyphenation_Remain_Char_Count.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.FO.Hyphenation_Remain_Char_Count.FO_Hyphenation_Remain_Char_Count_Access) return ODF.DOM.Attributes.FO.Hyphenation_Remain_Char_Count.ODF_FO_Hyphenation_Remain_Char_Count is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.FO.Hyphenation_Remain_Char_Count.FO_Hyphenation_Remain_Char_Count_Access) return ODF.DOM.Attributes.FO.Hyphenation_Remain_Char_Count.ODF_FO_Hyphenation_Remain_Char_Count is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.FO.Hyphenation_Remain_Char_Count.Internals;
AdaCore/libadalang
Ada
21
ads
package P is end P;
wookey-project/ewok-legacy
Ada
2,833
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. -- -- with ewok.tasks_shared; use ewok.tasks_shared; with soc.dma.interfaces; with types.c; package ewok.exported.dma with spark_mode => off is -- Specify DMA elements to (re)configure type t_config_mask is new soc.dma.interfaces.t_config_mask; -- -- User defined DMA configuration -- type t_controller is new soc.dma.t_dma_periph_index with size => 8; subtype t_stream is unsigned_8 range 0 .. 7; subtype t_channel is unsigned_8 range 0 .. 7; type t_dma_user_config is record controller : t_controller := ID_DMA1; stream : t_stream := 0; channel : t_channel := 0; size : unsigned_16; -- size in bytes in_addr : system_address; in_priority : soc.dma.interfaces.t_priority_level; in_handler : system_address; -- ISR out_addr : system_address; out_priority : soc.dma.interfaces.t_priority_level; out_handler : system_address; -- ISR flow_controller : soc.dma.interfaces.t_flow_controller; transfer_dir : soc.dma.interfaces.t_transfer_dir; mode : soc.dma.interfaces.t_mode; data_size : soc.dma.interfaces.t_data_size; memory_inc : types.c.bool; periph_inc : types.c.bool; mem_burst_size : soc.dma.interfaces.t_burst_size; periph_burst_size : soc.dma.interfaces.t_burst_size; end record; type t_dma_user_config_access is access all t_dma_user_config; type t_dma_shm_access is (SHM_ACCESS_READ, SHM_ACCESS_WRITE); -- The caller (accessed_id) grant access to another task (granted_id) -- to a range in its inner memory space. That mechanism permits to the -- 'granted' to configure the DMA with an address that belongs to -- the 'accessed' task. type t_dma_shm_info is record granted_id : t_task_id; accessed_id : t_task_id; -- caller base : system_address; size : unsigned_32; access_type : t_dma_shm_access; end record; end ewok.exported.dma;
optikos/oasis
Ada
3,819
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Compilation_Unit_Vectors; with Program.Contexts; with Program.Source_Buffers; with Program.Symbols; with Program.Visibility; private with Ada.Containers.Hashed_Maps; private with Ada.Containers.Vectors; private with Program.Compilation_Units; private with Program.Compilations; private with Program.Symbols.Tables; package Program.Plain_Contexts is pragma Preelaborate; type Context is limited new Program.Contexts.Context with private; procedure Initialize (Self : in out Context'Class); procedure Find_Or_Create_Symbol (Self : in out Context'Class; Buffer : not null Program.Source_Buffers.Source_Buffer_Access; Span : Program.Source_Buffers.Span; Result : out Program.Symbols.Symbol); function Find (Self : Context'Class; Value : Program.Text) return Program.Symbols.Symbol; procedure Parse_File (Self : aliased in out Context'Class; Text_Name : Text; Env : aliased in out Program.Visibility.Context); overriding function Library_Unit_Declarations (Self : Context) return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access; overriding function Compilation_Unit_Bodies (Self : Context) return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access; private type Symbol_List_Index is range 0 .. Integer'Last; function Hash (Value : Symbol_List_Index) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (Value)); type Symbol_List_Item is record Prefix : Symbol_List_Index; Symbol : Program.Symbols.Symbol; end record; function Hash (Value : Symbol_List_Item) return Ada.Containers.Hash_Type; package Symbol_List_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Symbol_List_Item, Element_Type => Symbol_List_Index, Hash => Hash, Equivalent_Keys => "="); package Unit_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Symbol_List_Index, Element_Type => Program.Compilation_Units.Compilation_Unit_Access, Hash => Hash, Equivalent_Keys => "=", "=" => Program.Compilation_Units."="); package Unit_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Program.Compilation_Units.Compilation_Unit_Access, "=" => Program.Compilation_Units."="); type Unit_Vector (Context : access Program.Plain_Contexts.Context) is limited new Program.Compilation_Unit_Vectors.Compilation_Unit_Vector with record Map : Unit_Maps.Map; List : Unit_Vectors.Vector; end record; overriding function Get_Length (Self : Unit_Vector) return Positive; overriding function Element (Self : Unit_Vector; Index : Positive) return not null Program.Compilation_Units.Compilation_Unit_Access; overriding function Find_Unit (Self : Unit_Vector; Name : Text) return Program.Compilation_Units.Compilation_Unit_Access; package Compilation_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Program.Compilations.Compilation_Access, "=" => Program.Compilations."="); type Context is limited new Program.Contexts.Context with record Symbols : Program.Symbols.Tables.Symbol_Table; Symbol_Lists : Symbol_List_Maps.Map; Declarations : aliased Unit_Vector (Context'Unchecked_Access); Bodies : aliased Unit_Vector (Context'Unchecked_Access); Compilations : Compilation_Vectors.Vector; end record; end Program.Plain_Contexts;
ellamosi/Ada_BMP_Library
Ada
3,821
adb
with Test_Directories; use Test_Directories; with Ada.Text_IO; use Ada.Text_IO; with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Bitmap; use Bitmap; with Bitmap.Buffer; use Bitmap.Buffer; with Bitmap.File_IO; use Bitmap.File_IO; with Bitmap.Memory_Mapped; use Bitmap.Memory_Mapped; with Compare_Files; procedure TC_BMP_File_Output is BM_Width : constant := 100; BM_Height : constant := 100; function Allocate_Bitmap return not null Any_Bitmap_Buffer; --------------------- -- Allocate_Bitmap -- --------------------- function Allocate_Bitmap return not null Any_Bitmap_Buffer is type Pixel_Data is new Bitmap.UInt16_Array (1 .. BM_Height * BM_Height) with Pack; type Pixel_Data_Access is access Pixel_Data; BM : constant Any_Memory_Mapped_Bitmap_Buffer := new Memory_Mapped_Bitmap_Buffer; Data : constant Pixel_Data_Access := new Pixel_Data; begin BM.Actual_Width := BM_Width; BM.Actual_Height := BM_Height; BM.Actual_Color_Mode := RGB_565; BM.Currently_Swapped := False; BM.Addr := Data.all'Address; return Any_Bitmap_Buffer (BM); end Allocate_Bitmap; BMP_File : Ada.Streams.Stream_IO.File_Type; BM : constant not null Any_Bitmap_Buffer := Allocate_Bitmap; Filename : constant String := "test.bmp"; begin Create (BMP_File, Out_File, Test_Dir & "/" & Filename); BM.Fill (Black); BM.Fill_Rounded_Rect (Color => Green, Area => ((5, 5), BM_Width / 2, BM_Height / 2), Radius => 10); BM.Draw_Rounded_Rect (Color => Red, Area => ((5, 5), BM_Width / 2, BM_Height / 2), Radius => 10, Thickness => 3); BM.Fill_Circle (Color => Yellow, Center => (BM_Width / 2, BM_Height / 2), Radius => BM_Width / 4); BM.Draw_Circle (Color => Blue, Center => (BM_Width / 2, BM_Height / 2), Radius => BM_Width / 4); BM.Cubic_Bezier (Color => Violet, P1 => (5, 5), P2 => (0, BM_Height / 2), P3 => (BM_Width / 2, BM_Height / 2), P4 => (BM_Width - 5, BM_Height - 5), N => 100, Thickness => 3); BM.Draw_Line (Color => White, Start => (0, 0), Stop => (BM_Width - 1, BM_Height / 2), Thickness => 1, Fast => True); BM.Set_Pixel ((0, 0), Red); BM.Set_Pixel ((0, 1), Green); BM.Set_Pixel ((0, 2), Blue); Copy_Rect (Src_Buffer => BM.all, Src_Pt => (0, 0), Dst_Buffer => BM.all, Dst_Pt => (0, BM_Height / 2 + 10), Width => BM_Width / 4, Height => BM_Height / 4, Synchronous => True); Write_BMP_File (BMP_File, BM.all); Close (BMP_File); if not Compare_Files.Binnary_Equal (Test_Dir & "/" & Filename, Test_Dir & "/ref.bmp") then Put_Line ("BMP file writing test FAILED."); Put_Line ("Output BMP is different than the reference."); Put_Line ("This could mean that:"); Put_Line (" 1 - Bitmap drawing is broken"); Put_Line (" 2 - Bitmap file output is broken"); Put_Line (" 3 - You changed/improved bitmap drawing"); New_Line; Put_Line ("When 1 or 2, please fix the problem,"); Put_Line ("When 3 please update the reference bitmap and exaplaining" & " the changes you made."); else Put_Line ("BMP file writing test OK"); end if; end TC_BMP_File_Output;
melwyncarlo/ProjectEuler
Ada
835
adb
with Ada.Integer_Text_IO; -- Copyright 2021 Melwyn Francis Carlo procedure A039 is use Ada.Integer_Text_IO; P_Max_Solutions : Integer := 0; N_Max_Solutions : Integer := 0; B, N : Integer; A, B2, P2 : Float; begin for P in reverse 500 .. 1000 loop B := 1; N := 0; loop if B = Integer (Float (P) / 2.0) then exit; end if; P2 := Float (P); B2 := Float (B); A := ((P2 * P2) - (2.0 * P2 * B2)) / ((2.0 * P2) - (2.0 * B2)); if Float'Floor (A) = A then N := N + 1; end if; B := B + 1; end loop; if N > N_Max_Solutions then N_Max_Solutions := N; P_Max_Solutions := P; end if; end loop; Put (P_Max_Solutions, Width => 0); end A039;
sparre/Command-Line-Parser-Generator
Ada
290
ads
-- Copyright: JSA Research & Innovation <[email protected]> -- License: Beer Ware pragma License (Unrestricted); with Ada.Strings.Wide_Unbounded; function Wide_Unbounded_Equal_Case_Insensitive (Left, Right : in Ada.Strings.Wide_Unbounded.Unbounded_Wide_String) return Boolean;
reznikmm/matreshka
Ada
4,694
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_Svg.Strikethrough_Position_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Svg_Strikethrough_Position_Attribute_Node is begin return Self : Svg_Strikethrough_Position_Attribute_Node do Matreshka.ODF_Svg.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Svg_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Svg_Strikethrough_Position_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Strikethrough_Position_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Svg_URI, Matreshka.ODF_String_Constants.Strikethrough_Position_Attribute, Svg_Strikethrough_Position_Attribute_Node'Tag); end Matreshka.ODF_Svg.Strikethrough_Position_Attributes;
reznikmm/clic
Ada
608
ads
with AAA.Strings; with CLIC.Subcommand; with CLIC.TTY; package CLIC_Ex.Commands.Topics.Example is type Instance is new CLIC.Subcommand.Help_Topic with null record; overriding function Name (This : Instance) return CLIC.Subcommand.Identifier is ("topic_example"); overriding function Title (This : Instance) return String is ("Just an example of CLIC help topic"); overriding function Content (This : Instance) return AAA.Strings.Vector is (AAA.Strings.Empty_Vector .Append ("Not " & CLIC.TTY.Dim ("much") & " to see here...")); end CLIC_Ex.Commands.Topics.Example;
onox/orka
Ada
1,540
adb
-- 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 Ada.Unchecked_Conversion; with Orka.SIMD.AVX.Doubles.Arithmetic; with Orka.SIMD.AVX.Longs.Logical; package body Orka.SIMD.AVX.Doubles.Compare is use SIMD.AVX.Doubles.Arithmetic; use SIMD.AVX.Longs.Logical; use SIMD.AVX.Longs; function Is_True (Elements : m256d; Position : Index_4D) return Boolean is begin return Elements (Position) /= 0.0; exception when Constraint_Error => return True; end Is_True; function Is_Equal (Left, Right : m256d) return Boolean is Epsilon : constant := Float_64'Model_Epsilon; function Convert is new Ada.Unchecked_Conversion (m256d, m256l); Result : constant m256d := abs (Left - Right) <= (Epsilon, Epsilon, Epsilon, Epsilon); begin return Test_All_Ones (Convert (Result), Convert (Result = Result)); end Is_Equal; end Orka.SIMD.AVX.Doubles.Compare;
stcarrez/ada-asf
Ada
2,676
ads
----------------------------------------------------------------------- -- components-root -- ASF Root View Component -- Copyright (C) 2010, 2011, 2012 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.Finalization; limited with ASF.Components.Base; package ASF.Components.Root is type UIViewRoot is private; -- Get the root node of the view. function Get_Root (UI : in UIViewRoot) return access ASF.Components.Base.UIComponent'Class; -- Get the view identifier. function Get_View_Id (UI : in UIViewRoot) return String; -- Create an identifier for a component. procedure Create_Unique_Id (UI : in out UIViewRoot; Id : out Natural); -- Set the root node of the view. procedure Set_Root (UI : in out UIViewRoot; Root : access ASF.Components.Base.UIComponent'Class; Name : in String); -- Set the metadata component of the view. procedure Set_Meta (UI : in out UIViewRoot); -- Returns True if the view has a metadata component. function Has_Meta (UI : in UIViewRoot) return Boolean; private -- The <b>Root_Holder</b> must be shared by multiple <b>UIViewRoot</b> instances. -- If this happens, this is shared by the <b>same</b> task. type Root_Holder (Len : Natural) is limited record Ref_Counter : Natural; View : access ASF.Components.Base.UIComponent'Class; Meta : access ASF.Components.Base.UIComponent'Class; Name : String (1 .. Len); end record; type Root_Holder_Access is access all Root_Holder; type UIViewRoot is new Ada.Finalization.Controlled with record Root : Root_Holder_Access := null; Last_Id : Natural := 0; end record; -- Increment the reference counter. overriding procedure Adjust (Object : in out UIViewRoot); -- Free the memory held by the component tree. overriding procedure Finalize (Object : in out UIViewRoot); end ASF.Components.Root;
AdaCore/training_material
Ada
1,583
adb
package body Basics is procedure Swap (X, Y : in out Integer) is Tmp : Integer := X; begin X := Y; Y := Tmp; end Swap; procedure Swap_Rec (R : in out Rec) is begin Swap (R.A, R.B); end Swap_Rec; procedure Swap_Table (T : in out Table; I, J : Index) is begin if I /= J then Swap (T (I), T (J)); pragma Annotate (GNATprove, False_Positive, "formal parameters * might be aliased", "I /= J so T(I) and T(J) cannot alias"); end if; end Swap_Table; procedure Swap_The_Rec is begin Swap_Rec (The_Rec); end Swap_The_Rec; procedure Swap_The_Table (I, J : Index) is begin Swap_Table (The_Table, I, J); end Swap_The_Table; procedure Init_Rec (R : out Rec) is begin R.A := 1; R.B := 2; end Init_Rec; procedure Init_Table (T : out Table) is begin T := (others => 0); T (T'First) := 1; T (T'Last) := 2; end Init_Table; procedure Init_The_Rec is begin Init_Rec (The_Rec); end Init_The_Rec; procedure Init_The_Table is begin Init_Table (The_Table); end Init_The_Table; procedure Strange_Init_Rec (R : out Rec; Cond : Boolean) is begin if Cond then Init_Rec (R); else Init_Rec (R); end if; end Strange_Init_Rec; procedure Strange_Init_Table (T : out Table; Val : Integer) is begin T := (others => 0); T (T'First) := Val; T (T'First) := 0; end Strange_Init_Table; end Basics;
osannolik/ada-canopen
Ada
3,233
ads
with Ada.Real_Time; with ACO.Utils.Generic_Event; with ACO.Messages; with ACO.States; with ACO.SDO_Sessions; with ACO.OD_Types; with ACO.Configuration; package ACO.Events is use ACO.Configuration; type Handler_Event_Type is (Tick, Received_Message); type Handler_Event_Data (Event : Handler_Event_Type := Tick) is record case Event is when Tick => Current_Time : Ada.Real_Time.Time; when Received_Message => Msg : ACO.Messages.Message; end case; end record; package HEP is new ACO.Utils.Generic_Event (Item_Type => Handler_Event_Data, Max_Nof_Subscribers => Max_Nof_Handler_Event_Subscribers, Max_Nof_Queued_Events => Max_Nof_Event_Queue_Data_Items); type Handler_Event_Listener (Event : Handler_Event_Type) is abstract new HEP.Subscriber with null record; overriding procedure Update (This : access Handler_Event_Listener; Data : in Handler_Event_Data); procedure On_Event (This : in out Handler_Event_Listener; Data : in Handler_Event_Data) is abstract; type Handler_Event_Manager is tagged limited record Handler_Events : HEP.Event_Publisher; end record; type Event_Type is (State_Transition, Slave_State_Transition, OD_Entry_Update, Heartbeat_Received, Heartbeat_Timed_Out, SDO_Status_Update); type Heartbeat_Data is record Id : ACO.Messages.Node_Nr; State : ACO.States.State; end record; type SDO_Status_Data is record Endpoint_Id : ACO.SDO_Sessions.Endpoint_Nr; Result : ACO.SDO_Sessions.SDO_Result; end record; type Slave_State_Data is record State : ACO.States.State_Transition; Node_Id : ACO.Messages.Node_Nr; end record; type Event_Data (Event : Event_Type := State_Transition) is record case Event is when State_Transition => State : ACO.States.State_Transition; when Slave_State_Transition => Slave : Slave_State_Data; when OD_Entry_Update => Index : ACO.OD_Types.Entry_Index; when Heartbeat_Received => Received_Heartbeat : Heartbeat_Data; when Heartbeat_Timed_Out => Node_Id : ACO.Messages.Node_Nr; when SDO_Status_Update => SDO_Status : SDO_Status_Data; end case; end record; package EP is new ACO.Utils.Generic_Event (Item_Type => Event_Data, Max_Nof_Subscribers => Max_Nof_Node_Event_Subscribers, Max_Nof_Queued_Events => Max_Nof_Event_Queue_Data_Items); type Event_Listener (Event : Event_Type) is abstract new EP.Subscriber with null record; overriding procedure Update (This : access Event_Listener; Data : in Event_Data); procedure On_Event (This : in out Event_Listener; Data : in Event_Data) is abstract; type Node_Event_Manager is tagged limited record Node_Events : EP.Queued_Event_Publisher (Priority_Ceiling => Event_Queue_Ceiling); end record; procedure Process (This : in out Node_Event_Manager); end ACO.Events;
reznikmm/matreshka
Ada
3,424
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Examples Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, 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 League.Strings; procedure Put_Line (Item : League.Strings.Universal_String);
AdaCore/libadalang
Ada
269
adb
procedure Test is type R is record X : Boolean; end record; function Foo (X : Integer) return Integer is (X) with Pre => Bar (X).X --% node.p_expression_type ; function Bar (X : Integer) return R is (X => True); begin null; end Test;
reznikmm/matreshka
Ada
4,688
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Office_Chart_Elements; package Matreshka.ODF_Office.Chart_Elements is type Office_Chart_Element_Node is new Matreshka.ODF_Office.Abstract_Office_Element_Node and ODF.DOM.Office_Chart_Elements.ODF_Office_Chart with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Office_Chart_Element_Node; overriding function Get_Local_Name (Self : not null access constant Office_Chart_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Office_Chart_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Office_Chart_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Office_Chart_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Office.Chart_Elements;
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_Border_Model_Attributes is pragma Preelaborate; type ODF_Table_Border_Model_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Border_Model_Attribute_Access is access all ODF_Table_Border_Model_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Border_Model_Attributes;
clairvoyant/anagram
Ada
364
ads
-- Copyright (c) 2010-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Anagram.Grammars.LR_Tables; package Anagram.Grammars.LR.Simple is function Build (Input : Grammar) return LR_Tables.Table_Access; end Anagram.Grammars.LR.Simple;
sungyeon/drake
Ada
1,308
ads
pragma License (Unrestricted); -- extended unit with Ada.Iterator_Interfaces; private with System; package Ada.Bind_Time_Variables is -- This is similar to Ada.Environment_Variables, -- but reads bind-time variables set by gnatbind -Vkey=val. pragma Preelaborate; function Value (Name : String) return String; function Value (Name : String; Default : String) return String; function Exists (Name : String) return Boolean; procedure Iterate ( Process : not null access procedure (Name, Value : String)); -- Iterators: type Cursor is private; pragma Preelaborable_Initialization (Cursor); function Has_Element (Position : Cursor) return Boolean; pragma Inline (Has_Element); function Name (Position : Cursor) return String; function Value (Position : Cursor) return String; package Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); function Iterate return Iterator_Interfaces.Forward_Iterator'Class; private type Cursor is new System.Address; type Iterator is new Iterator_Interfaces.Forward_Iterator with null record; overriding function First (Object : Iterator) return Cursor; overriding function Next (Object : Iterator; Position : Cursor) return Cursor; end Ada.Bind_Time_Variables;
fengjixuchui/ewok-kernel
Ada
1,297
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.debug with spark_mode => off is type t_level is (DEBUG, INFO, WARNING, ERROR, ALERT); BG_COLOR_BLACK : constant string := ASCII.ESC & "[37;40m"; BG_COLOR_RED : constant string := ASCII.ESC & "[37;41m"; BG_COLOR_ORANGE : constant string := ASCII.ESC & "[37;43m"; BG_COLOR_BLUE : constant string := ASCII.ESC & "[37;44m"; procedure log (s : string; nl : boolean := true); procedure log (level : t_level; s : string); procedure panic (s : string); end ewok.debug;
AaronC98/PlaneSystem
Ada
25,403
adb
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Directories; with Ada.Environment_Variables; with AWS.Config.Ini; with AWS.OS_Lib; package body AWS.Config is use Ada; Server_Config : Object; -- This variable will be updated with options found in 'aws.ini' and -- '<progname>.ini'. Ini_Loaded : Boolean := False; -- Set to True when initialization (.ini) files have been loaded procedure Read_If_Present (Filename : String); -- Read and parse Filename, does not raise an exception if the file does -- not exists. ----------------------- -- Accept_Queue_Size -- ----------------------- function Accept_Queue_Size (O : Object) return Positive is begin return O.P (Accept_Queue_Size).Pos_Value; end Accept_Queue_Size; -------------------- -- Admin_Password -- -------------------- function Admin_Password (O : Object) return String is begin return To_String (O.P (Admin_Password).Str_Value); end Admin_Password; ----------------- -- Admin_Realm -- ----------------- function Admin_Realm (O : Object) return String is begin return To_String (O.P (Admin_Realm).Str_Value); end Admin_Realm; --------------- -- Admin_URI -- --------------- function Admin_URI (O : Object) return String is begin return To_String (O.P (Admin_URI).Str_Value); end Admin_URI; ------------------------------- -- Case_Sensitive_Parameters -- ------------------------------- function Case_Sensitive_Parameters (O : Object) return Boolean is begin return O.P (Case_Sensitive_Parameters).Bool_Value; end Case_Sensitive_Parameters; ----------------- -- Certificate -- ----------------- function Certificate (O : Object) return String is begin return To_String (O.P (Certificate).Str_Value); end Certificate; -------------------------- -- Certificate_Required -- -------------------------- function Certificate_Required (O : Object) return Boolean is begin return O.P (Certificate_Required).Bool_Value; end Certificate_Required; ------------------------ -- Check_URL_Validity -- ------------------------ function Check_URL_Validity (O : Object) return Boolean is begin return O.P (Check_URL_Validity).Bool_Value; end Check_URL_Validity; ----------------------- -- Cipher_Priorities -- ----------------------- function Cipher_Priorities (O : Object) return String is begin return To_String (O.P (Cipher_Priorities).Str_Value); end Cipher_Priorities; --------------------------------- -- Cleaner_Client_Data_Timeout -- --------------------------------- function Cleaner_Client_Data_Timeout (O : Object) return Duration is begin return O.P (Cleaner_Client_Data_Timeout).Dur_Value; end Cleaner_Client_Data_Timeout; ----------------------------------- -- Cleaner_Client_Header_Timeout -- ----------------------------------- function Cleaner_Client_Header_Timeout (O : Object) return Duration is begin return O.P (Cleaner_Client_Header_Timeout).Dur_Value; end Cleaner_Client_Header_Timeout; ------------------------------------- -- Cleaner_Server_Response_Timeout -- ------------------------------------- function Cleaner_Server_Response_Timeout (O : Object) return Duration is begin return O.P (Cleaner_Server_Response_Timeout).Dur_Value; end Cleaner_Server_Response_Timeout; ------------------------------------- -- Cleaner_Wait_For_Client_Timeout -- ------------------------------------- function Cleaner_Wait_For_Client_Timeout (O : Object) return Duration is begin return O.P (Cleaner_Wait_For_Client_Timeout).Dur_Value; end Cleaner_Wait_For_Client_Timeout; ---------------------- -- Config_Directory -- ---------------------- function Config_Directory return String is use Ada.Characters.Handling; function Home_Path return String; --------------- -- Home_Path -- --------------- function Home_Path return String is use Ada.Environment_Variables; Home : constant String := "HOME"; -- Unix User : constant String := "USERPROFILE"; -- Windows begin if Exists (Home) then return Value (Home); elsif Exists (User) then return Value (User); else return "~"; end if; end Home_Path; Result : constant String := To_String (Process_Options (Config_Directory).Str_Value); begin if Result'Length = 0 or else Result (Result'First) in '/' | '\' or else (Result'Length > 2 and then To_Lower (Result (Result'First)) in 'a' .. 'z' and then Result (Result'First + 1) = ':') then return Result; end if; return Home_Path & OS_Lib.Directory_Separator & Result; end Config_Directory; ---------------------- -- Context_Lifetime -- ---------------------- function Context_Lifetime return Duration is begin return Process_Options (Context_Lifetime).Dur_Value; end Context_Lifetime; -------------- -- CRL_File -- -------------- function CRL_File (O : Object) return String is begin return To_String (O.P (CRL_File).Str_Value); end CRL_File; ---------------------------- -- Directory_Browser_Page -- ---------------------------- function Directory_Browser_Page (O : Object) return String is begin return To_String (O.P (Directory_Browser_Page).Str_Value); end Directory_Browser_Page; ---------------- -- Down_Image -- ---------------- function Down_Image (O : Object) return String is begin return To_String (O.P (Down_Image).Str_Value); end Down_Image; ------------------------- -- Error_Log_Activated -- ------------------------- function Error_Log_Activated (O : Object) return Boolean is begin return O.P (Error_Log_Activated).Bool_Value; end Error_Log_Activated; ------------------------------- -- Error_Log_Filename_Prefix -- ------------------------------- function Error_Log_Filename_Prefix (O : Object) return String is begin return To_String (O.P (Error_Log_Filename_Prefix).Str_Value); end Error_Log_Filename_Prefix; -------------------------- -- Error_Log_Split_Mode -- -------------------------- function Error_Log_Split_Mode (O : Object) return String is begin return To_String (O.P (Error_Log_Split_Mode).Str_Value); end Error_Log_Split_Mode; -------------------------- -- Exchange_Certificate -- -------------------------- function Exchange_Certificate (O : Object) return Boolean is begin return O.P (Exchange_Certificate).Bool_Value; end Exchange_Certificate; ------------------------------- -- Force_Client_Data_Timeout -- ------------------------------- function Force_Client_Data_Timeout (O : Object) return Duration is begin return O.P (Force_Client_Data_Timeout).Dur_Value; end Force_Client_Data_Timeout; --------------------------------- -- Force_Client_Header_Timeout -- --------------------------------- function Force_Client_Header_Timeout (O : Object) return Duration is begin return O.P (Force_Client_Header_Timeout).Dur_Value; end Force_Client_Header_Timeout; ----------------------------------- -- Force_Server_Response_Timeout -- ----------------------------------- function Force_Server_Response_Timeout (O : Object) return Duration is begin return O.P (Force_Server_Response_Timeout).Dur_Value; end Force_Server_Response_Timeout; ----------------------------------- -- Force_Wait_For_Client_Timeout -- ----------------------------------- function Force_Wait_For_Client_Timeout (O : Object) return Duration is begin return O.P (Force_Wait_For_Client_Timeout).Dur_Value; end Force_Wait_For_Client_Timeout; --------------------------------- -- Free_Slots_Keep_Alive_Limit -- --------------------------------- function Free_Slots_Keep_Alive_Limit (O : Object) return Natural is begin return O.P (Free_Slots_Keep_Alive_Limit).Nat_Value; end Free_Slots_Keep_Alive_Limit; ----------------- -- Get_Current -- ----------------- function Get_Current return Object is begin if not Ini_Loaded then Ini_Loaded := True; Load_Config; end if; return Server_Config; end Get_Current; ------------------ -- Hotplug_Port -- ------------------ function Hotplug_Port (O : Object) return Positive is begin return O.P (Hotplug_Port).Pos_Value; end Hotplug_Port; --------------------------- -- Input_Line_Size_Limit -- --------------------------- function Input_Line_Size_Limit return Positive is begin return Process_Options (Input_Line_Size_Limit).Pos_Value; end Input_Line_Size_Limit; --------------- -- IPv6_Only -- --------------- function IPv6_Only (O : Object) return Boolean is begin return O.P (IPv6_Only).Bool_Value; end IPv6_Only; ----------------------------- -- Is_WebSocket_Origin_Set -- ----------------------------- function Is_WebSocket_Origin_Set return Boolean is begin return Process_Options (Parameter_Name'(WebSocket_Origin)).Is_Set; end Is_WebSocket_Origin_Set; ---------------------------- -- Keep_Alive_Close_Limit -- ---------------------------- function Keep_Alive_Close_Limit (O : Object) return Positive is begin if O.P (Keep_Alive_Close_Limit).Nat_Value = 0 then return Max_Connection (O) * 4; else return O.P (Keep_Alive_Close_Limit).Nat_Value; end if; end Keep_Alive_Close_Limit; ---------------------------- -- Keep_Alive_Force_Limit -- ---------------------------- function Keep_Alive_Force_Limit (O : Object) return Positive is begin if O.P (Keep_Alive_Force_Limit).Nat_Value = 0 then return Max_Connection (O) * 2; else return O.P (Keep_Alive_Force_Limit).Nat_Value; end if; end Keep_Alive_Force_Limit; --------- -- Key -- --------- function Key (O : Object) return String is begin return To_String (O.P (Key).Str_Value); end Key; --------------------- -- Line_Stack_Size -- --------------------- function Line_Stack_Size (O : Object) return Positive is begin return O.P (Line_Stack_Size).Pos_Value; end Line_Stack_Size; ----------------- -- Load_Config -- ----------------- procedure Load_Config is begin Read_If_Present (Config_Directory & OS_Lib.Directory_Separator & "aws.ini"); Read_If_Present ("aws.ini"); Read_If_Present (Ini.Program_Ini_File (Full_Path => True)); Read_If_Present (Ini.Program_Ini_File (Full_Path => False)); end Load_Config; ------------------- -- Log_Activated -- ------------------- function Log_Activated (O : Object) return Boolean is begin return O.P (Log_Activated).Bool_Value; end Log_Activated; ----------------------------------------- -- Log_Extended_Fields_Generic_Iterate -- ----------------------------------------- procedure Log_Extended_Fields_Generic_Iterate (O : Object) is begin for J in 1 .. Log_Extended_Fields_Length (O) loop Field_Id (SV.Element (O.P (Log_Extended_Fields).Strs_Value, J)); end loop; end Log_Extended_Fields_Generic_Iterate; -------------------------------- -- Log_Extended_Fields_Length -- -------------------------------- function Log_Extended_Fields_Length (O : Object) return Natural is begin return Natural (SV.Length (O.P (Log_Extended_Fields).Strs_Value)); end Log_Extended_Fields_Length; ------------------------ -- Log_File_Directory -- ------------------------ function Log_File_Directory (O : Object) return String is begin return To_String (O.P (Log_File_Directory).Dir_Value); end Log_File_Directory; ------------------------- -- Log_Filename_Prefix -- ------------------------- function Log_Filename_Prefix (O : Object) return String is begin return To_String (O.P (Log_Filename_Prefix).Str_Value); end Log_Filename_Prefix; -------------------- -- Log_Size_Limit -- -------------------- function Log_Size_Limit (O : Object) return Natural is begin return O.P (Log_Size_Limit).Nat_Value; end Log_Size_Limit; -------------------- -- Log_Split_Mode -- -------------------- function Log_Split_Mode (O : Object) return String is begin return To_String (O.P (Log_Split_Mode).Str_Value); end Log_Split_Mode; ---------------- -- Logo_Image -- ---------------- function Logo_Image (O : Object) return String is begin return To_String (O.P (Logo_Image).Str_Value); end Logo_Image; ----------------------------- -- Max_Concurrent_Download -- ----------------------------- function Max_Concurrent_Download return Positive is begin return Process_Options (Max_Concurrent_Download).Pos_Value; end Max_Concurrent_Download; -------------------- -- Max_Connection -- -------------------- function Max_Connection (O : Object) return Positive is begin return O.P (Max_Connection).Pos_Value; end Max_Connection; ------------------------- -- Max_POST_Parameters -- ------------------------- function Max_POST_Parameters (O : Object) return Positive is begin return O.P (Max_POST_Parameters).Pos_Value; end Max_POST_Parameters; ------------------- -- Max_WebSocket -- ------------------- function Max_WebSocket return Positive is begin return Process_Options (Max_WebSocket).Pos_Value; end Max_WebSocket; --------------------------- -- Max_WebSocket_Handler -- --------------------------- function Max_WebSocket_Handler return Positive is begin return Process_Options (Max_WebSocket_Handler).Pos_Value; end Max_WebSocket_Handler; ---------------- -- MIME_Types -- ---------------- function MIME_Types return String is begin return To_String (Process_Options (MIME_Types).Str_Value); end MIME_Types; --------------------- -- Protocol_Family -- --------------------- function Protocol_Family (O : Object) return String is begin return To_String (O.P (Protocol_Family).Str_Value); end Protocol_Family; --------------------- -- Read_If_Present -- --------------------- procedure Read_If_Present (Filename : String) is begin if Directories.Exists (Filename) then Ini.Read (Server_Config, Filename); end if; end Read_If_Present; --------------------- -- Receive_Timeout -- --------------------- function Receive_Timeout (O : Object) return Duration is begin return O.P (Receive_Timeout).Dur_Value; end Receive_Timeout; ------------------- -- Reuse_Address -- ------------------- function Reuse_Address (O : Object) return Boolean is begin return O.P (Reuse_Address).Bool_Value; end Reuse_Address; -------------- -- Security -- -------------- function Security (O : Object) return Boolean is begin return O.P (Security).Bool_Value; end Security; ------------------- -- Security_Mode -- ------------------- function Security_Mode (O : Object) return String is begin return To_String (O.P (Security_Mode).Str_Value); end Security_Mode; ---------------------- -- Send_Buffer_Size -- ---------------------- function Send_Buffer_Size (O : Object) return Natural is begin return O.P (Send_Buffer_Size).Nat_Value; end Send_Buffer_Size; ------------------ -- Send_Timeout -- ------------------ function Send_Timeout (O : Object) return Duration is begin return O.P (Send_Timeout).Dur_Value; end Send_Timeout; ------------------- -- Server_Header -- ------------------- function Server_Header (O : Object) return String is begin return To_String (O.P (Server_Header).Str_Value); end Server_Header; ----------------- -- Server_Host -- ----------------- function Server_Host (O : Object) return String is begin return To_String (O.P (Server_Host).Str_Value); end Server_Host; ----------------- -- Server_Name -- ----------------- function Server_Name (O : Object) return String is begin return To_String (O.P (Server_Name).Str_Value); end Server_Name; ----------------- -- Server_Port -- ----------------- function Server_Port (O : Object) return Natural is begin return O.P (Server_Port).Nat_Value; end Server_Port; --------------------- -- Server_Priority -- --------------------- function Server_Priority (O : Object) return System.Any_Priority is begin return O.P (Server_Priority).Nat_Value; end Server_Priority; ---------------------- -- Service_Priority -- ---------------------- function Service_Priority return System.Any_Priority is begin return Process_Options (Service_Priority).Nat_Value; end Service_Priority; ------------- -- Session -- ------------- function Session (O : Object) return Boolean is begin return O.P (Session).Bool_Value; end Session; ------------------------------ -- Session_Cleaner_Priority -- ------------------------------ function Session_Cleaner_Priority return System.Any_Priority is begin return Process_Options (Session_Cleaner_Priority).Nat_Value; end Session_Cleaner_Priority; ------------------------------ -- Session_Cleanup_Interval -- ------------------------------ function Session_Cleanup_Interval return Duration is begin return Process_Options (Session_Cleanup_Interval).Dur_Value; end Session_Cleanup_Interval; ----------------------- -- Session_Id_Length -- ----------------------- function Session_Id_Length return Positive is begin return Process_Options (Session_Id_Length).Pos_Value; end Session_Id_Length; ---------------------- -- Session_Lifetime -- ---------------------- function Session_Lifetime return Duration is begin return Process_Options (Session_Lifetime).Dur_Value; end Session_Lifetime; ------------------ -- Session_Name -- ------------------ function Session_Name (O : Object) return String is begin return To_String (O.P (Session_Name).Str_Value); end Session_Name; -------------------------- -- Session_Private_Name -- -------------------------- function Session_Private_Name (O : Object) return String is begin return To_String (O.P (Session_Private_Name).Str_Value); end Session_Private_Name; ---------------------------- -- SSL_Session_Cache_Size -- ---------------------------- function SSL_Session_Cache_Size (O : Object) return Natural is begin return O.P (SSL_Session_Cache_Size).Nat_Value; end SSL_Session_Cache_Size; ----------------- -- Status_Page -- ----------------- function Status_Page (O : Object) return String is begin return To_String (O.P (Status_Page).Str_Value); end Status_Page; ------------------ -- TCP_No_Delay -- ------------------ function TCP_No_Delay (O : Object) return Boolean is begin return O.P (TCP_No_Delay).Bool_Value; end TCP_No_Delay; ------------------------ -- TLS_Ticket_Support -- ------------------------ function TLS_Ticket_Support (O : Object) return Boolean is begin return O.P (TLS_Ticket_Support).Bool_Value; end TLS_Ticket_Support; -------------------------------- -- Transient_Cleanup_Interval -- -------------------------------- function Transient_Cleanup_Interval return Duration is begin return Process_Options (Transient_Cleanup_Interval).Dur_Value; end Transient_Cleanup_Interval; ------------------------ -- Transient_Lifetime -- ------------------------ function Transient_Lifetime return Duration is begin return Process_Options (Transient_Lifetime).Dur_Value; end Transient_Lifetime; ---------------- -- Trusted_CA -- ---------------- function Trusted_CA (O : Object) return String is begin return To_String (O.P (Trusted_CA).Str_Value); end Trusted_CA; -------------- -- Up_Image -- -------------- function Up_Image (O : Object) return String is begin return To_String (O.P (Up_Image).Str_Value); end Up_Image; ---------------------- -- Upload_Directory -- ---------------------- function Upload_Directory (O : Object) return String is begin return To_String (O.P (Upload_Directory).Dir_Value); end Upload_Directory; ----------------------- -- Upload_Size_Limit -- ----------------------- function Upload_Size_Limit (O : Object) return Positive is begin return O.P (Upload_Size_Limit).Pos_Value; end Upload_Size_Limit; ---------------- -- User_Agent -- ---------------- function User_Agent return String is begin return To_String (Process_Options (User_Agent).Str_Value); end User_Agent; ---------------------------------- -- WebSocket_Message_Queue_Size -- ---------------------------------- function WebSocket_Message_Queue_Size return Positive is begin return Process_Options (WebSocket_Message_Queue_Size).Pos_Value; end WebSocket_Message_Queue_Size; ---------------------- -- WebSocket_Origin -- ---------------------- function WebSocket_Origin return GNAT.Regexp.Regexp is begin return Process_Options (WebSocket_Origin).Pattern; end WebSocket_Origin; ---------------------- -- WebSocket_Origin -- ---------------------- function WebSocket_Origin return String is begin return To_String (Process_Options (WebSocket_Origin).Regexp_Str); end WebSocket_Origin; ------------------------ -- WebSocket_Priority -- ------------------------ function WebSocket_Priority return System.Any_Priority is begin return Process_Options (WebSocket_Priority).Nat_Value; end WebSocket_Priority; --------------------------------------- -- WebSocket_Send_Message_Queue_Size -- --------------------------------------- function WebSocket_Send_Message_Queue_Size return Positive is begin return Process_Options (WebSocket_Send_Message_Queue_Size).Pos_Value; end WebSocket_Send_Message_Queue_Size; ----------------------- -- WebSocket_Timeout -- ----------------------- function WebSocket_Timeout return Duration is begin return Process_Options (WebSocket_Timeout).Dur_Value; end WebSocket_Timeout; -------------- -- WWW_Root -- -------------- function WWW_Root (O : Object) return String is begin return To_String (O.P (WWW_Root).Dir_Value); end WWW_Root; end AWS.Config;
charlie5/aIDE
Ada
1,533
ads
with AdaM.a_Pragma, gtk.Widget; private with aIDE.Editor.of_block, aIDE.Editor.of_context, gtk.Box, gtk.Button, gtk.Frame, gtk.Label, gtk.Alignment, gtk.GEntry; package aIDE.Editor.of_pragma is type Item is new Editor.item with private; type View is access all Item'Class; package Forge is function new_Editor (the_Pragma : in AdaM.a_Pragma.view) return View; end Forge; overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; function Target (Self : in Item) return AdaM.a_Pragma.view; procedure Target_is (Self : in out Item; Now : in AdaM.a_Pragma.view); private use gtk.Box, gtk.GEntry, gtk.Frame, gtk.Label, gtk.Button, gtk.Alignment; type Item is new Editor.item with record Target : AdaM.a_Pragma.view; top_Frame : Gtk_Frame; top_Box : Gtk_Box; arguments_Box : Gtk_Box; -- context_Alignment : Gtk_Alignment; -- context_Editor : aIDE.Editor.of_context.view; open_parenthesis_Label : Gtk_Label; close_parenthesis_Label : Gtk_Label; -- name_Entry : gtk_Entry; choose_Button : gtk_Button; -- block_Alignment : Gtk_Alignment; -- block_Editor : aIDE.Editor.of_block.view; end record; overriding procedure freshen (Self : in out Item); end aIDE.Editor.of_pragma;
aherd2985/Amass
Ada
676
ads
-- Copyright 2017 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "Sublist3rAPI" type = "api" function start() setratelimit(1) end function vertical(ctx, domain) local page, err = request(ctx, {url=buildurl(domain)}) if (err ~= nil and err ~= "") then return end local resp = json.decode(page) if (resp == nil or #resp == 0) then return end for i, v in pairs(resp) do newname(ctx, v) end end function buildurl(domain) return "https://api.sublist3r.com/search.php?domain=" .. domain end
reznikmm/increment
Ada
2,313
ads
-- Copyright (c) 2015-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Incr.Version_Trees; limited with Incr.Nodes.Tokens; package Incr.Documents is -- @summary -- Document representation -- -- @description -- This package provides Document type. -- -- Document represents single parsing tree together with its history. -- Three sentinel nodes surround actual parsing tree: -- * Start_Of_Stream - empty token at the beginning of the document -- * End_Of_Stream - empty token at the end of the document -- * Ultra_Root - contains these two tokens and root of parsing tree -- These three nodes are created on initialization and exist forever. -- -- Original grammar is augmented by new top rule: -- ultra_root ::= <start_of_stream> [original_root] <end_of_stream> -- -- As result any new empty document always matches the grammar and could -- serve as base for incremental analysis. type Document (History : access Version_Trees.Version_Tree'Class) is tagged limited private; -- Document representation type Document_Access is access all Document'Class; not overriding function Ultra_Root (Self : Document) return Nodes.Node_Access; -- Return ultra-root sentinel node of given Document. not overriding function Start_Of_Stream (Self : Document) return Nodes.Tokens.Token_Access; -- Return start-of-stream sentinel token of given Document. not overriding function End_Of_Stream (Self : Document) return Nodes.Tokens.Token_Access; -- Return end-of-stream sentinel token of given Document. not overriding procedure Commit (Self : in out Document); -- Single point commit routine. package Constructors is procedure Initialize (Self : aliased in out Document'Class; Root : Nodes.Node_Access); -- Initialze Self as new Document. Create sentinel nodes and reset -- parsing tree root to Root pointer. end Constructors; private type Document (History : access Version_Trees.Version_Tree'Class) is tagged limited record Ultra_Root : access Nodes.Node'Class; end record; end Incr.Documents;
persan/AdaYaml
Ada
48,107
adb
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Strings.Fixed; with Ada.Unchecked_Deallocation; with Yaml.Presenter.Analysis; with Yaml.Tags; package body Yaml.Presenter is use type Text.Reference; Line_End : constant Character := Character'Val (10); procedure Configure (P : in out Instance; Max_Line_Length : Line_Length_Type; Flow_Style : Flow_Style_Type) is begin P.Max_Line_Length := Max_Line_Length; P.Flow_Style := Flow_Style; end Configure; procedure Init (P : in out Instance) is begin P.Buffer_Pos := 1; P.Cur_Column := 1; P.Cur_Max_Column := P.Max_Line_Length; if P.Levels.Initialized then -- may occur when parser is re-used while P.Levels.Length > 0 loop P.Levels.Pop; end loop; else P.Levels := Level_Stacks.New_Stack (64); end if; P.Levels.Push (Level'(Before_Stream_Start, -2)); end Init; procedure Set_Output (P : in out Instance; D : not null Destination.Pointer) is begin Finalize (P); P.Dest := D; P.Buffer := new String (1 .. 8192); Init (P); end Set_Output; procedure Set_Output (P : in out Instance; Buffer : not null Buffer_Type) is begin Finalize (P); P.Dest := null; P.Buffer := Buffer; Init (P); end Set_Output; procedure Flush (P : in out Instance) is use type Destination.Pointer; begin if P.Dest /= null and then P.Buffer_Pos > 1 then P.Dest.Write_Data (P.Buffer (P.Buffer'First .. P.Buffer_Pos - 1)); P.Buffer_Pos := 1; end if; end Flush; procedure Free_S is new Ada.Unchecked_Deallocation (String, Buffer_Type); procedure Finalize (Object : in out Instance) is procedure Free_D is new Ada.Unchecked_Deallocation (Destination.Instance'Class, Destination.Pointer); use type Destination.Pointer; begin if Object.Dest /= null then Object.Flush; Free_D (Object.Dest); Free_S (Object.Buffer); end if; end Finalize; type Allowed_Styles is (All_Of_Them, No_Compact); procedure Put (P : in out Instance; E : Event) is use type Analysis.Necessary_Quoting; subtype Chosen_Scalar_Style_Type is Scalar_Style_Type range Plain .. Folded; pragma Warnings (Off, "formal parameter ""In_Flow"" is not referenced"); function Possibly_Block_Scalar_Style (Features : Analysis.Scalar_Features; In_Flow : Boolean) return Chosen_Scalar_Style_Type is (if Features.Single_Line_Length + P.Levels.Top.Indentation + (if Features.Unquoted_Single_Line then 2 else 4) <= P.Cur_Max_Column then Plain elsif Features.Max_Line_Length + P.Levels.Top.Indentation + 2 <= P.Cur_Max_Column then Literal elsif Features.Folding_Possible and then Features.Max_Word_Length + P.Levels.Top.Indentation + 2 <= P.Cur_Max_Column then Folded else Single_Quoted); pragma Warnings (On, "formal parameter ""In_Flow"" is not referenced"); function Chosen_Scalar_Style (Features : Analysis.Scalar_Features; In_Flow : Boolean) return Chosen_Scalar_Style_Type is (case E.Scalar_Style is when Double_Quoted => Double_Quoted, when Single_Quoted | Literal | Folded => (if Features.Quoting_Needed = Analysis.Double then Double_Quoted else E.Scalar_Style), when Plain => (case Features.Quoting_Needed is when Analysis.Double => Double_Quoted, when Analysis.Single => Single_Quoted, when Analysis.Only_In_Flow => (if In_Flow then Single_Quoted else Plain), when Analysis.None => Plain), when Any => (case Features.Quoting_Needed is when Analysis.Double => Double_Quoted, when Analysis.Only_In_Flow => Scalar_Style_Type'Max (Possibly_Block_Scalar_Style (Features, In_Flow), (if In_Flow then Single_Quoted else Plain)), when Analysis.Single => Scalar_Style_Type'Max (Possibly_Block_Scalar_Style (Features, In_Flow), (Single_Quoted)), when Analysis.None => Possibly_Block_Scalar_Style (Features, In_Flow))); procedure Write (S : String) with Pre => (for all C of S => C /= Character'Val (10)) is use type Destination.Pointer; begin P.Cur_Column := P.Cur_Column + S'Length; if P.Buffer_Pos + S'Length - 1 > P.Buffer.all'Length then if P.Dest = null then raise Presenter_Error with "output too long for destination string!"; else P.Flush; if S'Length < P.Buffer'Length then P.Dest.Write_Data (S); return; end if; end if; end if; P.Buffer (P.Buffer_Pos .. P.Buffer_Pos + S'Length - 1) := S; P.Buffer_Pos := P.Buffer_Pos + S'Length; end Write; procedure Write (C : Character) with Pre => C /= Character'Val (10) is use type Destination.Pointer; begin P.Cur_Column := P.Cur_Column + 1; if P.Buffer_Pos > P.Buffer.all'Length then if P.Dest = null then raise Presenter_Error with "output too long for destination string!"; else P.Flush; end if; end if; P.Buffer (P.Buffer_Pos) := C; P.Buffer_Pos := P.Buffer_Pos + 1; end Write; procedure Next_Line (Count : Positive := 1) is use Ada.Strings.Fixed; use type Destination.Pointer; begin for I in 1 .. Count loop if P.Buffer_Pos > P.Buffer.all'Length then if P.Dest = null then raise Presenter_Error with "output too long for destination string!"; else P.Dest.Write_Data (P.Buffer (P.Buffer'First .. P.Buffer_Pos - 1)); P.Buffer_Pos := 1; end if; end if; P.Buffer (P.Buffer_Pos) := Character'Val (10); P.Buffer_Pos := P.Buffer_Pos + 1; end loop; P.Cur_Column := 1; P.Cur_Max_Column := Positive'Max (P.Max_Line_Length / 2, P.Max_Line_Length - P.Levels.Top.Indentation); Write (P.Levels.Top.Indentation * ' '); end Next_Line; procedure Render_Tag (Tag : Text.Reference) is Yaml_Tag_Prefix : constant String := "tag:yaml.org,2002:"; begin if Tag.Length > Yaml_Tag_Prefix'Length and then Tag.Value (1 .. Yaml_Tag_Prefix'Length) = Yaml_Tag_Prefix then Write ("!!"); Write (Tag.Value (Yaml_Tag_Prefix'Length + 1 .. Tag.Length)); else Write ("!<" & Tag & ">"); end if; end Render_Tag; function Render_Inline_Properties (Props : Properties) return Boolean is begin return Wrote_Anything : Boolean := False do if Props.Anchor /= Text.Empty then Write (" &" & Props.Anchor); Wrote_Anything := True; end if; if Props.Tag /= Tags.Question_Mark then Write (' '); Render_Tag (Props.Tag); Wrote_Anything := True; end if; end return; end Render_Inline_Properties; function Render_Newline_Properties (Props : Properties) return Boolean is begin return Wrote_Anything : Boolean := False do if Props.Anchor /= Text.Empty then Write ('&' & Props.Anchor & ' '); Wrote_Anything := True; end if; if Props.Tag /= Tags.Question_Mark then Render_Tag (Props.Tag); Write (' '); Wrote_Anything := True; end if; end return; end Render_Newline_Properties; procedure Render_Single_Line_Double_Quoted with Pre => E.Kind = Scalar is begin Write ('"'); for C of E.Content.Value loop case C is when '"' | '\' => Write ('\' & C); when Character'Val (7) => Write ("\a"); when Character'Val (8) => Write ("\b"); when Character'Val (9) => Write ("\t"); when Character'Val (10) => Write ("\n"); when Character'Val (13) => Write ("\r"); when others => Write (C); end case; end loop; Write ('"'); end Render_Single_Line_Double_Quoted; procedure Render_Multi_Line_Double_Quoted with Pre => E.Kind = Scalar is Buffer : String (1 .. P.Cur_Max_Column + P.Levels.Top.Indentation) := (1 => '"', others => <>); Pos : Positive := 2; Recent_Was_Space : Boolean := False; begin for C of E.Content.Value loop case C is when '"' | '\' => Buffer (Pos) := '\'; Buffer (Pos + 1) := C; Pos := Pos + 2; Recent_Was_Space := False; when Character'Val (7) => Buffer (Pos .. Pos + 1) := "\a"; Pos := Pos + 2; Recent_Was_Space := False; when Character'Val (8) => Buffer (Pos .. Pos + 1) := "\b"; Pos := Pos + 2; Recent_Was_Space := False; when Character'Val (9) => Buffer (Pos .. Pos + 1) := "\t"; Pos := Pos + 2; Recent_Was_Space := False; when Character'Val (10) => if not Recent_Was_Space and then P.Cur_Column + Pos >= (P.Cur_Max_Column * 3) / 4 then Write (Buffer (1 .. Pos - 1)); Next_Line (2); Pos := 1; else Buffer (Pos .. Pos + 1) := "\n"; Pos := Pos + 2; end if; Recent_Was_Space := False; when Character'Val (13) => Buffer (Pos .. Pos + 1) := "\r"; Pos := Pos + 2; Recent_Was_Space := False; when ' ' => if not Recent_Was_Space and then P.Cur_Column + Pos >= (P.Cur_Max_Column * 3) / 4 then Buffer (Pos .. Pos + 1) := " \"; Write (Buffer (1 .. Pos + 1)); Next_Line; Pos := 1; Recent_Was_Space := False; else Buffer (Pos) := ' '; Pos := Pos + 1; Recent_Was_Space := True; end if; when others => Buffer (Pos) := C; Pos := Pos + 1; Recent_Was_Space := False; end case; if P.Cur_Column + Pos >= P.Cur_Max_Column - 1 then Buffer (Pos) := '\'; Write (Buffer (1 .. Pos)); Next_Line; Pos := 1; Recent_Was_Space := False; end if; end loop; Buffer (Pos) := '"'; Write (Buffer (1 .. Pos)); end Render_Multi_Line_Double_Quoted; procedure Render_Single_Quoted with Pre => E.Kind = Scalar is begin Write ("'TODO'"); end Render_Single_Quoted; procedure Render_Single_Line_Plain with Pre => E.Kind = Scalar is begin Write (E.Content.Value); end Render_Single_Line_Plain; procedure Render_Multi_Line_Plain with Pre => E.Kind = Scalar is Word_Start : Positive := 1; Pos : Positive := 1; First : Boolean := True; begin while Pos < E.Content.Value.Data'Last loop if E.Content.Value.Data (Pos) = ' ' and then not (E.Content.Value.Data (Pos + 1) in ' ' | Character'Val (10)) then if P.Cur_Column + Pos - Word_Start <= P.Cur_Max_Column then if First then First := False; else Write (' '); end if; else Next_Line; end if; Write (E.Content.Value (Word_Start .. Pos - 1)); Word_Start := Pos + 1; Pos := Pos + 2; else Pos := Pos + 1; end if; end loop; if P.Cur_Column + Pos - Word_Start <= P.Cur_Max_Column then if First then First := False; else Write (' '); end if; else Next_Line; end if; Write (E.Content.Value.Data (Word_Start .. E.Content.Value.Data'Last)); end Render_Multi_Line_Plain; procedure Render_Literal_Scalar with Pre => E.Kind = Scalar is First_Char : Positive; Next_Newline : Positive := 1; begin if E.Content.Length = 0 then Write (" |-"); else Write (" |"); if E.Content (E.Content.Length) = Character'Val (10) then if E.Content.Length > 1 and then E.Content (E.Content.Length - 1) = Character'Val (10) then Write ('+'); end if; else Write ('-'); end if; if E.Content (1) = ' ' then Write ('2'); end if; Outer : loop loop Next_Line; if Next_Newline > E.Content.Length then exit Outer; end if; exit when E.Content (Next_Newline) /= Character'Val (10); Next_Newline := Next_Newline + 1; end loop; First_Char := Next_Newline; while Next_Newline <= E.Content.Length and then E.Content (Next_Newline) /= Character'Val (10) loop Next_Newline := Next_Newline + 1; end loop; Write (E.Content.Value.Data (First_Char .. Next_Newline - 1)); exit when Next_Newline > E.Content.Length or else (Next_Newline = E.Content.Length and then E.Content (Next_Newline) = Character'Val (10)); Next_Newline := Next_Newline + 1; end loop Outer; end if; end Render_Literal_Scalar; procedure Render_Folded_Scalar with Pre => E.Kind = Scalar is Lookahead : Positive := 1; First_Char : Positive; Last_Space : Positive; begin if E.Content.Length = 0 then Write (" >-"); else Write (" >"); if E.Content (E.Content.Length) = Character'Val (10) then if E.Content.Length > 1 and then E.Content (E.Content.Length - 1) = Character'Val (10) then Write ('+'); end if; else Write ('-'); end if; if E.Content (1) = ' ' then Write ('2'); end if; Outer : loop <<At_New_Line>> loop if Lookahead > E.Content.Length then exit Outer; end if; Next_Line; exit when E.Content (Lookahead) /= Character'Val (10); Lookahead := Lookahead + 1; end loop; First_Char := Lookahead; Last_Space := First_Char; loop while not (E.Content (Lookahead) in ' ' | Character'Val (10)) loop Lookahead := Lookahead + 1; if Lookahead > E.Content.Length then Write (E.Content.Value.Data (First_Char .. E.Content.Length)); exit Outer; end if; end loop; if E.Content (Lookahead) = Character'Val (10) then Write (E.Content.Value.Data (First_Char .. Lookahead - 1)); Lookahead := Lookahead + 1; if Lookahead > E.Content.Length then exit Outer; end if; Next_Line; goto At_New_Line; end if; exit when Lookahead - First_Char >= P.Cur_Max_Column; Last_Space := Lookahead; Lookahead := Lookahead + 1; end loop; Write (E.Content.Value.Data (First_Char .. Last_Space - 1)); Lookahead := Last_Space + 1; end loop Outer; end if; end Render_Folded_Scalar; procedure Render_Long_Scalar (In_Flow : Boolean; Features : Analysis.Scalar_Features) with Pre => E.Kind = Scalar is Style : constant Chosen_Scalar_Style_Type := Chosen_Scalar_Style (Features, In_Flow); begin P.Levels.Push ((Position => <>, Indentation => P.Levels.Top.Indentation + 2)); case Style is when Literal => Render_Literal_Scalar; when Folded => Render_Folded_Scalar; when Double_Quoted => Next_Line; Render_Multi_Line_Double_Quoted; when Single_Quoted => Next_Line; Render_Single_Quoted; when Plain => Next_Line; Render_Multi_Line_Plain; end case; P.Levels.Pop; end Render_Long_Scalar; procedure Render_Scalar (In_Flow : Boolean; Features : Analysis.Scalar_Features) with Pre => E.Kind = Scalar is begin if P.Flow_Style = Canonical then if E.Scalar_Style in Literal | Folded then Render_Long_Scalar (True, Features); elsif P.Cur_Column + Features.Single_Line_Length + 3 <= P.Cur_Max_Column then Write (' '); Render_Single_Line_Double_Quoted; else P.Levels.Push ((Position => <>, Indentation => P.Levels.Top.Indentation + 2)); Next_Line; Render_Multi_Line_Double_Quoted; P.Levels.Pop; end if; elsif Features.Unquoted_Single_Line then if E.Scalar_Style in Any | Plain and then P.Cur_Column + Features.Single_Line_Length + 1 <= P.Cur_Max_Column then Write (' '); Render_Single_Line_Plain; elsif E.Scalar_Style = Double_Quoted and then P.Cur_Column + Features.Single_Line_Length + 3 <= P.Cur_Max_Column then Write (' '); Render_Single_Line_Double_Quoted; else Render_Long_Scalar (In_Flow, Features); end if; elsif E.Scalar_Style in Any | Double_Quoted and then P.Cur_Column + Features.Single_Line_Length + 3 <= P.Cur_Max_Column then Write (' '); Render_Single_Line_Double_Quoted; else Render_Long_Scalar (In_Flow, Features); end if; end Render_Scalar; type Node_Start_Descriptor is record Flow_Pos, Header_Pos, Implicit_Pos : Position_Type; Flow_Char : Character; end record; Mapping_Start_Descriptor : constant Node_Start_Descriptor := (Flow_Pos => After_Flow_Map_Start, Header_Pos => After_Map_Header, Implicit_Pos => After_Implicit_Map_Start, Flow_Char => '{'); Sequence_Start_Descriptor : constant Node_Start_Descriptor := (Flow_Pos => After_Flow_Seq_Start, Header_Pos => After_Seq_Header, Implicit_Pos => After_Implicit_Seq_Start, Flow_Char => '['); procedure Start_Node (Inline : Boolean; Styles : Allowed_Styles; Descriptor : Node_Start_Descriptor) with Pre => E.Kind in Mapping_Start | Sequence_Start is begin if (if Inline then Render_Inline_Properties (E.Collection_Properties) else Render_Newline_Properties (E.Collection_Properties)) then if Styles = No_Compact then if E.Collection_Style = Flow then Next_Line; Write (Descriptor.Flow_Char); P.Levels.Push ((Position => Descriptor.Flow_Pos, Indentation => P.Levels.Top.Indentation + 2)); else P.Levels.Push ((Position => Descriptor.Implicit_Pos, Indentation => P.Levels.Top.Indentation + 2)); Next_Line; end if; elsif E.Collection_Style = Flow then if Inline then Write (' '); end if; P.Levels.Push ((Position => Descriptor.Flow_Pos, Indentation => P.Cur_Column - 1)); Write (Descriptor.Flow_Char); else P.Levels.Push ((Position => Descriptor.Header_Pos, Indentation => P.Levels.Top.Indentation + 2)); end if; elsif Styles = No_Compact then if E.Collection_Style = Flow then Next_Line; Write (Descriptor.Flow_Char); P.Levels.Push ((Position => Descriptor.Flow_Pos, Indentation => P.Levels.Top.Indentation + 2)); else P.Levels.Push ((Position => Descriptor.Implicit_Pos, Indentation => P.Levels.Top.Indentation + 2)); Next_Line; end if; elsif E.Collection_Style = Flow then if Inline then Write (' '); end if; P.Levels.Push ((Position => Descriptor.Flow_Pos, Indentation => P.Cur_Column - 1)); Write (Descriptor.Flow_Char); else if Inline then Write (' '); end if; P.Levels.Push ((Position => Descriptor.Implicit_Pos, Indentation => P.Cur_Column - 1)); end if; end Start_Node; procedure Start_Flow_Node (Inline : Boolean; Descriptor : Node_Start_Descriptor) with Pre => E.Kind in Mapping_Start | Sequence_Start is begin if (if Inline then Render_Inline_Properties (E.Collection_Properties) else Render_Newline_Properties (E.Collection_Properties)) then null; end if; if Inline then Write (' '); end if; Write (Descriptor.Flow_Char); P.Levels.Push ((Position => Descriptor.Flow_Pos, Indentation => P.Levels.Top.Indentation + 2)); end Start_Flow_Node; procedure Render_Alias (Inline : Boolean) with Inline is begin if Inline then if P.Cur_Column + E.Target.Length + 2 <= P.Cur_Max_Column then Write (" *" & E.Target); else Next_Line; Write (" *" & E.Target); end if; else Write ("*" & E.Target); end if; end Render_Alias; procedure Render_Annotation is begin if Render_Inline_Properties (E.Annotation_Properties) then null; end if; Write (" @" & E.Name); P.Levels.Push ((Position => After_Annotation_Name, Indentation => P.Levels.Top.Indentation + 2)); end Render_Annotation; procedure Start_Document is begin case E.Kind is when Stream_End => Finalize (P); when Document_Start => P.Levels.Top.Position := Before_Doc_End; if E.Version /= Text.Empty then Write ("%YAML " & E.Version & Line_End & "---"); P.Levels.Push ((Position => After_Directives_End, Indentation => 0)); elsif E.Implicit_Start then P.Levels.Push ((Position => After_Implicit_Doc_Start, Indentation => 0)); else Write ("---"); P.Levels.Push ((Position => After_Directives_End, Indentation => 0)); end if; when others => raise Presenter_Error with "Unexpected event (expected document start or stream end): " & E.Kind'Img; end case; end Start_Document; procedure Render_Scalar_Mapping_Key (In_Flow : Boolean) with Pre => E.Kind = Scalar is begin declare Features : constant Analysis.Scalar_Features := Analysis.Features (E.Content.Value); begin if P.Flow_Style = Compact and then Features.Unquoted_Single_Line then if P.Cur_Column + Features.Single_Line_Length + 1 <= P.Cur_Max_Column then if Render_Newline_Properties (E.Scalar_Properties) then null; end if; Render_Single_Line_Plain; Write (':'); P.Levels.Top.Position := (if In_Flow then After_Flow_Map_Key else After_Implicit_Block_Map_Key); else Write ('?'); if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (In_Flow, Features); if In_Flow then Next_Line; Write (':'); P.Levels.Top.Position := After_Flow_Map_Key; else P.Levels.Top.Position := After_Explicit_Block_Map_Key; end if; end if; elsif P.Flow_Style = Compact and then P.Cur_Column + Features.Single_Line_Length + 3 <= P.Cur_Max_Column then if Render_Newline_Properties (E.Scalar_Properties) then null; end if; Render_Single_Line_Double_Quoted; Write (':'); P.Levels.Top.Position := (if In_Flow then After_Flow_Map_Key else After_Explicit_Block_Map_Key); else Write ('?'); if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (In_Flow, Features); Next_Line; Write (':'); P.Levels.Top.Position := (if In_Flow then After_Flow_Map_Key else After_Implicit_Block_Map_Key); end if; end; end Render_Scalar_Mapping_Key; procedure Start_Block_Key_Value_Pair is begin case E.Kind is when Scalar => Next_Line; Render_Scalar_Mapping_Key (False); when Mapping_Start => P.Levels.Top.Position := After_Explicit_Block_Map_Key; Next_Line; Write ('?'); Start_Node (True, No_Compact, Mapping_Start_Descriptor); when Sequence_Start => P.Levels.Top.Position := After_Implicit_Block_Map_Key; Next_Line; Write ('?'); Start_Node (True, No_Compact, Sequence_Start_Descriptor); when Alias => if P.Cur_Column + E.Target.Length + 3 <= P.Cur_Max_Column then Render_Alias (False); Write (" :"); P.Levels.Top.Position := After_Implicit_Block_Map_Key; else Write ("?"); Render_Alias (True); P.Levels.Top.Position := After_Explicit_Block_Map_Key; end if; when Mapping_End => -- empty mapping must be flow-style Write (" {}"); P.Levels.Pop; when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected mapping key): " & E.Kind'Img; end case; end Start_Block_Key_Value_Pair; procedure Start_Flow_Key_Value_Pair with Pre => E.Kind /= Mapping_End is begin if P.Flow_Style = Canonical then Next_Line; end if; case E.Kind is when Scalar => Render_Scalar_Mapping_Key (True); when Mapping_Start => if P.Flow_Style = Compact then Write (" ?"); else Write ('?'); end if; Next_Line; Write (':'); P.Levels.Top.Position := After_Flow_Map_Key; Start_Flow_Node (True, Mapping_Start_Descriptor); when Sequence_Start => if P.Flow_Style = Compact then Write (" ?"); else Write ('?'); end if; Write (':'); P.Levels.Top.Position := After_Flow_Map_Key; Start_Flow_Node (True, Sequence_Start_Descriptor); when Alias => if P.Flow_Style = Compact and then P.Cur_Column + E.Target.Length + 3 <= P.Cur_Max_Column then Render_Alias (False); Write (" :"); P.Levels.Top.Position := After_Flow_Map_Key; else if P.Flow_Style = Compact then Next_Line; end if; Write ('?'); Render_Alias (True); Write (':'); P.Levels.Top.Position := After_Flow_Map_Key; end if; when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected mapping key): " & E.Kind'Img; end case; end Start_Flow_Key_Value_Pair; procedure Start_Block_Sequence_Item is begin case E.Kind is when Scalar => Next_Line; Write ('-'); if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (False, Analysis.Features (E.Content.Value)); P.Levels.Top.Position := After_Block_Seq_Item; when Mapping_Start => Next_Line; Write ('-'); P.Levels.Top.Position := After_Block_Seq_Item; Start_Node (True, All_Of_Them, Mapping_Start_Descriptor); when Sequence_Start => Next_Line; Write ('-'); P.Levels.Top.Position := After_Block_Seq_Item; Start_Node (True, All_Of_Them, Sequence_Start_Descriptor); when Alias => Next_Line; Write ('-'); Render_Alias (True); P.Levels.Top.Position := After_Block_Seq_Item; when Sequence_End => Write (" []"); P.Levels.Pop; when others => raise Presenter_Error with "Unexpected event (expected sequence item): " & E.Kind'Img; end case; end Start_Block_Sequence_Item; procedure Start_Flow_Sequence_Item (After_Comma : Boolean; After_Position : Position_Type; End_Token : Event_Kind; End_Char : Character; Force_Inline : Boolean := False) is Inline : Boolean; begin if P.Flow_Style = Canonical and then not Force_Inline then Next_Line; Inline := True; else Inline := After_Comma; end if; case E.Kind is when Scalar => if Inline then if Render_Inline_Properties (E.Scalar_Properties) then null; end if; else if Render_Newline_Properties (E.Scalar_Properties) then null; end if; end if; declare Features : constant Analysis.Scalar_Features := Analysis.Features (E.Content.Value); begin if Features.Unquoted_Single_Line then if P.Cur_Column + Features.Single_Line_Length + 2 <= P.Cur_Max_Column then if Inline then Write (' '); end if; Render_Single_Line_Plain; else Render_Scalar (True, Features); end if; elsif P.Cur_Column + Features.Single_Line_Length + 4 <= P.Cur_Max_Column then if Inline then Write (' '); end if; Render_Single_Line_Double_Quoted; else Render_Scalar (True, Features); end if; end; P.Levels.Top.Position := After_Position; when Mapping_Start => Next_Line; P.Levels.Top.Position := After_Position; Start_Flow_Node (False, Mapping_Start_Descriptor); when Sequence_Start => Next_Line; P.Levels.Top.Position := After_Position; Start_Flow_Node (False, Sequence_Start_Descriptor); when Alias => Render_Alias (Inline); P.Levels.Top.Position := After_Position; when others => if E.Kind = End_Token then Write (End_Char); P.Levels.Pop; else raise Presenter_Error with "Unexpected event (expected sequence item): " & E.Kind'Img; end if; end case; end Start_Flow_Sequence_Item; begin case P.Levels.Top.Position is when Before_Stream_Start => if E.Kind /= Stream_Start then raise Presenter_Error with "missing Stream_Start event; got " & E.Kind'Img; end if; P.Levels.Top.Position := Before_Doc_Start; when After_Stream_End => raise Presenter_Error with "Unexpected event after stream end: " & E.Kind'Img; when Before_Doc_Start => Start_Document; when After_Implicit_Doc_Start => case E.Kind is when Scalar => P.Levels.Top.Position := Before_Doc_End; -- scalars at root level *must* have `---` Write ("---"); if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Long_Scalar (False, Analysis.Features (E.Content.Value)); when Mapping_Start => P.Levels.Top.Position := Before_Doc_End; if E.Collection_Style /= Flow and then (not Is_Empty (E.Collection_Properties)) then Write ("---"); Start_Node (True, No_Compact, Mapping_Start_Descriptor); else Start_Node (False, All_Of_Them, Mapping_Start_Descriptor); end if; when Sequence_Start => P.Levels.Top.Position := Before_Doc_End; if E.Collection_Style /= Flow and then (not Is_Empty (E.Collection_Properties)) then Write ("---"); Start_Node (True, No_Compact, Sequence_Start_Descriptor); else Start_Node (False, All_Of_Them, Sequence_Start_Descriptor); end if; when Alias => P.Levels.Top.Position := Before_Doc_End; Next_Line; Render_Alias (False); when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected node start): " & E.Kind'Img; end case; when After_Directives_End => case E.Kind is when Scalar => P.Levels.Top.Position := Before_Doc_End; if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Long_Scalar (False, Analysis.Features (E.Content.Value)); when Mapping_Start => P.Levels.Top.Position := Before_Doc_End; Start_Node (True, No_Compact, Mapping_Start_Descriptor); when Sequence_Start => Start_Node (True, No_Compact, Sequence_Start_Descriptor); when Alias => P.Levels.Top.Position := Before_Doc_End; Next_Line; Render_Alias (False); when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected node start): " & E.Kind'Img; end case; when Before_Doc_End => if E.Kind /= Document_End then raise Presenter_Error with "Unexpected event (expected document end): " & E.Kind'Img; end if; if E.Implicit_End then Next_Line; P.Levels.Top.Position := After_Implicit_Doc_End; else Next_Line; Write ("..."); Next_Line; P.Levels.Top.Position := Before_Doc_Start; end if; when After_Implicit_Doc_End => case E.Kind is when Document_Start => if E.Version /= Text.Empty then Write ("..."); Next_Line; end if; Start_Document; when Stream_End => P.Levels.Top.Position := After_Stream_End; when others => raise Presenter_Error with "Unexpected event (expected document start or stream end): " & E.Kind'Img; end case; when After_Implicit_Map_Start => case E.Kind is when Scalar => Render_Scalar_Mapping_Key (False); when Mapping_Start => P.Levels.Top.Position := After_Explicit_Block_Map_Key; Write ('?'); Start_Node (True, All_Of_Them, Mapping_Start_Descriptor); when Sequence_Start => P.Levels.Top.Position := After_Explicit_Block_Map_Key; Write ('?'); Start_Node (True, All_Of_Them, Sequence_Start_Descriptor); when Alias => if P.Cur_Column + E.Target.Length + 3 <= P.Cur_Max_Column then Render_Alias (False); Write (" :"); P.Levels.Top.Position := After_Implicit_Block_Map_Key; else Write ('?'); Render_Alias (True); P.Levels.Top.Position := After_Explicit_Block_Map_Key; end if; when Mapping_End => -- empty mapping must be flow-style Write ("{}"); P.Levels.Pop; when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected mapping key): " & E.Kind'Img; end case; when After_Map_Header => Start_Block_Key_Value_Pair; when After_Explicit_Block_Map_Key => Next_Line; Write (':'); case E.Kind is when Scalar => P.Levels.Top.Position := After_Block_Map_Value; if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (False, Analysis.Features (E.Content.Value)); when Mapping_Start => P.Levels.Top.Position := After_Block_Map_Value; Start_Node (True, All_Of_Them, Mapping_Start_Descriptor); when Sequence_Start => P.Levels.Top.Position := After_Block_Map_Value; Start_Node (True, All_Of_Them, Sequence_Start_Descriptor); when Alias => P.Levels.Top.Position := After_Block_Map_Value; Render_Alias (True); when Annotation_Start => P.Levels.Top.Position := After_Implicit_Block_Map_Key; Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected mapping value): " & E.Kind'Img; end case; when After_Implicit_Block_Map_Key => case E.Kind is when Scalar => P.Levels.Top.Position := After_Block_Map_Value; if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (False, Analysis.Features (E.Content.Value)); when Mapping_Start => P.Levels.Top.Position := After_Block_Map_Value; Start_Node (True, No_Compact, Mapping_Start_Descriptor); when Sequence_Start => P.Levels.Top.Position := After_Block_Map_Value; Start_Node (True, No_Compact, Sequence_Start_Descriptor); when Alias => P.Levels.Top.Position := After_Block_Map_Value; Render_Alias (True); when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected mapping value): " & E.Kind'Img; end case; when After_Block_Map_Value => if E.Kind = Mapping_End then P.Levels.Pop; else Start_Block_Key_Value_Pair; end if; when After_Seq_Header => Start_Block_Sequence_Item; when After_Implicit_Seq_Start => case E.Kind is when Scalar => Write ('-'); if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (False, Analysis.Features (E.Content.Value)); P.Levels.Top.Position := After_Block_Seq_Item; when Mapping_Start => Write ('-'); P.Levels.Top.Position := After_Block_Seq_Item; Start_Node (True, All_Of_Them, Mapping_Start_Descriptor); when Sequence_Start => Write ('-'); P.Levels.Top.Position := After_Block_Seq_Item; Start_Node (True, All_Of_Them, Sequence_Start_Descriptor); when Alias => Write ('-'); Render_Alias (True); P.Levels.Top.Position := After_Block_Seq_Item; when Annotation_Start => Write ('-'); Render_Annotation; when Sequence_End => Write ("[]"); P.Levels.Pop; when others => raise Presenter_Error with "Unexpected event (expected sequence item): " & E.Kind'Img; end case; when After_Block_Seq_Item => if E.Kind = Sequence_End then P.Levels.Pop; else Start_Block_Sequence_Item; end if; when After_Flow_Map_Start => if E.Kind = Mapping_End then -- make sure `{}` is rendered even in canonical style Write ('}'); P.Levels.Pop; else Start_Flow_Key_Value_Pair; end if; when After_Flow_Map_Key => case E.Kind is when Scalar => P.Levels.Top.Position := After_Flow_Map_Value; if Render_Inline_Properties (E.Scalar_Properties) then null; end if; Render_Scalar (True, Analysis.Features (E.Content.Value)); when Mapping_Start => P.Levels.Top.Position := After_Flow_Map_Value; Start_Flow_Node (True, Mapping_Start_Descriptor); when Sequence_Start => P.Levels.Top.Position := After_Flow_Map_Value; Start_Flow_Node (True, Sequence_Start_Descriptor); when Alias => Render_Alias (True); when Annotation_Start => Render_Annotation; when others => raise Presenter_Error with "Unexpected event (expected mapping value): " & E.Kind'Img; end case; when After_Flow_Map_Value => if E.Kind = Mapping_End then P.Levels.Pop; if P.Flow_Style = Canonical then Next_Line; end if; Write ('}'); else Write (','); Start_Flow_Key_Value_Pair; end if; when After_Flow_Seq_Start => Start_Flow_Sequence_Item (False, After_Flow_Seq_Item, Sequence_End, ']'); when After_Flow_Seq_Item => if E.Kind = Sequence_End then P.Levels.Pop; if P.Flow_Style = Canonical then Next_Line; end if; Write (']'); else Write (','); Start_Flow_Sequence_Item (True, After_Flow_Seq_Item, Sequence_End, ']'); end if; when After_Annotation_Name => if E.Kind = Annotation_End then P.Levels.Pop; else Write ('('); Start_Flow_Sequence_Item (False, After_Annotation_Param, Annotation_End, ')', True); end if; when After_Annotation_Param => Start_Flow_Sequence_Item (True, After_Annotation_Param, Annotation_End, ')', True); end case; end Put; procedure Consume (P : in out Instance; S : in out Stream.Instance) is Cur : Event := Stream.Next (S); begin loop P.Put (Cur); exit when Cur.Kind = Stream_End; Cur := Stream.Next (S); end loop; end Consume; end Yaml.Presenter;
reznikmm/matreshka
Ada
4,549
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_Db.Title_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Db_Title_Attribute_Node is begin return Self : Db_Title_Attribute_Node do Matreshka.ODF_Db.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Db_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Db_Title_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Title_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Db_URI, Matreshka.ODF_String_Constants.Title_Attribute, Db_Title_Attribute_Node'Tag); end Matreshka.ODF_Db.Title_Attributes;
riccardo-bernardini/eugen
Ada
3,354
ads
with Ada.Containers.Vectors; package EU_Projects.Identifiers.Full is use type Ada.Containers.Count_Type; type Segment_Index is range 1 .. Integer'Last; type Full_ID is private; Empty_Path : constant Full_ID; function "=" (X, Y : Full_ID) return Boolean; function "<" (X, Y : Full_ID) return Boolean; -- A valid path has a syntax similar to an identifier, with the -- following exceptions -- -- * It can have also dots '.' -- * It cannot end with a dot -- * After a dot a letter must follow function Is_Valid_Path (X : String) return Boolean is ( (X'Length > 0) and then (Is_Letter (X (X'First)) and Is_Alphanumeric (X (X'Last))) and then (for all I in X'Range => (Is_Alphanumeric (X (I)) or else (X (I) = '_' and then Is_Alphanumeric (X (I + 1))) or else (X (I) = '.' and then Is_Letter (X (I + 1))))) -- Note : in the condition above I+1 is always well defined since -- if X(X'Last) is alphanumeric, the last two tests are cutted -- away by the "or else" after Is_Alphanumeric (X (I)), otherwise -- if X(X'Last) is not alphanumeric, the "for all" will not checked -- at all because of the preceding "and then" ); function Parse (X : String) return Full_ID with Pre => Is_Valid_Path (X); function Image (X : Full_ID) return String; function Length (Item : Full_ID) return Ada.Containers.Count_Type; function Segment (Item : Full_ID; Index : Segment_Index) return Identifier; function First (Item : Full_ID) return Identifier with Pre => Length (Item) /= 0; function Last (Item : Full_ID) return Identifier with Pre => Length (Item) /= 0; function Header (Item : Full_ID) return Full_ID with Pre => Length (Item) /= 0, Post => Length (Header'Result) = Length (Item)-1; function Trailer (Item : Full_ID) return Full_ID with Pre => Length (Item) /= 0, Post => Length (Trailer'Result) = Length (Item)-1; type Resolver_Type is limited interface; function Find (Resolver : Resolver_Type; What : Full_ID) return Boolean is abstract; function Resolve (Item : Full_ID; Prefix : Full_ID; Resolver : Resolver_Type'Class) return Full_ID; private package ID_Vectors is new Ada.Containers.Vectors (Index_Type => Segment_Index, Element_Type => Identifier); type Full_ID is record Segments : ID_Vectors.Vector; end record; Empty_Path : constant Full_ID := Full_ID'(Segments => ID_Vectors.Empty_Vector); function Length (Item : Full_ID) return Ada.Containers.Count_Type is (Item.Segments.Length); function Segment (Item : Full_ID; Index : Segment_Index) return Identifier is (Item.Segments.Element (Index)); function First (Item : Full_ID) return Identifier is (Item.Segments.First_Element); function Last (Item : Full_ID) return Identifier is (Item.Segments.Last_Element); function "=" (X, Y : Full_ID) return Boolean is (ID_Vectors."="(X.Segments, Y.Segments)); end EU_Projects.Identifiers.Full;
ohenley/ada-util
Ada
4,687
adb
----------------------------------------------------------------------- -- util-streams-sockets-tests -- Unit tests for socket streams -- Copyright (C) 2012, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.IO_Exceptions; with Util.Test_Caller; with Util.Streams.Texts; with Util.Tests.Servers; package body Util.Streams.Sockets.Tests is use Util.Tests; package Caller is new Util.Test_Caller (Test, "Streams.Sockets"); type Test_Server is new Util.Tests.Servers.Server with record Count : Natural := 0; end record; -- Process the line received by the server. overriding procedure Process_Line (Into : in out Test_Server; Line : in Ada.Strings.Unbounded.Unbounded_String; Stream : in out Util.Streams.Texts.Reader_Stream'Class; Client : in out Util.Streams.Sockets.Socket_Stream'Class); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Streams.Initialize,Connect", Test_Socket_Init'Access); Caller.Add_Test (Suite, "Test Util.Streams.Connect,Read,Write", Test_Socket_Read'Access); end Add_Tests; -- ------------------------------ -- Process the line received by the server. -- ------------------------------ overriding procedure Process_Line (Into : in out Test_Server; Line : in Ada.Strings.Unbounded.Unbounded_String; Stream : in out Util.Streams.Texts.Reader_Stream'Class; Client : in out Util.Streams.Sockets.Socket_Stream'Class) is pragma Unreferenced (Stream, Client); begin if Ada.Strings.Unbounded.Index (Line, "test-" & Natural'Image (Into.Count + 1)) > 0 then Into.Count := Into.Count + 1; end if; end Process_Line; -- ------------------------------ -- Test reading and writing on a socket stream. -- ------------------------------ procedure Test_Socket_Read (T : in out Test) is Stream : aliased Sockets.Socket_Stream; Writer : Util.Streams.Texts.Print_Stream; Server : Test_Server; Addr : GNAT.Sockets.Sock_Addr_Type; begin Server.Start; T.Assert (Server.Get_Port > 0, "The server was not started"); Addr := (GNAT.Sockets.Family_Inet, GNAT.Sockets.Addresses (GNAT.Sockets.Get_Host_By_Name (GNAT.Sockets.Host_Name), 1), GNAT.Sockets.Port_Type (Server.Get_Port)); -- Let the server start. delay 0.1; -- Get a connection and write 10 lines. Stream.Connect (Server => Addr); Writer.Initialize (Output => Stream'Unchecked_Access, Size => 1024); for I in 1 .. 10 loop Writer.Write ("Sending a line on the socket test-" & Natural'Image (I) & ASCII.CR & ASCII.LF); Writer.Flush; end loop; Writer.Close; -- Stop the server and verify that 10 lines were received. Server.Stop; Util.Tests.Assert_Equals (T, 10, Server.Count, "Invalid number of lines received"); end Test_Socket_Read; -- ------------------------------ -- Test socket initialization. -- ------------------------------ procedure Test_Socket_Init (T : in out Test) is Stream : aliased Sockets.Socket_Stream; Fd : GNAT.Sockets.Socket_Type; Addr : GNAT.Sockets.Sock_Addr_Type; begin Addr := (GNAT.Sockets.Family_Inet, GNAT.Sockets.Addresses (GNAT.Sockets.Get_Host_By_Name (GNAT.Sockets.Host_Name), 1), 80); GNAT.Sockets.Create_Socket (Fd); Stream.Open (Fd); begin Stream.Connect (Addr); T.Assert (False, "No exception was raised"); exception when Ada.IO_Exceptions.Use_Error => null; end; end Test_Socket_Init; end Util.Streams.Sockets.Tests;
LaplaceKorea/curve25519-spark2014
Ada
2,108
adb
with Multiply_Proof; use Multiply_Proof; package body Curve25519_Mult with SPARK_Mode is -------------- -- Multiply -- -------------- function Multiply (X, Y : Integer_255) return Product_Integer is Product : Product_Integer := (others => 0); begin for J in Index_Type loop for K in Index_Type loop Product (J + K) := Product (J + K) + X (J) * Y (K) * (if J mod 2 = 1 and then K mod 2 = 1 then 2 else 1); Partial_Product_Def (X, Y, J, K); -- Reminding definition of Partial_Product pragma Loop_Invariant ((for all L in 0 .. J - 1 => Product (L) = Product'Loop_Entry (L)) and then (for all L in J + K + 1 .. 18 => Product (L) = Product'Loop_Entry (L))); -- To signify at which indexes content has not been changed pragma Loop_Invariant (for all L in J .. J + K => Product (L) = Partial_Product (X, Y, J, L - J)); -- Increasingly proving the value of Product (L) end loop; pragma Loop_Invariant (for all L in J + 10 .. 18 => Product (L) = Product'Loop_Entry (L)); -- To signify at which indexes content has not been changed pragma Loop_Invariant (for all L in Product_Index_Type => Product (L) in (-2) * Long_Long_Integer (J + 1) * (2**27 - 1)**2 .. 2 * Long_Long_Integer (J + 1) * (2**27 - 1)**2); -- To prove overflow checks pragma Loop_Invariant (for all L in 0 .. J + 9 => Product (L) = Array_Step_J (X, Y, J) (L)); -- Product is partially equal to Array_Step_J (X, Y, J); end loop; Prove_Multiply (X, Y, Product); return Product; end Multiply; end Curve25519_Mult;
AdaCore/training_material
Ada
3,881
adb
----------------------------------------------------------------------- -- Ada Labs -- -- -- -- Copyright (C) 2008-2009, AdaCore -- -- -- -- Labs is free software; you can redistribute it and/or modify it -- -- under the terms of the GNU General Public License as published by -- -- the Free Software Foundation; either version 2 of the License, or -- -- (at your option) any later version. -- -- -- -- This 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, write to the Free Software Foundation, Inc., 59 Temple -- -- Place - Suite 330, Boston, MA 02111-1307, USA. -- ----------------------------------------------------------------------- with Ada.Real_Time; use Ada.Real_Time; with Solar_System; use Solar_System; with Display; use Display; with Display.Basic; use Display.Basic; with Solar_System.Graphics; use Solar_System.Graphics; with Last_Chance_Handler; procedure Main is -- declare a variable Now of type Time to record current time Now : Time; -- declare a constant Period of 40 milliseconds of type Time_Span defining the loop period Period : constant Time_Span := Milliseconds (40); -- reference to the application window Window : Window_ID; begin -- Create the main window Window := Create_Window (Width => 240, Height => 320, Name => "Solar System"); Graphic_Context.Set_Window (Window); -- initialize Bodies using Init_Body procedure Init_Body (B => Sun, Radius => 20.0, Color => Yellow, Distance => 0.0, Speed => 0.0, Turns_Around => Sun); Init_Body (B => Earth, Radius => 5.0, Color => Blue, Distance => 50.0, Speed => 0.02, Turns_Around => Sun); Init_Body (B => Moon, Radius => 2.0, Color => Gray, Distance => 15.0, Speed => 0.04, Turns_Around => Earth); Init_Body (B => Satellite, Radius => 1.0, Color => Red, Distance => 8.0, Speed => 0.1, Turns_Around => Earth); Init_Body (B => Comet, Radius => 1.0, Color => Yellow, Distance => 80.0, Speed => 0.05, Tail => True, Turns_Around => Sun); Init_Body (B => Black_Hole, Radius => 0.0, Color => Blue, Distance => 75.0, Speed => -0.02, Turns_Around => Sun, Visible => False); Init_Body (B => Asteroid_1, Radius => 2.0, Color => Green, Distance => 5.0, Speed => 0.1, Turns_Around => Black_Hole); Init_Body (B => Asteroid_2, Radius => 2.0, Color => Blue, Distance => 5.0, Speed => 0.1, Angle => 1.57, Turns_Around => Black_Hole); -- create an infinite loop -- update the Now time with current clock -- wait until Now + Period time elapsed before the next loop Now := Clock; delay until Now + Period; end loop; end Main;
AdaCore/Ada_Drivers_Library
Ada
2,404
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, 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. -- -- -- ------------------------------------------------------------------------------ package Monitor is end Monitor;
AdaCore/Ada_Drivers_Library
Ada
21,741
ads
-- This spec has been automatically generated from STM32F7x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.USART is pragma Preelaborate; --------------- -- Registers -- --------------- -- CR1_DEDT array type CR1_DEDT_Field_Array is array (0 .. 4) of Boolean with Component_Size => 1, Size => 5; -- Type definition for CR1_DEDT type CR1_DEDT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- DEDT as a value Val : HAL.UInt5; when True => -- DEDT as an array Arr : CR1_DEDT_Field_Array; end case; end record with Unchecked_Union, Size => 5; for CR1_DEDT_Field use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- CR1_DEAT array type CR1_DEAT_Field_Array is array (0 .. 4) of Boolean with Component_Size => 1, Size => 5; -- Type definition for CR1_DEAT type CR1_DEAT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- DEAT as a value Val : HAL.UInt5; when True => -- DEAT as an array Arr : CR1_DEAT_Field_Array; end case; end record with Unchecked_Union, Size => 5; for CR1_DEAT_Field use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- Control register 1 type CR1_Register is record -- USART enable UE : Boolean := False; -- USART enable in Stop mode UESM : Boolean := False; -- Receiver enable RE : Boolean := False; -- Transmitter enable TE : Boolean := False; -- IDLE interrupt enable IDLEIE : Boolean := False; -- RXNE interrupt enable RXNEIE : Boolean := False; -- Transmission complete interrupt enable TCIE : Boolean := False; -- interrupt enable TXEIE : Boolean := False; -- PE interrupt enable PEIE : Boolean := False; -- Parity selection PS : Boolean := False; -- Parity control enable PCE : Boolean := False; -- Receiver wakeup method WAKE : Boolean := False; -- Word length M0 : Boolean := False; -- Mute mode enable MME : Boolean := False; -- Character match interrupt enable CMIE : Boolean := False; -- Oversampling mode OVER8 : Boolean := False; -- DEDT0 DEDT : CR1_DEDT_Field := (As_Array => False, Val => 16#0#); -- DEAT0 DEAT : CR1_DEAT_Field := (As_Array => False, Val => 16#0#); -- Receiver timeout interrupt enable RTOIE : Boolean := False; -- End of Block interrupt enable EOBIE : Boolean := False; -- Word length M1 : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record UE at 0 range 0 .. 0; UESM at 0 range 1 .. 1; RE at 0 range 2 .. 2; TE at 0 range 3 .. 3; IDLEIE at 0 range 4 .. 4; RXNEIE at 0 range 5 .. 5; TCIE at 0 range 6 .. 6; TXEIE at 0 range 7 .. 7; PEIE at 0 range 8 .. 8; PS at 0 range 9 .. 9; PCE at 0 range 10 .. 10; WAKE at 0 range 11 .. 11; M0 at 0 range 12 .. 12; MME at 0 range 13 .. 13; CMIE at 0 range 14 .. 14; OVER8 at 0 range 15 .. 15; DEDT at 0 range 16 .. 20; DEAT at 0 range 21 .. 25; RTOIE at 0 range 26 .. 26; EOBIE at 0 range 27 .. 27; M1 at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype CR2_STOP_Field is HAL.UInt2; -- CR2_ABRMOD array type CR2_ABRMOD_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for CR2_ABRMOD type CR2_ABRMOD_Field (As_Array : Boolean := False) is record case As_Array is when False => -- ABRMOD as a value Val : HAL.UInt2; when True => -- ABRMOD as an array Arr : CR2_ABRMOD_Field_Array; end case; end record with Unchecked_Union, Size => 2; for CR2_ABRMOD_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; subtype CR2_ADD0_3_Field is HAL.UInt4; subtype CR2_ADD4_7_Field is HAL.UInt4; -- Control register 2 type CR2_Register is record -- unspecified Reserved_0_3 : HAL.UInt4 := 16#0#; -- 7-bit Address Detection/4-bit Address Detection ADDM7 : Boolean := False; -- LIN break detection length LBDL : Boolean := False; -- LIN break detection interrupt enable LBDIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Last bit clock pulse LBCL : Boolean := False; -- Clock phase CPHA : Boolean := False; -- Clock polarity CPOL : Boolean := False; -- Clock enable CLKEN : Boolean := False; -- STOP bits STOP : CR2_STOP_Field := 16#0#; -- LIN mode enable LINEN : Boolean := False; -- Swap TX/RX pins SWAP : Boolean := False; -- RX pin active level inversion RXINV : Boolean := False; -- TX pin active level inversion TXINV : Boolean := False; -- Binary data inversion TAINV : Boolean := False; -- Most significant bit first MSBFIRST : Boolean := False; -- Auto baud rate enable ABREN : Boolean := False; -- ABRMOD0 ABRMOD : CR2_ABRMOD_Field := (As_Array => False, Val => 16#0#); -- Receiver timeout enable RTOEN : Boolean := False; -- Address of the USART node ADD0_3 : CR2_ADD0_3_Field := 16#0#; -- Address of the USART node ADD4_7 : CR2_ADD4_7_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record Reserved_0_3 at 0 range 0 .. 3; ADDM7 at 0 range 4 .. 4; LBDL at 0 range 5 .. 5; LBDIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; LBCL at 0 range 8 .. 8; CPHA at 0 range 9 .. 9; CPOL at 0 range 10 .. 10; CLKEN at 0 range 11 .. 11; STOP at 0 range 12 .. 13; LINEN at 0 range 14 .. 14; SWAP at 0 range 15 .. 15; RXINV at 0 range 16 .. 16; TXINV at 0 range 17 .. 17; TAINV at 0 range 18 .. 18; MSBFIRST at 0 range 19 .. 19; ABREN at 0 range 20 .. 20; ABRMOD at 0 range 21 .. 22; RTOEN at 0 range 23 .. 23; ADD0_3 at 0 range 24 .. 27; ADD4_7 at 0 range 28 .. 31; end record; subtype CR3_SCARCNT_Field is HAL.UInt3; subtype CR3_WUS_Field is HAL.UInt2; -- Control register 3 type CR3_Register is record -- Error interrupt enable EIE : Boolean := False; -- Ir mode enable IREN : Boolean := False; -- Ir low-power IRLP : Boolean := False; -- Half-duplex selection HDSEL : Boolean := False; -- Smartcard NACK enable NACK : Boolean := False; -- Smartcard mode enable SCEN : Boolean := False; -- DMA enable receiver DMAR : Boolean := False; -- DMA enable transmitter DMAT : Boolean := False; -- RTS enable RTSE : Boolean := False; -- CTS enable CTSE : Boolean := False; -- CTS interrupt enable CTSIE : Boolean := False; -- One sample bit method enable ONEBIT : Boolean := False; -- Overrun Disable OVRDIS : Boolean := False; -- DMA Disable on Reception Error DDRE : Boolean := False; -- Driver enable mode DEM : Boolean := False; -- Driver enable polarity selection DEP : Boolean := False; -- unspecified Reserved_16_16 : HAL.Bit := 16#0#; -- Smartcard auto-retry count SCARCNT : CR3_SCARCNT_Field := 16#0#; -- Wakeup from Stop mode interrupt flag selection WUS : CR3_WUS_Field := 16#0#; -- Wakeup from Stop mode interrupt enable WUFIE : Boolean := False; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR3_Register use record EIE at 0 range 0 .. 0; IREN at 0 range 1 .. 1; IRLP at 0 range 2 .. 2; HDSEL at 0 range 3 .. 3; NACK at 0 range 4 .. 4; SCEN at 0 range 5 .. 5; DMAR at 0 range 6 .. 6; DMAT at 0 range 7 .. 7; RTSE at 0 range 8 .. 8; CTSE at 0 range 9 .. 9; CTSIE at 0 range 10 .. 10; ONEBIT at 0 range 11 .. 11; OVRDIS at 0 range 12 .. 12; DDRE at 0 range 13 .. 13; DEM at 0 range 14 .. 14; DEP at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; SCARCNT at 0 range 17 .. 19; WUS at 0 range 20 .. 21; WUFIE at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype BRR_DIV_Fraction_Field is HAL.UInt4; subtype BRR_DIV_Mantissa_Field is HAL.UInt12; -- Baud rate register type BRR_Register is record -- DIV_Fraction DIV_Fraction : BRR_DIV_Fraction_Field := 16#0#; -- DIV_Mantissa DIV_Mantissa : BRR_DIV_Mantissa_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BRR_Register use record DIV_Fraction at 0 range 0 .. 3; DIV_Mantissa at 0 range 4 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype GTPR_PSC_Field is HAL.UInt8; subtype GTPR_GT_Field is HAL.UInt8; -- Guard time and prescaler register type GTPR_Register is record -- Prescaler value PSC : GTPR_PSC_Field := 16#0#; -- Guard time value GT : GTPR_GT_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for GTPR_Register use record PSC at 0 range 0 .. 7; GT at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype RTOR_RTO_Field is HAL.UInt24; subtype RTOR_BLEN_Field is HAL.UInt8; -- Receiver timeout register type RTOR_Register is record -- Receiver timeout value RTO : RTOR_RTO_Field := 16#0#; -- Block Length BLEN : RTOR_BLEN_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RTOR_Register use record RTO at 0 range 0 .. 23; BLEN at 0 range 24 .. 31; end record; -- Request register type RQR_Register is record -- Write-only. Auto baud rate request ABRRQ : Boolean := False; -- Write-only. Send break request SBKRQ : Boolean := False; -- Write-only. Mute mode request MMRQ : Boolean := False; -- Write-only. Receive data flush request RXFRQ : Boolean := False; -- Write-only. Transmit data flush request TXFRQ : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RQR_Register use record ABRRQ at 0 range 0 .. 0; SBKRQ at 0 range 1 .. 1; MMRQ at 0 range 2 .. 2; RXFRQ at 0 range 3 .. 3; TXFRQ at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; -- Interrupt & status register type ISR_Register is record -- Read-only. PE PE : Boolean; -- Read-only. FE FE : Boolean; -- Read-only. NF NF : Boolean; -- Read-only. ORE ORE : Boolean; -- Read-only. IDLE IDLE : Boolean; -- Read-only. RXNE RXNE : Boolean; -- Read-only. TC TC : Boolean; -- Read-only. TXE TXE : Boolean; -- Read-only. LBDF LBDF : Boolean; -- Read-only. CTSIF CTSIF : Boolean; -- Read-only. CTS CTS : Boolean; -- Read-only. RTOF RTOF : Boolean; -- Read-only. EOBF EOBF : Boolean; -- unspecified Reserved_13_13 : HAL.Bit; -- Read-only. ABRE ABRE : Boolean; -- Read-only. ABRF ABRF : Boolean; -- Read-only. BUSY BUSY : Boolean; -- Read-only. CMF CMF : Boolean; -- Read-only. SBKF SBKF : Boolean; -- Read-only. RWU RWU : Boolean; -- Read-only. WUF WUF : Boolean; -- Read-only. TEACK TEACK : Boolean; -- Read-only. REACK REACK : Boolean; -- unspecified Reserved_23_31 : HAL.UInt9; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record PE at 0 range 0 .. 0; FE at 0 range 1 .. 1; NF at 0 range 2 .. 2; ORE at 0 range 3 .. 3; IDLE at 0 range 4 .. 4; RXNE at 0 range 5 .. 5; TC at 0 range 6 .. 6; TXE at 0 range 7 .. 7; LBDF at 0 range 8 .. 8; CTSIF at 0 range 9 .. 9; CTS at 0 range 10 .. 10; RTOF at 0 range 11 .. 11; EOBF at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; ABRE at 0 range 14 .. 14; ABRF at 0 range 15 .. 15; BUSY at 0 range 16 .. 16; CMF at 0 range 17 .. 17; SBKF at 0 range 18 .. 18; RWU at 0 range 19 .. 19; WUF at 0 range 20 .. 20; TEACK at 0 range 21 .. 21; REACK at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- Interrupt flag clear register type ICR_Register is record -- Write-only. Parity error clear flag PECF : Boolean := False; -- Write-only. Framing error clear flag FECF : Boolean := False; -- Write-only. Noise detected clear flag NCF : Boolean := False; -- Write-only. Overrun error clear flag ORECF : Boolean := False; -- Write-only. Idle line detected clear flag IDLECF : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Write-only. Transmission complete clear flag TCCF : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Write-only. LIN break detection clear flag LBDCF : Boolean := False; -- Write-only. CTS clear flag CTSCF : Boolean := False; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- Write-only. Receiver timeout clear flag RTOCF : Boolean := False; -- Write-only. End of block clear flag EOBCF : Boolean := False; -- unspecified Reserved_13_16 : HAL.UInt4 := 16#0#; -- Write-only. Character match clear flag CMCF : Boolean := False; -- unspecified Reserved_18_19 : HAL.UInt2 := 16#0#; -- Write-only. Wakeup from Stop mode clear flag WUCF : Boolean := False; -- unspecified Reserved_21_31 : HAL.UInt11 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR_Register use record PECF at 0 range 0 .. 0; FECF at 0 range 1 .. 1; NCF at 0 range 2 .. 2; ORECF at 0 range 3 .. 3; IDLECF at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; TCCF at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; LBDCF at 0 range 8 .. 8; CTSCF at 0 range 9 .. 9; Reserved_10_10 at 0 range 10 .. 10; RTOCF at 0 range 11 .. 11; EOBCF at 0 range 12 .. 12; Reserved_13_16 at 0 range 13 .. 16; CMCF at 0 range 17 .. 17; Reserved_18_19 at 0 range 18 .. 19; WUCF at 0 range 20 .. 20; Reserved_21_31 at 0 range 21 .. 31; end record; subtype RDR_RDR_Field is HAL.UInt9; -- Receive data register type RDR_Register is record -- Read-only. Receive data value RDR : RDR_RDR_Field; -- unspecified Reserved_9_31 : HAL.UInt23; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RDR_Register use record RDR at 0 range 0 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype TDR_TDR_Field is HAL.UInt9; -- Transmit data register type TDR_Register is record -- Transmit data value TDR : TDR_TDR_Field := 16#0#; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDR_Register use record TDR at 0 range 0 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Universal synchronous asynchronous receiver transmitter type USART_Peripheral is record -- Control register 1 CR1 : aliased CR1_Register; -- Control register 2 CR2 : aliased CR2_Register; -- Control register 3 CR3 : aliased CR3_Register; -- Baud rate register BRR : aliased BRR_Register; -- Guard time and prescaler register GTPR : aliased GTPR_Register; -- Receiver timeout register RTOR : aliased RTOR_Register; -- Request register RQR : aliased RQR_Register; -- Interrupt & status register ISR : aliased ISR_Register; -- Interrupt flag clear register ICR : aliased ICR_Register; -- Receive data register RDR : aliased RDR_Register; -- Transmit data register TDR : aliased TDR_Register; end record with Volatile; for USART_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; CR3 at 16#8# range 0 .. 31; BRR at 16#C# range 0 .. 31; GTPR at 16#10# range 0 .. 31; RTOR at 16#14# range 0 .. 31; RQR at 16#18# range 0 .. 31; ISR at 16#1C# range 0 .. 31; ICR at 16#20# range 0 .. 31; RDR at 16#24# range 0 .. 31; TDR at 16#28# range 0 .. 31; end record; -- Universal synchronous asynchronous receiver transmitter UART4_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40004C00#); -- Universal synchronous asynchronous receiver transmitter UART5_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40005000#); -- Universal synchronous asynchronous receiver transmitter UART7_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40007800#); -- Universal synchronous asynchronous receiver transmitter UART8_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40007C00#); -- Universal synchronous asynchronous receiver transmitter USART1_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40011000#); -- Universal synchronous asynchronous receiver transmitter USART2_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40004400#); -- Universal synchronous asynchronous receiver transmitter USART3_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40004800#); -- Universal synchronous asynchronous receiver transmitter USART6_Periph : aliased USART_Peripheral with Import, Address => System'To_Address (16#40011400#); end STM32_SVD.USART;
zhmu/ananas
Ada
16,007
ads
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M - S T A C K _ U S A G E -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2022, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Address_To_Access_Conversions; with Interfaces; package System.Stack_Usage is pragma Preelaborate; package SSE renames System.Storage_Elements; subtype Stack_Address is SSE.Integer_Address; -- Address on the stack function To_Stack_Address (Value : System.Address) return Stack_Address renames System.Storage_Elements.To_Integer; Task_Name_Length : constant := 32; -- The maximum length of task name displayed. -- ??? Consider merging this variable with Max_Task_Image_Length. type Task_Result is record Task_Name : String (1 .. Task_Name_Length); Value : Natural; -- Amount of stack used. The value is calculated on the basis of the -- mechanism used by GNAT to allocate it, and it is NOT a precise value. Stack_Size : Natural; -- Size of the stack end record; type Result_Array_Type is array (Positive range <>) of Task_Result; type Stack_Analyzer is private; -- Type of the stack analyzer tool. It is used to fill a portion of the -- stack with Pattern, and to compute the stack used after some execution. -- Note that Fill_Stack writes data past the current top of the stack -- (i.e. at addresses less than the stack pointer register, assuming the -- stack grows downward). Therefore, this package is incompatible with -- tools like Valgrind and DrMemory. -- Usage: -- A typical use of the package is something like: -- A : Stack_Analyzer; -- task T is -- pragma Storage_Size (A_Storage_Size); -- end T; -- [...] -- Bottom_Of_Stack : aliased Integer; -- -- Bottom_Of_Stack'Address will be used as an approximation of -- -- the bottom of stack. A good practise is to avoid allocating -- -- other local variables on this stack, as it would degrade -- -- the quality of this approximation. -- begin -- Initialize_Analyzer (A, -- "Task t", -- A_Storage_Size, -- 0, -- A_Storage_Size - A_Guard, -- To_Stack_Address (Bottom_Of_Stack'Address)); -- Fill_Stack (A); -- Some_User_Code; -- Compute_Result (A); -- Report_Result (A); -- end T; -- Errors: -- -- We are instrumenting the code to measure the stack used by the user -- code. This method has a number of systematic errors, but several methods -- can be used to evaluate or reduce those errors. Here are those errors -- and the strategy that we use to deal with them: -- Bottom offset: -- Description: The procedure used to fill the stack with a given -- pattern will itself have a stack frame. The value of the stack -- pointer in this procedure is, therefore, different from the value -- before the call to the instrumentation procedure. -- Strategy: The user of this package should measure the bottom of stack -- before the call to Fill_Stack and pass it in parameter. The impact -- is very minor unless the stack used is very small, but in this case -- you aren't very interested by the figure. -- Instrumentation threshold at writing: -- Description: The procedure used to fill the stack with a given -- pattern will itself have a stack frame. Therefore, it will -- fill the stack after this stack frame. This part of the stack will -- appear as used in the final measure. -- Strategy: As the user passes the value of the bottom of stack to -- the instrumentation to deal with the bottom offset error, and as -- the instrumentation procedure knows where the pattern filling start -- on the stack, the difference between the two values is the minimum -- stack usage that the method can measure. If, when the results are -- computed, the pattern zone has been left untouched, we conclude -- that the stack usage is inferior to this minimum stack usage. -- Instrumentation threshold at reading: -- Description: The procedure used to read the stack at the end of the -- execution clobbers the stack by allocating its stack frame. If this -- stack frame is bigger than the total stack used by the user code at -- this point, it will increase the measured stack size. -- Strategy: We could augment this stack frame and see if it changes the -- measure. However, this error should be negligible. -- Pattern zone overflow: -- Description: The stack grows outer than the topmost bound of the -- pattern zone. In that case, the topmost region modified in the -- pattern is not the maximum value of the stack pointer during the -- execution. -- Strategy: At the end of the execution, the difference between the -- topmost memory region modified in the pattern zone and the -- topmost bound of the pattern zone can be understood as the -- biggest allocation that the method could have detect, provided -- that there is no "Untouched allocated zone" error and no "Pattern -- usage in user code" error. If no object in the user code is likely -- to have this size, this is not likely to happen. -- Pattern usage in user code: -- Description: The pattern can be found in the object of the user code. -- Therefore, the address space where this object has been allocated -- will appear as untouched. -- Strategy: Choose a pattern that is uncommon. 16#0000_0000# is the -- worst choice; 16#DEAD_BEEF# can be a good one. A good choice is an -- address which is not a multiple of 2, and which is not in the -- target address space. You can also change the pattern to see if it -- changes the measure. Note that this error *very* rarely influence -- the measure of the total stack usage: to have some influence, the -- pattern has to be used in the object that has been allocated on the -- topmost address of the used stack. -- Stack overflow: -- Description: The pattern zone does not fit on the stack. This may -- lead to an erroneous execution. -- Strategy: Specify a storage size that is bigger than the size of the -- pattern. 2 times bigger should be enough. -- Augmentation of the user stack frames: -- Description: The use of instrumentation object or procedure may -- augment the stack frame of the caller. -- Strategy: Do *not* inline the instrumentation procedures. Do *not* -- allocate the Stack_Analyzer object on the stack. -- Untouched allocated zone: -- Description: The user code may allocate objects that it will never -- touch. In that case, the pattern will not be changed. -- Strategy: There are no way to detect this error. Fortunately, this -- error is really rare, and it is most probably a bug in the user -- code, e.g. some uninitialized variable. It is (most of the time) -- harmless: it influences the measure only if the untouched allocated -- zone happens to be located at the topmost value of the stack -- pointer for the whole execution. procedure Initialize (Buffer_Size : Natural); pragma Export (C, Initialize, "__gnat_stack_usage_initialize"); -- Initializes the size of the buffer that stores the results. Only the -- first Buffer_Size results are stored. Any results that do not fit in -- this buffer will be displayed on the fly. procedure Fill_Stack (Analyzer : in out Stack_Analyzer); -- Fill an area of the stack with the pattern Analyzer.Pattern. The size -- of this area is Analyzer.Size. After the call to this procedure, -- the memory will look like that: -- -- Stack growing -- ----------------------------------------------------------------------> -- |<--------------------->|<----------------------------------->| -- | Stack frames to | Memory filled with Analyzer.Pattern | -- | Fill_Stack | | -- ^ | ^ -- Analyzer.Stack_Base | Analyzer.Pattern_Limit -- ^ -- Analyzer.Pattern_Limit +/- Analyzer.Pattern_Size -- procedure Initialize_Analyzer (Analyzer : in out Stack_Analyzer; Task_Name : String; Stack_Size : Natural; Stack_Base : Stack_Address; Pattern_Size : Natural; Pattern : Interfaces.Unsigned_32 := 16#DEAD_BEEF#); -- Should be called before any use of a Stack_Analyzer, to initialize it. -- Max_Pattern_Size is the size of the pattern zone, might be smaller than -- the full stack size Stack_Size in order to take into account e.g. the -- secondary stack and a guard against overflow. The actual size taken -- will be readjusted with data already used at the time the stack is -- actually filled. Is_Enabled : Boolean := False; -- When this flag is true, then stack analysis is enabled procedure Compute_Result (Analyzer : in out Stack_Analyzer); -- Read the pattern zone and deduce the stack usage. It should be called -- from the same frame as Fill_Stack. If Analyzer.Probe is not null, an -- array of Unsigned_32 with Analyzer.Probe elements is allocated on -- Compute_Result's stack frame. Probe can be used to detect the error: -- "instrumentation threshold at reading". See above. After the call -- to this procedure, the memory will look like: -- -- Stack growing -- -----------------------------------------------------------------------> -- |<---------------------->|<-------------->|<--------->|<--------->| -- | Stack frames | Array of | used | Memory | -- | to Compute_Result | Analyzer.Probe | during | filled | -- | | elements | the | with | -- | | | execution | pattern | -- | | | -- |<----------------------------------------------------> | -- Stack used ^ -- Pattern_Limit procedure Report_Result (Analyzer : Stack_Analyzer); -- Store the results of the computation in memory, at the address -- corresponding to the symbol __gnat_stack_usage_results. This is not -- done inside Compute_Result in order to use as less stack as possible -- within a task. procedure Output_Results; -- Print the results computed so far on the standard output. Should be -- called when all tasks are dead. pragma Export (C, Output_Results, "__gnat_stack_usage_output_results"); private package Unsigned_32_Addr is new System.Address_To_Access_Conversions (Interfaces.Unsigned_32); subtype Pattern_Type is Interfaces.Unsigned_32; Bytes_Per_Pattern : constant := Pattern_Type'Object_Size / Storage_Unit; type Stack_Analyzer is record Task_Name : String (1 .. Task_Name_Length); -- Name of the task Stack_Base : Stack_Address; -- Address of the base of the stack, as given by the caller of -- Initialize_Analyzer. Stack_Size : Natural; -- Entire size of the analyzed stack Pattern_Size : Natural; -- Size of the pattern zone Pattern : Pattern_Type; -- Pattern used to recognize untouched memory Pattern_Limit : Stack_Address; -- Bound of the pattern area farthest to the base Topmost_Touched_Mark : Stack_Address; -- Topmost address of the pattern area whose value it is pointing -- at has been modified during execution. If the systematic error are -- compensated, it is the topmost value of the stack pointer during -- the execution. Pattern_Overlay_Address : System.Address; -- Address of the stack abstraction object we overlay over a -- task's real stack, typically a pattern-initialized array. Result_Id : Positive; -- Id of the result. If less than value given to gnatbind -u corresponds -- to the location in the result array of result for the current task. end record; Environment_Task_Analyzer : Stack_Analyzer; Compute_Environment_Task : Boolean; type Result_Array_Ptr is access all Result_Array_Type; Result_Array : Result_Array_Ptr; pragma Export (C, Result_Array, "__gnat_stack_usage_results"); -- Exported in order to have an easy accessible symbol in when debugging Next_Id : Positive := 1; -- Id of the next stack analyzer function Stack_Size (SP_Low : Stack_Address; SP_High : Stack_Address) return Natural; pragma Inline (Stack_Size); -- Return the size of a portion of stack delimited by SP_High and SP_Low -- (), i.e. the difference between SP_High and SP_Low. The storage element -- pointed by SP_Low is not included in the size. Inlined to reduce the -- size of the stack used by the instrumentation code. end System.Stack_Usage;
BrickBot/Bound-T-H8-300
Ada
2,822
ads
-- Flow.Computation.Opt (decl) -- -- Command-line options for Flow.Computation. -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- 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. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.4 $ -- $Date: 2015/10/24 19:36:48 $ -- -- $Log: flow-computation-opt.ads,v $ -- Revision 1.4 2015/10/24 19:36:48 niklas -- Moved to free licence. -- -- Revision 1.3 2011-08-31 04:23:34 niklas -- BT-CH-0222: Option registry. Option -dump. External help files. -- -- Revision 1.2 2007/08/06 09:21:49 niklas -- Added option Trace_Models. -- -- Revision 1.1 2007/01/25 21:25:13 niklas -- BT-CH-0043. -- with Options.Bool; package Flow.Computation.Opt is pragma Elaborate_Body; -- -- To register the options. Deallocate : Boolean := True; -- -- Whether to use Unchecked_Deallocation to release unused -- heap memory. Trace_Models_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to trace on standard output the main events in the life -- of computation models. -- Trace_Models : Boolean renames Trace_Models_Opt.Value; end Flow.Computation.Opt;
AdaCore/gpr
Ada
395
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.Text_Value; package GPR2.Source_Reference.Identifier is new GPR2.Source_Reference.Text_Value (Name_Type);
AdaCore/libadalang
Ada
180
adb
procedure Test is procedure Foo is null; function Foo return Integer is (1); begin pragma Debug ((if True then True else False), Foo); pragma Test_Statement; end Test;
reznikmm/matreshka
Ada
3,704
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.Svg_V_Hanging_Attributes is pragma Preelaborate; type ODF_Svg_V_Hanging_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Svg_V_Hanging_Attribute_Access is access all ODF_Svg_V_Hanging_Attribute'Class with Storage_Size => 0; end ODF.DOM.Svg_V_Hanging_Attributes;
JKI757/coinapi-sdk
Ada
20,432
ads
-- OEML _ REST API -- This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> -- -- The version of the OpenAPI document: v1 -- Contact: [email protected] -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.2.0. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package .Models is pragma Style_Checks ("-mr"); type RejectReason_Type is record end record; package RejectReason_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RejectReason_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RejectReason_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RejectReason_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RejectReason_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RejectReason_Type_Vectors.Vector); -- ------------------------------ -- MessageReject object. -- ------------------------------ type MessageReject_Type is record P_Type : Swagger.Nullable_UString; Reject_Reason : .Models.RejectReason_Type; Exchange_Id : Swagger.Nullable_UString; Message : Swagger.Nullable_UString; Rejected_Message : Swagger.Nullable_UString; end record; package MessageReject_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => MessageReject_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in MessageReject_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in MessageReject_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out MessageReject_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out MessageReject_Type_Vectors.Vector); -- ------------------------------ -- JSON validation error. -- ------------------------------ type ValidationError_Type is record P_Type : Swagger.Nullable_UString; Title : Swagger.Nullable_UString; Status : Swagger.Number; Trace_Id : Swagger.Nullable_UString; Errors : Swagger.Nullable_UString; end record; package ValidationError_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ValidationError_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type_Vectors.Vector); type OrdType_Type is record end record; package OrdType_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrdType_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type_Vectors.Vector); type OrdStatus_Type is record end record; package OrdStatus_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrdStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type_Vectors.Vector); type OrderCancelAllRequest_Type is record Exchange_Id : Swagger.UString; end record; package OrderCancelAllRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderCancelAllRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type_Vectors.Vector); type OrderCancelSingleRequest_Type is record Exchange_Id : Swagger.UString; Exchange_Order_Id : Swagger.Nullable_UString; Client_Order_Id : Swagger.Nullable_UString; end record; package OrderCancelSingleRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderCancelSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type_Vectors.Vector); type OrdSide_Type is record end record; package OrdSide_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrdSide_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type_Vectors.Vector); type TimeInForce_Type is record end record; package TimeInForce_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => TimeInForce_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type_Vectors.Vector); type OrderNewSingleRequest_Type is record Exchange_Id : Swagger.UString; Client_Order_Id : Swagger.UString; Symbol_Id_Exchange : Swagger.Nullable_UString; Symbol_Id_Coinapi : Swagger.Nullable_UString; Amount_Order : Swagger.Number; Price : Swagger.Number; Side : .Models.OrdSide_Type; Order_Type : .Models.OrdType_Type; Time_In_Force : .Models.TimeInForce_Type; Expire_Time : Swagger.Nullable_Date; Exec_Inst : Swagger.UString_Vectors.Vector; end record; package OrderNewSingleRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderNewSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type_Vectors.Vector); -- ------------------------------ -- Relay fill information on working orders. -- ------------------------------ type Fills_Type is record Time : Swagger.Nullable_Date; Price : Swagger.Number; Amount : Swagger.Number; end record; package Fills_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Fills_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Fills_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Fills_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Fills_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Fills_Type_Vectors.Vector); type OrderExecutionReport_Type is record Exchange_Id : Swagger.UString; Client_Order_Id : Swagger.UString; Symbol_Id_Exchange : Swagger.Nullable_UString; Symbol_Id_Coinapi : Swagger.Nullable_UString; Amount_Order : Swagger.Number; Price : Swagger.Number; Side : .Models.OrdSide_Type; Order_Type : .Models.OrdType_Type; Time_In_Force : .Models.TimeInForce_Type; Expire_Time : Swagger.Nullable_Date; Exec_Inst : Swagger.UString_Vectors.Vector; Client_Order_Id_Format_Exchange : Swagger.UString; Exchange_Order_Id : Swagger.Nullable_UString; Amount_Open : Swagger.Number; Amount_Filled : Swagger.Number; Avg_Px : Swagger.Number; Status : .Models.OrdStatus_Type; Status_History : Swagger.UString_Vectors.Vector_Vectors.Vector; Error_Message : Swagger.Nullable_UString; Fills : .Models.Fills_Type_Vectors.Vector; end record; package OrderExecutionReport_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderExecutionReport_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type_Vectors.Vector); type OrderExecutionReportAllOf_Type is record Client_Order_Id_Format_Exchange : Swagger.UString; Exchange_Order_Id : Swagger.Nullable_UString; Amount_Open : Swagger.Number; Amount_Filled : Swagger.Number; Avg_Px : Swagger.Number; Status : .Models.OrdStatus_Type; Status_History : Swagger.UString_Vectors.Vector_Vectors.Vector; Error_Message : Swagger.Nullable_UString; Fills : .Models.Fills_Type_Vectors.Vector; end record; package OrderExecutionReportAllOf_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderExecutionReportAllOf_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type_Vectors.Vector); type BalanceData_Type is record Asset_Id_Exchange : Swagger.Nullable_UString; Asset_Id_Coinapi : Swagger.Nullable_UString; Balance : float; Available : float; Locked : float; Last_Updated_By : Swagger.Nullable_UString; Rate_Usd : float; Traded : float; end record; package BalanceData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => BalanceData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type_Vectors.Vector); type Balance_Type is record Exchange_Id : Swagger.Nullable_UString; Data : .Models.BalanceData_Type_Vectors.Vector; end record; package Balance_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Balance_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type_Vectors.Vector); type Position_Type is record Exchange_Id : Swagger.Nullable_UString; Data : .Models.PositionData_Type_Vectors.Vector; end record; package Position_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Position_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type_Vectors.Vector); type PositionData_Type is record Symbol_Id_Exchange : Swagger.Nullable_UString; Symbol_Id_Coinapi : Swagger.Nullable_UString; Avg_Entry_Price : Swagger.Number; Quantity : Swagger.Number; Side : .Models.OrdSide_Type; Unrealized_Pnl : Swagger.Number; Leverage : Swagger.Number; Cross_Margin : Swagger.Nullable_Boolean; Liquidation_Price : Swagger.Number; Raw_Data : Swagger.Object; end record; package PositionData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PositionData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type_Vectors.Vector); end .Models;
charlie5/cBound
Ada
1,794
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_compressed_tex_image_arb_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; minor_opcode : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; context_tag : aliased xcb.xcb_glx_context_tag_t; target : aliased Interfaces.Unsigned_32; level : aliased Interfaces.Integer_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_glx_get_compressed_tex_image_arb_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_compressed_tex_image_arb_request_t.Item, Element_Array => xcb.xcb_glx_get_compressed_tex_image_arb_request_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_compressed_tex_image_arb_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_compressed_tex_image_arb_request_t.Pointer, Element_Array => xcb.xcb_glx_get_compressed_tex_image_arb_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_compressed_tex_image_arb_request_t;
godunko/adawebpack
Ada
16,646
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . F I N A L I Z A T I O N _ M A S T E R S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2015-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- 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 is the WASM version of this package -- XXX Some code are commented out to allow to use this package with -- No_Exception_Propagation restriction. -- with Ada.Exceptions; use Ada.Exceptions; with System.Address_Image; with System.HTable; use System.HTable; with System.IO; use System.IO; with System.Soft_Links; use System.Soft_Links; with System.Storage_Elements; use System.Storage_Elements; package body System.Finalization_Masters is -- Finalize_Address hash table types. In general, masters are homogeneous -- collections of controlled objects. Rare cases such as allocations on a -- subpool require heterogeneous masters. The following table provides a -- relation between object address and its Finalize_Address routine. type Header_Num is range 0 .. 127; function Hash (Key : System.Address) return Header_Num; -- Address --> Finalize_Address_Ptr package Finalize_Address_Table is new Simple_HTable (Header_Num => Header_Num, Element => Finalize_Address_Ptr, No_Element => null, Key => System.Address, Hash => Hash, Equal => "="); --------------------------- -- Add_Offset_To_Address -- --------------------------- function Add_Offset_To_Address (Addr : System.Address; Offset : System.Storage_Elements.Storage_Offset) return System.Address is begin return System.Storage_Elements."+" (Addr, Offset); end Add_Offset_To_Address; ------------ -- Attach -- ------------ procedure Attach (N : not null FM_Node_Ptr; L : not null FM_Node_Ptr) is begin Lock_Task.all; Attach_Unprotected (N, L); Unlock_Task.all; -- Note: No need to unlock in case of an exception because the above -- code can never raise one. end Attach; ------------------------ -- Attach_Unprotected -- ------------------------ procedure Attach_Unprotected (N : not null FM_Node_Ptr; L : not null FM_Node_Ptr) is begin L.Next.Prev := N; N.Next := L.Next; L.Next := N; N.Prev := L; end Attach_Unprotected; --------------- -- Base_Pool -- --------------- function Base_Pool (Master : Finalization_Master) return Any_Storage_Pool_Ptr is begin return Master.Base_Pool; end Base_Pool; ----------------------------------------- -- Delete_Finalize_Address_Unprotected -- ----------------------------------------- procedure Delete_Finalize_Address_Unprotected (Obj : System.Address) is begin Finalize_Address_Table.Remove (Obj); end Delete_Finalize_Address_Unprotected; ------------------------ -- Detach_Unprotected -- ------------------------ procedure Detach_Unprotected (N : not null FM_Node_Ptr) is begin if N.Prev /= null and then N.Next /= null then N.Prev.Next := N.Next; N.Next.Prev := N.Prev; N.Prev := null; N.Next := null; end if; end Detach_Unprotected; -------------- -- Finalize -- -------------- overriding procedure Finalize (Master : in out Finalization_Master) is Cleanup : Finalize_Address_Ptr; Curr_Ptr : FM_Node_Ptr; -- Ex_Occur : Exception_Occurrence; Obj_Addr : Address; -- Raised : Boolean := False; function Is_Empty_List (L : not null FM_Node_Ptr) return Boolean; -- Determine whether a list contains only one element, the dummy head ------------------- -- Is_Empty_List -- ------------------- function Is_Empty_List (L : not null FM_Node_Ptr) return Boolean is begin return L.Next = L and then L.Prev = L; end Is_Empty_List; -- Start of processing for Finalize begin Lock_Task.all; -- Synchronization: -- Read - allocation, finalization -- Write - finalization if Master.Finalization_Started then Unlock_Task.all; -- Double finalization may occur during the handling of stand alone -- libraries or the finalization of a pool with subpools. Due to the -- potential aliasing of masters in these two cases, do not process -- the same master twice. return; end if; -- Lock the master to prevent any allocations while the objects are -- being finalized. The master remains locked because either the master -- is explicitly deallocated or the associated access type is about to -- go out of scope. -- Synchronization: -- Read - allocation, finalization -- Write - finalization Master.Finalization_Started := True; while not Is_Empty_List (Master.Objects'Unchecked_Access) loop Curr_Ptr := Master.Objects.Next; -- Synchronization: -- Write - allocation, deallocation, finalization Detach_Unprotected (Curr_Ptr); -- Skip the list header in order to offer proper object layout for -- finalization. Obj_Addr := Curr_Ptr.all'Address + Header_Size; -- Retrieve TSS primitive Finalize_Address depending on the master's -- mode of operation. -- Synchronization: -- Read - allocation, finalization -- Write - outside if Master.Is_Homogeneous then -- Synchronization: -- Read - finalization -- Write - allocation, outside Cleanup := Master.Finalize_Address; else -- Synchronization: -- Read - finalization -- Write - allocation, deallocation Cleanup := Finalize_Address_Unprotected (Obj_Addr); end if; begin Cleanup (Obj_Addr); -- XXX No_Exception_Propagation -- exception -- when Fin_Occur : others => -- if not Raised then -- Raised := True; -- Save_Occurrence (Ex_Occur, Fin_Occur); -- end if; end; -- When the master is a heterogeneous collection, destroy the object -- - Finalize_Address pair since it is no longer needed. -- Synchronization: -- Read - finalization -- Write - outside if not Master.Is_Homogeneous then -- Synchronization: -- Read - finalization -- Write - allocation, deallocation, finalization Delete_Finalize_Address_Unprotected (Obj_Addr); end if; end loop; Unlock_Task.all; -- If the finalization of a particular object failed or Finalize_Address -- was not set, reraise the exception now. -- if Raised then -- Reraise_Occurrence (Ex_Occur); -- end if; end Finalize; ---------------------- -- Finalize_Address -- ---------------------- function Finalize_Address (Master : Finalization_Master) return Finalize_Address_Ptr is begin return Master.Finalize_Address; end Finalize_Address; ---------------------------------- -- Finalize_Address_Unprotected -- ---------------------------------- function Finalize_Address_Unprotected (Obj : System.Address) return Finalize_Address_Ptr is begin return Finalize_Address_Table.Get (Obj); end Finalize_Address_Unprotected; -------------------------- -- Finalization_Started -- -------------------------- function Finalization_Started (Master : Finalization_Master) return Boolean is begin return Master.Finalization_Started; end Finalization_Started; ---------- -- Hash -- ---------- function Hash (Key : System.Address) return Header_Num is begin return Header_Num (To_Integer (Key) mod Integer_Address (Header_Num'Range_Length)); end Hash; ----------------- -- Header_Size -- ----------------- function Header_Size return System.Storage_Elements.Storage_Count is begin return FM_Node'Size / Storage_Unit; end Header_Size; ---------------- -- Initialize -- ---------------- overriding procedure Initialize (Master : in out Finalization_Master) is begin -- The dummy head must point to itself in both directions Master.Objects.Next := Master.Objects'Unchecked_Access; Master.Objects.Prev := Master.Objects'Unchecked_Access; end Initialize; -------------------- -- Is_Homogeneous -- -------------------- function Is_Homogeneous (Master : Finalization_Master) return Boolean is begin return Master.Is_Homogeneous; end Is_Homogeneous; ------------- -- Objects -- ------------- function Objects (Master : Finalization_Master) return FM_Node_Ptr is begin return Master.Objects'Unrestricted_Access; end Objects; ------------------ -- Print_Master -- ------------------ procedure Print_Master (Master : Finalization_Master) is Head : constant FM_Node_Ptr := Master.Objects'Unrestricted_Access; Head_Seen : Boolean := False; N_Ptr : FM_Node_Ptr; begin -- Output the basic contents of a master -- Master : 0x123456789 -- Is_Hmgen : TURE <or> FALSE -- Base_Pool: null <or> 0x123456789 -- Fin_Addr : null <or> 0x123456789 -- Fin_Start: TRUE <or> FALSE Put ("Master : "); Put_Line (Address_Image (Master'Address)); Put ("Is_Hmgen : "); Put_Line (Master.Is_Homogeneous'Img); Put ("Base_Pool: "); if Master.Base_Pool = null then Put_Line ("null"); else Put_Line (Address_Image (Master.Base_Pool'Address)); end if; Put ("Fin_Addr : "); if Master.Finalize_Address = null then Put_Line ("null"); else Put_Line (Address_Image (Master.Finalize_Address'Address)); end if; Put ("Fin_Start: "); Put_Line (Master.Finalization_Started'Img); -- Output all chained elements. The format is the following: -- ^ <or> ? <or> null -- |Header: 0x123456789 (dummy head) -- | Prev: 0x123456789 -- | Next: 0x123456789 -- V -- ^ - the current element points back to the correct element -- ? - the current element points back to an erroneous element -- n - the current element points back to null -- Header - the address of the list header -- Prev - the address of the list header which the current element -- points back to -- Next - the address of the list header which the current element -- points to -- (dummy head) - present if dummy head N_Ptr := Head; while N_Ptr /= null loop -- Should never be null Put_Line ("V"); -- We see the head initially; we want to exit when we see the head a -- second time. if N_Ptr = Head then exit when Head_Seen; Head_Seen := True; end if; -- The current element is null. This should never happen since the -- list is circular. if N_Ptr.Prev = null then Put_Line ("null (ERROR)"); -- The current element points back to the correct element elsif N_Ptr.Prev.Next = N_Ptr then Put_Line ("^"); -- The current element points to an erroneous element else Put_Line ("? (ERROR)"); end if; -- Output the header and fields Put ("|Header: "); Put (Address_Image (N_Ptr.all'Address)); -- Detect the dummy head if N_Ptr = Head then Put_Line (" (dummy head)"); else Put_Line (""); end if; Put ("| Prev: "); if N_Ptr.Prev = null then Put_Line ("null"); else Put_Line (Address_Image (N_Ptr.Prev.all'Address)); end if; Put ("| Next: "); if N_Ptr.Next = null then Put_Line ("null"); else Put_Line (Address_Image (N_Ptr.Next.all'Address)); end if; N_Ptr := N_Ptr.Next; end loop; end Print_Master; ------------------- -- Set_Base_Pool -- ------------------- procedure Set_Base_Pool (Master : in out Finalization_Master; Pool_Ptr : Any_Storage_Pool_Ptr) is begin Master.Base_Pool := Pool_Ptr; end Set_Base_Pool; -------------------------- -- Set_Finalize_Address -- -------------------------- procedure Set_Finalize_Address (Master : in out Finalization_Master; Fin_Addr_Ptr : Finalize_Address_Ptr) is begin -- Synchronization: -- Read - finalization -- Write - allocation, outside Lock_Task.all; Set_Finalize_Address_Unprotected (Master, Fin_Addr_Ptr); Unlock_Task.all; end Set_Finalize_Address; -------------------------------------- -- Set_Finalize_Address_Unprotected -- -------------------------------------- procedure Set_Finalize_Address_Unprotected (Master : in out Finalization_Master; Fin_Addr_Ptr : Finalize_Address_Ptr) is begin if Master.Finalize_Address = null then Master.Finalize_Address := Fin_Addr_Ptr; end if; end Set_Finalize_Address_Unprotected; ---------------------------------------------------- -- Set_Heterogeneous_Finalize_Address_Unprotected -- ---------------------------------------------------- procedure Set_Heterogeneous_Finalize_Address_Unprotected (Obj : System.Address; Fin_Addr_Ptr : Finalize_Address_Ptr) is begin Finalize_Address_Table.Set (Obj, Fin_Addr_Ptr); end Set_Heterogeneous_Finalize_Address_Unprotected; -------------------------- -- Set_Is_Heterogeneous -- -------------------------- procedure Set_Is_Heterogeneous (Master : in out Finalization_Master) is begin -- Synchronization: -- Read - finalization -- Write - outside Lock_Task.all; Master.Is_Homogeneous := False; Unlock_Task.all; end Set_Is_Heterogeneous; end System.Finalization_Masters;
charlie5/lace
Ada
2,469
adb
with shell.Commands.unsafe, gnat.OS_Lib, ada.Strings.fixed, ada.Strings.Maps, ada.Characters.latin_1, ada.Exceptions; package body lace.Environ.OS_Commands is use ada.Exceptions; function Path_to (Command : in String) return Paths.Folder is use Paths; begin return to_Folder (run_OS ("which " & Command)); end Path_to; procedure run_OS (command_Line : in String; Input : in String := "") is use Shell; begin Commands.unsafe.run (command_Line, +Input); exception when E : Commands.command_Error => raise Error with Exception_Message (E); end run_OS; function run_OS (command_Line : in String; Input : in String := ""; add_Errors : in Boolean := True) return String is use Shell, Shell.Commands, Shell.Commands.unsafe; function trim_LF (Source : in String) return String is use ada.Strings.fixed, ada.Strings.Maps, ada.Characters; LF_Set : constant Character_Set := to_Set (Latin_1.LF); begin return trim (Source, LF_Set, LF_Set); end trim_LF; Results : constant Command_Results := run (command_Line, +Input); Output : constant String := +Output_of (Results); begin if add_Errors then return trim_LF (Output & (+Errors_of (Results))); else return trim_LF (Output); end if; exception when E : command_Error => raise Error with Exception_Message (E); end run_OS; function run_OS (command_Line : in String; Input : in String := "") return Data is use Shell, Shell.Commands, Shell.Commands.unsafe; the_Command : unsafe.Command := Forge.to_Command (command_Line); begin return Output_of (run (The_Command, +Input)); exception when E : command_Error => raise Error with Exception_Message (E); end run_OS; function Executable_on_Path (Executable : Paths.File) return Boolean is use Paths, gnat.OS_Lib; File_Path : String_Access := locate_Exec_on_Path (+Executable); Found : constant Boolean := File_Path /= null; begin free (File_Path); return Found; end Executable_on_Path; end lace.Environ.OS_Commands;
stcarrez/ada-asf
Ada
1,854
ads
----------------------------------------------------------------------- -- asf-beans-headers -- Bean giving access to the request headers -- Copyright (C) 2011, 2012 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 Util.Beans.Basic; with Util.Beans.Objects; package ASF.Beans.Headers is -- Context variable giving access to the request headers. HEADER_ATTRIBUTE_NAME : constant String := "header"; -- ------------------------------ -- Request Header Bean -- ------------------------------ -- The <b>Header_Bean</b> gives access to the request headers. -- The bean instance is global to the application. type Header_Bean is new Util.Beans.Basic.Readonly_Bean with private; -- Get the request header identified by the given name. -- Returns Null_Object if the request does not define such header. overriding function Get_Value (Bean : in Header_Bean; Name : in String) return Util.Beans.Objects.Object; -- Return the Header_Bean instance. function Instance return Util.Beans.Objects.Object; private type Header_Bean is new Util.Beans.Basic.Readonly_Bean with null record; end ASF.Beans.Headers;
charlie5/cBound
Ada
1,359
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with xcb.xcb_glx_generic_error_t; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_bad_context_error_t is -- Item -- subtype Item is xcb.xcb_glx_generic_error_t.Item; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_bad_context_error_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_bad_context_error_t.Item, Element_Array => xcb.xcb_glx_bad_context_error_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_bad_context_error_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_bad_context_error_t.Pointer, Element_Array => xcb.xcb_glx_bad_context_error_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_bad_context_error_t;
glencornell/ada-object-framework
Ada
404
adb
with Ada.Text_Io; package body Derived_Objects is procedure My_Slot (This : in Derived_Object) is begin Ada.Text_Io.Put_Line ("My_Slot called for object with id = " & Natural'Image(This.Id)); end My_Slot; procedure My_Slot (This : in not null Aof.Core.Root_Objects.Access_Object) is begin Access_Derived_Object(This).My_Slot; end My_Slot; end Derived_Objects;
sungyeon/drake
Ada
714
ads
pragma License (Unrestricted); -- extended unit specialized for Windows package Ada.Environment_Encoding.Names is -- Constants for schemes of system-specific text encoding. pragma Preelaborate; UTF_8 : Encoding_Id renames Environment_Encoding.UTF_8; UTF_16 : Encoding_Id renames Environment_Encoding.UTF_16; UTF_32 : Encoding_Id renames Environment_Encoding.UTF_32; Latin_1 : constant Encoding_Id; Windows_31J : constant Encoding_Id; EUC_JP : constant Encoding_Id; private Latin_1 : constant Encoding_Id := 1252; -- 819 ? Windows_31J : constant Encoding_Id := 932; EUC_JP : constant Encoding_Id := 20932; -- 54932 ? end Ada.Environment_Encoding.Names;
reznikmm/matreshka
Ada
4,763
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_Subtotal_Rule_Elements; package Matreshka.ODF_Table.Subtotal_Rule_Elements is type Table_Subtotal_Rule_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Subtotal_Rule_Elements.ODF_Table_Subtotal_Rule with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Subtotal_Rule_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Subtotal_Rule_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Subtotal_Rule_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_Subtotal_Rule_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_Subtotal_Rule_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.Subtotal_Rule_Elements;
onox/sdlada
Ada
21,720
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 Interfaces; with Interfaces.C; with Interfaces.C.Strings; with SDL.Error; -- with SDL.Video.Surfaces.Makers; -- with SDL.Log; package body SDL.Video.Windows is package C renames Interfaces.C; use type Interfaces.Unsigned_32; use type C.int; use type SDL.C_Pointers.Windows_Pointer; use type System.Address; function Undefined_Window_Position (Display : Natural := 0) return SDL.Natural_Coordinate is Mask : constant Interfaces.Unsigned_32 := 16#1FFF_0000#; begin return C.int (Interfaces.Unsigned_32 (Display) or Mask); end Undefined_Window_Position; function Centered_Window_Position (Display : Natural := 0) return SDL.Natural_Coordinate is Mask : constant Interfaces.Unsigned_32 := 16#2FFF_0000#; begin return C.int (Interfaces.Unsigned_32 (Display) or Mask); end Centered_Window_Position; procedure Increment_Windows is begin Total_Windows_Created := Total_Windows_Created + 1; end Increment_Windows; procedure Decrement_Windows is begin Total_Windows_Created := Total_Windows_Created - 1; end Decrement_Windows; overriding procedure Finalize (Self : in out Window) is procedure SDL_Destroy (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_DestroyWindow"; begin -- SDL.Log.Put_Debug ("Windows.Finalize: " & (if Self.Internal = null then "null" else "not null") & -- " " & (if Self.Owns = True then "owns" else "Doesn't own")); -- Make sure we don't delete this twice! if Self.Internal /= null and then Self.Owns then -- SDL.Log.Put_Debug ("Windows.Finalize: Deleting"); SDL_Destroy (Self.Internal); Self.Internal := null; Decrement_Windows; end if; end Finalize; function Get_Brightness (Self : in Window) return Brightness is function SDL_Get_Brightness (W : in SDL.C_Pointers.Windows_Pointer) return C.C_float with Import => True, Convention => C, External_Name => "SDL_GetWindowBrightness"; begin return Brightness (SDL_Get_Brightness (Self.Internal)); end Get_Brightness; procedure Set_Brightness (Self : in out Window; How_Bright : in Brightness) is function SDL_Set_Brightness (W : in SDL.C_Pointers.Windows_Pointer; B : in C.C_float) return C.int with Import => True, Convention => C, External_Name => "SDL_SetWindowBrightness"; Result : C.int := SDL_Set_Brightness (Self.Internal, C.C_float (How_Bright)); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Set_Brightness; -- TODO: Try to see if we can just see User_Data_Access as the return type from the C function. function To_Data_Access is new Ada.Unchecked_Conversion (Source => System.Address, Target => User_Data_Access); function To_Address is new Ada.Unchecked_Conversion (Source => User_Data_Access, Target => System.Address); -- TODO: Make this and Set_Data generic. function Get_Data (Self : in Window; Name : in String) return User_Data_Access is function SDL_Get_Window_Data (W : in SDL.C_Pointers.Windows_Pointer; Name : in C.Strings.chars_ptr) return System.Address with Import => True, Convention => C, External_Name => "SDL_GetWindowData"; C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Name); Item : User_Data_Access := To_Data_Access (SDL_Get_Window_Data (Self.Internal, C_Name_Str)); begin C.Strings.Free (C_Name_Str); return Item; end Get_Data; function Set_Data (Self : in out Window; Name : in String; Item : in User_Data_Access) return User_Data_Access is function SDL_Set_Window_Data (W : in SDL.C_Pointers.Windows_Pointer; Name : in C.Strings.chars_ptr; User_Data : in System.Address) return System.Address with Import => True, Convention => C, External_Name => "SDL_SetWindowData"; C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Name); Previous_Data : User_Data_Access := To_Data_Access (SDL_Set_Window_Data (Self.Internal, C_Name_Str, To_Address (Item))); begin C.Strings.Free (C_Name_Str); return Previous_Data; end Set_Data; function Display_Index (Self : in Window) return SDL.Video.Displays.Display_Indices is function SDL_Get_Window_Display_Index (W : in SDL.C_Pointers.Windows_Pointer) return C.int with Import => True, Convention => C, External_Name => "SDL_GetWindowDisplayIndex"; Total : C.int := SDL_Get_Window_Display_Index (Self.Internal); begin if Total < 0 then raise Window_Error with SDL.Error.Get; end if; return SDL.Video.Displays.Display_Indices (Total + 1); end Display_Index; procedure Get_Display_Mode (Self : in Window; Mode : out SDL.Video.Displays.Mode) is function SDL_Get_Window_Display_Mode (W : in SDL.C_Pointers.Windows_Pointer; M : out SDL.Video.Displays.Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetWindowDisplayMode"; Result : C.int := SDL_Get_Window_Display_Mode (Self.Internal, Mode); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Get_Display_Mode; procedure Set_Display_Mode (Self : in out Window; Mode : in SDL.Video.Displays.Mode) is function SDL_Set_Window_Display_Mode (W : in SDL.C_Pointers.Windows_Pointer; M : in SDL.Video.Displays.Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_SetWindowDisplayMode"; Result : C.int := SDL_Set_Window_Display_Mode (Self.Internal, Mode); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Set_Display_Mode; function Get_Flags (Self : in Window) return Window_Flags is function SDL_Get_Window_Flags (W : in SDL.C_Pointers.Windows_Pointer) return Window_Flags with Import => True, Convention => C, External_Name => "SDL_GetWindowFlags"; begin return SDL_Get_Window_Flags (Self.Internal); end Get_Flags; function From_ID (Window_ID : in ID) return Window is function SDL_Get_Window_From_ID (W : in ID) return SDL.C_Pointers.Windows_Pointer with Import => True, Convention => C, External_Name => "SDL_GetWindowFromID"; begin return W : constant Window := (Ada.Finalization.Limited_Controlled with Internal => SDL_Get_Window_From_ID (Window_ID), Owns => False) do null; end return; end From_ID; procedure Get_Gamma_Ramp (Self : in Window; Red, Green, Blue : out SDL.Video.Pixel_Formats.Gamma_Ramp) is function SDL_Get_Window_Gamma_Ramp (W : in SDL.C_Pointers.Windows_Pointer; R, G, B : out SDL.Video.Pixel_Formats.Gamma_Ramp) return C.int with Import => True, Convention => C, External_Name => "SDL_GetWindowGammaRamp"; Result : C.int := SDL_Get_Window_Gamma_Ramp (Self.Internal, Red, Green, Blue); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Get_Gamma_Ramp; procedure Set_Gamma_Ramp (Self : in out Window; Red, Green, Blue : in SDL.Video.Pixel_Formats.Gamma_Ramp) is function SDL_Set_Window_Gamma_Ramp (W : in SDL.C_Pointers.Windows_Pointer; R, G, B : in SDL.Video.Pixel_Formats.Gamma_Ramp) return C.int with Import => True, Convention => C, External_Name => "SDL_SetWindowGammaRamp"; Result : C.int := SDL_Set_Window_Gamma_Ramp (Self.Internal, Red, Green, Blue); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Set_Gamma_Ramp; function Is_Grabbed (Self : in Window) return Boolean is function SDL_Get_Window_Grab (W : in SDL.C_Pointers.Windows_Pointer) return SDL_Bool with Import => True, Convention => C, External_Name => "SDL_GetWindowGrab"; begin return (SDL_Get_Window_Grab (Self.Internal) = SDL_True); end Is_Grabbed; procedure Set_Grabbed (Self : in out Window; Grabbed : in Boolean := True) is procedure SDL_Set_Window_Grab (W : in SDL.C_Pointers.Windows_Pointer; G : in SDL_Bool) with Import => True, Convention => C, External_Name => "SDL_SetWindowGrab"; begin SDL_Set_Window_Grab (Self.Internal, (if Grabbed = True then SDL_True else SDL_False)); end Set_Grabbed; function Get_ID (Self : in Window) return ID is function SDL_Get_Window_ID (W : in SDL.C_Pointers.Windows_Pointer) return ID with Import => True, Convention => C, External_Name => "SDL_GetWindowID"; begin return SDL_Get_Window_ID (Self.Internal); end Get_ID; function Get_Maximum_Size (Self : in Window) return SDL.Sizes is procedure SDL_Get_Window_Maximum_Size (Win : in SDL.C_Pointers.Windows_Pointer; W, H : out SDL.Dimension) with Import => True, Convention => C, External_Name => "SDL_GetWindowMaximumSize"; W, H : C.int := 0; begin SDL_Get_Window_Maximum_Size (Self.Internal, W, H); return SDL.Sizes'(Width => W, Height => H); end Get_Maximum_Size; procedure Set_Maximum_Size (Self : in out Window; Size : in SDL.Sizes) is procedure SDL_Get_Window_Maximum_Size (Win : in SDL.C_Pointers.Windows_Pointer; W, H : in C.int) with Import => True, Convention => C, External_Name => "SDL_SetWindowMaximumSize"; begin SDL_Get_Window_Maximum_Size (Self.Internal, C.int (Size.Width), C.int (Size.Height)); end Set_Maximum_Size; function Get_Minimum_Size (Self : in Window) return SDL.Sizes is procedure SDL_Get_Window_Minimum_Size (Win : in SDL.C_Pointers.Windows_Pointer; W, H : out SDL.Dimension) with Import => True, Convention => C, External_Name => "SDL_GetWindowMinimumSize"; W, H : C.int := 0; begin SDL_Get_Window_Minimum_Size (Self.Internal, W, H); return SDL.Sizes'(Width => W, Height => H); end Get_Minimum_Size; procedure Set_Minimum_Size (Self : in out Window; Size : in SDL.Sizes) is procedure SDL_Get_Window_Minimum_Size (Win : in SDL.C_Pointers.Windows_Pointer; W, H : in C.int) with Import => True, Convention => C, External_Name => "SDL_SetWindowMinimumSize"; begin SDL_Get_Window_Minimum_Size (Self.Internal, C.int (Size.Width), C.int (Size.Height)); end Set_Minimum_Size; function Pixel_Format (Self : in Window) return SDL.Video.Pixel_Formats.Pixel_Format is function SDL_Get_Window_Pixel_Format (W : in SDL.C_Pointers.Windows_Pointer) return SDL.Video.Pixel_Formats.Pixel_Format with Import => True, Convention => C, External_Name => "SDL_GetWindowPixelFormat"; begin return SDL_Get_Window_Pixel_Format (Self.Internal); end Pixel_Format; function Get_Position (Self : in Window) return SDL.Natural_Coordinates is procedure SDL_Get_Window_Position (W : in SDL.C_Pointers.Windows_Pointer; X, Y : out C.int) with Import => True, Convention => C, External_Name => "SDL_GetWindowPosition"; Position : SDL.Natural_Coordinates := SDL.Zero_Coordinate; begin SDL_Get_Window_Position (Self.Internal, Position.X, Position.Y); return Position; end Get_Position; procedure Set_Position (Self : in out Window; Position : SDL.Natural_Coordinates) is procedure SDL_Set_Window_Position (W : in SDL.C_Pointers.Windows_Pointer; X, Y : in C.int) with Import => True, Convention => C, External_Name => "SDL_SetWindowPosition"; begin SDL_Set_Window_Position (Self.Internal, Position.X, Position.Y); end Set_Position; function Get_Size (Self : in Window) return SDL.Sizes is procedure SDL_Get_Window_Size (Win : in SDL.C_Pointers.Windows_Pointer; W, H : out SDL.Dimension) with Import => True, Convention => C, External_Name => "SDL_GetWindowSize"; W, H : C.int := 0; begin SDL_Get_Window_Size (Self.Internal, W, H); return SDL.Sizes'(Width => W, Height => H); end Get_Size; procedure Set_Size (Self : in out Window; Size : in SDL.Sizes) is procedure SDL_Get_Window_Size (Win : in SDL.C_Pointers.Windows_Pointer; W, H : in C.int) with Import => True, Convention => C, External_Name => "SDL_SetWindowSize"; begin SDL_Get_Window_Size (Self.Internal, C.int (Size.Width), C.int (Size.Height)); end Set_Size; function Get_Surface (Self : in Window) return SDL.Video.Surfaces.Surface is function SDL_Get_Window_Surface (W : in SDL.C_Pointers.Windows_Pointer) return SDL.Video.Surfaces.Internal_Surface_Pointer with Import => True, Convention => C, External_Name => "SDL_GetWindowSurface"; use type SDL.Video.Surfaces.Internal_Surface_Pointer; S : SDL.Video.Surfaces.Internal_Surface_Pointer := SDL_Get_Window_Surface (Self.Internal); function Make_Surface_From_Pointer (S : in SDL.Video.Surfaces.Internal_Surface_Pointer) return SDL.Video.Surfaces.Surface with Convention => Ada, Import => True; begin if S = null then raise Window_Error with SDL.Error.Get; end if; return Make_Surface_From_Pointer (S); end Get_Surface; function Get_Title (Self : in Window) return Ada.Strings.UTF_Encoding.UTF_8_String is function SDL_Get_Window_Title (W : in SDL.C_Pointers.Windows_Pointer) return C.Strings.chars_ptr with Import => True, Convention => C, External_Name => "SDL_GetWindowTitle"; begin return C.Strings.Value (SDL_Get_Window_Title (Self.Internal)); end Get_Title; procedure Set_Title (Self : in Window; Title : in Ada.Strings.UTF_Encoding.UTF_8_String) is procedure SDL_Set_Window_Title (W : in SDL.C_Pointers.Windows_Pointer; C_Str : in C.char_array) with Import => True, Convention => C, External_Name => "SDL_SetWindowTitle"; begin SDL_Set_Window_Title (Self.Internal, C.To_C (Title)); end Set_Title; procedure Hide (Self : in Window) is procedure SDL_Hide_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_HideWindow"; begin SDL_Hide_Window (Self.Internal); end Hide; procedure Show (Self : in Window) is procedure SDL_Show_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_ShowWindow"; begin SDL_Show_Window (Self.Internal); end Show; procedure Maximise (Self : in Window) is procedure SDL_Maximise_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_MaximizeWindow"; begin SDL_Maximise_Window (Self.Internal); end Maximise; procedure Minimise (Self : in Window) is procedure SDL_Minimise_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_MinimizeWindow"; begin SDL_Minimise_Window (Self.Internal); end Minimise; procedure Raise_And_Focus (Self : in Window) is procedure SDL_Raise_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_RaiseWindow"; begin SDL_Raise_Window (Self.Internal); end Raise_And_Focus; procedure Restore (Self : in Window) is procedure SDL_Restore_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_RestoreWindow"; begin SDL_Restore_Window (Self.Internal); end Restore; procedure Set_Mode (Self : in out Window; Flags : in Full_Screen_Flags) is function SDL_Window_Full_Screen (W : in SDL.C_Pointers.Windows_Pointer; F : in Full_Screen_Flags) return C.int with Import => True, Convention => C, External_Name => "SDL_SetWindowFullscreen"; Result : C.int := SDL_Window_Full_Screen (Self.Internal, Flags); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Set_Mode; procedure Set_Icon (Self : in out Window; Icon : in SDL.Video.Surfaces.Surface) is procedure SDL_Set_Window_Icon (W : in SDL.C_Pointers.Windows_Pointer; S : SDL.Video.Surfaces.Internal_Surface_Pointer) with Import => True, Convention => C, External_Name => "SDL_SetWindowIcon"; function Get_Internal_Surface (Self : in SDL.Video.Surfaces.Surface) return SDL.Video.Surfaces.Internal_Surface_Pointer with Import => True, Convention => Ada; begin SDL_Set_Window_Icon (Self.Internal, Get_Internal_Surface (Icon)); end Set_Icon; procedure Update_Surface (Self : in Window) is function SDL_Update_Window_Surface (W : in SDL.C_Pointers.Windows_Pointer) return C.int with Import => True, Convention => C, External_Name => "SDL_UpdateWindowSurface"; Result : C.int := SDL_Update_Window_Surface (Self.Internal); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Update_Surface; procedure Update_Surface_Rectangle (Self : in Window; Rectangle : in SDL.Video.Rectangles.Rectangle) is function SDL_Update_Window_Surface_Rects (W : in SDL.C_Pointers.Windows_Pointer; R : in SDL.Video.Rectangles.Rectangle; L : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_UpdateWindowSurfaceRects"; Result : C.int := SDL_Update_Window_Surface_Rects (Self.Internal, Rectangle, 1); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Update_Surface_Rectangle; procedure Update_Surface_Rectangles (Self : in Window; Rectangles : SDL.Video.Rectangles.Rectangle_Arrays) is function SDL_Update_Window_Surface_Rects (W : in SDL.C_Pointers.Windows_Pointer; R : in SDL.Video.Rectangles.Rectangle_Arrays; L : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_UpdateWindowSurfaceRects"; Result : C.int := SDL_Update_Window_Surface_Rects (Self.Internal, Rectangles, Rectangles'Length); begin if Result /= Success then raise Window_Error with SDL.Error.Get; end if; end Update_Surface_Rectangles; function Exist return Boolean is begin if Total_Windows_Created /= Natural'First then return True; end if; return False; end Exist; function Get_Internal_Window (Self : in Window) return SDL.C_Pointers.Windows_Pointer is begin return Self.Internal; end Get_Internal_Window; end SDL.Video.Windows;
AdaCore/Ada_Drivers_Library
Ada
2,491
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2020, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL; package RISCV.Types is XLEN : constant := 64; subtype Unsigned_XLEN is HAL.UInt64; end RISCV.Types;
reznikmm/matreshka
Ada
3,803
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.ODF_Elements.Office.Scripts; package ODF.DOM.Elements.Office.Scripts.Internals is function Create (Node : Matreshka.ODF_Elements.Office.Scripts.Office_Scripts_Access) return ODF.DOM.Elements.Office.Scripts.ODF_Office_Scripts; function Wrap (Node : Matreshka.ODF_Elements.Office.Scripts.Office_Scripts_Access) return ODF.DOM.Elements.Office.Scripts.ODF_Office_Scripts; end ODF.DOM.Elements.Office.Scripts.Internals;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
325
ads
with HAL; with STM32GD; generic with package I2C is new HAL.I2C (<>); Address : STM32GD.I2C_Address; package Drivers.Si7060 is subtype Temperature_Type is Integer range -10000 .. 10000; function Init return Boolean; function Temperature_x100 (R : out Temperature_Type) return Boolean; end Drivers.Si7060;
AdaCore/libadalang
Ada
75
adb
pragma Cfg_4; separate (Pkg.Foo) procedure Bar is begin null; end Foo;
davidkristola/vole
Ada
1,706
adb
with Ada.Exceptions; use Ada.Exceptions; package body kv.avm.References is ----------------------------------------------------------------------------- function Ref_Img(Ref : Reference_Type) return String is Index : constant String := Offset_Type'IMAGE(Ref.Index); begin return Make_Register_Name(Natural(Ref.Index), Ref.Memory); end Ref_Img; ---------------------------------------------------------------------------- function Make_Register_Name (Index : Natural; Bank : Register_Bank_Type) return String is Lookup : constant array (Register_Bank_Type) of Character := ('I', 'L', 'A', 'C'); -- used to be SLAF Answer : String := Natural'IMAGE(Index); begin Answer(1) := Lookup(Bank); return Answer; end Make_Register_Name; ---------------------------------------------------------------------------- function Make_Reference(Token : String) return Reference_Type is Answer : Reference_Type; begin case Token(Token'FIRST) is when 'S' | 's' | 'I' | 'i' => -- Old: S, New: I (input) Answer.Memory := Input; when 'L' | 'l' => Answer.Memory := Local; when 'A' | 'a' => Answer.Memory := Attribute; when 'F' | 'f' | 'C' | 'c' => -- Old: F, New: C (constant) Answer.Memory := Fixed; when others => Raise_Exception(Invalid_Reference_Designator_Error'IDENTITY, "Invalid reference designator, expected I, L, A, or C; got: " & Token(Token'FIRST)); end case; Answer.Index := Offset_Type'VALUE(Token(Token'FIRST+1..Token'LAST)); return Answer; end Make_Reference; end kv.avm.References;
sparre/Command-Line-Parser-Generator
Ada
899
ads
with Ada.Containers.Indefinite_Hashed_Sets, Ada.Strings.Fixed.Equal_Case_Insensitive, Ada.Strings.Fixed.Hash_Case_Insensitive; with An_Application.Command_Line_Parser.Argument_List; private package An_Application.Command_Line_Parser.Key_List is package Sets is new Ada.Containers.Indefinite_Hashed_Sets (Element_Type => String, Hash => Ada.Strings.Fixed.Hash_Case_Insensitive, Equivalent_Elements => Ada.Strings.Fixed.Equal_Case_Insensitive); type Instance is new Sets.Set with null record; function "+" (Left : in Instance; Right : in String) return Instance; function "+" (Right : in String) return Instance; function "=" (Left : in Argument_List.Instance; Right : in Instance) return Boolean; end An_Application.Command_Line_Parser.Key_List;
AdaCore/training_material
Ada
4,955
adb
----------------------------------------------------------------------- -- Ada Labs -- -- -- -- Copyright (C) 2008-2009, AdaCore -- -- -- -- Labs is free software; you can redistribute it and/or modify it -- -- under the terms of the GNU General Public License as published by -- -- the Free Software Foundation; either version 2 of the License, or -- -- (at your option) any later version. -- -- -- -- This 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, write to the Free Software Foundation, Inc., 59 Temple -- -- Place - Suite 330, Boston, MA 02111-1307, USA. -- ----------------------------------------------------------------------- with Ada.Real_Time; use Ada.Real_Time; with Solar_System; use Solar_System; with Display; use Display; with Display.Basic; use Display.Basic; with My_Solar_System; use My_Solar_System; with Solar_System.Graphics; use Solar_System.Graphics; procedure Main is -- declare a variable Next of type Time to store the Next step time Next : Time; -- declare a constant Period of 40 milliseconds of type Time_Span defining the loop period Period : constant Time_Span := Milliseconds (40); -- reference to the application window Window : Window_ID; -- reference to the graphical canvas associated with the application window Canvas : Canvas_ID; begin -- Create the main window Window := Create_Window (Width => 240, Height => 320, Name => "Solar System"); -- retrieve the graphical canvas associated with the main window Canvas := Get_Canvas (Window); -- initialize Bodies using Init_Body procedure Init_Body (B => Get_Body (Sun, Bodies'Access), Radius => 20.0, Color => Yellow, Distance => 0.0, Angle => 0.0, Speed => 0.0, Turns_Around => Get_Body (Sun, Bodies'Access)); Init_Body (B => Get_Body (Earth, Bodies'Access), Radius => 5.0, Color => Blue, Distance => 50.0, Angle => 0.0, Speed => 0.02, Turns_Around => Get_Body (Sun, Bodies'Access)); Init_Body (B => Get_Body (Moon, Bodies'Access), Radius => 2.0, Color => White, Distance => 15.0, Angle => 0.0, Speed => 0.04, Turns_Around => Get_Body (Earth, Bodies'Access)); Init_Body (B => Get_Body (Satellite, Bodies'Access), Radius => 1.0, Color => Red, Distance => 8.0, Angle => 0.0, Speed => 0.1, Turns_Around => Get_Body (Earth, Bodies'Access)); Init_Body (B => Get_Body (Comet, Bodies'Access), Radius => 1.0, Color => Yellow, Distance => 80.0, Angle => 0.0, Speed => 0.05, Turns_Around => Get_Body (Sun, Bodies'Access)); Init_Body (B => Get_Body (Black_Hole, Bodies'Access), Radius => 0.0, Color => Blue, Distance => 75.0, Angle => 0.0, Speed => -0.02, Turns_Around => Get_Body (Sun, Bodies'Access), Visible => False); Init_Body (B => Get_Body (Asteroid_1, Bodies'Access), Radius => 1.0, Color => Green, Distance => 5.0, Angle => 0.0, Speed => 0.1, Turns_Around => Get_Body (Black_Hole, Bodies'Access)); Init_Body (B => Get_Body (Asteroid_2, Bodies'Access), Radius => 1.0, Color => Yellow, Distance => 5.0, Angle => 3.14, Speed => 0.1, Turns_Around => Get_Body (Black_Hole, Bodies'Access)); -- initialize the Next step time begin the current time (Clock) + the period Next := Clock + Period; -- create an infinite loop -- call Move_All procedure -- call Draw_All procedure -- call Swap_Buffers to update the screen -- wait until Next time -- update the Next time while not Is_Killed loop Move_All (Bodies'Access); Draw_All (Bodies, Canvas); Display.Basic.Swap_Buffers (Window); delay until Next; Next := Next + Period; end loop; end Main;
reznikmm/matreshka
Ada
5,394
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UMLDI.UML_Structure_Diagrams.Collections is pragma Preelaborate; package UMLDI_UML_Structure_Diagram_Collections is new AMF.Generic_Collections (UMLDI_UML_Structure_Diagram, UMLDI_UML_Structure_Diagram_Access); type Set_Of_UMLDI_UML_Structure_Diagram is new UMLDI_UML_Structure_Diagram_Collections.Set with null record; Empty_Set_Of_UMLDI_UML_Structure_Diagram : constant Set_Of_UMLDI_UML_Structure_Diagram; type Ordered_Set_Of_UMLDI_UML_Structure_Diagram is new UMLDI_UML_Structure_Diagram_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UMLDI_UML_Structure_Diagram : constant Ordered_Set_Of_UMLDI_UML_Structure_Diagram; type Bag_Of_UMLDI_UML_Structure_Diagram is new UMLDI_UML_Structure_Diagram_Collections.Bag with null record; Empty_Bag_Of_UMLDI_UML_Structure_Diagram : constant Bag_Of_UMLDI_UML_Structure_Diagram; type Sequence_Of_UMLDI_UML_Structure_Diagram is new UMLDI_UML_Structure_Diagram_Collections.Sequence with null record; Empty_Sequence_Of_UMLDI_UML_Structure_Diagram : constant Sequence_Of_UMLDI_UML_Structure_Diagram; private Empty_Set_Of_UMLDI_UML_Structure_Diagram : constant Set_Of_UMLDI_UML_Structure_Diagram := (UMLDI_UML_Structure_Diagram_Collections.Set with null record); Empty_Ordered_Set_Of_UMLDI_UML_Structure_Diagram : constant Ordered_Set_Of_UMLDI_UML_Structure_Diagram := (UMLDI_UML_Structure_Diagram_Collections.Ordered_Set with null record); Empty_Bag_Of_UMLDI_UML_Structure_Diagram : constant Bag_Of_UMLDI_UML_Structure_Diagram := (UMLDI_UML_Structure_Diagram_Collections.Bag with null record); Empty_Sequence_Of_UMLDI_UML_Structure_Diagram : constant Sequence_Of_UMLDI_UML_Structure_Diagram := (UMLDI_UML_Structure_Diagram_Collections.Sequence with null record); end AMF.UMLDI.UML_Structure_Diagrams.Collections;
reznikmm/matreshka
Ada
566
ads
-- $Header:$ -- -- -- NOTES -- This file is added by Umass for the purpose of adding more error recovery -- power to Ayacc. -- package Error_Report_File is -- -- TITLE: package Error_Report_File -- Output the code which allows users to see what the error token was. -- -- LANGUAGE: -- Ada -- -- PERSONNEL: -- AUTHOR: Benjamin Hurwitz -- DATE: Jul 27 1990 -- -- OVERVIEW: -- Export the procedure Write_File which outputs all the code to the -- file {base_name}_error_report.a -- -- UPDATES: -- procedure Write_File; end Error_Report_File;
MinimSecure/unum-sdk
Ada
964
adb
-- Copyright 2012-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is type Small is range 0 .. 1000; Small_Value : Small := 10; begin for J in 1 .. 10 loop Small_Value := Small_Value + Small (J); Do_Nothing (Small_Value'Address); -- STOP end loop; end Foo;
stcarrez/bbox-ada-api
Ada
882
ads
----------------------------------------------------------------------- -- upnp -- UPnP operations -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package UPnP is pragma Pure; end UPnP;
zhmu/ananas
Ada
20,999
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- F N A M E . U F -- -- -- -- 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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Alloc; with Debug; use Debug; with Fmap; use Fmap; with Krunch; with Opt; use Opt; with Osint; use Osint; with Table; with Uname; use Uname; with Widechar; use Widechar; with GNAT.HTable; package body Fname.UF is -------------------------------------------------------- -- Declarations for Handling Source_File_Name pragmas -- -------------------------------------------------------- type SFN_Entry is record U : Unit_Name_Type; -- Unit name F : File_Name_Type; -- Spec/Body file name Index : Nat; -- Index from SFN pragma (0 if none) end record; -- Record single Unit_Name type call to Set_File_Name package SFN_Table is new Table.Table ( Table_Component_Type => SFN_Entry, Table_Index_Type => Int, Table_Low_Bound => 0, Table_Initial => Alloc.SFN_Table_Initial, Table_Increment => Alloc.SFN_Table_Increment, Table_Name => "SFN_Table"); -- Table recording all Unit_Name calls to Set_File_Name type SFN_Header_Num is range 0 .. 100; function SFN_Hash (F : Unit_Name_Type) return SFN_Header_Num; -- Compute hash index for use by Simple_HTable No_Entry : constant Int := -1; -- Signals no entry in following table package SFN_HTable is new GNAT.HTable.Simple_HTable ( Header_Num => SFN_Header_Num, Element => Int, No_Element => No_Entry, Key => Unit_Name_Type, Hash => SFN_Hash, Equal => "="); -- Hash table allowing rapid access to SFN_Table, the element value is an -- index into this table. type SFN_Pattern_Entry is record Pat : String_Ptr; -- File name pattern (with asterisk in it) Typ : Character; -- 'S'/'B'/'U' for spec/body/subunit Dot : String_Ptr; -- Dot_Separator string Cas : Casing_Type; -- Upper/Lower/Mixed end record; -- Records single call to Set_File_Name_Patterm package SFN_Patterns is new Table.Table ( Table_Component_Type => SFN_Pattern_Entry, Table_Index_Type => Int, Table_Low_Bound => 1, Table_Initial => 10, Table_Increment => 100, Table_Name => "SFN_Patterns"); -- Table recording calls to Set_File_Name_Pattern. Note that the first two -- entries are set to represent the standard GNAT rules for file naming. ----------------------- -- File_Name_Of_Body -- ----------------------- function File_Name_Of_Body (Name : Name_Id) return File_Name_Type is begin Get_Name_String (Name); Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "%b"; Name_Len := Name_Len + 2; return Get_File_Name (Name_Enter, Subunit => False); end File_Name_Of_Body; ----------------------- -- File_Name_Of_Spec -- ----------------------- function File_Name_Of_Spec (Name : Name_Id) return File_Name_Type is begin Get_Name_String (Name); Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "%s"; Name_Len := Name_Len + 2; return Get_File_Name (Name_Enter, Subunit => False); end File_Name_Of_Spec; ---------------------------- -- Get_Expected_Unit_Type -- ---------------------------- function Get_Expected_Unit_Type (Fname : File_Name_Type) return Expected_Unit_Type is begin -- In syntax checking only mode or in multiple unit per file mode, there -- can be more than one unit in a file, so the file name is not a useful -- guide to the nature of the unit. if Operating_Mode = Check_Syntax or else Multiple_Unit_Index /= 0 then return Unknown; end if; -- Search the file mapping table, if we find an entry for this file we -- know whether it is a spec or a body. for J in SFN_Table.First .. SFN_Table.Last loop if Fname = SFN_Table.Table (J).F then if Is_Body_Name (SFN_Table.Table (J).U) then return Expect_Body; else return Expect_Spec; end if; end if; end loop; -- If no entry in file naming table, assume .ads/.adb for spec/body and -- return unknown if we have neither of these two cases. Get_Name_String (Fname); if Name_Len > 4 then if Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads" then return Expect_Spec; elsif Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then return Expect_Body; end if; end if; return Unknown; end Get_Expected_Unit_Type; ------------------- -- Get_File_Name -- ------------------- function Get_File_Name (Uname : Unit_Name_Type; Subunit : Boolean; May_Fail : Boolean := False) return File_Name_Type is Unit_Char : Character; -- Set to 's' or 'b' for spec or body or to 'u' for a subunit Unit_Char_Search : Character; -- Same as Unit_Char, except that in the case of 'u' for a subunit, we -- set Unit_Char_Search to 'b' if we do not find a subunit match. N : Int; Pname : File_Name_Type := No_File; Fname : File_Name_Type := No_File; -- Path name and File name for mapping begin -- Null or error name means that some previous error occurred. This is -- an unrecoverable error, so signal it. if Uname in Error_Unit_Name_Or_No_Unit_Name then raise Unrecoverable_Error; end if; -- Look in the map from unit names to file names Fname := Mapped_File_Name (Uname); -- If the unit name is already mapped, return the corresponding file -- name from the map. if Fname /= No_File then return Fname; end if; -- If there is a specific SFN pragma, return the corresponding file name N := SFN_HTable.Get (Uname); if N /= No_Entry then return SFN_Table.Table (N).F; end if; -- Here for the case where the name was not found in the table Get_Decoded_Name_String (Uname); -- A special fudge, normally we don't have operator symbols present, -- since it is always an error to do so. However, if we do, at this -- stage it has a leading double quote. -- What we do in this case is to go back to the undecoded name, which -- is of the form, for example: -- Oand%s -- and build a file name that looks like: -- _and_.ads -- which is bit peculiar, but we keep it that way. This means that we -- avoid bombs due to writing a bad file name, and we get expected error -- processing downstream, e.g. a compilation following gnatchop. if Name_Buffer (1) = '"' then Get_Name_String (Uname); Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Name_Buffer (Name_Len - 1); Name_Buffer (Name_Len - 1) := Name_Buffer (Name_Len - 2); Name_Buffer (Name_Len - 2) := '_'; Name_Buffer (1) := '_'; end if; -- Deal with spec or body suffix Unit_Char := Name_Buffer (Name_Len); pragma Assert (Unit_Char = 'b' or else Unit_Char = 's'); pragma Assert (Name_Len >= 3 and then Name_Buffer (Name_Len - 1) = '%'); Name_Len := Name_Len - 2; if Subunit then Unit_Char := 'u'; end if; -- Now we need to find the proper translation of the name declare Uname : constant String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len); Pent : Nat; Plen : Natural; Fnam : File_Name_Type := No_File; J : Natural; Dot : String_Ptr; Dotl : Natural; Is_Predef : Boolean; -- Set True for predefined file function C (N : Natural) return Character; -- Return N'th character of pattern function C (N : Natural) return Character is begin return SFN_Patterns.Table (Pent).Pat (N); end C; -- Start of search through pattern table begin -- Search pattern table to find a matching entry. In the general case -- we do two complete searches. The first time through we stop only -- if a matching file is found, the second time through we accept the -- first match regardless. Note that there will always be a match the -- second time around, because of the default entries at the end of -- the table. for No_File_Check in False .. True loop Unit_Char_Search := Unit_Char; <<Repeat_Search>> -- The search is repeated with Unit_Char_Search set to b, if an -- initial search for the subunit case fails to find any match. Pent := SFN_Patterns.First; while Pent <= SFN_Patterns.Last loop if SFN_Patterns.Table (Pent).Typ = Unit_Char_Search then -- Determine if we have a predefined file name Is_Predef := Is_Predefined_Unit_Name (Uname, Renamings_Included => True); -- Found a match, execute the pattern Name_Len := Uname'Length; Name_Buffer (1 .. Name_Len) := Uname; -- Apply casing, except that we do not do this for the case -- of a predefined library file. For the latter, we always -- use the all lower case name, regardless of the setting. if not Is_Predef then Set_Casing (SFN_Patterns.Table (Pent).Cas); end if; -- If dot translation required do it Dot := SFN_Patterns.Table (Pent).Dot; Dotl := Dot.all'Length; if Dot.all /= "." then J := 1; while J <= Name_Len loop if Name_Buffer (J) = '.' then if Dotl = 1 then Name_Buffer (J) := Dot (Dot'First); else Name_Buffer (J + Dotl .. Name_Len + Dotl - 1) := Name_Buffer (J + 1 .. Name_Len); Name_Buffer (J .. J + Dotl - 1) := Dot.all; Name_Len := Name_Len + Dotl - 1; end if; J := J + Dotl; -- Skip past wide char sequences to avoid messing with -- dot characters that are part of a sequence. elsif Name_Buffer (J) = ASCII.ESC or else (Upper_Half_Encoding and then Name_Buffer (J) in Upper_Half_Character) then Skip_Wide (Name_Buffer, J); else J := J + 1; end if; end loop; end if; -- Here move result to right if preinsertion before * Plen := SFN_Patterns.Table (Pent).Pat'Length; for K in 1 .. Plen loop if C (K) = '*' then if K /= 1 then Name_Buffer (1 + K - 1 .. Name_Len + K - 1) := Name_Buffer (1 .. Name_Len); for L in 1 .. K - 1 loop Name_Buffer (L) := C (L); end loop; Name_Len := Name_Len + K - 1; end if; for L in K + 1 .. Plen loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := C (L); end loop; exit; end if; end loop; -- Execute possible crunch on constructed name. The krunch -- operation excludes any extension that may be present. J := Name_Len; while J > 1 loop exit when Name_Buffer (J) = '.'; J := J - 1; end loop; -- Case of extension present if J > 1 then declare Ext : constant String := Name_Buffer (J .. Name_Len); begin -- Remove extension Name_Len := J - 1; -- Krunch what's left Krunch (Name_Buffer, Name_Len, Integer (Maximum_File_Name_Length), Debug_Flag_4); -- Replace extension Name_Buffer (Name_Len + 1 .. Name_Len + Ext'Length) := Ext; Name_Len := Name_Len + Ext'Length; end; -- Case of no extension present, straight krunch on the -- entire file name. else Krunch (Name_Buffer, Name_Len, Integer (Maximum_File_Name_Length), Debug_Flag_4); end if; Fnam := Name_Find; -- If we are in the second search of the table, we accept -- the file name without checking, because we know that the -- file does not exist, except when May_Fail is True, in -- which case we return No_File. if No_File_Check then if May_Fail then return No_File; else return Fnam; end if; -- Otherwise we check if the file exists else Pname := Find_File (Fnam, Source); -- If it does exist, we add it to the mappings and return -- the file name. if Pname /= No_File then -- Add to mapping, so that we don't do another path -- search in Find_File for this file name and, if we -- use a mapping file, we are ready to update it at -- the end of this compilation for the benefit of -- other compilation processes. Add_To_File_Map (Get_File_Name.Uname, Fnam, Pname); return Fnam; -- If there are only two entries, they are those of the -- default GNAT naming scheme. The file does not exist, -- but there is no point doing the second search, because -- we will end up with the same file name. Just return -- the file name, or No_File if May_Fail is True. elsif SFN_Patterns.Last = 2 then if May_Fail then return No_File; else return Fnam; end if; -- The file does not exist, but there may be other naming -- scheme. Keep on searching. else Fnam := No_File; end if; end if; end if; Pent := Pent + 1; end loop; -- If search failed, and was for a subunit, repeat the search with -- Unit_Char_Search reset to 'b', since in the normal case we -- simply treat subunits as bodies. if Fnam = No_File and then Unit_Char_Search = 'u' then Unit_Char_Search := 'b'; goto Repeat_Search; end if; -- Repeat entire search in No_File_Check mode if necessary end loop; -- Something is wrong if search fails completely, since the default -- entries should catch all possibilities at this stage. raise Program_Error; end; end Get_File_Name; -------------------- -- Get_Unit_Index -- -------------------- function Get_Unit_Index (Uname : Unit_Name_Type) return Nat is N : constant Int := SFN_HTable.Get (Uname); begin if N /= No_Entry then return SFN_Table.Table (N).Index; else return 0; end if; end Get_Unit_Index; ---------------- -- Initialize -- ---------------- procedure Initialize is begin SFN_Table.Init; SFN_Patterns.Init; -- Add default entries to SFN_Patterns.Table to represent the standard -- default GNAT rules for file name translation. SFN_Patterns.Append (New_Val => (Pat => new String'("*.ads"), Typ => 's', Dot => new String'("-"), Cas => All_Lower_Case)); SFN_Patterns.Append (New_Val => (Pat => new String'("*.adb"), Typ => 'b', Dot => new String'("-"), Cas => All_Lower_Case)); end Initialize; ---------- -- Lock -- ---------- procedure Lock is begin SFN_Table.Release; SFN_Table.Locked := True; end Lock; ------------------- -- Set_File_Name -- ------------------- procedure Set_File_Name (U : Unit_Name_Type; F : File_Name_Type; Index : Nat) is begin SFN_Table.Increment_Last; SFN_Table.Table (SFN_Table.Last) := (U, F, Index); SFN_HTable.Set (U, SFN_Table.Last); end Set_File_Name; --------------------------- -- Set_File_Name_Pattern -- --------------------------- procedure Set_File_Name_Pattern (Pat : String_Ptr; Typ : Character; Dot : String_Ptr; Cas : Casing_Type) is L : constant Nat := SFN_Patterns.Last; begin SFN_Patterns.Increment_Last; -- Move up the last two entries (the default ones) and then put the new -- entry into the table just before them (we always have the default -- entries be the last ones). SFN_Patterns.Table (L + 1) := SFN_Patterns.Table (L); SFN_Patterns.Table (L) := SFN_Patterns.Table (L - 1); SFN_Patterns.Table (L - 1) := (Pat, Typ, Dot, Cas); end Set_File_Name_Pattern; -------------- -- SFN_Hash -- -------------- function SFN_Hash (F : Unit_Name_Type) return SFN_Header_Num is begin return SFN_Header_Num (Int (F) mod SFN_Header_Num'Range_Length); end SFN_Hash; begin -- We call the initialization routine from the package body, so that -- Fname.Init only needs to be called explicitly to reinitialize. Fname.UF.Initialize; end Fname.UF;
zhmu/ananas
Ada
3,657
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ W I D E _ T E X T _ I O . I N T E G E R _ A U X -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- This package contains implementation for Ada.Wide_Wide.Text_IO.Integer_IO -- and Ada.Wide_Wide_Text_IO.Modular_IO. The routines in this package are -- identical semantically to those in Integer_IO and Modular_IO themselves, -- except that the default parameters have been removed because they are -- supplied explicitly by the calls from within these units. private generic type Num is (<>); with procedure Scan (Str : String; Ptr : not null access Integer; Max : Integer; Res : out Num); with procedure Set_Image (V : Num; S : in out String; P : in out Natural); with procedure Set_Image_Width (V : Num; W : Integer; S : out String; P : in out Natural); with procedure Set_Image_Based (V : Num; B : Natural; W : Integer; S : out String; P : in out Natural); package Ada.Wide_Wide_Text_IO.Integer_Aux is procedure Get (File : File_Type; Item : out Num; Width : Field); procedure Gets (From : String; Item : out Num; Last : out Positive); procedure Put (File : File_Type; Item : Num; Width : Field; Base : Number_Base); procedure Puts (To : out String; Item : Num; Base : Number_Base); end Ada.Wide_Wide_Text_IO.Integer_Aux;
AdaCore/gpr
Ada
43
ads
package ABC is procedure Call; end ABC;
rveenker/sdlada
Ada
4,673
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, 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. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Palettes -- -- Palettes, colours and various conversions. -------------------------------------------------------------------------------------------------------------------- with Ada.Finalization; with Ada.Iterator_Interfaces; with Interfaces.C.Pointers; package SDL.Video.Palettes is package C renames Interfaces.C; type Colour_Component is range 0 .. 255 with Size => 8, Convention => C; type Colour is record Red : Colour_Component := Colour_Component'First; Green : Colour_Component := Colour_Component'First; Blue : Colour_Component := Colour_Component'First; Alpha : Colour_Component := Colour_Component'First; end record with Convention => C_Pass_by_Copy, Size => Colour_Component'Size * 4; Null_Colour : constant Colour := (others => <>); type RGB_Colour is record Red : Colour_Component := Colour_Component'First; Green : Colour_Component := Colour_Component'First; Blue : Colour_Component := Colour_Component'First; end record with Convention => C_Pass_by_Copy, Size => Colour_Component'Size * 4; Null_RGB_Colour : constant RGB_Colour := (others => <>); -- Cursor type for our iterator. type Cursor is private; No_Element : constant Cursor; function Element (Position : in Cursor) return Colour; function Has_Element (Position : in Cursor) return Boolean with Inline; -- Create the iterator interface package. package Palette_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); type Palette is tagged limited private with Default_Iterator => Iterate, Iterator_Element => Colour, Constant_Indexing => Constant_Reference; type Palette_Access is access Palette; function Constant_Reference (Container : aliased Palette; Position : Cursor) return Colour; function Iterate (Container : Palette) return Palette_Iterator_Interfaces.Forward_Iterator'Class; function Create (Total_Colours : in Positive) return Palette; procedure Free (Container : in out Palette); Empty_Palette : constant Palette; private type Colour_Array is array (C.size_t range <>) of aliased Colour with Convention => C; package Colour_Array_Pointer is new Interfaces.C.Pointers (Index => C.size_t, Element => Colour, Element_Array => Colour_Array, Default_Terminator => Null_Colour); type Internal_Palette is record Total : C.int; Colours : Colour_Array_Pointer.Pointer; Version : Interfaces.Unsigned_32; Ref_Count : C.int; end record with Convention => C; type Internal_Palette_Access is access Internal_Palette with Convention => C; type Palette is tagged limited record Data : Internal_Palette_Access; end record; type Palette_Constant_Access is access constant Palette; type Cursor is record Container : Palette_Constant_Access; Index : Natural; Current : Colour_Array_Pointer.Pointer; end record; No_Element : constant Cursor := Cursor'(Container => null, Index => Natural'First, Current => null); Empty_Palette : constant Palette := Palette'(Data => null); end SDL.Video.Palettes;
reznikmm/matreshka
Ada
11,010
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.UML_Named_Elements; with AMF.UML.Combined_Fragments; with AMF.UML.Dependencies.Collections; with AMF.UML.Gates.Collections; with AMF.UML.General_Orderings.Collections; with AMF.UML.Interaction_Operands.Collections; with AMF.UML.Interactions; with AMF.UML.Lifelines.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.Visitors; package AMF.Internals.UML_Combined_Fragments is type UML_Combined_Fragment_Proxy is limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy and AMF.UML.Combined_Fragments.UML_Combined_Fragment with null record; overriding function Get_Cfragment_Gate (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Gates.Collections.Set_Of_UML_Gate; -- Getter of CombinedFragment::cfragmentGate. -- -- Specifies the gates that form the interface between this -- CombinedFragment and its surroundings overriding function Get_Interaction_Operator (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.UML_Interaction_Operator_Kind; -- Getter of CombinedFragment::interactionOperator. -- -- Specifies the operation which defines the semantics of this combination -- of InteractionFragments. overriding procedure Set_Interaction_Operator (Self : not null access UML_Combined_Fragment_Proxy; To : AMF.UML.UML_Interaction_Operator_Kind); -- Setter of CombinedFragment::interactionOperator. -- -- Specifies the operation which defines the semantics of this combination -- of InteractionFragments. overriding function Get_Operand (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Interaction_Operands.Collections.Ordered_Set_Of_UML_Interaction_Operand; -- Getter of CombinedFragment::operand. -- -- The set of operands of the combined fragment. overriding function Get_Covered (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline; -- Getter of InteractionFragment::covered. -- -- References the Lifelines that the InteractionFragment involves. overriding function Get_Enclosing_Interaction (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Interactions.UML_Interaction_Access; -- Getter of InteractionFragment::enclosingInteraction. -- -- The Interaction enclosing this InteractionFragment. overriding procedure Set_Enclosing_Interaction (Self : not null access UML_Combined_Fragment_Proxy; To : AMF.UML.Interactions.UML_Interaction_Access); -- Setter of InteractionFragment::enclosingInteraction. -- -- The Interaction enclosing this InteractionFragment. overriding function Get_Enclosing_Operand (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access; -- Getter of InteractionFragment::enclosingOperand. -- -- The operand enclosing this InteractionFragment (they may nest -- recursively) overriding procedure Set_Enclosing_Operand (Self : not null access UML_Combined_Fragment_Proxy; To : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access); -- Setter of InteractionFragment::enclosingOperand. -- -- The operand enclosing this InteractionFragment (they may nest -- recursively) overriding function Get_General_Ordering (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering; -- Getter of InteractionFragment::generalOrdering. -- -- The general ordering relationships contained in this fragment. overriding function Get_Client_Dependency (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Combined_Fragment_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Combined_Fragment_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 All_Owning_Packages (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Combined_Fragment_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Combined_Fragment_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding procedure Enter_Element (Self : not null access constant UML_Combined_Fragment_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant UML_Combined_Fragment_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant UML_Combined_Fragment_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.UML_Combined_Fragments;
charlie5/lace
Ada
8,073
adb
with openGL.Program.lit, openGL.Buffer.general, openGL.Shader, openGL.Attribute, openGL.Tasks, openGL.Errors, GL.lean, GL.Pointers, Interfaces.C.Strings, System.storage_Elements; package body openGL.Geometry.lit_colored is use GL.lean, GL.Pointers, Interfaces, System; ------------------ -- Shader Program -- type Program is record vertex_Shader : aliased Shader.item; fragment_Shader : aliased Shader.item; Program : openGL.Program.lit.view; end record; ----------- --- Globals -- the_Program : aliased Program; Name_1 : constant String := "Site"; Name_2 : constant String := "Normal"; Name_3 : constant String := "Color"; Name_4 : constant String := "Shine"; Attribute_1_Name : aliased C.char_array := C.to_C (Name_1); Attribute_2_Name : aliased C.char_array := C.to_C (Name_2); Attribute_3_Name : aliased C.char_array := C.to_C (Name_3); Attribute_4_Name : aliased C.char_array := C.to_C (Name_4); Attribute_1_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_1_Name'Access); Attribute_2_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_2_Name'Access); Attribute_3_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_3_Name'Access); Attribute_4_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_4_Name'Access); --------- -- Forge -- function new_Geometry return View is use System.storage_Elements; use type openGL.Program.lit.view; procedure define (the_Program : access Program) is use Attribute.Forge; Sample : Vertex; Attribute_1, Attribute_2, Attribute_3, Attribute_4 : Attribute.view; begin the_Program.Program := new openGL.Program.lit.item; the_Program. vertex_Shader.define (Shader.Vertex, "assets/opengl/shader/lit_colored.vert"); the_Program.fragment_Shader.define (Shader.Fragment, "assets/opengl/shader/lit_colored.frag"); the_Program.Program.define (the_Program. vertex_Shader'Access, the_Program.fragment_Shader'Access); Attribute_1 := new_Attribute (Name => Name_1, gl_Location => the_Program.Program.attribute_Location (Name_1), Size => 3, data_Kind => attribute.GL_FLOAT, Stride => lit_colored.Vertex'Size / 8, Offset => 0, Normalized => False); Attribute_2 := new_Attribute (Name => Name_2, gl_Location => the_Program.Program.attribute_Location (Name_2), Size => 3, data_Kind => attribute.GL_FLOAT, Stride => lit_colored.Vertex'Size / 8, Offset => Sample.Normal (1)'Address - Sample.Site (1)'Address, Normalized => False); Attribute_3 := new_Attribute (Name => Name_3, gl_Location => the_Program.Program.attribute_Location (Name_3), Size => 4, data_Kind => attribute.GL_UNSIGNED_BYTE, Stride => lit_colored.Vertex'Size / 8, Offset => Sample.Color.Primary.Red'Address - Sample.Site (1) 'Address, Normalized => True); Attribute_4 := new_Attribute (Name => Name_4, gl_Location => the_Program.Program.attribute_Location (Name_4), Size => 1, data_Kind => attribute.GL_FLOAT, Stride => lit_colored.Vertex'Size / 8, Offset => Sample.Shine 'Address - Sample.Site (1) 'Address, Normalized => True); the_Program.Program.add (Attribute_1); the_Program.Program.add (Attribute_2); the_Program.Program.add (Attribute_3); the_Program.Program.add (Attribute_4); glBindAttribLocation (program => the_Program.Program.gl_Program, index => the_Program.Program.Attribute (named => Name_1).gl_Location, name => +Attribute_1_Name_ptr); Errors.log; glBindAttribLocation (program => the_Program.Program.gl_Program, index => the_Program.Program.Attribute (named => Name_2).gl_Location, name => +Attribute_2_Name_ptr); Errors.log; glBindAttribLocation (program => the_Program.Program.gl_Program, index => the_Program.Program.Attribute (named => Name_3).gl_Location, name => +Attribute_3_Name_ptr); Errors.log; glBindAttribLocation (program => the_Program.Program.gl_Program, index => the_Program.Program.Attribute (named => Name_4).gl_Location, name => +Attribute_4_Name_ptr); Errors.log; end define; Self : constant View := new Geometry.lit_colored.item; begin Tasks.check; if the_Program.Program = null -- Define the shaders and program, if required. then define (the_Program'Access); end if; Self.Program_is (openGL.Program.view (the_Program.Program)); return Self; end new_Geometry; ---------- -- Vertex -- function is_Transparent (Self : in Vertex_array) return Boolean is function get_Color (Index : in Index_t) return rgba_Color is (Self (Index).Color); function my_Transparency is new get_Transparency (any_Index_t => Index_t, get_Color => get_Color); begin return my_Transparency (Count => Self'Length); end is_Transparent; -------------- -- Attributes -- package openGL_Buffer_of_geometry_Vertices is new Buffer.general (base_Object => Buffer.array_Object, Index => Index_t, Element => Vertex, Element_Array => Vertex_array); procedure Vertices_are (Self : in out Item; Now : in Vertex_array) is use openGL_Buffer_of_geometry_Vertices.Forge; begin Buffer.free (Self.Vertices); Self.is_Transparent := False; self.Vertices := new openGL_Buffer_of_geometry_Vertices.Object' (to_Buffer (Now, usage => Buffer.static_Draw)); Self.is_Transparent := is_Transparent (Now); -- Set the bounds. -- declare function get_Site (Index : in Index_t) return Vector_3 is (Now (Index).Site); function bounding_Box is new get_Bounds (Index_t, get_Site); begin Self.Bounds_are (bounding_Box (count => Now'Length)); end; end Vertices_are; end openGL.Geometry.lit_colored;
reznikmm/matreshka
Ada
3,743
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package Matreshka.ODF_Attributes.FO.Font_Size is type FO_Font_Size_Node is new Matreshka.ODF_Attributes.FO.FO_Node_Base with null record; type FO_Font_Size_Access is access all FO_Font_Size_Node'Class; overriding function Get_Local_Name (Self : not null access constant FO_Font_Size_Node) return League.Strings.Universal_String; end Matreshka.ODF_Attributes.FO.Font_Size;
docandrew/troodon
Ada
3,525
ads
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with bits_types_h; limited with bits_timex_h; package bits_time_h is -- unsupported macro: CLOCKS_PER_SEC ((__clock_t) 1000000) CLOCK_REALTIME : constant := 0; -- /usr/include/bits/time.h:46 CLOCK_MONOTONIC : constant := 1; -- /usr/include/bits/time.h:48 CLOCK_PROCESS_CPUTIME_ID : constant := 2; -- /usr/include/bits/time.h:50 CLOCK_THREAD_CPUTIME_ID : constant := 3; -- /usr/include/bits/time.h:52 CLOCK_MONOTONIC_RAW : constant := 4; -- /usr/include/bits/time.h:54 CLOCK_REALTIME_COARSE : constant := 5; -- /usr/include/bits/time.h:56 CLOCK_MONOTONIC_COARSE : constant := 6; -- /usr/include/bits/time.h:58 CLOCK_BOOTTIME : constant := 7; -- /usr/include/bits/time.h:60 CLOCK_REALTIME_ALARM : constant := 8; -- /usr/include/bits/time.h:62 CLOCK_BOOTTIME_ALARM : constant := 9; -- /usr/include/bits/time.h:64 CLOCK_TAI : constant := 11; -- /usr/include/bits/time.h:66 TIMER_ABSTIME : constant := 1; -- /usr/include/bits/time.h:69 -- System-dependent timing definitions. Linux version. -- Copyright (C) 1996-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C 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 -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- * Never include this file directly; use <time.h> instead. -- -- ISO/IEC 9899:1999 7.23.1: Components of time -- The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is -- the number per second of the value returned by the `clock' function. -- CAE XSH, Issue 4, Version 2: <time.h> -- The value of CLOCKS_PER_SEC is required to be 1 million on all -- XSI-conformant systems. -- Even though CLOCKS_PER_SEC has such a strange value CLK_TCK -- presents the real value for clock ticks per second for the system. -- Identifier for system-wide realtime clock. -- Monotonic system-wide clock. -- High-resolution timer from the CPU. -- Thread-specific CPU-time clock. -- Monotonic system-wide clock, not adjusted for frequency scaling. -- Identifier for system-wide realtime clock, updated only on ticks. -- Monotonic system-wide clock, updated only on ticks. -- Monotonic system-wide clock that includes time spent in suspension. -- Like CLOCK_REALTIME but also wakes suspended system. -- Like CLOCK_BOOTTIME but also wakes suspended system. -- Like CLOCK_REALTIME but in International Atomic Time. -- Flag to indicate time is absolute. -- Tune a POSIX clock. function clock_adjtime (uu_clock_id : bits_types_h.uu_clockid_t; uu_utx : access bits_timex_h.timex) return int -- /usr/include/bits/time.h:78 with Import => True, Convention => C, External_Name => "clock_adjtime"; end bits_time_h;
charlie5/cBound
Ada
1,340
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_get_property_cookie_t is -- Item -- type Item is record sequence : aliased Interfaces.C.unsigned; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_get_property_cookie_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_get_property_cookie_t.Item, Element_Array => xcb.xcb_get_property_cookie_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_get_property_cookie_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_get_property_cookie_t.Pointer, Element_Array => xcb.xcb_get_property_cookie_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_get_property_cookie_t;