repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
Rodeo-McCabe/orka | Ada | 994 | 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.
package body Orka.SIMD.SSE.Singles.Compare is
function Is_True (Elements : m128; Position : Index_Homogeneous) return Boolean is
use type GL.Types.Single;
begin
return Elements (Position) /= 0.0;
exception
when Constraint_Error =>
return True;
end Is_True;
end Orka.SIMD.SSE.Singles.Compare;
|
stcarrez/ada-asf | Ada | 1,229 | ads | -----------------------------------------------------------------------
-- asf-components-widgets -- ASF Widget Components
-- Copyright (C) 2013-2021 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.
-----------------------------------------------------------------------
-- = Widget Components =
-- The `widget` components are specific to Ada Server Faces and they provide high level
-- components to help in designing and providing a web interface.
--
-- ```
-- xmlns:w="http://code.google.com/p/ada-asf/widget"
-- ```
--
-- @include-doc docs/comp-widgets/*.txt
package ASF.Components.Widgets is
end ASF.Components.Widgets;
|
tum-ei-rcs/StratoX | Ada | 197 | ads | with Units; use Units;
package Config is
CFG_TARGET_ALTITUDE_THRESHOLD : constant Altitude_Type := 100.0 * Meter;
CFG_TARGET_ALTITUDE_THRESHOLD_TIME : constant := 6.0 * Second;
end Config;
|
jhumphry/Ada_BinToAsc | Ada | 4,025 | ads | -- BinToAsc_Suite.Base16_Tests
-- Unit tests for BinToAsc
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
with RFC4648;
with BinToAsc_Suite.Utils;
package BinToAsc_Suite.Base16_Tests is
Base16_Test_Vectors : constant Test_Vector_Array := ((TBS(""), TBS("")),
(TBS("f"), TBS("66")),
(TBS("fo"), TBS("666F")),
(TBS("foo"), TBS("666F6F")),
(TBS("foob"), TBS("666F6F62")),
(TBS("fooba"), TBS("666F6F6261")),
(TBS("foobar"), TBS("666F6F626172")));
type Base16_Test is new Test_Cases.Test_Case with null record;
procedure Register_Tests (T: in out Base16_Test);
function Name (T : Base16_Test) return Test_String;
procedure Set_Up (T : in out Base16_Test);
procedure Check_Symmetry is
new BinToAsc_Suite.Utils.Check_Symmetry(BToA => RFC4648.BToA,
Codec_To_String => RFC4648.Base16.Base16_To_String,
Codec_To_Bin => RFC4648.Base16.Base16_To_Bin);
procedure Check_Length is
new BinToAsc_Suite.Utils.Check_Length(BToA => RFC4648.BToA,
Codec_To_String => RFC4648.Base16.Base16_To_String,
Codec_To_Bin => RFC4648.Base16.Base16_To_Bin);
procedure Check_Test_Vectors_To_String is
new BinToAsc_Suite.Utils.Check_Test_Vectors_To_String(Test_Vectors => Base16_Test_Vectors,
Codec_To_String => RFC4648.Base16.Base16_To_String);
procedure Check_Test_Vectors_To_Bin is
new BinToAsc_Suite.Utils.Check_Test_Vectors_To_Bin(Test_Vectors => Base16_Test_Vectors,
Codec_To_Bin => RFC4648.Base16.Base16_To_Bin);
procedure Check_Test_Vectors_Incremental_To_String is
new BinToAsc_Suite.Utils.Check_Test_Vectors_Incremental_To_String(Test_Vectors => Base16_Test_Vectors,
Codec_To_String => RFC4648.Base16.Base16_To_String,
Max_Buffer_Length => 20);
procedure Check_Test_Vectors_Incremental_To_Bin is
new BinToAsc_Suite.Utils.Check_Test_Vectors_Incremental_To_Bin(Test_Vectors => Base16_Test_Vectors,
Codec_To_Bin => RFC4648.Base16.Base16_To_Bin,
Max_Buffer_Length => 20);
procedure Check_Test_Vectors_By_Char_To_String is
new BinToAsc_Suite.Utils.Check_Test_Vectors_By_Char_To_String(Test_Vectors => Base16_Test_Vectors,
Codec_To_String => RFC4648.Base16.Base16_To_String,
Max_Buffer_Length => 20);
procedure Check_Test_Vectors_By_Char_To_Bin is
new BinToAsc_Suite.Utils.Check_Test_Vectors_By_Char_To_Bin(Test_Vectors => Base16_Test_Vectors,
Codec_To_Bin => RFC4648.Base16.Base16_To_Bin,
Max_Buffer_Length => 20);
procedure Check_Junk_Rejection (T : in out Test_Cases.Test_Case'Class);
procedure Check_Junk_Rejection_By_Char (T : in out Test_Cases.Test_Case'Class);
procedure Check_Incomplete_Group_Rejection (T : in out Test_Cases.Test_Case'Class);
procedure Check_Case_Insensitive (T : in out Test_Cases.Test_Case'Class);
end BinToAsc_Suite.Base16_Tests;
|
wooky/aoc | Ada | 1,359 | adb | package body AOC.Coordinates is
function Hash (C : Coordinate) return Hash_Type is
begin
return Hash_Type (abs ((C.Row + C.Column + 1) * (C.Row + C.Column) / 2 + C.Row));
end Hash;
procedure Translate (C : in out Coordinate ; Delta_Row, Delta_Column : Integer) is
begin
C.Row := C.Row + Delta_Row;
C.Column := C.Column + Delta_Column;
end Translate;
function Translate (C : Coordinate ; Delta_Row, Delta_Column : Integer) return Coordinate is
Result : Coordinate := C;
begin
Result.Translate (Delta_Row, Delta_Column);
return Result;
end Translate;
function Direct_Neighbors (C : Coordinate) return Direct_Neighbors_Array is
begin
return (
C.Translate (-1, 0),
C.Translate (1, 0),
C.Translate (0, -1),
C.Translate (0, 1)
);
end Direct_Neighbors;
function Distance (From, To : Coordinate) return Natural is
begin
return abs (From.Row - To.Row) + abs (From.Column - To.Column);
end Distance;
function Find (Where : Rectangle ; What : Character) return Coordinate is
begin
for Row in Where'Range(1) loop
for Column in Where'Range(2) loop
if Where (Row, Column) = What then
return (Row => Row, Column => Column);
end if;
end loop;
end loop;
raise Program_Error with "Not found!";
end Find;
end AOC.Coordinates;
|
DrenfongWong/tkm-rpc | Ada | 724 | adb | with Tkmrpc.Servers.Cfg;
with Tkmrpc.Response.Cfg.Tkm_Version.Convert;
package body Tkmrpc.Operation_Handlers.Cfg.Tkm_Version is
-------------------------------------------------------------------------
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is
pragma Unreferenced (Req);
Specific_Res : Response.Cfg.Tkm_Version.Response_Type;
begin
Specific_Res := Response.Cfg.Tkm_Version.Null_Response;
Servers.Cfg.Tkm_Version
(Result => Specific_Res.Header.Result,
Version => Specific_Res.Data.Version);
Res := Response.Cfg.Tkm_Version.Convert.To_Response (S => Specific_Res);
end Handle;
end Tkmrpc.Operation_Handlers.Cfg.Tkm_Version;
|
reznikmm/matreshka | Ada | 7,160 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.User_Index_Entry_Template_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_User_Index_Entry_Template_Element_Node is
begin
return Self : Text_User_Index_Entry_Template_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_User_Index_Entry_Template_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_User_Index_Entry_Template
(ODF.DOM.Text_User_Index_Entry_Template_Elements.ODF_Text_User_Index_Entry_Template_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_User_Index_Entry_Template_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.User_Index_Entry_Template_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_User_Index_Entry_Template_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_User_Index_Entry_Template
(ODF.DOM.Text_User_Index_Entry_Template_Elements.ODF_Text_User_Index_Entry_Template_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_User_Index_Entry_Template_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_User_Index_Entry_Template
(Visitor,
ODF.DOM.Text_User_Index_Entry_Template_Elements.ODF_Text_User_Index_Entry_Template_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.User_Index_Entry_Template_Element,
Text_User_Index_Entry_Template_Element_Node'Tag);
end Matreshka.ODF_Text.User_Index_Entry_Template_Elements;
|
tum-ei-rcs/StratoX | Ada | 6,135 | ads | -- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: Emanuel Regnath ([email protected])
with HAL;
with Interfaces; use Interfaces;
with Ada.Unchecked_Conversion;
-- @summary
-- target-independent functions of HIL.
package HIL with
SPARK_Mode
is
pragma Preelaborate;
--procedure configure_Hardware;
subtype Byte is HAL.Byte;
-- Unsigned_8
-- Integer_8
type Bit is mod 2**1 with Size => 1;
-- Architecture Independent
type Unsigned_8_Mask is new Unsigned_8;
subtype Unsigned_8_Bit_Index is Natural range 0 .. 7;
type Unsigned_16_Mask is new Unsigned_16;
type Unsigned_16_Bit_Index is new Natural range 0 .. 15;
type Unsigned_32_Mask is new Unsigned_32;
type Unsigned_32_Bit_Index is new Natural range 0 .. 31;
-- Arrays
type Byte_Array is array(Natural range <>) of Byte;
type Short_Array is array(Natural range <>) of Unsigned_16;
type Word_Array is array(Natural range <>) of Unsigned_32;
subtype Byte_Array_2 is Byte_Array(1..2); -- not working (explicit raise in flow_utility.adb)
-- type Byte_Array_2 is Byte_Array(1..2);
type Byte_Array_4 is array(1..4) of Byte;
type Unsigned_8_Array is array(Natural range <>) of Unsigned_8;
type Unsigned_16_Array is array(Natural range <>) of Unsigned_16;
type Unsigned_32_Array is array(Natural range <>) of Unsigned_32;
type Integer_8_Array is array(Natural range <>) of Integer_8;
type Integer_16_Array is array(Natural range <>) of Integer_16;
type Integer_32_Array is array(Natural range <>) of Integer_32;
type Float_Array is array(Natural range <>) of Float;
function From_Byte_Array_To_Float is new Ada.Unchecked_Conversion (Source => Byte_Array_4,
Target => Float);
function From_Float_To_Byte_Array is new Ada.Unchecked_Conversion (Source => Float,
Target => Byte_Array_4);
-- little endian (lowest byte first)
function toBytes(uint : in Unsigned_16) return Byte_Array is
(1 => Unsigned_8( uint mod 2**8 ), 2 => Unsigned_8 ( uint / 2**8 ) );
function toBytes( source : in Float) return Byte_Array_4 is
(From_Float_To_Byte_Array( source ) )
with Pre => source'Size = 32;
-- FAILS (unsigned arg, constrained return)
function toBytes_uc(uint : Unsigned_16) return Byte_Array_2 is
(1 => Unsigned_8( uint mod 2**8 ), 2 => Unsigned_8 ( uint / 2**8 ) );
function toUnsigned_16( bytes : Byte_Array) return Unsigned_16
is
( Unsigned_16 (bytes (bytes'First ))
+ Unsigned_16 (bytes (bytes'First + 1)) * 2**8)
with Pre => bytes'Length = 2;
function toUnsigned_32( bytes : Byte_Array) return Unsigned_32 is
( Unsigned_32 (bytes (bytes'First ))
+ Unsigned_32 (bytes (bytes'First + 1)) * 2**8
+ Unsigned_32 (bytes (bytes'First + 2)) * 2**16
+ Unsigned_32 (bytes (bytes'First + 3)) * 2**24)
with Pre => bytes'Length = 4;
function Bytes_To_Unsigned32 is new Ada.Unchecked_Conversion (Source => Byte_Array_4,
Target => Unsigned_32);
function Unsigned32_To_Bytes is new Ada.Unchecked_Conversion (Source => Unsigned_32,
Target => Byte_Array_4);
function From_Byte_To_Integer_8 is new Ada.Unchecked_Conversion (Source => Byte,
Target => Integer_8);
function From_Byte_Array_To_Integer_32 is new Ada.Unchecked_Conversion (Source => Byte_Array_4,
Target => Integer_32);
function toInteger_8( value : Byte ) return Integer_8 is
( From_Byte_To_Integer_8( value ) );
function toInteger_32( bytes : Byte_Array) return Integer_32
is
(From_Byte_Array_To_Integer_32( Byte_Array_4( bytes ) ) )
with Pre => bytes'Length = 4;
function toCharacter( source : Byte ) return Character
is ( Character'Val ( source ) );
function toFloat( source : Byte_Array_4 ) return Float is
( From_Byte_Array_To_Float( source ) );
procedure write_Bits( register : in out Unsigned_8;
start_index : Unsigned_8_Bit_Index;
length : Positive;
value : Integer) with
Pre => length <= Natural (Unsigned_8_Bit_Index'Last) + 1 - Natural (start_index) and then
value < 2**(length-1) + 2**(length-1) - 1; -- e.g. 2^8 = 256, but range is only up to 2^8-1
function read_Bits( register : in Unsigned_8;
start_index : Unsigned_8_Bit_Index;
length : Positive) return Unsigned_8
with Pre => length <= Natural (Unsigned_8_Bit_Index'Last) + 1 - Natural (start_index),
Post => read_Bits'Result < 2**length;
-- procedure set_Bit( reg : in out Unsigned_16, bit : Unsigned_16_Bit_ID) is
-- mask : Unsigned_16_Mask
procedure set_Bits( register : in out Unsigned_16; bit_mask : Unsigned_16_Mask)
with Pre => register'Size = bit_mask'Size;
procedure clear_Bits( register : in out Unsigned_16; bit_mask : Unsigned_16_Mask)
with Pre => register'Size = bit_mask'Size;
function isSet( register : Unsigned_16; bit_mask : Unsigned_16_Mask) return Boolean is
( ( register and Unsigned_16( bit_mask ) ) > 0 );
-- procedure Read_Buffer
-- (Stream : not null access Streams.Root_Stream_Type'Class;
-- Item : out Byte_Array);
--
-- procedure Write_Buffer
-- (Stream : not null access Streams.Root_Stream_Type'Class;
-- Item : in Byte_Array);
--
-- for Byte_Array'Read use Read_Buffer;
-- for Byte_Array'Write use Write_Buffer;
end HIL;
|
Rodeo-McCabe/orka | Ada | 7,825 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Characters.Latin_1;
with Ada.Numerics.Generic_Elementary_Functions;
with GL.Buffers;
with Orka.Rendering.Drawing;
with Orka.Transforms.Doubles.Matrices;
with Orka.Transforms.Doubles.Vectors;
with Orka.Transforms.Doubles.Vector_Conversions;
with Orka.Transforms.Singles.Vectors;
package body Orka.Features.Atmosphere.Rendering is
package EF is new Ada.Numerics.Generic_Elementary_Functions (GL.Types.Double);
Altitude_Hack_Threshold : constant := 8000.0;
function Create_Atmosphere
(Data : aliased Model_Data;
Location : Resources.Locations.Location_Ptr;
Parameters : Model_Parameters := (others => <>)) return Atmosphere
is
Atmosphere_Model : constant Model := Create_Model (Data'Access, Location);
Sky_GLSL : constant String := Resources.Convert
(Orka.Resources.Byte_Array'(Location.Read_Data ("atmosphere/sky.frag").Get));
use Ada.Characters.Latin_1;
use Rendering.Programs;
use Rendering.Programs.Modules;
Sky_Shader : constant String :=
"#version 420 core" & LF &
(if Data.Luminance /= None then "#define USE_LUMINANCE" & LF else "") &
"const float kLengthUnitInMeters = " & Data.Length_Unit_In_Meters'Image & ";" & LF &
Sky_GLSL & LF;
Shader_Module : constant Rendering.Programs.Modules.Module := Atmosphere_Model.Get_Shader;
begin
return Result : Atmosphere :=
(Program => Create_Program (Modules.Module_Array'
(Modules.Create_Module (Location, VS => "atmosphere/sky.vert"),
Modules.Create_Module_From_Sources (FS => Sky_Shader),
Shader_Module)),
Module => Shader_Module,
Parameters => Parameters,
Bottom_Radius => Data.Bottom_Radius,
Distance_Scale => 1.0 / Data.Length_Unit_In_Meters,
others => <>)
do
Result.Uniform_Ground_Hack := Result.Program.Uniform ("ground_hack");
Result.Uniform_Camera_Offset := Result.Program.Uniform ("camera_offset");
Result.Uniform_Camera_Pos := Result.Program.Uniform ("camera_pos");
Result.Uniform_Planet_Pos := Result.Program.Uniform ("planet_pos");
Result.Uniform_View := Result.Program.Uniform ("view");
Result.Uniform_Proj := Result.Program.Uniform ("proj");
Result.Uniform_Sun_Dir := Result.Program.Uniform ("sun_direction");
Result.Uniform_Star_Dir := Result.Program.Uniform ("star_direction");
Result.Uniform_Star_Size := Result.Program.Uniform ("star_size");
end return;
end Create_Atmosphere;
function Shader_Module (Object : Atmosphere) return Orka.Rendering.Programs.Modules.Module is
(Object.Module);
function Flattened_Vector
(Parameters : Model_Parameters;
Direction : Orka.Transforms.Doubles.Vectors.Vector4)
return Orka.Transforms.Doubles.Vectors.Vector4 is
Altitude : constant := 0.0;
Flattening : GL.Types.Double renames Parameters.Flattening;
E2 : constant GL.Types.Double := 2.0 * Flattening - Flattening**2;
N : constant GL.Types.Double := Parameters.Semi_Major_Axis /
EF.Sqrt (1.0 - E2 * Direction (Orka.Z)**2);
begin
return
(Direction (Orka.X) * (N + Altitude),
Direction (Orka.Y) * (N + Altitude),
Direction (Orka.Z) * (N * (1.0 - E2) + Altitude),
1.0);
end Flattened_Vector;
package Matrices renames Orka.Transforms.Doubles.Matrices;
procedure Render
(Object : in out Atmosphere;
Camera : Cameras.Camera_Ptr;
Planet : Behaviors.Behavior_Ptr;
Star : Behaviors.Behavior_Ptr)
is
function "*" (Left : Matrices.Matrix4; Right : Matrices.Vector4) return Matrices.Vector4
renames Matrices."*";
function "*" (Left, Right : Matrices.Matrix4) return Matrices.Matrix4 renames Matrices."*";
function Far_Plane (Value : GL.Types.Compare_Function) return GL.Types.Compare_Function is
(case Value is
when Less | LEqual => LEqual,
when Greater | GEqual => GEqual,
when others => raise Constraint_Error);
Original_Function : constant GL.Types.Compare_Function := GL.Buffers.Depth_Function;
use Orka.Transforms.Doubles.Vectors;
use Orka.Transforms.Doubles.Vector_Conversions;
use all type Orka.Transforms.Doubles.Vectors.Vector4;
Planet_To_Camera : constant Vector4 := Camera.View_Position - Planet.Position;
Planet_To_Star : constant Vector4 := Star.Position - Planet.Position;
Camera_To_Star : constant Vector4 := Star.Position - Camera.View_Position;
procedure Apply_Hacks is
GL_To_Geo : constant Matrices.Matrix4 := Matrices.R
(Matrices.Vectors.Normalize ((1.0, 1.0, 1.0, 0.0)),
(2.0 / 3.0) * Ada.Numerics.Pi);
Earth_Tilt : constant Matrices.Matrix4 := Matrices.R
(Matrices.Vectors.Normalize ((1.0, 0.0, 0.0, 0.0)),
Object.Parameters.Axial_Tilt);
Inverse_Inertial : constant Matrices.Matrix4 := Earth_Tilt * GL_To_Geo;
Camera_Normal_Inert : constant Vector4 := Normalize (Inverse_Inertial * Planet_To_Camera);
Actual_Surface : constant Vector4 := Flattened_Vector
(Object.Parameters, Camera_Normal_Inert);
Expected_Surface : constant Vector4 := Camera_Normal_Inert * Object.Bottom_Radius;
Offset : constant Vector4 := Expected_Surface - Actual_Surface;
Altitude : constant GL.Types.Double := Length (Planet_To_Camera) - Length (Actual_Surface);
begin
Object.Uniform_Ground_Hack.Set_Boolean (Altitude < Altitude_Hack_Threshold);
Object.Uniform_Camera_Offset.Set_Vector (Convert (Offset * Object.Distance_Scale));
end Apply_Hacks;
begin
if Object.Parameters.Flattening > 0.0 then
Apply_Hacks;
else
Object.Uniform_Ground_Hack.Set_Boolean (False);
Object.Uniform_Camera_Offset.Set_Vector (Orka.Transforms.Singles.Vectors.Zero_Point);
end if;
Object.Uniform_Camera_Pos.Set_Vector (Orka.Transforms.Singles.Vectors.Zero_Point);
Object.Uniform_Planet_Pos.Set_Vector (Convert (-Planet_To_Camera * Object.Distance_Scale));
Object.Uniform_Sun_Dir.Set_Vector (Convert (Normalize (Planet_To_Star)));
Object.Uniform_Star_Dir.Set_Vector (Convert (Normalize (Camera_To_Star)));
-- Use distance to star and its radius instead of the
-- Sun_Angular_Radius of Model_Data
declare
Angular_Radius : constant GL.Types.Double :=
EF.Arctan (Object.Parameters.Star_Radius, Length (Camera_To_Star));
begin
Object.Uniform_Star_Size.Set_Single (GL.Types.Single (EF.Cos (Angular_Radius)));
end;
Object.Uniform_View.Set_Matrix (Camera.View_Matrix);
Object.Uniform_Proj.Set_Matrix (Camera.Lens.Projection_Matrix);
Object.Program.Use_Program;
GL.Buffers.Set_Depth_Function (Far_Plane (Original_Function));
Orka.Rendering.Drawing.Draw (GL.Types.Triangles, 0, 3);
GL.Buffers.Set_Depth_Function (Original_Function);
end Render;
end Orka.Features.Atmosphere.Rendering;
|
VMika/DES_Ada | Ada | 17,449 | adb | pragma Warnings (Off);
pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__main.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__main.adb");
pragma Suppress (Overflow_Check);
with System.Restrictions;
with Ada.Exceptions;
package body ada_main is
E070 : Short_Integer; pragma Import (Ada, E070, "system__os_lib_E");
E013 : Short_Integer; pragma Import (Ada, E013, "system__soft_links_E");
E023 : Short_Integer; pragma Import (Ada, E023, "system__exception_table_E");
E066 : Short_Integer; pragma Import (Ada, E066, "ada__io_exceptions_E");
E050 : Short_Integer; pragma Import (Ada, E050, "ada__strings_E");
E038 : Short_Integer; pragma Import (Ada, E038, "ada__containers_E");
E025 : Short_Integer; pragma Import (Ada, E025, "system__exceptions_E");
E017 : Short_Integer; pragma Import (Ada, E017, "system__secondary_stack_E");
E076 : Short_Integer; pragma Import (Ada, E076, "interfaces__c_E");
E052 : Short_Integer; pragma Import (Ada, E052, "ada__strings__maps_E");
E056 : Short_Integer; pragma Import (Ada, E056, "ada__strings__maps__constants_E");
E078 : Short_Integer; pragma Import (Ada, E078, "system__object_reader_E");
E045 : Short_Integer; pragma Import (Ada, E045, "system__dwarf_lines_E");
E037 : Short_Integer; pragma Import (Ada, E037, "system__traceback__symbolic_E");
E146 : Short_Integer; pragma Import (Ada, E146, "interfaces__c__strings_E");
E201 : Short_Integer; pragma Import (Ada, E201, "interfaces__cobol_E");
E156 : Short_Integer; pragma Import (Ada, E156, "system__task_info_E");
E108 : Short_Integer; pragma Import (Ada, E108, "ada__tags_E");
E106 : Short_Integer; pragma Import (Ada, E106, "ada__streams_E");
E122 : Short_Integer; pragma Import (Ada, E122, "system__file_control_block_E");
E121 : Short_Integer; pragma Import (Ada, E121, "system__finalization_root_E");
E119 : Short_Integer; pragma Import (Ada, E119, "ada__finalization_E");
E118 : Short_Integer; pragma Import (Ada, E118, "system__file_io_E");
E216 : Short_Integer; pragma Import (Ada, E216, "ada__streams__stream_io_E");
E182 : Short_Integer; pragma Import (Ada, E182, "system__storage_pools_E");
E178 : Short_Integer; pragma Import (Ada, E178, "system__finalization_masters_E");
E176 : Short_Integer; pragma Import (Ada, E176, "system__storage_pools__subpools_E");
E168 : Short_Integer; pragma Import (Ada, E168, "ada__strings__unbounded_E");
E006 : Short_Integer; pragma Import (Ada, E006, "ada__calendar_E");
E140 : Short_Integer; pragma Import (Ada, E140, "ada__real_time_E");
E104 : Short_Integer; pragma Import (Ada, E104, "ada__text_io_E");
E203 : Short_Integer; pragma Import (Ada, E203, "system__pool_global_E");
E212 : Short_Integer; pragma Import (Ada, E212, "system__sequential_io_E");
E238 : Short_Integer; pragma Import (Ada, E238, "system__tasking__initialization_E");
E246 : Short_Integer; pragma Import (Ada, E246, "system__tasking__protected_objects_E");
E250 : Short_Integer; pragma Import (Ada, E250, "system__tasking__protected_objects__entries_E");
E254 : Short_Integer; pragma Import (Ada, E254, "system__tasking__queuing_E");
E260 : Short_Integer; pragma Import (Ada, E260, "system__tasking__stages_E");
E195 : Short_Integer; pragma Import (Ada, E195, "p_structuraltypes_E");
E193 : Short_Integer; pragma Import (Ada, E193, "p_stephandler_E");
E207 : Short_Integer; pragma Import (Ada, E207, "p_stephandler__feistelhandler_E");
E209 : Short_Integer; pragma Import (Ada, E209, "p_stephandler__inputhandler_E");
E220 : Short_Integer; pragma Import (Ada, E220, "p_stephandler__iphandler_E");
E222 : Short_Integer; pragma Import (Ada, E222, "p_stephandler__keyhandler_E");
E224 : Short_Integer; pragma Import (Ada, E224, "p_stephandler__outputhandler_E");
E226 : Short_Integer; pragma Import (Ada, E226, "p_stephandler__reverseiphandler_E");
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E226 := E226 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "p_stephandler__reverseiphandler__finalize_spec");
begin
F1;
end;
E224 := E224 - 1;
declare
procedure F2;
pragma Import (Ada, F2, "p_stephandler__outputhandler__finalize_spec");
begin
F2;
end;
E222 := E222 - 1;
declare
procedure F3;
pragma Import (Ada, F3, "p_stephandler__keyhandler__finalize_spec");
begin
F3;
end;
E220 := E220 - 1;
declare
procedure F4;
pragma Import (Ada, F4, "p_stephandler__iphandler__finalize_spec");
begin
F4;
end;
E209 := E209 - 1;
declare
procedure F5;
pragma Import (Ada, F5, "p_stephandler__inputhandler__finalize_spec");
begin
F5;
end;
E207 := E207 - 1;
declare
procedure F6;
pragma Import (Ada, F6, "p_stephandler__feistelhandler__finalize_spec");
begin
F6;
end;
E193 := E193 - 1;
declare
procedure F7;
pragma Import (Ada, F7, "p_stephandler__finalize_spec");
begin
F7;
end;
E250 := E250 - 1;
declare
procedure F8;
pragma Import (Ada, F8, "system__tasking__protected_objects__entries__finalize_spec");
begin
F8;
end;
E212 := E212 - 1;
declare
procedure F9;
pragma Import (Ada, F9, "system__sequential_io__finalize_spec");
begin
F9;
end;
E203 := E203 - 1;
declare
procedure F10;
pragma Import (Ada, F10, "system__pool_global__finalize_spec");
begin
F10;
end;
E104 := E104 - 1;
declare
procedure F11;
pragma Import (Ada, F11, "ada__text_io__finalize_spec");
begin
F11;
end;
E168 := E168 - 1;
declare
procedure F12;
pragma Import (Ada, F12, "ada__strings__unbounded__finalize_spec");
begin
F12;
end;
E176 := E176 - 1;
declare
procedure F13;
pragma Import (Ada, F13, "system__storage_pools__subpools__finalize_spec");
begin
F13;
end;
E178 := E178 - 1;
declare
procedure F14;
pragma Import (Ada, F14, "system__finalization_masters__finalize_spec");
begin
F14;
end;
E216 := E216 - 1;
declare
procedure F15;
pragma Import (Ada, F15, "ada__streams__stream_io__finalize_spec");
begin
F15;
end;
declare
procedure F16;
pragma Import (Ada, F16, "system__file_io__finalize_body");
begin
E118 := E118 - 1;
F16;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
Bind_Env_Addr : System.Address;
pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
System.Restrictions.Run_Time_Restrictions :=
(Set =>
(False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False),
Value => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
Violated =>
(False, False, False, True, True, False, False, True,
False, False, True, True, True, True, False, False,
False, False, False, True, True, False, True, True,
False, True, True, True, True, False, False, False,
False, False, True, False, False, True, False, True,
False, False, True, False, False, False, True, True,
False, True, True, False, True, False, False, False,
True, False, True, True, True, True, True, False,
False, True, False, True, True, True, False, True,
True, False, True, True, True, True, False, False,
True, False, False, False, False, True, True, True,
False, False, False),
Count => (0, 0, 0, 0, 2, 2, 1, 0, 0, 0),
Unknown => (False, False, False, False, False, False, True, False, False, False));
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E023 := E023 + 1;
Ada.Io_Exceptions'Elab_Spec;
E066 := E066 + 1;
Ada.Strings'Elab_Spec;
E050 := E050 + 1;
Ada.Containers'Elab_Spec;
E038 := E038 + 1;
System.Exceptions'Elab_Spec;
E025 := E025 + 1;
System.Soft_Links'Elab_Body;
E013 := E013 + 1;
Interfaces.C'Elab_Spec;
System.Os_Lib'Elab_Body;
E070 := E070 + 1;
Ada.Strings.Maps'Elab_Spec;
Ada.Strings.Maps.Constants'Elab_Spec;
E056 := E056 + 1;
System.Secondary_Stack'Elab_Body;
E017 := E017 + 1;
System.Object_Reader'Elab_Spec;
System.Dwarf_Lines'Elab_Spec;
E045 := E045 + 1;
E076 := E076 + 1;
E052 := E052 + 1;
System.Traceback.Symbolic'Elab_Body;
E037 := E037 + 1;
E078 := E078 + 1;
Interfaces.C.Strings'Elab_Spec;
E146 := E146 + 1;
Interfaces.Cobol'Elab_Spec;
E201 := E201 + 1;
System.Task_Info'Elab_Spec;
E156 := E156 + 1;
Ada.Tags'Elab_Spec;
Ada.Tags'Elab_Body;
E108 := E108 + 1;
Ada.Streams'Elab_Spec;
E106 := E106 + 1;
System.File_Control_Block'Elab_Spec;
E122 := E122 + 1;
System.Finalization_Root'Elab_Spec;
E121 := E121 + 1;
Ada.Finalization'Elab_Spec;
E119 := E119 + 1;
System.File_Io'Elab_Body;
E118 := E118 + 1;
Ada.Streams.Stream_Io'Elab_Spec;
E216 := E216 + 1;
System.Storage_Pools'Elab_Spec;
E182 := E182 + 1;
System.Finalization_Masters'Elab_Spec;
System.Finalization_Masters'Elab_Body;
E178 := E178 + 1;
System.Storage_Pools.Subpools'Elab_Spec;
E176 := E176 + 1;
Ada.Strings.Unbounded'Elab_Spec;
E168 := E168 + 1;
Ada.Calendar'Elab_Spec;
Ada.Calendar'Elab_Body;
E006 := E006 + 1;
Ada.Real_Time'Elab_Spec;
Ada.Real_Time'Elab_Body;
E140 := E140 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E104 := E104 + 1;
System.Pool_Global'Elab_Spec;
E203 := E203 + 1;
System.Sequential_Io'Elab_Spec;
E212 := E212 + 1;
System.Tasking.Initialization'Elab_Body;
E238 := E238 + 1;
System.Tasking.Protected_Objects'Elab_Body;
E246 := E246 + 1;
System.Tasking.Protected_Objects.Entries'Elab_Spec;
E250 := E250 + 1;
System.Tasking.Queuing'Elab_Body;
E254 := E254 + 1;
System.Tasking.Stages'Elab_Body;
E260 := E260 + 1;
E195 := E195 + 1;
P_Stephandler'Elab_Spec;
P_Stephandler'Elab_Body;
E193 := E193 + 1;
P_Stephandler.Feistelhandler'Elab_Spec;
P_Stephandler.Feistelhandler'Elab_Body;
E207 := E207 + 1;
P_Stephandler.Inputhandler'Elab_Spec;
P_Stephandler.Inputhandler'Elab_Body;
E209 := E209 + 1;
P_Stephandler.Iphandler'Elab_Spec;
P_Stephandler.Iphandler'Elab_Body;
E220 := E220 + 1;
P_Stephandler.Keyhandler'Elab_Spec;
P_Stephandler.Keyhandler'Elab_Body;
E222 := E222 + 1;
P_Stephandler.Outputhandler'Elab_Spec;
P_Stephandler.Outputhandler'Elab_Body;
E224 := E224 + 1;
P_Stephandler.Reverseiphandler'Elab_Spec;
P_Stephandler.Reverseiphandler'Elab_Body;
E226 := E226 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_main");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_structuraltypes.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler-feistelhandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler-inputhandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler-iphandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler-keyhandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler-outputhandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\p_stephandler-reverseiphandler.o
-- C:\Users\vadim\des-ada\Des-Ada - Copie\obj\main.o
-- -LC:\Users\vadim\des-ada\Des-Ada - Copie\obj\
-- -LC:\Users\vadim\des-ada\Des-Ada - Copie\obj\
-- -LC:/gnat/2017/lib/gcc/i686-pc-mingw32/6.3.1/adalib/
-- -static
-- -lgnarl
-- -lgnat
-- -Xlinker
-- --stack=0x200000,0x1000
-- -mthreads
-- -Wl,--stack=0x2000000
-- END Object file/option list
end ada_main;
|
PThierry/ewok-kernel | Ada | 1,863 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with system; use system;
with soc.rcc;
package body soc.exti
with spark_mode => off
is
procedure init
is
begin
for line in t_exti_line_index'range loop
clear_pending(line);
disable(line);
end loop;
soc.rcc.RCC.APB2ENR.SYSCFGEN := true;
end init;
function is_line_pending
(line : t_exti_line_index)
return boolean
is
begin
return (EXTI.PR.line(line) = PENDING_REQUEST);
end is_line_pending;
procedure clear_pending
(line : in t_exti_line_index)
is
begin
EXTI.PR.line(line) := CLEAR_REQUEST;
end clear_pending;
procedure enable
(line : in t_exti_line_index)
is
begin
EXTI.IMR.line(line) := NOT_MASKED; -- interrupt is unmasked
end enable;
procedure disable
(line : in t_exti_line_index)
is
begin
EXTI.IMR.line(line) := MASKED; -- interrupt is masked
end disable;
function is_enabled (line : in t_exti_line_index)
return boolean
is
begin
return EXTI.IMR.line(line) = NOT_MASKED;
end;
end soc.exti;
|
MinimSecure/unum-sdk | Ada | 898 | adb | -- Copyright 2010-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
Last_Node_Id : Node_Id := Node_Id'First;
function Pn (N : Node_Id) return Node_Id is
begin
Last_Node_Id := N;
return N;
end Pn;
end Pck;
|
zhmu/ananas | Ada | 30,068 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
-- --
-- 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 Ada.Strings.Wide_Fixed;
with Ada.Strings.Wide_Search;
with Ada.Unchecked_Deallocation;
package body Ada.Strings.Wide_Unbounded is
---------
-- "&" --
---------
function "&"
(Left : Unbounded_Wide_String;
Right : Unbounded_Wide_String) return Unbounded_Wide_String
is
L_Length : constant Natural := Left.Last;
R_Length : constant Natural := Right.Last;
Result : Unbounded_Wide_String;
begin
Result.Last := L_Length + R_Length;
Result.Reference := new Wide_String (1 .. Result.Last);
Result.Reference (1 .. L_Length) :=
Left.Reference (1 .. Left.Last);
Result.Reference (L_Length + 1 .. Result.Last) :=
Right.Reference (1 .. Right.Last);
return Result;
end "&";
function "&"
(Left : Unbounded_Wide_String;
Right : Wide_String) return Unbounded_Wide_String
is
L_Length : constant Natural := Left.Last;
Result : Unbounded_Wide_String;
begin
Result.Last := L_Length + Right'Length;
Result.Reference := new Wide_String (1 .. Result.Last);
Result.Reference (1 .. L_Length) := Left.Reference (1 .. Left.Last);
Result.Reference (L_Length + 1 .. Result.Last) := Right;
return Result;
end "&";
function "&"
(Left : Wide_String;
Right : Unbounded_Wide_String) return Unbounded_Wide_String
is
R_Length : constant Natural := Right.Last;
Result : Unbounded_Wide_String;
begin
Result.Last := Left'Length + R_Length;
Result.Reference := new Wide_String (1 .. Result.Last);
Result.Reference (1 .. Left'Length) := Left;
Result.Reference (Left'Length + 1 .. Result.Last) :=
Right.Reference (1 .. Right.Last);
return Result;
end "&";
function "&"
(Left : Unbounded_Wide_String;
Right : Wide_Character) return Unbounded_Wide_String
is
Result : Unbounded_Wide_String;
begin
Result.Last := Left.Last + 1;
Result.Reference := new Wide_String (1 .. Result.Last);
Result.Reference (1 .. Result.Last - 1) :=
Left.Reference (1 .. Left.Last);
Result.Reference (Result.Last) := Right;
return Result;
end "&";
function "&"
(Left : Wide_Character;
Right : Unbounded_Wide_String) return Unbounded_Wide_String
is
Result : Unbounded_Wide_String;
begin
Result.Last := Right.Last + 1;
Result.Reference := new Wide_String (1 .. Result.Last);
Result.Reference (1) := Left;
Result.Reference (2 .. Result.Last) :=
Right.Reference (1 .. Right.Last);
return Result;
end "&";
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Wide_Character) return Unbounded_Wide_String
is
Result : Unbounded_Wide_String;
begin
Result.Last := Left;
Result.Reference := new Wide_String (1 .. Left);
for J in Result.Reference'Range loop
Result.Reference (J) := Right;
end loop;
return Result;
end "*";
function "*"
(Left : Natural;
Right : Wide_String) return Unbounded_Wide_String
is
Len : constant Natural := Right'Length;
K : Positive;
Result : Unbounded_Wide_String;
begin
Result.Last := Left * Len;
Result.Reference := new Wide_String (1 .. Result.Last);
K := 1;
for J in 1 .. Left loop
Result.Reference (K .. K + Len - 1) := Right;
K := K + Len;
end loop;
return Result;
end "*";
function "*"
(Left : Natural;
Right : Unbounded_Wide_String) return Unbounded_Wide_String
is
Len : constant Natural := Right.Last;
K : Positive;
Result : Unbounded_Wide_String;
begin
Result.Last := Left * Len;
Result.Reference := new Wide_String (1 .. Result.Last);
K := 1;
for J in 1 .. Left loop
Result.Reference (K .. K + Len - 1) :=
Right.Reference (1 .. Right.Last);
K := K + Len;
end loop;
return Result;
end "*";
---------
-- "<" --
---------
function "<"
(Left : Unbounded_Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) < Right.Reference (1 .. Right.Last);
end "<";
function "<"
(Left : Unbounded_Wide_String;
Right : Wide_String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) < Right;
end "<";
function "<"
(Left : Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return Left < Right.Reference (1 .. Right.Last);
end "<";
----------
-- "<=" --
----------
function "<="
(Left : Unbounded_Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) <= Right.Reference (1 .. Right.Last);
end "<=";
function "<="
(Left : Unbounded_Wide_String;
Right : Wide_String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) <= Right;
end "<=";
function "<="
(Left : Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return Left <= Right.Reference (1 .. Right.Last);
end "<=";
---------
-- "=" --
---------
function "="
(Left : Unbounded_Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) = Right.Reference (1 .. Right.Last);
end "=";
function "="
(Left : Unbounded_Wide_String;
Right : Wide_String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) = Right;
end "=";
function "="
(Left : Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return Left = Right.Reference (1 .. Right.Last);
end "=";
---------
-- ">" --
---------
function ">"
(Left : Unbounded_Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) > Right.Reference (1 .. Right.Last);
end ">";
function ">"
(Left : Unbounded_Wide_String;
Right : Wide_String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) > Right;
end ">";
function ">"
(Left : Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return Left > Right.Reference (1 .. Right.Last);
end ">";
----------
-- ">=" --
----------
function ">="
(Left : Unbounded_Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) >= Right.Reference (1 .. Right.Last);
end ">=";
function ">="
(Left : Unbounded_Wide_String;
Right : Wide_String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) >= Right;
end ">=";
function ">="
(Left : Wide_String;
Right : Unbounded_Wide_String) return Boolean
is
begin
return Left >= Right.Reference (1 .. Right.Last);
end ">=";
------------
-- Adjust --
------------
procedure Adjust (Object : in out Unbounded_Wide_String) is
begin
-- Copy string, except we do not copy the statically allocated null
-- string, since it can never be deallocated. Note that we do not copy
-- extra string room here to avoid dragging unused allocated memory.
if Object.Reference /= Null_Wide_String'Access then
Object.Reference :=
new Wide_String'(Object.Reference (1 .. Object.Last));
end if;
end Adjust;
------------
-- Append --
------------
procedure Append
(Source : in out Unbounded_Wide_String;
New_Item : Unbounded_Wide_String)
is
begin
Realloc_For_Chunk (Source, New_Item.Last);
Source.Reference (Source.Last + 1 .. Source.Last + New_Item.Last) :=
New_Item.Reference (1 .. New_Item.Last);
Source.Last := Source.Last + New_Item.Last;
end Append;
procedure Append
(Source : in out Unbounded_Wide_String;
New_Item : Wide_String)
is
begin
Realloc_For_Chunk (Source, New_Item'Length);
Source.Reference (Source.Last + 1 .. Source.Last + New_Item'Length) :=
New_Item;
Source.Last := Source.Last + New_Item'Length;
end Append;
procedure Append
(Source : in out Unbounded_Wide_String;
New_Item : Wide_Character)
is
begin
Realloc_For_Chunk (Source, 1);
Source.Reference (Source.Last + 1) := New_Item;
Source.Last := Source.Last + 1;
end Append;
-----------
-- Count --
-----------
function Count
(Source : Unbounded_Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
begin
return
Wide_Search.Count
(Source.Reference (1 .. Source.Last), Pattern, Mapping);
end Count;
function Count
(Source : Unbounded_Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
begin
return
Wide_Search.Count
(Source.Reference (1 .. Source.Last), Pattern, Mapping);
end Count;
function Count
(Source : Unbounded_Wide_String;
Set : Wide_Maps.Wide_Character_Set) return Natural
is
begin
return
Wide_Search.Count
(Source.Reference (1 .. Source.Last), Set);
end Count;
------------
-- Delete --
------------
function Delete
(Source : Unbounded_Wide_String;
From : Positive;
Through : Natural) return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Delete
(Source.Reference (1 .. Source.Last), From, Through));
end Delete;
procedure Delete
(Source : in out Unbounded_Wide_String;
From : Positive;
Through : Natural)
is
begin
if From > Through then
null;
elsif From < Source.Reference'First or else Through > Source.Last then
raise Index_Error;
else
declare
Len : constant Natural := Through - From + 1;
begin
Source.Reference (From .. Source.Last - Len) :=
Source.Reference (Through + 1 .. Source.Last);
Source.Last := Source.Last - Len;
end;
end if;
end Delete;
-------------
-- Element --
-------------
function Element
(Source : Unbounded_Wide_String;
Index : Positive) return Wide_Character
is
begin
if Index <= Source.Last then
return Source.Reference (Index);
else
raise Strings.Index_Error;
end if;
end Element;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Unbounded_Wide_String) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
begin
-- Note: Don't try to free statically allocated null string
if Object.Reference /= Null_Wide_String'Access then
Deallocate (Object.Reference);
Object.Reference := Null_Unbounded_Wide_String.Reference;
Object.Last := 0;
end if;
end Finalize;
----------------
-- Find_Token --
----------------
procedure Find_Token
(Source : Unbounded_Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Strings.Membership;
First : out Positive;
Last : out Natural)
is
begin
Wide_Search.Find_Token
(Source.Reference (From .. Source.Last), Set, Test, First, Last);
end Find_Token;
procedure Find_Token
(Source : Unbounded_Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Strings.Membership;
First : out Positive;
Last : out Natural)
is
begin
Wide_Search.Find_Token
(Source.Reference (1 .. Source.Last), Set, Test, First, Last);
end Find_Token;
----------
-- Free --
----------
procedure Free (X : in out Wide_String_Access) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
begin
-- Note: Do not try to free statically allocated null string
if X /= Null_Unbounded_Wide_String.Reference then
Deallocate (X);
end if;
end Free;
----------
-- Head --
----------
function Head
(Source : Unbounded_Wide_String;
Count : Natural;
Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String
is
begin
return To_Unbounded_Wide_String
(Wide_Fixed.Head (Source.Reference (1 .. Source.Last), Count, Pad));
end Head;
procedure Head
(Source : in out Unbounded_Wide_String;
Count : Natural;
Pad : Wide_Character := Wide_Space)
is
Old : Wide_String_Access := Source.Reference;
begin
Source.Reference :=
new Wide_String'
(Wide_Fixed.Head (Source.Reference (1 .. Source.Last), Count, Pad));
Source.Last := Source.Reference'Length;
Free (Old);
end Head;
-----------
-- Index --
-----------
function Index
(Source : Unbounded_Wide_String;
Pattern : Wide_String;
Going : Strings.Direction := Strings.Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
begin
return
Wide_Search.Index
(Source.Reference (1 .. Source.Last), Pattern, Going, Mapping);
end Index;
function Index
(Source : Unbounded_Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
begin
return
Wide_Search.Index
(Source.Reference (1 .. Source.Last), Pattern, Going, Mapping);
end Index;
function Index
(Source : Unbounded_Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Strings.Membership := Strings.Inside;
Going : Strings.Direction := Strings.Forward) return Natural
is
begin
return Wide_Search.Index
(Source.Reference (1 .. Source.Last), Set, Test, Going);
end Index;
function Index
(Source : Unbounded_Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
begin
return
Wide_Search.Index
(Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
end Index;
function Index
(Source : Unbounded_Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
begin
return
Wide_Search.Index
(Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
end Index;
function Index
(Source : Unbounded_Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
return
Wide_Search.Index
(Source.Reference (1 .. Source.Last), Set, From, Test, Going);
end Index;
function Index_Non_Blank
(Source : Unbounded_Wide_String;
Going : Strings.Direction := Strings.Forward) return Natural
is
begin
return
Wide_Search.Index_Non_Blank
(Source.Reference (1 .. Source.Last), Going);
end Index_Non_Blank;
function Index_Non_Blank
(Source : Unbounded_Wide_String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
return
Wide_Search.Index_Non_Blank
(Source.Reference (1 .. Source.Last), From, Going);
end Index_Non_Blank;
----------------
-- Initialize --
----------------
procedure Initialize (Object : in out Unbounded_Wide_String) is
begin
Object.Reference := Null_Unbounded_Wide_String.Reference;
Object.Last := 0;
end Initialize;
------------
-- Insert --
------------
function Insert
(Source : Unbounded_Wide_String;
Before : Positive;
New_Item : Wide_String) return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Insert
(Source.Reference (1 .. Source.Last), Before, New_Item));
end Insert;
procedure Insert
(Source : in out Unbounded_Wide_String;
Before : Positive;
New_Item : Wide_String)
is
begin
if Before not in Source.Reference'First .. Source.Last + 1 then
raise Index_Error;
end if;
Realloc_For_Chunk (Source, New_Item'Length);
Source.Reference
(Before + New_Item'Length .. Source.Last + New_Item'Length) :=
Source.Reference (Before .. Source.Last);
Source.Reference (Before .. Before + New_Item'Length - 1) := New_Item;
Source.Last := Source.Last + New_Item'Length;
end Insert;
------------
-- Length --
------------
function Length (Source : Unbounded_Wide_String) return Natural is
begin
return Source.Last;
end Length;
---------------
-- Overwrite --
---------------
function Overwrite
(Source : Unbounded_Wide_String;
Position : Positive;
New_Item : Wide_String) return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Overwrite
(Source.Reference (1 .. Source.Last), Position, New_Item));
end Overwrite;
procedure Overwrite
(Source : in out Unbounded_Wide_String;
Position : Positive;
New_Item : Wide_String)
is
NL : constant Natural := New_Item'Length;
begin
if Position <= Source.Last - NL + 1 then
Source.Reference (Position .. Position + NL - 1) := New_Item;
else
declare
Old : Wide_String_Access := Source.Reference;
begin
Source.Reference := new Wide_String'
(Wide_Fixed.Overwrite
(Source.Reference (1 .. Source.Last), Position, New_Item));
Source.Last := Source.Reference'Length;
Free (Old);
end;
end if;
end Overwrite;
-----------------------
-- Realloc_For_Chunk --
-----------------------
procedure Realloc_For_Chunk
(Source : in out Unbounded_Wide_String;
Chunk_Size : Natural)
is
Growth_Factor : constant := 32;
-- The growth factor controls how much extra space is allocated when
-- we have to increase the size of an allocated unbounded string. By
-- allocating extra space, we avoid the need to reallocate on every
-- append, particularly important when a string is built up by repeated
-- append operations of small pieces. This is expressed as a factor so
-- 32 means add 1/32 of the length of the string as growth space.
Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
-- Allocation will be done by a multiple of Min_Mul_Alloc This causes
-- no memory loss as most (all?) malloc implementations are obliged to
-- align the returned memory on the maximum alignment as malloc does not
-- know the target alignment.
S_Length : constant Natural := Source.Reference'Length;
begin
if Chunk_Size > S_Length - Source.Last then
declare
New_Size : constant Positive :=
S_Length + Chunk_Size + (S_Length / Growth_Factor);
New_Rounded_Up_Size : constant Positive :=
((New_Size - 1) / Min_Mul_Alloc + 1) * Min_Mul_Alloc;
Tmp : constant Wide_String_Access :=
new Wide_String (1 .. New_Rounded_Up_Size);
begin
Tmp (1 .. Source.Last) := Source.Reference (1 .. Source.Last);
Free (Source.Reference);
Source.Reference := Tmp;
end;
end if;
end Realloc_For_Chunk;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Source : in out Unbounded_Wide_String;
Index : Positive;
By : Wide_Character)
is
begin
if Index <= Source.Last then
Source.Reference (Index) := By;
else
raise Strings.Index_Error;
end if;
end Replace_Element;
-------------------
-- Replace_Slice --
-------------------
function Replace_Slice
(Source : Unbounded_Wide_String;
Low : Positive;
High : Natural;
By : Wide_String) return Unbounded_Wide_String
is
begin
return To_Unbounded_Wide_String
(Wide_Fixed.Replace_Slice
(Source.Reference (1 .. Source.Last), Low, High, By));
end Replace_Slice;
procedure Replace_Slice
(Source : in out Unbounded_Wide_String;
Low : Positive;
High : Natural;
By : Wide_String)
is
Old : Wide_String_Access := Source.Reference;
begin
Source.Reference := new Wide_String'
(Wide_Fixed.Replace_Slice
(Source.Reference (1 .. Source.Last), Low, High, By));
Source.Last := Source.Reference'Length;
Free (Old);
end Replace_Slice;
-------------------------------
-- Set_Unbounded_Wide_String --
-------------------------------
procedure Set_Unbounded_Wide_String
(Target : out Unbounded_Wide_String;
Source : Wide_String)
is
begin
Target.Last := Source'Length;
Target.Reference := new Wide_String (1 .. Source'Length);
Target.Reference.all := Source;
end Set_Unbounded_Wide_String;
-----------
-- Slice --
-----------
function Slice
(Source : Unbounded_Wide_String;
Low : Positive;
High : Natural) return Wide_String
is
begin
-- Note: test of High > Length is in accordance with AI95-00128
if Low > Source.Last + 1 or else High > Source.Last then
raise Index_Error;
else
return Source.Reference (Low .. High);
end if;
end Slice;
----------
-- Tail --
----------
function Tail
(Source : Unbounded_Wide_String;
Count : Natural;
Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String is
begin
return To_Unbounded_Wide_String
(Wide_Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
end Tail;
procedure Tail
(Source : in out Unbounded_Wide_String;
Count : Natural;
Pad : Wide_Character := Wide_Space)
is
Old : Wide_String_Access := Source.Reference;
begin
Source.Reference := new Wide_String'
(Wide_Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
Source.Last := Source.Reference'Length;
Free (Old);
end Tail;
------------------------------
-- To_Unbounded_Wide_String --
------------------------------
function To_Unbounded_Wide_String
(Source : Wide_String)
return Unbounded_Wide_String
is
Result : Unbounded_Wide_String;
begin
Result.Last := Source'Length;
Result.Reference := new Wide_String (1 .. Source'Length);
Result.Reference.all := Source;
return Result;
end To_Unbounded_Wide_String;
function To_Unbounded_Wide_String
(Length : Natural) return Unbounded_Wide_String
is
Result : Unbounded_Wide_String;
begin
Result.Last := Length;
Result.Reference := new Wide_String (1 .. Length);
return Result;
end To_Unbounded_Wide_String;
-------------------
-- To_Wide_String --
--------------------
function To_Wide_String
(Source : Unbounded_Wide_String)
return Wide_String
is
begin
return Source.Reference (1 .. Source.Last);
end To_Wide_String;
---------------
-- Translate --
---------------
function Translate
(Source : Unbounded_Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping)
return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Translate
(Source.Reference (1 .. Source.Last), Mapping));
end Translate;
procedure Translate
(Source : in out Unbounded_Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping)
is
begin
Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
end Translate;
function Translate
(Source : Unbounded_Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function)
return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Translate
(Source.Reference (1 .. Source.Last), Mapping));
end Translate;
procedure Translate
(Source : in out Unbounded_Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function)
is
begin
Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
end Translate;
----------
-- Trim --
----------
function Trim
(Source : Unbounded_Wide_String;
Side : Trim_End) return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
end Trim;
procedure Trim
(Source : in out Unbounded_Wide_String;
Side : Trim_End)
is
Old : Wide_String_Access := Source.Reference;
begin
Source.Reference :=
new Wide_String'
(Wide_Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
Source.Last := Source.Reference'Length;
Free (Old);
end Trim;
function Trim
(Source : Unbounded_Wide_String;
Left : Wide_Maps.Wide_Character_Set;
Right : Wide_Maps.Wide_Character_Set)
return Unbounded_Wide_String
is
begin
return
To_Unbounded_Wide_String
(Wide_Fixed.Trim
(Source.Reference (1 .. Source.Last), Left, Right));
end Trim;
procedure Trim
(Source : in out Unbounded_Wide_String;
Left : Wide_Maps.Wide_Character_Set;
Right : Wide_Maps.Wide_Character_Set)
is
Old : Wide_String_Access := Source.Reference;
begin
Source.Reference :=
new Wide_String'
(Wide_Fixed.Trim
(Source.Reference (1 .. Source.Last), Left, Right));
Source.Last := Source.Reference'Length;
Free (Old);
end Trim;
---------------------
-- Unbounded_Slice --
---------------------
function Unbounded_Slice
(Source : Unbounded_Wide_String;
Low : Positive;
High : Natural) return Unbounded_Wide_String
is
begin
if Low > Source.Last + 1 or else High > Source.Last then
raise Index_Error;
else
return To_Unbounded_Wide_String (Source.Reference.all (Low .. High));
end if;
end Unbounded_Slice;
procedure Unbounded_Slice
(Source : Unbounded_Wide_String;
Target : out Unbounded_Wide_String;
Low : Positive;
High : Natural)
is
begin
if Low > Source.Last + 1 or else High > Source.Last then
raise Index_Error;
else
Target :=
To_Unbounded_Wide_String (Source.Reference.all (Low .. High));
end if;
end Unbounded_Slice;
end Ada.Strings.Wide_Unbounded;
|
BrickBot/Bound-T-H8-300 | Ada | 6,664 | ads | -- Flow.Opt (decl)
--
-- Command-line options for the control-flow analysis.
--
-- 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.14 $
-- $Date: 2015/10/24 19:36:49 $
--
-- $Log: flow-opt.ads,v $
-- Revision 1.14 2015/10/24 19:36:49 niklas
-- Moved to free licence.
--
-- Revision 1.13 2013-02-05 20:08:31 niklas
-- Using Options.General.Trace_Resolution for Trace_Flow_Resolution.
--
-- Revision 1.12 2011-08-31 04:23:34 niklas
-- BT-CH-0222: Option registry. Option -dump. External help files.
--
-- Revision 1.11 2007/08/25 18:53:20 niklas
-- Added option Check_Consistency.
--
-- Revision 1.10 2007/07/21 18:18:42 niklas
-- BT-CH-0064. Support for AVR/IAR switch-handler analysis.
--
-- Revision 1.9 2007/07/11 18:47:03 niklas
-- Added Virtual_Mood_T (for AVR/IAR). Not yet used in a generic way.
--
-- Revision 1.8 2007/01/25 21:25:15 niklas
-- BT-CH-0043.
--
-- Revision 1.7 2006/11/26 22:07:26 niklas
-- BT-CH-0039.
--
-- Revision 1.6 2006/10/24 08:44:31 niklas
-- BT-CH-0028.
--
-- Revision 1.5 2006/08/22 12:12:45 niklas
-- Added the option Warn_No_Return (-warn return), for warning about
-- calls to non-returning subprograms. Before, these warnings were
-- always emitted; now they are disabled by default.
--
-- Revision 1.4 2006/05/06 06:59:21 niklas
-- BT-CH-0021.
--
-- Revision 1.3 2005/02/16 21:11:45 niklas
-- BT-CH-0002.
--
-- Revision 1.2 2003/02/17 16:16:18 holsti
-- Added option Trace_Calls (-trace calls) to display calls as they are found.
--
-- Revision 1.1 2003/01/03 11:45:53 holsti
-- First version.
--
with Options.Bool;
package Flow.Opt is
pragma Elaborate_Body;
--
-- To register the options.
Warn_Dynamic_Flow_Opt : aliased Options.Bool.Option_T (Default => True);
--
-- Whether to emit a warning whenever a dynamic (boundable) control
-- transition element (edge, call) is added to a flow-graph.
--
Warn_Dynamic_Flow : Boolean renames Warn_Dynamic_Flow_Opt.Value;
Trace_Construction_Opt : aliased Options.Bool.Option_T (Default => False);
--
-- Whether to trace the actions for constructing the control-flow graph.
-- The actions are: add a step, add an edge, take a loose edge, bind a
-- loose edge.
--
Trace_Construction : Boolean renames Trace_Construction_Opt.Value;
Trace_Data_States_Opt : aliased Options.Bool.Option_T (Default => False);
--
-- Whether to trace the transformations of the data state associated
-- with flow-graph elements (Step_Tag_T.Data) as such elements are
-- created.
--
Trace_Data_States : Boolean renames Trace_Data_States_Opt.Value;
Trace_Data_Refinement_Opt : aliased Options.Bool.Option_T (Default => False);
--
-- Whether to trace the occasions when some property of an element
-- being added to a flow-graph becomes refined (partially evaluated)
-- by the data state (Step_Tag_T.Data) associated with the element.
--
Trace_Data_Refinement : Boolean renames Trace_Data_Refinement_Opt.Value;
function Trace_Flow_Resolution return Boolean;
--
-- Whether to trace the process of resolving dynamic control flow
-- which here means the calls of Add_Resolved_Edge.
-- Tracks Options.General.Trace_Resolution.
Check_Consistency_Opt : aliased Options.Bool.Option_T (Default => False);
--
-- Whether to check the flow-graph construction for internal
-- consistency. This can be quite time-consuming.
--
Check_Consistency : Boolean renames Check_Consistency_Opt.Value;
Deallocate : Boolean := True;
--
-- Whether to use Unchecked_Deallocation to release unused
-- heap memory.
--
--- Options for virtual function calls
--
-- These options might be more at home in Flow.Calls.Opt, but they
-- are defined here to make them available in Processor.Program.
type Possible_Virtual_Mood_T is (Any, Static, Dynamic);
--
-- Whether virtual function calls (ie. dispatching calls) should
-- be analysed Statically (when possible) or as Dynamic calls.
-- The value Any means "not specified here".
subtype Virtual_Mood_T is Possible_Virtual_Mood_T range Static .. Dynamic;
--
-- A specified virtual-mood, that is, not Any mood.
package Virtual_Mood_Valued is new Options.Discrete_Valued (
Value_Type => Virtual_Mood_T,
Value_Image => Virtual_Mood_T'Image);
--
-- Options with values of type Virtual_Mood_T.
Virtual_Mood_Opt : aliased Virtual_Mood_Valued.Option_T (Default => Static);
--
-- Whether virtual function calls (ie. dispatching calls) should
-- be analysed statically (when possible) or as dynamic calls, to
-- be resolved by analysis or by assertions.
--
-- If virtual calls are analysed statically it may not be possible
-- to limit the set of callees by an assertion.
--
Virtual_Mood : Virtual_Mood_T renames Virtual_Mood_Opt.Value;
end Flow.Opt;
|
zhmu/ananas | Ada | 90 | ads | package Private1 is
type T is private;
private
type T is new Boolean;
end Private1;
|
reznikmm/matreshka | Ada | 7,272 | 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_Elements;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Exception_Handlers;
with AMF.UML.Executable_Nodes;
with AMF.UML.Object_Nodes;
with AMF.Visitors;
package AMF.Internals.UML_Exception_Handlers is
type UML_Exception_Handler_Proxy is
limited new AMF.Internals.UML_Elements.UML_Element_Proxy
and AMF.UML.Exception_Handlers.UML_Exception_Handler with null record;
overriding function Get_Exception_Input
(Self : not null access constant UML_Exception_Handler_Proxy)
return AMF.UML.Object_Nodes.UML_Object_Node_Access;
-- Getter of ExceptionHandler::exceptionInput.
--
-- An object node within the handler body. When the handler catches an
-- exception, the exception token is placed in this node, causing the body
-- to execute.
overriding procedure Set_Exception_Input
(Self : not null access UML_Exception_Handler_Proxy;
To : AMF.UML.Object_Nodes.UML_Object_Node_Access);
-- Setter of ExceptionHandler::exceptionInput.
--
-- An object node within the handler body. When the handler catches an
-- exception, the exception token is placed in this node, causing the body
-- to execute.
overriding function Get_Exception_Type
(Self : not null access constant UML_Exception_Handler_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of ExceptionHandler::exceptionType.
--
-- The kind of instances that the handler catches. If an exception occurs
-- whose type is any of the classifiers in the set, the handler catches
-- the exception and executes its body.
overriding function Get_Handler_Body
(Self : not null access constant UML_Exception_Handler_Proxy)
return AMF.UML.Executable_Nodes.UML_Executable_Node_Access;
-- Getter of ExceptionHandler::handlerBody.
--
-- A node that is executed if the handler satisfies an uncaught exception.
overriding procedure Set_Handler_Body
(Self : not null access UML_Exception_Handler_Proxy;
To : AMF.UML.Executable_Nodes.UML_Executable_Node_Access);
-- Setter of ExceptionHandler::handlerBody.
--
-- A node that is executed if the handler satisfies an uncaught exception.
overriding function Get_Protected_Node
(Self : not null access constant UML_Exception_Handler_Proxy)
return AMF.UML.Executable_Nodes.UML_Executable_Node_Access;
-- Getter of ExceptionHandler::protectedNode.
--
-- The node protected by the handler. The handler is examined if an
-- exception propagates to the outside of the node.
overriding procedure Set_Protected_Node
(Self : not null access UML_Exception_Handler_Proxy;
To : AMF.UML.Executable_Nodes.UML_Executable_Node_Access);
-- Setter of ExceptionHandler::protectedNode.
--
-- The node protected by the handler. The handler is examined if an
-- exception propagates to the outside of the node.
overriding procedure Enter_Element
(Self : not null access constant UML_Exception_Handler_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_Exception_Handler_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_Exception_Handler_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_Exception_Handlers;
|
LiberatorUSA/GUCEF | Ada | 1,969 | adb | package body agar.gui.widget.combo is
package cbinds is
function allocate
(parent : widget_access_t;
flags : flags_t;
label : cs.chars_ptr) return combo_access_t;
pragma import (c, allocate, "AG_ComboNewS");
procedure size_hint
(combo : combo_access_t;
text : cs.chars_ptr;
items : c.int);
pragma import (c, size_hint, "AG_ComboSizeHint");
procedure size_hint_pixels
(combo : combo_access_t;
width : c.int;
height : c.int);
pragma import (c, size_hint_pixels, "AG_ComboSizeHintPixels");
procedure select_text
(combo : combo_access_t;
text : cs.chars_ptr);
pragma import (c, select_text, "AG_ComboSelectText");
end cbinds;
--
function allocate
(parent : widget_access_t;
flags : flags_t;
label : string) return combo_access_t
is
ca_text : aliased c.char_array := c.to_c (label);
begin
return cbinds.allocate
(parent => parent,
flags => flags,
label => cs.to_chars_ptr (ca_text'unchecked_access));
end allocate;
procedure size_hint
(combo : combo_access_t;
text : string;
items : integer)
is
ca_text : aliased c.char_array := c.to_c (text);
begin
cbinds.size_hint
(combo => combo,
text => cs.to_chars_ptr (ca_text'unchecked_access),
items => c.int (items));
end size_hint;
procedure size_hint_pixels
(combo : combo_access_t;
width : positive;
height : positive) is
begin
cbinds.size_hint_pixels
(combo => combo,
width => c.int (width),
height => c.int (height));
end size_hint_pixels;
procedure select_text
(combo : combo_access_t;
text : string) is
ca_text : aliased c.char_array := c.to_c (text);
begin
cbinds.select_text
(combo => combo,
text => cs.to_chars_ptr (ca_text'unchecked_access));
end select_text;
end agar.gui.widget.combo;
|
zhmu/ananas | Ada | 1,342 | adb | -- { dg-do run }
with Ada.Text_IO; use Ada.Text_IO;
with GNAT; use GNAT;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
procedure Dynhash1 is
procedure Destroy (Val : in out Integer) is null;
function Hash (Key : Integer) return Bucket_Range_Type is
begin
return Bucket_Range_Type (Key);
end Hash;
package Integer_Hash_Tables is new Dynamic_Hash_Tables
(Key_Type => Integer,
Value_Type => Integer,
No_Value => 0,
Expansion_Threshold => 1.3,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => "=",
Destroy_Value => Destroy,
Hash => Hash);
use Integer_Hash_Tables;
Siz : Natural;
T : Dynamic_Hash_Table;
begin
T := Create (8);
Put (T, 1, 1);
Put (T, 1, 2);
Put (T, 1, 3);
Siz := Size (T);
if Siz /= 1 then
Put_Line ("ERROR: Put: wrong size");
Put_Line ("expected: 1");
Put_Line ("got :" & Siz'Img);
end if;
Delete (T, 1);
Delete (T, 1);
Siz := Size (T);
if Siz /= 0 then
Put_Line ("ERROR: Delete: wrong size");
Put_Line ("expected: 0");
Put_Line ("got :" & Siz'Img);
end if;
Destroy (T);
end Dynhash1;
|
burratoo/Acton | Ada | 22,266 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . C --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
package body Interfaces.C is
-----------------------
-- Is_Nul_Terminated --
-----------------------
-- Case of char_array
function Is_Nul_Terminated (Item : char_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
-- Case of wchar_array
function Is_Nul_Terminated (Item : wchar_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = wide_nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
-- Case of char16_array
function Is_Nul_Terminated (Item : char16_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = char16_nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
-- Case of char32_array
function Is_Nul_Terminated (Item : char32_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = char32_nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
------------
-- To_Ada --
------------
-- Convert char to Character
function To_Ada (Item : char) return Character is
begin
return Character'Val (char'Pos (Item));
end To_Ada;
-- Convert char_array to String (function form)
-- function To_Ada
-- (Item : char_array;
-- Trim_Nul : Boolean := True) return String
-- is
-- Count : Natural;
-- From : size_t;
--
-- begin
-- if Trim_Nul then
-- From := Item'First;
--
-- loop
-- if From > Item'Last then
-- raise Terminator_Error;
-- elsif Item (From) = nul then
-- exit;
-- else
-- From := From + 1;
-- end if;
-- end loop;
--
-- Count := Natural (From - Item'First);
--
-- else
-- Count := Item'Length;
-- end if;
--
-- declare
-- R : String (1 .. Count);
--
-- begin
-- for J in R'Range loop
-- R (J) := To_Ada (Item (size_t (J) + (Item'First - 1)));
-- end loop;
--
-- return R;
-- end;
-- end To_Ada;
-- Convert char_array to String (procedure form)
procedure To_Ada
(Item : char_array;
Target : out String;
Count : out Natural;
Trim_Nul : Boolean := True)
is
From : size_t;
To : Positive;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = nul then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
if Count > Target'Length then
raise Constraint_Error;
else
From := Item'First;
To := Target'First;
for J in 1 .. Count loop
Target (To) := Character (Item (From));
From := From + 1;
To := To + 1;
end loop;
end if;
end To_Ada;
-- Convert wchar_t to Wide_Character
function To_Ada (Item : wchar_t) return Wide_Character is
begin
return Wide_Character (Item);
end To_Ada;
-- Convert wchar_array to Wide_String (function form)
-- function To_Ada
-- (Item : wchar_array;
-- Trim_Nul : Boolean := True) return Wide_String
-- is
-- Count : Natural;
-- From : size_t;
--
-- begin
-- if Trim_Nul then
-- From := Item'First;
--
-- loop
-- if From > Item'Last then
-- raise Terminator_Error;
-- elsif Item (From) = wide_nul then
-- exit;
-- else
-- From := From + 1;
-- end if;
-- end loop;
--
-- Count := Natural (From - Item'First);
--
-- else
-- Count := Item'Length;
-- end if;
--
-- declare
-- R : Wide_String (1 .. Count);
--
-- begin
-- for J in R'Range loop
-- R (J) := To_Ada (Item (size_t (J) + (Item'First - 1)));
-- end loop;
--
-- return R;
-- end;
-- end To_Ada;
-- Convert wchar_array to Wide_String (procedure form)
procedure To_Ada
(Item : wchar_array;
Target : out Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True)
is
From : size_t;
To : Positive;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = wide_nul then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
if Count > Target'Length then
raise Constraint_Error;
else
From := Item'First;
To := Target'First;
for J in 1 .. Count loop
Target (To) := To_Ada (Item (From));
From := From + 1;
To := To + 1;
end loop;
end if;
end To_Ada;
-- Convert char16_t to Wide_Character
function To_Ada (Item : char16_t) return Wide_Character is
begin
return Wide_Character'Val (char16_t'Pos (Item));
end To_Ada;
-- Convert char16_array to Wide_String (function form)
-- function To_Ada
-- (Item : char16_array;
-- Trim_Nul : Boolean := True) return Wide_String
-- is
-- Count : Natural;
-- From : size_t;
--
-- begin
-- if Trim_Nul then
-- From := Item'First;
--
-- loop
-- if From > Item'Last then
-- raise Terminator_Error;
-- elsif Item (From) = char16_t'Val (0) then
-- exit;
-- else
-- From := From + 1;
-- end if;
-- end loop;
--
-- Count := Natural (From - Item'First);
--
-- else
-- Count := Item'Length;
-- end if;
--
-- declare
-- R : Wide_String (1 .. Count);
--
-- begin
-- for J in R'Range loop
-- R (J) := To_Ada (Item (size_t (J) + (Item'First - 1)));
-- end loop;
--
-- return R;
-- end;
-- end To_Ada;
-- Convert char16_array to Wide_String (procedure form)
procedure To_Ada
(Item : char16_array;
Target : out Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True)
is
From : size_t;
To : Positive;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = char16_t'Val (0) then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
if Count > Target'Length then
raise Constraint_Error;
else
From := Item'First;
To := Target'First;
for J in 1 .. Count loop
Target (To) := To_Ada (Item (From));
From := From + 1;
To := To + 1;
end loop;
end if;
end To_Ada;
-- Convert char32_t to Wide_Wide_Character
function To_Ada (Item : char32_t) return Wide_Wide_Character is
begin
return Wide_Wide_Character'Val (char32_t'Pos (Item));
end To_Ada;
-- Convert char32_array to Wide_Wide_String (function form)
-- function To_Ada
-- (Item : char32_array;
-- Trim_Nul : Boolean := True) return Wide_Wide_String
-- is
-- Count : Natural;
-- From : size_t;
--
-- begin
-- if Trim_Nul then
-- From := Item'First;
--
-- loop
-- if From > Item'Last then
-- raise Terminator_Error;
-- elsif Item (From) = char32_t'Val (0) then
-- exit;
-- else
-- From := From + 1;
-- end if;
-- end loop;
--
-- Count := Natural (From - Item'First);
--
-- else
-- Count := Item'Length;
-- end if;
--
-- declare
-- R : Wide_Wide_String (1 .. Count);
--
-- begin
-- for J in R'Range loop
-- R (J) := To_Ada (Item (size_t (J) + (Item'First - 1)));
-- end loop;
--
-- return R;
-- end;
-- end To_Ada;
-- Convert char32_array to Wide_Wide_String (procedure form)
procedure To_Ada
(Item : char32_array;
Target : out Wide_Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True)
is
From : size_t;
To : Positive;
begin
if Trim_Nul then
From := Item'First;
loop
if From > Item'Last then
raise Terminator_Error;
elsif Item (From) = char32_t'Val (0) then
exit;
else
From := From + 1;
end if;
end loop;
Count := Natural (From - Item'First);
else
Count := Item'Length;
end if;
if Count > Target'Length then
raise Constraint_Error;
else
From := Item'First;
To := Target'First;
for J in 1 .. Count loop
Target (To) := To_Ada (Item (From));
From := From + 1;
To := To + 1;
end loop;
end if;
end To_Ada;
----------
-- To_C --
----------
-- Convert Character to char
function To_C (Item : Character) return char is
begin
return char'Val (Character'Pos (Item));
end To_C;
-- Convert String to char_array (function form)
-- function To_C
-- (Item : String;
-- Append_Nul : Boolean := True) return char_array
-- is
-- begin
-- if Append_Nul then
-- declare
-- R : char_array (0 .. Item'Length);
--
-- begin
-- for J in Item'Range loop
-- R (size_t (J - Item'First)) := To_C (Item (J));
-- end loop;
--
-- R (R'Last) := nul;
-- return R;
-- end;
--
-- -- Append_Nul False
--
-- else
-- -- A nasty case, if the string is null, we must return a null
-- -- char_array. The lower bound of this array is required to be zero
-- -- (RM B.3(50)) but that is of course impossible given that size_t
-- -- is unsigned. According to Ada 2005 AI-258, the result is to raise
-- -- Constraint_Error. This is also the appropriate behavior in Ada 95,
-- -- since nothing else makes sense.
--
-- if Item'Length = 0 then
-- raise Constraint_Error;
--
-- -- Normal case
--
-- else
-- declare
-- R : char_array (0 .. Item'Length - 1);
--
-- begin
-- for J in Item'Range loop
-- R (size_t (J - Item'First)) := To_C (Item (J));
-- end loop;
--
-- return R;
-- end;
-- end if;
-- end if;
-- end To_C;
-- Convert String to char_array (procedure form)
procedure To_C
(Item : String;
Target : out char_array;
Count : out size_t;
Append_Nul : Boolean := True)
is
To : size_t;
begin
if Target'Length < Item'Length then
raise Constraint_Error;
else
To := Target'First;
for From in Item'Range loop
Target (To) := char (Item (From));
To := To + 1;
end loop;
if Append_Nul then
if To > Target'Last then
raise Constraint_Error;
else
Target (To) := nul;
Count := Item'Length + 1;
end if;
else
Count := Item'Length;
end if;
end if;
end To_C;
-- Convert Wide_Character to wchar_t
function To_C (Item : Wide_Character) return wchar_t is
begin
return wchar_t (Item);
end To_C;
-- Convert Wide_String to wchar_array (function form)
-- function To_C
-- (Item : Wide_String;
-- Append_Nul : Boolean := True) return wchar_array
-- is
-- begin
-- if Append_Nul then
-- declare
-- R : wchar_array (0 .. Item'Length);
--
-- begin
-- for J in Item'Range loop
-- R (size_t (J - Item'First)) := To_C (Item (J));
-- end loop;
--
-- R (R'Last) := wide_nul;
-- return R;
-- end;
--
-- else
-- -- A nasty case, if the string is null, we must return a null
-- -- wchar_array. The lower bound of this array is required to be zero
-- -- (RM B.3(50)) but that is of course impossible given that size_t
-- -- is unsigned. According to Ada 2005 AI-258, the result is to raise
-- -- Constraint_Error. This is also the appropriate behavior in Ada 95,
-- -- since nothing else makes sense.
--
-- if Item'Length = 0 then
-- raise Constraint_Error;
--
-- else
-- declare
-- R : wchar_array (0 .. Item'Length - 1);
--
-- begin
-- for J in size_t range 0 .. Item'Length - 1 loop
-- R (J) := To_C (Item (Integer (J) + Item'First));
-- end loop;
--
-- return R;
-- end;
-- end if;
-- end if;
-- end To_C;
-- Convert Wide_String to wchar_array (procedure form)
procedure To_C
(Item : Wide_String;
Target : out wchar_array;
Count : out size_t;
Append_Nul : Boolean := True)
is
To : size_t;
begin
if Target'Length < Item'Length then
raise Constraint_Error;
else
To := Target'First;
for From in Item'Range loop
Target (To) := To_C (Item (From));
To := To + 1;
end loop;
if Append_Nul then
if To > Target'Last then
raise Constraint_Error;
else
Target (To) := wide_nul;
Count := Item'Length + 1;
end if;
else
Count := Item'Length;
end if;
end if;
end To_C;
-- Convert Wide_Character to char16_t
function To_C (Item : Wide_Character) return char16_t is
begin
return char16_t'Val (Wide_Character'Pos (Item));
end To_C;
-- Convert Wide_String to char16_array (function form)
-- function To_C
-- (Item : Wide_String;
-- Append_Nul : Boolean := True) return char16_array
-- is
-- begin
-- if Append_Nul then
-- declare
-- R : char16_array (0 .. Item'Length);
--
-- begin
-- for J in Item'Range loop
-- R (size_t (J - Item'First)) := To_C (Item (J));
-- end loop;
--
-- R (R'Last) := char16_t'Val (0);
-- return R;
-- end;
--
-- else
-- -- A nasty case, if the string is null, we must return a null
-- -- char16_array. The lower bound of this array is required to be zero
-- -- (RM B.3(50)) but that is of course impossible given that size_t
-- -- is unsigned. According to Ada 2005 AI-258, the result is to raise
-- -- Constraint_Error. This is also the appropriate behavior in Ada 95,
-- -- since nothing else makes sense.
--
-- if Item'Length = 0 then
-- raise Constraint_Error;
--
-- else
-- declare
-- R : char16_array (0 .. Item'Length - 1);
--
-- begin
-- for J in size_t range 0 .. Item'Length - 1 loop
-- R (J) := To_C (Item (Integer (J) + Item'First));
-- end loop;
--
-- return R;
-- end;
-- end if;
-- end if;
-- end To_C;
-- Convert Wide_String to char16_array (procedure form)
procedure To_C
(Item : Wide_String;
Target : out char16_array;
Count : out size_t;
Append_Nul : Boolean := True)
is
To : size_t;
begin
if Target'Length < Item'Length then
raise Constraint_Error;
else
To := Target'First;
for From in Item'Range loop
Target (To) := To_C (Item (From));
To := To + 1;
end loop;
if Append_Nul then
if To > Target'Last then
raise Constraint_Error;
else
Target (To) := char16_t'Val (0);
Count := Item'Length + 1;
end if;
else
Count := Item'Length;
end if;
end if;
end To_C;
-- Convert Wide_Character to char32_t
function To_C (Item : Wide_Wide_Character) return char32_t is
begin
return char32_t'Val (Wide_Wide_Character'Pos (Item));
end To_C;
-- Convert Wide_Wide_String to char32_array (function form)
-- function To_C
-- (Item : Wide_Wide_String;
-- Append_Nul : Boolean := True) return char32_array
-- is
-- begin
-- if Append_Nul then
-- declare
-- R : char32_array (0 .. Item'Length);
--
-- begin
-- for J in Item'Range loop
-- R (size_t (J - Item'First)) := To_C (Item (J));
-- end loop;
--
-- R (R'Last) := char32_t'Val (0);
-- return R;
-- end;
--
-- else
-- -- A nasty case, if the string is null, we must return a null
-- -- char32_array. The lower bound of this array is required to be zero
-- -- (RM B.3(50)) but that is of course impossible given that size_t
-- -- is unsigned. According to Ada 2005 AI-258, the result is to raise
-- -- Constraint_Error.
--
-- if Item'Length = 0 then
-- raise Constraint_Error;
--
-- else
-- declare
-- R : char32_array (0 .. Item'Length - 1);
--
-- begin
-- for J in size_t range 0 .. Item'Length - 1 loop
-- R (J) := To_C (Item (Integer (J) + Item'First));
-- end loop;
--
-- return R;
-- end;
-- end if;
-- end if;
-- end To_C;
-- Convert Wide_Wide_String to char32_array (procedure form)
procedure To_C
(Item : Wide_Wide_String;
Target : out char32_array;
Count : out size_t;
Append_Nul : Boolean := True)
is
To : size_t;
begin
if Target'Length < Item'Length then
raise Constraint_Error;
else
To := Target'First;
for From in Item'Range loop
Target (To) := To_C (Item (From));
To := To + 1;
end loop;
if Append_Nul then
if To > Target'Last then
raise Constraint_Error;
else
Target (To) := char32_t'Val (0);
Count := Item'Length + 1;
end if;
else
Count := Item'Length;
end if;
end if;
end To_C;
end Interfaces.C;
|
reznikmm/matreshka | Ada | 4,568 | 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_Style.Name_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Name_Attribute_Node is
begin
return Self : Style_Name_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Name_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Name_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Name_Attribute,
Style_Name_Attribute_Node'Tag);
end Matreshka.ODF_Style.Name_Attributes;
|
tum-ei-rcs/StratoX | Ada | 114 | adb | with p4;
with Assume_Call;
procedure Main with SPARK_Mode is
begin
--Assume_Call.Caller;
p4.foo;
end Main;
|
elisboa/freebsd-ports | Ada | 2,906 | adb | --- src/anet-sockets-inet.adb.orig 2016-06-29 10:26:01 UTC
+++ src/anet-sockets-inet.adb
@@ -52,7 +52,7 @@ package body Anet.Sockets.Inet is
Res : C.int;
Sock : Thin.Inet.Sockaddr_In_Type
(Family => Socket_Families.Family_Inet);
- Len : aliased C.int := Sock'Size / 8;
+ Len : aliased C.int := Thin.Inet.Sockaddr_In_Size;
begin
New_Socket.Sock_FD := -1;
@@ -80,7 +80,7 @@ package body Anet.Sockets.Inet is
Res : C.int;
Sock : Thin.Inet.Sockaddr_In_Type
(Family => Socket_Families.Family_Inet6);
- Len : aliased C.int := Sock'Size / 8;
+ Len : aliased C.int := Thin.Inet.Sockaddr_In6_Size;
begin
New_Socket.Sock_FD := -1;
@@ -129,7 +129,7 @@ package body Anet.Sockets.Inet is
(Result => Thin.C_Bind
(S => Socket.Sock_FD,
Name => Sockaddr'Address,
- Namelen => Sockaddr'Size / 8),
+ Namelen => Thin.Inet.Sockaddr_In_Size),
Message => "Unable to bind IPv4 socket to " & To_String
(Address => Address) & "," & Port'Img);
end Bind;
@@ -153,7 +153,7 @@ package body Anet.Sockets.Inet is
(Result => Thin.C_Bind
(S => Socket.Sock_FD,
Name => Sockaddr'Address,
- Namelen => Sockaddr'Size / 8),
+ Namelen => Thin.Inet.Sockaddr_In6_Size),
Message => "Unable to bind IPv6 socket to " & To_String
(Address => Address) & "," & Port'Img);
end Bind;
@@ -173,7 +173,7 @@ package body Anet.Sockets.Inet is
(Result => Thin.C_Connect
(S => Socket.Sock_FD,
Name => Dst'Address,
- Namelen => Dst'Size / 8),
+ Namelen => Thin.Inet.Sockaddr_In_Size),
Message => "Unable to connect socket to address " & To_String
(Address => Address) & " (" & Port'Img & " )");
end Connect;
@@ -193,7 +193,7 @@ package body Anet.Sockets.Inet is
(Result => Thin.C_Connect
(S => Socket.Sock_FD,
Name => Dst'Address,
- Namelen => Dst'Size / 8),
+ Namelen => Thin.Inet.Sockaddr_In6_Size),
Message => "Unable to connect socket to address " & To_String
(Address => Address) & " (" & Port'Img & " )");
end Connect;
@@ -432,7 +432,7 @@ package body Anet.Sockets.Inet is
Len => Item'Length,
Flags => 0,
To => Dst'Address,
- Tolen => Dst'Size / 8);
+ Tolen => Thin.Inet.Sockaddr_In_Size);
Errno.Check_Or_Raise
(Result => C.int (Res),
@@ -464,7 +464,7 @@ package body Anet.Sockets.Inet is
Len => Item'Length,
Flags => 0,
To => Dst'Address,
- Tolen => Dst'Size / 8);
+ Tolen => Thin.Inet.Sockaddr_In6_Size);
Errno.Check_Or_Raise
(Result => C.int (Res),
|
damaki/libkeccak | Ada | 2,055 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2016, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with AUnit.Test_Fixtures;
package Util_Tests
is
type Test is new AUnit.Test_Fixtures.Test_Fixture with null record;
overriding
procedure Set_Up (T : in out Test);
procedure Test_Left_Encode_Bit_Length_Equivalence (T : in out Test);
procedure Test_Right_Encode_Bit_Length_Equivalence (T : in out Test);
end Util_Tests;
|
wildeee/safADA | Ada | 1,706 | adb | With Ada.Text_IO; Use Ada.Text_IO;
Procedure Determinante is
type Real_Matrix is array (Integer range <>, Integer range <>) of Integer'Base;
matriz: Real_Matrix(1..3, 1..3);
diagonalPrincipal1: Integer;
diagonalPrincipal2: Integer;
diagonalPrincipal3: Integer;
diagonalPrincipalSoma: Integer;
diagonalSecundaria1: Integer;
diagonalSecundaria2: Integer;
diagonalSecundaria3: Integer;
diagonalSecundariaSoma: Integer;
det : Integer;
-- Leitura String
function Get_String return String is
Line : String (1 .. 1_000);
Last : Natural;
begin
Get_Line (Line, Last);
return Line (1 .. Last);
end Get_String;
-- Leitura Integer
function Get_Integer return Integer is
S : constant String := Get_String;
begin
return Integer'Value (S);
end Get_Integer;
-- Lê 15 elementos do array
procedure Faz_Leitura is
begin
for L in Integer range 1 .. 3 loop
for C in Integer range 1 .. 3 loop
matriz(L, C) := Get_Integer;
end loop;
end loop;
end Faz_Leitura;
begin
Faz_Leitura;
diagonalPrincipal1 := matriz(1, 1) * matriz(2, 2) * matriz(3, 3);
diagonalPrincipal2 := matriz(1, 2) * matriz(2, 3) * matriz(3, 1);
diagonalPrincipal3 := matriz(1, 3) * matriz(2, 1) * matriz(3, 2);
diagonalSecundaria1 := matriz(1, 3) * matriz(2, 2) * matriz(3, 1);
diagonalSecundaria2 := matriz(1, 1) * matriz(2, 3) * matriz(3, 2);
diagonalSecundaria3 := matriz(1, 2) * matriz(2, 1) * matriz(3, 3);
diagonalPrincipalSoma := diagonalPrincipal1 + diagonalPrincipal2 + diagonalPrincipal3;
diagonalSecundariaSoma := diagonalSecundaria1 + diagonalSecundaria2 + diagonalSecundaria3;
det := diagonalPrincipalSoma - diagonalSecundariaSoma;
Put_Line(Integer'Image(det));
end Determinante; |
godunko/adawebpack | Ada | 2,973 | ads | ------------------------------------------------------------------------------
-- --
-- AdaWebPack --
-- --
------------------------------------------------------------------------------
-- Copyright © 2020, Vadim Godunko --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
------------------------------------------------------------------------------
with Web.HTML.Elements;
with Web.Strings;
package Web.HTML.Images is
pragma Preelaborate;
type HTML_Image_Element is
new Web.HTML.Elements.HTML_Element with null record;
end Web.HTML.Images;
|
reznikmm/matreshka | Ada | 5,805 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.XML_Schema.Visitors;
package body Matreshka.XML_Schema.AST.Attribute_Declarations is
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Attribute_Declaration_Node;
Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class;
Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control) is
begin
Visitor.Enter_Attribute_Declaration
(Matreshka.XML_Schema.AST.Attribute_Declaration_Access (Self), Control);
end Enter_Node;
--------------
-- Get_Name --
--------------
overriding function Get_Name
(Self : not null access Attribute_Declaration_Node)
return League.Strings.Universal_String is
begin
return Self.Name;
end Get_Name;
--------------------------
-- Get_Target_Namespace --
--------------------------
overriding function Get_Target_Namespace
(Self : not null access Attribute_Declaration_Node)
return League.Strings.Universal_String is
begin
return Self.Target_Namespace;
end Get_Target_Namespace;
--------------
-- Get_Type --
--------------
overriding function Get_Type
(Self : not null access Attribute_Declaration_Node)
return XML.Schema.Component_Type
is
pragma Unreferenced (Self);
begin
return XML.Schema.Attribute_Declaration;
end Get_Type;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Attribute_Declaration_Node;
Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class;
Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control) is
begin
Visitor.Leave_Attribute_Declaration
(Matreshka.XML_Schema.AST.Attribute_Declaration_Access (Self), Control);
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Attribute_Declaration_Node;
Iterator : in out Matreshka.XML_Schema.Visitors.Abstract_Iterator'Class;
Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class;
Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control) is
begin
Iterator.Visit_Attribute_Declaration
(Visitor, Matreshka.XML_Schema.AST.Attribute_Declaration_Access (Self), Control);
end Visit_Node;
end Matreshka.XML_Schema.AST.Attribute_Declarations;
|
afrl-rq/OpenUxAS | Ada | 30,831 | ads | with Ada.Containers.Formal_Hashed_Maps;
with Ada.Containers.Formal_Hashed_Sets;
with Ada.Containers.Formal_Ordered_Maps;
with Ada.Containers.Functional_Maps;
with Ada.Containers.Functional_Vectors;
with Ada.Containers; use Ada.Containers;
with Common; use Common;
with LMCP_Messages; use LMCP_Messages;
with Route_Aggregator_Communication; use Route_Aggregator_Communication;
package Route_Aggregator with SPARK_Mode is
pragma Unevaluated_Use_Of_Old (Allow);
pragma Assertion_Policy (Ignore);
-- Configuration data is separated from the service state as it is not
-- handled by the same primitives. We use functional containers, as it is
-- not supposed to be modified often.
package ES_Maps is new Ada.Containers.Functional_Maps
(Key_Type => Int64,
Element_Type => EntityState);
use ES_Maps;
subtype EntityState_Map is ES_Maps.Map
with Predicate =>
(for all Id of EntityState_Map => (Id = Get (EntityState_Map, Id).Id));
type Route_Aggregator_Configuration_Data is record
m_entityStates : Int64_Seq;
m_entityStatesInfo : EntityState_Map;
m_airVehicles : Int64_Set;
m_groundVehicles : Int64_Set;
m_surfaceVehicles : Int64_Set;
m_fastPlan : Boolean;
end record
with Predicate =>
(for all Id of m_entityStates => Contains (m_airVehicles, Id)
or else Contains (m_groundVehicles, Id)
or else Contains (m_surfaceVehicles, Id))
and then
(for all Id of m_entityStatesInfo =>
(Contains (m_entityStates, Int64_Sequences.First, Last (m_entityStates), Id)));
package Int64_Formal_Sets is new Ada.Containers.Formal_Hashed_Sets
(Element_Type => Int64,
Hash => Int64_Hash);
use Int64_Formal_Sets;
use Int64_Formal_Sets.Formal_Model;
package Int_Set_P renames Int64_Formal_Sets.Formal_Model.P;
package Int_Set_E renames Int64_Formal_Sets.Formal_Model.E;
package Int_Set_M renames Int64_Formal_Sets.Formal_Model.M;
subtype Int64_Formal_Set is Int64_Formal_Sets.Set
(200, Int64_Formal_Sets.Default_Modulus (200));
-- Use ordered maps so that we can modify the container during iteration
package Int64_Formal_Set_Maps is new Ada.Containers.Formal_Ordered_Maps
(Key_Type => Int64,
Element_Type => Int64_Formal_Set);
use Int64_Formal_Set_Maps;
use Int64_Formal_Set_Maps.Formal_Model;
package Int_Set_Maps_P renames Int64_Formal_Set_Maps.Formal_Model.P;
package Int_Set_Maps_K renames Int64_Formal_Set_Maps.Formal_Model.K;
package Int_Set_Maps_M is new Ada.Containers.Functional_Maps
(Int64, Int64_Set);
use type Int_Set_Maps_M.Map;
subtype Int64_Formal_Set_Map is Int64_Formal_Set_Maps.Map (200);
function Same_Mappings
(M : Int64_Formal_Set_Maps.Formal_Model.M.Map;
N : Int_Set_Maps_M.Map)
return Boolean
with Ghost,
Annotate => (GNATprove, Inline_For_Proof);
-- The two structures contain the same mappings
function Model (M : Int64_Formal_Set_Map) return Int_Set_Maps_M.Map with
Post => Same_Mappings
(Int64_Formal_Set_Maps.Formal_Model.Model (M), Model'Result);
-- Redefine the model of a map of formal sets to be a map of functional
-- sets to ease formal verification.
-- Model cannot be ghost as it is used in a type predicate.
package Int64_RouteResponse_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => RoutePlanResponse,
Hash => Int64_Hash);
use Int64_RouteResponse_Maps;
use Int64_RouteResponse_Maps.Formal_Model;
package RR_Maps_M renames Int64_RouteResponse_Maps.Formal_Model.M;
subtype Int64_RouteResponse_Map is Int64_RouteResponse_Maps.Map
(200, Int64_RouteResponse_Maps.Default_Modulus (200))
with Predicate =>
(for all K of Int64_RouteResponse_Map =>
Element (Int64_RouteResponse_Map, K).ResponseID = K);
type IdPlanPair is record
Id : Int64;
Plan : RoutePlan;
Cost : Int64 := -1;
end record;
package Int64_IdPlanPair_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => IdPlanPair,
Hash => Int64_Hash);
use Int64_IdPlanPair_Maps;
use Int64_IdPlanPair_Maps.Formal_Model;
subtype Int64_IdPlanPair_Map is Int64_IdPlanPair_Maps.Map
(200, Int64_IdPlanPair_Maps.Default_Modulus (200))
with Predicate =>
(for all K of Int64_IdPlanPair_Map =>
Element (Int64_IdPlanPair_Map, K).Plan.RouteID = K);
-- State of the service is modified more often, data can be removed as
-- well has added. Use formal containers for efficiency.
function No_Overlaps (pendingRoute : Int_Set_Maps_M.Map) return Boolean;
function No_Overlaps (pendingRoute, pendingAutoReq : Int_Set_Maps_M.Map) return Boolean;
function All_Pending_Requests_Seen
(pendingRequest : Int_Set_Maps_M.Map;
routeRequestId : Int64)
return Boolean;
package UAR_Maps is new Ada.Containers.Formal_Ordered_Maps
(Key_Type => Int64,
Element_Type => UniqueAutomationRequest);
use UAR_Maps;
subtype Int64_UniqueAutomationRequest_Map is UAR_Maps.Map (200);
type TaskOptionPair is record
vehicleId : Int64 := 0;
prevTaskId : Int64 := 0;
prevTaskOption : Int64 := 0;
taskId : Int64 := 0;
taskOption : Int64 := 0;
end record;
package Int64_TaskOptionPair_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => TaskOptionPair,
Hash => Int64_Hash);
use Int64_TaskOptionPair_Maps;
subtype Int64_TaskOptionPair_Map is Int64_TaskOptionPair_Maps.Map (200, Int64_TaskOptionPair_Maps.Default_Modulus (200));
package Int64_TaskPlanOptions_Maps is new Ada.Containers.Formal_Hashed_Maps
(Key_Type => Int64,
Element_Type => TaskPlanOptions,
Hash => Int64_Hash);
use Int64_TaskPlanOptions_Maps;
subtype Int64_TaskPlanOptions_Map is Int64_TaskPlanOptions_Maps.Map
(200, Int64_TaskPlanOptions_Maps.Default_Modulus (200));
package RPReq_Sequences is new Ada.Containers.Functional_Vectors
(Index_Type => Positive,
Element_Type => RoutePlanRequest);
type RPReq_Seq is new RPReq_Sequences.Sequence;
type Route_Aggregator_State is record
-- Unique ID associated to a RoutePlanRequest
m_routeRequestId : Int64 := 1;
-- Unique ID associated to a RouteConstraint in a RoutePlanRequest
m_routeId : Int64 := 1000000;
-- Unique ID associated to a UniqueAutomationRequest
m_autoRequestId : Int64 := 1;
-- Set of route IDs that correspond to an original RouteRequest
m_pendingRoute : Int64_Formal_Set_Map;
-- Received RoutePlanResponses
m_routePlanResponses : Int64_RouteResponse_Map;
-- Individual RoutePlans contained in RoutePlanResponses
m_routePlans : Int64_IdPlanPair_Map;
-- Set of route IDs that correspond to an original UniqueAutomationRequest
m_pendingAutoReq : Int64_Formal_Set_Map;
-- Received UniqueAutomationRequests
m_uniqueAutomationRequests : Int64_UniqueAutomationRequest_Map;
-- Mapping from route ID to the corresponding task/option pair
m_routeTaskPairing : Int64_TaskOptionPair_Map;
-- Mapping from task ID to associated TaskplanOptions
m_taskOptions : Int64_TaskPlanOptions_Map;
end record
with Predicate =>
-- Pending routes plan requests are associated to a seen identifier
All_Pending_Requests_Seen (Model (m_pendingRoute), m_routeRequestId)
and All_Pending_Requests_Seen (Model (m_pendingAutoReq), m_routeRequestId)
-- Pending routes plan requests are associated to one route request
-- or one automation request only
and No_Overlaps (Model (m_pendingRoute))
and No_Overlaps (Model (m_pendingAutoReq))
and No_Overlaps (Model (m_pendingRoute), Model (m_pendingAutoReq))
-- Pending automation requests are associated to a received automation request
and (for all ReqID of m_pendingAutoReq => Contains (m_uniqueAutomationRequests, ReqID));
function Plan_To_Route (pendingRoute : Int64_Formal_Set_Map) return Int64_Map with
Ghost,
Pre => No_Overlaps (Model (pendingRoute)),
-- Map each plan request id to the corresponding route request
Post => (for all I of Model (pendingRoute) =>
(for all K of Int_Set_Maps_M.Get (Model (pendingRoute), I) =>
Has_Key (Plan_To_Route'Result, K)
and then Get (Plan_To_Route'Result, K) = I))
and then (for all I of Plan_To_Route'Result =>
Int_Set_Maps_M.Has_Key (Model (pendingRoute), Get (Plan_To_Route'Result, I))
and then Contains (Int_Set_Maps_M.Get (Model (pendingRoute), Get (Plan_To_Route'Result, I)), I));
-- Property of State
function All_Plans_Registered
(routePlanResponses : Int64_RouteResponse_Map;
routePlans : Int64_IdPlanPair_Map)
return Boolean
with Ghost;
-- All plans associated to pending route plan responses are registered
function Only_Pending_Plans
(routePlanResponses : Int64_RouteResponse_Map;
routePlans : Int64_IdPlanPair_Map)
return Boolean
with Ghost;
-- All plans are associated to a pending route plan response.
-- Plans are stored in the route responses of the associated plan response.
function Valid_Plan_Responses
(pendingRoute : Int64_Formal_Set_Map;
pendingAutoReq : Int64_Formal_Set_Map;
routePlanResponses : Int64_RouteResponse_Map)
return Boolean
with Ghost,
Pre => No_Overlaps (Model (pendingRoute)) and then No_Overlaps (Model (pendingAutoReq));
-- We only have route plan responses associated to pending routes or
-- pending automation requests.
function Is_Pending
(pendingRoute : Int_Set_Maps_M.Map;
routePlanResponses : RR_Maps_M.Map;
Request_Id : Int64)
return Boolean
with Ghost,
Pre => Int_Set_Maps_M.Has_Key (pendingRoute, Request_Id);
-- True iff we are still waiting for some route plan response for Id
function No_Finished_Request
(pendingRoute, pendingAutoReq : Int64_Formal_Set_Map;
routePlanResponses : Int64_RouteResponse_Map)
return Boolean
with Ghost;
-- We only have pending requests in m_pendingRequest
package Message_History with
Ghost,
Annotate => (GNATprove, Terminating)
is
type Event_Kind is
(Receive_RouteRequest, Send_PlanRequest, Receive_PlanResponse, Send_RouteResponse);
type Event is record
Kind : Event_Kind;
Id : Int64;
end record;
package Event_Sequences is new Ada.Containers.Functional_Vectors
(Index_Type => Positive,
Element_Type => Event);
type History_Type is new Event_Sequences.Sequence;
-- At the moment, History only stores message exchanges related to
-- a received RouteRequest. In the future, this needs to be extended
-- to AutomationRequests.
History : History_Type;
function Valid_Events (routeRequestId : Int64) return Boolean;
-- All pln ids in history are smaller than routeRequestId
function RouteResponse_Sent (Id : Int64) return Boolean;
-- A route response was sent for this Id
function PlanRequest_Sent (Id : Int64) return Boolean;
-- A plan request was sent for this Id
function No_RouteRequest_Lost (pendingRoute : Int64_Formal_Set_Map) return Boolean;
-- All received route requests are either pending or answered
function No_PlanResponse_Lost
(pendingRoute : Int64_Formal_Set_Map;
routePlanResponses : Int64_RouteResponse_Map)
return Boolean
is
(for all E of History =>
(if E.Kind = Receive_PlanResponse
and Has_Key (Plan_To_Route (pendingRoute), E.Id)
then Contains (routePlanResponses, E.Id)))
with Pre => No_Overlaps (Model (pendingRoute));
-- All received plan responses are stored
function PlanRequest_Processed
(routePlanResponses : Int64_RouteResponse_Map;
Id : Int64) return Boolean
is
(Contains (routePlanResponses, Id)
or else PlanRequest_Sent (Id));
function All_Pending_Plans_Sent
(pendingRoute : Int64_Formal_Set_Map;
routePlanResponses : Int64_RouteResponse_Map)
return Boolean
is
(for all Id of Plan_To_Route (pendingRoute) =>
PlanRequest_Processed (routePlanResponses, Id))
with Pre => No_Overlaps (Model (pendingRoute));
-- All plan requests associated to pending route request are either
-- answered or sent (they are not all sent as some might go through
-- fast planning).
private
function Valid_Events (routeRequestId : Int64) return Boolean is
(for all E of History =>
(if E.Kind in Send_PlanRequest | Receive_PlanResponse then
E.Id <= routeRequestId));
function RouteResponse_Sent (Id : Int64) return Boolean is
(for some E of History =>
E.Kind = Send_RouteResponse and then E.Id = Id);
function PlanRequest_Sent (Id : Int64) return Boolean is
(for some E of History =>
E.Kind = Send_PlanRequest and then E.Id = Id);
function No_RouteRequest_Lost (pendingRoute : Int64_Formal_Set_Map) return Boolean is
(for all E of History =>
(if E.Kind = Receive_RouteRequest then
Contains (pendingRoute, E.Id)
or else RouteResponse_Sent (E.Id)));
end Message_History;
use Message_History;
-- Service functionality
procedure Euclidean_Plan
(Data : Route_Aggregator_Configuration_Data;
routePlanResponses : in out Int64_RouteResponse_Map;
routePlans : in out Int64_IdPlanPair_Map;
Request : RoutePlanRequest)
with
-- Import,
Global => null,
Pre => not Contains (routePlanResponses, Request.RequestID)
and All_Plans_Registered (routePlanResponses, routePlans)
and Only_Pending_Plans (routePlanResponses, routePlans),
Post => Contains (routePlanResponses, Request.RequestID)
and Model (routePlanResponses)'Old <= Model (routePlanResponses)
and RR_Maps_M.Keys_Included_Except (Model (routePlanResponses),
Model (routePlanResponses)'Old,
Request.RequestID)
and All_Plans_Registered (routePlanResponses, routePlans)
and Only_Pending_Plans (routePlanResponses, routePlans); -- Not true in C implementation!
-- Stub, TBD
procedure Handle_Route_Plan_Response
(Mailbox : in out Route_Aggregator_Mailbox;
State : in out Route_Aggregator_State;
Response : RoutePlanResponse)
with
Pre =>
-- The response is expected
(Has_Key (Plan_To_Route (State.m_pendingRoute), Response.ResponseID)
or Has_Key (Plan_To_Route (State.m_pendingAutoReq), Response.ResponseID))
-- The response was not already received
and not Contains (State.m_routePlanResponses, Response.ResponseID)
-- Plans associated to Response are new
and (for all Pl of Response.RouteResponses =>
not Contains (State.m_routePlans, Pl.RouteID))
-- General invariants
and All_Plans_Registered (State.m_routePlanResponses, State.m_routePlans)
and Only_Pending_Plans (State.m_routePlanResponses, State.m_routePlans)
and Valid_Plan_Responses (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
and No_Finished_Request (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
-- History invariants
and Valid_Events (State.m_routeRequestId)
and No_RouteRequest_Lost (State.m_pendingRoute)
and No_PlanResponse_Lost (State.m_pendingRoute, State.m_routePlanResponses)
and All_Pending_Plans_Sent (State.m_pendingRoute, State.m_routePlanResponses),
-- General invariants
Post =>
All_Plans_Registered (State.m_routePlanResponses, State.m_routePlans)
and Only_Pending_Plans (State.m_routePlanResponses, State.m_routePlans)
and Valid_Plan_Responses (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
and No_Finished_Request (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
-- The response has been added to the history
and History'Old < History
and Get (History, Last (History)'Old + 1).Kind = Receive_PlanResponse
and Get (History, Last (History)'Old + 1).Id = Response.ResponseID
-- History invariants
and Valid_Events (State.m_routeRequestId)
and No_RouteRequest_Lost (State.m_pendingRoute)
and No_PlanResponse_Lost (State.m_pendingRoute, State.m_routePlanResponses)
and All_Pending_Plans_Sent (State.m_pendingRoute, State.m_routePlanResponses);
procedure Handle_Task_Plan_Options
(Mailbox : in out Route_Aggregator_Mailbox;
Data : Route_Aggregator_Configuration_Data;
State : in out Route_Aggregator_State;
Options : TaskPlanOptions);
procedure Handle_Route_Request
(Data : Route_Aggregator_Configuration_Data;
Mailbox : in out Route_Aggregator_Mailbox;
State : in out Route_Aggregator_State;
Request : RouteRequest)
with
-- We have at least an entity registed in the service
Pre => Length (Data.m_entityStates) /= 0
-- The request id is fresh
and not Contains (State.m_pendingRoute, Request.RequestID)
-- The vehicules ids of the request are registered
and (for all V of Request.VehicleID =>
(for some V2 of Data.m_entityStates => V = V2))
-- General invariants
and All_Plans_Registered (State.m_routePlanResponses, State.m_routePlans)
and Only_Pending_Plans (State.m_routePlanResponses, State.m_routePlans)
and Valid_Plan_Responses (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
and No_Finished_Request (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
-- History invariants
and Valid_Events (State.m_routeRequestId)
and No_RouteRequest_Lost (State.m_pendingRoute)
and No_PlanResponse_Lost (State.m_pendingRoute, State.m_routePlanResponses)
and All_Pending_Plans_Sent (State.m_pendingRoute, State.m_routePlanResponses),
-- General invariants
Post => All_Plans_Registered (State.m_routePlanResponses, State.m_routePlans)
and Only_Pending_Plans (State.m_routePlanResponses, State.m_routePlans)
and Valid_Plan_Responses (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
and No_Finished_Request (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
-- The request has been added to the history
and History'Old < History
and Get (History, Last (History)'Old + 1).Kind = Receive_RouteRequest
and Get (History, Last (History)'Old + 1).Id = Request.RequestID
-- History invariants
and Valid_Events (State.m_routeRequestId)
and No_RouteRequest_Lost (State.m_pendingRoute)
and No_PlanResponse_Lost (State.m_pendingRoute, State.m_routePlanResponses)
and All_Pending_Plans_Sent (State.m_pendingRoute, State.m_routePlanResponses);
procedure Handle_Unique_Automation_Request
(Data : Route_Aggregator_Configuration_Data;
Mailbox : in out Route_Aggregator_Mailbox;
State : in out Route_Aggregator_State;
Areq : UniqueAutomationRequest)
with
Pre => State.m_autoRequestId < Int64'Last
and then not Contains (State.m_uniqueAutomationRequests, State.m_autoRequestId + 1)
and then Length (State.m_uniqueAutomationRequests) < State.m_uniqueAutomationRequests.Capacity;
procedure Check_All_Route_Plans
(Mailbox : in out Route_Aggregator_Mailbox;
State : in out Route_Aggregator_State)
with
-- General invariants
Pre => All_Plans_Registered (State.m_routePlanResponses, State.m_routePlans)
and Only_Pending_Plans (State.m_routePlanResponses, State.m_routePlans)
and Valid_Plan_Responses (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
-- History invariants
and Valid_Events (State.m_routeRequestId)
and No_RouteRequest_Lost (State.m_pendingRoute)
and No_PlanResponse_Lost (State.m_pendingRoute, State.m_routePlanResponses)
and All_Pending_Plans_Sent (State.m_pendingRoute, State.m_routePlanResponses),
-- General invariants
Post => All_Plans_Registered (State.m_routePlanResponses, State.m_routePlans)
and Only_Pending_Plans (State.m_routePlanResponses, State.m_routePlans)
and Valid_Plan_Responses (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
and No_Finished_Request (State.m_pendingRoute, State.m_pendingAutoReq, State.m_routePlanResponses)
-- History invariants
and History'Old <= History
and Valid_Events (State.m_routeRequestId)
and No_RouteRequest_Lost (State.m_pendingRoute)
and No_PlanResponse_Lost (State.m_pendingRoute, State.m_routePlanResponses)
and All_Pending_Plans_Sent (State.m_pendingRoute, State.m_routePlanResponses);
procedure SendRouteResponse
(Mailbox : in out Route_Aggregator_Mailbox;
pendingRoute : Int64_Formal_Set_Map;
pendingAutoReq : Int64_Formal_Set_Map;
routePlanResponses : in out Int64_RouteResponse_Map;
routePlans : in out Int64_IdPlanPair_Map;
routeKey : Int64)
with
Pre => Int_Set_Maps_M.Has_Key (Model (pendingRoute), routeKey)
-- Only send route response if all plans are received
and then (for all Id of Int_Set_Maps_M.Get (Model (pendingRoute), routeKey) =>
Contains (routePlanResponses, Id))
-- General invariants
and then No_Overlaps (Model (pendingRoute))
and then No_Overlaps (Model (pendingAutoReq))
and then No_Overlaps (Model (pendingRoute), Model (pendingAutoReq))
and then All_Plans_Registered (routePlanResponses, routePlans)
and then Only_Pending_Plans (routePlanResponses, routePlans)
and then Valid_Plan_Responses (pendingRoute, pendingAutoReq, routePlanResponses)
-- History invariants
and then No_RouteRequest_Lost (pendingRoute)
and then No_PlanResponse_Lost (pendingRoute, routePlanResponses)
and then All_Pending_Plans_Sent (pendingRoute, routePlanResponses),
-- Plan responses associated to routeKey have been removed
Post =>
(for all Id of Model (routePlanResponses) =>
Contains (Model (routePlanResponses)'Old, Id))
and (for all Id of Model (routePlanResponses) =>
not Contains (Element (pendingRoute, routeKey), Id))
and (for all Id of Model (routePlanResponses)'Old =>
(if not Contains (Element (pendingRoute, routeKey), Id) then
Contains (routePlanResponses, Id)))
-- General invariants
and All_Plans_Registered (routePlanResponses, routePlans)
and Only_Pending_Plans (routePlanResponses, routePlans)
and Valid_Plan_Responses (pendingRoute, pendingAutoReq, routePlanResponses)
-- The route response was sent
and History'Old < History
and Last (History) = Last (History)'Old + 1
and Get (History, Last (History)) = (Send_RouteResponse, routeKey)
-- History invariants
and No_RouteRequest_Lost (pendingRoute)
and
(for all E of History =>
(if E.Kind = Receive_PlanResponse
and then Has_Key (Plan_To_Route (pendingRoute), E.Id)
and then Get (Plan_To_Route (pendingRoute), E.Id) /= routeKey
then Contains (routePlanResponses, E.Id)))
and
(for all Id of Plan_To_Route (pendingRoute) =>
(if Get (Plan_To_Route (pendingRoute), Id) /= routeKey then
Contains (routePlanResponses, Id)
or else PlanRequest_Sent (Id)));
procedure Check_All_Task_Options_Received
(Mailbox : in out Route_Aggregator_Mailbox;
Data : Route_Aggregator_Configuration_Data;
State : in out Route_Aggregator_State);
procedure Build_Matrix_Requests
(Mailbox : in out Route_Aggregator_Mailbox;
Data : Route_Aggregator_Configuration_Data;
State : in out Route_Aggregator_State;
ReqId : Int64);
procedure SendMatrix
(Mailbox : in out Route_Aggregator_Mailbox;
m_uniqueAutomationRequests : Int64_UniqueAutomationRequest_Map;
m_pendingRoute : Int64_Formal_Set_Map;
m_pendingAutoReq : Int64_Formal_Set_Map;
m_routePlans : in out Int64_IdPlanPair_Map;
m_routeTaskPairing : in out Int64_TaskOptionPair_Map;
m_routePlanResponses : in out Int64_RouteResponse_Map;
m_taskOptions : in out Int64_TaskPlanOptions_Map;
autoKey : Int64)
with
Pre => Int_Set_Maps_M.Has_Key (Model (m_pendingAutoReq), autoKey)
and then Contains (m_uniqueAutomationRequests, autoKey)
and then No_Overlaps (Model (m_pendingRoute))
and then No_Overlaps (Model (m_pendingAutoReq))
and then No_Overlaps (Model (m_pendingRoute), Model (m_pendingAutoReq))
and then (for all Id of Int_Set_Maps_M.Get (Model (m_pendingAutoReq), autoKey) =>
Contains (m_routePlanResponses, Id))
and then All_Plans_Registered (m_routePlanResponses, m_routePlans)
and then Only_Pending_Plans (m_routePlanResponses, m_routePlans)
and then Valid_Plan_Responses (m_pendingRoute, m_pendingAutoReq, m_routePlanResponses)
-- History invariants
and then No_RouteRequest_Lost (m_pendingRoute)
and then No_PlanResponse_Lost (m_pendingRoute, m_routePlanResponses)
and then All_Pending_Plans_Sent (m_pendingRoute, m_routePlanResponses),
Post => (for all Id of Model (m_routePlanResponses) =>
Contains (Model (m_routePlanResponses)'Old, Id))
and (for all Id of Model (m_routePlanResponses) =>
not Contains (Element (m_pendingAutoReq, autoKey), Id))
and (for all Id of Model (m_routePlanResponses)'Old =>
(if not Contains (Element (m_pendingAutoReq, autoKey), Id) then
Contains (m_routePlanResponses, Id)))
-- General invariants
and All_Plans_Registered (m_routePlanResponses, m_routePlans)
and Only_Pending_Plans (m_routePlanResponses, m_routePlans)
and Valid_Plan_Responses (m_pendingRoute, m_pendingAutoReq, m_routePlanResponses)
-- History invariants
and No_PlanResponse_Lost (m_pendingRoute, m_routePlanResponses)
and All_Pending_Plans_Sent (m_pendingRoute, m_routePlanResponses);
private
function Same_Mappings
(M : Int64_Formal_Set_Maps.Formal_Model.M.Map;
N : Int_Set_Maps_M.Map)
return Boolean
is
((for all I of M => Int_Set_Maps_M.Has_Key (N, I))
and then (for all I of N => Contains (M, I))
and then
(for all I of N =>
(for all E of Int_Set_Maps_M.Get (N, I) =>
Contains (Element (M, I), E)))
and then
(for all I of N =>
(for all E of Element (M, I) =>
Contains (Int_Set_Maps_M.Get (N, I), E))));
function Disjoint (S1, S2 : Int64_Set) return Boolean is
(for all E of S1 => not Contains (S2, E));
function No_Overlaps (pendingRoute : Int_Set_Maps_M.Map) return Boolean is
(for all R_1 of pendingRoute =>
(for all R_2 of pendingRoute =>
(if R_1 /= R_2 then
Disjoint (Int_Set_Maps_M.Get (pendingRoute, R_1),
Int_Set_Maps_M.Get (pendingRoute, R_2)))));
function No_Overlaps (pendingRoute, pendingAutoReq : Int_Set_Maps_M.Map) return Boolean is
(for all R_1 of pendingRoute =>
(for all R_2 of pendingAutoReq =>
Disjoint (Int_Set_Maps_M.Get (pendingRoute, R_1),
Int_Set_Maps_M.Get (pendingAutoReq, R_2))));
function All_Pending_Requests_Seen
(pendingRequest : Int_Set_Maps_M.Map;
routeRequestId : Int64)
return Boolean
is
(for all R_Id of pendingRequest =>
(for all Id of Int_Set_Maps_M.Get (pendingRequest, R_Id) =>
Id <= routeRequestId));
function All_Plans_Registered
(routePlanResponses : Int64_RouteResponse_Map;
routePlans : Int64_IdPlanPair_Map)
return Boolean
is
(for all RP of Model (routePlanResponses) =>
(for all Pl of Element (routePlanResponses, RP).RouteResponses =>
Contains (routePlans, Pl.RouteID)
and then Element (routePlans, Pl.RouteID).Id = RP));
function Only_Pending_Plans
(routePlanResponses : Int64_RouteResponse_Map;
routePlans : Int64_IdPlanPair_Map)
return Boolean
is
(for all Pl of Model (routePlans) =>
(Contains (routePlanResponses, Element (routePlans, Pl).Id)
and then Contains (Element (routePlanResponses, Element (routePlans, Pl).Id).RouteResponses, Pl)));
function Valid_Plan_Responses
(pendingRoute : Int64_Formal_Set_Map;
pendingAutoReq : Int64_Formal_Set_Map;
routePlanResponses : Int64_RouteResponse_Map)
return Boolean
is
(for all RP of Model (routePlanResponses) =>
(Has_Key (Plan_To_Route (pendingRoute), RP)
or else Has_Key (Plan_To_Route (pendingAutoReq), RP)));
function Is_Pending
(pendingRoute : Int_Set_Maps_M.Map;
routePlanResponses : RR_Maps_M.Map;
Request_Id : Int64)
return Boolean
is
(for some RP of Int_Set_Maps_M.Get (pendingRoute, Request_Id) =>
not Contains (routePlanResponses, RP));
function No_Finished_Request
(pendingRoute, pendingAutoReq : Int64_Formal_Set_Map;
routePlanResponses : Int64_RouteResponse_Map)
return Boolean
is
((for all Id of Model (pendingRoute) =>
Is_Pending (Model (pendingRoute), Model (routePlanResponses), Id))
and then
(for all Id of Model (pendingAutoReq) =>
Is_Pending (Model (pendingAutoReq), Model (routePlanResponses), Id)));
end Route_Aggregator;
|
AdaCore/training_material | Ada | 2,280 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package avx512vbmivlintrin_h is
-- Copyright (C) 2013-2017 Free Software Foundation, Inc.
-- This file is part of GCC.
-- GCC 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, or (at your option)
-- any later version.
-- GCC 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.
-- 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/>.
-- skipped func _mm256_mask_multishift_epi64_epi8
-- skipped func _mm256_maskz_multishift_epi64_epi8
-- skipped func _mm256_multishift_epi64_epi8
-- skipped func _mm_mask_multishift_epi64_epi8
-- skipped func _mm_maskz_multishift_epi64_epi8
-- skipped func _mm_multishift_epi64_epi8
-- skipped func _mm256_permutexvar_epi8
-- skipped func _mm256_maskz_permutexvar_epi8
-- skipped func _mm256_mask_permutexvar_epi8
-- skipped func _mm_permutexvar_epi8
-- skipped func _mm_maskz_permutexvar_epi8
-- skipped func _mm_mask_permutexvar_epi8
-- skipped func _mm256_permutex2var_epi8
-- idx
-- skipped func _mm256_mask_permutex2var_epi8
-- idx
-- skipped func _mm256_mask2_permutex2var_epi8
-- idx
-- skipped func _mm256_maskz_permutex2var_epi8
-- idx
-- skipped func _mm_permutex2var_epi8
-- idx
-- skipped func _mm_mask_permutex2var_epi8
-- idx
-- skipped func _mm_mask2_permutex2var_epi8
-- idx
-- skipped func _mm_maskz_permutex2var_epi8
-- idx
end avx512vbmivlintrin_h;
|
AdaCore/training_material | Ada | 1,042 | adb | -- Which declaration(s) is(are) legal for this piece of code?
--$ begin question
procedure Main is
type Shape_Kind is (Circle, Line);
type Shape (Kind : Shape_Kind) is record
case Kind is
when Line =>
X, Y : Float;
X2, Y2 : Float;
when Circle =>
Radius : Float;
end case;
end record;
-- V and V2 declaration...
--$ end question
--$ begin cut
V : Shape := (Circle, others => 0.0)
V2 : Shape (Line);
-- Cannot assign with different discriminant
--$ end cut
--$ begin cut
V : Shape := (Kind => Circle, Radius => 0.0);
V2 : Shape (Circle);
-- OK
--$ end cut
--$ begin cut
V : Shape (Line) := (Kind => Circle, Radius => 0.0);
V2 : Shape (Circle);
-- ``V`` initial value has a different discriminant
--$ end cut
--$ begin cut
V : Shape;
V2 : Shape (Circle);
-- ``Shape`` cannot be mutable: ``V`` must have a discriminant
--$ end cut
--$ begin question
begin
V := V2;
--$ end question
end Main;
|
AdaCore/Ada_Drivers_Library | Ada | 6,640 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Based on ft6x06.h from MCD Application Team
with Ada.Unchecked_Conversion;
with STM32.Board; use STM32.Board;
with STM32.Device; use STM32.Device;
with STM32.I2C;
with STM32.GPIO; use STM32.GPIO;
with STM32.Setup;
with HAL.Touch_Panel; use HAL.Touch_Panel;
with Ada.Real_Time; use Ada.Real_Time;
with STM32.DMA; use STM32.DMA;
package body Touch_Panel_FT6x06 is
procedure Initialize_DMA;
procedure TP_Init_Pins;
-- Initializes the Touch Panel GPIO pins
---------------
-- Init_Pins --
---------------
procedure TP_Init_Pins
is
begin
Enable_Clock (TP_INT);
-- Configure_IO (TP_INT,
-- (Speed => Speed_50MHz,
-- Mode => Mode_In,
-- Output_Type => Open_Drain,
-- Resistors => Pull_Up));
Configure_IO (TP_INT,
(Mode => Mode_In,
Resistors => Pull_Up));
Lock (TP_INT);
end TP_Init_Pins;
--------------------
-- Initialize_DMA --
--------------------
procedure Initialize_DMA is
Config : DMA_Stream_Configuration;
begin
Enable_Clock (I2C_TX_RX_DMA);
-- TX and RX config --
Config.Increment_Peripheral_Address := False;
Config.Increment_Memory_Address := True;
Config.Peripheral_Data_Format := Bytes;
Config.Memory_Data_Format := Bytes;
Config.Operation_Mode := Normal_Mode;
Config.Priority := Priority_High;
Config.FIFO_Enabled := False;
Config.FIFO_Threshold := FIFO_Threshold_Full_Configuration;
Config.Memory_Burst_Size := Memory_Burst_Inc4;
Config.Peripheral_Burst_Size := Peripheral_Burst_Single;
-- TX DMA --
Config.Channel := I2C_TX_DMA_Chan;
Config.Direction := Memory_To_Peripheral;
Configure (I2C_TX_RX_DMA, I2C_TX_DMA_Stream, Config);
-- RX DMA --
Config.Channel := I2C_RX_DMA_Chan;
Config.Direction := Peripheral_To_Memory;
Configure (I2C_TX_RX_DMA, I2C_RX_DMA_Stream, Config);
end Initialize_DMA;
----------------
-- Initialize --
----------------
function Initialize
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation :=
HAL.Framebuffer.Default) return Boolean
is
begin
TP_Init_Pins;
delay until Clock + Milliseconds (200);
if not TP_I2C.Port_Enabled then
STM32.Setup.Setup_I2C_Master (Port => TP_I2C,
SDA => TP_I2C_SDA,
SCL => TP_I2C_SCL,
SDA_AF => TP_I2C_AF,
SCL_AF => TP_I2C_AF,
Clock_Speed => 100_000);
end if;
Initialize_DMA;
TP_I2C.Set_TX_DMA_Handler (I2C_TX_DMA_Int'Access);
TP_I2C.Set_RX_DMA_Handler (I2C_RX_DMA_Int'Access);
TP_I2C.Set_Polling_Threshold (0);
This.TP_Set_Use_Interrupts (False);
This.Set_Orientation (Orientation);
return This.Check_Id;
end Initialize;
----------------
-- Initialize --
----------------
procedure Initialize (This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation :=
HAL.Framebuffer.Default) is
begin
if not This.Initialize (Orientation) then
raise Constraint_Error with "Cannot initialize the touch panel";
end if;
end Initialize;
---------------------
-- Set_Orientation --
---------------------
procedure Set_Orientation
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation)
is
begin
case Orientation is
when HAL.Framebuffer.Default | HAL.Framebuffer.Landscape =>
This.Set_Bounds (LCD_Natural_Width,
LCD_Natural_Height,
Invert_Y);
when HAL.Framebuffer.Portrait =>
This.Set_Bounds (LCD_Natural_Width,
LCD_Natural_Height,
Swap_XY);
end case;
end Set_Orientation;
end Touch_Panel_FT6x06;
|
reznikmm/matreshka | Ada | 3,977 | 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.Text_Custom5_Attributes;
package Matreshka.ODF_Text.Custom5_Attributes is
type Text_Custom5_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Custom5_Attributes.ODF_Text_Custom5_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Custom5_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Custom5_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Custom5_Attributes;
|
stcarrez/dynamo | Ada | 5,634 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- W I D E C H A R --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Subprograms for manipulation of wide character sequences. Note that in
-- this package, wide character and wide wide character are not distinguished
-- since this package is basically concerned with syntactic notions, and it
-- deals with Char_Code values, rather than values of actual Ada types.
with Types; use Types;
package Widechar is
Wide_Char_Byte_Count : Nat := 0;
-- This value is incremented whenever Scan_Wide or Skip_Wide is called.
-- The amount added is the length of the wide character sequence minus
-- one. This means that the count that accumulates here represents the
-- difference between the length in characters and the length in bytes.
-- This is used for checking the line length in characters.
function Length_Wide return Nat;
-- Returns the maximum length in characters for the escape sequence that
-- is used to encode wide character literals outside the ASCII range. Used
-- only in the implementation of the attribute Width for Wide_Character
-- and Wide_Wide_Character.
procedure Scan_Wide
(S : Source_Buffer_Ptr;
P : in out Source_Ptr;
C : out Char_Code;
Err : out Boolean);
-- On entry S (P) points to the first character in the source text for
-- a wide character (i.e. to an ESC character, a left bracket, or an
-- upper half character, depending on the representation method). A
-- single wide character is scanned. If no error is found, the value
-- stored in C is the code for this wide character, P is updated past
-- the sequence and Err is set to False. If an error is found, then
-- P points to the improper character, C is undefined, and Err is
-- set to True.
procedure Set_Wide
(C : Char_Code;
S : in out String;
P : in out Natural);
-- The escape sequence (including any leading ESC character) for the
-- given character code is stored starting at S (P + 1), and on return
-- P points to the last stored character (i.e. P is the count of stored
-- characters on entry and exit, and the escape sequence is appended to
-- the end of the stored string). The character code C represents a code
-- originally constructed by Scan_Wide, so it is known to be in a range
-- that is appropriate for the encoding method in use.
procedure Skip_Wide (S : String; P : in out Natural);
-- On entry, S (P) points to an ESC character for a wide character escape
-- sequence or to an upper half character if the encoding method uses the
-- upper bit, or to a left bracket if the brackets encoding method is in
-- use. On exit, P is bumped past the wide character sequence. No error
-- checking is done, since this is only used on escape sequences generated
-- by Set_Wide, which are known to be correct.
procedure Skip_Wide (S : Source_Buffer_Ptr; P : in out Source_Ptr);
-- Similar to the above procedure, but operates on a source buffer
-- instead of a string, with P being a Source_Ptr referencing the
-- contents of the source buffer.
function Is_Start_Of_Wide_Char
(S : Source_Buffer_Ptr;
P : Source_Ptr) return Boolean;
-- Determines if S (P) is the start of a wide character sequence
end Widechar;
|
stcarrez/ada-wiki | Ada | 2,842 | ads | -----------------------------------------------------------------------
-- wiki-plugins-conditions -- Condition Plugin
-- Copyright (C) 2016, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Wiki.Strings;
-- === Conditions Plugins ===
-- The <b>Wiki.Plugins.Conditions</b> package defines a set of conditional plugins
-- to show or hide wiki content according to some conditions evaluated during the parsing phase.
--
package Wiki.Plugins.Conditions is
MAX_CONDITION_DEPTH : constant Natural := 31;
type Condition_Depth is new Natural range 0 .. MAX_CONDITION_DEPTH;
type Condition_Type is (CONDITION_IF, CONDITION_ELSIF, CONDITION_ELSE, CONDITION_END);
type Condition_Plugin is new Wiki_Plugin with private;
-- Evaluate the condition and return it as a boolean status.
function Evaluate (Plugin : in Condition_Plugin;
Params : in Wiki.Attributes.Attribute_List) return Boolean;
-- Get the type of condition (IF, ELSE, ELSIF, END) represented by the plugin.
function Get_Condition_Kind (Plugin : in Condition_Plugin;
Params : in Wiki.Attributes.Attribute_List)
return Condition_Type;
-- Evaluate the condition described by the parameters and hide or show the wiki
-- content.
overriding
procedure Expand (Plugin : in out Condition_Plugin;
Document : in out Wiki.Documents.Document;
Params : in out Wiki.Attributes.Attribute_List;
Context : in out Plugin_Context);
-- Append the attribute name/value to the condition plugin parameter list.
procedure Append (Plugin : in out Condition_Plugin;
Name : in Wiki.Strings.WString;
Value : in Wiki.Strings.WString);
private
type Boolean_Array is array (Condition_Depth) of Boolean;
pragma Pack (Boolean_Array);
type Condition_Plugin is new Wiki_Plugin with record
Depth : Condition_Depth := 1;
Values : Boolean_Array := (others => False);
Params : Wiki.Attributes.Attribute_List;
end record;
end Wiki.Plugins.Conditions;
|
xeenta/learning-ada | Ada | 260 | adb | with Person;
with Ada.Text_IO; use Ada.Text_IO;
package body B is
procedure Print_Modify is
package I is new Ada.Text_IO.Integer_IO (Integer);
begin
I.Put (Person.Unit_Age); New_Line;
Person.Unit_Age := 20;
end Print_Modify;
end B;
|
MayaPosch/ByteBauble | Ada | 1,507 | ads | --
-- bytebauble.ads - Specification for the ByteBauble package.
--
-- 2021/03/05, Maya Posch
--
with Interfaces;
package ByteBauble is
type BBEndianness is (BB_BE, BB_LE);
subtype uint16 is Interfaces.Unsigned_16;
subtype uint32 is Interfaces.Unsigned_32;
subtype uint64 is Interfaces.Unsigned_64;
--subtype uint128 is Interfaces.Unsigned_128;
function Bswap_16 (X : uint16) return uint16;
pragma Import (Intrinsic, Bswap_16, "__builtin_bswap16");
function Bswap_32 (X : uint32) return uint32;
pragma Import (Intrinsic, Bswap_32, "__builtin_bswap32");
function Bswap_64 (X : uint64) return uint64;
pragma Import (Intrinsic, Bswap_64, "__builtin_bswap64");
-- function Bswap_128 (X : uint128) return uint128;
-- pragma Import (Intrinsic, Bswap_128, "__builtin_bswap128");
procedure detectHostEndian;
function getHostEndian return BBEndianness;
procedure setGlobalEndianness(endian : in BBEndianness);
function toGlobal(value : in uint16; endian : in BBEndianness) return uint16;
function toGlobal(value : in uint32; endian : in BBEndianness) return uint32;
function toGlobal(value : in uint64; endian : in BBEndianness) return uint64;
function toHost(value : in uint16; endian : in BBEndianness) return uint16;
function toHost(value : in uint32; endian : in BBEndianness) return uint32;
function toHost(value : in uint64; endian : in BBEndianness) return uint64;
private
globalEndian : BBEndianness := BB_LE;
hostEndian : BBEndianness := BB_LE;
end ByteBauble;
|
AdaCore/gpr | Ada | 7,133 | adb | --
-- Copyright (C) 2021-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--
package body GPR2.Unit.List is
type Iterator is new Unit_Iterator.Forward_Iterator with record
Root : not null access constant Object;
end record;
overriding function First (Iter : Iterator) return Cursor;
overriding function Next (Iter : Iterator; Position : Cursor) return Cursor;
procedure Skip_Padding (Cursor : in out Unit_Vectors.Cursor) with Inline;
-- Skips padding elements that correspond to unused positions
-----------
-- Clear --
-----------
procedure Clear (Self : in out Object) is
begin
Self.List.Clear;
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Self : aliased Object; Index : Unit_Index) return Constant_Reference_Type
is
Cursor : Unit_Vectors.Cursor;
begin
if Self.Multi_Unit then
Cursor := Self.List.To_Cursor (Index);
else
Cursor := Self.List.First;
end if;
return Self.Constant_Reference (Position => (Current => Cursor));
end Constant_Reference;
function Constant_Reference
(Self : aliased Object; Position : Cursor) return Constant_Reference_Type
is
Ref : constant Unit_Vectors.Constant_Reference_Type :=
Self.List.Constant_Reference (Position.Current);
begin
return (Unit => Ref.Element.all'Unchecked_Access, Ref => Ref);
end Constant_Reference;
-------------
-- Element --
-------------
function Element (Self : Object; Index : Unit_Index) return Unit.Object is
begin
if Self.Multi_Unit then
return Self.List.Element (Index);
else
pragma Assert (Index = No_Index);
return Self.List.First_Element;
end if;
end Element;
-------------
-- Element --
-------------
function Element (Position : Cursor) return Unit.Object is
begin
return Unit_Vectors.Element (Position.Current);
end Element;
-----------
-- First --
-----------
overriding function First (Iter : Iterator) return Cursor is
First : Unit_Vectors.Cursor := Iter.Root.List.First;
begin
Skip_Padding (First);
return (Current => First);
end First;
-----------------
-- Has_Element --
-----------------
function Has_Element (Self : Object; Index : Unit_Index) return Boolean is
begin
if Self.Multi_Unit then
if Index not in Multi_Unit_Index then
return False;
else
return Self.List.Last_Index >= Index;
end if;
elsif Index = No_Index then
return not Self.List.Is_Empty;
else
return False;
end if;
end Has_Element;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
return Unit_Vectors.Has_Element (Position.Current);
end Has_Element;
------------
-- Insert --
------------
procedure Insert (Self : in out Object; Element : Unit.Object) is
Inserted : Boolean;
Position : Cursor;
begin
Self.Insert (Element, Position, Inserted);
if not Inserted then
raise Constraint_Error with "Element already exists";
end if;
end Insert;
------------
-- Insert --
------------
procedure Insert
(Self : in out Object; Element : Unit.Object; Position : out Cursor;
Inserted : out Boolean)
is
begin
if Element.Index = No_Index then
if not Self.List.Is_Empty then
Inserted := False;
Position := (Current => Self.List.First);
else
Self.Multi_Unit := False;
Self.List.Append (Element);
Inserted := True;
Position := (Current => Self.List.First);
end if;
elsif not Self.Multi_Unit and then not Self.List.Is_Empty then
-- Trying to insert an indexed element while a non indexed
-- one already exists.
Inserted := False;
Position := (Current => Self.List.First);
else
Self.Multi_Unit := True;
if Element.Index <= Self.List.Last_Index then
Position := (Current => Self.List.To_Cursor (Element.Index));
if Self.List (Position.Current).Is_Defined then
Inserted := False;
else
Self.List (Position.Current) := Element;
Inserted := True;
end if;
else
-- add padding elements if needed
while Self.List.Last_Index + 1 /= Element.Index loop
Self.List.Append (Unit.Undefined);
end loop;
Self.List.Append (Element);
Inserted := True;
Position := (Current => Self.List.Last);
end if;
end if;
end Insert;
--------------
-- Is_Empty --
--------------
function Is_Empty (Self : Object) return Boolean is
begin
return Self.List.Is_Empty;
end Is_Empty;
------------------------
-- Is_Multi_Unit_List --
------------------------
function Is_Indexed_List (Self : Object) return Boolean is
begin
return Self.Multi_Unit;
end Is_Indexed_List;
-------------
-- Iterate --
-------------
function Iterate (Self : Object) return Unit_Iterator.Forward_Iterator'Class
is
begin
return Iterator'(Root => Self'Unrestricted_Access);
end Iterate;
------------
-- Length --
------------
function Length (Self : Object) return Ada.Containers.Count_Type is
begin
return Self.List.Length;
end Length;
----------
-- Next --
----------
overriding function Next (Iter : Iterator; Position : Cursor) return Cursor
is
Next : Unit_Vectors.Cursor := Unit_Vectors.Next (Position.Current);
begin
Skip_Padding (Next);
return Cursor'(Current => Next);
end Next;
---------------
-- Reference --
---------------
function Reference
(Self : aliased in out Object; Index : Unit_Index) return Reference_Type
is
Cursor : Unit_Vectors.Cursor;
begin
if Self.Multi_Unit then
Cursor := Self.List.To_Cursor (Index);
else
pragma Assert (Index = No_Index);
Cursor := Self.List.First;
end if;
return Reference (Self, (Current => Cursor));
end Reference;
function Reference
(Self : aliased in out Object; Position : Cursor) return Reference_Type
is
Ref : constant Unit_Vectors.Reference_Type :=
Self.List.Reference (Position.Current);
begin
return (Unit => Ref.Element.all'Unchecked_Access, Ref => Ref);
end Reference;
------------------
-- Skip_Padding --
------------------
procedure Skip_Padding (Cursor : in out Unit_Vectors.Cursor) is
begin
while Unit_Vectors.Has_Element (Cursor)
and then not Unit_Vectors.Element (Cursor).Is_Defined
loop
Cursor := Unit_Vectors.Next (Cursor);
end loop;
end Skip_Padding;
end GPR2.Unit.List;
|
datdojp/davu | Ada | 478 | ads | if(window["ADS_CHECKER"] != undefined && window["ADS_CHECKER"] != "undefined") document.write('<script type="text/javascript" src="http://admicro1.vcmedia.vn/ads_codes/ads_code_170.ads"></script>'); else document.write('<script type="text/javascript" src="http://admicro1.vcmedia.vn/core/admicro_core.js?id=1"></script><script type="text/javascript" src="http://admicro1.vcmedia.vn/ads_codes/ads_code_170.ads"></script>'); var url_write='http://admicro.vn/adproject/write.php'; |
sungyeon/drake | Ada | 273 | ads | pragma License (Unrestricted);
with Ada.Strings.Generic_Unbounded.Generic_Hash;
with Ada.Strings.Wide_Hash;
function Ada.Strings.Wide_Unbounded.Wide_Hash is
new Unbounded_Wide_Strings.Generic_Hash (Wide_Hash);
pragma Preelaborate (Ada.Strings.Wide_Unbounded.Wide_Hash);
|
reznikmm/matreshka | Ada | 3,627 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Web API Definition --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This is root package for DOM Level 4 API.
------------------------------------------------------------------------------
package WebAPI.DOM is
pragma Preelaborate;
type Event_Phases is
(None,
Capturing_Phase,
At_Target,
Bubbling_Phase);
end WebAPI.DOM;
|
charlie5/lace | Ada | 24,420 | adb | with
ada.unchecked_Deallocation,
ada.Containers,
ada.Calendar,
ada.Text_IO,
ada.Exceptions;
package body physics.Engine
is
use ada.Text_IO;
protected body safe_command_Set
is
function is_Empty return Boolean
is
begin
return the_Count = 0;
end is_Empty;
procedure add (the_Command : in Command)
is
begin
the_Count := the_Count + 1;
Set (the_Count) := the_Command;
end add;
procedure Fetch (To : out Commands;
Count : out Natural)
is
begin
To (1 .. the_Count) := Set (1 .. the_Count);
Count := the_Count;
the_Count := 0;
end Fetch;
end safe_command_Set;
task body Evolver
is
use type physics.Joint.view,
ada.Containers.Count_type;
Stopped : Boolean := True;
Cycle : ada.Containers.Count_type := 0;
next_render_Time : ada.Calendar.Time;
-- max_joint_Force,
-- max_joint_Torque : Real := 0.0;
procedure free_Objects
is
-- the_free_Objects : gel.Object.views := the_World.free_Object_Set;
begin
-- for Each in the_free_Objects'Range
-- loop
-- log ("Engine is Freeing Object id: " & Object_Id'Image (the_free_Objects (Each).Id));
--
-- if the_free_Objects (Each).owns_Graphics
-- then
-- the_World.Renderer.free (the_free_Objects (Each).Visual.Model);
-- end if;
--
-- gel.Object.free (the_free_Objects (Each));
-- end loop;
null;
end free_Objects;
procedure evolve
is
begin
Cycle := Cycle + 1;
do_engine_Commands:
declare
the_Commands : Commands;
Count : Natural;
command_Count : array (command_Kind) of Natural := [others => 0];
begin
Self.Commands.fetch (the_Commands, Count);
for Each in 1 .. Count
loop
declare
the_Command : Command renames the_Commands (Each);
begin
command_Count (the_Command.Kind) := command_Count (the_Command.Kind) + 1;
case the_Command.Kind
is
when scale_Object =>
the_Command.Object.activate;
the_Command.Object.Shape.Scale_is (the_Command.Scale);
the_Command.Object .Scale_is (the_Command.Scale);
Self.Space.update_Bounds (the_Command.Object);
when update_Bounds =>
Self.Space.update_Bounds (the_Command.Object);
when update_Site =>
the_Command.Object.Site_is (the_Command.Site);
when set_Speed =>
the_Command.Object.Speed_is (the_Command.Speed);
when set_xy_Spin =>
the_Command.Object.xy_Spin_is (the_Command.xy_Spin);
when add_Object =>
declare
-- procedure rebuild_Shape (the_Object : in Object.view)
-- is
-- use type physics.Model.shape_Kind,
-- physics.Model.View;
--
-- the_Scale : aliased Vector_3;
--
-- begin
-- if the_Object.physics_Model = null then
-- return;
-- end if;
--
-- the_Scale := Self.physics_Model.Scale;
--
-- case Self.physics_Model.shape_Info.Kind
-- is
-- when physics.Model.Cube =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_box_Shape (Self.physics_Model.shape_Info.half_Extents));
--
-- when physics.Model.a_Sphere =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_sphere_Shape (Self.physics_Model.shape_Info.sphere_Radius));
--
-- when physics.Model.multi_Sphere =>
-- Self.Shape := physics_Shape_view (Self.World.Physics.new_multisphere_Shape (Self.physics_Model.shape_Info.Sites.all,
-- Self.physics_Model.shape_Info.Radii.all));
-- when physics.Model.Cone =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_cone_Shape (radius => Real (Self.physics_Model.Scale (1) / 2.0),
-- height => Real (Self.physics_Model.Scale (2))));
-- when physics.Model.a_Capsule =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_capsule_Shape (Self.physics_Model.shape_Info.lower_Radius,
-- Self.physics_Model.shape_Info.Height));
-- when physics.Model.Cylinder =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_cylinder_Shape (Self.physics_Model.shape_Info.half_Extents));
--
-- when physics.Model.Hull =>
-- Self.Shape := physics_Shape_view (Self.World.Physics.new_convex_hull_Shape (Self.physics_Model.shape_Info.Points.all));
--
-- when physics.Model.Mesh =>
-- Self.Shape := physics_Shape_view (Self.World.Physics .new_mesh_Shape (Self.physics_Model.shape_Info.Model));
--
-- when physics.Model.Plane =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_plane_Shape (Self.physics_Model.Shape_Info.plane_Normal,
-- Self.physics_Model.Shape_Info.plane_Offset));
-- when physics.Model.Heightfield =>
-- Self.Shape := physics_Shape_view (Self.World.Physics.new_heightfield_Shape (Self.physics_Model.shape_Info.Heights.all,
-- Self.physics_Model.Scale));
-- when physics.Model.Circle =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_circle_Shape (Self.physics_Model.shape_Info.circle_Radius));
--
-- when physics.Model.Polygon =>
-- Self.Shape := physics_Shape_view (Self.World.Physics. new_polygon_Shape (physics.space.polygon_Vertices (Self.physics_Model.shape_Info.Vertices (1 .. Self.physics_Model.shape_Info.vertex_Count))));
-- end case;
--
-- end rebuild_Shape;
procedure add (the_Object : in Object.view)
is
begin
-- the_World.add (the_Object. physics_Model.all'Access);
-- if the_Object.physics_Model.is_Tangible
-- then
-- rebuild_Shape (the_Object);
the_Object.Shape.define;
-- the_Object.define (Shape => the_Object.Shape,
-- Mass => the_Object.Model.Mass,
-- Friction => the_Object.Model.Friction,
-- Restitution => the_Object.Model.Restitution,
-- at_Site => the_Object.Model.Site);
Self.Space.add (the_Object);
-- end if;
-- begin
-- the_Object_Transforms.insert (the_Object, Identity_4x4);
-- the_Object.Solid.user_Data_is (the_Object);
-- end;
-- the_World.Object_Count := the_World.Object_Count + 1;
-- the_World.Objects (the_World.Object_Count) := the_Object;
end add;
begin
add (the_Command.Object);
end;
when rid_Object =>
declare
function find (the_Object : in Object.view) return Index
is
begin
-- for Each in 1 .. the_World.Object_Count
-- loop
-- if the_World.Objects (Each) = the_Object
-- then
-- return Each;
-- end if;
-- end loop;
raise constraint_Error with "no such Object in world";
return 0;
end find;
procedure rid (the_Object : in Object.view)
is
use type Object.view;
begin
if the_Object /= null
then
-- if the_Object.physics_Model.is_Tangible
-- then
Self.Space.rid (the_Object);
-- end if;
-- if the_Object_Transforms.contains (the_Object) then
-- the_Object_Transforms.delete (the_Object);
-- end if;
else
raise program_Error;
end if;
declare
Id : Index;
pragma Unreferenced (Id);
begin
Id := find (the_Object);
-- if Id <= the_World.Object_Count
-- then
-- the_World.Objects (1 .. the_World.Object_Count - 1)
-- := the_World.Objects ( 1 .. Id - 1)
-- & the_World.Objects (Id + 1 .. the_World.Object_Count);
-- end if;
-- the_World.Object_Count := the_World.Object_Count - 1;
end;
end rid;
begin
rid (the_Command.Object);
end;
when apply_Force =>
the_Command.Object.apply_Force (the_Command.Force);
when destroy_Object =>
declare
-- the_free_Set : free_Set renames the_World.free_Sets (the_World.current_free_Set);
begin
raise Program_Error with "destroy_Object ~ TODO";
-- the_free_Set.Count := the_free_Set.Count + 1;
-- the_free_Set.Objects (the_free_Set.Count) := the_Command.Object;
end;
when add_Joint =>
Self.Space.add (the_Command.Joint.all'Access);
the_Command.Joint.user_Data_is (the_Command.Joint);
when rid_Joint =>
Self.Space.rid (the_Command.Joint.all'Access);
when set_Joint_local_Anchor =>
Self.Space.set_Joint_local_Anchor (the_Command.anchor_Joint.all'Access,
the_Command.is_Anchor_A,
the_Command.local_Anchor);
when free_Joint =>
-- Joint.free (the_Command.Joint);
null;
when cast_Ray =>
null;
-- declare
-- function cast_Ray (Self : in Item'Class; From, To : in math.Vector_3) return ray_Collision
-- is
-- use type std_physics.Object.view;
--
-- physics_Collision : constant standard.physics.Space.ray_Collision := Self.physics.cast_Ray (From, To);
-- begin
-- if physics_Collision.near_Object = null
-- then
-- return ray_Collision' (near_Object => null,
-- others => <>);
-- else
-- return ray_Collision' (to_GEL (physics_Collision.near_Object),
-- physics_Collision.hit_Fraction,
-- physics_Collision.Normal_world,
-- physics_Collision.Site_world);
-- end if;
-- end cast_Ray;
--
-- the_Collision : constant ray_Collision := cast_Ray (the_World.all,
-- the_Command.From,
-- the_Command.To);
-- begin
-- if the_Collision.near_Object = null
-- or else the_Collision.near_Object.is_Destroyed
-- then
-- free (the_Command.Context);
--
-- else
-- declare
-- no_Params : aliased no_Parameters;
-- the_Event : raycast_collision_Event'Class
-- := raycast_collision_Event_dispatching_Constructor (the_Command.event_Kind,
-- no_Params'Access);
-- begin
-- the_Event.near_Object := the_Collision.near_Object;
-- the_Event.Context := the_Command.Context;
-- the_Event.Site_world := the_Collision.Site_world;
--
-- the_Command.Observer.receive (the_Event, from_subject => the_World.Name);
-- end;
-- end if;
-- end;
when set_Gravity =>
Self.Space.Gravity_is (the_Command.Gravity);
end case;
end;
end loop;
end do_engine_Commands;
Self.Space.evolve (by => 1.0 / 60.0); -- Evolve the world.
-- free_Objects;
end evolve;
use ada.Calendar;
begin
-- accept start (space_Kind : in physics.space_Kind)
accept start (the_Space : in Space.view)
do
Stopped := False;
-- Self.Space := physics.Forge.new_Space (space_Kind);
Self.Space := the_Space;
end start;
next_render_Time := ada.Calendar.Clock;
loop
select
accept stop
do
Stopped := True;
-- Add 'destroy' commands for all Objects.
--
-- declare
-- the_Objects : Object.views renames the_World.Objects;
-- begin
-- for i in 1 .. the_World.Object_Count
-- loop
-- the_Objects (i).destroy (and_Children => False);
-- end loop;
-- end;
-- Evolve the world til there are no commands left.
--
while not Self.Commands.is_Empty
loop
evolve;
end loop;
-- Free both sets of freeable Objects.
--
free_Objects;
free_Objects;
end stop;
exit when Stopped;
or
accept reset_Age
do
Self.Age := 0.0;
end reset_Age;
else
null;
end select;
evolve;
-- the_World.new_Object_transforms_Available.signal;
-- the_World.evolver_Done .signal;
-- Check for joint breakage.
--
-- if the_World.broken_joints_Allowed
-- then
-- declare
-- use gel.Joint,
-- standard.physics.Space;
--
-- the_Joint : gel.Joint.view;
-- reaction_Force,
-- reaction_Torque : math.Real;
--
-- Cursor : standard.physics.Space.joint_Cursor'Class := the_World.Physics.first_Joint;
-- begin
-- while has_Element (Cursor)
-- loop
-- the_Joint := to_GEL (Element (Cursor));
--
-- if the_Joint /= null
-- then
-- reaction_Force := abs (the_Joint.reaction_Force);
-- reaction_Torque := abs (the_Joint.reaction_Torque);
--
-- if reaction_Force > 50.0 / 8.0
-- or reaction_Torque > 100.0 / 8.0
-- then
-- begin
-- the_World.Physics .rid (the_Joint.Physics.all'Access);
-- the_World.broken_Joints.add (the_Joint);
--
-- exception
-- when no_such_Child =>
-- put_Line ("Error when breaking joint due to reaction Force: no_such_Child !");
-- end;
-- end if;
--
-- if reaction_Force > max_joint_Force
-- then
-- max_joint_Force := reaction_Force;
-- end if;
--
-- if reaction_Torque > max_joint_Torque
-- then
-- max_joint_Torque := reaction_Torque;
-- end if;
-- end if;
--
-- next (Cursor);
-- end loop;
-- end;
-- end if;
next_render_Time := next_render_Time + Duration (1.0 / 60.0);
end loop;
exception
when E : others =>
new_Line (2);
put_Line ("Error in physics.Engine.evolver task !");
new_Line;
put_Line (Ada.Exceptions.Exception_Information (E));
put_Line ("Evolver has terminated !");
new_Line (2);
end Evolver;
-- procedure start (Self : access Item; space_Kind : in physics.space_Kind)
procedure start (Self : access Item; the_Space : in Space.view)
is
begin
Self.Evolver.start (the_Space);
end start;
procedure stop (Self : access Item)
is
procedure free is new ada.unchecked_Deallocation (safe_command_Set, safe_command_Set_view);
begin
Self.Evolver.stop;
free (Self.Commands);
end stop;
procedure add (Self : access Item; the_Object : in Object.view)
is
begin
put_Line ("physics engine: add Object");
Self.Commands.add ((Kind => add_Object,
Object => the_Object,
add_Children => False));
end add;
procedure rid (Self : in out Item; the_Object : in Object.view)
is
begin
Self.Commands.add ((Kind => rid_Object,
Object => the_Object,
rid_Children => False));
end rid;
procedure add (Self : in out Item; the_Joint : in Joint.view)
is
begin
Self.Commands.add ((Kind => add_Joint,
Object => null,
Joint => the_Joint));
end add;
procedure rid (Self : in out Item; the_Joint : in Joint.view)
is
begin
Self.Commands.add ((Kind => rid_Joint,
Object => null,
Joint => the_Joint));
end rid;
procedure update_Scale (Self : in out Item; of_Object : in Object.view;
To : in math.Vector_3)
is
begin
Self.Commands.add ((Kind => scale_Object,
Object => of_Object,
Scale => To));
end update_Scale;
procedure apply_Force (Self : in out Item; to_Object : in Object.view;
Force : in math.Vector_3)
is
begin
Self.Commands.add ((Kind => apply_Force,
Object => to_Object,
Force => Force));
end apply_Force;
procedure update_Site (Self : in out Item; of_Object : in Object.view;
To : in math.Vector_3)
is
begin
put_Line ("physics engine: update_Site");
Self.Commands.add ((Kind => update_Site,
Object => of_Object,
Site => To));
end update_Site;
procedure set_Speed (Self : in out Item; of_Object : in Object.view;
To : in math.Vector_3)
is
begin
Self.Commands.add ((Kind => set_Speed,
Object => of_Object,
Speed => To));
end set_Speed;
procedure set_Gravity (Self : in out Item; To : in math.Vector_3)
is
begin
Self.Commands.add ((Kind => set_Gravity,
Object => null,
Gravity => To));
end set_Gravity;
procedure set_xy_Spin (Self : in out Item; of_Object : in Object.view;
To : in math.Radians)
is
begin
Self.Commands.add ((Kind => set_xy_Spin,
Object => of_Object,
xy_Spin => To));
end set_xy_Spin;
procedure update_Bounds (Self : in out Item; of_Object : in Object.view)
is
begin
Self.Commands.add ((Kind => update_Bounds,
Object => of_Object));
end update_Bounds;
procedure set_local_Anchor (Self : in out Item; for_Joint : in Joint.view;
To : in math.Vector_3;
is_Anchor_A : in Boolean)
is
begin
Self.Commands.add ((Kind => set_Joint_local_Anchor,
Object => null,
anchor_Joint => for_Joint,
local_Anchor => To,
is_Anchor_A => is_Anchor_A));
end set_local_Anchor;
end physics.Engine;
|
reznikmm/matreshka | Ada | 3,719 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Glue_Points_Attributes is
pragma Preelaborate;
type ODF_Draw_Glue_Points_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Glue_Points_Attribute_Access is
access all ODF_Draw_Glue_Points_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Glue_Points_Attributes;
|
sungyeon/drake | Ada | 6,104 | adb | with System.Address_To_Named_Access_Conversions;
with System.Storage_Barriers;
package body System.Atomic_Primitives is
use type Interfaces.Unsigned_8;
use type Interfaces.Unsigned_16;
use type Interfaces.Unsigned_32;
use type Interfaces.Unsigned_64;
pragma Compile_Time_Warning (
not uint8'Atomic_Always_Lock_Free,
"uint8 is not atomic");
pragma Compile_Time_Warning (
not uint16'Atomic_Always_Lock_Free,
"uint16 is not atomic");
pragma Compile_Time_Warning (
not uint32'Atomic_Always_Lock_Free,
"uint32 is not atomic");
-- pragma Compile_Time_Warning (
-- not uint64'Atomic_Always_Lock_Free,
-- "uint64 is not atomic");
type uint8_Access is access all uint8;
for uint8_Access'Storage_Size use 0;
type uint16_Access is access all uint16;
for uint16_Access'Storage_Size use 0;
type uint32_Access is access all uint32;
for uint32_Access'Storage_Size use 0;
type uint64_Access is access all uint64;
for uint64_Access'Storage_Size use 0;
package uint8_Access_Conv is
new Address_To_Named_Access_Conversions (uint8, uint8_Access);
package uint16_Access_Conv is
new Address_To_Named_Access_Conversions (uint16, uint16_Access);
package uint32_Access_Conv is
new Address_To_Named_Access_Conversions (uint32, uint32_Access);
package uint64_Access_Conv is
new Address_To_Named_Access_Conversions (uint64, uint64_Access);
-- Use sequentially consistent model for general purpose.
Order : constant := Storage_Barriers.ATOMIC_SEQ_CST;
function atomic_load (
ptr : not null access constant uint8;
memorder : Integer := Order)
return uint8
with Import, Convention => Intrinsic, External_Name => "__atomic_load_1";
function atomic_load (
ptr : not null access constant uint16;
memorder : Integer := Order)
return uint16
with Import, Convention => Intrinsic, External_Name => "__atomic_load_2";
function atomic_load (
ptr : not null access constant uint32;
memorder : Integer := Order)
return uint32
with Import, Convention => Intrinsic, External_Name => "__atomic_load_4";
function atomic_load (
ptr : not null access constant uint64;
memorder : Integer := Order)
return uint64
with Import, Convention => Intrinsic, External_Name => "__atomic_load_8";
function atomic_compare_exchange (
ptr : not null access uint8;
expected : not null access uint8;
desired : uint8;
weak : Boolean := False;
success_memorder : Integer := Order;
failure_memorder : Integer := Order)
return Boolean
with Import,
Convention => Intrinsic,
External_Name => "__atomic_compare_exchange_1";
function atomic_compare_exchange (
ptr : not null access uint16;
expected : not null access uint16;
desired : uint16;
weak : Boolean := False;
success_memorder : Integer := Order;
failure_memorder : Integer := Order)
return Boolean
with Import,
Convention => Intrinsic,
External_Name => "__atomic_compare_exchange_2";
function atomic_compare_exchange (
ptr : not null access uint32;
expected : not null access uint32;
desired : uint32;
weak : Boolean := False;
success_memorder : Integer := Order;
failure_memorder : Integer := Order)
return Boolean
with Import,
Convention => Intrinsic,
External_Name => "__atomic_compare_exchange_4";
function atomic_compare_exchange (
ptr : not null access uint64;
expected : not null access uint64;
desired : uint64;
weak : Boolean := False;
success_memorder : Integer := Order;
failure_memorder : Integer := Order)
return Boolean
with Import,
Convention => Intrinsic,
External_Name => "__atomic_compare_exchange_8";
-- implementation
function Lock_Free_Read_8 (Ptr : Address) return Interfaces.Unsigned_8 is
begin
return atomic_load (uint8_Access_Conv.To_Pointer (Ptr));
end Lock_Free_Read_8;
function Lock_Free_Read_16 (Ptr : Address) return Interfaces.Unsigned_16 is
begin
return atomic_load (uint16_Access_Conv.To_Pointer (Ptr));
end Lock_Free_Read_16;
function Lock_Free_Read_32 (Ptr : Address) return Interfaces.Unsigned_32 is
begin
return atomic_load (uint32_Access_Conv.To_Pointer (Ptr));
end Lock_Free_Read_32;
function Lock_Free_Read_64 (Ptr : Address) return Interfaces.Unsigned_64 is
begin
return atomic_load (uint64_Access_Conv.To_Pointer (Ptr));
end Lock_Free_Read_64;
function Lock_Free_Try_Write_8 (
Ptr : Address;
Expected : in out Interfaces.Unsigned_8;
Desired : Interfaces.Unsigned_8)
return Boolean is
begin
return atomic_compare_exchange (
uint8_Access_Conv.To_Pointer (Ptr),
Expected'Unrestricted_Access,
Desired);
end Lock_Free_Try_Write_8;
function Lock_Free_Try_Write_16 (
Ptr : Address;
Expected : in out Interfaces.Unsigned_16;
Desired : Interfaces.Unsigned_16)
return Boolean is
begin
return atomic_compare_exchange (
uint16_Access_Conv.To_Pointer (Ptr),
Expected'Unrestricted_Access,
Desired);
end Lock_Free_Try_Write_16;
function Lock_Free_Try_Write_32 (
Ptr : Address;
Expected : in out Interfaces.Unsigned_32;
Desired : Interfaces.Unsigned_32)
return Boolean is
begin
return atomic_compare_exchange (
uint32_Access_Conv.To_Pointer (Ptr),
Expected'Unrestricted_Access,
Desired);
end Lock_Free_Try_Write_32;
function Lock_Free_Try_Write_64 (
Ptr : Address;
Expected : in out Interfaces.Unsigned_64;
Desired : Interfaces.Unsigned_64)
return Boolean is
begin
return atomic_compare_exchange (
uint64_Access_Conv.To_Pointer (Ptr),
Expected'Unrestricted_Access,
Desired);
end Lock_Free_Try_Write_64;
end System.Atomic_Primitives;
|
zhmu/ananas | Ada | 18,098 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T D L L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1997-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. --
-- --
------------------------------------------------------------------------------
-- GNATDLL is a Windows specific tool for building a DLL.
-- Both relocatable and non-relocatable DLL's are supported
with Gnatvsn;
with MDLL.Fil; use MDLL.Fil;
with MDLL.Utl;
with Switch; use Switch;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Command_Line; use Ada.Command_Line;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Command_Line; use GNAT.Command_Line;
procedure Gnatdll is
procedure Syntax;
-- Print out usage
procedure Check (Filename : String);
-- Check that the file whose name is Filename exists
procedure Parse_Command_Line;
-- Parse the command line arguments passed to gnatdll
procedure Check_Context;
-- Check the context before running any commands to build the library
Syntax_Error : exception;
-- Raised when a syntax error is detected, in this case a usage info will
-- be displayed.
Context_Error : exception;
-- Raised when some files (specified on the command line) are missing to
-- build the DLL.
Help : Boolean := False;
-- Help will be set to True the usage information is to be displayed
Version : constant String := Gnatvsn.Gnat_Version_String;
-- Why should it be necessary to make a copy of this
Default_DLL_Address : constant String := "0x11000000";
-- Default address for non relocatable DLL (Win32)
Lib_Filename : Unbounded_String := Null_Unbounded_String;
-- The DLL filename that will be created (.dll)
Def_Filename : Unbounded_String := Null_Unbounded_String;
-- The definition filename (.def)
List_Filename : Unbounded_String := Null_Unbounded_String;
-- The name of the file containing the objects file to put into the DLL
DLL_Address : Unbounded_String := To_Unbounded_String (Default_DLL_Address);
-- The DLL's base address
Gen_Map_File : Boolean := False;
-- Set to True if a map file is to be generated
Objects_Files : Argument_List_Access := MDLL.Null_Argument_List_Access;
-- List of objects to put inside the library
Ali_Files : Argument_List_Access := MDLL.Null_Argument_List_Access;
-- For each Ada file specified, we keep a record of the corresponding
-- ALI file. This list of SLI files is used to build the binder program.
Options : Argument_List_Access := MDLL.Null_Argument_List_Access;
-- A list of options set in the command line
Largs_Options : Argument_List_Access := MDLL.Null_Argument_List_Access;
Bargs_Options : Argument_List_Access := MDLL.Null_Argument_List_Access;
-- GNAT linker and binder args options
type Build_Mode_State is (Import_Lib, Dynamic_Lib, Dynamic_Lib_Only, Nil);
-- Import_Lib means only the .a file will be created, Dynamic_Lib means
-- that both the DLL and the import library will be created.
-- Dynamic_Lib_Only means that only the DLL will be created (no import
-- library).
Build_Mode : Build_Mode_State := Nil;
-- Will be set when parsing the command line
Must_Build_Relocatable : Boolean := True;
-- True means build a relocatable DLL, will be set to False if a
-- non-relocatable DLL must be built.
------------
-- Syntax --
------------
procedure Syntax is
procedure P (Str : String) renames Put_Line;
begin
P ("Usage : gnatdll [options] [list-of-files]");
New_Line;
P ("[list-of-files] a list of Ada libraries (.ali) and/or " &
"foreign object files");
New_Line;
P ("[options] can be");
P (" -h Help - display this message");
P (" -v Verbose");
P (" -q Quiet");
P (" -k Remove @nn suffix from exported names");
P (" -g Generate debugging information");
P (" -Idir Specify source and object files search path");
P (" -l file File contains a list-of-files to be added to "
& "the library");
P (" -e file Definition file containing exports");
P (" -d file Put objects in the relocatable dynamic "
& "library <file>");
P (" -b addr Set base address for the relocatable DLL");
P (" default address is " & Default_DLL_Address);
P (" -a[addr] Build non-relocatable DLL at address <addr>");
P (" if <addr> is not specified use "
& Default_DLL_Address);
P (" -m Generate map file");
P (" -n No-import - do not create the import library");
P (" -bargs opts opts are passed to the binder");
P (" -largs opts opts are passed to the linker");
end Syntax;
-----------
-- Check --
-----------
procedure Check (Filename : String) is
begin
if not Is_Regular_File (Filename) then
Raise_Exception
(Context_Error'Identity, "Error: " & Filename & " not found.");
end if;
end Check;
------------------------
-- Parse_Command_Line --
------------------------
procedure Parse_Command_Line is
procedure Add_File (Filename : String);
-- Add one file to the list of file to handle
procedure Add_Files_From_List (List_Filename : String);
-- Add the files listed in List_Filename (one by line) to the list
-- of file to handle
Max_Files : constant := 50_000;
Max_Options : constant := 1_000;
Ofiles : Argument_List (1 .. Max_Files);
O : Positive := Ofiles'First;
-- List of object files to put in the library. O is the next entry
-- to be used.
Afiles : Argument_List (1 .. Max_Files);
A : Positive := Afiles'First;
-- List of ALI files. A is the next entry to be used
Gopts : Argument_List (1 .. Max_Options);
G : Positive := Gopts'First;
-- List of gcc options. G is the next entry to be used
Lopts : Argument_List (1 .. Max_Options);
L : Positive := Lopts'First;
-- A list of -largs options (L is next entry to be used)
Bopts : Argument_List (1 .. Max_Options);
B : Positive := Bopts'First;
-- A list of -bargs options (B is next entry to be used)
Build_Import : Boolean := True;
-- Set to False if option -n if specified (no-import)
--------------
-- Add_File --
--------------
procedure Add_File (Filename : String) is
begin
if Is_Ali (Filename) then
Check (Filename);
-- Record it to generate the binder program when
-- building dynamic library
Afiles (A) := new String'(Filename);
A := A + 1;
elsif Is_Obj (Filename) then
Check (Filename);
-- Just record this object file
Ofiles (O) := new String'(Filename);
O := O + 1;
else
-- Unknown file type
Raise_Exception
(Syntax_Error'Identity,
"don't know what to do with " & Filename & " !");
end if;
end Add_File;
-------------------------
-- Add_Files_From_List --
-------------------------
procedure Add_Files_From_List (List_Filename : String) is
File : File_Type;
Buffer : String (1 .. 500);
Last : Natural;
begin
Open (File, In_File, List_Filename);
while not End_Of_File (File) loop
Get_Line (File, Buffer, Last);
Add_File (Buffer (1 .. Last));
end loop;
Close (File);
exception
when Name_Error =>
Raise_Exception
(Syntax_Error'Identity,
"list-of-files file " & List_Filename & " not found.");
end Add_Files_From_List;
-- Start of processing for Parse_Command_Line
begin
Initialize_Option_Scan ('-', False, "bargs largs");
-- scan gnatdll switches
loop
case Getopt ("g h v q k a? b: d: e: l: n m I:") is
when ASCII.NUL =>
exit;
when 'h' =>
Help := True;
when 'g' =>
Gopts (G) := new String'("-g");
G := G + 1;
when 'v' =>
-- Turn verbose mode on
MDLL.Verbose := True;
if MDLL.Quiet then
Raise_Exception
(Syntax_Error'Identity,
"impossible to use -q and -v together.");
end if;
when 'q' =>
-- Turn quiet mode on
MDLL.Quiet := True;
if MDLL.Verbose then
Raise_Exception
(Syntax_Error'Identity,
"impossible to use -v and -q together.");
end if;
when 'k' =>
MDLL.Kill_Suffix := True;
when 'a' =>
if Parameter = "" then
-- Default address for a relocatable dynamic library.
-- address for a non relocatable dynamic library.
DLL_Address := To_Unbounded_String (Default_DLL_Address);
else
DLL_Address := To_Unbounded_String (Parameter);
end if;
Must_Build_Relocatable := False;
when 'b' =>
DLL_Address := To_Unbounded_String (Parameter);
Must_Build_Relocatable := True;
when 'e' =>
Def_Filename := To_Unbounded_String (Parameter);
when 'd' =>
-- Build a non relocatable DLL
Lib_Filename := To_Unbounded_String (Parameter);
if Def_Filename = Null_Unbounded_String then
Def_Filename := To_Unbounded_String
(Ext_To (Parameter, "def"));
end if;
Build_Mode := Dynamic_Lib;
when 'm' =>
Gen_Map_File := True;
when 'n' =>
Build_Import := False;
when 'l' =>
List_Filename := To_Unbounded_String (Parameter);
when 'I' =>
Gopts (G) := new String'("-I" & Parameter);
G := G + 1;
when others =>
raise Invalid_Switch;
end case;
end loop;
-- Get parameters
loop
declare
File : constant String := Get_Argument (Do_Expansion => True);
begin
exit when File'Length = 0;
Add_File (File);
end;
end loop;
-- Get largs parameters
Goto_Section ("largs");
loop
case Getopt ("*") is
when ASCII.NUL =>
exit;
when others =>
Lopts (L) := new String'(Full_Switch);
L := L + 1;
end case;
end loop;
-- Get bargs parameters
Goto_Section ("bargs");
loop
case Getopt ("*") is
when ASCII.NUL =>
exit;
when others =>
Bopts (B) := new String'(Full_Switch);
B := B + 1;
end case;
end loop;
-- if list filename has been specified, parse it
if List_Filename /= Null_Unbounded_String then
Add_Files_From_List (To_String (List_Filename));
end if;
-- Check if the set of parameters are compatible
if Build_Mode = Nil and then not Help and then not MDLL.Verbose then
Raise_Exception (Syntax_Error'Identity, "nothing to do.");
end if;
-- -n option but no file specified
if not Build_Import
and then A = Afiles'First
and then O = Ofiles'First
then
Raise_Exception
(Syntax_Error'Identity,
"-n specified but there are no objects to build the library.");
end if;
-- Check if we want to build an import library (option -e and
-- no file specified)
if Build_Mode = Dynamic_Lib
and then A = Afiles'First
and then O = Ofiles'First
then
Build_Mode := Import_Lib;
end if;
-- If map file is to be generated, add linker option here
if Gen_Map_File and then Build_Mode = Import_Lib then
Raise_Exception
(Syntax_Error'Identity,
"Can't generate a map file for an import library.");
end if;
-- Check if only a dynamic library must be built
if Build_Mode = Dynamic_Lib and then not Build_Import then
Build_Mode := Dynamic_Lib_Only;
end if;
if O /= Ofiles'First then
Objects_Files := new Argument_List'(Ofiles (1 .. O - 1));
end if;
if A /= Afiles'First then
Ali_Files := new Argument_List'(Afiles (1 .. A - 1));
end if;
if G /= Gopts'First then
Options := new Argument_List'(Gopts (1 .. G - 1));
end if;
if L /= Lopts'First then
Largs_Options := new Argument_List'(Lopts (1 .. L - 1));
end if;
if B /= Bopts'First then
Bargs_Options := new Argument_List'(Bopts (1 .. B - 1));
end if;
exception
when Invalid_Switch =>
Raise_Exception
(Syntax_Error'Identity,
Message => "Invalid Switch " & Full_Switch);
when Invalid_Parameter =>
Raise_Exception
(Syntax_Error'Identity,
Message => "No parameter for " & Full_Switch);
end Parse_Command_Line;
-------------------
-- Check_Context --
-------------------
procedure Check_Context is
begin
Check (To_String (Def_Filename));
-- Check that each object file specified exists and raise exception
-- Context_Error if it does not.
for F in Objects_Files'Range loop
Check (Objects_Files (F).all);
end loop;
end Check_Context;
procedure Check_Version_And_Help is new Check_Version_And_Help_G (Syntax);
-- Start of processing for Gnatdll
begin
Check_Version_And_Help ("GNATDLL", "1997");
if Ada.Command_Line.Argument_Count = 0 then
Help := True;
else
Parse_Command_Line;
end if;
if MDLL.Verbose or else Help then
New_Line;
Put_Line ("GNATDLL " & Version & " - Dynamic Libraries Builder");
New_Line;
end if;
MDLL.Utl.Locate;
if Help
or else (MDLL.Verbose and then Ada.Command_Line.Argument_Count = 1)
then
Syntax;
else
Check_Context;
case Build_Mode is
when Import_Lib =>
MDLL.Build_Import_Library
(To_String (Lib_Filename),
To_String (Def_Filename));
when Dynamic_Lib =>
MDLL.Build_Dynamic_Library
(Objects_Files.all,
Ali_Files.all,
Options.all,
Bargs_Options.all,
Largs_Options.all,
To_String (Lib_Filename),
To_String (Def_Filename),
To_String (DLL_Address),
Build_Import => True,
Relocatable => Must_Build_Relocatable,
Map_File => Gen_Map_File);
when Dynamic_Lib_Only =>
MDLL.Build_Dynamic_Library
(Objects_Files.all,
Ali_Files.all,
Options.all,
Bargs_Options.all,
Largs_Options.all,
To_String (Lib_Filename),
To_String (Def_Filename),
To_String (DLL_Address),
Build_Import => False,
Relocatable => Must_Build_Relocatable,
Map_File => Gen_Map_File);
when Nil =>
null;
end case;
end if;
Set_Exit_Status (Success);
exception
when SE : Syntax_Error =>
Put_Line ("Syntax error : " & Exception_Message (SE));
New_Line;
Syntax;
Set_Exit_Status (Failure);
when E : MDLL.Tools_Error | Context_Error =>
Put_Line (Exception_Message (E));
Set_Exit_Status (Failure);
when others =>
Put_Line ("gnatdll: INTERNAL ERROR. Please report");
Set_Exit_Status (Failure);
end Gnatdll;
|
ptrebuc/ewok-kernel | Ada | 7,187 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.layout; use ewok.layout;
with ewok.tasks; use ewok.tasks;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.devices;
with ewok.exported.dma; use type ewok.exported.dma.t_dma_shm_access;
package body ewok.sanitize
with spark_mode => on
is
function is_word_in_data_slot
(ptr : system_address;
task_id : ewok.tasks_shared.t_task_id;
mode : ewok.tasks_shared.t_task_mode)
return boolean
with spark_mode => off
is
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
if ptr >= user_task.data_slot_start and
ptr + 4 <= user_task.data_slot_end
then
return true;
end if;
-- ISR mode is a special case because the stack is therefore
-- mutualized (thus only one ISR can be executed at the same time)
if mode = TASK_MODE_ISRTHREAD and
ptr >= STACK_BOTTOM_TASK_ISR and
ptr < STACK_TOP_TASK_ISR
then
return true;
end if;
return false;
end is_word_in_data_slot;
function is_word_in_txt_slot
(ptr : system_address;
task_id : ewok.tasks_shared.t_task_id)
return boolean
with spark_mode => off
is
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
if ptr >= user_task.txt_slot_start and
ptr + 4 <= user_task.txt_slot_end
then
return true;
else
return false;
end if;
end is_word_in_txt_slot;
function is_word_in_allocated_device
(ptr : system_address;
task_id : ewok.tasks_shared.t_task_id)
return boolean
with spark_mode => off
is
dev_id : ewok.devices_shared.t_device_id;
dev_size : unsigned_32;
dev_addr : system_address;
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
for i in user_task.device_id'range loop
dev_id := user_task.device_id(i);
if dev_id /= ID_DEV_UNUSED then
dev_addr := ewok.devices.get_user_device_addr (dev_id);
dev_size := ewok.devices.get_user_device_size (dev_id);
if ptr >= dev_addr and
ptr + 4 >= dev_addr and
ptr + 4 < dev_addr + dev_size
then
return true;
end if;
end if;
end loop;
return false;
end is_word_in_allocated_device;
function is_word_in_any_slot
(ptr : system_address;
task_id : ewok.tasks_shared.t_task_id;
mode : ewok.tasks_shared.t_task_mode)
return boolean
with spark_mode => off
is
begin
return
is_word_in_data_slot (ptr, task_id, mode) or
is_word_in_txt_slot (ptr, task_id);
end is_word_in_any_slot;
function is_range_in_devices_slot
(ptr : system_address;
size : unsigned_32;
task_id : ewok.tasks_shared.t_task_id)
return boolean
with spark_mode => off
is
user_device_size : unsigned_32;
user_device_addr : unsigned_32;
dev_id : t_device_id;
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
for i in user_task.device_id'range loop
dev_id := user_task.device_id(i);
if dev_id /= ID_DEV_UNUSED then
user_device_size := ewok.devices.get_user_device_size(dev_id);
user_device_addr := ewok.devices.get_user_device_addr(dev_id);
if ptr >= user_device_addr and
ptr + size <= user_device_addr + user_device_size
then
return true;
end if;
end if;
end loop;
return false;
end is_range_in_devices_slot;
function is_range_in_data_slot
(ptr : system_address;
size : unsigned_32;
task_id : ewok.tasks_shared.t_task_id;
mode : ewok.tasks_shared.t_task_mode)
return boolean
with spark_mode => off
is
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
if ptr >= user_task.data_slot_start and
ptr + size >= ptr and
ptr + size <= user_task.data_slot_end
then
return true;
end if;
if mode = TASK_MODE_ISRTHREAD and
ptr >= STACK_BOTTOM_TASK_ISR and
ptr + size >= ptr and
ptr + size < STACK_TOP_TASK_ISR
then
return true;
end if;
return false;
end is_range_in_data_slot;
function is_range_in_txt_slot
(ptr : system_address;
size : unsigned_32;
task_id : ewok.tasks_shared.t_task_id)
return boolean
with spark_mode => off
is
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
if ptr >= user_task.txt_slot_start and
ptr + size >= ptr and
ptr + size <= user_task.txt_slot_end
then
return true;
else
return false;
end if;
end is_range_in_txt_slot;
function is_range_in_any_slot
(ptr : system_address;
size : unsigned_32;
task_id : ewok.tasks_shared.t_task_id;
mode : ewok.tasks_shared.t_task_mode)
return boolean
with spark_mode => off
is
begin
return
is_range_in_data_slot (ptr, size, task_id, mode) or
is_range_in_txt_slot (ptr, size, task_id);
end is_range_in_any_slot;
function is_range_in_dma_shm
(ptr : system_address;
size : unsigned_32;
dma_access : ewok.exported.dma.t_dma_shm_access;
task_id : ewok.tasks_shared.t_task_id)
return boolean
with spark_mode => off
is
user_task : ewok.tasks.t_task renames ewok.tasks.tasks_list(task_id);
begin
for i in 1 .. user_task.num_dma_shms loop
if user_task.dma_shm(i).access_type = dma_access and
ptr >= user_task.dma_shm(i).base and
ptr + size >= ptr and
ptr + size <= (user_task.dma_shm(i).base +
user_task.dma_shm(i).size)
then
return true;
end if;
end loop;
return false;
end is_range_in_dma_shm;
end ewok.sanitize;
|
zhmu/ananas | Ada | 433 | adb | -- { dg-do compile }
procedure CPP_Constructor2 is
package P is
type X is tagged limited record
A, B, C, D : Integer;
end record;
pragma Import (Cpp, X);
procedure F1 (V : X);
pragma Import (Cpp, F1);
function F2 return X; -- { dg-error "C\\+\\+ constructor must have external name or link name" }
pragma Cpp_Constructor (F2);
end P;
begin
null;
end CPP_Constructor2;
|
zhmu/ananas | Ada | 4,345 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C A L E N D A R . A R I T H M E T I C --
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-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. --
-- --
------------------------------------------------------------------------------
package body Ada.Calendar.Arithmetic is
--------------------------
-- Implementation Notes --
--------------------------
-- All operations in this package are target and time representation
-- independent, thus only one source file is needed for multiple targets.
---------
-- "+" --
---------
function "+" (Left : Time; Right : Day_Count) return Time is
R : constant Long_Integer := Long_Integer (Right);
begin
return Arithmetic_Operations.Add (Left, R);
end "+";
function "+" (Left : Day_Count; Right : Time) return Time is
L : constant Long_Integer := Long_Integer (Left);
begin
return Arithmetic_Operations.Add (Right, L);
end "+";
---------
-- "-" --
---------
function "-" (Left : Time; Right : Day_Count) return Time is
R : constant Long_Integer := Long_Integer (Right);
begin
return Arithmetic_Operations.Subtract (Left, R);
end "-";
function "-" (Left, Right : Time) return Day_Count is
Days : Long_Integer;
Seconds : Duration;
Leap_Seconds : Integer;
pragma Warnings (Off, Seconds); -- temporary ???
pragma Warnings (Off, Leap_Seconds); -- temporary ???
pragma Unreferenced (Seconds, Leap_Seconds);
begin
Arithmetic_Operations.Difference
(Left, Right, Days, Seconds, Leap_Seconds);
return Day_Count (Days);
end "-";
----------------
-- Difference --
----------------
procedure Difference
(Left : Time;
Right : Time;
Days : out Day_Count;
Seconds : out Duration;
Leap_Seconds : out Leap_Seconds_Count)
is
Op_Days : Long_Integer;
Op_Leaps : Integer;
begin
Arithmetic_Operations.Difference
(Left, Right, Op_Days, Seconds, Op_Leaps);
Days := Day_Count (Op_Days);
Leap_Seconds := Leap_Seconds_Count (Op_Leaps);
end Difference;
end Ada.Calendar.Arithmetic;
|
AdaCore/OpenUxAS | Ada | 8,105 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with DOM.Core; use DOM.Core;
with DOM.Core.Nodes; use DOM.Core.Nodes;
with GNAT.Strings; use GNAT.Strings;
with DOM.Core.Elements;
with GNAT.Command_Line;
with Ctrl_C_Handler;
with UxAS.Common.Configuration_Manager; use UxAS.Common;
with UxAS.Comms.LMCP_Net_Client.Service; use UxAS.Comms.LMCP_Net_Client.Service;
with UxAS.Comms.LMCP_Net_Client.Service.Automation_Request_Validation;
pragma Unreferenced (UxAS.Comms.LMCP_Net_Client.Service.Automation_Request_Validation);
-- need package in closure for sake of package executable part
with UxAS.Comms.LMCP_Net_Client.Service.Route_Aggregation;
pragma Unreferenced (UxAS.Comms.LMCP_Net_Client.Service.Route_Aggregation);
-- need package in closure for sake of package executable part
with UxAS.Comms.LMCP_Net_Client.Service.Assignment_Tree_Branch_Bounding;
pragma Unreferenced (UxAS.Comms.LMCP_Net_Client.Service.Assignment_Tree_Branch_Bounding);
-- need package in closure for sake of package executable part
with UxAS.Comms.LMCP_Net_Client.Service.Example_Spark_Service;
pragma Unreferenced (UxAS.Comms.LMCP_Net_Client.Service.Example_Spark_Service);
-- need package in closure for sake of package executable part
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with UxAS.Common.String_Constant.Lmcp_Network_Socket_Address;
procedure UxAS_Ada is
Successful : Boolean;
New_Service : Any_Service;
XML_Cfg_File_Name : aliased GNAT.Strings.String_Access;
All_Enabled_Services : DOM.Core.Element;
All_Enabled_Bridges : DOM.Core.Element;
From_Msg_Hub, To_Msg_Hub : Unbounded_String;
-- These are the TCP address we use for this separate Ada process
-- to communicate with the UxAS process in C++, taken from the
-- LmcpObjectNetworkPublishPullBridge arguments in the XML file.
procedure Launch_Services (Services : DOM.Core.Element; Successful : out Boolean);
-- Instantiate, configure, initialize, and start each service specified in
-- the configuration XML file. This is what ServiceManager::createService()
-- would do, if implemented.
procedure Get_LMCP_Socket_Addresses
(Bridges : DOM.Core.Element;
Pub_Address : out Unbounded_String;
Pull_Address : out Unbounded_String);
-- Find the LmcpObjectNetworkPublishPullBridge specification in the
-- configuration XML file and get the corresponding TCP addresses to
-- use in package UxAS.Common.String_Constant.Lmcp_Network_Socket_Address.
procedure Get_Config_File_Name with
Global => XML_Cfg_File_Name;
-- Parse the command line for the name of the XML configuration file
-- specifying the names of the services to launch and the TCP addresses
-- to use when communicating with the rest of UxAS
--------------------------
-- Get_Config_File_Name --
--------------------------
procedure Get_Config_File_Name is
use GNAT.Command_Line;
Config : Command_Line_Configuration;
begin
Define_Switch (Config,
XML_Cfg_File_Name'Access,
"-cfgPath:",
Help => "XML configuration file");
Getopt (Config);
if XML_Cfg_File_Name.all = "" then
Display_Help (Config);
end if;
end Get_Config_File_Name;
---------------------
-- Launch_Services --
---------------------
procedure Launch_Services (Services : DOM.Core.Element; Successful : out Boolean) is
Next : DOM.Core.Node;
begin
Next := First_Child (Services);
while Next /= null loop
declare
Service_Type_Name : constant String := DOM.Core.Elements.Get_Attribute (Next, Name => "Type");
begin
New_Service := Instantiate_Service (Service_Type_Name);
if New_Service = null then
Put_Line ("Could not Instantiate_Service for " & Service_Type_Name);
Successful := False;
return;
end if;
New_Service.Configure_Service
(Parent_Of_Work_Directory => Configuration_Manager.Root_Data_Work_Directory,
Service_XML_Node => Next,
Result => Successful);
if not Successful then
Put_Line ("Could not Configure_Service for " & Service_Type_Name);
return;
end if;
New_Service.Initialize_And_Start (Successful);
if not Successful then
Put_Line ("Could not Initialize_And_Start " & Service_Type_Name);
return;
end if;
Put_Line ("Successfully launched " & Service_Type_Name);
Next := Next_Sibling (Next);
end;
end loop;
end Launch_Services;
-------------------------------
-- Get_LMCP_Socket_Addresses --
-------------------------------
procedure Get_LMCP_Socket_Addresses
(Bridges : DOM.Core.Element;
Pub_Address : out Unbounded_String;
Pull_Address : out Unbounded_String)
is
Next : DOM.Core.Node;
begin
Pub_Address := Null_Unbounded_String;
Pull_Address := Null_Unbounded_String;
-- <Bridge Type="LmcpObjectNetworkPublishPullBridge" AddressPUB="tcp://127.0.0.1:5560" AddressPULL="tcp://127.0.0.1:5561">
Next := First_Child (Bridges);
while Next /= null loop
declare
Service_Type_Name : constant String := DOM.Core.Elements.Get_Attribute (Next, Name => "Type");
begin
if Service_Type_Name = "LmcpObjectNetworkPublishPullBridge" then
Pub_Address := To_Unbounded_String (DOM.Core.Elements.Get_Attribute (Next, Name => "AddressPUB"));
Pull_Address := To_Unbounded_String (DOM.Core.Elements.Get_Attribute (Next, Name => "AddressPULL"));
Put_Line ("Found bridge addressPUB: """ & To_String (Pub_Address) & """");
Put_Line ("Found bridge addressPULL: """ & To_String (Pull_Address) & """");
return;
end if;
Next := Next_Sibling (Next);
end;
end loop;
end Get_LMCP_Socket_Addresses;
begin
Ctrl_C_Handler;
Get_Config_File_Name;
if XML_Cfg_File_Name.all = "" then
return; -- we already displayed the help info in the procedure
end if;
Configuration_Manager.Instance.Load_Base_XML_File (XML_Cfg_File_Name.all, Successful);
if not Successful then
Put_Line ("Could not load base XML file '" & XML_Cfg_File_Name.all & "'");
return;
end if;
-- First, search All_Enabled_Bridges for the TCP addresses to use, rather than hard-coding them in
-- package UxAS.Common.String_Constant.Lmcp_Network_Socket_Address
--
-- NOTE: We MUST do this before we launch the services since they will use the addresses in that package...
Configuration_Manager.Instance.Get_Enabled_Bridges (All_Enabled_Bridges, Successful);
if not Successful then
Put_Line ("Could not Get_Enabled_Bridges via config manager");
return;
end if;
Get_LMCP_Socket_Addresses (All_Enabled_Bridges, Pub_Address => From_Msg_Hub, Pull_Address => To_Msg_Hub);
if From_Msg_Hub = Null_Unbounded_String or To_Msg_Hub = Null_Unbounded_String then
Put_Line ("Could not get bridge's two TCP addresses from XML file");
return;
end if;
UxAS.Common.String_Constant.Lmcp_Network_Socket_Address.InProc_From_MessageHub := From_Msg_Hub;
UxAS.Common.String_Constant.Lmcp_Network_Socket_Address.InProc_To_MessageHub := To_Msg_Hub;
-- Now launch the services specified in the config XML file
Configuration_Manager.Instance.Get_Enabled_Services (All_Enabled_Services, Successful);
if not Successful then
Put_Line ("Could not Get_Enabled_Services via config manager");
return;
end if;
Launch_Services (All_Enabled_Services, Successful);
if not Successful then
return;
end if;
Put_Line ("Initialization complete");
exception
when Error : others =>
Put_Line (Exception_Information (Error));
end UxAS_Ada;
|
rtoal/enhanced-dining-philosophers | Ada | 1,153 | ads | ------------------------------------------------------------------------------
-- protected_counters.ads
--
-- This package defines protected type Counter. A counter is basically an in-
-- teger which starts with some initial positive value and is decremented (by
-- 1) by calling tasks. When a task decrements the counter it is informed
-- whether or not it made the counter go to zero. The decrement and test
-- are bound together in a critical section because without this protection,
-- the zero might be missed or discovered by two different tasks!
--
-- Entries:
--
-- Decrement_And_Test_If_Zero (Is_Zero) decrements the counter's value and
-- sets Is_Zero to whether the newly
-- updated value is 0.
------------------------------------------------------------------------------
package Protected_Counters is
protected type Counter (Initial_Value: Positive) is
procedure Decrement_And_Test_If_Zero (Is_Zero: out Boolean);
private
Value: Natural := Initial_Value;
end Counter;
end Protected_Counters;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 16,117 | ads | pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32L0x1.svd
pragma Restrictions (No_Elaboration_Code);
with System;
package STM32_SVD.GPIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- MODER_MODE array element
subtype MODER_MODE_Element is STM32_SVD.UInt2;
-- MODER_MODE array
type MODER_MODE_Field_Array is array (0 .. 15) of MODER_MODE_Element
with Component_Size => 2, Size => 32;
-- GPIO port mode register
type MODER_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MODE as a value
Val : STM32_SVD.UInt32;
when True =>
-- MODE as an array
Arr : MODER_MODE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MODER_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- OTYPER_OT array element
subtype OTYPER_OT_Element is STM32_SVD.Bit;
-- OTYPER_OT array
type OTYPER_OT_Field_Array is array (0 .. 15) of OTYPER_OT_Element
with Component_Size => 1, Size => 16;
-- Type definition for OTYPER_OT
type OTYPER_OT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OT as a value
Val : STM32_SVD.UInt16;
when True =>
-- OT as an array
Arr : OTYPER_OT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for OTYPER_OT_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port output type register
type OTYPER_Register is record
-- Port x configuration bits (y = 0..15)
OT : OTYPER_OT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OTYPER_Register use record
OT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- OSPEEDR_OSPEED array element
subtype OSPEEDR_OSPEED_Element is STM32_SVD.UInt2;
-- OSPEEDR_OSPEED array
type OSPEEDR_OSPEED_Field_Array is array (0 .. 15)
of OSPEEDR_OSPEED_Element
with Component_Size => 2, Size => 32;
-- GPIO port output speed register
type OSPEEDR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OSPEED as a value
Val : STM32_SVD.UInt32;
when True =>
-- OSPEED as an array
Arr : OSPEEDR_OSPEED_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSPEEDR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- PUPDR_PUPD array element
subtype PUPDR_PUPD_Element is STM32_SVD.UInt2;
-- PUPDR_PUPD array
type PUPDR_PUPD_Field_Array is array (0 .. 15) of PUPDR_PUPD_Element
with Component_Size => 2, Size => 32;
-- GPIO port pull-up/pull-down register
type PUPDR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PUPD as a value
Val : STM32_SVD.UInt32;
when True =>
-- PUPD as an array
Arr : PUPDR_PUPD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PUPDR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- IDR_ID array element
subtype IDR_ID_Element is STM32_SVD.Bit;
-- IDR_ID array
type IDR_ID_Field_Array is array (0 .. 15) of IDR_ID_Element
with Component_Size => 1, Size => 16;
-- Type definition for IDR_ID
type IDR_ID_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ID as a value
Val : STM32_SVD.UInt16;
when True =>
-- ID as an array
Arr : IDR_ID_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for IDR_ID_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port input data register
type IDR_Register is record
-- Read-only. Port input data bit (y = 0..15)
ID : IDR_ID_Field;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
ID at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- ODR_OD array element
subtype ODR_OD_Element is STM32_SVD.Bit;
-- ODR_OD array
type ODR_OD_Field_Array is array (0 .. 15) of ODR_OD_Element
with Component_Size => 1, Size => 16;
-- Type definition for ODR_OD
type ODR_OD_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OD as a value
Val : STM32_SVD.UInt16;
when True =>
-- OD as an array
Arr : ODR_OD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for ODR_OD_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port output data register
type ODR_Register is record
-- Port output data bit (y = 0..15)
OD : ODR_OD_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ODR_Register use record
OD at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- BSRR_BS array element
subtype BSRR_BS_Element is STM32_SVD.Bit;
-- BSRR_BS array
type BSRR_BS_Field_Array is array (0 .. 15) of BSRR_BS_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BS
type BSRR_BS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BS as a value
Val : STM32_SVD.UInt16;
when True =>
-- BS as an array
Arr : BSRR_BS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BS_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- BSRR_BR array element
subtype BSRR_BR_Element is STM32_SVD.Bit;
-- BSRR_BR array
type BSRR_BR_Field_Array is array (0 .. 15) of BSRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BR
type BSRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32_SVD.UInt16;
when True =>
-- BR as an array
Arr : BSRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port bit set/reset register
type BSRR_Register is record
-- Write-only. Port x set bit y (y= 0..15)
BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#);
-- Write-only. Port x reset bit y (y = 0..15)
BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BSRR_Register use record
BS at 0 range 0 .. 15;
BR at 0 range 16 .. 31;
end record;
-- LCKR_LCK array element
subtype LCKR_LCK_Element is STM32_SVD.Bit;
-- LCKR_LCK array
type LCKR_LCK_Field_Array is array (0 .. 15) of LCKR_LCK_Element
with Component_Size => 1, Size => 16;
-- Type definition for LCKR_LCK
type LCKR_LCK_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- LCK as a value
Val : STM32_SVD.UInt16;
when True =>
-- LCK as an array
Arr : LCKR_LCK_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for LCKR_LCK_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
subtype LCKR_LCKK_Field is STM32_SVD.Bit;
-- GPIO port configuration lock register
type LCKR_Register is record
-- Port x lock bit y (y= 0..15)
LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#);
-- Port x lock bit y (y= 0..15)
LCKK : LCKR_LCKK_Field := 16#0#;
-- unspecified
Reserved_17_31 : STM32_SVD.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for LCKR_Register use record
LCK at 0 range 0 .. 15;
LCKK at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-- AFRL_AFSEL array element
subtype AFRL_AFSEL_Element is STM32_SVD.UInt4;
-- AFRL_AFSEL array
type AFRL_AFSEL_Field_Array is array (0 .. 7) of AFRL_AFSEL_Element
with Component_Size => 4, Size => 32;
-- GPIO alternate function low register
type AFRL_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AFSEL as a value
Val : STM32_SVD.UInt32;
when True =>
-- AFSEL as an array
Arr : AFRL_AFSEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AFRL_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- AFRH_AFSEL array element
subtype AFRH_AFSEL_Element is STM32_SVD.UInt4;
-- AFRH_AFSEL array
type AFRH_AFSEL_Field_Array is array (8 .. 15) of AFRH_AFSEL_Element
with Component_Size => 4, Size => 32;
-- GPIO alternate function high register
type AFRH_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AFSEL as a value
Val : STM32_SVD.UInt32;
when True =>
-- AFSEL as an array
Arr : AFRH_AFSEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AFRH_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- BRR_BR array element
subtype BRR_BR_Element is STM32_SVD.Bit;
-- BRR_BR array
type BRR_BR_Field_Array is array (0 .. 15) of BRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BRR_BR
type BRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32_SVD.UInt16;
when True =>
-- BR as an array
Arr : BRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port bit reset register
type BRR_Register is record
-- Write-only. Port x Reset bit y (y= 0 .. 15)
BR : BRR_BR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
BR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- General-purpose I/Os
type GPIOA_Peripheral is record
-- GPIO port mode register
MODER : aliased MODER_Register;
-- GPIO port output type register
OTYPER : aliased OTYPER_Register;
-- GPIO port output speed register
OSPEEDR : aliased OSPEEDR_Register;
-- GPIO port pull-up/pull-down register
PUPDR : aliased PUPDR_Register;
-- GPIO port input data register
IDR : aliased IDR_Register;
-- GPIO port output data register
ODR : aliased ODR_Register;
-- GPIO port bit set/reset register
BSRR : aliased BSRR_Register;
-- GPIO port configuration lock register
LCKR : aliased LCKR_Register;
-- GPIO alternate function low register
AFRL : aliased AFRL_Register;
-- GPIO alternate function high register
AFRH : aliased AFRH_Register;
-- GPIO port bit reset register
BRR : aliased BRR_Register;
end record
with Volatile;
for GPIOA_Peripheral use record
MODER at 16#0# range 0 .. 31;
OTYPER at 16#4# range 0 .. 31;
OSPEEDR at 16#8# range 0 .. 31;
PUPDR at 16#C# range 0 .. 31;
IDR at 16#10# range 0 .. 31;
ODR at 16#14# range 0 .. 31;
BSRR at 16#18# range 0 .. 31;
LCKR at 16#1C# range 0 .. 31;
AFRL at 16#20# range 0 .. 31;
AFRH at 16#24# range 0 .. 31;
BRR at 16#28# range 0 .. 31;
end record;
-- General-purpose I/Os
type GPIO_Peripheral is record
-- GPIO port mode register
MODER : aliased MODER_Register;
-- GPIO port output type register
OTYPER : aliased OTYPER_Register;
-- GPIO port output speed register
OSPEEDR : aliased OSPEEDR_Register;
-- GPIO port pull-up/pull-down register
PUPDR : aliased PUPDR_Register;
-- GPIO port input data register
IDR : aliased IDR_Register;
-- GPIO port output data register
ODR : aliased ODR_Register;
-- GPIO port bit set/reset register
BSRR : aliased BSRR_Register;
-- GPIO port configuration lock register
LCKR : aliased LCKR_Register;
-- GPIO alternate function low register
AFRL : aliased AFRL_Register;
-- GPIO alternate function high register
AFRH : aliased AFRH_Register;
-- GPIO port bit reset register
BRR : aliased BRR_Register;
end record
with Volatile;
for GPIO_Peripheral use record
MODER at 16#0# range 0 .. 31;
OTYPER at 16#4# range 0 .. 31;
OSPEEDR at 16#8# range 0 .. 31;
PUPDR at 16#C# range 0 .. 31;
IDR at 16#10# range 0 .. 31;
ODR at 16#14# range 0 .. 31;
BSRR at 16#18# range 0 .. 31;
LCKR at 16#1C# range 0 .. 31;
AFRL at 16#20# range 0 .. 31;
AFRH at 16#24# range 0 .. 31;
BRR at 16#28# range 0 .. 31;
end record;
-- General-purpose I/Os
GPIOA_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOA_Base;
-- General-purpose I/Os
GPIOB_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOB_Base;
-- General-purpose I/Os
GPIOC_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOC_Base;
-- General-purpose I/Os
GPIOD_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOD_Base;
-- General-purpose I/Os
GPIOE_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOE_Base;
-- General-purpose I/Os
GPIOH_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOH_Base;
end STM32_SVD.GPIO;
|
reznikmm/matreshka | Ada | 3,727 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- 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 Interfaces.C;
separate (Matreshka.FastCGI.Server)
function FCGI_Listen_Socket return GNAT.Sockets.Socket_Type is
STD_INPUT_HANDLE : constant := -10;
function GetStdHandle
(nStdHandle : Interfaces.C.int) return GNAT.Sockets.Socket_Type;
pragma Import (Stdcall, GetStdHandle, "GetStdHandle");
begin
return GetStdHandle (STD_INPUT_HANDLE);
end FCGI_Listen_Socket;
|
zhmu/ananas | Ada | 220 | adb | -- { dg-do compile }
procedure Test_Exp is
function X return Boolean is
(Integer'Size = 32) or else (Float'Size = 32); -- { dg-error "expression function must be enclosed in parentheses" }
begin
null;
end;
|
zhmu/ananas | Ada | 9,072 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 1 2 6 --
-- --
-- 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_126 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_126;
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;
-- The following declarations are for the case where the address
-- passed to GetU_126 or SetU_126 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_ClusterU_Ref is access Rev_ClusterU;
------------
-- Get_126 --
------------
function Get_126
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_126
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_126;
-------------
-- GetU_126 --
-------------
function GetU_126
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_126
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_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 GetU_126;
------------
-- Set_126 --
------------
procedure Set_126
(Arr : System.Address;
N : Natural;
E : Bits_126;
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_126;
-------------
-- SetU_126 --
-------------
procedure SetU_126
(Arr : System.Address;
N : Natural;
E : Bits_126;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_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 SetU_126;
end System.Pack_126;
|
hbarrientosg/cs-mp | Ada | 2,737 | adb | with Text_Io,sequential_io,Direct_io;
with Ada.strings.unbounded;
use text_io;
use Ada.strings.unbounded;
procedure practica5 is
Type TDatos is record
Palabra:string(1..15);-- Este el tipo de dato que tiene el fichero de acceso directo
numero:Natural;
end record;
package ficheroSec is new Sequential_Io(positive);-- Declaro los ficheros indice y secuencial y de que estructuras
package ficheroInd is new Direct_io(TDatos);-- se componen ambos ficheros
use FicheroSec,ficheroInd;
-- declaro las variables que voy a utilizar--
Nombre_dat,nombre_ind,Nombre_txt:string(1..50);
Lon_dat,lon_Ind,lon_txt:Natural;
Fichero_dat:FicheroInd.File_type;
fichero_Ind:FicheroSec.File_type;
fichero_Txt:Text_io.File_type;
Dato:Tdatos;
N:Natural;
Linea:unbounded_string:=null_unbounded_string;
begin
-- Pido los nombres de los ficheros por pantalla
put_line("Deme el Nombre del fichero con extencion .ind");
get_line(Nombre_ind,Lon_ind);
put_line("Deme el Nombre del Fichero con extencion .dat");
get_line(Nombre_dat,Lon_dat);
Put_line("Deme el nombre del fichero de texto destino");
get_line(Nombre_txt,Lon_txt);
-- Abro el fichero secuencial y el de acceso directo
open(Fichero_Dat,in_file,Nombre_dat(1..lon_Dat));
open(Fichero_Ind,in_file,Nombre_Ind(1..Lon_ind));
Create(fichero_Txt,out_file,Nombre_Txt(1..lon_Txt));
loop
read(fichero_ind,N);
-- leo en el fichero la posicion
Read(fichero_dat,Dato,Ficheroind.positive_count(N));
-- leo el dato en la posicion que marac el fichero anterior
if index(to_unbounded_string(Dato.Palabra(1..dato.Numero)),".")= dato.Numero then
-- si la palabra tiene el punto al final lo concateno a linea y lo escribo en el fichero
Linea:=Linea & to_unbounded_string(Dato.Palabra(1..dato.Numero));
put_line(Fichero_txt,To_string(Linea));
linea:=null_unbounded_string;
else
--si no entoces lo concateno con un espacio a linea
Linea:=Linea & to_unbounded_string(Dato.Palabra(1..dato.Numero)) & " ";
end if;
exit when end_of_File(fichero_ind);
end loop;
If Length(Linea)/=0 then-- si al final no hay punto entoces le quito el espacio y
--lo escribo en el fichero
Linea:=to_unbounded_string(slice(linea,1,Length(Linea)-1));
put_line(Fichero_txt,To_string(Linea));
end if;
close(Fichero_ind);
Close(Fichero_Dat);--Cierro los ficheros
Close(Fichero_Txt);
exception
when ficheroInd.Name_Error | FicheroSec.name_Error =>
put_line("El nombre del archivo no existe");
when ficheroInd.End_Error | FicheroSec.End_Error =>
put_line("No ha escrito la ruta del archivo");
When FicheroInd.Device_Error | FicheroSec.Device_Error =>
Put_line("No puede Escribir en el dispositivo");
when Others =>
Put_line("Error desconocido");
end Practica5;
|
reznikmm/matreshka | Ada | 4,122 | 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 League.Strings;
with Matreshka.DOM_Attributes;
with Matreshka.DOM_Nodes;
package Matreshka.ODF_XHTML is
type Abstract_XHTML_Attribute_Node is
abstract new Matreshka.DOM_Attributes.Abstract_Attribute_L2_Node with
record
Prefix : League.Strings.Universal_String;
end record;
overriding function Get_Namespace_URI
(Self : not null access constant Abstract_XHTML_Attribute_Node)
return League.Strings.Universal_String;
package Constructors is
procedure Initialize
(Self : not null access Abstract_XHTML_Attribute_Node'Class;
Document : not null Matreshka.DOM_Nodes.Document_Access;
Prefix : League.Strings.Universal_String)
with Inline => True;
end Constructors;
end Matreshka.ODF_XHTML;
|
reznikmm/increment | Ada | 6,219 | adb | -- Copyright (c) 2015-2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Command_Line;
with Ada.Wide_Wide_Text_IO;
with League.Application;
with League.Strings;
with XML.SAX.Input_Sources.Streams.Files;
with XML.SAX.Pretty_Writers;
with XML.SAX.Simple_Readers;
with XML.SAX.String_Output_Destinations;
with XML.Templates.Streams;
with XML.SAX.Writers;
with Incr.Debug;
with Incr.Documents;
with Incr.Lexers.Batch_Lexers;
with Incr.Lexers.Incremental;
with Incr.Nodes.Tokens;
with Incr.Parsers.Incremental;
with Incr.Version_Trees;
with Tests.Commands;
with Tests.Lexers;
with Tests.Parser_Data.XML_Reader;
procedure Tests.Driver is
procedure Dump
(Document : Incr.Documents.Document'Class;
Result : out League.Strings.Universal_String);
function To_String
(Vector : XML.Templates.Streams.XML_Stream_Element_Vectors.Vector)
return League.Strings.Universal_String;
type Provider_Access is access all Tests.Parser_Data.Provider;
History : constant Incr.Version_Trees.Version_Tree_Access :=
new Incr.Version_Trees.Version_Tree;
Document : constant Incr.Documents.Document_Access :=
new Incr.Documents.Document (History);
Provider : constant Provider_Access :=
new Tests.Parser_Data.Provider (Document);
----------
-- Dump --
----------
procedure Dump
(Document : Incr.Documents.Document'Class;
Result : out League.Strings.Universal_String)
is
Output : aliased XML.SAX.String_Output_Destinations.
String_Output_Destination;
Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer;
begin
Writer.Set_Output_Destination (Output'Unchecked_Access);
Writer.Set_Offset (2);
Incr.Debug.Dump (Document, Provider.all, Writer);
Result := Output.Get_Text;
end Dump;
---------------
-- To_String --
---------------
function To_String
(Vector : XML.Templates.Streams.XML_Stream_Element_Vectors.Vector)
return League.Strings.Universal_String
is
use XML.Templates.Streams;
Output : aliased XML.SAX.String_Output_Destinations.
String_Output_Destination;
Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer;
begin
Writer.Set_Output_Destination (Output'Unchecked_Access);
Writer.Set_Offset (2);
Writer.Start_Document;
for V of Vector loop
case V.Kind is
when Start_Element =>
Writer.Start_Element
(Namespace_URI => V.Namespace_URI,
Qualified_Name => V.Qualified_Name,
Local_Name => V.Local_Name,
Attributes => V.Attributes);
when End_Element =>
Writer.End_Element
(Namespace_URI => V.Namespace_URI,
Qualified_Name => V.Qualified_Name,
Local_Name => V.Local_Name);
when Text =>
Writer.Characters (V.Text);
when others =>
null;
end case;
end loop;
Writer.End_Document;
return Output.Get_Text;
end To_String;
Batch_Lexer : constant Incr.Lexers.Batch_Lexers.Batch_Lexer_Access :=
new Tests.Lexers.Test_Lexers.Batch_Lexer;
Incr_Lexer : constant Incr.Lexers.Incremental.Incremental_Lexer_Access :=
new Incr.Lexers.Incremental.Incremental_Lexer;
Incr_Parser : constant Incr.Parsers.Incremental.Incremental_Parser_Access :=
new Incr.Parsers.Incremental.Incremental_Parser;
Ref : Incr.Version_Trees.Version := History.Parent (History.Changing);
Root : Incr.Nodes.Node_Access;
Input : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source;
Reader : XML.SAX.Simple_Readers.Simple_Reader;
Handler : aliased Tests.Parser_Data.XML_Reader.Reader (Provider);
begin
Input.Open_By_File_Name (League.Application.Arguments.Element (1));
Reader.Set_Content_Handler (Handler'Unchecked_Access);
Reader.Set_Input_Source (Input'Unchecked_Access);
Reader.Parse;
if Provider.Part_Counts (2) = 0 then
declare
Kind : Incr.Nodes.Node_Kind;
begin
Provider.Create_Node
(Prod => 2,
Children => (1 .. 0 => <>),
Node => Root,
Kind => Kind);
end;
end if;
Incr.Documents.Constructors.Initialize (Document.all, Root);
Incr_Lexer.Set_Batch_Lexer (Batch_Lexer);
for Command of Handler.Get_Commands loop
case Command.Kind is
when Tests.Commands.Commit =>
Document.Commit;
when Tests.Commands.Set_EOS_Text =>
Document.End_Of_Stream.Set_Text (Command.Text);
when Tests.Commands.Set_Token_Text =>
declare
Token : Incr.Nodes.Tokens.Token_Access :=
Document.Start_Of_Stream;
begin
for J in 2 .. Command.Token loop
Token := Token.Next_Token (History.Changing);
end loop;
Token.Set_Text (Command.Text);
end;
when Tests.Commands.Dump_Tree =>
declare
use type League.Strings.Universal_String;
Text : League.Strings.Universal_String;
Expect : League.Strings.Universal_String;
begin
Dump (Document.all, Text);
Expect := To_String (Command.Dump);
Ada.Wide_Wide_Text_IO.Put_Line
(Text.To_Wide_Wide_String);
if Text /= Expect then
Ada.Wide_Wide_Text_IO.Put_Line ("DOESN'T MATCH!!!");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
end;
when Tests.Commands.Run =>
Incr_Parser.Run
(Lexer => Incr_Lexer,
Provider => Provider.all'Unchecked_Access,
Factory => Provider.all'Unchecked_Access,
Document => Document,
Reference => Ref);
Ref := History.Changing;
end case;
end loop;
end Tests.Driver;
|
charlie5/lace | Ada | 3,726 | adb | with
openGL.Visual,
openGL.Model.Box. colored,
openGL.Model.Box.textured,
openGL.Model.Box.lit_colored_textured,
openGL.Palette,
openGL.Demo;
procedure launch_render_Boxes
--
-- Exercise the rendering of box models.
--
is
use openGL,
openGL.Model,
openGL.Math,
openGL.linear_Algebra_3d;
the_Texture : constant openGL.asset_Name := to_Asset ("assets/opengl/texture/Face1.bmp");
begin
Demo.print_Usage;
Demo.define ("openGL 'Render Boxes' Demo");
Demo.Camera.Position_is ([0.0, 0.0, 10.0],
y_Rotation_from (to_Radians (0.0)));
declare
use openGL.Model.box,
openGL.Palette;
-- The Models.
--
the_Box_1_Model : constant Model.Box.colored.view
:= Model.Box.colored.new_Box
(Size => [1.0, 2.0, 1.0],
Faces => [Front => (Colors => [others => (Blue, Opaque)]),
Rear => (Colors => [others => (Blue, Opaque)]),
Upper => (Colors => [others => (Green, Opaque)]),
Lower => (Colors => [others => (Green, Opaque)]),
Left => (Colors => [others => (Dark_Red, Opaque)]),
Right => (Colors => [others => (Red, Opaque)])]);
the_Box_2_Model : constant Model.Box.lit_colored_textured.view
:= Model.Box.lit_colored_textured.new_Box
(Size => [1.0, 2.0, 1.0],
Faces => [Front => (Colors => [others => (Blue, Opaque)], texture_Name => the_Texture),
Rear => (Colors => [others => (Blue, Opaque)], texture_Name => the_Texture),
Upper => (Colors => [others => (Green, Opaque)], texture_Name => the_Texture),
Lower => (Colors => [others => (Green, Opaque)], texture_Name => the_Texture),
Left => (Colors => [others => (Dark_Red, Opaque)], texture_Name => the_Texture),
Right => (Colors => [others => (Red, Opaque)], texture_Name => the_Texture)]);
the_Box_3_Model : constant Model.Box.textured.view
:= Model.Box.textured.new_Box
(Size => [1.0, 2.0, 1.0],
Faces => [Front => (texture_Name => the_Texture),
Rear => (texture_Name => the_Texture),
Upper => (texture_Name => the_Texture),
Lower => (texture_Name => the_Texture),
Left => (texture_Name => the_Texture),
Right => (texture_Name => the_Texture)]);
-- The Visuals.
--
use openGL.Visual.Forge;
the_Visuals : constant openGL.Visual.views := [1 => new_Visual (the_Box_1_Model.all'Access),
2 => new_Visual (the_Box_2_Model.all'Access),
3 => new_Visual (the_Box_3_Model.all'Access)];
begin
the_Visuals (1).Site_is ([-3.0, 0.0, 0.0]);
the_Visuals (2).Site_is ([ 0.0, 0.0, 0.0]);
the_Visuals (3).Site_is ([ 3.0, 0.0, 0.0]);
-- Main loop.
--
while not Demo.Done
loop
-- Handle user commands.
--
Demo.Dolly.evolve;
Demo.Done := Demo.Dolly.quit_Requested;
-- Render the sprites.
--
Demo.Camera.render (the_Visuals);
while not Demo.Camera.cull_Completed
loop
delay Duration'Small;
end loop;
Demo.Renderer.render;
Demo.FPS_Counter.increment; -- Frames per second display.
end loop;
end;
Demo.destroy;
end launch_render_Boxes;
|
faelys/natools | Ada | 2,045 | ads | ------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.S_Expressions.Printers.Pretty.Cofnig.Tests provides a test suite --
-- S-expression serialization and deserialization of pretty printer --
-- parameters. --
------------------------------------------------------------------------------
with Natools.Tests;
package Natools.S_Expressions.Printers.Pretty.Config.Tests is
pragma Preelaborate (Tests);
package NT renames Natools.Tests;
procedure All_Tests (Report : in out NT.Reporter'Class);
procedure Hash_Function_Test (Report : in out NT.Reporter'Class);
procedure Read_Test (Report : in out NT.Reporter'Class);
procedure Write_Test (Report : in out NT.Reporter'Class);
end Natools.S_Expressions.Printers.Pretty.Config.Tests;
|
AdaCore/libadalang | Ada | 63 | adb | procedure Main is
begin
--% node.p_valid_keywords
end Main;
|
reznikmm/matreshka | Ada | 4,599 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Text_Path_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Text_Path_Attribute_Node is
begin
return Self : Draw_Text_Path_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Text_Path_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Text_Path_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Text_Path_Attribute,
Draw_Text_Path_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Text_Path_Attributes;
|
zhmu/ananas | Ada | 529 | ads | package Opt18_Pkg is
pragma Pure;
type Limit_Type is record
Low : Float;
High : Float;
end record;
function First_Order_Trig return Float;
type Trig_Pair_Type is
record
Sin : Float;
Cos : Float;
end record;
function Atan2 (Trig : in Trig_Pair_Type) return Float;
function Unchecked_Trig_Pair (Sin, Cos : in Float) return Trig_Pair_Type;
function Double_Trig (Trig : in Trig_Pair_Type) return Trig_Pair_Type;
function Sqrt (X : Float) return Float;
end Opt18_Pkg;
|
reznikmm/matreshka | Ada | 4,632 | 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_Table.Member_Count_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Member_Count_Attribute_Node is
begin
return Self : Table_Member_Count_Attribute_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Member_Count_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Member_Count_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Member_Count_Attribute,
Table_Member_Count_Attribute_Node'Tag);
end Matreshka.ODF_Table.Member_Count_Attributes;
|
PThierry/ewok-kernel | Ada | 4,238 | 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 m4.mpu;
with m4.scb;
package ewok.mpu
with spark_mode => on
is
type t_region_type is
(REGION_TYPE_KERN_CODE,
REGION_TYPE_KERN_DATA,
REGION_TYPE_KERN_DEVICES,
REGION_TYPE_USER_CODE,
REGION_TYPE_USER_DATA,
REGION_TYPE_USER_DEV,
REGION_TYPE_USER_DEV_RO,
REGION_TYPE_ISR_STACK)
with size => 32;
KERN_CODE_REGION : constant m4.mpu.t_region_number := 0;
KERN_DEVICES_REGION : constant m4.mpu.t_region_number := 1;
KERN_DATA_REGION : constant m4.mpu.t_region_number := 2;
USER_CODE_REGION : constant m4.mpu.t_region_number := 3; -- USER_TXT
USER_DATA_REGION : constant m4.mpu.t_region_number := 4; -- USER_RAM
USER_DATA_SHARED_REGION : constant m4.mpu.t_region_number := 5;
USER_FREE_1_REGION : constant m4.mpu.t_region_number := 6;
USER_FREE_2_REGION : constant m4.mpu.t_region_number := 7;
---------------
-- Functions --
---------------
pragma assertion_policy (pre => IGNORE, post => IGNORE, assert => IGNORE);
-- Initialize the MPU
procedure init
(success : out boolean)
with global => (in_out => (m4.mpu.MPU, m4.scb.SCB));
--
-- Utilities so that the kernel can temporary access the whole memory space
--
procedure enable_unrestricted_kernel_access
with
global => (in_out => (m4.mpu.MPU));
procedure disable_unrestricted_kernel_access
with
global => (in_out => (m4.mpu.MPU));
-- That function is only used by SPARK prover
function get_region_size_mask (size : m4.mpu.t_region_size) return unsigned_32
is (2**(natural (size) + 1) - 1)
with ghost;
pragma warnings
(off, "condition can only be False if invalid values present");
procedure set_region
(region_number : in m4.mpu.t_region_number;
addr : in system_address;
size : in m4.mpu.t_region_size;
region_type : in t_region_type;
subregion_mask : in unsigned_8)
with
global => (in_out => (m4.mpu.MPU)),
pre =>
(region_number < 8
and
(addr and 2#11111#) = 0
and
size >= 4
and
(addr and get_region_size_mask(size)) = 0);
pragma warnings (on);
procedure update_subregions
(region_number : in m4.mpu.t_region_number;
subregion_mask : in unsigned_8)
with
global => (in_out => (m4.mpu.MPU));
procedure bytes_to_region_size
(bytes : in unsigned_32;
region_size : out m4.mpu.t_region_size;
success : out boolean)
with global => null;
-------------------------------
-- Pool of available regions --
-------------------------------
type t_region_entry is record
used : boolean := false; -- is region used?
addr : system_address; -- base address
end record;
regions_pool : array
(m4.mpu.t_region_number range USER_FREE_1_REGION .. USER_FREE_2_REGION)
of t_region_entry
:= (others => (false, 0));
function can_be_mapped return boolean;
procedure map
(addr : in system_address;
size : in unsigned_32;
region_type : in ewok.mpu.t_region_type;
subregion_mask : in unsigned_8;
success : out boolean);
procedure unmap
(addr : in system_address);
procedure unmap_all;
end ewok.mpu;
|
zhmu/ananas | Ada | 360 | adb | with Ada.Streams; use Ada.Streams;
package body Inline20_G is
package body Nested_G is
procedure Get (Data : T; Into : out Offset_Type) is
begin
Into := (T'Descriptor_Size + Data'Size) / Standard'Storage_Unit;
end;
function F return Integer is
begin
return 0;
end;
end Nested_G;
end Inline20_G;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 85,270 | ads | -- This spec has been automatically generated from STM32F0xx.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.TIM is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_CEN_Field is STM32_SVD.Bit;
subtype CR1_UDIS_Field is STM32_SVD.Bit;
subtype CR1_URS_Field is STM32_SVD.Bit;
subtype CR1_OPM_Field is STM32_SVD.Bit;
subtype CR1_DIR_Field is STM32_SVD.Bit;
subtype CR1_CMS_Field is STM32_SVD.UInt2;
subtype CR1_ARPE_Field is STM32_SVD.Bit;
subtype CR1_CKD_Field is STM32_SVD.UInt2;
-- control register 1
type CR1_Register is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- One-pulse mode
OPM : CR1_OPM_Field := 16#0#;
-- Direction
DIR : CR1_DIR_Field := 16#0#;
-- Center-aligned mode selection
CMS : CR1_CMS_Field := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- Clock division
CKD : CR1_CKD_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
OPM at 0 range 3 .. 3;
DIR at 0 range 4 .. 4;
CMS at 0 range 5 .. 6;
ARPE at 0 range 7 .. 7;
CKD at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype CR2_CCPC_Field is STM32_SVD.Bit;
subtype CR2_CCUS_Field is STM32_SVD.Bit;
subtype CR2_CCDS_Field is STM32_SVD.Bit;
subtype CR2_MMS_Field is STM32_SVD.UInt3;
subtype CR2_TI1S_Field is STM32_SVD.Bit;
subtype CR2_OIS1_Field is STM32_SVD.Bit;
subtype CR2_OIS1N_Field is STM32_SVD.Bit;
subtype CR2_OIS2_Field is STM32_SVD.Bit;
subtype CR2_OIS2N_Field is STM32_SVD.Bit;
subtype CR2_OIS3_Field is STM32_SVD.Bit;
subtype CR2_OIS3N_Field is STM32_SVD.Bit;
subtype CR2_OIS4_Field is STM32_SVD.Bit;
-- control register 2
type CR2_Register is record
-- Capture/compare preloaded control
CCPC : CR2_CCPC_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : CR2_CCUS_Field := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- TI1 selection
TI1S : CR2_TI1S_Field := 16#0#;
-- Output Idle state 1
OIS1 : CR2_OIS1_Field := 16#0#;
-- Output Idle state 1
OIS1N : CR2_OIS1N_Field := 16#0#;
-- Output Idle state 2
OIS2 : CR2_OIS2_Field := 16#0#;
-- Output Idle state 2
OIS2N : CR2_OIS2N_Field := 16#0#;
-- Output Idle state 3
OIS3 : CR2_OIS3_Field := 16#0#;
-- Output Idle state 3
OIS3N : CR2_OIS3N_Field := 16#0#;
-- Output Idle state 4
OIS4 : CR2_OIS4_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
CCPC at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CCUS at 0 range 2 .. 2;
CCDS at 0 range 3 .. 3;
MMS at 0 range 4 .. 6;
TI1S at 0 range 7 .. 7;
OIS1 at 0 range 8 .. 8;
OIS1N at 0 range 9 .. 9;
OIS2 at 0 range 10 .. 10;
OIS2N at 0 range 11 .. 11;
OIS3 at 0 range 12 .. 12;
OIS3N at 0 range 13 .. 13;
OIS4 at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype SMCR_SMS_Field is STM32_SVD.UInt3;
subtype SMCR_TS_Field is STM32_SVD.UInt3;
subtype SMCR_MSM_Field is STM32_SVD.Bit;
subtype SMCR_ETF_Field is STM32_SVD.UInt4;
subtype SMCR_ETPS_Field is STM32_SVD.UInt2;
subtype SMCR_ECE_Field is STM32_SVD.Bit;
subtype SMCR_ETP_Field is STM32_SVD.Bit;
-- slave mode control register
type SMCR_Register is record
-- Slave mode selection
SMS : SMCR_SMS_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Trigger selection
TS : SMCR_TS_Field := 16#0#;
-- Master/Slave mode
MSM : SMCR_MSM_Field := 16#0#;
-- External trigger filter
ETF : SMCR_ETF_Field := 16#0#;
-- External trigger prescaler
ETPS : SMCR_ETPS_Field := 16#0#;
-- External clock enable
ECE : SMCR_ECE_Field := 16#0#;
-- External trigger polarity
ETP : SMCR_ETP_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SMCR_Register use record
SMS at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TS at 0 range 4 .. 6;
MSM at 0 range 7 .. 7;
ETF at 0 range 8 .. 11;
ETPS at 0 range 12 .. 13;
ECE at 0 range 14 .. 14;
ETP at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DIER_UIE_Field is STM32_SVD.Bit;
subtype DIER_CC1IE_Field is STM32_SVD.Bit;
subtype DIER_CC2IE_Field is STM32_SVD.Bit;
subtype DIER_CC3IE_Field is STM32_SVD.Bit;
subtype DIER_CC4IE_Field is STM32_SVD.Bit;
subtype DIER_COMIE_Field is STM32_SVD.Bit;
subtype DIER_TIE_Field is STM32_SVD.Bit;
subtype DIER_BIE_Field is STM32_SVD.Bit;
subtype DIER_UDE_Field is STM32_SVD.Bit;
subtype DIER_CC1DE_Field is STM32_SVD.Bit;
subtype DIER_CC2DE_Field is STM32_SVD.Bit;
subtype DIER_CC3DE_Field is STM32_SVD.Bit;
subtype DIER_CC4DE_Field is STM32_SVD.Bit;
subtype DIER_COMDE_Field is STM32_SVD.Bit;
subtype DIER_TDE_Field is STM32_SVD.Bit;
-- DMA/Interrupt enable register
type DIER_Register is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- Capture/Compare 2 interrupt enable
CC2IE : DIER_CC2IE_Field := 16#0#;
-- Capture/Compare 3 interrupt enable
CC3IE : DIER_CC3IE_Field := 16#0#;
-- Capture/Compare 4 interrupt enable
CC4IE : DIER_CC4IE_Field := 16#0#;
-- COM interrupt enable
COMIE : DIER_COMIE_Field := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- Break interrupt enable
BIE : DIER_BIE_Field := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- Capture/Compare 2 DMA request enable
CC2DE : DIER_CC2DE_Field := 16#0#;
-- Capture/Compare 3 DMA request enable
CC3DE : DIER_CC3DE_Field := 16#0#;
-- Capture/Compare 4 DMA request enable
CC4DE : DIER_CC4DE_Field := 16#0#;
-- Reserved
COMDE : DIER_COMDE_Field := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
CC2IE at 0 range 2 .. 2;
CC3IE at 0 range 3 .. 3;
CC4IE at 0 range 4 .. 4;
COMIE at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
BIE at 0 range 7 .. 7;
UDE at 0 range 8 .. 8;
CC1DE at 0 range 9 .. 9;
CC2DE at 0 range 10 .. 10;
CC3DE at 0 range 11 .. 11;
CC4DE at 0 range 12 .. 12;
COMDE at 0 range 13 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype SR_UIF_Field is STM32_SVD.Bit;
subtype SR_CC1IF_Field is STM32_SVD.Bit;
subtype SR_CC2IF_Field is STM32_SVD.Bit;
subtype SR_CC3IF_Field is STM32_SVD.Bit;
subtype SR_CC4IF_Field is STM32_SVD.Bit;
subtype SR_COMIF_Field is STM32_SVD.Bit;
subtype SR_TIF_Field is STM32_SVD.Bit;
subtype SR_BIF_Field is STM32_SVD.Bit;
subtype SR_CC1OF_Field is STM32_SVD.Bit;
subtype SR_CC2OF_Field is STM32_SVD.Bit;
subtype SR_CC3OF_Field is STM32_SVD.Bit;
subtype SR_CC4OF_Field is STM32_SVD.Bit;
-- status register
type SR_Register is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- Capture/Compare 2 interrupt flag
CC2IF : SR_CC2IF_Field := 16#0#;
-- Capture/Compare 3 interrupt flag
CC3IF : SR_CC3IF_Field := 16#0#;
-- Capture/Compare 4 interrupt flag
CC4IF : SR_CC4IF_Field := 16#0#;
-- COM interrupt flag
COMIF : SR_COMIF_Field := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- Break interrupt flag
BIF : SR_BIF_Field := 16#0#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- Capture/compare 2 overcapture flag
CC2OF : SR_CC2OF_Field := 16#0#;
-- Capture/Compare 3 overcapture flag
CC3OF : SR_CC3OF_Field := 16#0#;
-- Capture/Compare 4 overcapture flag
CC4OF : SR_CC4OF_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
CC2IF at 0 range 2 .. 2;
CC3IF at 0 range 3 .. 3;
CC4IF at 0 range 4 .. 4;
COMIF at 0 range 5 .. 5;
TIF at 0 range 6 .. 6;
BIF at 0 range 7 .. 7;
Reserved_8_8 at 0 range 8 .. 8;
CC1OF at 0 range 9 .. 9;
CC2OF at 0 range 10 .. 10;
CC3OF at 0 range 11 .. 11;
CC4OF at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype EGR_UG_Field is STM32_SVD.Bit;
subtype EGR_CC1G_Field is STM32_SVD.Bit;
subtype EGR_CC2G_Field is STM32_SVD.Bit;
subtype EGR_CC3G_Field is STM32_SVD.Bit;
subtype EGR_CC4G_Field is STM32_SVD.Bit;
subtype EGR_COMG_Field is STM32_SVD.Bit;
subtype EGR_TG_Field is STM32_SVD.Bit;
subtype EGR_BG_Field is STM32_SVD.Bit;
-- event generation register
type EGR_Register is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- Write-only. Capture/compare 2 generation
CC2G : EGR_CC2G_Field := 16#0#;
-- Write-only. Capture/compare 3 generation
CC3G : EGR_CC3G_Field := 16#0#;
-- Write-only. Capture/compare 4 generation
CC4G : EGR_CC4G_Field := 16#0#;
-- Write-only. Capture/Compare control update generation
COMG : EGR_COMG_Field := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- Write-only. Break generation
BG : EGR_BG_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
CC3G at 0 range 3 .. 3;
CC4G at 0 range 4 .. 4;
COMG at 0 range 5 .. 5;
TG at 0 range 6 .. 6;
BG at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CCMR1_Output_CC1S_Field is STM32_SVD.UInt2;
subtype CCMR1_Output_OC1FE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC1PE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC1M_Field is STM32_SVD.UInt3;
subtype CCMR1_Output_OC1CE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_CC2S_Field is STM32_SVD.UInt2;
subtype CCMR1_Output_OC2FE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC2PE_Field is STM32_SVD.Bit;
subtype CCMR1_Output_OC2M_Field is STM32_SVD.UInt3;
subtype CCMR1_Output_OC2CE_Field is STM32_SVD.Bit;
-- capture/compare mode register (output mode)
type CCMR1_Output_Register is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Output_CC1S_Field := 16#0#;
-- Output Compare 1 fast enable
OC1FE : CCMR1_Output_OC1FE_Field := 16#0#;
-- Output Compare 1 preload enable
OC1PE : CCMR1_Output_OC1PE_Field := 16#0#;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- Output Compare 1 clear enable
OC1CE : CCMR1_Output_OC1CE_Field := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Output_CC2S_Field := 16#0#;
-- Output Compare 2 fast enable
OC2FE : CCMR1_Output_OC2FE_Field := 16#0#;
-- Output Compare 2 preload enable
OC2PE : CCMR1_Output_OC2PE_Field := 16#0#;
-- Output Compare 2 mode
OC2M : CCMR1_Output_OC2M_Field := 16#0#;
-- Output Compare 2 clear enable
OC2CE : CCMR1_Output_OC2CE_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Output_Register use record
CC1S at 0 range 0 .. 1;
OC1FE at 0 range 2 .. 2;
OC1PE at 0 range 3 .. 3;
OC1M at 0 range 4 .. 6;
OC1CE at 0 range 7 .. 7;
CC2S at 0 range 8 .. 9;
OC2FE at 0 range 10 .. 10;
OC2PE at 0 range 11 .. 11;
OC2M at 0 range 12 .. 14;
OC2CE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCMR1_Input_CC1S_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC1PCS_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC1F_Field is STM32_SVD.UInt4;
subtype CCMR1_Input_CC2S_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC2PCS_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC2F_Field is STM32_SVD.UInt4;
-- capture/compare mode register 1 (input mode)
type CCMR1_Input_Register is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
IC1PCS : CCMR1_Input_IC1PCS_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_Field := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Input_CC2S_Field := 16#0#;
-- Input capture 2 prescaler
IC2PCS : CCMR1_Input_IC2PCS_Field := 16#0#;
-- Input capture 2 filter
IC2F : CCMR1_Input_IC2F_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Input_Register use record
CC1S at 0 range 0 .. 1;
IC1PCS at 0 range 2 .. 3;
IC1F at 0 range 4 .. 7;
CC2S at 0 range 8 .. 9;
IC2PCS at 0 range 10 .. 11;
IC2F at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCMR2_Output_CC3S_Field is STM32_SVD.UInt2;
subtype CCMR2_Output_OC3FE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC3PE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC3M_Field is STM32_SVD.UInt3;
subtype CCMR2_Output_OC3CE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_CC4S_Field is STM32_SVD.UInt2;
subtype CCMR2_Output_OC4FE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC4PE_Field is STM32_SVD.Bit;
subtype CCMR2_Output_OC4M_Field is STM32_SVD.UInt3;
subtype CCMR2_Output_OC4CE_Field is STM32_SVD.Bit;
-- capture/compare mode register (output mode)
type CCMR2_Output_Register is record
-- Capture/Compare 3 selection
CC3S : CCMR2_Output_CC3S_Field := 16#0#;
-- Output compare 3 fast enable
OC3FE : CCMR2_Output_OC3FE_Field := 16#0#;
-- Output compare 3 preload enable
OC3PE : CCMR2_Output_OC3PE_Field := 16#0#;
-- Output compare 3 mode
OC3M : CCMR2_Output_OC3M_Field := 16#0#;
-- Output compare 3 clear enable
OC3CE : CCMR2_Output_OC3CE_Field := 16#0#;
-- Capture/Compare 4 selection
CC4S : CCMR2_Output_CC4S_Field := 16#0#;
-- Output compare 4 fast enable
OC4FE : CCMR2_Output_OC4FE_Field := 16#0#;
-- Output compare 4 preload enable
OC4PE : CCMR2_Output_OC4PE_Field := 16#0#;
-- Output compare 4 mode
OC4M : CCMR2_Output_OC4M_Field := 16#0#;
-- Output compare 4 clear enable
OC4CE : CCMR2_Output_OC4CE_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR2_Output_Register use record
CC3S at 0 range 0 .. 1;
OC3FE at 0 range 2 .. 2;
OC3PE at 0 range 3 .. 3;
OC3M at 0 range 4 .. 6;
OC3CE at 0 range 7 .. 7;
CC4S at 0 range 8 .. 9;
OC4FE at 0 range 10 .. 10;
OC4PE at 0 range 11 .. 11;
OC4M at 0 range 12 .. 14;
OC4CE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCMR2_Input_CC3S_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC3PSC_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC3F_Field is STM32_SVD.UInt4;
subtype CCMR2_Input_CC4S_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC4PSC_Field is STM32_SVD.UInt2;
subtype CCMR2_Input_IC4F_Field is STM32_SVD.UInt4;
-- capture/compare mode register 2 (input mode)
type CCMR2_Input_Register is record
-- Capture/compare 3 selection
CC3S : CCMR2_Input_CC3S_Field := 16#0#;
-- Input capture 3 prescaler
IC3PSC : CCMR2_Input_IC3PSC_Field := 16#0#;
-- Input capture 3 filter
IC3F : CCMR2_Input_IC3F_Field := 16#0#;
-- Capture/Compare 4 selection
CC4S : CCMR2_Input_CC4S_Field := 16#0#;
-- Input capture 4 prescaler
IC4PSC : CCMR2_Input_IC4PSC_Field := 16#0#;
-- Input capture 4 filter
IC4F : CCMR2_Input_IC4F_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR2_Input_Register use record
CC3S at 0 range 0 .. 1;
IC3PSC at 0 range 2 .. 3;
IC3F at 0 range 4 .. 7;
CC4S at 0 range 8 .. 9;
IC4PSC at 0 range 10 .. 11;
IC4F at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCER_CC1E_Field is STM32_SVD.Bit;
subtype CCER_CC1P_Field is STM32_SVD.Bit;
subtype CCER_CC1NE_Field is STM32_SVD.Bit;
subtype CCER_CC1NP_Field is STM32_SVD.Bit;
subtype CCER_CC2E_Field is STM32_SVD.Bit;
subtype CCER_CC2P_Field is STM32_SVD.Bit;
subtype CCER_CC2NE_Field is STM32_SVD.Bit;
subtype CCER_CC2NP_Field is STM32_SVD.Bit;
subtype CCER_CC3E_Field is STM32_SVD.Bit;
subtype CCER_CC3P_Field is STM32_SVD.Bit;
subtype CCER_CC3NE_Field is STM32_SVD.Bit;
subtype CCER_CC3NP_Field is STM32_SVD.Bit;
subtype CCER_CC4E_Field is STM32_SVD.Bit;
subtype CCER_CC4P_Field is STM32_SVD.Bit;
-- capture/compare enable register
type CCER_Register is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- Capture/Compare 1 complementary output enable
CC1NE : CCER_CC1NE_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- Capture/Compare 2 output enable
CC2E : CCER_CC2E_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2P : CCER_CC2P_Field := 16#0#;
-- Capture/Compare 2 complementary output enable
CC2NE : CCER_CC2NE_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : CCER_CC2NP_Field := 16#0#;
-- Capture/Compare 3 output enable
CC3E : CCER_CC3E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC3P : CCER_CC3P_Field := 16#0#;
-- Capture/Compare 3 complementary output enable
CC3NE : CCER_CC3NE_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC3NP : CCER_CC3NP_Field := 16#0#;
-- Capture/Compare 4 output enable
CC4E : CCER_CC4E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC4P : CCER_CC4P_Field := 16#0#;
-- unspecified
Reserved_14_31 : STM32_SVD.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
CC1NE at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
CC2E at 0 range 4 .. 4;
CC2P at 0 range 5 .. 5;
CC2NE at 0 range 6 .. 6;
CC2NP at 0 range 7 .. 7;
CC3E at 0 range 8 .. 8;
CC3P at 0 range 9 .. 9;
CC3NE at 0 range 10 .. 10;
CC3NP at 0 range 11 .. 11;
CC4E at 0 range 12 .. 12;
CC4P at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
subtype CNT_CNT_Field is STM32_SVD.UInt16;
-- counter
type CNT_Register is record
-- counter value
CNT : CNT_CNT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNT_Register use record
CNT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype PSC_PSC_Field is STM32_SVD.UInt16;
-- prescaler
type PSC_Register is record
-- Prescaler value
PSC : PSC_PSC_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PSC_Register use record
PSC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype ARR_ARR_Field is STM32_SVD.UInt16;
-- auto-reload register
type ARR_Register is record
-- Auto-reload value
ARR : ARR_ARR_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ARR_Register use record
ARR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype RCR_REP_Field is STM32_SVD.Byte;
-- repetition counter register
type RCR_Register is record
-- Repetition counter value
REP : RCR_REP_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RCR_Register use record
REP at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CCR1_CCR1_Field is STM32_SVD.UInt16;
-- capture/compare register 1
type CCR1_Register is record
-- Capture/Compare 1 value
CCR1 : CCR1_CCR1_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR1_Register use record
CCR1 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCR2_CCR2_Field is STM32_SVD.UInt16;
-- capture/compare register 2
type CCR2_Register is record
-- Capture/Compare 2 value
CCR2 : CCR2_CCR2_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR2_Register use record
CCR2 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCR3_CCR3_Field is STM32_SVD.UInt16;
-- capture/compare register 3
type CCR3_Register is record
-- Capture/Compare 3 value
CCR3 : CCR3_CCR3_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR3_Register use record
CCR3 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCR4_CCR4_Field is STM32_SVD.UInt16;
-- capture/compare register 4
type CCR4_Register is record
-- Capture/Compare 3 value
CCR4 : CCR4_CCR4_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR4_Register use record
CCR4 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype BDTR_DTG_Field is STM32_SVD.Byte;
subtype BDTR_LOCK_Field is STM32_SVD.UInt2;
subtype BDTR_OSSI_Field is STM32_SVD.Bit;
subtype BDTR_OSSR_Field is STM32_SVD.Bit;
subtype BDTR_BKE_Field is STM32_SVD.Bit;
subtype BDTR_BKP_Field is STM32_SVD.Bit;
subtype BDTR_AOE_Field is STM32_SVD.Bit;
subtype BDTR_MOE_Field is STM32_SVD.Bit;
-- break and dead-time register
type BDTR_Register is record
-- Dead-time generator setup
DTG : BDTR_DTG_Field := 16#0#;
-- Lock configuration
LOCK : BDTR_LOCK_Field := 16#0#;
-- Off-state selection for Idle mode
OSSI : BDTR_OSSI_Field := 16#0#;
-- Off-state selection for Run mode
OSSR : BDTR_OSSR_Field := 16#0#;
-- Break enable
BKE : BDTR_BKE_Field := 16#0#;
-- Break polarity
BKP : BDTR_BKP_Field := 16#0#;
-- Automatic output enable
AOE : BDTR_AOE_Field := 16#0#;
-- Main output enable
MOE : BDTR_MOE_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BDTR_Register use record
DTG at 0 range 0 .. 7;
LOCK at 0 range 8 .. 9;
OSSI at 0 range 10 .. 10;
OSSR at 0 range 11 .. 11;
BKE at 0 range 12 .. 12;
BKP at 0 range 13 .. 13;
AOE at 0 range 14 .. 14;
MOE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DCR_DBA_Field is STM32_SVD.UInt5;
subtype DCR_DBL_Field is STM32_SVD.UInt5;
-- DMA control register
type DCR_Register is record
-- DMA base address
DBA : DCR_DBA_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- DMA burst length
DBL : DCR_DBL_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCR_Register use record
DBA at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
DBL at 0 range 8 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype DMAR_DMAB_Field is STM32_SVD.UInt16;
-- DMA address for full transfer
type DMAR_Register is record
-- DMA register for burst accesses
DMAB : DMAR_DMAB_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DMAR_Register use record
DMAB at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register 2
type CR2_Register_1 is record
-- unspecified
Reserved_0_2 : STM32_SVD.UInt3 := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- TI1 selection
TI1S : CR2_TI1S_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_1 use record
Reserved_0_2 at 0 range 0 .. 2;
CCDS at 0 range 3 .. 3;
MMS at 0 range 4 .. 6;
TI1S at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_1 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- Capture/Compare 2 interrupt enable
CC2IE : DIER_CC2IE_Field := 16#0#;
-- Capture/Compare 3 interrupt enable
CC3IE : DIER_CC3IE_Field := 16#0#;
-- Capture/Compare 4 interrupt enable
CC4IE : DIER_CC4IE_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- Capture/Compare 2 DMA request enable
CC2DE : DIER_CC2DE_Field := 16#0#;
-- Capture/Compare 3 DMA request enable
CC3DE : DIER_CC3DE_Field := 16#0#;
-- Capture/Compare 4 DMA request enable
CC4DE : DIER_CC4DE_Field := 16#0#;
-- Reserved
COMDE : DIER_COMDE_Field := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_1 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
CC2IE at 0 range 2 .. 2;
CC3IE at 0 range 3 .. 3;
CC4IE at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
UDE at 0 range 8 .. 8;
CC1DE at 0 range 9 .. 9;
CC2DE at 0 range 10 .. 10;
CC3DE at 0 range 11 .. 11;
CC4DE at 0 range 12 .. 12;
COMDE at 0 range 13 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register_1 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- Capture/Compare 2 interrupt flag
CC2IF : SR_CC2IF_Field := 16#0#;
-- Capture/Compare 3 interrupt flag
CC3IF : SR_CC3IF_Field := 16#0#;
-- Capture/Compare 4 interrupt flag
CC4IF : SR_CC4IF_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- unspecified
Reserved_7_8 : STM32_SVD.UInt2 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- Capture/compare 2 overcapture flag
CC2OF : SR_CC2OF_Field := 16#0#;
-- Capture/Compare 3 overcapture flag
CC3OF : SR_CC3OF_Field := 16#0#;
-- Capture/Compare 4 overcapture flag
CC4OF : SR_CC4OF_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_1 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
CC2IF at 0 range 2 .. 2;
CC3IF at 0 range 3 .. 3;
CC4IF at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TIF at 0 range 6 .. 6;
Reserved_7_8 at 0 range 7 .. 8;
CC1OF at 0 range 9 .. 9;
CC2OF at 0 range 10 .. 10;
CC3OF at 0 range 11 .. 11;
CC4OF at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- event generation register
type EGR_Register_1 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- Write-only. Capture/compare 2 generation
CC2G : EGR_CC2G_Field := 16#0#;
-- Write-only. Capture/compare 3 generation
CC3G : EGR_CC3G_Field := 16#0#;
-- Write-only. Capture/compare 4 generation
CC4G : EGR_CC4G_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_1 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
CC3G at 0 range 3 .. 3;
CC4G at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TG at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
subtype CCMR1_Input_IC1PSC_Field is STM32_SVD.UInt2;
subtype CCMR1_Input_IC2PSC_Field is STM32_SVD.UInt2;
-- capture/compare mode register 1 (input mode)
type CCMR1_Input_Register_1 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
IC1PSC : CCMR1_Input_IC1PSC_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_Field := 16#0#;
-- Capture/compare 2 selection
CC2S : CCMR1_Input_CC2S_Field := 16#0#;
-- Input capture 2 prescaler
IC2PSC : CCMR1_Input_IC2PSC_Field := 16#0#;
-- Input capture 2 filter
IC2F : CCMR1_Input_IC2F_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Input_Register_1 use record
CC1S at 0 range 0 .. 1;
IC1PSC at 0 range 2 .. 3;
IC1F at 0 range 4 .. 7;
CC2S at 0 range 8 .. 9;
IC2PSC at 0 range 10 .. 11;
IC2F at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CCER_CC4NP_Field is STM32_SVD.Bit;
-- capture/compare enable register
type CCER_Register_1 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- unspecified
Reserved_2_2 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- Capture/Compare 2 output enable
CC2E : CCER_CC2E_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2P : CCER_CC2P_Field := 16#0#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : CCER_CC2NP_Field := 16#0#;
-- Capture/Compare 3 output enable
CC3E : CCER_CC3E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC3P : CCER_CC3P_Field := 16#0#;
-- unspecified
Reserved_10_10 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 3 output Polarity
CC3NP : CCER_CC3NP_Field := 16#0#;
-- Capture/Compare 4 output enable
CC4E : CCER_CC4E_Field := 16#0#;
-- Capture/Compare 3 output Polarity
CC4P : CCER_CC4P_Field := 16#0#;
-- unspecified
Reserved_14_14 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 4 output Polarity
CC4NP : CCER_CC4NP_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_1 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
CC2E at 0 range 4 .. 4;
CC2P at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
CC2NP at 0 range 7 .. 7;
CC3E at 0 range 8 .. 8;
CC3P at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
CC3NP at 0 range 11 .. 11;
CC4E at 0 range 12 .. 12;
CC4P at 0 range 13 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
CC4NP at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CNT_CNT_L_Field is STM32_SVD.UInt16;
subtype CNT_CNT_H_Field is STM32_SVD.UInt16;
-- counter
type CNT_Register_1 is record
-- Low counter value
CNT_L : CNT_CNT_L_Field := 16#0#;
-- High counter value (TIM2 only)
CNT_H : CNT_CNT_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNT_Register_1 use record
CNT_L at 0 range 0 .. 15;
CNT_H at 0 range 16 .. 31;
end record;
subtype ARR_ARR_L_Field is STM32_SVD.UInt16;
subtype ARR_ARR_H_Field is STM32_SVD.UInt16;
-- auto-reload register
type ARR_Register_1 is record
-- Low Auto-reload value
ARR_L : ARR_ARR_L_Field := 16#0#;
-- High Auto-reload value (TIM2 only)
ARR_H : ARR_ARR_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ARR_Register_1 use record
ARR_L at 0 range 0 .. 15;
ARR_H at 0 range 16 .. 31;
end record;
subtype CCR1_CCR1_L_Field is STM32_SVD.UInt16;
subtype CCR1_CCR1_H_Field is STM32_SVD.UInt16;
-- capture/compare register 1
type CCR1_Register_1 is record
-- Low Capture/Compare 1 value
CCR1_L : CCR1_CCR1_L_Field := 16#0#;
-- High Capture/Compare 1 value (TIM2 only)
CCR1_H : CCR1_CCR1_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR1_Register_1 use record
CCR1_L at 0 range 0 .. 15;
CCR1_H at 0 range 16 .. 31;
end record;
subtype CCR2_CCR2_L_Field is STM32_SVD.UInt16;
subtype CCR2_CCR2_H_Field is STM32_SVD.UInt16;
-- capture/compare register 2
type CCR2_Register_1 is record
-- Low Capture/Compare 2 value
CCR2_L : CCR2_CCR2_L_Field := 16#0#;
-- High Capture/Compare 2 value (TIM2 only)
CCR2_H : CCR2_CCR2_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR2_Register_1 use record
CCR2_L at 0 range 0 .. 15;
CCR2_H at 0 range 16 .. 31;
end record;
subtype CCR3_CCR3_L_Field is STM32_SVD.UInt16;
subtype CCR3_CCR3_H_Field is STM32_SVD.UInt16;
-- capture/compare register 3
type CCR3_Register_1 is record
-- Low Capture/Compare value
CCR3_L : CCR3_CCR3_L_Field := 16#0#;
-- High Capture/Compare value (TIM2 only)
CCR3_H : CCR3_CCR3_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR3_Register_1 use record
CCR3_L at 0 range 0 .. 15;
CCR3_H at 0 range 16 .. 31;
end record;
subtype CCR4_CCR4_L_Field is STM32_SVD.UInt16;
subtype CCR4_CCR4_H_Field is STM32_SVD.UInt16;
-- capture/compare register 4
type CCR4_Register_1 is record
-- Low Capture/Compare value
CCR4_L : CCR4_CCR4_L_Field := 16#0#;
-- High Capture/Compare value (TIM2 only)
CCR4_H : CCR4_CCR4_H_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR4_Register_1 use record
CCR4_L at 0 range 0 .. 15;
CCR4_H at 0 range 16 .. 31;
end record;
subtype DMAR_DMAR_Field is STM32_SVD.UInt16;
-- DMA address for full transfer
type DMAR_Register_1 is record
-- DMA register for burst accesses
DMAR : DMAR_DMAR_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DMAR_Register_1 use record
DMAR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register 1
type CR1_Register_1 is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- One-pulse mode
OPM : CR1_OPM_Field := 16#0#;
-- unspecified
Reserved_4_6 : STM32_SVD.UInt3 := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register_1 use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
OPM at 0 range 3 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
ARPE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- control register 2
type CR2_Register_2 is record
-- unspecified
Reserved_0_3 : STM32_SVD.UInt4 := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_2 use record
Reserved_0_3 at 0 range 0 .. 3;
MMS at 0 range 4 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_2 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- unspecified
Reserved_1_7 : STM32_SVD.UInt7 := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- unspecified
Reserved_9_31 : STM32_SVD.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_2 use record
UIE at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
UDE at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- status register
type SR_Register_2 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- unspecified
Reserved_1_31 : STM32_SVD.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_2 use record
UIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- event generation register
type EGR_Register_2 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- unspecified
Reserved_1_31 : STM32_SVD.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_2 use record
UG at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- control register 1
type CR1_Register_2 is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- unspecified
Reserved_3_6 : STM32_SVD.UInt4 := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- Clock division
CKD : CR1_CKD_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register_2 use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
ARPE at 0 range 7 .. 7;
CKD at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_3 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_3 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- status register
type SR_Register_3 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- unspecified
Reserved_2_8 : STM32_SVD.UInt7 := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_3 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
Reserved_2_8 at 0 range 2 .. 8;
CC1OF at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- event generation register
type EGR_Register_3 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_3 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- capture/compare mode register (output mode)
type CCMR1_Output_Register_1 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Output_CC1S_Field := 16#0#;
-- Output compare 1 fast enable
OC1FE : CCMR1_Output_OC1FE_Field := 16#0#;
-- Output Compare 1 preload enable
OC1PE : CCMR1_Output_OC1PE_Field := 16#0#;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Output_Register_1 use record
CC1S at 0 range 0 .. 1;
OC1FE at 0 range 2 .. 2;
OC1PE at 0 range 3 .. 3;
OC1M at 0 range 4 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- capture/compare mode register (input mode)
type CCMR1_Input_Register_2 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Input_CC1S_Field := 16#0#;
-- Input capture 1 prescaler
IC1PSC : CCMR1_Input_IC1PSC_Field := 16#0#;
-- Input capture 1 filter
IC1F : CCMR1_Input_IC1F_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Input_Register_2 use record
CC1S at 0 range 0 .. 1;
IC1PSC at 0 range 2 .. 3;
IC1F at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- capture/compare enable register
type CCER_Register_2 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- unspecified
Reserved_2_2 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- unspecified
Reserved_4_31 : STM32_SVD.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_2 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype OR_RMP_Field is STM32_SVD.UInt2;
-- option register
type OR_Register is record
-- Timer input 1 remap
RMP : OR_RMP_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register use record
RMP at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- control register 1
type CR1_Register_3 is record
-- Counter enable
CEN : CR1_CEN_Field := 16#0#;
-- Update disable
UDIS : CR1_UDIS_Field := 16#0#;
-- Update request source
URS : CR1_URS_Field := 16#0#;
-- One-pulse mode
OPM : CR1_OPM_Field := 16#0#;
-- unspecified
Reserved_4_6 : STM32_SVD.UInt3 := 16#0#;
-- Auto-reload preload enable
ARPE : CR1_ARPE_Field := 16#0#;
-- Clock division
CKD : CR1_CKD_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register_3 use record
CEN at 0 range 0 .. 0;
UDIS at 0 range 1 .. 1;
URS at 0 range 2 .. 2;
OPM at 0 range 3 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
ARPE at 0 range 7 .. 7;
CKD at 0 range 8 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- control register 2
type CR2_Register_3 is record
-- Capture/compare preloaded control
CCPC : CR2_CCPC_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : CR2_CCUS_Field := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- Master mode selection
MMS : CR2_MMS_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Output Idle state 1
OIS1 : CR2_OIS1_Field := 16#0#;
-- Output Idle state 1
OIS1N : CR2_OIS1N_Field := 16#0#;
-- Output Idle state 2
OIS2 : CR2_OIS2_Field := 16#0#;
-- unspecified
Reserved_11_31 : STM32_SVD.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_3 use record
CCPC at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CCUS at 0 range 2 .. 2;
CCDS at 0 range 3 .. 3;
MMS at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
OIS1 at 0 range 8 .. 8;
OIS1N at 0 range 9 .. 9;
OIS2 at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-- slave mode control register
type SMCR_Register_1 is record
-- Slave mode selection
SMS : SMCR_SMS_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Trigger selection
TS : SMCR_TS_Field := 16#0#;
-- Master/Slave mode
MSM : SMCR_MSM_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SMCR_Register_1 use record
SMS at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TS at 0 range 4 .. 6;
MSM at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_4 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- Capture/Compare 2 interrupt enable
CC2IE : DIER_CC2IE_Field := 16#0#;
-- unspecified
Reserved_3_4 : STM32_SVD.UInt2 := 16#0#;
-- COM interrupt enable
COMIE : DIER_COMIE_Field := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- Break interrupt enable
BIE : DIER_BIE_Field := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- Capture/Compare 2 DMA request enable
CC2DE : DIER_CC2DE_Field := 16#0#;
-- unspecified
Reserved_11_13 : STM32_SVD.UInt3 := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_4 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
CC2IE at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
COMIE at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
BIE at 0 range 7 .. 7;
UDE at 0 range 8 .. 8;
CC1DE at 0 range 9 .. 9;
CC2DE at 0 range 10 .. 10;
Reserved_11_13 at 0 range 11 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register_4 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- Capture/Compare 2 interrupt flag
CC2IF : SR_CC2IF_Field := 16#0#;
-- unspecified
Reserved_3_4 : STM32_SVD.UInt2 := 16#0#;
-- COM interrupt flag
COMIF : SR_COMIF_Field := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- Break interrupt flag
BIF : SR_BIF_Field := 16#0#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- Capture/compare 2 overcapture flag
CC2OF : SR_CC2OF_Field := 16#0#;
-- unspecified
Reserved_11_31 : STM32_SVD.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_4 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
CC2IF at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
COMIF at 0 range 5 .. 5;
TIF at 0 range 6 .. 6;
BIF at 0 range 7 .. 7;
Reserved_8_8 at 0 range 8 .. 8;
CC1OF at 0 range 9 .. 9;
CC2OF at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-- event generation register
type EGR_Register_4 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- Write-only. Capture/compare 2 generation
CC2G : EGR_CC2G_Field := 16#0#;
-- unspecified
Reserved_3_4 : STM32_SVD.UInt2 := 16#0#;
-- Write-only. Capture/Compare control update generation
COMG : EGR_COMG_Field := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- Write-only. Break generation
BG : EGR_BG_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_4 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
CC2G at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
COMG at 0 range 5 .. 5;
TG at 0 range 6 .. 6;
BG at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- capture/compare mode register (output mode)
type CCMR1_Output_Register_2 is record
-- Capture/Compare 1 selection
CC1S : CCMR1_Output_CC1S_Field := 16#0#;
-- Output Compare 1 fast enable
OC1FE : CCMR1_Output_OC1FE_Field := 16#0#;
-- Output Compare 1 preload enable
OC1PE : CCMR1_Output_OC1PE_Field := 16#0#;
-- Output Compare 1 mode
OC1M : CCMR1_Output_OC1M_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 2 selection
CC2S : CCMR1_Output_CC2S_Field := 16#0#;
-- Output Compare 2 fast enable
OC2FE : CCMR1_Output_OC2FE_Field := 16#0#;
-- Output Compare 2 preload enable
OC2PE : CCMR1_Output_OC2PE_Field := 16#0#;
-- Output Compare 2 mode
OC2M : CCMR1_Output_OC2M_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCMR1_Output_Register_2 use record
CC1S at 0 range 0 .. 1;
OC1FE at 0 range 2 .. 2;
OC1PE at 0 range 3 .. 3;
OC1M at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CC2S at 0 range 8 .. 9;
OC2FE at 0 range 10 .. 10;
OC2PE at 0 range 11 .. 11;
OC2M at 0 range 12 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- capture/compare enable register
type CCER_Register_3 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- Capture/Compare 1 complementary output enable
CC1NE : CCER_CC1NE_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- Capture/Compare 2 output enable
CC2E : CCER_CC2E_Field := 16#0#;
-- Capture/Compare 2 output Polarity
CC2P : CCER_CC2P_Field := 16#0#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 2 output Polarity
CC2NP : CCER_CC2NP_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_3 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
CC1NE at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
CC2E at 0 range 4 .. 4;
CC2P at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
CC2NP at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- control register 2
type CR2_Register_4 is record
-- Capture/compare preloaded control
CCPC : CR2_CCPC_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Capture/compare control update selection
CCUS : CR2_CCUS_Field := 16#0#;
-- Capture/compare DMA selection
CCDS : CR2_CCDS_Field := 16#0#;
-- unspecified
Reserved_4_7 : STM32_SVD.UInt4 := 16#0#;
-- Output Idle state 1
OIS1 : CR2_OIS1_Field := 16#0#;
-- Output Idle state 1
OIS1N : CR2_OIS1N_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_4 use record
CCPC at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CCUS at 0 range 2 .. 2;
CCDS at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
OIS1 at 0 range 8 .. 8;
OIS1N at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- DMA/Interrupt enable register
type DIER_Register_5 is record
-- Update interrupt enable
UIE : DIER_UIE_Field := 16#0#;
-- Capture/Compare 1 interrupt enable
CC1IE : DIER_CC1IE_Field := 16#0#;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- COM interrupt enable
COMIE : DIER_COMIE_Field := 16#0#;
-- Trigger interrupt enable
TIE : DIER_TIE_Field := 16#0#;
-- Break interrupt enable
BIE : DIER_BIE_Field := 16#0#;
-- Update DMA request enable
UDE : DIER_UDE_Field := 16#0#;
-- Capture/Compare 1 DMA request enable
CC1DE : DIER_CC1DE_Field := 16#0#;
-- unspecified
Reserved_10_13 : STM32_SVD.UInt4 := 16#0#;
-- Trigger DMA request enable
TDE : DIER_TDE_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIER_Register_5 use record
UIE at 0 range 0 .. 0;
CC1IE at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 4;
COMIE at 0 range 5 .. 5;
TIE at 0 range 6 .. 6;
BIE at 0 range 7 .. 7;
UDE at 0 range 8 .. 8;
CC1DE at 0 range 9 .. 9;
Reserved_10_13 at 0 range 10 .. 13;
TDE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register_5 is record
-- Update interrupt flag
UIF : SR_UIF_Field := 16#0#;
-- Capture/compare 1 interrupt flag
CC1IF : SR_CC1IF_Field := 16#0#;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- COM interrupt flag
COMIF : SR_COMIF_Field := 16#0#;
-- Trigger interrupt flag
TIF : SR_TIF_Field := 16#0#;
-- Break interrupt flag
BIF : SR_BIF_Field := 16#0#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Capture/Compare 1 overcapture flag
CC1OF : SR_CC1OF_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_5 use record
UIF at 0 range 0 .. 0;
CC1IF at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 4;
COMIF at 0 range 5 .. 5;
TIF at 0 range 6 .. 6;
BIF at 0 range 7 .. 7;
Reserved_8_8 at 0 range 8 .. 8;
CC1OF at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- event generation register
type EGR_Register_5 is record
-- Write-only. Update generation
UG : EGR_UG_Field := 16#0#;
-- Write-only. Capture/compare 1 generation
CC1G : EGR_CC1G_Field := 16#0#;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- Write-only. Capture/Compare control update generation
COMG : EGR_COMG_Field := 16#0#;
-- Write-only. Trigger generation
TG : EGR_TG_Field := 16#0#;
-- Write-only. Break generation
BG : EGR_BG_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EGR_Register_5 use record
UG at 0 range 0 .. 0;
CC1G at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 4;
COMG at 0 range 5 .. 5;
TG at 0 range 6 .. 6;
BG at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- capture/compare enable register
type CCER_Register_4 is record
-- Capture/Compare 1 output enable
CC1E : CCER_CC1E_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1P : CCER_CC1P_Field := 16#0#;
-- Capture/Compare 1 complementary output enable
CC1NE : CCER_CC1NE_Field := 16#0#;
-- Capture/Compare 1 output Polarity
CC1NP : CCER_CC1NP_Field := 16#0#;
-- unspecified
Reserved_4_31 : STM32_SVD.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCER_Register_4 use record
CC1E at 0 range 0 .. 0;
CC1P at 0 range 1 .. 1;
CC1NE at 0 range 2 .. 2;
CC1NP at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type TIM1_Disc is
(
Output,
Input);
-- Advanced-timers
type TIM1_Peripheral
(Discriminent : TIM1_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register;
-- slave mode control register
SMCR : aliased SMCR_Register;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register;
-- status register
SR : aliased SR_Register;
-- event generation register
EGR : aliased EGR_Register;
-- capture/compare enable register
CCER : aliased CCER_Register;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- repetition counter register
RCR : aliased RCR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- capture/compare register 2
CCR2 : aliased CCR2_Register;
-- capture/compare register 3
CCR3 : aliased CCR3_Register;
-- capture/compare register 4
CCR4 : aliased CCR4_Register;
-- break and dead-time register
BDTR : aliased BDTR_Register;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register (output mode)
CCMR2_Output : aliased CCMR2_Output_Register;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register;
-- capture/compare mode register 2 (input mode)
CCMR2_Input : aliased CCMR2_Input_Register;
end case;
end record
with Unchecked_Union, Volatile;
for TIM1_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
RCR at 16#30# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCR3 at 16#3C# range 0 .. 31;
CCR4 at 16#40# range 0 .. 31;
BDTR at 16#44# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR2_Output at 16#1C# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
CCMR2_Input at 16#1C# range 0 .. 31;
end record;
-- Advanced-timers
TIM1_Periph : aliased TIM1_Peripheral
with Import, Address => System'To_Address (16#40012C00#);
type TIM2_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM2_Peripheral
(Discriminent : TIM2_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register_1;
-- slave mode control register
SMCR : aliased SMCR_Register;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_1;
-- status register
SR : aliased SR_Register_1;
-- event generation register
EGR : aliased EGR_Register_1;
-- capture/compare enable register
CCER : aliased CCER_Register_1;
-- counter
CNT : aliased CNT_Register_1;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register_1;
-- capture/compare register 1
CCR1 : aliased CCR1_Register_1;
-- capture/compare register 2
CCR2 : aliased CCR2_Register_1;
-- capture/compare register 3
CCR3 : aliased CCR3_Register_1;
-- capture/compare register 4
CCR4 : aliased CCR4_Register_1;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register_1;
case Discriminent is
when Output =>
-- capture/compare mode register 1 (output mode)
CCMR1_Output : aliased CCMR1_Output_Register;
-- capture/compare mode register 2 (output mode)
CCMR2_Output : aliased CCMR2_Output_Register;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_1;
-- capture/compare mode register 2 (input mode)
CCMR2_Input : aliased CCMR2_Input_Register;
end case;
end record
with Unchecked_Union, Volatile;
for TIM2_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
CCR3 at 16#3C# range 0 .. 31;
CCR4 at 16#40# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR2_Output at 16#1C# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
CCMR2_Input at 16#1C# range 0 .. 31;
end record;
-- General-purpose-timers
TIM2_Periph : aliased TIM2_Peripheral
with Import, Address => System'To_Address (16#40000000#);
-- General-purpose-timers
TIM3_Periph : aliased TIM2_Peripheral
with Import, Address => System'To_Address (16#40000400#);
-- Basic-timers
type TIM6_Peripheral is record
-- control register 1
CR1 : aliased CR1_Register_1;
-- control register 2
CR2 : aliased CR2_Register_2;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_2;
-- status register
SR : aliased SR_Register_2;
-- event generation register
EGR : aliased EGR_Register_2;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
end record
with Volatile;
for TIM6_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
end record;
-- Basic-timers
TIM6_Periph : aliased TIM6_Peripheral
with Import, Address => System'To_Address (16#40001000#);
type TIM14_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM14_Peripheral
(Discriminent : TIM14_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_2;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_3;
-- status register
SR : aliased SR_Register_3;
-- event generation register
EGR : aliased EGR_Register_3;
-- capture/compare enable register
CCER : aliased CCER_Register_2;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- option register
OR_k : aliased OR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_1;
when Input =>
-- capture/compare mode register (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_2;
end case;
end record
with Unchecked_Union, Volatile;
for TIM14_Peripheral use record
CR1 at 16#0# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
OR_k at 16#50# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM14_Periph : aliased TIM14_Peripheral
with Import, Address => System'To_Address (16#40002000#);
type TIM15_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM15_Peripheral
(Discriminent : TIM15_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_3;
-- control register 2
CR2 : aliased CR2_Register_3;
-- slave mode control register
SMCR : aliased SMCR_Register_1;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_4;
-- status register
SR : aliased SR_Register_4;
-- event generation register
EGR : aliased EGR_Register_4;
-- capture/compare enable register
CCER : aliased CCER_Register_3;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- repetition counter register
RCR : aliased RCR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- capture/compare register 2
CCR2 : aliased CCR2_Register;
-- break and dead-time register
BDTR : aliased BDTR_Register;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_2;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_1;
end case;
end record
with Unchecked_Union, Volatile;
for TIM15_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SMCR at 16#8# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
RCR at 16#30# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
CCR2 at 16#38# range 0 .. 31;
BDTR at 16#44# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM15_Periph : aliased TIM15_Peripheral
with Import, Address => System'To_Address (16#40014000#);
type TIM16_Disc is
(
Output,
Input);
-- General-purpose-timers
type TIM16_Peripheral
(Discriminent : TIM16_Disc := Output)
is record
-- control register 1
CR1 : aliased CR1_Register_3;
-- control register 2
CR2 : aliased CR2_Register_4;
-- DMA/Interrupt enable register
DIER : aliased DIER_Register_5;
-- status register
SR : aliased SR_Register_5;
-- event generation register
EGR : aliased EGR_Register_5;
-- capture/compare enable register
CCER : aliased CCER_Register_4;
-- counter
CNT : aliased CNT_Register;
-- prescaler
PSC : aliased PSC_Register;
-- auto-reload register
ARR : aliased ARR_Register;
-- repetition counter register
RCR : aliased RCR_Register;
-- capture/compare register 1
CCR1 : aliased CCR1_Register;
-- break and dead-time register
BDTR : aliased BDTR_Register;
-- DMA control register
DCR : aliased DCR_Register;
-- DMA address for full transfer
DMAR : aliased DMAR_Register;
case Discriminent is
when Output =>
-- capture/compare mode register (output mode)
CCMR1_Output : aliased CCMR1_Output_Register_1;
when Input =>
-- capture/compare mode register 1 (input mode)
CCMR1_Input : aliased CCMR1_Input_Register_2;
end case;
end record
with Unchecked_Union, Volatile;
for TIM16_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
DIER at 16#C# range 0 .. 31;
SR at 16#10# range 0 .. 31;
EGR at 16#14# range 0 .. 31;
CCER at 16#20# range 0 .. 31;
CNT at 16#24# range 0 .. 31;
PSC at 16#28# range 0 .. 31;
ARR at 16#2C# range 0 .. 31;
RCR at 16#30# range 0 .. 31;
CCR1 at 16#34# range 0 .. 31;
BDTR at 16#44# range 0 .. 31;
DCR at 16#48# range 0 .. 31;
DMAR at 16#4C# range 0 .. 31;
CCMR1_Output at 16#18# range 0 .. 31;
CCMR1_Input at 16#18# range 0 .. 31;
end record;
-- General-purpose-timers
TIM16_Periph : aliased TIM16_Peripheral
with Import, Address => System'To_Address (16#40014400#);
-- General-purpose-timers
TIM17_Periph : aliased TIM16_Peripheral
with Import, Address => System'To_Address (16#40014800#);
end STM32_SVD.TIM;
|
stcarrez/ada-asf | Ada | 8,163 | adb | -----------------------------------------------------------------------
-- applications-main-configs -- Configuration support for ASF Applications
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Util.Serialize.IO.XML;
with EL.Functions.Namespaces;
with ASF.Navigations;
with ASF.Navigations.Mappers;
with Servlet.Core.Mappers;
with ASF.Servlets.Faces.Mappers;
with ASF.Beans.Mappers;
with ASF.Views.Nodes.Core;
package body ASF.Applications.Main.Configs is
use Util.Log;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("ASF.Applications.Main.Configs");
function Get_Locale (Value : in Util.Beans.Objects.Object) return Util.Locales.Locale;
function Get_Locale (Value : in Util.Beans.Objects.Object) return Util.Locales.Locale is
Name : constant String := Util.Beans.Objects.To_String (Value);
Locale : constant Util.Locales.Locale := Util.Locales.Get_Locale (Name);
begin
return Locale;
end Get_Locale;
-- ------------------------------
-- Save in the application config object the value associated with the given field.
-- When the <b>TAG_MESSAGE_BUNDLE</b> field is reached, insert the new bundle definition
-- in the application.
-- ------------------------------
procedure Set_Member (N : in out Application_Config;
Field : in Application_Fields;
Value : in Util.Beans.Objects.Object) is
begin
case Field is
when TAG_MESSAGE_VAR =>
N.Name := Value;
when TAG_MESSAGE_BUNDLE =>
declare
Bundle : constant String := Util.Beans.Objects.To_String (Value);
begin
if Util.Beans.Objects.Is_Null (N.Name) then
N.App.Register (Name => Bundle & "Msg",
Bundle => Bundle);
else
N.App.Register (Name => Util.Beans.Objects.To_String (N.Name),
Bundle => Bundle);
end if;
N.Name := Util.Beans.Objects.Null_Object;
end;
when TAG_DEFAULT_LOCALE =>
N.App.Set_Default_Locale (Get_Locale (Value));
when TAG_SUPPORTED_LOCALE =>
N.App.Add_Supported_Locale (Get_Locale (Value));
end case;
end Set_Member;
AMapper : aliased Application_Mapper.Mapper;
-- ------------------------------
-- Setup the XML parser to read the managed bean definitions.
-- By instantiating this package, the <b>Reader</b> gets populated with the XML mappings
-- to read the servlet, managed beans and navigation rules.
-- ------------------------------
package body Reader_Config is
procedure Set_Property_Context (Params : in Util.Properties.Manager'Class);
-- Get the navigation handler for the Navigation_Config instantiation
-- GNAT crashes if the call is made in the instantiation part.
Nav : constant ASF.Navigations.Navigation_Handler_Access := App.Get_Navigation_Handler;
package Bean_Config is
new ASF.Beans.Mappers.Reader_Config (Mapper, App.Factory'Access,
Context.all'Access);
package Navigation_Config is
new ASF.Navigations.Mappers.Reader_Config (Mapper, Nav, Context.all'Access);
package Servlet_Config is
new Servlet.Core.Mappers.Reader_Config (Mapper, App.all'Access,
Context.all'Access);
package Faces_Config is
new ASF.Servlets.Faces.Mappers.Reader_Config (Mapper, App.all'Access,
Context.all'Access);
pragma Warnings (Off, Bean_Config);
pragma Warnings (Off, Navigation_Config);
pragma Warnings (Off, Faces_Config);
Config : aliased Application_Config;
NS_Mapper : aliased EL.Functions.Namespaces.NS_Function_Mapper;
procedure Set_Property_Context (Params : in Util.Properties.Manager'Class) is
begin
Prop_Context.Set_Properties (Params);
end Set_Property_Context;
begin
-- Install the property context that gives access
-- to the application configuration properties
App.Get_Init_Parameters (Set_Property_Context'Access);
Context.Set_Resolver (Prop_Context'Unchecked_Access);
-- Setup the function mapper to resolve uses of functions within EL expressions.
NS_Mapper.Set_Namespace (Prefix => "fn",
URI => ASF.Views.Nodes.Core.FN_URI);
NS_Mapper.Set_Function_Mapper (App.Functions'Unchecked_Access);
Context.Set_Function_Mapper (NS_Mapper'Unchecked_Access);
Mapper.Add_Mapping ("faces-config", AMapper'Access);
Mapper.Add_Mapping ("module", AMapper'Access);
Mapper.Add_Mapping ("web-app", AMapper'Access);
Config.App := App;
Servlet_Config.Config.Override_Context := Override_Context;
Application_Mapper.Set_Context (Mapper, Config'Unchecked_Access);
end Reader_Config;
-- ------------------------------
-- Read the configuration file associated with the application. This includes:
-- <ul>
-- <li>The servlet and filter mappings</li>
-- <li>The managed bean definitions</li>
-- <li>The navigation rules</li>
-- </ul>
-- ------------------------------
procedure Read_Configuration (App : in out Application'Class;
File : in String) is
Reader : Util.Serialize.IO.XML.Parser;
Mapper : Util.Serialize.Mappers.Processing;
Context : aliased EL.Contexts.Default.Default_Context;
-- Setup the <b>Reader</b> to parse and build the configuration for managed beans,
-- navigation rules, servlet rules. Each package instantiation creates a local variable
-- used while parsing the XML file.
package Config is
new Reader_Config (Mapper, App'Unchecked_Access, Context'Unchecked_Access);
pragma Warnings (Off, Config);
begin
Log.Info ("Reading module configuration file {0}", File);
-- Util.Serialize.IO.Dump (Reader, AWA.Modules.Log);
-- Read the configuration file and record managed beans, navigation rules.
Reader.Parse (File, Mapper);
end Read_Configuration;
-- ------------------------------
-- Create the configuration parameter definition instance.
-- ------------------------------
package body Parameter is
PARAM_NAME : aliased constant String := Name;
PARAM_VALUE : aliased constant String := Default;
Param : constant Config_Param := ASF.Applications.P '(Name => PARAM_NAME'Access,
Default => PARAM_VALUE'Access);
-- ------------------------------
-- Returns the configuration parameter.
-- ------------------------------
function P return Config_Param is
begin
return Param;
end P;
end Parameter;
begin
AMapper.Add_Mapping ("application/message-bundle/@var", TAG_MESSAGE_VAR);
AMapper.Add_Mapping ("application/message-bundle", TAG_MESSAGE_BUNDLE);
AMapper.Add_Mapping ("application/locale-config/default-locale", TAG_DEFAULT_LOCALE);
AMapper.Add_Mapping ("application/locale-config/supported-locale", TAG_SUPPORTED_LOCALE);
end ASF.Applications.Main.Configs;
|
reznikmm/matreshka | Ada | 4,728 | 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_Style.Border_Line_Width_Bottom_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Border_Line_Width_Bottom_Attribute_Node is
begin
return Self : Style_Border_Line_Width_Bottom_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Border_Line_Width_Bottom_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Border_Line_Width_Bottom_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Border_Line_Width_Bottom_Attribute,
Style_Border_Line_Width_Bottom_Attribute_Node'Tag);
end Matreshka.ODF_Style.Border_Line_Width_Bottom_Attributes;
|
zhmu/ananas | Ada | 111 | ads | -- { dg-do compile }
package Access1 is
type R;
type S is access R;
type R is new S;
end Access1;
|
stcarrez/etherscope | Ada | 2,747 | ads | -----------------------------------------------------------------------
-- etherscope-analyzer-igmp -- IGMP packet analyzer
-- Copyright (C) 2016 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.Real_Time;
with Net.Buffers;
with EtherScope.Stats;
-- === IGMP Analysis ===
-- The IGMP analysis looks at multicast group submissions and remember which multicast
-- group was subscribed. It also identifies the multicast traffic and associate it to
-- the IGMP group. The analyzer identifies when a host subscribes to a multicast group
-- and when the group is left.
--
-- The implementation is able to remember only one subscriber.
package EtherScope.Analyzer.IGMP is
subtype Group_Index is EtherScope.Stats.Group_Index;
-- Collect per source IGMP group statistics.
type Group_Stats is record
-- The IPv4 group address.
Ip : Net.Ip_Addr := (0, 0, 0, 0);
-- Time of the last report.
Last_Report : Ada.Real_Time.Time;
-- Number of membership reports seen so far.
Report_Count : Natural := 0;
-- UDP flow statistics associated with the group.
UDP : EtherScope.Stats.Statistics;
end record;
type Group_Table_Stats is array (Group_Index) of Group_Stats;
-- IGMP packet and associated traffic analysis.
type Analysis is record
Groups : Group_Table_Stats;
Count : EtherScope.Stats.Group_Count := 0;
end record;
-- Analyze the IGMP packet and update the analysis.
procedure Analyze (Packet : in Net.Buffers.Buffer_Type;
Result : in out Analysis);
-- Analyze the UDP multicast packet and update the analysis.
procedure Analyze_Traffic (Packet : in Net.Buffers.Buffer_Type;
Result : in out Analysis);
-- Compute the bandwidth utilization for different devices and protocols.
procedure Update_Rates (Current : in out Analysis;
Previous : in out Analysis;
Dt : in Positive);
end EtherScope.Analyzer.IGMP;
|
charlie5/aIDE | Ada | 1,080 | ads | with
AdaM.Any,
Ada.Containers.Vectors,
Ada.Streams;
package AdaM.Subunit
is
type Item is new Any.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- Forge
--
function new_Subprogram return Subunit.view;
procedure free (Self : in out Subunit.view);
procedure destruct (Self : in out Subunit.item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
private
type Item is new Any.item with
record
null;
end record;
end AdaM.Subunit;
|
AdaCore/Ada_Drivers_Library | Ada | 31,103 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f429xx.h --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides declarations for devices on the STM32F42xx MCUs
-- manufactured by ST Microelectronics. For example, an STM32F429.
with STM32_SVD; use STM32_SVD;
with STM32_SVD.SDIO;
with STM32.DMA; use STM32.DMA;
with STM32.GPIO; use STM32.GPIO;
with STM32.ADC; use STM32.ADC;
with STM32.USARTs; use STM32.USARTs;
with STM32.SPI; use STM32.SPI;
with STM32.SPI.DMA; use STM32.SPI.DMA;
with STM32.I2S; use STM32.I2S;
with STM32.I2C; use STM32.I2C;
with STM32.I2C.DMA; use STM32.I2C.DMA;
with STM32.Timers; use STM32.Timers;
with STM32.DAC; use STM32.DAC;
with STM32.RTC; use STM32.RTC;
with STM32.CRC; use STM32.CRC;
with STM32.SDMMC; use STM32.SDMMC;
package STM32.Device is
pragma Elaborate_Body;
Unknown_Device : exception;
-- Raised by the routines below for a device passed as an actual parameter
-- when that device is not present on the given hardware instance.
procedure Enable_Clock (This : aliased in out GPIO_Port)
with Inline;
procedure Enable_Clock (Point : GPIO_Point)
with Inline;
procedure Enable_Clock (Points : GPIO_Points)
with Inline;
procedure Reset (This : aliased in out GPIO_Port)
with Inline;
procedure Reset (Point : GPIO_Point)
with Inline;
procedure Reset (Points : GPIO_Points)
with Inline;
GPIO_A : aliased GPIO_Port with Import, Volatile, Address => GPIOA_Base;
GPIO_B : aliased GPIO_Port with Import, Volatile, Address => GPIOB_Base;
GPIO_C : aliased GPIO_Port with Import, Volatile, Address => GPIOC_Base;
GPIO_D : aliased GPIO_Port with Import, Volatile, Address => GPIOD_Base;
GPIO_E : aliased GPIO_Port with Import, Volatile, Address => GPIOE_Base;
GPIO_F : aliased GPIO_Port with Import, Volatile, Address => GPIOF_Base;
GPIO_G : aliased GPIO_Port with Import, Volatile, Address => GPIOG_Base;
GPIO_H : aliased GPIO_Port with Import, Volatile, Address => GPIOH_Base;
GPIO_I : aliased GPIO_Port with Import, Volatile, Address => GPIOI_Base;
GPIO_J : aliased GPIO_Port with Import, Volatile, Address => GPIOJ_Base;
GPIO_K : aliased GPIO_Port with Import, Volatile, Address => GPIOK_Base;
PA0 : aliased GPIO_Point := (GPIO_A'Access, Pin_0);
PA1 : aliased GPIO_Point := (GPIO_A'Access, Pin_1);
PA2 : aliased GPIO_Point := (GPIO_A'Access, Pin_2);
PA3 : aliased GPIO_Point := (GPIO_A'Access, Pin_3);
PA4 : aliased GPIO_Point := (GPIO_A'Access, Pin_4);
PA5 : aliased GPIO_Point := (GPIO_A'Access, Pin_5);
PA6 : aliased GPIO_Point := (GPIO_A'Access, Pin_6);
PA7 : aliased GPIO_Point := (GPIO_A'Access, Pin_7);
PA8 : aliased GPIO_Point := (GPIO_A'Access, Pin_8);
PA9 : aliased GPIO_Point := (GPIO_A'Access, Pin_9);
PA10 : aliased GPIO_Point := (GPIO_A'Access, Pin_10);
PA11 : aliased GPIO_Point := (GPIO_A'Access, Pin_11);
PA12 : aliased GPIO_Point := (GPIO_A'Access, Pin_12);
PA13 : aliased GPIO_Point := (GPIO_A'Access, Pin_13);
PA14 : aliased GPIO_Point := (GPIO_A'Access, Pin_14);
PA15 : aliased GPIO_Point := (GPIO_A'Access, Pin_15);
PB0 : aliased GPIO_Point := (GPIO_B'Access, Pin_0);
PB1 : aliased GPIO_Point := (GPIO_B'Access, Pin_1);
PB2 : aliased GPIO_Point := (GPIO_B'Access, Pin_2);
PB3 : aliased GPIO_Point := (GPIO_B'Access, Pin_3);
PB4 : aliased GPIO_Point := (GPIO_B'Access, Pin_4);
PB5 : aliased GPIO_Point := (GPIO_B'Access, Pin_5);
PB6 : aliased GPIO_Point := (GPIO_B'Access, Pin_6);
PB7 : aliased GPIO_Point := (GPIO_B'Access, Pin_7);
PB8 : aliased GPIO_Point := (GPIO_B'Access, Pin_8);
PB9 : aliased GPIO_Point := (GPIO_B'Access, Pin_9);
PB10 : aliased GPIO_Point := (GPIO_B'Access, Pin_10);
PB11 : aliased GPIO_Point := (GPIO_B'Access, Pin_11);
PB12 : aliased GPIO_Point := (GPIO_B'Access, Pin_12);
PB13 : aliased GPIO_Point := (GPIO_B'Access, Pin_13);
PB14 : aliased GPIO_Point := (GPIO_B'Access, Pin_14);
PB15 : aliased GPIO_Point := (GPIO_B'Access, Pin_15);
PC0 : aliased GPIO_Point := (GPIO_C'Access, Pin_0);
PC1 : aliased GPIO_Point := (GPIO_C'Access, Pin_1);
PC2 : aliased GPIO_Point := (GPIO_C'Access, Pin_2);
PC3 : aliased GPIO_Point := (GPIO_C'Access, Pin_3);
PC4 : aliased GPIO_Point := (GPIO_C'Access, Pin_4);
PC5 : aliased GPIO_Point := (GPIO_C'Access, Pin_5);
PC6 : aliased GPIO_Point := (GPIO_C'Access, Pin_6);
PC7 : aliased GPIO_Point := (GPIO_C'Access, Pin_7);
PC8 : aliased GPIO_Point := (GPIO_C'Access, Pin_8);
PC9 : aliased GPIO_Point := (GPIO_C'Access, Pin_9);
PC10 : aliased GPIO_Point := (GPIO_C'Access, Pin_10);
PC11 : aliased GPIO_Point := (GPIO_C'Access, Pin_11);
PC12 : aliased GPIO_Point := (GPIO_C'Access, Pin_12);
PC13 : aliased GPIO_Point := (GPIO_C'Access, Pin_13);
PC14 : aliased GPIO_Point := (GPIO_C'Access, Pin_14);
PC15 : aliased GPIO_Point := (GPIO_C'Access, Pin_15);
PD0 : aliased GPIO_Point := (GPIO_D'Access, Pin_0);
PD1 : aliased GPIO_Point := (GPIO_D'Access, Pin_1);
PD2 : aliased GPIO_Point := (GPIO_D'Access, Pin_2);
PD3 : aliased GPIO_Point := (GPIO_D'Access, Pin_3);
PD4 : aliased GPIO_Point := (GPIO_D'Access, Pin_4);
PD5 : aliased GPIO_Point := (GPIO_D'Access, Pin_5);
PD6 : aliased GPIO_Point := (GPIO_D'Access, Pin_6);
PD7 : aliased GPIO_Point := (GPIO_D'Access, Pin_7);
PD8 : aliased GPIO_Point := (GPIO_D'Access, Pin_8);
PD9 : aliased GPIO_Point := (GPIO_D'Access, Pin_9);
PD10 : aliased GPIO_Point := (GPIO_D'Access, Pin_10);
PD11 : aliased GPIO_Point := (GPIO_D'Access, Pin_11);
PD12 : aliased GPIO_Point := (GPIO_D'Access, Pin_12);
PD13 : aliased GPIO_Point := (GPIO_D'Access, Pin_13);
PD14 : aliased GPIO_Point := (GPIO_D'Access, Pin_14);
PD15 : aliased GPIO_Point := (GPIO_D'Access, Pin_15);
PE0 : aliased GPIO_Point := (GPIO_E'Access, Pin_0);
PE1 : aliased GPIO_Point := (GPIO_E'Access, Pin_1);
PE2 : aliased GPIO_Point := (GPIO_E'Access, Pin_2);
PE3 : aliased GPIO_Point := (GPIO_E'Access, Pin_3);
PE4 : aliased GPIO_Point := (GPIO_E'Access, Pin_4);
PE5 : aliased GPIO_Point := (GPIO_E'Access, Pin_5);
PE6 : aliased GPIO_Point := (GPIO_E'Access, Pin_6);
PE7 : aliased GPIO_Point := (GPIO_E'Access, Pin_7);
PE8 : aliased GPIO_Point := (GPIO_E'Access, Pin_8);
PE9 : aliased GPIO_Point := (GPIO_E'Access, Pin_9);
PE10 : aliased GPIO_Point := (GPIO_E'Access, Pin_10);
PE11 : aliased GPIO_Point := (GPIO_E'Access, Pin_11);
PE12 : aliased GPIO_Point := (GPIO_E'Access, Pin_12);
PE13 : aliased GPIO_Point := (GPIO_E'Access, Pin_13);
PE14 : aliased GPIO_Point := (GPIO_E'Access, Pin_14);
PE15 : aliased GPIO_Point := (GPIO_E'Access, Pin_15);
PF0 : aliased GPIO_Point := (GPIO_F'Access, Pin_0);
PF1 : aliased GPIO_Point := (GPIO_F'Access, Pin_1);
PF2 : aliased GPIO_Point := (GPIO_F'Access, Pin_2);
PF3 : aliased GPIO_Point := (GPIO_F'Access, Pin_3);
PF4 : aliased GPIO_Point := (GPIO_F'Access, Pin_4);
PF5 : aliased GPIO_Point := (GPIO_F'Access, Pin_5);
PF6 : aliased GPIO_Point := (GPIO_F'Access, Pin_6);
PF7 : aliased GPIO_Point := (GPIO_F'Access, Pin_7);
PF8 : aliased GPIO_Point := (GPIO_F'Access, Pin_8);
PF9 : aliased GPIO_Point := (GPIO_F'Access, Pin_9);
PF10 : aliased GPIO_Point := (GPIO_F'Access, Pin_10);
PF11 : aliased GPIO_Point := (GPIO_F'Access, Pin_11);
PF12 : aliased GPIO_Point := (GPIO_F'Access, Pin_12);
PF13 : aliased GPIO_Point := (GPIO_F'Access, Pin_13);
PF14 : aliased GPIO_Point := (GPIO_F'Access, Pin_14);
PF15 : aliased GPIO_Point := (GPIO_F'Access, Pin_15);
PG0 : aliased GPIO_Point := (GPIO_G'Access, Pin_0);
PG1 : aliased GPIO_Point := (GPIO_G'Access, Pin_1);
PG2 : aliased GPIO_Point := (GPIO_G'Access, Pin_2);
PG3 : aliased GPIO_Point := (GPIO_G'Access, Pin_3);
PG4 : aliased GPIO_Point := (GPIO_G'Access, Pin_4);
PG5 : aliased GPIO_Point := (GPIO_G'Access, Pin_5);
PG6 : aliased GPIO_Point := (GPIO_G'Access, Pin_6);
PG7 : aliased GPIO_Point := (GPIO_G'Access, Pin_7);
PG8 : aliased GPIO_Point := (GPIO_G'Access, Pin_8);
PG9 : aliased GPIO_Point := (GPIO_G'Access, Pin_9);
PG10 : aliased GPIO_Point := (GPIO_G'Access, Pin_10);
PG11 : aliased GPIO_Point := (GPIO_G'Access, Pin_11);
PG12 : aliased GPIO_Point := (GPIO_G'Access, Pin_12);
PG13 : aliased GPIO_Point := (GPIO_G'Access, Pin_13);
PG14 : aliased GPIO_Point := (GPIO_G'Access, Pin_14);
PG15 : aliased GPIO_Point := (GPIO_G'Access, Pin_15);
PH0 : aliased GPIO_Point := (GPIO_H'Access, Pin_0);
PH1 : aliased GPIO_Point := (GPIO_H'Access, Pin_1);
PH2 : aliased GPIO_Point := (GPIO_H'Access, Pin_2);
PH3 : aliased GPIO_Point := (GPIO_H'Access, Pin_3);
PH4 : aliased GPIO_Point := (GPIO_H'Access, Pin_4);
PH5 : aliased GPIO_Point := (GPIO_H'Access, Pin_5);
PH6 : aliased GPIO_Point := (GPIO_H'Access, Pin_6);
PH7 : aliased GPIO_Point := (GPIO_H'Access, Pin_7);
PH8 : aliased GPIO_Point := (GPIO_H'Access, Pin_8);
PH9 : aliased GPIO_Point := (GPIO_H'Access, Pin_9);
PH10 : aliased GPIO_Point := (GPIO_H'Access, Pin_10);
PH11 : aliased GPIO_Point := (GPIO_H'Access, Pin_11);
PH12 : aliased GPIO_Point := (GPIO_H'Access, Pin_12);
PH13 : aliased GPIO_Point := (GPIO_H'Access, Pin_13);
PH14 : aliased GPIO_Point := (GPIO_H'Access, Pin_14);
PH15 : aliased GPIO_Point := (GPIO_H'Access, Pin_15);
PI0 : aliased GPIO_Point := (GPIO_I'Access, Pin_0);
PI1 : aliased GPIO_Point := (GPIO_I'Access, Pin_1);
PI2 : aliased GPIO_Point := (GPIO_I'Access, Pin_2);
PI3 : aliased GPIO_Point := (GPIO_I'Access, Pin_3);
PI4 : aliased GPIO_Point := (GPIO_I'Access, Pin_4);
PI5 : aliased GPIO_Point := (GPIO_I'Access, Pin_5);
PI6 : aliased GPIO_Point := (GPIO_I'Access, Pin_6);
PI7 : aliased GPIO_Point := (GPIO_I'Access, Pin_7);
PI8 : aliased GPIO_Point := (GPIO_I'Access, Pin_8);
PI9 : aliased GPIO_Point := (GPIO_I'Access, Pin_9);
PI10 : aliased GPIO_Point := (GPIO_I'Access, Pin_10);
PI11 : aliased GPIO_Point := (GPIO_I'Access, Pin_11);
PI12 : aliased GPIO_Point := (GPIO_I'Access, Pin_12);
PI13 : aliased GPIO_Point := (GPIO_I'Access, Pin_13);
PI14 : aliased GPIO_Point := (GPIO_I'Access, Pin_14);
PI15 : aliased GPIO_Point := (GPIO_I'Access, Pin_15);
PJ0 : aliased GPIO_Point := (GPIO_J'Access, Pin_0);
PJ1 : aliased GPIO_Point := (GPIO_J'Access, Pin_1);
PJ2 : aliased GPIO_Point := (GPIO_J'Access, Pin_2);
PJ3 : aliased GPIO_Point := (GPIO_J'Access, Pin_3);
PJ4 : aliased GPIO_Point := (GPIO_J'Access, Pin_4);
PJ5 : aliased GPIO_Point := (GPIO_J'Access, Pin_5);
PJ6 : aliased GPIO_Point := (GPIO_J'Access, Pin_6);
PJ7 : aliased GPIO_Point := (GPIO_J'Access, Pin_7);
PJ8 : aliased GPIO_Point := (GPIO_J'Access, Pin_8);
PJ9 : aliased GPIO_Point := (GPIO_J'Access, Pin_9);
PJ10 : aliased GPIO_Point := (GPIO_J'Access, Pin_10);
PJ11 : aliased GPIO_Point := (GPIO_J'Access, Pin_11);
PJ12 : aliased GPIO_Point := (GPIO_J'Access, Pin_12);
PJ13 : aliased GPIO_Point := (GPIO_J'Access, Pin_13);
PJ14 : aliased GPIO_Point := (GPIO_J'Access, Pin_14);
PJ15 : aliased GPIO_Point := (GPIO_J'Access, Pin_15);
PK0 : aliased GPIO_Point := (GPIO_K'Access, Pin_0);
PK1 : aliased GPIO_Point := (GPIO_K'Access, Pin_1);
PK2 : aliased GPIO_Point := (GPIO_K'Access, Pin_2);
PK3 : aliased GPIO_Point := (GPIO_K'Access, Pin_3);
PK4 : aliased GPIO_Point := (GPIO_K'Access, Pin_4);
PK5 : aliased GPIO_Point := (GPIO_K'Access, Pin_5);
PK6 : aliased GPIO_Point := (GPIO_K'Access, Pin_6);
PK7 : aliased GPIO_Point := (GPIO_K'Access, Pin_7);
PK8 : aliased GPIO_Point := (GPIO_K'Access, Pin_8);
PK9 : aliased GPIO_Point := (GPIO_K'Access, Pin_9);
PK10 : aliased GPIO_Point := (GPIO_K'Access, Pin_10);
PK11 : aliased GPIO_Point := (GPIO_K'Access, Pin_11);
PK12 : aliased GPIO_Point := (GPIO_K'Access, Pin_12);
PK13 : aliased GPIO_Point := (GPIO_K'Access, Pin_13);
PK14 : aliased GPIO_Point := (GPIO_K'Access, Pin_14);
PK15 : aliased GPIO_Point := (GPIO_K'Access, Pin_15);
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM4_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM5_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM8_3 : constant GPIO_Alternate_Function;
GPIO_AF_TIM9_3 : constant GPIO_Alternate_Function;
GPIO_AF_TIM10_3 : constant GPIO_Alternate_Function;
GPIO_AF_TIM11_3 : constant GPIO_Alternate_Function;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function;
GPIO_AF_I2C2_4 : constant GPIO_Alternate_Function;
GPIO_AF_I2C3_4 : constant GPIO_Alternate_Function;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI2_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI3_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI4_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI5_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI6_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI2_6 : constant GPIO_Alternate_Function;
GPIO_AF_SPI3_6 : constant GPIO_Alternate_Function;
GPIO_AF_SAI1_6 : constant GPIO_Alternate_Function;
GPIO_AF_SPI3_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function;
GPIO_AF_I2S3ext_7 : constant GPIO_Alternate_Function;
GPIO_AF_UART4_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART5_8 : constant GPIO_Alternate_Function;
GPIO_AF_USART6_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART7_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART8_8 : constant GPIO_Alternate_Function;
GPIO_AF_CAN1_9 : constant GPIO_Alternate_Function;
GPIO_AF_CAN2_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM12_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM13_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM14_9 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_9 : constant GPIO_Alternate_Function;
GPIO_AF_OTG1_FS_10 : constant GPIO_Alternate_Function;
GPIO_AF_OTG2_HS_10 : constant GPIO_Alternate_Function;
GPIO_AF_ETH_11 : constant GPIO_Alternate_Function;
GPIO_AF_FMC_12 : constant GPIO_Alternate_Function;
GPIO_AF_SDIO_12 : constant GPIO_Alternate_Function;
GPIO_AF_OTG2_FS_12 : constant GPIO_Alternate_Function;
GPIO_AF_DCMI_13 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_13 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_14 : constant GPIO_Alternate_Function;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function;
function GPIO_Port_Representation (Port : GPIO_Port) return UInt4
with Inline;
ADC_1 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC1_Base;
ADC_2 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC2_Base;
ADC_3 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC3_Base;
VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel);
Temperature_Sensor : constant ADC_Point := VBat;
-- see RM pg 410, section 13.10, also pg 389
VBat_Bridge_Divisor : constant := 4;
-- The VBAT pin is internally connected to a bridge divider. The actual
-- voltage is the raw conversion value * the divisor. See section 13.11,
-- pg 412 of the RM.
procedure Enable_Clock (This : aliased in out Analog_To_Digital_Converter);
procedure Reset_All_ADC_Units;
DAC_1 : aliased Digital_To_Analog_Converter with Import, Volatile, Address => DAC_Base;
DAC_Channel_1_IO : GPIO_Point renames PA4;
DAC_Channel_2_IO : GPIO_Point renames PA5;
procedure Enable_Clock (This : aliased in out Digital_To_Analog_Converter);
procedure Reset (This : aliased in out Digital_To_Analog_Converter);
Internal_USART_1 : aliased Internal_USART with Import, Volatile, Address => USART1_Base;
Internal_USART_2 : aliased Internal_USART with Import, Volatile, Address => USART2_Base;
Internal_USART_3 : aliased Internal_USART with Import, Volatile, Address => USART3_Base;
Internal_UART_4 : aliased Internal_USART with Import, Volatile, Address => UART4_Base;
Internal_UART_5 : aliased Internal_USART with Import, Volatile, Address => UART5_Base;
Internal_USART_6 : aliased Internal_USART with Import, Volatile, Address => USART6_Base;
Internal_UART_7 : aliased Internal_USART with Import, Volatile, Address => UART7_Base;
Internal_UART_8 : aliased Internal_USART with Import, Volatile, Address => UART8_Base;
USART_1 : aliased USART (Internal_USART_1'Access);
USART_2 : aliased USART (Internal_USART_2'Access);
USART_3 : aliased USART (Internal_USART_3'Access);
UART_4 : aliased USART (Internal_UART_4'Access);
UART_5 : aliased USART (Internal_UART_5'Access);
USART_6 : aliased USART (Internal_USART_6'Access);
UART_7 : aliased USART (Internal_UART_7'Access);
UART_8 : aliased USART (Internal_UART_8'Access);
procedure Enable_Clock (This : aliased in out USART);
procedure Reset (This : aliased in out USART);
DMA_1 : aliased DMA_Controller with Import, Volatile, Address => DMA1_Base;
DMA_2 : aliased DMA_Controller with Import, Volatile, Address => DMA2_Base;
procedure Enable_Clock (This : aliased in out DMA_Controller);
procedure Reset (This : aliased in out DMA_Controller);
Internal_I2C_Port_1 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C1_Base;
Internal_I2C_Port_2 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C2_Base;
Internal_I2C_Port_3 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C3_Base;
type I2C_Port_Id is (I2C_Id_1, I2C_Id_2, I2C_Id_3);
I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access);
I2C_2 : aliased I2C_Port (Internal_I2C_Port_2'Access);
I2C_3 : aliased I2C_Port (Internal_I2C_Port_3'Access);
I2C_1_DMA : aliased I2C_Port_DMA (Internal_I2C_Port_1'Access);
I2C_2_DMA : aliased I2C_Port_DMA (Internal_I2C_Port_2'Access);
I2C_3_DMA : aliased I2C_Port_DMA (Internal_I2C_Port_3'Access);
function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id with Inline;
procedure Enable_Clock (This : I2C_Port'Class);
procedure Enable_Clock (This : I2C_Port_Id);
procedure Reset (This : I2C_Port'Class);
procedure Reset (This : I2C_Port_Id);
Internal_SPI_1 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI1_Base;
Internal_SPI_2 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI2_Base;
Internal_SPI_3 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI3_Base;
Internal_SPI_4 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI4_Base;
Internal_SPI_5 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI5_Base;
Internal_SPI_6 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI6_Base;
SPI_1 : aliased SPI_Port (Internal_SPI_1'Access);
SPI_2 : aliased SPI_Port (Internal_SPI_2'Access);
SPI_3 : aliased SPI_Port (Internal_SPI_3'Access);
SPI_4 : aliased SPI_Port (Internal_SPI_4'Access);
SPI_5 : aliased SPI_Port (Internal_SPI_5'Access);
SPI_6 : aliased SPI_Port (Internal_SPI_6'Access);
SPI_1_DMA : aliased SPI_Port_DMA (Internal_SPI_1'Access);
SPI_2_DMA : aliased SPI_Port_DMA (Internal_SPI_2'Access);
SPI_3_DMA : aliased SPI_Port_DMA (Internal_SPI_3'Access);
SPI_4_DMA : aliased SPI_Port_DMA (Internal_SPI_4'Access);
SPI_5_DMA : aliased SPI_Port_DMA (Internal_SPI_5'Access);
SPI_6_DMA : aliased SPI_Port_DMA (Internal_SPI_6'Access);
procedure Enable_Clock (This : SPI_Port'Class);
procedure Reset (This : SPI_Port'Class);
Internal_I2S_1 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI1_Base;
Internal_I2S_2 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI2_Base;
Internal_I2S_3 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI3_Base;
Internal_I2S_4 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI4_Base;
Internal_I2S_5 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI5_Base;
Internal_I2S_6 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI6_Base;
Internal_I2S_2_Ext : aliased Internal_I2S_Port with Import, Volatile, Address => I2S2ext_Base;
Internal_I2S_3_Ext : aliased Internal_I2S_Port with Import, Volatile, Address => I2S3ext_Base;
I2S_1 : aliased I2S_Port (Internal_I2S_1'Access, Extended => False);
I2S_2 : aliased I2S_Port (Internal_I2S_2'Access, Extended => False);
I2S_3 : aliased I2S_Port (Internal_I2S_3'Access, Extended => False);
I2S_4 : aliased I2S_Port (Internal_I2S_4'Access, Extended => False);
I2S_5 : aliased I2S_Port (Internal_I2S_5'Access, Extended => False);
I2S_6 : aliased I2S_Port (Internal_I2S_6'Access, Extended => False);
I2S_2_Ext : aliased I2S_Port (Internal_I2S_2_Ext'Access, Extended => True);
I2S_3_Ext : aliased I2S_Port (Internal_I2S_3_Ext'Access, Extended => True);
procedure Enable_Clock (This : I2S_Port);
procedure Reset (This : in out I2S_Port);
Timer_1 : aliased Timer with Import, Volatile, Address => TIM1_Base;
Timer_2 : aliased Timer with Import, Volatile, Address => TIM2_Base;
Timer_3 : aliased Timer with Import, Volatile, Address => TIM3_Base;
Timer_4 : aliased Timer with Import, Volatile, Address => TIM4_Base;
Timer_5 : aliased Timer with Import, Volatile, Address => TIM5_Base;
Timer_6 : aliased Timer with Import, Volatile, Address => TIM6_Base;
Timer_7 : aliased Timer with Import, Volatile, Address => TIM7_Base;
Timer_8 : aliased Timer with Import, Volatile, Address => TIM8_Base;
Timer_9 : aliased Timer with Import, Volatile, Address => TIM9_Base;
Timer_10 : aliased Timer with Import, Volatile, Address => TIM10_Base;
Timer_11 : aliased Timer with Import, Volatile, Address => TIM11_Base;
Timer_12 : aliased Timer with Import, Volatile, Address => TIM12_Base;
Timer_13 : aliased Timer with Import, Volatile, Address => TIM13_Base;
Timer_14 : aliased Timer with Import, Volatile, Address => TIM14_Base;
procedure Enable_Clock (This : in out Timer);
procedure Reset (This : in out Timer);
-----------
-- SDMMC --
-----------
SDIO : aliased SDMMC_Controller (STM32_SVD.SDIO.SDIO_Periph'Access);
type SDIO_Clock_Source is (Src_Sysclk, Src_48Mhz);
procedure Enable_Clock (This : in out SDMMC_Controller);
procedure Reset (This : in out SDMMC_Controller);
---------
-- CRC --
---------
CRC_Unit : CRC_32 with Import, Volatile, Address => CRC_Base;
procedure Enable_Clock (This : in out CRC_32);
procedure Disable_Clock (This : in out CRC_32);
procedure Reset (This : in out CRC_32);
-----------------------------
-- Reset and Clock Control --
-----------------------------
type RCC_System_Clocks is record
SYSCLK : UInt32;
HCLK : UInt32;
PCLK1 : UInt32;
PCLK2 : UInt32;
TIMCLK1 : UInt32;
TIMCLK2 : UInt32;
I2SCLK : UInt32;
end record;
function System_Clock_Frequencies return RCC_System_Clocks;
procedure Set_PLLI2S_Factors (Pll_N : UInt9;
Pll_R : UInt3);
function PLLI2S_Enabled return Boolean;
procedure Enable_PLLI2S
with Post => PLLI2S_Enabled;
procedure Disable_PLLI2S
with Post => not PLLI2S_Enabled;
type PLLSAI_DivR is new UInt2;
PLLSAI_DIV2 : constant PLLSAI_DivR := 0;
PLLSAI_DIV4 : constant PLLSAI_DivR := 1;
PLLSAI_DIV8 : constant PLLSAI_DivR := 2;
PLLSAI_DIV16 : constant PLLSAI_DivR := 3;
procedure Set_PLLSAI_Factors
(LCD : UInt3;
VCO : UInt9;
DivR : PLLSAI_DivR);
procedure Enable_PLLSAI;
procedure Disable_PLLSAI;
function PLLSAI_Ready return Boolean;
procedure Enable_DCMI_Clock;
procedure Reset_DCMI;
RTC : aliased RTC_Device;
private
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TIM1_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM4_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM5_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM8_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TIM9_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TIM10_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TIM11_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_I2C2_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_I2C3_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI2_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI3_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI4_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI5_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI6_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI2_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_SPI3_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_SAI1_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_SPI3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_I2S3ext_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_UART4_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART5_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_USART6_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART7_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART8_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_CAN1_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_CAN2_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM12_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM13_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM14_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_LTDC_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_OTG1_FS_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_OTG2_HS_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_ETH_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_FMC_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_SDIO_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_OTG2_FS_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_DCMI_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_LTDC_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_LTDC_14 : constant GPIO_Alternate_Function := 14;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function := 15;
end STM32.Device;
|
aeszter/sharepoint2ics | Ada | 50 | ads |
package Seminar is
pragma Pure;
end Seminar;
|
charlie5/aIDE | Ada | 1,180 | ads | with
AdaM.Any,
Ada.Containers.Vectors,
Ada.Streams;
private
with
AdaM.Partition;
package AdaM.protected_Entry
is
type Item is new Any.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- Forge
--
function new_Subprogram return protected_Entry.view;
procedure free (Self : in out protected_Entry.view);
procedure destruct (Self : in out protected_Entry.item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
private
type Item is new Any.item with
record
Partitions : Partition.Vector;
end record;
end AdaM.protected_Entry;
|
persan/AdaYaml | Ada | 2,611 | adb | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Unchecked_Deallocation;
package body Yaml.Stacks is
procedure Adjust (Object : in out Stack) is
begin
if Object.Data /= null then
Object.Data.Refcount := Object.Data.Refcount + 1;
end if;
end Adjust;
procedure Free_Element_Array is new Ada.Unchecked_Deallocation
(Element_Array, Element_Array_Access);
procedure Finalize (Object : in out Stack) is
procedure Free_Holder is new Ada.Unchecked_Deallocation
(Holder, Holder_Access);
Reference : Holder_Access := Object.Data;
begin
Object.Data := null;
if Reference /= null then
Reference.Refcount := Reference.Refcount - 1;
if Reference.Refcount = 0 then
Free_Element_Array (Reference.Elements);
Free_Holder (Reference);
end if;
end if;
end Finalize;
function New_Stack (Initial_Capacity : Positive) return Stack is
begin
return Ret : constant Stack :=
(Ada.Finalization.Controlled with Data => new Holder) do
Ret.Data.Elements := new Element_Array (1 .. Initial_Capacity);
Ret.Data.Length := 0;
end return;
end New_Stack;
function Top (Object : in out Stack) return access Element_Type is
(Object.Data.Elements (Object.Data.Length)'Access);
function Length (Object : Stack) return Natural is
(if Object.Data = null then 0 else Object.Data.Length);
function Element (Object : Stack; Index : Positive)
return access Element_Type is
(Object.Data.Elements (Index)'Access);
procedure Pop (Object : in out Stack) is
begin
Object.Data.Length := Object.Data.Length - 1;
end Pop;
procedure Push (Object : in out Stack; Value : Element_Type) is
begin
if Object.Data = null then
Object := New_Stack (32);
end if;
if Object.Data.Length = Object.Data.Elements.all'Last then
declare
New_Array : constant Element_Array_Access :=
new Element_Array (1 .. Object.Data.Length * 2);
begin
New_Array (1 .. Object.Data.Length) := Object.Data.Elements.all;
Free_Element_Array (Object.Data.Elements);
Object.Data.Elements := New_Array;
end;
end if;
Object.Data.Length := Object.Data.Length + 1;
Object.Data.Elements (Object.Data.Length) := Value;
end Push;
function Initialized (Object : Stack) return Boolean is
(Object.Data /= null);
end Yaml.Stacks;
|
AdaCore/Ada-IntelliJ | Ada | 4,085 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014-2017, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Interrupts.Names;
with Ada.Real_Time; use Ada.Real_Time;
with Registers; use Registers;
with STM32F4; use STM32F4;
with STM32F4.GPIO; use STM32F4.GPIO;
package body Button is
protected Button is
pragma Interrupt_Priority;
function Current_Direction return Directions;
private
procedure Interrupt_Handler;
pragma Attach_Handler
(Interrupt_Handler,
Ada.Interrupts.Names.EXTI0_Interrupt);
Direction : Directions := Clockwise; -- arbitrary
Last_Time : Time := Clock;
end Button;
Debounce_Time : constant Time_Span := Milliseconds (500);
protected body Button is
function Current_Direction return Directions is
begin
return Direction;
end Current_Direction;
procedure Interrupt_Handler is
Now : constant Time := Clock;
begin
-- Clear interrupt
EXTI.PR (0) := 1;
-- Debouncing
if Now - Last_Time >= Debounce_Time then
if Direction = Counterclockwise then
Direction := Clockwise;
else
Direction := Counterclockwise;
end if;
Last_Time := Now;
end if;
end Interrupt_Handler;
end Button;
function Current_Direction return Directions is
begin
return Button.Current_Direction;
end Current_Direction;
procedure Initialize is
RCC_AHB1ENR_GPIOA : constant Word := 16#01#;
RCC_APB2ENR_SYSCFG : constant Word := 2**14;
begin
-- Enable clock for GPIO-A
RCC.AHB1ENR := RCC.AHB1ENR or RCC_AHB1ENR_GPIOA;
-- Configure PA0
GPIOA.MODER (0) := Mode_IN;
GPIOA.PUPDR (0) := No_Pull;
-- Enable clock for SYSCFG
RCC.APB2ENR := RCC.APB2ENR or RCC_APB2ENR_SYSCFG;
-- Select PA for EXTI0
SYSCFG.EXTICR1 (0) := 0;
-- Interrupt on rising edge
EXTI.FTSR (0) := 0;
EXTI.RTSR (0) := 1;
EXTI.IMR (0) := 1;
end Initialize;
begin
Initialize;
end Button;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 504 | adb | with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC; use STM32_SVD.RCC;
with HAL;
package body STM32GD.CLOCKS.TREE is
procedure Init is
RCC : RCC_Peripheral renames RCC_Periph;
begin
if PLL_Source = HSE_Input then
RCC.CR.HSEON := 1;
while RCC.CR.HSERDY = 0 loop
null;
end loop;
end if;
RCC.CFGR := (
PLLMUL => UInt4 (PLL_Mul),
PLLSRC => (
case PLL_Source is
when HSI_Input => 1,
when HSE_Input => 1),
others => <>);
end;
end STM32GD.CLOCKS.TREE;
|
darkestkhan/xdg | Ada | 5,918 | ads | ------------------------------------------------------------------------------
-- EMAIL: <[email protected]> --
-- License: ISC License (see COPYING file) --
-- --
-- Copyright © 2014 - 2015 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
----------------------------------------------------------------------------
-- This package implements functionality pertaining to XDG Base --
-- Directories Specification. --
-- <http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html> --
----------------------------------------------------------------------------
---------------------------------------------------------------------------
-- FIXME: Create_* and Delete_* subprograms should check if Directory passed
-- is valid directory inside appropriate place (that is, ie. to prevent
-- deletion of "../../").
---------------------------------------------------------------------------
package XDG is
----------------------------------------------------------------------------
-- NOTE: All functions returning pathname are making sure last character of
-- said pathname is '/' (or '\' in case of Windows).
----------------------------------------------------------------------------
-- Directory in which user specific data files should be stored.
function Data_Home return String;
-- As above but for configuration files.
function Config_Home return String;
-- As above but for non-essential data files.
function Cache_Home return String;
-- As above but for non-essential runtime files.
-- Returns null string in case XDG_RUNTIME_DIR is not set.
function Runtime_Dir return String;
----------------------------------------------------------------------------
-- Preference ordered set of base directories to search for data files
-- in addition to Data_Home. Directories are separated by ':'.
-- NOTE: Default value for Windows is "".
function Data_Dirs return String;
-- As above but for config files.
function Config_Dirs return String;
----------------------------------------------------------------------------
-- NOTE: Subprograms below work only within XDG base directories.
-- For example: Data_Home (Directory) will return path resultant of
-- ${XDG_DATA_HOME}/${DIRECTORY}.
-- NOTE: Subprogram operating on XDG_RUNTIME_DIR will raise No_Runtime_Dir
-- exception if there is no XDG_RUNTIME_DIR environment variable defined.
----------------------------------------------------------------------------
-- These functions return path to directory.
function Data_Home (Directory: in String) return String;
function Config_Home (Directory: in String) return String;
function Cache_Home (Directory: in String) return String;
function Runtime_Dir (Directory: in String) return String;
No_Runtime_Dir: exception;
----------------------------------------------------------------------------
-- These procedures create path to directory. If target Directory already
-- exists nothing will happen.
procedure Create_Data_Home (Directory: in String);
procedure Create_Config_Home (Directory: in String);
procedure Create_Cache_Home (Directory: in String);
procedure Create_Runtime_Dir (Directory: in String);
----------------------------------------------------------------------------
-- These procedures delete directory. If Empty_Only is true Directory will
-- be deleted only when empty, otherwise will delete Directory with its entire
-- content.
procedure Delete_Data_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Config_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Cache_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Runtime_Dir
( Directory : in String;
Empty_Only: in Boolean := True
);
----------------------------------------------------------------------------
-- These functions check if directory exists and if it actually is directory.
-- Returns false only when target file exists and is not directory. This way
-- you can check if Directory is valid location and if so you can create it
-- using one of the procedures available from this package.
function Is_Valid_Data_Home (Directory: in String) return Boolean;
function Is_Valid_Config_Home (Directory: in String) return Boolean;
function Is_Valid_Cache_Home (Directory: in String) return Boolean;
function Is_Valid_Runtime_Dir (Directory: in String) return Boolean;
----------------------------------------------------------------------------
end XDG;
|
AdaCore/Ada_Drivers_Library | Ada | 11,926 | ads | -- This spec has been automatically generated from STM32F7x9.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.DCMI is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_FCRC_Field is HAL.UInt2;
subtype CR_EDM_Field is HAL.UInt2;
-- control register 1
type CR_Register is record
-- Capture enable
CAPTURE : Boolean := False;
-- Capture mode
CM : Boolean := False;
-- Crop feature
CROP : Boolean := False;
-- JPEG format
JPEG : Boolean := False;
-- Embedded synchronization select
ESS : Boolean := False;
-- Pixel clock polarity
PCKPOL : Boolean := False;
-- Horizontal synchronization polarity
HSPOL : Boolean := False;
-- Vertical synchronization polarity
VSPOL : Boolean := False;
-- Frame capture rate control
FCRC : CR_FCRC_Field := 16#0#;
-- Extended data mode
EDM : CR_EDM_Field := 16#0#;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- DCMI enable
ENABLE : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
CAPTURE at 0 range 0 .. 0;
CM at 0 range 1 .. 1;
CROP at 0 range 2 .. 2;
JPEG at 0 range 3 .. 3;
ESS at 0 range 4 .. 4;
PCKPOL at 0 range 5 .. 5;
HSPOL at 0 range 6 .. 6;
VSPOL at 0 range 7 .. 7;
FCRC at 0 range 8 .. 9;
EDM at 0 range 10 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
ENABLE at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- status register
type SR_Register is record
-- Read-only. HSYNC
HSYNC : Boolean;
-- Read-only. VSYNC
VSYNC : Boolean;
-- Read-only. FIFO not empty
FNE : Boolean;
-- unspecified
Reserved_3_31 : HAL.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
HSYNC at 0 range 0 .. 0;
VSYNC at 0 range 1 .. 1;
FNE at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- raw interrupt status register
type RIS_Register is record
-- Read-only. Capture complete raw interrupt status
FRAME_RIS : Boolean;
-- Read-only. Overrun raw interrupt status
OVR_RIS : Boolean;
-- Read-only. Synchronization error raw interrupt status
ERR_RIS : Boolean;
-- Read-only. VSYNC raw interrupt status
VSYNC_RIS : Boolean;
-- Read-only. Line raw interrupt status
LINE_RIS : Boolean;
-- unspecified
Reserved_5_31 : HAL.UInt27;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RIS_Register use record
FRAME_RIS at 0 range 0 .. 0;
OVR_RIS at 0 range 1 .. 1;
ERR_RIS at 0 range 2 .. 2;
VSYNC_RIS at 0 range 3 .. 3;
LINE_RIS at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-- interrupt enable register
type IER_Register is record
-- Capture complete interrupt enable
FRAME_IE : Boolean := False;
-- Overrun interrupt enable
OVR_IE : Boolean := False;
-- Synchronization error interrupt enable
ERR_IE : Boolean := False;
-- VSYNC interrupt enable
VSYNC_IE : Boolean := False;
-- Line interrupt enable
LINE_IE : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
FRAME_IE at 0 range 0 .. 0;
OVR_IE at 0 range 1 .. 1;
ERR_IE at 0 range 2 .. 2;
VSYNC_IE at 0 range 3 .. 3;
LINE_IE at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-- masked interrupt status register
type MIS_Register is record
-- Read-only. Capture complete masked interrupt status
FRAME_MIS : Boolean;
-- Read-only. Overrun masked interrupt status
OVR_MIS : Boolean;
-- Read-only. Synchronization error masked interrupt status
ERR_MIS : Boolean;
-- Read-only. VSYNC masked interrupt status
VSYNC_MIS : Boolean;
-- Read-only. Line masked interrupt status
LINE_MIS : Boolean;
-- unspecified
Reserved_5_31 : HAL.UInt27;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MIS_Register use record
FRAME_MIS at 0 range 0 .. 0;
OVR_MIS at 0 range 1 .. 1;
ERR_MIS at 0 range 2 .. 2;
VSYNC_MIS at 0 range 3 .. 3;
LINE_MIS at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-- interrupt clear register
type ICR_Register is record
-- Write-only. Capture complete interrupt status clear
FRAME_ISC : Boolean := False;
-- Write-only. Overrun interrupt status clear
OVR_ISC : Boolean := False;
-- Write-only. Synchronization error interrupt status clear
ERR_ISC : Boolean := False;
-- Write-only. Vertical synch interrupt status clear
VSYNC_ISC : Boolean := False;
-- Write-only. line interrupt status clear
LINE_ISC : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
FRAME_ISC at 0 range 0 .. 0;
OVR_ISC at 0 range 1 .. 1;
ERR_ISC at 0 range 2 .. 2;
VSYNC_ISC at 0 range 3 .. 3;
LINE_ISC at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype ESCR_FSC_Field is HAL.UInt8;
subtype ESCR_LSC_Field is HAL.UInt8;
subtype ESCR_LEC_Field is HAL.UInt8;
subtype ESCR_FEC_Field is HAL.UInt8;
-- embedded synchronization code register
type ESCR_Register is record
-- Frame start delimiter code
FSC : ESCR_FSC_Field := 16#0#;
-- Line start delimiter code
LSC : ESCR_LSC_Field := 16#0#;
-- Line end delimiter code
LEC : ESCR_LEC_Field := 16#0#;
-- Frame end delimiter code
FEC : ESCR_FEC_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ESCR_Register use record
FSC at 0 range 0 .. 7;
LSC at 0 range 8 .. 15;
LEC at 0 range 16 .. 23;
FEC at 0 range 24 .. 31;
end record;
subtype ESUR_FSU_Field is HAL.UInt8;
subtype ESUR_LSU_Field is HAL.UInt8;
subtype ESUR_LEU_Field is HAL.UInt8;
subtype ESUR_FEU_Field is HAL.UInt8;
-- embedded synchronization unmask register
type ESUR_Register is record
-- Frame start delimiter unmask
FSU : ESUR_FSU_Field := 16#0#;
-- Line start delimiter unmask
LSU : ESUR_LSU_Field := 16#0#;
-- Line end delimiter unmask
LEU : ESUR_LEU_Field := 16#0#;
-- Frame end delimiter unmask
FEU : ESUR_FEU_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ESUR_Register use record
FSU at 0 range 0 .. 7;
LSU at 0 range 8 .. 15;
LEU at 0 range 16 .. 23;
FEU at 0 range 24 .. 31;
end record;
subtype CWSTRT_HOFFCNT_Field is HAL.UInt14;
subtype CWSTRT_VST_Field is HAL.UInt13;
-- crop window start
type CWSTRT_Register is record
-- Horizontal offset count
HOFFCNT : CWSTRT_HOFFCNT_Field := 16#0#;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Vertical start line count
VST : CWSTRT_VST_Field := 16#0#;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CWSTRT_Register use record
HOFFCNT at 0 range 0 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
VST at 0 range 16 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
subtype CWSIZE_CAPCNT_Field is HAL.UInt14;
subtype CWSIZE_VLINE_Field is HAL.UInt14;
-- crop window size
type CWSIZE_Register is record
-- Capture count
CAPCNT : CWSIZE_CAPCNT_Field := 16#0#;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Vertical line count
VLINE : CWSIZE_VLINE_Field := 16#0#;
-- unspecified
Reserved_30_31 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CWSIZE_Register use record
CAPCNT at 0 range 0 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
VLINE at 0 range 16 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-- DR_Byte array element
subtype DR_Byte_Element is HAL.UInt8;
-- DR_Byte array
type DR_Byte_Field_Array is array (0 .. 3) of DR_Byte_Element
with Component_Size => 8, Size => 32;
-- data register
type DR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- Byte as a value
Val : HAL.UInt32;
when True =>
-- Byte as an array
Arr : DR_Byte_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for DR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Digital camera interface
type DCMI_Peripheral is record
-- control register 1
CR : aliased CR_Register;
-- status register
SR : aliased SR_Register;
-- raw interrupt status register
RIS : aliased RIS_Register;
-- interrupt enable register
IER : aliased IER_Register;
-- masked interrupt status register
MIS : aliased MIS_Register;
-- interrupt clear register
ICR : aliased ICR_Register;
-- embedded synchronization code register
ESCR : aliased ESCR_Register;
-- embedded synchronization unmask register
ESUR : aliased ESUR_Register;
-- crop window start
CWSTRT : aliased CWSTRT_Register;
-- crop window size
CWSIZE : aliased CWSIZE_Register;
-- data register
DR : aliased DR_Register;
end record
with Volatile;
for DCMI_Peripheral use record
CR at 16#0# range 0 .. 31;
SR at 16#4# range 0 .. 31;
RIS at 16#8# range 0 .. 31;
IER at 16#C# range 0 .. 31;
MIS at 16#10# range 0 .. 31;
ICR at 16#14# range 0 .. 31;
ESCR at 16#18# range 0 .. 31;
ESUR at 16#1C# range 0 .. 31;
CWSTRT at 16#20# range 0 .. 31;
CWSIZE at 16#24# range 0 .. 31;
DR at 16#28# range 0 .. 31;
end record;
-- Digital camera interface
DCMI_Periph : aliased DCMI_Peripheral
with Import, Address => System'To_Address (16#50050000#);
end STM32_SVD.DCMI;
|
JeremyGrosser/Ada_Drivers_Library | Ada | 1,929 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Architecture : constant String := "ARM"; -- From board definition
Board : constant String := "OpenMV2"; -- From command line
CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition
Device_Family : constant String := "STM32F4"; -- From board definition
Device_Name : constant String := "STM32F427VGTx"; -- From board definition
Has_Ravenscar_Full_Runtime : constant String := "True"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "True"; -- From board definition
Has_ZFP_Runtime : constant String := "False"; -- From board definition
High_Speed_External_Clock : constant := 12000000; -- From board definition
Max_Mount_Name_Length : constant := 128; -- From default value
Max_Mount_Points : constant := 2; -- From default value
Max_Path_Length : constant := 1024; -- From default value
Number_Of_Interrupts : constant := 0; -- From default value
Runtime_Name : constant String := "ravenscar-sfp-openmv2"; -- From default value
Runtime_Name_Suffix : constant String := "openmv2"; -- From board definition
Runtime_Profile : constant String := "ravenscar-sfp"; -- From command line
Use_Startup_Gen : constant Boolean := False; -- From command line
Vendor : constant String := "STMicro"; -- From board definition
end ADL_Config;
|
Wilfred/difftastic | Ada | 123 | adb | with Ada.Text_IO;
procedure Hello is
package TIO renames Ada.Text_IO;
begin
TIO.Put_Line ("Hello World!");
end Hello;
|
stcarrez/ada-util | Ada | 1,657 | adb | -----------------------------------------------------------------------
-- popen -- Print the GNAT version by using a pipe
-- Copyright (C) 2011, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with Util.Processes;
with Util.Streams.Pipes;
with Util.Streams.Buffered;
procedure Popen is
Command : constant String := "gnatmake --version";
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
Content : Ada.Strings.Unbounded.Unbounded_String;
begin
Pipe.Open (Command, Util.Processes.READ);
Buffer.Initialize (Pipe'Unchecked_Access, 1024);
Buffer.Read (Content);
Pipe.Close;
if Pipe.Get_Exit_Status /= 0 then
Ada.Text_IO.Put_Line (Command & " exited with status "
& Integer'Image (Pipe.Get_Exit_Status));
return;
end if;
Ada.Text_IO.Put_Line ("Result: " & Ada.Strings.Unbounded.To_String (Content));
end Popen;
|
reznikmm/matreshka | Ada | 16,451 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.Tables.CMOF_Attributes;
with AMF.Internals.Element_Collections;
with AMF.Visitors.CMOF_Iterators;
with AMF.Visitors.CMOF_Visitors;
package body AMF.Internals.CMOF_Data_Types is
use AMF.Internals.Tables.CMOF_Attributes;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant CMOF_Data_Type_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then
AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class
(Visitor).Enter_Data_Type
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access (Self),
Control);
end if;
end Enter_Element;
-------------------------
-- Get_Owned_Attribute --
-------------------------
overriding function Get_Owned_Attribute
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property is
begin
return
AMF.CMOF.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(Internal_Get_Owned_Attribute (Self.Element)));
end Get_Owned_Attribute;
-------------------------
-- Get_Owned_Operation --
-------------------------
overriding function Get_Owned_Operation
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Operations.Collections.Ordered_Set_Of_CMOF_Operation is
begin
return
AMF.CMOF.Operations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(Internal_Get_Owned_Operation (Self.Element)));
end Get_Owned_Operation;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant CMOF_Data_Type_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then
AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class
(Visitor).Leave_Data_Type
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant CMOF_Data_Type_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.CMOF_Iterators.CMOF_Iterator'Class then
AMF.Visitors.CMOF_Iterators.CMOF_Iterator'Class
(Iterator).Visit_Data_Type
(Visitor,
AMF.CMOF.Data_Types.CMOF_Data_Type_Access (Self),
Control);
end if;
end Visit_Element;
------------------------
-- All_Owned_Elements --
------------------------
overriding function All_Owned_Elements
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented");
raise Program_Error;
return All_Owned_Elements (Self);
end All_Owned_Elements;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant CMOF_Data_Type_Proxy)
return Optional_String
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Get_Qualified_Name unimplemented");
raise Program_Error;
return Get_Qualified_Name (Self);
end Get_Qualified_Name;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant CMOF_Data_Type_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access;
Ns : AMF.CMOF.Namespaces.CMOF_Namespace_Access)
return Boolean
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error;
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
-----------------
-- Set_Package --
-----------------
overriding procedure Set_Package
(Self : not null access CMOF_Data_Type_Proxy;
To : AMF.CMOF.Packages.CMOF_Package_Access)
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Set_Package unimplemented");
raise Program_Error;
end Set_Package;
---------------------
-- Imported_Member --
---------------------
overriding function Imported_Member
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented");
raise Program_Error;
return Imported_Member (Self);
end Imported_Member;
-------------------------
-- Get_Names_Of_Member --
-------------------------
overriding function Get_Names_Of_Member
(Self : not null access constant CMOF_Data_Type_Proxy;
Element : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return AMF.String_Collections.Set_Of_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented");
raise Program_Error;
return Get_Names_Of_Member (Self, Element);
end Get_Names_Of_Member;
--------------------
-- Import_Members --
--------------------
overriding function Import_Members
(Self : not null access constant CMOF_Data_Type_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented");
raise Program_Error;
return Import_Members (Self, Imps);
end Import_Members;
------------------------
-- Exclude_Collisions --
------------------------
overriding function Exclude_Collisions
(Self : not null access constant CMOF_Data_Type_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented");
raise Program_Error;
return Exclude_Collisions (Self, Imps);
end Exclude_Collisions;
---------------------------------
-- Members_Are_Distinguishable --
---------------------------------
overriding function Members_Are_Distinguishable
(Self : not null access constant CMOF_Data_Type_Proxy)
return Boolean
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented");
raise Program_Error;
return Members_Are_Distinguishable (Self);
end Members_Are_Distinguishable;
---------------------------------
-- Set_Is_Final_Specialization --
---------------------------------
overriding procedure Set_Is_Final_Specialization
(Self : not null access CMOF_Data_Type_Proxy;
To : Boolean)
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Set_Is_Final_Specialization unimplemented");
raise Program_Error;
end Set_Is_Final_Specialization;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant CMOF_Data_Type_Proxy;
Other : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return Boolean
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error;
return Conforms_To (Self, Other);
end Conforms_To;
------------------
-- All_Features --
------------------
overriding function All_Features
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Features.Collections.Set_Of_CMOF_Feature
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented");
raise Program_Error;
return All_Features (Self);
end All_Features;
-------------
-- General --
-------------
overriding function General
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "General unimplemented");
raise Program_Error;
return General (Self);
end General;
-------------
-- Parents --
-------------
overriding function Parents
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parents unimplemented");
raise Program_Error;
return Parents (Self);
end Parents;
----------------------
-- Inherited_Member --
----------------------
overriding function Inherited_Member
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented");
raise Program_Error;
return Inherited_Member (Self);
end Inherited_Member;
-----------------
-- All_Parents --
-----------------
overriding function All_Parents
(Self : not null access constant CMOF_Data_Type_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Parents unimplemented");
raise Program_Error;
return All_Parents (Self);
end All_Parents;
-------------------------
-- Inheritable_Members --
-------------------------
overriding function Inheritable_Members
(Self : not null access constant CMOF_Data_Type_Proxy;
C : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented");
raise Program_Error;
return Inheritable_Members (Self, C);
end Inheritable_Members;
-----------------------
-- Has_Visibility_Of --
-----------------------
overriding function Has_Visibility_Of
(Self : not null access constant CMOF_Data_Type_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return Boolean
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented");
raise Program_Error;
return Has_Visibility_Of (Self, N);
end Has_Visibility_Of;
-------------
-- Inherit --
-------------
overriding function Inherit
(Self : not null access constant CMOF_Data_Type_Proxy;
Inhs : AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented");
raise Program_Error;
return Inherit (Self, Inhs);
end Inherit;
-------------------------
-- May_Specialize_Type --
-------------------------
overriding function May_Specialize_Type
(Self : not null access constant CMOF_Data_Type_Proxy;
C : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return Boolean
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented");
raise Program_Error;
return May_Specialize_Type (Self, C);
end May_Specialize_Type;
end AMF.Internals.CMOF_Data_Types;
|
zhmu/ananas | Ada | 5,647 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . H E A P _ S O R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body GNAT.Heap_Sort is
----------
-- Sort --
----------
-- We are using the classical heapsort algorithm (i.e. Floyd's Treesort3)
-- as described by Knuth ("The Art of Programming", Volume III, first
-- edition, section 5.2.3, p. 145-147) with the modification that is
-- mentioned in exercise 18. For more details on this algorithm, see
-- Robert B. K. Dewar PhD thesis "The use of Computers in the X-ray
-- Phase Problem". University of Chicago, 1968, which was the first
-- publication of the modification, which reduces the number of compares
-- from 2NlogN to NlogN.
procedure Sort (N : Natural; Xchg : Xchg_Procedure; Lt : Lt_Function) is
Max : Natural := N;
-- Current Max index in tree being sifted. Note that we make Max
-- Natural rather than Positive so that the case of sorting zero
-- elements is correctly handled (i.e. does nothing at all).
procedure Sift (S : Positive);
-- This procedure sifts up node S, i.e. converts the subtree rooted
-- at node S into a heap, given the precondition that any sons of
-- S are already heaps.
----------
-- Sift --
----------
procedure Sift (S : Positive) is
C : Positive := S;
Son : Positive;
Father : Positive;
begin
-- This is where the optimization is done, normally we would do a
-- comparison at each stage between the current node and the larger
-- of the two sons, and continue the sift only if the current node
-- was less than this maximum. In this modified optimized version,
-- we assume that the current node will be less than the larger
-- son, and unconditionally sift up. Then when we get to the bottom
-- of the tree, we check parents to make sure that we did not make
-- a mistake. This roughly cuts the number of comparisons in half,
-- since it is almost always the case that our assumption is correct.
-- Loop to pull up larger sons
loop
Son := C + C;
if Son < Max then
if Lt (Son, Son + 1) then
Son := Son + 1;
end if;
elsif Son > Max then
exit;
end if;
Xchg (Son, C);
C := Son;
end loop;
-- Loop to check fathers
while C /= S loop
Father := C / 2;
if Lt (Father, C) then
Xchg (Father, C);
C := Father;
else
exit;
end if;
end loop;
end Sift;
-- Start of processing for Sort
begin
-- Phase one of heapsort is to build the heap. This is done by
-- sifting nodes N/2 .. 1 in sequence.
for J in reverse 1 .. N / 2 loop
Sift (J);
end loop;
-- In phase 2, the largest node is moved to end, reducing the size
-- of the tree by one, and the displaced node is sifted down from
-- the top, so that the largest node is again at the top.
while Max > 1 loop
Xchg (1, Max);
Max := Max - 1;
Sift (1);
end loop;
end Sort;
end GNAT.Heap_Sort;
|
reznikmm/matreshka | Ada | 4,651 | 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.Math_Math_Elements;
package Matreshka.ODF_Math.Math_Elements is
type Math_Math_Element_Node is
new Matreshka.ODF_Math.Abstract_Math_Element_Node
and ODF.DOM.Math_Math_Elements.ODF_Math_Math
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Math_Math_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Math_Math_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Math_Math_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 Math_Math_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 Math_Math_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_Math.Math_Elements;
|
reznikmm/matreshka | Ada | 4,640 | 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_Style.Country_Asian_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Country_Asian_Attribute_Node is
begin
return Self : Style_Country_Asian_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Country_Asian_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Country_Asian_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Country_Asian_Attribute,
Style_Country_Asian_Attribute_Node'Tag);
end Matreshka.ODF_Style.Country_Asian_Attributes;
|
datacomo-dm/DMCloud | Ada | 4,260 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: read.adb,v 1.1.1.1 2004/05/31 10:53:40 Administrator Exp $
-- Test/demo program for the generic read interface.
with Ada.Numerics.Discrete_Random;
with Ada.Streams;
with Ada.Text_IO;
with ZLib;
procedure Read is
use Ada.Streams;
------------------------------------
-- Test configuration parameters --
------------------------------------
File_Size : Stream_Element_Offset := 100_000;
Continuous : constant Boolean := False;
-- If this constant is True, the test would be repeated again and again,
-- with increment File_Size for every iteration.
Header : constant ZLib.Header_Type := ZLib.Default;
-- Do not use Header other than Default in ZLib versions 1.1.4 and older.
Init_Random : constant := 8;
-- We are using the same random sequence, in case of we catch bug,
-- so we would be able to reproduce it.
-- End --
Pack_Size : Stream_Element_Offset;
Offset : Stream_Element_Offset;
Filter : ZLib.Filter_Type;
subtype Visible_Symbols
is Stream_Element range 16#20# .. 16#7E#;
package Random_Elements is new
Ada.Numerics.Discrete_Random (Visible_Symbols);
Gen : Random_Elements.Generator;
Period : constant Stream_Element_Offset := 200;
-- Period constant variable for random generator not to be very random.
-- Bigger period, harder random.
Read_Buffer : Stream_Element_Array (1 .. 2048);
Read_First : Stream_Element_Offset;
Read_Last : Stream_Element_Offset;
procedure Reset;
procedure Read
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
-- this procedure is for generic instantiation of
-- ZLib.Read
-- reading data from the File_In.
procedure Read is new ZLib.Read
(Read,
Read_Buffer,
Rest_First => Read_First,
Rest_Last => Read_Last);
----------
-- Read --
----------
procedure Read
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset) is
begin
Last := Stream_Element_Offset'Min
(Item'Last,
Item'First + File_Size - Offset);
for J in Item'First .. Last loop
if J < Item'First + Period then
Item (J) := Random_Elements.Random (Gen);
else
Item (J) := Item (J - Period);
end if;
Offset := Offset + 1;
end loop;
end Read;
-----------
-- Reset --
-----------
procedure Reset is
begin
Random_Elements.Reset (Gen, Init_Random);
Pack_Size := 0;
Offset := 1;
Read_First := Read_Buffer'Last + 1;
Read_Last := Read_Buffer'Last;
end Reset;
begin
Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
loop
for Level in ZLib.Compression_Level'Range loop
Ada.Text_IO.Put ("Level ="
& ZLib.Compression_Level'Image (Level));
-- Deflate using generic instantiation.
ZLib.Deflate_Init
(Filter,
Level,
Header => Header);
Reset;
Ada.Text_IO.Put
(Stream_Element_Offset'Image (File_Size) & " ->");
loop
declare
Buffer : Stream_Element_Array (1 .. 1024);
Last : Stream_Element_Offset;
begin
Read (Filter, Buffer, Last);
Pack_Size := Pack_Size + Last - Buffer'First + 1;
exit when Last < Buffer'Last;
end;
end loop;
Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size));
ZLib.Close (Filter);
end loop;
exit when not Continuous;
File_Size := File_Size + 1;
end loop;
end Read;
|
AdaCore/training_material | Ada | 18,049 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . L I B M _ D O U B L E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Ada Cert Math specific version of s-libdou.ads
-- @llrset Libm
-- LLR Libm
-- ========
package Libm_Double is
pragma Pure;
-- This package provides an implementation of the various C99 functions
-- used in the Ada run time. It is intended to be used for targets that
-- do not have a C math library, or where the C math library isn't of
-- sufficient quality and accuracy to meet Ada requirements.
-- In case of error conditions, NaNs or infinities are returned as
-- recommended in clause F.9 of the C99 standard. When called from C code,
-- the implementation behaves as if the FENV_ACCESS state is off, assuming
-- default rounding behavior and exception behavior.
-- The following C99 elementary functions are provided:
-- Acos, Acosh, Asin, Asinh, Atan, Atan2, Atanh, Cosh, Exp, Exp2, Log,
-- Log1p, Log2, Pow, Sin, Sinh, Tan, Tanh
-- All functions with a NaN argument return a NaN result, except where
-- stated otherwise. Unless otherwise specified, where the symbol +- occurs
-- in both an argument and the result, the result has the same sign as
-- the argument.
-- Each function lists C special values, Ada expected values as well as
-- Ada accuracy requirements the function meets. For accuracy requirements
-- the maximum relative error (abbreviated as MRE) is given, as well as
-- the domain for which the accuracy is guaranteed, where applicable.
-- The maximum relative error is expressed as multiple of Eps,
-- where Eps is Long_Float'Model_Epsilon.
-- What about principal branch ???
----------
-- Acos --
----------
function Acos (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "acos";
-- @llr acos (Long_Float) Special Values
-- The Acos function shall return the following special values:
--
-- C99 special values:
-- Acos (1) = +0
-- Acos (x) = NaN if abs (x) > 1
--
-- Ada expected values:
-- Acos (0) = Pi/2.0 (tightly approximated)
-- Acos (-1) = Pi (tightly approximated)
-- Acos (x) return a result in [0, Pi] radians
--
-- @llr acos (Long_Float) Accuracy
-- The Acos function shall return the inverse cosine of <X> with the
-- following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 4.0 * Eps
-----------
-- Acosh --
-----------
function Acosh (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "acosh";
-- @llr acosh (Long_Float) Special Values
-- The Acosh function shall return the following special values:
--
-- C99 special values:
-- Acosh (1) = +0
-- Acosh (x) = NaN if abs X > 1
-- Acosh (+INF) = +INF
--
-- @llr acosh (Long_Float) Accuracy
-- The Acosh function shall return the inverse hyperbolic tangent of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 8.0 * Eps
----------
-- Asin --
----------
function Asin (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "asin";
-- @llr asin (Long_Float) Special Values
-- The Asin function shall return the following special values:
--
-- C99 special values:
-- Asin (+-0) = +-0
-- Asin (x) = NaN if abs (x) > 1
--
-- Ada expected values:
-- Asin (1) = Pi/2.0 (tightly approximated)
-- Asin (-1) = -Pi/2 (tightly approximated)
-- Asin (x) return a result in [-Pi/2, Pi/2] radians
--
-- @llr asin (Long_Float) Accuracy
-- The Asin function shall return the inverse sine of <X> with the
-- following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 4.0 * Eps
-----------
-- Asinh --
-----------
function Asinh (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "asinh";
-- @llr asinh (Long_Float) Special Values
-- The Asinh function shall return the following special values:
--
-- C99 special values:
-- Asinh (0) = 0
-- Asinh (+INF) = +INF
--
-- @llr asinh (Long_Float) Accuracy
-- The Asinh function shall return the inverse hyperbolic sine of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 8.0 * Eps
----------
-- Atan --
----------
function Atan (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "atan";
-- @llr atan (Long_Float) Special Values
-- The Atan function shall return the following special values:
--
-- C99 special values:
-- Atan (+-0) = +-Pi
-- Atan2 (+-INF) = +-0.5 * Pi
--
-- C expected values:
-- Atan (x) return a result in [-Pi/2, Pi/2]
-----------
-- Atan2 --
-----------
function Atan2 (Y : Long_Float; X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "atan2";
-- @llr atan2 (Long_Float; Long_Float) Special Values
-- The Atan2 function shall return the following special values:
--
-- C99 special values:
-- Atan2 (+-0, -0) = +-Pi
-- Atan2 (+-0, +0) = +-0
-- Atan2 (+-0, x) = +-Pi, if x < 0
-- Atan2 (+-0, x) = +-0, if x > 0
-- Atan2 (y, +-0) = -0.5 * Pi, if y < 0
-- Atan2 (y, +-0) = 0.5 * Pi, if y > 0
-- Atan2 (+-y, -INF) = +-Pi, if y > 0 and y is finite
-- (tightly approximated)
-- Atan2 (+-y, -INF) = +-0, if y < 0 and y is finite
-- Atan2 (+-INF, x) = +-0.5 * Pi, if x is finite
-- (tightly approximated)
-- Atan2 (+-INF, -INF) = +-0.75 * Pi (tightly approximated)
-- Atan2 (+-INF, +INF) = +-0.25 * Pi (tightly approximated)
--
-- Ada expected values:
-- Atan2 (y, x) return a result in [-Pi, Pi]
--
-- @llr atan2 (Long_Float; Long_Float) Accuracy
-- The Atan2 function shall return the inverse tangent of <Y> / <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 4.0 * Eps
-----------
-- Atanh --
-----------
function Atanh (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "atanh";
-- @llr atanh (Long_Float) Special Values
-- The Atanh function shall return the following special values:
--
-- C99 special values:
-- Atanh (0) = 0
-- Atanh (+-1) = +- INF
-- Atanh (X) = NaN for abs X > 1
--
-- @llr atanh (Long_Float) Accuracy
-- The Atanh function shall return the inverse hyperbolic tangent of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 8.0 * Eps
---------
-- Cos --
---------
function Cos (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "cos";
-- @llr cos (Long_Float) Special Values
-- The Cos function shall return the following special values:
--
-- C99 special values:
-- Cos (+-0) = 1
-- Cos (+-INF) = NaN
--
-- Ada expected values:
-- abs (Cos (x)) <= 1
--
-- @llr cos (Long_Float) Accuracy
-- The Cos function shall return the cosine of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 2.0 * Eps
----------
-- Cosh --
----------
function Cosh (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "cosh";
-- @llr cosh (Long_Float) Special Values
-- The Cosh function shall return the following special values:
--
-- C99 special values:
-- Cosh (+-0) = 1
-- Cosh (+-INF) = +INF
--
-- Ada expected values:
-- abs (Cosh (x)) > 1
--
-- @llr cosh (Long_Float) Accuracy
-- The Cosh function shall return the hyperbolic cosine of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 8.0 * Eps
---------
-- Exp --
---------
function Exp (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "exp";
-- @llr exp (Long_Float) Special Values
-- The Exp function shall return the following special values:
--
-- C99 special values:
-- Exp (+-0) = 1
-- Exp (-INF) = +0
-- Exp (+INF) = +INF
--
-- @llr exp (Long_Float) Accuracy
-- The Exp function shall return the exponential of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 4.0 * Eps
----------
-- Exp2 --
----------
function Exp2 (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "exp2";
-- @llr exp2 (Long_Float) Special Values
-- The Exp2 function shall return the following special values:
--
-- C99 special values:
-- Exp2 (+-0) = 1
-- Exp2 (-INF) = +0
-- Exp2 (+INF) = +INF
--
-- @llr exp2 (Long_Float) Accuracy
-- The Exp2 function shall return the exponential of <X> in base 2
-- with the following accuracy:
--
-- Accuracy requirements:
-- MRE <= 4.0 * Eps
---------
-- Log --
---------
function Log (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "log";
-- @llr log (Long_Float) Special Values
-- The Log function shall return the following special values:
--
-- C99 special values:
-- Log (+-0) = -INF
-- Log (1) = +0
-- Log (x) = NaN if x<0
-- Log (+INF) = +INF
--
-- @llr log (Long_Float) Accuracy
-- The Log function shall return the logarithm of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 4.0 * Eps
-----------
-- Log1p --
-----------
function Log1p (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "log1p";
-- @llr log1p (Long_Float) Special Values:
-- The Log1p function shall return the following special values:
--
-- C99 special values:
-- Log1p (+-0) = -INF
-- Log1p (1) = +0
-- Log1p (x) = NaN if x<0
-- Log1p (+INF) = +INF
--
-- @llr log1p (Long_Float) Accuracy
-- The Log1p function shall return the logarithm of <X> + 1
-- with the following accuracy:
--
-- Accuracy requirements:
-- MRE <= 4.0 * Eps
----------
-- Log2 --
----------
function Log2 (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "log2";
-- @llr log2 (Long_Float) Special Values
-- The Log2 function shall return the following special values:
--
-- C99 Special values:
-- Log2 (+-0) = -INF
-- Log2 (1) = +0
-- Log2 (x) = NaN if x<0
-- Log2 (+INF) = +INF
--
-- @llr log2 (Long_Float) Accuracy
-- The Log2 function shall return the logarithm of <X> in base 2
-- with the following accuracy:
--
-- Accuracy requirements:
-- MRE <= 4.0 * Eps
---------
-- Pow --
---------
function Pow (Left, Right : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "pow";
-- @llr pow (Long_Float; Long_Float) Special Values
-- The Pow function shall return the following special values
--
-- C99 Special values:
-- Pow (+-0, y) = +-INF, if y < 0 and y an odd integer
-- Pow (+-0, y) = +INF, if y < 0 and y not an odd integer
-- Pow (+-0, y) = +-0 if y > 0 and y an odd integer
-- Pow (+-0, y) = +0 if y > 0 and y not an odd integer
-- Pow (-1, +-INF) = 1
-- Pow (1, y) = 1 for any y, even a NaN
-- Pow (x, +-0) = 1 for any x, even a NaN
-- Pow (x, y) = NaN, if x < 0 and both x and y finite and not integer
-- Pow (x, -INF) = +INF if abs (x) < 1
-- Pow (x, -INF) = +0 if abs (x) > 1
-- Pow (x, +INF) = +0 if abs (x) < 1
-- Pow (x, +INF) = +INF if abs (x) > 1
-- Pow (-INF, y) = -0 if y < 0 and y an odd integer
-- Pow (-INF, y) = +0 if y < 0 and y not an odd integer
-- Pow (-INF, y) = -INF if y > 0 and y an odd integer
-- Pow (-INF, y) = +INF if y > 0 and y not an odd integer
-- Pow (+INF, y) = +0 if y < 0
-- Pow (+INF, y) = +INF if y > 0
--
-- @llr pow (Long_Float; Long_Float) Accuracy
-- The Pow function shall return <Left> to the power of <Right>
-- with the following accuracy:
--
-- Ada Accuracy requirements:
-- MRE <= (4.0 + abs (x * Log (y)) / 32) * Eps
---------
-- Sin --
---------
function Sin (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "sin";
-- @llr sin (Long_Float) Special Values
-- The Sin function shall return the following special values
--
-- C99 special values:
-- Sin (+-0) = +-0
-- Sin (+-INF) = NaN
--
-- @llr sin (Long_Float) Accuracy
-- The Sin function shall return the sine of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 2.0 * Eps
----------
-- Sinh --
----------
function Sinh (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "sinh";
-- @llr sinh (Long_Float) Special Values
-- The Sinh function shall return the following special values:
--
-- C99 Special values:
-- Sinh (+-0) = +-0
-- Sinh (+-INF) = +-INF
--
-- @llr sinh (Long_Float) Accuracy
-- The Sinh function shall return the hyperbolic sine of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 8.0 * Eps
----------
-- Sqrt --
----------
function Sqrt (X : Long_Float) return Long_Float;
-- The Sqrt function shall return the following special values:
--
-- C99 special values:
-- Sqrt (+-0) = +-0
-- Sqrt (INF) = INF
-- Sqrt (X) = NaN, for X < 0.0
---------
-- Tan --
---------
function Tan (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "tan";
-- @llr tan (Long_Float) Special Values
-- The Tan function shall return the following special values:
--
-- C99 special values:
-- Tan (+-0) = +0
-- Tan (+-INF) = NaN
--
-- @llr tan (Long_Float) Accuracy
-- The Tan function shall return the tangent of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 4.0 * Eps
----------
-- Tanh --
----------
function Tanh (X : Long_Float) return Long_Float
with Export, Convention => C, External_Name => "tanh";
-- @llr tanh (Long_Float) Special Values
-- The Tanh function shall return the following special values:
--
-- C99 special values:
-- Tanh (+-0) = +-0
-- Tanh (+-INF) = +-1
--
-- @llr tanh (Long_Float) Accuracy
-- The Tanh function shall return the hyperbolic tangent of <X>
-- with the following accuracy:
--
-- Ada accuracy requirements:
-- MRE <= 8.0 * Eps
private
function Identity (X : Long_Float) return Long_Float is (X);
function Infinity return Long_Float is (1.0 / Identity (0.0));
function NaN return Long_Float is (Infinity - Infinity);
function Exact (X : Long_Float) return Long_Float is (X);
function Epsilon return Long_Float is (Long_Float'Model_Epsilon);
function Maximum_Relative_Error (X : Long_Float) return Float is
(Float (0.0 * X));
end Libm_Double;
|
reznikmm/matreshka | Ada | 5,068 | 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_Elements;
with AMF.Standard_Profile_L2.Implementation_Classes;
with AMF.UML.Classes;
with AMF.Visitors;
package AMF.Internals.Standard_Profile_L2_Implementation_Classes is
type Standard_Profile_L2_Implementation_Class_Proxy is
limited new AMF.Internals.UML_Elements.UML_Element_Base
and AMF.Standard_Profile_L2.Implementation_Classes.Standard_Profile_L2_Implementation_Class with null record;
overriding function Get_Base_Class
(Self : not null access constant Standard_Profile_L2_Implementation_Class_Proxy)
return AMF.UML.Classes.UML_Class_Access;
-- Getter of ImplementationClass::base_Class.
--
overriding procedure Set_Base_Class
(Self : not null access Standard_Profile_L2_Implementation_Class_Proxy;
To : AMF.UML.Classes.UML_Class_Access);
-- Setter of ImplementationClass::base_Class.
--
overriding procedure Enter_Element
(Self : not null access constant Standard_Profile_L2_Implementation_Class_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant Standard_Profile_L2_Implementation_Class_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant Standard_Profile_L2_Implementation_Class_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.Standard_Profile_L2_Implementation_Classes;
|
stcarrez/jason | Ada | 4,938 | ads | -----------------------------------------------------------------------
-- jason-projects-beans -- Beans for module projects
-- Copyright (C) 2016 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 ADO;
with ASF.Helpers.Beans;
with AWA.Tags.Beans;
with AWA.Wikis.Beans;
with Util.Beans.Basic;
with Util.Beans.Objects;
with Jason.Projects.Modules;
with Jason.Projects.Models;
package Jason.Projects.Beans is
type Project_Bean is new Jason.Projects.Models.Project_Bean with record
Module : Jason.Projects.Modules.Project_Module_Access := null;
Count : Natural := 0;
Id : ADO.Identifier := ADO.NO_IDENTIFIER;
-- List of tags associated with the wiki page.
Tags : aliased AWA.Tags.Beans.Tag_List_Bean;
Tags_Bean : Util.Beans.Basic.Readonly_Bean_Access;
-- The wiki space.
Wiki_Space : AWA.Wikis.Beans.Wiki_Space_Bean;
end record;
type Project_Bean_Access is access all Project_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Project_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Project_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create project action.
overriding
procedure Create (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Save project action.
overriding
procedure Save (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Load project information.
overriding
procedure Load (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the wiki space.
overriding
procedure Create_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Load the project if it is associated with the current wiki space.
overriding
procedure Load_Wiki (Bean : in out Project_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Projects_Bean bean instance.
function Create_Project_Bean (Module : in Jason.Projects.Modules.Project_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
function Get_Project_Bean is
new ASF.Helpers.Beans.Get_Bean (Element_Type => Project_Bean,
Element_Access => Project_Bean_Access);
-- ------------------------------
-- Bean that collects the list of projects filtered by tag, priority and status.
-- ------------------------------
type Project_List_Bean is new Jason.Projects.Models.Project_List_Bean with record
Module : Jason.Projects.Modules.Project_Module_Access := null;
Project : Jason.Projects.Models.Project_Ref;
-- List of tickets.
Projects : aliased Jason.Projects.Models.List_Info_List_Bean;
Projects_Bean : Jason.Projects.Models.List_Info_List_Bean_Access;
-- List of tags associated with the tickets.
Tags : AWA.Tags.Beans.Entity_Tag_Map;
end record;
type Project_List_Bean_Access is access all Project_List_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Project_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Project_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Load list of tickets.
overriding
procedure Load (Bean : in out Project_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Create the Project_List_Bean bean instance.
function Create_Project_List_Bean (Module : in Jason.Projects.Modules.Project_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
end Jason.Projects.Beans;
|
charlie5/cBound | Ada | 1,780 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_vendor_private_with_reply_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
retval : aliased Interfaces.Unsigned_32;
data1 : aliased swig.int8_t_Array (0 .. 23);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_vendor_private_with_reply_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_vendor_private_with_reply_reply_t.Item,
Element_Array =>
xcb.xcb_glx_vendor_private_with_reply_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_vendor_private_with_reply_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_vendor_private_with_reply_reply_t.Pointer,
Element_Array =>
xcb.xcb_glx_vendor_private_with_reply_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_vendor_private_with_reply_reply_t;
|
zhmu/ananas | Ada | 288 | ads | package Corr_Discr is
type Base (T1 : Boolean := True; T2 : Boolean := False)
is null record;
for Base use record
T1 at 0 range 0 .. 0;
T2 at 0 range 1 .. 1;
end record;
type Deriv (D : Boolean := False) is new Base (T1 => True, T2 => D);
end Corr_Discr;
|
dan76/Amass | Ada | 1,470 | ads | -- Copyright © by Jeff Foley 2017-2023. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-- SPDX-License-Identifier: Apache-2.0
name = "Active DNS"
type = "dns"
local cfg
function start()
cfg = config()
end
function vertical(ctx, domain)
if (cfg == nil or cfg.mode ~= "active") then
return
end
for _, addr in pairs(ns_addrs(ctx, domain)) do
zone_walk(ctx, domain, addr)
zone_transfer(ctx, domain, addr)
end
end
function subdomain(ctx, name, domain, times)
if (cfg == nil or cfg.mode ~= "active" or times > 1) then
return
end
for _, addr in pairs(ns_addrs(ctx, name)) do
zone_walk(ctx, name, addr)
zone_transfer(ctx, name, addr)
end
end
function ns_addrs(ctx, name)
local addrs = {}
local resp, err = resolve(ctx, name, "NS")
if (err ~= nil or #resp == 0) then
return addrs
end
for _, record in pairs(resp) do
resp, err = resolve(ctx, record['rrdata'], "A")
if (err == nil and #resp > 0) then
for _, rr in pairs(resp) do
table.insert(addrs, rr['rrdata'])
end
end
resp, err = resolve(ctx, record['rrdata'], "AAAA")
if (err == nil and #resp > 0) then
for _, rr in pairs(resp) do
table.insert(addrs, rr['rrdata'])
end
end
end
return addrs
end
|
sudoadminservices/bugbountyservices | Ada | 3,221 | 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 = "SecurityTrails"
type = "api"
function start()
setratelimit(1)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local resp
local vurl = verturl(domain)
-- Check if the response data is in the graph database
if (cfg.ttl ~= nil and cfg.ttl > 0) then
resp = obtain_response(vurl, cfg.ttl)
end
if (resp == nil or resp == "") then
local err
resp, err = request({
url=vurl,
headers={
APIKEY=c.key,
['Content-Type']="application/json",
},
})
if (err ~= nil and err ~= "") then
return
end
if (cfg.ttl ~= nil and cfg.ttl > 0) then
cache_response(vurl, resp)
end
end
local j = json.decode(resp)
if (j == nil or #(j.subdomains) == 0) then
return
end
for i, sub in pairs(j.subdomains) do
sendnames(ctx, sub .. "." .. domain)
end
end
function verturl(domain)
return "https://api.securitytrails.com/v1/domain/" .. domain .. "/subdomains"
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
local found = {}
for i, v in pairs(names) do
if found[v] == nil then
newname(ctx, v)
found[v] = true
end
end
end
function horizontal(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == "") then
return
end
local resp
local hurl = horizonurl(domain)
-- Check if the response data is in the graph database
if (cfg.ttl ~= nil and cfg.ttl > 0) then
resp = obtain_response(hurl, cfg.ttl)
end
if (resp == nil or resp == "") then
local err
resp, err = request({
url=hurl,
headers={
APIKEY=c.key,
['Content-Type']="application/json",
},
})
if (err ~= nil and err ~= "") then
return
end
if (cfg.ttl ~= nil and cfg.ttl > 0) then
cache_response(hurl, resp)
end
end
local j = json.decode(resp)
if (j == nil or #(j.records) == 0) then
return
end
assoc = {}
for i, r in pairs(j.records) do
if r.hostname ~= "" then
table.insert(assoc, r.hostname)
end
end
for i, a in pairs(assoc) do
associated(ctx, domain, a)
end
end
function horizonurl(domain)
return "https://api.securitytrails.com/v1/domain/" .. domain .. "/associated"
end
|
python36/0xfa | Ada | 1,287 | ads | with numbers; use numbers;
with strings; use strings;
package address is
type pos_addr_t is tagged private;
null_pos_addr : constant pos_addr_t;
error_address_odd : exception;
function create (value : word) return pos_addr_t;
procedure set (pos_addr : in out pos_addr_t; value : word);
function get (pos_addr : pos_addr_t) return word;
function valid_value_for_pos_addr (value : word) return boolean;
procedure inc (pos_addr : in out pos_addr_t);
function inc (pos_addr : pos_addr_t) return pos_addr_t;
procedure dec (pos_addr : in out pos_addr_t);
function "<" (a, b : pos_addr_t) return boolean;
function "<=" (a, b : pos_addr_t) return boolean;
function ">" (a, b : pos_addr_t) return boolean;
function ">=" (a, b : pos_addr_t) return boolean;
function "-" (a, b : pos_addr_t) return pos_addr_t;
function "+" (a, b : pos_addr_t) return pos_addr_t;
function "*" (a, b : pos_addr_t) return pos_addr_t;
function "/" (a, b : pos_addr_t) return pos_addr_t;
function "+" (a: pos_addr_t; b : natural) return pos_addr_t;
function "+" (a: pos_addr_t; b : word) return pos_addr_t;
private
use type word;
type pos_addr_t is tagged record
addr : word;
end record;
null_pos_addr : constant pos_addr_t := (addr => 16#ffff#);
end address; |
reznikmm/matreshka | Ada | 4,592 | 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$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
package AMF.Internals.Tables.Primitive_Types_Metamodel.Objects is
procedure Initialize;
private
procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent);
end AMF.Internals.Tables.Primitive_Types_Metamodel.Objects;
|
stcarrez/ada-el | Ada | 7,250 | ads | -----------------------------------------------------------------------
-- el-contexts-default -- Default contexts for evaluating an expression
-- Copyright (C) 2009, 2010, 2011, 2015, 2021 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 EL.Variables;
with Ada.Finalization;
private with Util.Beans.Objects.Maps;
-- private with EL.Objects.Maps; creates Assert_Failure sem_ch10.adb:2691
package EL.Contexts.Default is
-- ------------------------------
-- Default Context
-- ------------------------------
-- Context information for expression evaluation.
type Default_Context is new Ada.Finalization.Controlled and ELContext with private;
type Default_Context_Access is access all Default_Context'Class;
overriding
procedure Finalize (Obj : in out Default_Context);
-- Retrieves the ELResolver associated with this ELcontext.
overriding
function Get_Resolver (Context : Default_Context) return ELResolver_Access;
-- Retrieves the VariableMapper associated with this ELContext.
overriding
function Get_Variable_Mapper (Context : Default_Context)
return access EL.Variables.Variable_Mapper'Class;
-- Retrieves the FunctionMapper associated with this ELContext.
-- The FunctionMapper is only used when parsing an expression.
overriding
function Get_Function_Mapper (Context : Default_Context)
return EL.Functions.Function_Mapper_Access;
-- Set the function mapper to be used when parsing an expression.
overriding
procedure Set_Function_Mapper (Context : in out Default_Context;
Mapper : access EL.Functions.Function_Mapper'Class);
-- Set the VariableMapper associated with this ELContext.
overriding
procedure Set_Variable_Mapper (Context : in out Default_Context;
Mapper : access EL.Variables.Variable_Mapper'Class);
-- Set the ELResolver associated with this ELcontext.
procedure Set_Resolver (Context : in out Default_Context;
Resolver : in ELResolver_Access);
procedure Set_Variable (Context : in out Default_Context;
Name : in String;
Value : access Util.Beans.Basic.Readonly_Bean'Class);
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Default_Context;
Ex : in Ada.Exceptions.Exception_Occurrence);
-- ------------------------------
-- Guarded Context
-- ------------------------------
-- The <b>Guarded_Context</b> is a proxy context that allows to handle exceptions
-- raised when evaluating expressions. The <b>Handler</b> procedure will be called
-- when an exception is raised when the expression is evaluated. This allows to
-- report an error message and ignore or not the exception (See ASF).
type Guarded_Context (Handler : not null access
procedure (Ex : in Ada.Exceptions.Exception_Occurrence);
Context : ELContext_Access)
is new Ada.Finalization.Limited_Controlled and ELContext with null record;
type Guarded_Context_Access is access all Default_Context'Class;
-- Retrieves the ELResolver associated with this ELcontext.
overriding
function Get_Resolver (Context : in Guarded_Context) return ELResolver_Access;
-- Retrieves the Variable_Mapper associated with this ELContext.
overriding
function Get_Variable_Mapper (Context : in Guarded_Context)
return access EL.Variables.Variable_Mapper'Class;
-- Retrieves the Function_Mapper associated with this ELContext.
-- The Function_Mapper is only used when parsing an expression.
overriding
function Get_Function_Mapper (Context : in Guarded_Context)
return EL.Functions.Function_Mapper_Access;
-- Set the function mapper to be used when parsing an expression.
overriding
procedure Set_Function_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Functions.Function_Mapper'Class);
-- Set the Variable_Mapper associated with this ELContext.
overriding
procedure Set_Variable_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Variables.Variable_Mapper'Class);
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Guarded_Context;
Ex : in Ada.Exceptions.Exception_Occurrence);
-- ------------------------------
-- Default Resolver
-- ------------------------------
type Default_ELResolver is new ELResolver with private;
type Default_ELResolver_Access is access all Default_ELResolver'Class;
-- Get the value associated with a base object and a given property.
overriding
function Get_Value (Resolver : Default_ELResolver;
Context : ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : Unbounded_String) return EL.Objects.Object;
-- Set the value associated with a base object and a given property.
overriding
procedure Set_Value (Resolver : in out Default_ELResolver;
Context : in ELContext'Class;
Base : access Util.Beans.Basic.Bean'Class;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
-- Register the value under the given name.
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in Util.Beans.Basic.Readonly_Bean_Access);
-- Register the value under the given name.
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
private
type Default_Context is new Ada.Finalization.Controlled and ELContext with record
Var_Mapper : EL.Variables.Variable_Mapper_Access;
Resolver : ELResolver_Access;
Function_Mapper : EL.Functions.Function_Mapper_Access;
Var_Mapper_Created : Boolean := False;
end record;
type Default_ELResolver is new ELResolver with record
Map : EL.Objects.Maps.Map;
end record;
end EL.Contexts.Default;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 8,691 | ads | -- This spec has been automatically generated from STM32F030.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.Flash is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype ACR_LATENCY_Field is STM32_SVD.UInt3;
subtype ACR_PRFTBE_Field is STM32_SVD.Bit;
subtype ACR_PRFTBS_Field is STM32_SVD.Bit;
-- Flash access control register
type ACR_Register is record
-- LATENCY
LATENCY : ACR_LATENCY_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- PRFTBE
PRFTBE : ACR_PRFTBE_Field := 16#1#;
-- Read-only. PRFTBS
PRFTBS : ACR_PRFTBS_Field := 16#1#;
-- unspecified
Reserved_6_31 : STM32_SVD.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ACR_Register use record
LATENCY at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
PRFTBE at 0 range 4 .. 4;
PRFTBS at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
subtype SR_BSY_Field is STM32_SVD.Bit;
subtype SR_PGERR_Field is STM32_SVD.Bit;
subtype SR_WRPRT_Field is STM32_SVD.Bit;
subtype SR_EOP_Field is STM32_SVD.Bit;
-- Flash status register
type SR_Register is record
-- Read-only. Busy
BSY : SR_BSY_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Programming error
PGERR : SR_PGERR_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Write protection error
WRPRT : SR_WRPRT_Field := 16#0#;
-- End of operation
EOP : SR_EOP_Field := 16#0#;
-- unspecified
Reserved_6_31 : STM32_SVD.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
BSY at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
PGERR at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
WRPRT at 0 range 4 .. 4;
EOP at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
subtype CR_PG_Field is STM32_SVD.Bit;
subtype CR_PER_Field is STM32_SVD.Bit;
subtype CR_MER_Field is STM32_SVD.Bit;
subtype CR_OPTPG_Field is STM32_SVD.Bit;
subtype CR_OPTER_Field is STM32_SVD.Bit;
subtype CR_STRT_Field is STM32_SVD.Bit;
subtype CR_LOCK_Field is STM32_SVD.Bit;
subtype CR_OPTWRE_Field is STM32_SVD.Bit;
subtype CR_ERRIE_Field is STM32_SVD.Bit;
subtype CR_EOPIE_Field is STM32_SVD.Bit;
subtype CR_FORCE_OPTLOAD_Field is STM32_SVD.Bit;
-- Flash control register
type CR_Register is record
-- Programming
PG : CR_PG_Field := 16#0#;
-- Page erase
PER : CR_PER_Field := 16#0#;
-- Mass erase
MER : CR_MER_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Option byte programming
OPTPG : CR_OPTPG_Field := 16#0#;
-- Option byte erase
OPTER : CR_OPTER_Field := 16#0#;
-- Start
STRT : CR_STRT_Field := 16#0#;
-- Lock
LOCK : CR_LOCK_Field := 16#1#;
-- unspecified
Reserved_8_8 : STM32_SVD.Bit := 16#0#;
-- Option bytes write enable
OPTWRE : CR_OPTWRE_Field := 16#0#;
-- Error interrupt enable
ERRIE : CR_ERRIE_Field := 16#0#;
-- unspecified
Reserved_11_11 : STM32_SVD.Bit := 16#0#;
-- End of operation interrupt enable
EOPIE : CR_EOPIE_Field := 16#0#;
-- Force option byte loading
FORCE_OPTLOAD : CR_FORCE_OPTLOAD_Field := 16#0#;
-- unspecified
Reserved_14_31 : STM32_SVD.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
PG at 0 range 0 .. 0;
PER at 0 range 1 .. 1;
MER at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
OPTPG at 0 range 4 .. 4;
OPTER at 0 range 5 .. 5;
STRT at 0 range 6 .. 6;
LOCK at 0 range 7 .. 7;
Reserved_8_8 at 0 range 8 .. 8;
OPTWRE at 0 range 9 .. 9;
ERRIE at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
EOPIE at 0 range 12 .. 12;
FORCE_OPTLOAD at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
subtype OBR_OPTERR_Field is STM32_SVD.Bit;
subtype OBR_LEVEL1_PROT_Field is STM32_SVD.Bit;
subtype OBR_LEVEL2_PROT_Field is STM32_SVD.Bit;
subtype OBR_WDG_SW_Field is STM32_SVD.Bit;
subtype OBR_nRST_STOP_Field is STM32_SVD.Bit;
subtype OBR_nRST_STDBY_Field is STM32_SVD.Bit;
subtype OBR_BOOT1_Field is STM32_SVD.Bit;
subtype OBR_VDDA_MONITOR_Field is STM32_SVD.Bit;
-- OBR_Data array element
subtype OBR_Data_Element is STM32_SVD.Byte;
-- OBR_Data array
type OBR_Data_Field_Array is array (0 .. 1) of OBR_Data_Element
with Component_Size => 8, Size => 16;
-- Type definition for OBR_Data
type OBR_Data_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- Data as a value
Val : STM32_SVD.UInt16;
when True =>
-- Data as an array
Arr : OBR_Data_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for OBR_Data_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Option byte register
type OBR_Register is record
-- Read-only. Option byte error
OPTERR : OBR_OPTERR_Field;
-- Read-only. Level 1 protection status
LEVEL1_PROT : OBR_LEVEL1_PROT_Field;
-- Read-only. Level 2 protection status
LEVEL2_PROT : OBR_LEVEL2_PROT_Field;
-- unspecified
Reserved_3_7 : STM32_SVD.UInt5;
-- Read-only. WDG_SW
WDG_SW : OBR_WDG_SW_Field;
-- Read-only. nRST_STOP
nRST_STOP : OBR_nRST_STOP_Field;
-- Read-only. nRST_STDBY
nRST_STDBY : OBR_nRST_STDBY_Field;
-- unspecified
Reserved_11_11 : STM32_SVD.Bit;
-- Read-only. BOOT1
BOOT1 : OBR_BOOT1_Field;
-- Read-only. VDDA_MONITOR
VDDA_MONITOR : OBR_VDDA_MONITOR_Field;
-- unspecified
Reserved_14_15 : STM32_SVD.UInt2;
-- Read-only. Data0
Data : OBR_Data_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OBR_Register use record
OPTERR at 0 range 0 .. 0;
LEVEL1_PROT at 0 range 1 .. 1;
LEVEL2_PROT at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
WDG_SW at 0 range 8 .. 8;
nRST_STOP at 0 range 9 .. 9;
nRST_STDBY at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
BOOT1 at 0 range 12 .. 12;
VDDA_MONITOR at 0 range 13 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
Data at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Flash
type Flash_Peripheral is record
-- Flash access control register
ACR : aliased ACR_Register;
-- Flash key register
KEYR : aliased STM32_SVD.UInt32;
-- Flash option key register
OPTKEYR : aliased STM32_SVD.UInt32;
-- Flash status register
SR : aliased SR_Register;
-- Flash control register
CR : aliased CR_Register;
-- Flash address register
AR : aliased STM32_SVD.UInt32;
-- Option byte register
OBR : aliased OBR_Register;
-- Write protection register
WRPR : aliased STM32_SVD.UInt32;
end record
with Volatile;
for Flash_Peripheral use record
ACR at 16#0# range 0 .. 31;
KEYR at 16#4# range 0 .. 31;
OPTKEYR at 16#8# range 0 .. 31;
SR at 16#C# range 0 .. 31;
CR at 16#10# range 0 .. 31;
AR at 16#14# range 0 .. 31;
OBR at 16#1C# range 0 .. 31;
WRPR at 16#20# range 0 .. 31;
end record;
-- Flash
Flash_Periph : aliased Flash_Peripheral
with Import, Address => System'To_Address (16#40022000#);
end STM32_SVD.Flash;
|
reznikmm/matreshka | Ada | 3,633 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Activity_Final_Nodes.Hash is
new AMF.Elements.Generic_Hash (UML_Activity_Final_Node, UML_Activity_Final_Node_Access);
|
reznikmm/matreshka | Ada | 3,636 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Interaction_Fragments.Hash is
new AMF.Elements.Generic_Hash (UML_Interaction_Fragment, UML_Interaction_Fragment_Access);
|
reznikmm/mount_photos | Ada | 2,738 | ads | -- Copyright (c) 2020 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Streams;
with Ada.Containers.Hashed_Maps;
with Fuse.Main;
with League.Stream_Element_Vectors;
with League.Strings.Hash;
package Photo_Files is
type Element_Array is
array (Positive range <>) of Ada.Streams.Stream_Element;
type File is record
Id : League.Strings.Universal_String;
Base_URL : League.Strings.Universal_String;
end record;
package File_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String, -- Name
Element_Type => File,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=");
type Album is record
Id : League.Strings.Universal_String;
Files : File_Maps.Map;
end record;
package Album_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String, -- Name
Element_Type => Album,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=");
type Context is record
Access_Token : League.Strings.Universal_String;
Albums : Album_Maps.Map;
Cached_File : League.Strings.Universal_String;
Cached_Data : League.Stream_Element_Vectors.Stream_Element_Vector;
end record;
type Context_Access is access all Context;
pragma Warnings (Off);
package Photos is new Fuse.Main
(Element_Type => Ada.Streams.Stream_Element,
Element_Array => Element_Array,
User_Data_Type => Context_Access);
pragma Warnings (On);
function GetAttr
(Path : in String;
St_Buf : access Photos.System.Stat_Type)
return Photos.System.Error_Type;
function Open
(Path : in String;
Fi : access Photos.System.File_Info_Type)
return Photos.System.Error_Type;
function Read
(Path : in String;
Buffer : access Photos.Buffer_Type;
Size : in out Natural;
Offset : in Natural;
Fi : access Photos.System.File_Info_Type)
return Photos.System.Error_Type;
function ReadDir
(Path : in String;
Filler : access procedure
(Name : String;
St_Buf : Photos.System.Stat_Access;
Offset : Natural);
Offset : in Natural;
Fi : access Photos.System.File_Info_Type)
return Photos.System.Error_Type;
package Hello_GetAttr is new Photos.GetAttr;
package Hello_Open is new Photos.Open;
package Hello_Read is new Photos.Read;
package Hello_ReadDir is new Photos.ReadDir;
end Photo_Files;
|
reznikmm/matreshka | Ada | 3,677 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- 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 Servlet.HTTP_Responses;
package Servlet.FastCGI_Responses is
type FastCGI_Servet_Response is
limited new Servlet.HTTP_Responses.HTTP_Servlet_Response with private;
private
type FastCGI_Servet_Response is
limited new Servlet.HTTP_Responses.HTTP_Servlet_Response with null record;
end Servlet.FastCGI_Responses;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.