repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
andreas-woelfl/astma
Ada
842
adb
with Text_IO; package body Memory_Analyzer is function Bytes_Required (Value : in Integer) return Integer is Bytes_To_Long_Word : constant Integer := 4; Offset_To_Byte_In_Bits : constant Integer := 8 - 1; Offset_To_Long_Word_In_Bytes : Integer := Bytes_To_Long_Word - 1; begin return (( (((Value + Offset_To_Byte_In_Bits) / 8) + Offset_To_Long_Word_In_Bytes) / Bytes_To_Long_Word) * Bytes_To_Long_Word); end Bytes_Required; function Count (Size : Integer; File : String; Var : String) return Boolean is begin Text_IO.Put_Line ("local, " & File & ", " & Var & ", " & Integer'Image (Bytes_Required (Size))); return True; end Count; end Memory_Analyzer;
reznikmm/matreshka
Ada
6,880
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_Meta.Auto_Reload_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Meta_Auto_Reload_Element_Node is begin return Self : Meta_Auto_Reload_Element_Node do Matreshka.ODF_Meta.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Meta_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Meta_Auto_Reload_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_Meta_Auto_Reload (ODF.DOM.Meta_Auto_Reload_Elements.ODF_Meta_Auto_Reload_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 Meta_Auto_Reload_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Auto_Reload_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Meta_Auto_Reload_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_Meta_Auto_Reload (ODF.DOM.Meta_Auto_Reload_Elements.ODF_Meta_Auto_Reload_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 Meta_Auto_Reload_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_Meta_Auto_Reload (Visitor, ODF.DOM.Meta_Auto_Reload_Elements.ODF_Meta_Auto_Reload_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.Meta_URI, Matreshka.ODF_String_Constants.Auto_Reload_Element, Meta_Auto_Reload_Element_Node'Tag); end Matreshka.ODF_Meta.Auto_Reload_Elements;
strenkml/EE368
Ada
1,761
ads
package Memory.Flash is type Flash_Type is new Memory_Type with private; type Flash_Pointer is access all Flash_Type'Class; function Create_Flash(word_size : Positive := 8; block_size : Positive := 256; read_latency : Time_Type := 10; write_latency : Time_Type := 1000) return Flash_Pointer; overriding function Clone(mem : Flash_Type) return Memory_Pointer; overriding procedure Reset(mem : in out Flash_Type; context : in Natural); overriding procedure Read(mem : in out Flash_Type; address : in Address_Type; size : in Positive); overriding procedure Write(mem : in out Flash_Type; address : in Address_Type; size : in Positive); overriding function To_String(mem : Flash_Type) return Unbounded_String; overriding function Get_Cost(mem : Flash_Type) return Cost_Type; overriding function Get_Writes(mem : Flash_Type) return Long_Integer; overriding function Get_Word_Size(mem : Flash_Type) return Positive; overriding function Get_Ports(mem : Flash_Type) return Port_Vector_Type; overriding procedure Generate(mem : in Flash_Type; sigs : in out Unbounded_String; code : in out Unbounded_String); private type Flash_Type is new Memory_Type with record word_size : Positive := 8; block_size : Positive := 256; read_latency : Time_Type := 10; write_latency : Time_Type := 1000; writes : Long_Integer := 0; end record; end Memory.Flash;
strenkml/EE368
Ada
1,206
ads
package Memory.Transform.Offset is type Offset_Type is new Transform_Type with private; type Offset_Pointer is access all Offset_Type'Class; function Create_Offset return Offset_Pointer; function Random_Offset(next : access Memory_Type'Class; generator : Distribution_Type; max_cost : Cost_Type) return Memory_Pointer; overriding function Clone(mem : Offset_Type) return Memory_Pointer; overriding procedure Permute(mem : in out Offset_Type; generator : in Distribution_Type; max_cost : in Cost_Type); overriding function Is_Empty(mem : Offset_Type) return Boolean; overriding function Get_Name(mem : Offset_Type) return String; private type Offset_Type is new Transform_Type with null record; overriding function Apply(mem : Offset_Type; address : Address_Type; dir : Boolean) return Address_Type; overriding function Get_Alignment(mem : Offset_Type) return Positive; overriding function Get_Transform_Length(mem : Offset_Type) return Natural; end Memory.Transform.Offset;
clairvoyant/anagram
Ada
14,836
adb
-- Copyright (c) 2010-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Anagram.Grammars.Tools; package body Anagram.Grammars.LR.LALR is End_Of_File : constant := 0; ----------- -- Build -- ----------- function Build (Input : Grammar; Right_Nulled : Boolean) return LR_Tables.Table_Access is C : Set_Of_LR_Item_Set_Access := Items (Input); -- Set of LR(0) items Min_Reference : constant Reference := To_Reference (Input.Last_Terminal); Max_Reference : constant Reference := To_Reference (Input.Last_Non_Terminal); subtype Ref is Reference range Min_Reference .. Max_Reference; type Reference_Set is array (Ref) of Boolean with Pack; type Lookahead_Set is array (1 .. C.Last_Item) of Reference_Set; -- Set of terminal for each LR_Item in any State type Offset_Set is array (1 .. C.Last_Item) of Boolean with Pack; -- Set of unconsidered LR_Items type Reference_Set_Indexed_By_Non_Terminal is array (Non_Terminal_Index range <>) of Reference_Set; procedure Add_Recuces (Result : in out LR_Tables.Table; Added : in out Reference_Set_Indexed_By_Non_Terminal; State : State_Index; Prod : Production_Index; Next : Part_Index; LA : Reference_Set); -- Add reduce of Prod to Result using LA look ahead set and -- reduces of transitive closure of LR-item. procedure Next_To_Do_Item (To_Do : Offset_Set; State : in out LR.State_Index; Offset : in out LR_Item_Index); -- Look for next unconsidered LR_Item and it's State procedure Fill_Look_Aheads (Look_Aheads : in out Lookahead_Set); -- Fill Look_Aheads table function Get_First (From, To : Part_Index; -- This is β Default : Reference_Set) -- This is a return Reference_Set; -- This is FIRST (βa) function Check_Added (Added : in out Reference_Set_Indexed_By_Non_Terminal; Index : Non_Terminal_Index; Set : in out Reference_Set) return Boolean; -- Check if some of Set not in Added (Index) yet. -- Then let "Added := Added or Set" and "Set := Set - Added" function Is_Right_Nulled (From, To : Part_Index) return Boolean; -- Check if parts => ε and Right_Nulled enabled ----------------- -- Add_Recuces -- ----------------- procedure Add_Recuces (Result : in out LR_Tables.Table; Added : in out Reference_Set_Indexed_By_Non_Terminal; State : State_Index; Prod : Production_Index; Next : Part_Index; LA : Reference_Set) is P : Production renames Input.Production (Prod); NT : constant Non_Terminal_Index := P.Parent; begin if Next > P.Last then -- A := α . if NT = Input.Root then -- S' := S . LR_Tables.Set_Finish (Result, State); else for T in 0 .. Input.Last_Terminal loop if LA (To_Reference (T)) then LR_Tables.Set_Reduce (Result, State, T, Prod, P.Last); end if; end loop; -- The same for non-terminals for NT in 1 .. Input.Last_Non_Terminal loop if LA (To_Reference (NT)) then LR_Tables.Set_Reduce (Result, State, NT, Prod, P.Last); end if; end loop; end if; elsif Input.Part (Next).Is_Non_Terminal_Reference then if Is_Right_Nulled (Next, P.Last) then for T in 0 .. Input.Last_Terminal loop if LA (To_Reference (T)) then LR_Tables.Set_Reduce (Result, State, T, Prod, Next - 1); end if; end loop; -- The same for non-terminals for NT in 1 .. Input.Last_Non_Terminal loop if LA (To_Reference (NT)) then LR_Tables.Set_Reduce (Result, State, NT, Prod, P.Last); end if; end loop; end if; -- A := α . B β -- Add closure of kernel item declare Set : Reference_Set := Get_First (Next + 1, P.Last, LA); B : Non_Terminal renames Input.Non_Terminal (Input.Part (Next).Denote); begin if Check_Added (Added, B.Index, Set) then for P in B.First .. B.Last loop Add_Recuces (Result, Added, State, P, Input.Production (P).First, Set); end loop; end if; end; end if; end Add_Recuces; ----------------- -- Check_Added -- ----------------- function Check_Added (Added : in out Reference_Set_Indexed_By_Non_Terminal; Index : Non_Terminal_Index; Set : in out Reference_Set) return Boolean is begin Set := Set and not Added (Index); if Set = (Ref => False) then return False; else Added (Index) := Added (Index) or Set; return True; end if; end Check_Added; ---------------------- -- Fill_Look_Aheads -- ---------------------- procedure Fill_Look_Aheads (Look_Aheads : in out Lookahead_Set) is procedure Add (Added : in out Reference_Set_Indexed_By_Non_Terminal; State : State_Index; Prod : Production_Index; Next : Part_Index; Look_Ahead : Reference_Set); Source_State : LR.State_Index := 1; Source_Index : LR_Item_Index := 1; To_Do : Offset_Set := (others => False); To_Do_Count : Natural; --------- -- Add -- --------- procedure Add (Added : in out Reference_Set_Indexed_By_Non_Terminal; State : State_Index; Prod : Production_Index; Next : Part_Index; Look_Ahead : Reference_Set) is P : Production renames Input.Production (Prod); R : Reference; Old : Reference_Set; Target_State : LR.State_Index; Target_Index : LR_Item_Index := LR_Item_Index'Last; begin if Next > P.Last then -- A := α . return; end if; R := To_Reference (Input.Part (Next)); Target_State := C.Go_To (R, State); for J in C.Ranges (Target_State).First .. C.Ranges (Target_State).Last loop if C.List (J) = To_Item (Next) then Target_Index := J; exit; end if; end loop; Old := Look_Aheads (Target_Index); Look_Aheads (Target_Index) := Look_Aheads (Target_Index) or Look_Ahead; if not To_Do (Target_Index) and then Old /= Look_Aheads (Target_Index) then To_Do (Target_Index) := True; To_Do_Count := To_Do_Count + 1; end if; -- A := α . B β if Input.Part (Next).Is_Non_Terminal_Reference then -- Add closure of kernel item declare Set : Reference_Set := Get_First (Next + 1, P.Last, Look_Ahead); B : Non_Terminal renames Input.Non_Terminal (Input.Part (Next).Denote); begin if Check_Added (Added, B.Index, Set) then for P in B.First .. B.Last loop Add (Added, State, P, Input.Production (P).First, Set); end loop; end if; end; end if; end Add; begin Look_Aheads (Source_Index) (End_Of_File) := True; To_Do (Source_Index) := True; To_Do_Count := 1; while To_Do_Count > 0 loop declare Added : Reference_Set_Indexed_By_Non_Terminal := (1 .. Input.Last_Non_Terminal => (Ref => False)); begin Next_To_Do_Item (To_Do, Source_State, Source_Index); To_Do (Source_Index) := False; To_Do_Count := To_Do_Count - 1; declare Item : constant LR_Item := C.List (Source_Index); Next : Part_Index; Prod : constant Production_Index := To_Production (Input, Item); begin if Item = 0 then Next := Input.Production (Prod).First; else Next := Part_Index (Item + 1); end if; Add (Added, Source_State, Prod, Next, Look_Aheads (Source_Index)); end; end; end loop; end Fill_Look_Aheads; First : Tools.Terminal_Set_Per_Non_Terminal (Input.Last_Terminal, Input.Last_Non_Terminal); -- FIRST (A) for each non-terminal A First_NT : Tools.Non_Terminal_Set_Per_Non_Terminal (Input.Last_Non_Terminal); --------------- -- Get_First -- --------------- function Get_First (From, To : Part_Index; -- This is β Default : Reference_Set) -- This is a return Reference_Set -- This is FIRST (βa) is Result : Reference_Set := (others => False); T : Terminal_Index; NT : Non_Terminal_Index; begin for P of Input.Part (From .. To) loop if P.Is_Terminal_Reference then T := P.Denote; Result (To_Reference (T)) := True; return Result; else -- non terminal reference X NT := P.Denote; Result (To_Reference (NT)) := True; for T in 1 .. Input.Last_Terminal loop if First.Map (P.Denote, T) then -- Append FIRST(X) Result (To_Reference (T)) := True; end if; end loop; -- The same for non-terminal for NT in 1 .. Input.Last_Non_Terminal loop if First_NT.Map (P.Denote, NT) then -- Append FIRST(X) Result (To_Reference (NT)) := True; end if; end loop; if not First.Map (P.Denote, Tools.ε) then return Result; end if; -- Continue if ε ∈ FIRST(X) end if; end loop; Result := Result or Default; -- Append a return Result; end Get_First; --------------------- -- Is_Right_Nulled -- --------------------- function Is_Right_Nulled (From, To : Part_Index) return Boolean is begin if Right_Nulled then for P of Input.Part (From .. To) loop if P.Is_Terminal_Reference or else not First.Map (P.Denote, Tools.ε) then return False; end if; end loop; return True; else return False; end if; end Is_Right_Nulled; --------------------- -- Next_To_Do_Item -- --------------------- procedure Next_To_Do_Item (To_Do : Offset_Set; State : in out LR.State_Index; Offset : in out LR_Item_Index) is begin for J in To_Do'Range loop if To_Do (Offset) then return; elsif Offset = To_Do'Last then State := 1; Offset := To_Do'First; elsif C.Ranges (State).Last = Offset then State := State + 1; Offset := C.Ranges (State).First; else Offset := Offset + 1; end if; end loop; end Next_To_Do_Item; Look_Aheads : Lookahead_Set := (others => (others => False)); -- Look ahead terminals for each LR_Item in any state Result : constant LR_Tables.Table_Access := LR_Tables.Create (Last_State => C.Last_State, Last_Terminal => Input.Last_Terminal, Last_Non_Terminal => Input.Last_Non_Terminal); begin Tools.Get_First (Input, First, First_NT); Fill_Look_Aheads (Look_Aheads); for State in 1 .. C.Last_State loop declare Target : State_Count; Set : constant LR_Item_Set := To_Set (C, State); Added : Reference_Set_Indexed_By_Non_Terminal := (1 .. Input.Last_Non_Terminal => (Ref => False)); begin for J in Set'Range loop declare Item : constant LR_Item := Set (J); Next : Part_Index; Prod : constant Production_Index := To_Production (Input, Item); begin if Item = 0 then Next := Input.Production (Prod).First; else Next := Part_Index (Item + 1); end if; Add_Recuces (Result.all, Added, State, Prod, Next, Look_Aheads (J)); end; end loop; -- Add shifts on terminals for T in Input.Terminal'Range loop Target := C.Go_To (To_Reference (T), State); if Target /= 0 then LR_Tables.Set_Shift (Result.all, State, T, Target); end if; end loop; -- Add shifts on non-terminals for NT in Input.Non_Terminal'Range loop Target := C.Go_To (To_Reference (NT), State); if Target /= 0 then LR_Tables.Set_Shift (Result.all, State, NT, Target); end if; end loop; end; end loop; Free (C); return Result; end Build; end Anagram.Grammars.LR.LALR;
OneWingedShark/Byron
Ada
378
ads
Pragma Ada_2012; Pragma Assertion_Policy( Check ); -- Byron.Transformation_Function is a generic function that takes transformation -- procedure and allows it to be used as a function; it is intended to be used -- by Byron.Pass. Generic Type Input_Type(<>) is private; Function Byron.Generics.Identity(Input : Input_Type) return Input_Type with Pure, Pure_Function, Inline;
vasil-sd/ada-tlsf
Ada
751
adb
with Ada.Containers; with TLSF.Proof.Relation; package body TLSF.Proof.Test.Relation with SPARK_Mode is --------------- -- Test_Find -- --------------- procedure Test_Find is use type Ada.Containers.Count_Type; type Element is new Natural; package Relation is new TLSF.Proof.Relation(Element_Type => Element); R1 : Relation.R; begin null; pragma Assert (Relation.Empty(R1)); R1 := Relation.Relate(R1, 1,2); pragma Assert (Relation.Related(R1,1,2)); pragma Assert (not Relation.Related(R1,2,3)); R1 := Relation.Relate(R1, 2,3); pragma Assert (Relation.Related(R1,2,3)); R3 := Relation. end Test_Find; end TLSF.Proof.Test.Relation;
edin/raytracer
Ada
418
ads
-- -- Raytracer implementation in Ada -- by John Perry (github: johnperry-math) -- 2021 -- -- specification for Rays -- -- local packages with Vectors; use Vectors; -- @summary a Ray has a starting point and a direction package Rays is type Ray_Type is record Start, Dir: Vector; end record; function Create_Ray(Start, Dir: Vector) return Ray_Type; pragma Inline_Always(Create_Ray); end Rays;
onox/orka
Ada
1,118
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.SIMD.SSE2.Integers.Logical is pragma Pure; function And_Not (Left, Right : m128i) return m128i with Inline_Always; -- Return result of not Left and Right function "and" (Left, Right : m128i) return m128i with Inline_Always; function "or" (Left, Right : m128i) return m128i with Inline_Always; function "xor" (Left, Right : m128i) return m128i with Inline_Always; end Orka.SIMD.SSE2.Integers.Logical;
cborao/Ada-P3
Ada
1,491
adb
--PRÁCTICA 3: CÉSAR BORAO MORATINOS (Handlers.adb) with Maps_G; with Ada.Text_IO; with Chat_Messages; with Chat_Procedures; with Ada.Strings.Unbounded; package body Handlers is package ATI renames Ada.Text_IO; package CM renames Chat_Messages; package CP renames Chat_Procedures; package ASU renames Ada.Strings.Unbounded; procedure Client_Handler(From: in LLU.End_Point_Type; To: in LLU.End_Point_Type; P_Buffer: access LLU.Buffer_Type) is Mess: CM.Message_Type; Nick: ASU.Unbounded_String; Comment: ASU.Unbounded_String; begin Mess := CM.Message_Type'Input(P_Buffer); Nick := ASU.Unbounded_String'Input(P_Buffer); Comment := ASU.Unbounded_String'Input(P_Buffer); ATI.New_Line; ATI.Put_Line(ASU.To_String(Nick) & ": " & ASU.To_String(Comment)); LLU.Reset(P_Buffer.all); ATI.Put(">> "); end Client_Handler; procedure Server_Handler (From: in LLU.End_Point_Type; To: in LLU.End_Point_Type; P_Buffer: access LLU.Buffer_Type) is Mess: CM.Message_Type; Buffer_Out: aliased LLU.Buffer_Type(1024); begin Mess := CM.Message_Type'Input (P_Buffer); case Mess is when CM.Init => CP.Case_Init(P_Buffer,Buffer_Out'Access); when CM.Writer => CP.Case_Writer(P_Buffer,Buffer_Out'Access); when CM.Logout => CP.Case_Logout(P_Buffer,Buffer_Out'Access); when others => ATI.Put_Line("Unknown message type"); end case; LLU.Reset (P_Buffer.all); end Server_Handler; end Handlers;
reznikmm/matreshka
Ada
3,684
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Form_Name_Attributes is pragma Preelaborate; type ODF_Form_Name_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Form_Name_Attribute_Access is access all ODF_Form_Name_Attribute'Class with Storage_Size => 0; end ODF.DOM.Form_Name_Attributes;
charlie5/lace
Ada
6,600
adb
with openGL.Geometry .lit_colored, openGL.Primitive.indexed; package body openGL.Model.sphere.lit_colored is --------- --- Forge -- function new_Sphere (Radius : in Real; lat_Count : in Positive := default_latitude_Count; long_Count : in Positive := default_longitude_Count; Color : in lucid_Color) return View is Self : constant View := new Item; begin Self.Color := Color; Self.lat_Count := lat_Count; Self.long_Count := long_Count; Self.define (Radius); return Self; end new_Sphere; -------------- --- Attributes -- -- NB: - An extra vertex is required at the end of each latitude ring. -- - This last vertex has the same site as the rings initial vertex. -- - The last vertex has 's' texture coord of 1.0, whereas -- the initial vertex has 's' texture coord of 0.0. -- overriding function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class; Fonts : in Font.font_id_Map_of_font) return Geometry.views is pragma unreferenced (Textures, Fonts); use Geometry, Geometry.lit_colored; lat_Count : Positive renames Self.lat_Count; long_Count : Positive renames Self.long_Count; Num_lat_strips : constant Positive := lat_Count - 1; lat_Spacing : constant Real := Degrees_180 / Real (lat_Count - 1); long_Spacing : constant Real := Degrees_360 / Real (long_Count); indices_Count : constant long_Index_t := long_Index_t (Num_lat_strips * (long_Count + 1) * 2); vertex_Count : constant Index_t := 1 + 1 -- North and south pole. + Index_t ((long_Count + 1) * (lat_Count - 2)); -- Each latitude ring. the_Vertices : aliased Geometry.lit_colored.Vertex_array := [1 .. vertex_Count => <>]; the_Sites : aliased Sites := [1 .. vertex_Count => <>]; the_Indices : aliased Indices := [1 .. indices_Count => <>]; Color : constant rgba_Color := to_rgba_Color (Self.Color); the_Geometry : constant Geometry.lit_colored.view := Geometry.lit_colored.new_Geometry; begin set_Sites: declare use linear_Algebra, linear_Algebra_3D; north_Pole : constant Site := [0.0, 0.5, 0.0]; south_Pole : constant Site := [0.0, -0.5, 0.0]; the_Site : Site := north_Pole; vert_Id : Index_t := 1; -- Start at '1' (not '0') to account for the northpole. latitude_line_First : Site; a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords. begin the_Sites (the_Vertices'First) := north_Pole; the_Vertices (the_Vertices'First).Site := north_Pole; the_Vertices (the_Vertices'First).Normal := Normalised (north_Pole); the_Vertices (the_Vertices'First).Color := Color; the_Vertices (the_Vertices'First).Shine := 0.5; the_Sites (the_Vertices'Last) := south_Pole; the_Vertices (the_Vertices'Last).Site := south_Pole; the_Vertices (the_Vertices'Last).Normal := Normalised (south_Pole); the_Vertices (the_Vertices'Last).Color := Color; the_Vertices (the_Vertices'Last).Shine := 0.5; for lat_Id in 2 .. lat_Count - 1 loop a := 0.0; b := b + lat_Spacing; the_Site := the_Site * z_Rotation_from (lat_Spacing); latitude_line_First := the_Site; -- Store initial latitude lines 1st point. vert_Id := vert_Id + 1; the_Sites (vert_Id) := the_Site; -- Add 1st point on a line of latitude. the_Vertices (vert_Id).Site := the_Site; the_Vertices (vert_Id).Normal := Normalised (the_Site); the_Vertices (vert_Id).Color := Color; the_Vertices (vert_Id).Shine := 0.5; for long_Id in 1 .. long_Count loop a := a + long_Spacing; if long_Id /= long_Count then the_Site := the_Site * y_Rotation_from (-long_Spacing); else the_Site := latitude_line_First; -- Restore the_Vertex back to initial latitude lines 1st point. end if; vert_Id := vert_Id + 1; the_Sites (vert_Id) := the_Site; -- Add each succesive point on a line of latitude. the_Vertices (vert_Id).Site := the_Site; the_Vertices (vert_Id).Normal := Normalised (the_Site); the_Vertices (vert_Id).Color := Color; the_Vertices (vert_Id).Shine := 0.5; end loop; end loop; end set_Sites; for i in the_Vertices'Range loop the_Vertices (i).Site := the_Vertices (i).Site * Self.Radius * 2.0; end loop; set_Indices: declare strip_Id : long_Index_t := 0; Upper : Index_t; Lower : Index_t; begin upper := 1; lower := 2; for lat_Strip in 1 .. num_lat_Strips loop for Each in 1 .. long_Count + 1 loop strip_Id := strip_Id + 1; the_Indices (strip_Id) := Upper; strip_Id := strip_Id + 1; the_Indices (strip_Id) := Lower; if lat_Strip /= 1 then Upper := Upper + 1; end if; if lat_Strip /= num_lat_Strips then Lower := Lower + 1; end if; end loop; if lat_Strip = 1 then Upper := 2; end if; Lower := Upper + Index_t (long_Count) + 1; end loop; end set_Indices; the_Geometry.is_Transparent (False); the_Geometry.Vertices_are (the_Vertices); declare the_Primitive : constant Primitive.indexed.view := Primitive.indexed.new_Primitive (Primitive.triangle_Strip, the_Indices); begin the_Geometry.add (Primitive.view (the_Primitive)); end; return [1 => Geometry.view (the_Geometry)]; end to_GL_Geometries; end openGL.Model.sphere.lit_colored;
KipodAfterFree/KAF-2019-FireHog
Ada
3,783
ads
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Form_Demo.Handler -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer <[email protected]> 1996 -- Version Control -- $Revision: 1.5 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; generic with function My_Driver (Frm : Form; K : Key_Code; Pan : Panel) return Boolean; package Sample.Form_Demo.Handler is procedure Drive_Me (F : in Form; Lin : in Line_Position; Col : in Column_Position; Title : in String := ""); -- Position the menu at the given point and drive it. procedure Drive_Me (F : in Form; Title : in String := ""); -- Center menu and drive it. end Sample.Form_Demo.Handler;
reznikmm/matreshka
Ada
4,269
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Text.Number_Lines.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Text.Number_Lines.Text_Number_Lines_Access) return ODF.DOM.Attributes.Text.Number_Lines.ODF_Text_Number_Lines is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Text.Number_Lines.Text_Number_Lines_Access) return ODF.DOM.Attributes.Text.Number_Lines.ODF_Text_Number_Lines is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Text.Number_Lines.Internals;
zhmu/ananas
Ada
5,980
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package encapsulates and centralizes information about all uses of -- interrupts (or signals), including the target-dependent mapping of -- interrupts (or signals) to exceptions. -- Unlike the original design, System.Interrupt_Management can only be used -- for tasking systems. -- PLEASE DO NOT put any subprogram declarations with arguments of type -- Interrupt_ID into the visible part of this package. The type Interrupt_ID -- is used to derive the type in Ada.Interrupts, and adding more operations -- to that type would be illegal according to the Ada Reference Manual. This -- is the reason why the signals sets are implemented using visible arrays -- rather than functions. with System.OS_Interface; with Interfaces.C; package System.Interrupt_Management is pragma Preelaborate; type Interrupt_Mask is limited private; type Interrupt_ID is new Interfaces.C.int range 0 .. System.OS_Interface.Max_Interrupt; type Interrupt_Set is array (Interrupt_ID) of Boolean; -- The following objects serve as constants, but are initialized in the -- body to aid portability. This permits us to use more portable names for -- interrupts, where distinct names may map to the same interrupt ID -- value. -- For example, suppose SIGRARE is a signal that is not defined on all -- systems, but is always reserved when it is defined. If we have the -- convention that ID zero is not used for any "real" signals, and SIGRARE -- = 0 when SIGRARE is not one of the locally supported signals, we can -- write: -- Reserved (SIGRARE) := True; -- and the initialization code will be portable. Abort_Task_Interrupt : Interrupt_ID; -- The interrupt that is used to implement task abort if an interrupt is -- used for that purpose. This is one of the reserved interrupts. Keep_Unmasked : Interrupt_Set := [others => False]; -- Keep_Unmasked (I) is true iff the interrupt I is one that must be kept -- unmasked at all times, except (perhaps) for short critical sections. -- This includes interrupts that are mapped to exceptions (see -- System.Interrupt_Exceptions.Is_Exception), but may also include -- interrupts (e.g. timer) that need to be kept unmasked for other -- reasons. Where interrupts are implemented as OS signals, and signal -- masking is per-task, the interrupt should be unmasked in ALL TASKS. Reserve : Interrupt_Set := [others => False]; -- Reserve (I) is true iff the interrupt I is one that cannot be permitted -- to be attached to a user handler. The possible reasons are many. For -- example, it may be mapped to an exception used to implement task abort, -- or used to implement time delays. procedure Initialize; -- Initialize the various variables defined in this package. This procedure -- must be called before accessing any object from this package, and can be -- called multiple times. private type Interrupt_Mask is new System.OS_Interface.sigset_t; -- In some implementations Interrupt_Mask is represented as a linked list procedure Adjust_Context_For_Raise (Signo : System.OS_Interface.Signal; Ucontext : System.Address); pragma Import (C, Adjust_Context_For_Raise, "__gnat_adjust_context_for_raise"); -- Target specific hook performing adjustments to the signal's machine -- context, to be called before an exception may be raised from a signal -- handler. This service is provided by init.c, together with the -- non-tasking signal handler. end System.Interrupt_Management;
GPUWorks/lumen2
Ada
4,134
adb
-- Lumen.Binary.Endian.Words -- Byte re-ordering routines for "word" -- (32-bit) values -- -- -- Chip Richards, NiEstu, Phoenix AZ, Summer 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, NiEstu -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- The software is provided "as is" and the author disclaims all warranties -- with regard to this software including all implied warranties of -- merchantability and fitness. In no event shall the author be liable for any -- special, direct, indirect, or consequential damages or any damages -- whatsoever resulting from loss of use, data or profits, whether in an -- action of contract, negligence or other tortious action, arising out of or -- in connection with the use or performance of this software. -- Environment with Ada.Unchecked_Conversion; package body Lumen.Binary.Endian.Words is --------------------------------------------------------------------------- type Four_Bytes is record B0 : Byte; B1 : Byte; B2 : Byte; B3 : Byte; end record; for Four_Bytes'Size use Word_Bits; for Four_Bytes use record B0 at 0 range 0 .. 7; B1 at 1 range 0 .. 7; B2 at 2 range 0 .. 7; B3 at 3 range 0 .. 7; end record; --------------------------------------------------------------------------- -- Swap the bytes, no matter the host ordering function Swap_Bytes (Value : Word_Type) return Word_Type is W : Four_Bytes; T : Four_Bytes; function VTT is new Ada.Unchecked_Conversion (Word_Type, Four_Bytes); function TTV is new Ada.Unchecked_Conversion (Four_Bytes, Word_Type); begin -- Swap_Bytes T := VTT (Value); W.B0 := T.B3; W.B1 := T.B2; W.B2 := T.B1; W.B3 := T.B0; return TTV (W); end Swap_Bytes; --------------------------------------------------------------------------- -- Swap bytes if host is little-endian, or no-op if it's big-endian function To_Big (Value : Word_Type) return Word_Type is begin -- To_Big if System_Byte_Order /= High_Order_First then return Swap_Bytes (Value); else return Value; end if; end To_Big; --------------------------------------------------------------------------- -- Swap bytes if host is big-endian, or no-op if it's little-endian function To_Little (Value : Word_Type) return Word_Type is begin -- To_Little if System_Byte_Order /= Low_Order_First then return Swap_Bytes (Value); else return Value; end if; end To_Little; --------------------------------------------------------------------------- -- Swap the bytes, no matter the host ordering procedure Swap_Bytes (Value : in out Word_Type) is W : Four_Bytes; T : Four_Bytes; function VTT is new Ada.Unchecked_Conversion (Word_Type, Four_Bytes); function TTV is new Ada.Unchecked_Conversion (Four_Bytes, Word_Type); begin -- Swap_Bytes T := VTT (Value); W.B0 := T.B3; W.B1 := T.B2; W.B2 := T.B1; W.B3 := T.B0; Value := TTV (W); end Swap_Bytes; --------------------------------------------------------------------------- -- Swap bytes if host is little-endian, or no-op if it's big-endian procedure To_Big (Value : in out Word_Type) is begin -- To_Big if System_Byte_Order /= High_Order_First then Swap_Bytes (Value); end if; end To_Big; --------------------------------------------------------------------------- -- Swap bytes if host is big-endian, or no-op if it's little-endian procedure To_Little (Value : in out Word_Type) is begin -- To_Little if System_Byte_Order /= Low_Order_First then Swap_Bytes (Value); end if; end To_Little; --------------------------------------------------------------------------- end Lumen.Binary.Endian.Words;
AdaCore/libadalang
Ada
4,393
adb
-- Rename controlling parameters of primitive subprograms to "Self". Write the -- result in ".new" suffixed files. with Ada.Text_IO; with Langkit_Support.Text, Libadalang.Analysis, Libadalang.Common, Libadalang.Iterators, Libadalang.Rewriting; with Helpers; procedure Rewrite_Self_Arg is package TIO renames Ada.Text_IO; package LAL renames Libadalang.Analysis; package LALCO renames Libadalang.Common; package LAL_RW renames Libadalang.Rewriting; package LAL_It renames Libadalang.Iterators; use type LALCO.Ada_Node_Kind_Type; Units : Helpers.Unit_Vectors.Vector; Ctx : constant LAL.Analysis_Context := Helpers.Initialize ("material.gpr", Units); Handle : LAL_RW.Rewriting_Handle := LAL_RW.Start_Rewriting (Ctx); function Is_Subp (N : LAL.Ada_Node) return Boolean is (LAL.Kind (N) = LALCO.Ada_Subp_Spec); begin for Unit of Units loop for Node of LAL_It.Find (LAL.Root (Unit), Is_Subp'Access).Consume loop declare use type LAL_RW.Node_Rewriting_Handle; Subp_Spec : constant LAL.Subp_Spec := Node.As_Subp_Spec; -- Subprogram specification to rewrite Primitive_Of : LAL.Base_Type_Decl; -- Subp_Spec is a primitive of this Id : LAL_RW.Node_Rewriting_Handle := LAL_RW.No_Node_Rewriting_Handle; -- Formal identifier to rewrite into Self begin Primitive_Of := Subp_Spec.P_Primitive_Subp_Types (1); if not Primitive_Of.Is_Null and then not Subp_Spec.F_Subp_Params.Is_Null then -- Look for a parameter whose type is the same as Primitive_Of. -- Abort rewriting if there are more than one such parameter. Primitive_Of := Primitive_Of.P_Canonical_Type; for Param_Spec of Subp_Spec.F_Subp_Params.F_Params.Children loop declare use type LAL.Base_Type_Decl; PS : constant LAL.Param_Spec := Param_Spec.As_Param_Spec; Param_Type : constant LAL.Base_Type_Decl := PS.F_Type_Expr.P_Designated_Type_Decl.P_Canonical_Type; begin if Param_Type = Primitive_Of and then Id = LAL_RW.No_Node_Rewriting_Handle and then PS.F_Ids.Children_Count = 1 then Id := LAL_RW.Handle (PS.F_Ids.Child (1).As_Defining_Name.F_Name); end if; end; end loop; -- Rename the formal! if Id /= LAL_RW.No_Node_Rewriting_Handle then LAL_RW.Set_Text (Id, "Self"); end if; end if; end; end loop; end loop; -- Write results declare Units : Helpers.Unit_Vectors.Vector; Result : LAL_RW.Apply_Result; begin -- Remember which analysis units are to be rewritten. Keep track of them -- using Analysis_Unit values, since the call to LAL_RW.Apply will make -- all rewriting handles invalid. for Unit_Handle of LAL_RW.Unit_Handles (Handle) loop Units.Append (LAL_RW.Unit (Unit_Handle)); end loop; Result := LAL_RW.Apply (Handle); if not Result.Success then TIO.Put_Line ("Error during rewriting..."); end if; -- Go through all rewritten units and generate a ".new" source file to -- contain the rewritten sources. for U of Units loop declare Filename : constant String := LAL.Get_Filename (U) & ".new"; Charset : constant String := LAL.Get_Charset (U); -- Retreive rewritten text, and encode it using the same encoding -- as in the original file. Content_Text : constant Langkit_Support.Text.Text_Type := LAL.Text (U); Content_Bytes : constant String := Langkit_Support.Text.Encode (Content_Text, Charset); Output_File : TIO.File_Type; begin TIO.Create (Output_File, TIO.Out_File, Filename); TIO.Put (Output_File, Content_Bytes); TIO.Close (Output_File); end; end loop; end; end Rewrite_Self_Arg;
pdaxrom/Kino2
Ada
3,685
ads
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.My_Field_Type -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en -- Version Control -- $Revision: 1.9 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; with Terminal_Interface.Curses.Forms.Field_Types.User; use Terminal_Interface.Curses.Forms.Field_Types.User; -- This is a very simple user defined field type. It accepts only a -- defined character as input into the field. -- package Sample.My_Field_Type is type My_Data is new User_Defined_Field_Type with record Ch : Character; end record; function Field_Check (Fld : Field; Typ : My_Data) return Boolean; function Character_Check (Ch : Character; Typ : My_Data) return Boolean; end Sample.My_Field_Type;
Rodeo-McCabe/orka
Ada
2,202
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Orka.SIMD.AVX.Singles.Compare; with Orka.SIMD.AVX.Singles.Logical; with Orka.SIMD.AVX.Singles.Swizzle; with Orka.SIMD.SSE.Singles.Arithmetic; with Orka.SIMD.SSE3.Singles.Arithmetic; package body Orka.SIMD.AVX.Singles.Arithmetic is function Divide_Or_Zero (Left, Right : m256) return m256 is use SIMD.AVX.Singles.Compare; use SIMD.AVX.Singles.Logical; -- Create a mask with all 1's for each element that is non-zero Zero : constant m256 := (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); Mask : constant m256 := Zero /= Right; Normalized : constant m256 := Left / Right; begin -- Any element in Right that is zero will result in a -- corresponding element consisting of all 0's in the Mask. -- This will avoid the divide-by-zero exception when dividing. return Mask and Normalized; end Divide_Or_Zero; function "abs" (Elements : m256) return m256 is use SIMD.AVX.Singles.Logical; use type GL.Types.Single; begin return And_Not ((-0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), Elements); end "abs"; function Sum (Elements : m256) return GL.Types.Single is use SIMD.SSE.Singles; use SIMD.SSE.Singles.Arithmetic; use SIMD.AVX.Singles.Swizzle; -- From https://stackoverflow.com/a/35270026 Low : constant m128 := Cast (Elements); High : constant m128 := Extract (Elements, 1); begin return SIMD.SSE3.Singles.Arithmetic.Sum (Low + High); end Sum; end Orka.SIMD.AVX.Singles.Arithmetic;
twdroeger/ada-awa
Ada
14,825
adb
----------------------------------------------------------------------- -- awa-blogs-module -- Blog and post management module -- Copyright (C) 2011, 2012, 2013, 2017, 2018, 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; with AWA.Modules.Get; with AWA.Modules.Beans; with AWA.Blogs.Beans; with AWA.Applications; with AWA.Services.Contexts; with AWA.Permissions; with AWA.Workspaces.Models; with AWA.Workspaces.Modules; with AWA.Storages.Models; with ADO.Objects; with ADO.Sessions; with ADO.Statements; package body AWA.Blogs.Modules is package ASC renames AWA.Services.Contexts; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Blogs.Module"); package Register is new AWA.Modules.Beans (Module => Blog_Module, Module_Access => Blog_Module_Access); -- ------------------------------ -- Initialize the blog module. -- ------------------------------ overriding procedure Initialize (Plugin : in out Blog_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config) is begin Log.Info ("Initializing the blogs module"); -- Setup the resource bundles. App.Register ("blogMsg", "blogs"); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Post_Bean", Handler => AWA.Blogs.Beans.Create_Post_Bean'Access); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Post_List_Bean", Handler => AWA.Blogs.Beans.Create_Post_List_Bean'Access); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Blog_Admin_Bean", Handler => AWA.Blogs.Beans.Create_Blog_Admin_Bean'Access); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Blog_Bean", Handler => AWA.Blogs.Beans.Create_Blog_Bean'Access); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Status_List_Bean", Handler => AWA.Blogs.Beans.Create_Status_List'Access); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Stat_Bean", Handler => AWA.Blogs.Beans.Create_Blog_Stat_Bean'Access); Register.Register (Plugin => Plugin, Name => "AWA.Blogs.Beans.Format_List_Bean", Handler => AWA.Blogs.Beans.Create_Format_List_Bean'Access); App.Add_Servlet ("blog-image", Plugin.Image_Servlet'Unchecked_Access); AWA.Modules.Module (Plugin).Initialize (App, Props); end Initialize; -- ------------------------------ -- Configures the module after its initialization and after having read its XML configuration. -- ------------------------------ overriding procedure Configure (Plugin : in out Blog_Module; Props : in ASF.Applications.Config) is pragma Unreferenced (Props); Image_Prefix : constant String := Plugin.Get_Config (PARAM_IMAGE_PREFIX); begin Plugin.Image_Prefix := Wiki.Strings.To_UString (Wiki.Strings.To_WString (Image_Prefix)); end Configure; -- ------------------------------ -- Get the blog module instance associated with the current application. -- ------------------------------ function Get_Blog_Module return Blog_Module_Access is function Get is new AWA.Modules.Get (Blog_Module, Blog_Module_Access, NAME); begin return Get; end Get_Blog_Module; -- ------------------------------ -- Get the image prefix that was configured for the Blog module. -- ------------------------------ function Get_Image_Prefix (Module : in Blog_Module) return Wiki.Strings.UString is begin return Module.Image_Prefix; end Get_Image_Prefix; -- ------------------------------ -- Create a new blog for the user workspace. -- ------------------------------ procedure Create_Blog (Model : in Blog_Module; Title : in String; Result : out ADO.Identifier) is pragma Unreferenced (Model); Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current; User : constant ADO.Identifier := Ctx.Get_User_Identifier; DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx); Blog : AWA.Blogs.Models.Blog_Ref; WS : AWA.Workspaces.Models.Workspace_Ref; begin Log.Info ("Creating blog {0} for user", Title); Ctx.Start; AWA.Workspaces.Modules.Get_Workspace (DB, Ctx, WS); -- Check that the user has the create blog permission on the given workspace. AWA.Permissions.Check (Permission => ACL_Create_Blog.Permission, Entity => WS); Blog.Set_Name (Title); Blog.Set_Workspace (WS); Blog.Set_Create_Date (Ada.Calendar.Clock); Blog.Save (DB); -- Add the permission for the user to use the new blog. AWA.Workspaces.Modules.Add_Permission (Session => DB, User => User, Entity => Blog, Workspace => WS.Get_Id, List => (ACL_Delete_Blog.Permission, ACL_Update_Post.Permission, ACL_Create_Post.Permission, ACL_Delete_Post.Permission)); Ctx.Commit; Result := Blog.Get_Id; Log.Info ("Blog {0} created for user {1}", ADO.Identifier'Image (Result), ADO.Identifier'Image (User)); end Create_Blog; -- ------------------------------ -- Create a new post associated with the given blog identifier. -- ------------------------------ procedure Create_Post (Model : in Blog_Module; Blog_Id : in ADO.Identifier; Title : in String; URI : in String; Text : in String; Summary : in String; Format : in AWA.Blogs.Models.Format_Type; Comment : in Boolean; Status : in AWA.Blogs.Models.Post_Status_Type; Result : out ADO.Identifier) is pragma Unreferenced (Model); use type AWA.Blogs.Models.Post_Status_Type; Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current; User : constant ADO.Identifier := Ctx.Get_User_Identifier; DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx); Blog : AWA.Blogs.Models.Blog_Ref; Post : AWA.Blogs.Models.Post_Ref; Found : Boolean; begin Log.Debug ("Creating post for user"); Ctx.Start; -- Get the blog instance. Blog.Load (Session => DB, Id => Blog_Id, Found => Found); if not Found then Log.Error ("Blog {0} not found", ADO.Identifier'Image (Blog_Id)); raise Not_Found with "Blog not found"; end if; -- Check that the user has the create post permission on the given blog. AWA.Permissions.Check (Permission => ACL_Create_Post.Permission, Entity => Blog); -- Build the new post. Post.Set_Title (Title); Post.Set_Text (Text); Post.Set_Summary (Summary); Post.Set_Create_Date (Ada.Calendar.Clock); if Status = AWA.Blogs.Models.POST_PUBLISHED then Post.Set_Publish_Date (ADO.Nullable_Time '(Is_Null => False, Value => Ada.Calendar.Clock)); end if; Post.Set_Uri (URI); Post.Set_Author (Ctx.Get_User); Post.Set_Status (Status); Post.Set_Blog (Blog); Post.Set_Format (Format); Post.Set_Allow_Comments (Comment); Post.Save (DB); Ctx.Commit; Result := Post.Get_Id; Log.Info ("Post {0} created for user {1}", ADO.Identifier'Image (Result), ADO.Identifier'Image (User)); end Create_Post; -- ------------------------------ -- Update the post title and text associated with the blog post identified by <b>Post</b>. -- ------------------------------ procedure Update_Post (Model : in Blog_Module; Post_Id : in ADO.Identifier; Title : in String; Summary : in String; URI : in String; Text : in String; Format : in AWA.Blogs.Models.Format_Type; Comment : in Boolean; Publish_Date : in ADO.Nullable_Time; Status : in AWA.Blogs.Models.Post_Status_Type) is pragma Unreferenced (Model); use type AWA.Blogs.Models.Post_Status_Type; Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current; DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx); Post : AWA.Blogs.Models.Post_Ref; Found : Boolean; begin Ctx.Start; Post.Load (Session => DB, Id => Post_Id, Found => Found); if not Found then Log.Error ("Post {0} not found", ADO.Identifier'Image (Post_Id)); raise Not_Found; end if; -- Check that the user has the update post permission on the given post. AWA.Permissions.Check (Permission => ACL_Update_Post.Permission, Entity => Post); if not Publish_Date.Is_Null then Post.Set_Publish_Date (Publish_Date); end if; if Status = AWA.Blogs.Models.POST_PUBLISHED and then Post.Get_Publish_Date.Is_Null then Post.Set_Publish_Date (ADO.Nullable_Time '(Is_Null => False, Value => Ada.Calendar.Clock)); end if; Post.Set_Title (Title); Post.Set_Text (Text); Post.Set_Summary (Summary); Post.Set_Uri (URI); Post.Set_Status (Status); Post.Set_Format (Format); Post.Set_Allow_Comments (Comment); Post.Save (DB); Ctx.Commit; end Update_Post; -- ------------------------------ -- Delete the post identified by the given identifier. -- ------------------------------ procedure Delete_Post (Model : in Blog_Module; Post_Id : in ADO.Identifier) is pragma Unreferenced (Model); Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current; DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx); Post : AWA.Blogs.Models.Post_Ref; Found : Boolean; begin Ctx.Start; Post.Load (Session => DB, Id => Post_Id, Found => Found); if not Found then Log.Error ("Post {0} not found", ADO.Identifier'Image (Post_Id)); raise Not_Found; end if; -- Check that the user has the delete post permission on the given post. AWA.Permissions.Check (Permission => ACL_Delete_Post.Permission, Entity => Post); Post.Delete (Session => DB); Ctx.Commit; end Delete_Post; -- ------------------------------ -- Load the image data associated with a blog post. The image must be public and the -- post visible for the image to be retrieved by anonymous users. -- ------------------------------ procedure Load_Image (Model : in Blog_Module; Post_Id : in ADO.Identifier; Image_Id : in ADO.Identifier; Width : in out Natural; Height : in out Natural; Mime : out Ada.Strings.Unbounded.Unbounded_String; Date : out Ada.Calendar.Time; Into : out ADO.Blob_Ref) is pragma Unreferenced (Model); use type AWA.Storages.Models.Storage_Type; Ctx : constant Services.Contexts.Service_Context_Access := AWA.Services.Contexts.Current; User : constant ADO.Identifier := Ctx.Get_User_Identifier; DB : constant ADO.Sessions.Session := AWA.Services.Contexts.Get_Session (Ctx); Query : ADO.Statements.Query_Statement; Kind : AWA.Storages.Models.Storage_Type; begin if Width = Natural'Last or Height = Natural'Last then Query := DB.Create_Statement (Models.Query_Blog_Image_Get_Data); elsif Width > 0 then Query := DB.Create_Statement (Models.Query_Blog_Image_Width_Get_Data); Query.Bind_Param ("width", Width); elsif Height > 0 then Query := DB.Create_Statement (Models.Query_Blog_Image_Height_Get_Data); Query.Bind_Param ("height", Height); else Query := DB.Create_Statement (Models.Query_Blog_Image_Get_Data); end if; Query.Bind_Param ("post_id", Post_Id); Query.Bind_Param ("store_id", Image_Id); Query.Bind_Param ("user_id", User); Query.Execute; if not Query.Has_Elements then Log.Warn ("Blog post image entity {0} not found", ADO.Identifier'Image (Image_Id)); raise ADO.Objects.NOT_FOUND; end if; Mime := Query.Get_Unbounded_String (0); Date := Query.Get_Time (1); Width := Query.Get_Natural (4); Height := Query.Get_Natural (5); Kind := AWA.Storages.Models.Storage_Type'Val (Query.Get_Integer (3)); if Kind = AWA.Storages.Models.DATABASE then Into := Query.Get_Blob (6); else null; end if; end Load_Image; end AWA.Blogs.Modules;
optikos/oasis
Ada
5,966
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Package_Body_Stubs is function Create (Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Package_Body_Stub is begin return Result : Package_Body_Stub := (Package_Token => Package_Token, Body_Token => Body_Token, Name => Name, Is_Token => Is_Token, Separate_Token => Separate_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Package_Body_Stub is begin return Result : Implicit_Package_Body_Stub := (Name => Name, Aspects => Aspects, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Name (Self : Base_Package_Body_Stub) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Self.Name; end Name; overriding function Aspects (Self : Base_Package_Body_Stub) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Package_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Package_Token; end Package_Token; overriding function Body_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Body_Token; end Body_Token; overriding function Is_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function Separate_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Separate_Token; end Separate_Token; overriding function With_Token (Self : Package_Body_Stub) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Package_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Package_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Package_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Package_Body_Stub'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Package_Body_Stub_Element (Self : Base_Package_Body_Stub) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Package_Body_Stub_Element; overriding function Is_Declaration_Element (Self : Base_Package_Body_Stub) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Package_Body_Stub; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Package_Body_Stub (Self); end Visit; overriding function To_Package_Body_Stub_Text (Self : aliased in out Package_Body_Stub) return Program.Elements.Package_Body_Stubs .Package_Body_Stub_Text_Access is begin return Self'Unchecked_Access; end To_Package_Body_Stub_Text; overriding function To_Package_Body_Stub_Text (Self : aliased in out Implicit_Package_Body_Stub) return Program.Elements.Package_Body_Stubs .Package_Body_Stub_Text_Access is pragma Unreferenced (Self); begin return null; end To_Package_Body_Stub_Text; end Program.Nodes.Package_Body_Stubs;
KipodAfterFree/KAF-2019-FireHog
Ada
5,834
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Curses_Demo.Attributes -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer <[email protected]> 1996 -- Version Control -- $Revision: 1.7 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; with Sample.Manifest; use Sample.Manifest; with Sample.Helpers; use Sample.Helpers; with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Header_Handler; use Sample.Header_Handler; with Sample.Explanation; use Sample.Explanation; with Sample.Menu_Demo.Handler; with Sample.Curses_Demo.Mouse; package body Sample.Curses_Demo.Attributes is procedure Demo is P : Panel := Create (Standard_Window); K : Real_Key_Code; begin Set_Meta_Mode; Set_KeyPad_Mode; Top (P); Push_Environment ("ATTRIBDEMO"); Default_Labels; Notepad ("ATTRIB-PAD00"); Set_Character_Attributes (Attr => (others => False)); Add (Line => 1, Column => Columns / 2 - 10, Str => "This is NORMAL"); Set_Character_Attributes (Attr => (Stand_Out => True, others => False)); Add (Line => 2, Column => Columns / 2 - 10, Str => "This is Stand_Out"); Set_Character_Attributes (Attr => (Under_Line => True, others => False)); Add (Line => 3, Column => Columns / 2 - 10, Str => "This is Under_Line"); Set_Character_Attributes (Attr => (Reverse_Video => True, others => False)); Add (Line => 4, Column => Columns / 2 - 10, Str => "This is Reverse_Video"); Set_Character_Attributes (Attr => (Blink => True, others => False)); Add (Line => 5, Column => Columns / 2 - 10, Str => "This is Blink"); Set_Character_Attributes (Attr => (Dim_Character => True, others => False)); Add (Line => 6, Column => Columns / 2 - 10, Str => "This is Dim_Character"); Set_Character_Attributes (Attr => (Bold_Character => True, others => False)); Add (Line => 7, Column => Columns / 2 - 10, Str => "This is Bold_Character"); Refresh_Without_Update; Update_Panels; Update_Screen; loop K := Get_Key; if K in Special_Key_Code'Range then case K is when QUIT_CODE => exit; when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("ATTRIBKEYS"); when others => null; end case; end if; end loop; Pop_Environment; Clear; Refresh_Without_Update; Delete (P); Update_Panels; Update_Screen; end Demo; end Sample.Curses_Demo.Attributes;
stcarrez/ada-awa
Ada
1,363
ads
----------------------------------------------------------------------- -- awa-counters-modules-tests -- Unit tests for counters service -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with AWA.Tests; package AWA.Counters.Modules.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Counters.Modules.Counter_Module_Access; end record; -- Test incrementing counters and flushing. procedure Test_Increment (T : in out Test); -- Test incrementing a global counter. procedure Test_Global_Counter (T : in out Test); end AWA.Counters.Modules.Tests;
reznikmm/matreshka
Ada
5,760
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; with Core.Connectables.Slots_0.Slots_1.Generic_Emitters; generic type Data_Type is digits <>; with package Float_Slots is new Core.Connectables.Slots_0.Slots_1 (Data_Type); with package Float_Emitters is new Float_Slots.Generic_Emitters; package WUI.Widgets.Spin_Boxes.Generic_Floats is type Float_Spin_Box is new WUI.Widgets.Spin_Boxes.Abstract_Spin_Box with private; type Float_Spin_Box_Access is access all Float_Spin_Box'Class with Storage_Size => 0; not overriding function Value (Self : Float_Spin_Box) return Data_Type; not overriding procedure Set_Value (Self : in out Float_Spin_Box; To : Data_Type); -- Available as slot. ------------- -- Signals -- ------------- not overriding function Value_Changed_Signal (Self : in out Float_Spin_Box) return not null access Float_Slots.Signal'Class; ----------- -- Slots -- ----------- function Set_Value_Slot (Self : in out Float_Spin_Box'Class) return Float_Slots.Slot'Class; package Constructors is procedure Initialize (Self : in out Float_Spin_Box'Class; Element : not null WebAPI.HTML.Input_Elements.HTML_Input_Element_Access); function Create (Element : not null WebAPI.HTML.Input_Elements.HTML_Input_Element_Access) return not null Float_Spin_Box_Access; function Create (Id : League.Strings.Universal_String) return not null Float_Spin_Box_Access; end Constructors; private type Float_Spin_Box is new WUI.Widgets.Spin_Boxes.Abstract_Spin_Box with record Last_Value : Data_Type; -- Last valid value. Value_Changed : aliased Float_Emitters.Emitter (Float_Spin_Box'Unchecked_Access); end record; overriding procedure Step_Down (Self : in out Float_Spin_Box); overriding procedure Step_Up (Self : in out Float_Spin_Box); overriding procedure Input_Event (Self : in out Float_Spin_Box); overriding procedure Change_Event (Self : in out Float_Spin_Box); ----------- -- Slots -- ----------- package Set_Value_Slots is new Float_Slots.Generic_Slots (Float_Spin_Box, Set_Value); function Set_Value_Slot (Self : in out Float_Spin_Box'Class) return Float_Slots.Slot'Class renames Set_Value_Slots.To_Slot; end WUI.Widgets.Spin_Boxes.Generic_Floats;
sungyeon/drake
Ada
16,464
adb
-- reference: -- https://blogs.msdn.microsoft.com/oldnewthing/20140307-00/?p=1573 with System.Native_Time; with System.Storage_Elements; with C.winbase; with C.winnt; package body System.Native_Calendar is use type System.Native_Time.Nanosecond_Number; use type Storage_Elements.Storage_Offset; use type C.windef.WINBOOL; use type C.windef.WORD; procedure memset ( b : not null access C.winbase.TIME_ZONE_INFORMATION; c : Integer; n : Storage_Elements.Storage_Count) with Import, Convention => Intrinsic, External_Name => "__builtin_memset"; Diff : constant := 17324755200_000_000_0; -- 100-nanoseconds from 1601-01-01 (0 of FILETIME) -- to 2150-01-01 (0 of Ada time) function "+" (Left : C.windef.FILETIME; Right : Duration) return C.windef.FILETIME with Convention => Intrinsic; function "-" (Left : C.windef.FILETIME; Right : Duration) return C.windef.FILETIME with Convention => Intrinsic; function "-" (Left, Right : C.windef.FILETIME) return Duration with Convention => Intrinsic; pragma Inline_Always ("+"); pragma Inline_Always ("-"); function "+" (Left : C.windef.FILETIME; Right : Duration) return C.windef.FILETIME is use type C.winnt.ULONGLONG; Left_U : constant C.winnt.ULARGE_INTEGER := ( Unchecked_Tag => 0, LowPart => Left.dwLowDateTime, HighPart => Left.dwHighDateTime); Result_U : constant C.winnt.ULARGE_INTEGER := ( Unchecked_Tag => 255, -- any value in others QuadPart => Left_U.QuadPart + C.winnt.ULONGLONG ( System.Native_Time.Nanosecond_Number'Integer_Value (Right) / 100)); begin return ( dwLowDateTime => Result_U.LowPart, dwHighDateTime => Result_U.HighPart); end "+"; function "-" (Left : C.windef.FILETIME; Right : Duration) return C.windef.FILETIME is begin return Left + (-Right); end "-"; function "-" (Left, Right : C.windef.FILETIME) return Duration is use type C.winnt.ULONGLONG; Left_U : constant C.winnt.ULARGE_INTEGER := ( Unchecked_Tag => 0, LowPart => Left.dwLowDateTime, HighPart => Left.dwHighDateTime); Right_U : constant C.winnt.ULARGE_INTEGER := ( Unchecked_Tag => 0, LowPart => Right.dwLowDateTime, HighPart => Right.dwHighDateTime); begin return Duration'Fixed_Value ((Left_U.QuadPart - Right_U.QuadPart) * 100); end "-"; procedure Make_TZI ( TZI : aliased out C.winbase.TIME_ZONE_INFORMATION; Time_Zone : Time_Offset); procedure Make_TZI ( TZI : aliased out C.winbase.TIME_ZONE_INFORMATION; Time_Zone : Time_Offset) is begin memset ( TZI'Access, 0, C.winbase.TIME_ZONE_INFORMATION'Size / Standard'Storage_Unit); TZI.Bias := C.winnt.LONG (-Time_Zone); TZI.StandardBias := TZI.Bias; TZI.DaylightBias := TZI.Bias; end Make_TZI; function Is_Leap_Second (T : Duration) return Boolean; function Is_Leap_Second (T : Duration) return Boolean is Aliased_T : aliased C.windef.FILETIME := To_Native_Time (T); SystemTime : aliased C.winbase.SYSTEMTIME; Success : C.windef.WINBOOL; begin Success := C.winbase.FileTimeToSystemTime (Aliased_T'Access, SystemTime'Access); return Success /= C.windef.FALSE and then Second_Number'Base (SystemTime.wSecond) = 60; end Is_Leap_Second; -- implementation function To_Native_Time (T : Duration) return Native_Time is U : constant C.winnt.ULARGE_INTEGER := ( Unchecked_Tag => 255, -- any value in others QuadPart => C.winnt.ULONGLONG ( System.Native_Time.Nanosecond_Number'Integer_Value (T) / 100 + Diff)); begin return ( dwLowDateTime => U.LowPart, dwHighDateTime => U.HighPart); end To_Native_Time; function To_Time (T : Native_Time) return Duration is U : constant C.winnt.ULARGE_INTEGER := ( Unchecked_Tag => 0, LowPart => T.dwLowDateTime, HighPart => T.dwHighDateTime); begin return Duration'Fixed_Value ( (System.Native_Time.Nanosecond_Number (U.QuadPart) - Diff) * 100); end To_Time; function Clock return Native_Time is Result : aliased C.windef.FILETIME; begin C.winbase.GetSystemTimeAsFileTime (Result'Access); return Result; end Clock; procedure Split ( Date : Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Seconds : out Day_Duration; Leap_Second : out Boolean; Time_Zone : Time_Offset; Error : out Boolean) is Sub_Second : constant Second_Duration := Duration'Fixed_Value ( System.Native_Time.Nanosecond_Number'Integer_Value (Date) mod 1_000_000_000); FileTime : aliased C.windef.FILETIME := To_Native_Time (Date - Sub_Second); SystemTime : aliased C.winbase.SYSTEMTIME; SystemTime2 : aliased C.winbase.SYSTEMTIME; Dest : C.winbase.PSYSTEMTIME; begin Error := C.winbase.FileTimeToSystemTime (FileTime'Access, SystemTime'Access) = C.windef.FALSE; if not Error then -- Leap_Second is always calculated as GMT Leap_Second := Second_Number'Base (SystemTime.wSecond) >= 60; -- other units are calculated by Time_Zone if Time_Zone /= 0 then declare TZI : aliased C.winbase.TIME_ZONE_INFORMATION; begin Make_TZI (TZI, Time_Zone); Error := C.winbase.SystemTimeToTzSpecificLocalTime ( TZI'Access, SystemTime'Access, SystemTime2'Access) = C.windef.FALSE; if not Error then if Leap_Second then pragma Assert (SystemTime2.wSecond = 60); SystemTime2.wSecond := 59; end if; Seconds := Duration ( Integer (SystemTime2.wHour) * (60 * 60) + Integer (SystemTime2.wMinute) * 60 + Integer (SystemTime2.wSecond)); end if; end; Dest := SystemTime2'Unchecked_Access; else -- This assumes all leap seconds are at "23:59:60" on GMT. -- truncate to day SystemTime.wHour := 0; SystemTime.wMinute := 0; SystemTime.wSecond := 0; pragma Assert (SystemTime.wMilliseconds = 0); declare Truncated_Time : aliased C.windef.FILETIME; begin Error := C.winbase.SystemTimeToFileTime ( SystemTime'Access, Truncated_Time'Access) = C.windef.FALSE; if not Error then if Leap_Second then FileTime := FileTime - 1.0; end if; Seconds := FileTime - Truncated_Time; end if; end; Dest := SystemTime'Unchecked_Access; end if; if not Error then Year := Year_Number (Dest.wYear); Month := Month_Number (Dest.wMonth); Day := Day_Number (Dest.wDay); Seconds := Seconds + Sub_Second; end if; end if; end Split; procedure Split ( Date : Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Hour : out Hour_Number; Minute : out Minute_Number; Second : out Second_Number; Sub_Second : out Second_Duration; Leap_Second : out Boolean; Day_of_Week : out Day_Name; Time_Zone : Time_Offset; Error : out Boolean) is FileTime : aliased C.windef.FILETIME := To_Native_Time (Date); SystemTime : aliased C.winbase.SYSTEMTIME; SystemTime2 : aliased C.winbase.SYSTEMTIME; Dest : C.winbase.PSYSTEMTIME; begin Error := C.winbase.FileTimeToSystemTime (FileTime'Access, SystemTime'Access) = C.windef.FALSE; if not Error then -- Second, Sub_Second and Leap_Second are always calculated as GMT if Second_Number'Base (SystemTime.wSecond) >= 60 then Second := 59; Leap_Second := True; else Second := Second_Number (SystemTime.wSecond); Leap_Second := False; end if; Sub_Second := Duration'Fixed_Value ( System.Native_Time.Nanosecond_Number'Integer_Value (Date) mod 1_000_000_000); -- other units are calculated by Time_Zone if Time_Zone /= 0 then declare TZI : aliased C.winbase.TIME_ZONE_INFORMATION; begin Make_TZI (TZI, Time_Zone); Error := C.winbase.SystemTimeToTzSpecificLocalTime ( TZI'Access, SystemTime'Access, SystemTime2'Access) = C.windef.FALSE; end; Dest := SystemTime2'Unchecked_Access; else Dest := SystemTime'Unchecked_Access; end if; if not Error then Year := Year_Number (Dest.wYear); Month := Month_Number (Dest.wMonth); Day := Day_Number (Dest.wDay); Hour := Hour_Number (Dest.wHour); Minute := Minute_Number (Dest.wMinute); Day_of_Week := (Integer (Dest.wDayOfWeek) + 6) rem 7; -- Day_Name starts from Monday end if; end if; end Split; procedure Time_Of ( Year : Year_Number; Month : Month_Number; Day : Day_Number; Seconds : Day_Duration; Leap_Second : Boolean; Time_Zone : Time_Offset; Result : out Time; Error : out Boolean) is Actual_Seconds : Day_Duration; SystemTime : aliased C.winbase.SYSTEMTIME := ( wYear => C.windef.WORD (Year), wMonth => C.windef.WORD (Month), wDayOfWeek => 16#ffff#, wDay => C.windef.WORD (Day), wHour => 0, wMinute => 0, wSecond => 0, wMilliseconds => 0); SystemTime2 : aliased C.winbase.SYSTEMTIME; Source : C.winbase.PSYSTEMTIME; FileTime : aliased C.windef.FILETIME; begin if Time_Zone /= 0 then Actual_Seconds := Duration'Fixed_Value ( System.Native_Time.Nanosecond_Number'Integer_Value (Seconds) mod 1_000_000_000); declare S : constant Natural := Integer (Seconds - Actual_Seconds); TZI : aliased C.winbase.TIME_ZONE_INFORMATION; begin SystemTime.wHour := C.windef.WORD (S / (60 * 60)); SystemTime.wMinute := C.windef.WORD (S rem (60 * 60) / 60); SystemTime.wSecond := C.windef.WORD (S rem 60); Make_TZI (TZI, Time_Zone); Error := C.winbase.TzSpecificLocalTimeToSystemTime ( TZI'Access, SystemTime'Access, SystemTime2'Access) = C.windef.FALSE; end; Source := SystemTime2'Unchecked_Access; else -- This assumes all leap seconds are at "23:59:60" on GMT. Error := False; Actual_Seconds := Seconds; Source := SystemTime'Unchecked_Access; end if; if not Error then Error := C.winbase.SystemTimeToFileTime (Source, FileTime'Access) = C.windef.FALSE; Result := To_Time (FileTime) + Actual_Seconds; if not Error then if Leap_Second then Result := Result + 1.0; -- checking Error := not Is_Leap_Second (Result); end if; end if; end if; end Time_Of; procedure Time_Of ( Year : Year_Number; Month : Month_Number; Day : Day_Number; Hour : Hour_Number; Minute : Minute_Number; Second : Second_Number; Sub_Second : Second_Duration; Leap_Second : Boolean; Time_Zone : Time_Offset; Result : out Time; Error : out Boolean) is SystemTime : aliased C.winbase.SYSTEMTIME := ( wYear => C.windef.WORD (Year), wMonth => C.windef.WORD (Month), wDayOfWeek => 16#ffff#, wDay => C.windef.WORD (Day), wHour => C.windef.WORD (Hour), wMinute => C.windef.WORD (Minute), wSecond => C.windef.WORD (Second), wMilliseconds => 0); SystemTime2 : aliased C.winbase.SYSTEMTIME; Source : C.winbase.PSYSTEMTIME; FileTime : aliased C.windef.FILETIME; begin if Time_Zone /= 0 then declare TZI : aliased C.winbase.TIME_ZONE_INFORMATION; begin Make_TZI (TZI, Time_Zone); Error := C.winbase.TzSpecificLocalTimeToSystemTime ( TZI'Access, SystemTime'Access, SystemTime2'Access) = C.windef.FALSE; end; Source := SystemTime2'Unchecked_Access; else Error := False; Source := SystemTime'Unchecked_Access; end if; if not Error then Error := C.winbase.SystemTimeToFileTime (Source, FileTime'Access) = C.windef.FALSE; if not Error then Result := To_Time (FileTime) + Sub_Second; if Leap_Second then Result := Result + 1.0; -- checking Error := not Is_Leap_Second (Result); end if; end if; end if; end Time_Of; procedure UTC_Time_Offset ( Date : Time; Time_Zone : out Time_Offset; Error : out Boolean) is -- Raymond Chen explains: -- SystemTimeToTzSpecificLocalTime uses the time zone in effect at the -- time being converted, whereas the FileTimeToLocalFileTime function -- uses the time zone in effect right now. File_Time : aliased constant C.windef.FILETIME := To_Native_Time (Duration (Date)); System_Time : aliased C.winbase.SYSTEMTIME; Local_System_Time : aliased C.winbase.SYSTEMTIME; Local_File_Time : aliased C.windef.FILETIME; -- Use Backed_File_Time instead of Date (or File_Time) because the -- unit of FILETIME is 100 nano-seconds but the unit of SYSTEMTIME -- is one milli-second. Backed_File_Time : aliased C.windef.FILETIME; begin Error := not ( C.winbase.FileTimeToSystemTime ( File_Time'Access, System_Time'Access) /= C.windef.FALSE and then C.winbase.SystemTimeToTzSpecificLocalTime ( null, System_Time'Access, Local_System_Time'Access) /= C.windef.FALSE and then C.winbase.SystemTimeToFileTime ( Local_System_Time'Access, Local_File_Time'Access) /= C.windef.FALSE and then C.winbase.SystemTimeToFileTime ( System_Time'Access, Backed_File_Time'Access) /= C.windef.FALSE); if not Error then declare Offset : constant System.Native_Time.Nanosecond_Number := System.Native_Time.Nanosecond_Number'Integer_Value ( System.Native_Time.To_Duration (Local_File_Time) - System.Native_Time.To_Duration (Backed_File_Time)); begin Time_Zone := Time_Offset (Offset / 60_000_000_000); end; end if; end UTC_Time_Offset; procedure Delay_Until (T : Native_Time) is Timeout_T : constant Duration := System.Native_Time.To_Duration (T); Current_T : constant Duration := System.Native_Time.To_Duration (Clock); D : Duration; begin if Timeout_T > Current_T then D := Timeout_T - Current_T; else D := 0.0; -- always calling Delay_For for abort checking end if; System.Native_Time.Delay_For (D); end Delay_Until; end System.Native_Calendar;
reznikmm/matreshka
Ada
4,696
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.Line_Height_At_Least_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Line_Height_At_Least_Attribute_Node is begin return Self : Style_Line_Height_At_Least_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_Line_Height_At_Least_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Line_Height_At_Least_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Line_Height_At_Least_Attribute, Style_Line_Height_At_Least_Attribute_Node'Tag); end Matreshka.ODF_Style.Line_Height_At_Least_Attributes;
reznikmm/matreshka
Ada
42,943
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Primitive_Types is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Primitive_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Primitive_Type (AMF.UML.Primitive_Types.UML_Primitive_Type_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Primitive_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Primitive_Type (AMF.UML.Primitive_Types.UML_Primitive_Type_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Primitive_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.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Primitive_Type (Visitor, AMF.UML.Primitive_Types.UML_Primitive_Type_Access (Self), Control); end if; end Visit_Element; ------------------------- -- Get_Owned_Attribute -- ------------------------- overriding function Get_Owned_Attribute (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Attribute (Self.Element))); end Get_Owned_Attribute; ------------------------- -- Get_Owned_Operation -- ------------------------- overriding function Get_Owned_Operation (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation is begin return AMF.UML.Operations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Operation (Self.Element))); end Get_Owned_Operation; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Attribute (Self.Element))); end Get_Attribute; --------------------------- -- Get_Collaboration_Use -- --------------------------- overriding function Get_Collaboration_Use (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is begin return AMF.UML.Collaboration_Uses.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Collaboration_Use (Self.Element))); end Get_Collaboration_Use; ----------------- -- Get_Feature -- ----------------- overriding function Get_Feature (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin return AMF.UML.Features.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Feature (Self.Element))); end Get_Feature; ----------------- -- Get_General -- ----------------- overriding function Get_General (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_General (Self.Element))); end Get_General; ------------------------ -- Get_Generalization -- ------------------------ overriding function Get_Generalization (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is begin return AMF.UML.Generalizations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization (Self.Element))); end Get_Generalization; -------------------------- -- Get_Inherited_Member -- -------------------------- overriding function Get_Inherited_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Inherited_Member (Self.Element))); end Get_Inherited_Member; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant UML_Primitive_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; --------------------------------- -- Get_Is_Final_Specialization -- --------------------------------- overriding function Get_Is_Final_Specialization (Self : not null access constant UML_Primitive_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Final_Specialization (Self.Element); end Get_Is_Final_Specialization; --------------------------------- -- Set_Is_Final_Specialization -- --------------------------------- overriding procedure Set_Is_Final_Specialization (Self : not null access UML_Primitive_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Final_Specialization (Self.Element, To); end Set_Is_Final_Specialization; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is begin return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; ------------------------ -- Get_Owned_Use_Case -- ------------------------ overriding function Get_Owned_Use_Case (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Use_Case (Self.Element))); end Get_Owned_Use_Case; -------------------------- -- Get_Powertype_Extent -- -------------------------- overriding function Get_Powertype_Extent (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is begin return AMF.UML.Generalization_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype_Extent (Self.Element))); end Get_Powertype_Extent; ------------------------------ -- Get_Redefined_Classifier -- ------------------------------ overriding function Get_Redefined_Classifier (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Classifier (Self.Element))); end Get_Redefined_Classifier; ------------------------ -- Get_Representation -- ------------------------ overriding function Get_Representation (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is begin return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Representation (Self.Element))); end Get_Representation; ------------------------ -- Set_Representation -- ------------------------ overriding procedure Set_Representation (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Representation (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Representation; ---------------------- -- Get_Substitution -- ---------------------- overriding function Get_Substitution (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is begin return AMF.UML.Substitutions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Substitution (Self.Element))); end Get_Substitution; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is begin return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------ -- Get_Use_Case -- ------------------ overriding function Get_Use_Case (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case (Self.Element))); end Get_Use_Case; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Packages.UML_Package_Access is begin return AMF.UML.Packages.UML_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package (Self.Element))); end Get_Package; ----------------- -- Set_Package -- ----------------- overriding procedure Set_Package (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Packages.UML_Package_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Package (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Package; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is begin return AMF.UML.Template_Signatures.UML_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Primitive_Type_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; -------------------------- -- Get_Template_Binding -- -------------------------- overriding function Get_Template_Binding (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is begin return AMF.UML.Template_Bindings.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding (Self.Element))); end Get_Template_Binding; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Primitive_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Primitive_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; ------------- -- Inherit -- ------------- overriding function Inherit (Self : not null access constant UML_Primitive_Type_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Inherit"; return Inherit (Self, Inhs); end Inherit; ------------------ -- All_Features -- ------------------ overriding function All_Features (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.All_Features"; return All_Features (Self); end All_Features; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Primitive_Type_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------- -- General -- ------------- overriding function General (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "General unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.General"; return General (Self); end General; ----------------------- -- Has_Visibility_Of -- ----------------------- overriding function Has_Visibility_Of (Self : not null access constant UML_Primitive_Type_Proxy; N : AMF.UML.Named_Elements.UML_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 with "Unimplemented procedure UML_Primitive_Type_Proxy.Has_Visibility_Of"; return Has_Visibility_Of (Self, N); end Has_Visibility_Of; ------------------------- -- Inheritable_Members -- ------------------------- overriding function Inheritable_Members (Self : not null access constant UML_Primitive_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Inheritable_Members"; return Inheritable_Members (Self, C); end Inheritable_Members; ---------------------- -- Inherited_Member -- ---------------------- overriding function Inherited_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Inherited_Member"; return Inherited_Member (Self); end Inherited_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant UML_Primitive_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ------------------------- -- May_Specialize_Type -- ------------------------- overriding function May_Specialize_Type (Self : not null access constant UML_Primitive_Type_Proxy; C : AMF.UML.Classifiers.UML_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 with "Unimplemented procedure UML_Primitive_Type_Proxy.May_Specialize_Type"; return May_Specialize_Type (Self, C); end May_Specialize_Type; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Primitive_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant UML_Primitive_Type_Proxy; Element : AMF.UML.Named_Elements.UML_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 with "Unimplemented procedure UML_Primitive_Type_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant UML_Primitive_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Primitive_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 with "Unimplemented procedure UML_Primitive_Type_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Primitive_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_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 with "Unimplemented procedure UML_Primitive_Type_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Namespace"; return Namespace (Self); end Namespace; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Primitive_Type_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Primitive_Type_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant UML_Primitive_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; ---------------------------- -- Parameterable_Elements -- ---------------------------- overriding function Parameterable_Elements (Self : not null access constant UML_Primitive_Type_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Primitive_Type_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Primitive_Type_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Primitive_Type_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; end AMF.Internals.UML_Primitive_Types;
sparre/Ada-2012-Examples
Ada
456
ads
with Ada.Calendar; package Eksempel_2 is type Goods_Data_Type is tagged record Noget : Integer; Production_Date : Ada.Calendar.Time; end record; subtype DDMMYY_Date is String (1 .. 6); function Production_Date (Item : in Goods_Data_Type) return DDMMYY_Date; procedure Set_Production_Date (Item : in out Goods_Data_Type; Value : in DDMMYY_Date); end Eksempel_2;
MinimSecure/unum-sdk
Ada
919
ads
-- Copyright 2016-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 target_wrapper is type Float_Array_3 is array (1 .. 3) of Float; type parameters is record u2 : Float_Array_3; end record; Assign_Arr_Input : parameters; end target_wrapper;
charlie5/lace
Ada
112
ads
with any_Math.any_fast_Rotation; package float_Math.fast_Rotation is new float_Math.any_fast_Rotation;
thorstel/Advent-of-Code-2018
Ada
4,021
adb
with Ada.Assertions; use Ada.Assertions; with Ada.Containers.Hashed_Maps; use Ada.Containers; with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Hash; procedure Day18 is subtype Input_String is String (1 .. 50); type String_Array is array (Input_String'Range) of Input_String; function Array_Hash (A : String_Array) return Hash_Type is Hash : Hash_Type := 0; begin for I in A'Range loop Hash := Hash + Ada.Strings.Hash (A (I)); end loop; return Hash; end Array_Hash; package Array_Maps is new Hashed_Maps (Key_Type => String_Array, Element_Type => Natural, Hash => Array_Hash, Equivalent_Keys => "="); Grid : String_Array; function Count_Neighbors (X_Start, Y_Start : Natural; Char : Character) return Natural is Result : Natural := 0; begin for Y in Y_Start - 1 .. Y_Start + 1 loop for X in X_Start - 1 .. X_Start + 1 loop if (X /= X_Start or Y /= Y_Start) and (X >= Grid'First and X <= Grid'Last) and (Y >= Grid'First and Y <= Grid'Last) then if Grid (Y) (X) = Char then Result := Result + 1; end if; end if; end loop; end loop; return Result; end Count_Neighbors; function Change_Tile (X, Y : Positive) return Character is Current_Tile : constant Character := Grid (Y) (X); New_Tile : Character := Current_Tile; begin if Current_Tile = '.' then if Count_Neighbors (X, Y, '|') >= 3 then New_Tile := '|'; end if; elsif Current_Tile = '|' then if Count_Neighbors (X, Y, '#') >= 3 then New_Tile := '#'; end if; elsif Current_Tile = '#' then if Count_Neighbors (X, Y, '#') = 0 or Count_Neighbors (X, Y, '|') = 0 then New_Tile := '.'; end if; else Assert (False, "Illegal tile: " & Current_Tile); end if; return New_Tile; end Change_Tile; function Change_Grid return String_Array is New_Grid : String_Array; begin for Y in Grid'Range loop for X in Grid'Range loop New_Grid (Y) (X) := Change_Tile (X, Y); end loop; end loop; return New_Grid; end Change_Grid; function Resource_Value return Natural is Tree_Count : Natural := 0; Lumber_Count : Natural := 0; begin for I in Grid'Range loop for J in Grid'Range loop if Grid (I) (J) = '|' then Tree_Count := Tree_Count + 1; elsif Grid (I) (J) = '#' then Lumber_Count := Lumber_Count + 1; end if; end loop; end loop; return Tree_Count * Lumber_Count; end Resource_Value; begin -- Input Handling declare File : File_Type; begin Open (File, In_File, "input.txt"); for I in Grid'Range loop Grid (I) := Get_Line (File); end loop; Assert (End_Of_File (File), "More input than expected!"); Close (File); end; declare Total : constant Natural := 1000000000; Remaining : Natural := 0; Seen_Grids : Array_Maps.Map; begin Seen_Grids.Insert (Grid, 0); Outer_Loop : for I in 1 .. Total loop Grid := Change_Grid; -- Part 1 if I = 10 then Put_Line ("Part 1 =" & Natural'Image (Resource_Value)); end if; -- Detection of cycle if Seen_Grids.Contains (Grid) then Remaining := (Total - I) mod (I - Seen_Grids (Grid)); exit Outer_Loop; else Seen_Grids.Insert (Grid, I); end if; end loop Outer_Loop; for I in 1 .. Remaining loop Grid := Change_Grid; end loop; Put_Line ("Part 2 =" & Natural'Image (Resource_Value)); end; end Day18;
onox/orka
Ada
1,822
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2023 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 Orka.Behaviors; with Orka.Cameras; with Orka.Rendering.Programs.Modules; with Orka.Resources.Locations; with Orka.Features.Atmosphere.Rendering; package Orka.Features.Atmosphere.Cache is type Cached_Atmosphere is tagged limited private; function Create_Atmosphere (Data : aliased Model_Data; Location_Shaders : Resources.Locations.Location_Ptr; Location_Cache : Resources.Locations.Writable_Location_Ptr; Parameters : Rendering.Model_Parameters := (others => <>)) return Cached_Atmosphere; function Shader_Module (Object : Cached_Atmosphere) return Orka.Rendering.Programs.Modules.Module; -- Return the shader module for use by other features like terrain -- rendering procedure Render (Object : in out Cached_Atmosphere; Camera : Cameras.Camera_Ptr; Planet : Behaviors.Behavior_Ptr; Star : Behaviors.Behavior_Ptr); -- Render the atmosphere on the far plane private type Cached_Atmosphere is tagged limited record Atmosphere : Rendering.Atmosphere; Textures : Precomputed_Textures; end record; end Orka.Features.Atmosphere.Cache;
microsoft/winget-cli
Ada
5,996
adb
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $ with Ada.Unchecked_Deallocation; package body ZLib.Streams is ----------- -- Close -- ----------- procedure Close (Stream : in out Stream_Type) is procedure Free is new Ada.Unchecked_Deallocation (Stream_Element_Array, Buffer_Access); begin if Stream.Mode = Out_Stream or Stream.Mode = Duplex then -- We should flush the data written by the writer. Flush (Stream, Finish); Close (Stream.Writer); end if; if Stream.Mode = In_Stream or Stream.Mode = Duplex then Close (Stream.Reader); Free (Stream.Buffer); end if; end Close; ------------ -- Create -- ------------ procedure Create (Stream : out Stream_Type; Mode : in Stream_Mode; Back : in Stream_Access; Back_Compressed : in Boolean; Level : in Compression_Level := Default_Compression; Strategy : in Strategy_Type := Default_Strategy; Header : in Header_Type := Default; Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset := Default_Buffer_Size; Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset := Default_Buffer_Size) is subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size); procedure Init_Filter (Filter : in out Filter_Type; Compress : in Boolean); ----------------- -- Init_Filter -- ----------------- procedure Init_Filter (Filter : in out Filter_Type; Compress : in Boolean) is begin if Compress then Deflate_Init (Filter, Level, Strategy, Header => Header); else Inflate_Init (Filter, Header => Header); end if; end Init_Filter; begin Stream.Back := Back; Stream.Mode := Mode; if Mode = Out_Stream or Mode = Duplex then Init_Filter (Stream.Writer, Back_Compressed); Stream.Buffer_Size := Write_Buffer_Size; else Stream.Buffer_Size := 0; end if; if Mode = In_Stream or Mode = Duplex then Init_Filter (Stream.Reader, not Back_Compressed); Stream.Buffer := new Buffer_Subtype; Stream.Rest_First := Stream.Buffer'Last + 1; Stream.Rest_Last := Stream.Buffer'Last; end if; end Create; ----------- -- Flush -- ----------- procedure Flush (Stream : in out Stream_Type; Mode : in Flush_Mode := Sync_Flush) is Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size); Last : Stream_Element_Offset; begin loop Flush (Stream.Writer, Buffer, Last, Mode); Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last)); exit when Last < Buffer'Last; end loop; end Flush; ------------- -- Is_Open -- ------------- function Is_Open (Stream : Stream_Type) return Boolean is begin return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer); end Is_Open; ---------- -- Read -- ---------- procedure Read (Stream : in out Stream_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is procedure Read (Item : out Stream_Element_Array; Last : out Stream_Element_Offset); ---------- -- Read -- ---------- procedure Read (Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Ada.Streams.Read (Stream.Back.all, Item, Last); end Read; procedure Read is new ZLib.Read (Read => Read, Buffer => Stream.Buffer.all, Rest_First => Stream.Rest_First, Rest_Last => Stream.Rest_Last); begin Read (Stream.Reader, Item, Last); end Read; ------------------- -- Read_Total_In -- ------------------- function Read_Total_In (Stream : in Stream_Type) return Count is begin return Total_In (Stream.Reader); end Read_Total_In; -------------------- -- Read_Total_Out -- -------------------- function Read_Total_Out (Stream : in Stream_Type) return Count is begin return Total_Out (Stream.Reader); end Read_Total_Out; ----------- -- Write -- ----------- procedure Write (Stream : in out Stream_Type; Item : in Stream_Element_Array) is procedure Write (Item : in Stream_Element_Array); ----------- -- Write -- ----------- procedure Write (Item : in Stream_Element_Array) is begin Ada.Streams.Write (Stream.Back.all, Item); end Write; procedure Write is new ZLib.Write (Write => Write, Buffer_Size => Stream.Buffer_Size); begin Write (Stream.Writer, Item, No_Flush); end Write; -------------------- -- Write_Total_In -- -------------------- function Write_Total_In (Stream : in Stream_Type) return Count is begin return Total_In (Stream.Writer); end Write_Total_In; --------------------- -- Write_Total_Out -- --------------------- function Write_Total_Out (Stream : in Stream_Type) return Count is begin return Total_Out (Stream.Writer); end Write_Total_Out; end ZLib.Streams;
reznikmm/matreshka
Ada
3,714
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.Office_Mimetype_Attributes is pragma Preelaborate; type ODF_Office_Mimetype_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Office_Mimetype_Attribute_Access is access all ODF_Office_Mimetype_Attribute'Class with Storage_Size => 0; end ODF.DOM.Office_Mimetype_Attributes;
stcarrez/ada-asf
Ada
1,646
adb
----------------------------------------------------------------------- -- components-utils-flush -- Flush javascript queue and response -- Copyright (C) 2011, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Contexts.Writer; package body ASF.Components.Utils.Flush is -- ------------------------------ -- Flush the javascript queue -- ------------------------------ overriding procedure Encode_Begin (UI : in UIFlush; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Writer : constant ASF.Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; begin if UI.Get_Attribute (Name => "response", Context => Context, Default => False) then Writer.Write_Scripts; else Writer.Flush; end if; end Encode_Begin; end ASF.Components.Utils.Flush;
godunko/adawebpack
Ada
3,568
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Web API Definition -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision: 5549 $ $Date: 2016-03-20 14:52:06 +0300 (Sun, 20 Mar 2016) $ ------------------------------------------------------------------------------ with Web.GL.Objects; package Web.GL.Textures is pragma Preelaborate; type WebGL_Texture is new Web.GL.Objects.WebGL_Object with null record; end Web.GL.Textures;
Fabien-Chouteau/Ada_Drivers_Library
Ada
8,904
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 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 the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with NRF51_SVD.SPI; use NRF51_SVD.SPI; package body nRF51.SPI_Master is procedure Transfer (This : in out SPI_Master; Data_Out : UInt8; Data_In : out UInt8) with Inline_Always; -- Send and receive one byte of data -------------- -- Transfer -- -------------- procedure Transfer (This : in out SPI_Master; Data_Out : UInt8; Data_In : out UInt8) is begin -- Set output byte This.Periph.TXD.TXD := Data_Out; -- Wait for the RX ready event while This.Periph.EVENTS_READY = 0 loop null; end loop; -- Get input data Data_In := This.Periph.RXD.RXD; -- Clear event This.Periph.EVENTS_READY := 0; end Transfer; ------------ -- Enable -- ------------ procedure Enable (This : in out SPI_Master) is begin This.Periph.ENABLE.ENABLE := Enabled; end Enable; ------------- -- Disable -- ------------- procedure Disable (This : in out SPI_Master) is begin This.Periph.ENABLE.ENABLE := Disabled; end Disable; ------------- -- Enabled -- ------------- function Enabled (This : SPI_Master) return Boolean is (This.Periph.ENABLE.ENABLE = Enabled); --------------- -- Configure -- --------------- procedure Configure (This : in out SPI_Master; SCK, MOSI, MISO : GPIO_Pin_Index; Speed : Clock_Speed; Bit_Order : Data_Bit_Order; Polarity : Clock_Polarity; Phase : Clock_Phase) is begin This.Periph.PSELSCK := UInt32 (SCK); This.Periph.PSELMOSI := UInt32 (MOSI); This.Periph.PSELMISO := UInt32 (MISO); This.Periph.FREQUENCY := (case Speed is when SPI_125kbps => 16#0200_0000#, when SPI_250kbps => 16#0400_0000#, when SPI_500kbps => 16#0800_0000#, when SPI_1Mbps => 16#1000_0000#, when SPI_2Mbps => 16#2000_0000#, when SPI_4Mbps => 16#4000_0000#, when SPI_8Mbps => 16#8000_0000#); This.Periph.CONFIG.ORDER := (case Bit_Order is when Most_Significant_First => Msbfirst, when Least_Significant_First => Lsbfirst); This.Periph.CONFIG.CPHA := (case Phase is when Sample_Leading_Edge => Leading, when Sample_Trailing_Edge => Trailing); This.Periph.CONFIG.CPOL := (case Polarity is when Active_High => Activehigh, when Active_Low => Activelow); end Configure; ---------------- -- Disconnect -- ---------------- procedure Disconnect (This : in out SPI_Master) is begin This.Periph.PSELSCK := UInt32'Last; This.Periph.PSELMOSI := UInt32'Last; This.Periph.PSELMISO := UInt32'Last; end Disconnect; --------------- -- Data_Size -- --------------- overriding function Data_Size (This : SPI_Master) return SPI_Data_Size is (HAL.SPI.Data_Size_8b); -------------- -- Transmit -- -------------- overriding procedure Transmit (This : in out SPI_Master; Data : SPI_Data_8b; Status : out SPI_Status; Timeout : Natural := 1000) is pragma Unreferenced (Timeout); Unused : UInt8; begin -- Clear any previous event This.Periph.EVENTS_READY := 0; for Elt of Data loop Transfer (This, Data_Out => Elt, Data_In => Unused); end loop; Status := HAL.SPI.Ok; end Transmit; -------------- -- Transmit -- -------------- overriding procedure Transmit (This : in out SPI_Master; Data : SPI_Data_16b; Status : out SPI_Status; Timeout : Natural := 1000) is pragma Unreferenced (Timeout); Unused : UInt8; begin -- Clear any previous event This.Periph.EVENTS_READY := 0; if This.Periph.CONFIG.ORDER = Msbfirst then for Elt of Data loop Transfer (This, Data_Out => UInt8 (Shift_Left (Elt, 8)), Data_In => Unused); Transfer (This, Data_Out => UInt8 (Elt and 16#FF#), Data_In => Unused); end loop; else for Elt of Data loop Transfer (This, Data_Out => UInt8 (Elt and 16#FF#), Data_In => Unused); Transfer (This, Data_Out => UInt8 (Shift_Left (Elt, 8)), Data_In => Unused); end loop; end if; Status := HAL.SPI.Ok; end Transmit; ------------- -- Receive -- ------------- overriding procedure Receive (This : in out SPI_Master; Data : out SPI_Data_8b; Status : out SPI_Status; Timeout : Natural := 1000) is pragma Unreferenced (Timeout); begin -- Clear any previous event This.Periph.EVENTS_READY := 0; for Elt of Data loop Transfer (This, Data_Out => 0, Data_In => Elt); end loop; Status := HAL.SPI.Ok; end Receive; ------------- -- Receive -- ------------- overriding procedure Receive (This : in out SPI_Master; Data : out SPI_Data_16b; Status : out SPI_Status; Timeout : Natural := 1000) is pragma Unreferenced (Timeout); Byte : UInt8; begin -- Clear any previous event This.Periph.EVENTS_READY := 0; if This.Periph.CONFIG.ORDER = Msbfirst then for Elt of Data loop Transfer (This, Data_Out => 0, Data_In => Byte); Elt := Shift_Left (UInt16 (Byte), 8); Transfer (This, Data_Out => 0, Data_In => Byte); Elt := Elt or UInt16 (Byte); end loop; else for Elt of Data loop Transfer (This, Data_Out => 0, Data_In => Byte); Elt := Elt or UInt16 (Byte); Transfer (This, Data_Out => 0, Data_In => Byte); Elt := Shift_Left (UInt16 (Byte), 8); end loop; end if; Status := HAL.SPI.Ok; end Receive; end nRF51.SPI_Master;
AdaCore/training_material
Ada
254
ads
package Task_Select is Termination_Flag : Boolean := False; task Select_Loop_Task is entry Start; entry Receive_Message (V : String); entry Send_Message (V : String); entry Stop; end Select_Loop_Task; end Task_Select;
reznikmm/matreshka
Ada
10,955
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.CMOF.Associations; with AMF.CMOF.Classes; with AMF.CMOF.Classifiers.Collections; with AMF.CMOF.Data_Types; with AMF.CMOF.Elements.Collections; with AMF.CMOF.Multiplicity_Elements; with AMF.CMOF.Named_Elements; with AMF.CMOF.Namespaces; with AMF.CMOF.Properties.Collections; with AMF.CMOF.Redefinable_Elements; with AMF.Internals.CMOF_Features; with AMF.Internals.CMOF_Multiplicity_Elements; pragma Elaborate (AMF.Internals.CMOF_Multiplicity_Elements); with AMF.Internals.CMOF_Typed_Elements; pragma Elaborate (AMF.Internals.CMOF_Typed_Elements); with AMF.Visitors; package AMF.Internals.CMOF_Properties is package Multiplicity_Elements is new AMF.Internals.CMOF_Multiplicity_Elements (AMF.Internals.CMOF_Features.CMOF_Feature_Proxy); package Typed_Elements is new AMF.Internals.CMOF_Typed_Elements (Multiplicity_Elements.CMOF_Multiplicity_Element_Proxy); type CMOF_Property_Proxy is limited new Typed_Elements.CMOF_Typed_Element_Proxy and AMF.CMOF.Properties.CMOF_Property with null record; -- XXX These subprograms are stubs overriding function All_Owned_Elements (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element; overriding procedure Set_Lower (Self : not null access CMOF_Property_Proxy; To : Optional_Integer); overriding procedure Set_Upper (Self : not null access CMOF_Property_Proxy; To : Optional_Unlimited_Natural); overriding function Includes_Multiplicity (Self : not null access constant CMOF_Property_Proxy; M : AMF.CMOF.Multiplicity_Elements.CMOF_Multiplicity_Element_Access) return Boolean; overriding function Includes_Cardinality (Self : not null access constant CMOF_Property_Proxy; C : Integer) return Boolean; overriding function Get_Qualified_Name (Self : not null access constant CMOF_Property_Proxy) return Optional_String; overriding function Is_Distinguishable_From (Self : not null access constant CMOF_Property_Proxy; N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access; Ns : AMF.CMOF.Namespaces.CMOF_Namespace_Access) return Boolean; overriding procedure Set_Is_Leaf (Self : not null access CMOF_Property_Proxy; To : Boolean); overriding function Is_Redefinition_Context_Valid (Self : not null access constant CMOF_Property_Proxy; Redefined : AMF.CMOF.Redefinable_Elements.CMOF_Redefinable_Element_Access) return Boolean; overriding function Get_Is_Read_Only (Self : not null access constant CMOF_Property_Proxy) return Boolean; overriding procedure Set_Is_Read_Only (Self : not null access CMOF_Property_Proxy; To : Boolean); overriding function Get_Default (Self : not null access constant CMOF_Property_Proxy) return Optional_String; overriding procedure Set_Default (Self : not null access CMOF_Property_Proxy; To : Optional_String); overriding function Get_Is_Composite (Self : not null access constant CMOF_Property_Proxy) return Boolean; overriding procedure Set_Is_Composite (Self : not null access CMOF_Property_Proxy; To : Boolean); overriding function Get_Is_Derived (Self : not null access constant CMOF_Property_Proxy) return Boolean; overriding procedure Set_Is_Derived (Self : not null access CMOF_Property_Proxy; To : Boolean); overriding function Get_Is_Derived_Union (Self : not null access constant CMOF_Property_Proxy) return Boolean; overriding procedure Set_Is_Derived_Union (Self : not null access CMOF_Property_Proxy; To : Boolean); overriding function Get_Class (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Classes.CMOF_Class_Access; overriding procedure Set_Class (Self : not null access CMOF_Property_Proxy; To : AMF.CMOF.Classes.CMOF_Class_Access); overriding function Get_Owning_Association (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Associations.CMOF_Association_Access; overriding procedure Set_Owning_Association (Self : not null access CMOF_Property_Proxy; To : AMF.CMOF.Associations.CMOF_Association_Access); overriding function Get_Redefined_Property (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Properties.Collections.Set_Of_CMOF_Property; overriding function Get_Subsetted_Property (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Properties.Collections.Set_Of_CMOF_Property; overriding function Get_Opposite (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Properties.CMOF_Property_Access; -- Getter of Property::opposite. -- -- In the case where the property is one navigable end of a binary -- association with both ends navigable, this gives the other end. overriding procedure Set_Opposite (Self : not null access CMOF_Property_Proxy; To : AMF.CMOF.Properties.CMOF_Property_Access); overriding function Get_Datatype (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Data_Types.CMOF_Data_Type_Access; -- Getter of Property::datatype. -- -- The DataType that owns this Property. overriding procedure Set_Datatype (Self : not null access CMOF_Property_Proxy; To : AMF.CMOF.Data_Types.CMOF_Data_Type_Access); overriding function Get_Association (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Associations.CMOF_Association_Access; overriding procedure Set_Association (Self : not null access CMOF_Property_Proxy; To : AMF.CMOF.Associations.CMOF_Association_Access); overriding function Opposite (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Properties.CMOF_Property_Access; overriding function Is_Consistent_With (Self : not null access constant CMOF_Property_Proxy; Redefinee : AMF.CMOF.Redefinable_Elements.CMOF_Redefinable_Element_Access) return Boolean; overriding function Subsetting_Context (Self : not null access constant CMOF_Property_Proxy) return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier; overriding function Is_Navigable (Self : not null access constant CMOF_Property_Proxy) return Boolean; overriding function Is_Attribute (Self : not null access constant CMOF_Property_Proxy; P : AMF.CMOF.Properties.CMOF_Property_Access) return Boolean; overriding procedure Enter_Element (Self : not null access constant CMOF_Property_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 CMOF_Property_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 CMOF_Property_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.CMOF_Properties;
reznikmm/matreshka
Ada
3,778
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Tags; package Web_Services.SOAP.Payloads.Encoders.Registry is procedure Register (Message_Tag : Ada.Tags.Tag; Encoder_Tag : Ada.Tags.Tag); -- Register encoder. function Resolve (Message_Tag : Ada.Tags.Tag) return not null Web_Services.SOAP.Payloads.Encoders.SOAP_Payload_Encoder_Access; -- Resolve encoder for the given message. end Web_Services.SOAP.Payloads.Encoders.Registry;
reznikmm/matreshka
Ada
7,040
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Form.Connection_Resource_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Form_Connection_Resource_Element_Node is begin return Self : Form_Connection_Resource_Element_Node do Matreshka.ODF_Form.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Form_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Form_Connection_Resource_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Enter_Form_Connection_Resource (ODF.DOM.Form_Connection_Resource_Elements.ODF_Form_Connection_Resource_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Enter_Node (Visitor, Control); end if; end Enter_Node; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Form_Connection_Resource_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Connection_Resource_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Form_Connection_Resource_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Leave_Form_Connection_Resource (ODF.DOM.Form_Connection_Resource_Elements.ODF_Form_Connection_Resource_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Leave_Node (Visitor, Control); end if; end Leave_Node; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Form_Connection_Resource_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then ODF.DOM.Iterators.Abstract_ODF_Iterator'Class (Iterator).Visit_Form_Connection_Resource (Visitor, ODF.DOM.Form_Connection_Resource_Elements.ODF_Form_Connection_Resource_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Visit_Node (Iterator, Visitor, Control); end if; end Visit_Node; begin Matreshka.DOM_Documents.Register_Element (Matreshka.ODF_String_Constants.Form_URI, Matreshka.ODF_String_Constants.Connection_Resource_Element, Form_Connection_Resource_Element_Node'Tag); end Matreshka.ODF_Form.Connection_Resource_Elements;
charlie5/aIDE
Ada
1,224
ads
with AdaM.a_Package, aIDE.Palette.of_packages, Gtk.Button, Gtk.Notebook, gtk.Widget; private with Gtk.Frame, Gtk.Box; package aIDE.Palette.of_packages_subpackages is type Item is new Palette.item with private; type View is access all Item'Class; function to_packages_Palette_package return View; function new_Button (for_Package : in AdaM.a_Package.view; Named : in String; packages_Palette : in Palette.of_packages.view) return Gtk.Button.gtk_Button; procedure Parent_is (Self : in out Item; Now : in aIDE.Palette.of_packages.view); function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; function children_Notebook (Self : in Item) return gtk.Notebook.gtk_Notebook; private use gtk.Button, gtk.Box, gtk.Notebook, gtk.Frame; type Item is new Palette.item with record Parent : Palette.of_packages.view; Top : gtk_Frame; select_button_Box : gtk_Box; children_Notebook : gtk_Notebook; end record; end aIDE.Palette.of_packages_subpackages;
stcarrez/helios
Ada
7,802
adb
----------------------------------------------------------------------- -- helios-commands-register -- Command to register the agent in hyperion -- Copyright (C) 2018, 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Command_Line; with Util.Beans.Objects; with Util.Log; with Swagger.Credentials.OAuth; with Security.Random; with Helios.Datas; with Helios.Rest.Clients; with Helios.Rest.Models; with GNAT.Sockets; package body Helios.Commands.Register is use Ada.Text_IO; use type GNAT.Strings.String_Access; function Get_Default_Value (Context : in Context_Type; Name : in String) return GNAT.Strings.String_Access; function Get_Ip (Command : in Command_Type) return Swagger.UString; function Get_Name (Command : in Command_Type) return Swagger.UString; function Get_Name (Command : in Command_Type) return Swagger.UString is begin if Command.Name = null then return Swagger.To_UString (GNAT.Sockets.Host_Name); else return Swagger.To_UString (Command.Name.all); end if; end Get_Name; function Get_Ip (Command : in Command_Type) return Swagger.UString is begin return Swagger.To_UString (Command.IP.all); end Get_Ip; -- Execute a information command to report information about the agent and monitoring. overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is Client : Helios.Rest.Clients.Client_Type; Agent : Helios.Rest.Models.Agent_Type; Host : Helios.Rest.Models.Host_Type; Cred : aliased Swagger.Credentials.OAuth.OAuth2_Credential_Type; Scope : constant String := "agent:register"; Rand : Security.Random.Generator; Host_Key : Swagger.UString; begin Load (Context); if Command.Client_Id = null or else Command.Client_Id.all = "" then Put_Line ("Missing client_id parameter"); Helios.Commands.Usage (Args, Name); elsif Command.Client_Secret = null or else Command.Client_Secret.all = "" then Put_Line ("Missing client_secret parameter"); Helios.Commands.Usage (Args, Name); elsif Args.Get_Count /= 2 then Helios.Commands.Usage (Args, Name); else -- Step 1: get an OAuth access token. Cred.Set_Application_Identifier (Command.Client_Id.all); Cred.Set_Application_Secret (Command.Client_Secret.all); Client.Set_Server (Args.Get_Argument (1) & "/api/v1"); Cred.Set_Provider_URI (Args.Get_Argument (1) & "/oauth/token"); Cred.Request_Token (Context.Server.Get ("username"), Context.Server.Get ("password"), Scope); Client.Set_Credentials (Cred'Access); -- Step 2: register the agent to the server. Client.Register_Agent (Name => Get_Name (Command), Ip => Get_Ip (Command), Agent_Key => Swagger.To_UString (Rand.Generate (Bits => 1024)), Result => Agent); if Client.Get_Status /= 200 then Command.Log (Util.Log.ERROR_LEVEL, Name, "Registration of helios agent failed."); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; -- Step 3: register the host in the monitoring server. Host_Key := Swagger.To_UString (Rand.Generate (Bits => 1024)); Client.Create_Host (Name => Get_Name (Command), Ip => Get_Ip (Command), Agent_Id => Integer (Agent.Id), Agent_Key => Agent.Key, Host_Key => Host_Key, Result => Host); if Client.Get_Status /= 200 then Command.Log (Util.Log.ERROR_LEVEL, Name, "Creation of host failed."); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; -- Step 4: save the connection information in the server configuration file. Context.Server.Set ("client_id", Command.Client_Id.all); Context.Server.Set ("client_secret", Command.Client_Secret.all); Context.Server.Set ("agent_key", Agent.Key); Context.Server.Set ("server_url", Args.Get_Argument (1) & "/api/v1"); Context.Server.Set ("server_oauth_url", Args.Get_Argument (1) & "/oauth/token"); Context.Server.Set ("agent_id", Long_Long_Integer'Image (Agent.Id)); Context.Server.Set ("host_id", Long_Long_Integer'Image (Host.Id)); Context.Server.Set ("host_key", Host_Key); Save_Server_Configuration (Context); end if; end Execute; function Get_Default_Value (Context : in Context_Type; Name : in String) return GNAT.Strings.String_Access is Value : constant Util.Beans.Objects.Object := Context.Server.Get_Value (Name); begin if Util.Beans.Objects.Is_Null (Value) then return null; else return new String '(Util.Beans.Objects.To_String (Value)); end if; end Get_Default_Value; -- ------------------------------ -- Setup the command before parsing the arguments and executing it. -- ------------------------------ procedure Setup (Command : in out Command_Type; Config : in out GNAT.Command_Line.Command_Line_Configuration; Context : in out Context_Type) is package GC renames GNAT.Command_Line; begin Command.Client_Id := Get_Default_Value (Context, "client_id"); Command.Client_Secret := Get_Default_Value (Context, "client_secret"); GC.Define_Switch (Config, Command.Client_Id'Access, "", "--client-id=", "Define the helios client identifier"); GC.Define_Switch (Config, Command.Client_Secret'Access, "", "--client-secret=", "Define the helios client secret"); GC.Define_Switch (Config, Command.Server'Access, "", "--server=", "Server hostname or IP address"); GC.Define_Switch (Config, Command.Port'Access, "", "--port=", "Server TCP/IP port"); GC.Define_Switch (Config, Command.IP'Access, "", "--client-ip=", "IP address of the host to use"); end Setup; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ overriding procedure Help (Command : in out Command_Type; Name : in String; Context : in out Context_Type) is pragma Unreferenced (Command, Name, Context); begin Ada.Text_IO.Put_Line ("register: register the agent to the Hyperion monitoring server"); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (""); end Help; end Helios.Commands.Register;
charlie5/lace
Ada
2,610
ads
with openGL.Display, openGL.Screen; private with eGL; package opengl.surface_Profile -- -- Models an openGL surface profile. -- is type Item is tagged private; type View is access all Item'Class; type Items is array (Positive range <>) of Item; -- Surface Quality -- Irrelevant : constant Natural := Natural'Last; type color_Buffer is record Bits_red : Natural := Irrelevant; Bits_green : Natural := Irrelevant; Bits_blue : Natural := Irrelevant; Bits_luminence : Natural := Irrelevant; Bits_alpha : Natural := Irrelevant; Bits_alpha_mask : Natural := Irrelevant; end record; function Image (Self : in color_Buffer) return String; type Qualities is record color_Buffer : surface_Profile.color_Buffer; depth_buffer_Bits : Natural := Irrelevant; stencil_buffer_Bits : Natural := Irrelevant; end record; function Image (Self : in Qualities) return String; default_Qualities : constant Qualities; -- Forge -- desired_Qualitites_unavailable : exception; procedure define (Self : in out Item; the_Display : access opengl.Display.item'Class; Screen : access openGL.Screen .item'Class; Desired : in Qualities := default_Qualities); function fetch_All (the_Display : access opengl.Display.item'Class) return surface_Profile.items; -- Attributes -- function Quality (Self : in Item) return Qualities; private type Item is tagged record egl_Config : aliased egl.EGLConfig; Display : access opengl.Display.item'Class; end record; default_Qualities : constant Qualities := (color_Buffer => (Bits_red => 8, Bits_green => 8, Bits_blue => 8, Bits_luminence => Irrelevant, Bits_alpha => Irrelevant, Bits_alpha_mask => Irrelevant), depth_buffer_Bits => 24, stencil_buffer_Bits => Irrelevant); end opengl.surface_Profile;
reznikmm/matreshka
Ada
3,764
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Last_Row_End_Column_Attributes is pragma Preelaborate; type ODF_Table_Last_Row_End_Column_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Last_Row_End_Column_Attribute_Access is access all ODF_Table_Last_Row_End_Column_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Last_Row_End_Column_Attributes;
Letractively/ada-el
Ada
3,538
ads
----------------------------------------------------------------------- -- EL.Methods.Func_1 -- Function Bindings with 1 argument -- Copyright (C) 2010, 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Expressions; with EL.Contexts; with Util.Beans.Methods; with Util.Beans.Basic; generic type Param1_Type (<>) is limited private; type Return_Type (<>) is private; package EL.Methods.Func_1 is use Util.Beans.Methods; -- Returns True if the method is a valid method which accepts the arguments -- defined by the package instantiation. function Is_Valid (Method : in EL.Expressions.Method_Info) return Boolean; -- Execute the method describe by the method expression -- and with the given context. The method signature is: -- -- function F (Obj : <Bean>; Param : Param1_Type) return Return_Type; -- -- where <Bean> inherits from <b>Readonly_Bean</b> -- (See <b>Bind</b> package) -- -- Raises <b>Invalid_Method</b> if the method referenced by -- the method expression does not exist or does not match -- the signature. function Execute (Method : in EL.Expressions.Method_Expression'Class; Param : in Param1_Type; Context : in EL.Contexts.ELContext'Class) return Return_Type; -- Function access to the proxy. type Proxy_Access is access function (O : in Util.Beans.Basic.Readonly_Bean'Class; P : in Param1_Type) return Return_Type; -- The binding record which links the method name -- to the proxy function. type Binding is new Method_Binding with record Method : Proxy_Access; end record; type Binding_Access is access constant Binding; -- Proxy for the binding. -- The proxy declares the binding definition that links -- the name to the function and it implements the necessary -- object conversion to translate the <b>Readonly_Bean</b> -- object to the target object type. generic -- Name of the method (as exposed in the EL expression) Name : String; -- The bean type type Bean is new Util.Beans.Basic.Readonly_Bean with private; -- The bean method to invoke with function Method (O : in Bean; P1 : in Param1_Type) return Return_Type; package Bind is -- Method that <b>Execute</b> will invoke. function Method_Access (O : in Util.Beans.Basic.Readonly_Bean'Class; P1 : in Param1_Type) return Return_Type; F_NAME : aliased constant String := Name; -- The proxy binding that can be exposed through -- the <b>Method_Bean</b> interface. Proxy : aliased constant Binding := Binding '(Name => F_NAME'Access, Method => Method_Access'Access); end Bind; end EL.Methods.Func_1;
AdaCore/libadalang
Ada
100,495
adb
------------------------------------------------------------------------------ -- -- -- GPR TECHNOLOGY -- -- -- -- Copyright (C) 2007-2016, AdaCore -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- -- License for more details. You should have received a copy of the GNU -- -- General Public License distributed with GNAT; see file COPYING. If not, -- -- see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers.Indefinite_Ordered_Sets; with Ada.Calendar.Time_Zones; use Ada.Calendar; use Ada.Calendar.Time_Zones; with Ada.Command_Line; use Ada.Command_Line; with Ada.Directories; use Ada.Directories; with Ada.Environment_Variables; use Ada.Environment_Variables; with Ada.Streams.Stream_IO; use Ada.Streams; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Calendar.Time_IO; use GNAT.Calendar.Time_IO; with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables; with GNAT.IO_Aux; with GNAT.Sockets; with GNAT.Table; with GNAT.Regpat; use GNAT.Regpat; with Interfaces.C.Strings; with System; with Gpr_Build_Util; use Gpr_Build_Util; with GprConfig.Sdefault; with GPR_Version; use GPR_Version; with GPR.ALI; use GPR.ALI; with GPR.Com; with GPR.Debug; with GPR.Opt; use GPR.Opt; with GPR.Osint; use GPR.Osint; with GPR.Conf; with GPR.Env; with GPR.Err; with GPR.Names; use GPR.Names; with GPR.Scans; with GPR.Sinput; with GPR.Tempdir; with GPR.Util; use GPR.Util; package body Gpr_Util is use GPR.Stamps; Libgcc_Subdir_Ptr : Interfaces.C.Strings.chars_ptr; pragma Import (C, Libgcc_Subdir_Ptr, "__gnat_default_libgcc_subdir"); -- Pointer to string indicating the installation subdirectory where a -- default shared libgcc might be found. GNU_Header : aliased constant String := "INPUT ("; GNU_Opening : aliased constant String := """"; GNU_Closing : aliased constant String := '"' & ASCII.LF; GNU_Footer : aliased constant String := ')' & ASCII.LF; package Project_Name_Boolean_Htable is new Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, Key => Name_Id, Hash => Hash, Equal => "="); Project_Failure : Project_Name_Boolean_Htable.Instance := Project_Name_Boolean_Htable.Nil; -- Record a boolean for project having failed to compile cleanly ------------------------------- -- Binder_Exchange_File_Name -- ------------------------------- function Binder_Exchange_File_Name (Main_Base_Name : File_Name_Type; Prefix : Name_Id) return String_Access is File_Name : constant String := Get_Name_String (Main_Base_Name); begin Get_Name_String (Prefix); Add_Str_To_Name_Buffer (File_Name); Add_Str_To_Name_Buffer (Binder_Exchange_Suffix); return new String'(Name_Buffer (1 .. Name_Len)); end Binder_Exchange_File_Name; ----------------------- -- Compute_Slave_Env -- ----------------------- function Compute_Slave_Env (Project : Project_Tree_Ref; Auto : Boolean) return String is User : String_Access := Getenv ("USER"); User_Name : String_Access := Getenv ("USERNAME"); Default : constant String := (if User = null then (if User_Name = null then "unknown" else User_Name.all) else User.all) & '@' & GNAT.Sockets.Host_Name; package S_Set is new Containers.Indefinite_Ordered_Sets (String); Set : S_Set.Set; Ctx : Context; begin Free (User); Free (User_Name); if Auto then -- In this mode the slave environment is computed based on -- the project variable value and the command line arguments. -- First adds all command line arguments for K in 1 .. Argument_Count loop -- Skip arguments that are not changing the actual compilation and -- this will ensure that the same environment will be created for -- gprclean. if Argument (K) not in "-p" | "-d" | "-c" | "-q" and then (Argument (K)'Length < 2 or else Argument (K) (1 .. 2) /= "-j") then Set.Insert (Argument (K)); end if; end loop; -- Then all the global variables for the project tree for K in 1 .. Variable_Element_Table.Last (Project.Shared.Variable_Elements) loop declare V : constant Variable := Project.Shared.Variable_Elements.Table (K); begin if V.Value.Kind = Single then Set.Include (Get_Name_String (V.Name) & "=" & Get_Name_String (V.Value.Value)); end if; end; end loop; -- Compute the MD5 sum of the sorted elements in the set for S of Set loop Update (Ctx, S); end loop; return Default & "-" & Digest (Ctx); else -- Otherwise use the default <user_name> & '@' & <host_name> return Default; end if; end Compute_Slave_Env; ------------------------------ -- Check_Version_And_Help_G -- ------------------------------ -- Common switches for GNU tools Version_Switch : constant String := "--version"; Help_Switch : constant String := "--help"; procedure Check_Version_And_Help_G (Tool_Name : String; Initial_Year : String; Version_String : String) is Version_Switch_Present : Boolean := False; Help_Switch_Present : Boolean := False; Next_Arg : Natural; begin -- First check for --version or --help Next_Arg := 1; while Next_Arg <= Argument_Count loop declare Next_Argv : constant String := Argument (Next_Arg); begin if Next_Argv = Version_Switch then Version_Switch_Present := True; elsif Next_Argv = Help_Switch then Help_Switch_Present := True; end if; Next_Arg := Next_Arg + 1; end; end loop; -- If --version was used, display version and exit if Version_Switch_Present then Display_Version (Tool_Name, Initial_Year, Version_String); Put_Line (Free_Software); New_Line; OS_Exit (0); end if; -- If --help was used, display help and exit if Help_Switch_Present then Usage; New_Line; Put_Line ("Report bugs to [email protected]"); OS_Exit (0); end if; end Check_Version_And_Help_G; -------------------------------- -- Create_Export_Symbols_File -- -------------------------------- procedure Create_Export_Symbols_File (Driver_Path : String; Options : Argument_List; Sym_Matcher : String; Format : Export_File_Format; Objects : String_List; Library_Symbol_File : String; Export_File_Name : out Path_Name_Type) is use type Containers.Count_Type; package Syms_List is new Containers.Indefinite_Ordered_Sets (String); procedure Get_Syms (Object_File : String); -- Read exported symbols from Object_File and add them into Syms procedure Write (Str : String); -- Write Str into the export file Pattern : constant Pattern_Matcher := Compile (Sym_Matcher); Syms : Syms_List.Set; FD : File_Descriptor; -------------- -- Get_Syms -- -------------- procedure Get_Syms (Object_File : String) is Success : Boolean; Ret : Integer; Opts : Argument_List (1 .. Options'Length + 1); File : File_Type; File_Name : Path_Name_Type; Matches : Match_Array (0 .. 1); function Filename return String is (Get_Name_String (File_Name)); -- Remove the ASCII.NUL from end of temporary file-name begin Opts (1 .. Options'Length) := Options; Opts (Opts'Last) := new String'(Object_File); GPR.Tempdir.Create_Temp_File (FD, File_Name); Record_Temp_File (null, File_Name); Close (FD); if Verbose_Mode then Put (Driver_Path); for O of Opts loop Put (' '); Put (O.all); end loop; New_Line; end if; Spawn (Driver_Path, Opts, Filename, Success, Ret); if Success then Open (File, In_File, Filename); while not End_Of_File (File) loop declare use GNAT; Buffer : constant String := IO_Aux.Get_Line (File); begin Match (Pattern, Buffer, Matches); if Matches (1) /= No_Match then Syms.Include (Buffer (Matches (1).First .. Matches (1).Last)); end if; end; end loop; Close (File); end if; Free (Opts (Opts'Last)); end Get_Syms; ----------- -- Write -- ----------- procedure Write (Str : String) is S : constant String := Str & ASCII.LF; R : Integer with Unreferenced; begin R := Write (FD, S (S'First)'Address, S'Length); end Write; begin Export_File_Name := No_Path; if Format = None then return; end if; if Library_Symbol_File = "" then -- Get the exported symbols from every object files, first get the nm -- tool for the target. for K in Objects'Range loop Get_Syms (Objects (K).all); end loop; else -- Get the symbols from the symbol file, one symbol per line if Is_Readable_File (Library_Symbol_File) then declare File : File_Type; Line : String (1 .. 1_024); Last : Natural; begin Open (File, In_File, Library_Symbol_File); while not End_Of_File (File) loop Get_Line (File, Line, Last); if Last > 0 then Syms.Include (Line (1 .. Last)); end if; end loop; Close (File); end; else raise Constraint_Error with "unable to locate Library_Symbol_File""" & Library_Symbol_File & '"'; end if; end if; if Syms.Length = 0 then return; end if; -- Now create the export file, either GNU or DEF format Create_Export_File : declare File_Name : Path_Name_Type; begin -- Create (Export_File, Out_File); GPR.Tempdir.Create_Temp_File (FD, File_Name); Record_Temp_File (null, File_Name); Get_Name_String (File_Name); -- Always add .def at the end, this is needed for Windows Add_Str_To_Name_Buffer (".def"); Export_File_Name := Name_Find; Record_Temp_File (null, Export_File_Name); -- Header case Format is when GNU => Write ("SYMS {"); Write (" global:"); when Def => Write ("EXPORTS"); when None | Flat => null; end case; -- Symbols for Sym of Syms loop case Format is when GNU => Write (Sym & ";"); when Def | Flat => Write (Sym); when None => null; end case; end loop; -- Footer case Format is when GNU => Write (" local: *;"); Write ("};"); when None | Def | Flat => null; end case; Close (FD); Copy_File (Get_Name_String (File_Name), Get_Name_String (Export_File_Name), Success); end Create_Export_File; end Create_Export_Symbols_File; -------------------------- -- Create_Response_File -- -------------------------- procedure Create_Response_File (Format : Response_File_Format; Objects : String_List; Other_Arguments : String_List; Resp_File_Options : String_List; Name_1 : out Path_Name_Type; Name_2 : out Path_Name_Type) is Resp_File : File_Descriptor; Status : Integer; pragma Warnings (Off, Status); Closing_Status : Boolean; pragma Warnings (Off, Closing_Status); function Modified_Argument (Arg : String) return String; -- If the argument includes a space, a backslash, or a double quote, -- escape the character with a preceding backsash. ----------------------- -- Modified_Argument -- ----------------------- function Modified_Argument (Arg : String) return String is Result : String (1 .. 2 * Arg'Length); Last : Natural := 0; procedure Add (C : Character); --------- -- Add -- --------- procedure Add (C : Character) is begin Last := Last + 1; Result (Last) := C; end Add; begin for J in Arg'Range loop if Arg (J) = '\' or else Arg (J) = ' ' or else Arg (J) = '"' then Add ('\'); end if; Add (Arg (J)); end loop; return Result (1 .. Last); end Modified_Argument; begin Name_2 := No_Path; Tempdir.Create_Temp_File (Resp_File, Name => Name_1); Record_Temp_File (null, Name_1); if Format = GNU or else Format = GCC_GNU then Status := Write (Resp_File, GNU_Header'Address, GNU_Header'Length); end if; for J in Objects'Range loop if Format = GNU or else Format = GCC_GNU then Status := Write (Resp_File, GNU_Opening'Address, GNU_Opening'Length); end if; Status := Write (Resp_File, Objects (J).all'Address, Objects (J)'Length); if Format = GNU or else Format = GCC_GNU then Status := Write (Resp_File, GNU_Closing'Address, GNU_Closing'Length); else Status := Write (Resp_File, ASCII.LF'Address, 1); end if; end loop; if Format = GNU or else Format = GCC_GNU then Status := Write (Resp_File, GNU_Footer'Address, GNU_Footer'Length); end if; case Format is when GCC_GNU | GCC_Object_List | GCC_Option_List => Close (Resp_File, Closing_Status); Name_2 := Name_1; Tempdir.Create_Temp_File (Resp_File, Name => Name_1); Record_Temp_File (null, Name_1); declare Arg : constant String := Modified_Argument (Get_Name_String (Name_2)); begin for J in Resp_File_Options'Range loop Status := Write (Resp_File, Resp_File_Options (J) (1)'Address, Resp_File_Options (J)'Length); if J < Resp_File_Options'Last then Status := Write (Resp_File, ASCII.LF'Address, 1); end if; end loop; Status := Write (Resp_File, Arg (1)'Address, Arg'Length); end; Status := Write (Resp_File, ASCII.LF'Address, 1); when GCC => null; when others => Close (Resp_File, Closing_Status); end case; if Format = GCC or else Format = GCC_GNU or else Format = GCC_Object_List or else Format = GCC_Option_List then for J in Other_Arguments'Range loop declare Arg : constant String := Modified_Argument (Other_Arguments (J).all); begin Status := Write (Resp_File, Arg (1)'Address, Arg'Length); end; Status := Write (Resp_File, ASCII.LF'Address, 1); end loop; Close (Resp_File, Closing_Status); end if; end Create_Response_File; --------------------- -- Create_Sym_Link -- --------------------- procedure Create_Sym_Link (From, To : String) is function Symlink (Oldpath : System.Address; Newpath : System.Address) return Integer; pragma Import (C, Symlink, "__gnat_symlink"); C_From : constant String := From & ASCII.NUL; C_To : constant String := Relative_Path (Containing_Directory (To), Containing_Directory (From)) & Ada.Directories.Simple_Name (To) & ASCII.NUL; Result : Integer; Success : Boolean; pragma Unreferenced (Success, Result); begin Delete_File (From, Success); Result := Symlink (C_To'Address, C_From'Address); end Create_Sym_Link; ---------------------- -- Create_Sym_Links -- ---------------------- procedure Create_Sym_Links (Lib_Path : String; Lib_Version : String; Lib_Dir : String; Maj_Version : String) is function Symlink (Oldpath : System.Address; Newpath : System.Address) return Integer; pragma Import (C, Symlink, "__gnat_symlink"); Version_Path : String_Access; Success : Boolean; Result : Integer; pragma Unreferenced (Success, Result); begin Version_Path := new String (1 .. Lib_Version'Length + 1); Version_Path (1 .. Lib_Version'Length) := Lib_Version; Version_Path (Version_Path'Last) := ASCII.NUL; if Maj_Version'Length = 0 then declare Newpath : String (1 .. Lib_Path'Length + 1); begin Newpath (1 .. Lib_Path'Length) := Lib_Path; Newpath (Newpath'Last) := ASCII.NUL; Delete_File (Lib_Path, Success); Result := Symlink (Version_Path (1)'Address, Newpath'Address); end; else declare Newpath1 : String (1 .. Lib_Path'Length + 1); Maj_Path : constant String := Lib_Dir & Directory_Separator & Maj_Version; Newpath2 : String (1 .. Maj_Path'Length + 1); Maj_Ver : String (1 .. Maj_Version'Length + 1); begin Newpath1 (1 .. Lib_Path'Length) := Lib_Path; Newpath1 (Newpath1'Last) := ASCII.NUL; Newpath2 (1 .. Maj_Path'Length) := Maj_Path; Newpath2 (Newpath2'Last) := ASCII.NUL; Maj_Ver (1 .. Maj_Version'Length) := Maj_Version; Maj_Ver (Maj_Ver'Last) := ASCII.NUL; Delete_File (Maj_Path, Success); Result := Symlink (Version_Path (1)'Address, Newpath2'Address); Delete_File (Lib_Path, Success); Result := Symlink (Maj_Ver'Address, Newpath1'Address); end; end if; end Create_Sym_Links; ------------------------------------ -- Display_Usage_Version_And_Help -- ------------------------------------ procedure Display_Usage_Version_And_Help is begin Put_Line (" --version Display version and exit"); Put_Line (" --help Display usage and exit"); New_Line; end Display_Usage_Version_And_Help; --------------------- -- Display_Version -- --------------------- procedure Display_Version (Tool_Name : String; Initial_Year : String; Version_String : String) is begin Put_Line (Tool_Name & " " & Version_String); Put ("Copyright (C) "); Put (Initial_Year); Put ('-'); Put (Current_Year); Put (", "); Put (Copyright_Holder); New_Line; end Display_Version; ---------------------- -- Ensure_Directory -- ---------------------- function Ensure_Directory (Path : String) return String is begin if Path'Length = 0 or else Path (Path'Last) = Directory_Separator or else Path (Path'Last) = '/' -- on Windows check also for / then return Path; else return Path & Directory_Separator; end if; end Ensure_Directory; -- --------------- -- -- Error_Msg -- -- --------------- -- -- procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is -- pragma Warnings (Off, Msg); -- pragma Warnings (Off, Flag_Location); -- begin -- null; -- end Error_Msg; -- -- ----------------- -- -- Error_Msg_S -- -- ----------------- -- -- procedure Error_Msg_S (Msg : String) is -- pragma Warnings (Off, Msg); -- begin -- null; -- end Error_Msg_S; -- -- ------------------ -- -- Error_Msg_SC -- -- ------------------ -- -- procedure Error_Msg_SC (Msg : String) is -- pragma Warnings (Off, Msg); -- begin -- null; -- end Error_Msg_SC; -- -- ------------------ -- -- Error_Msg_SP -- -- ------------------ -- -- procedure Error_Msg_SP (Msg : String) is -- pragma Warnings (Off, Msg); -- begin -- null; -- end Error_Msg_SP; -------------- -- File_MD5 -- -------------- function File_MD5 (Pathname : String) return Message_Digest is use Stream_IO; C : Context; S : Stream_IO.File_Type; B : Stream_Element_Array (1 .. 100 * 1024); -- Buffer to read chunk of data L : Stream_Element_Offset; begin Open (S, In_File, Pathname); while not End_Of_File (S) loop Read (S, B, L); Update (C, B (1 .. L)); end loop; Close (S); return Digest (C); end File_MD5; ------------------------------ -- Get_Compiler_Driver_Path -- ------------------------------ function Get_Compiler_Driver_Path (Project_Tree : Project_Tree_Ref; Lang : Language_Ptr) return String_Access is pragma Unreferenced (Project_Tree); begin if Lang.Config.Compiler_Driver_Path = null then declare Compiler : Name_Id := Compiler_Subst_HTable.Get (Lang.Name); begin -- If --compiler-subst was used to specify an alternate compiler, -- then Compiler /= No_Name. In the usual case, Compiler = -- No_Name, so we set Compiler to the Compiler_Driver from the -- config file. if Compiler = No_Name then Compiler := Name_Id (Lang.Config.Compiler_Driver); end if; -- No compiler found, return now if Compiler = No_Name then return null; end if; declare Compiler_Name : constant String := Get_Name_String (Compiler); begin if Compiler_Name = "" then return null; end if; Lang.Config.Compiler_Driver_Path := Locate_Exec_On_Path (Compiler_Name); if Lang.Config.Compiler_Driver_Path = null then raise Constraint_Error with "unable to locate """ & Compiler_Name & '"'; end if; end; end; end if; return Lang.Config.Compiler_Driver_Path; end Get_Compiler_Driver_Path; ---------------------- -- Get_Slaves_Hosts -- ---------------------- function Get_Slaves_Hosts (Project_Tree : Project_Tree_Ref; Arg : String) return String is use Ada.Strings.Unbounded; Hosts : Unbounded_String; begin if Arg'Length > Distributed_Option'Length and then Arg (Arg'First + Distributed_Option'Length) = '=' then -- The hosts are specified on the command-line Hosts := To_Unbounded_String (Arg (Arg'First + Distributed_Option'Length + 1 .. Arg'Last)); elsif Environment_Variables.Exists ("GPR_SLAVES") then Hosts := To_Unbounded_String (Value ("GPR_SLAVES")); elsif Environment_Variables.Exists ("GPR_SLAVES_FILE") then declare F_Name : constant String := Value ("GPR_SLAVES_FILE"); F : Text_IO.File_Type; Buffer : String (1 .. 100); Last : Natural; begin if Ada.Directories.Exists (F_Name) then Open (F, In_File, F_Name); while not Text_IO.End_Of_File (F) loop Text_IO.Get_Line (F, Buffer, Last); if Last > 0 then if Hosts /= Null_Unbounded_String then Append (Hosts, ","); end if; Append (Hosts, Buffer (1 .. Last)); end if; end loop; Text_IO.Close (F); else Fail_Program (Project_Tree, "hosts distributed file " & F_Name & " not found"); end if; end; end if; return To_String (Hosts); end Get_Slaves_Hosts; ---------------------------- -- Find_Binding_Languages -- ---------------------------- procedure Find_Binding_Languages (Tree : Project_Tree_Ref; Root_Project : Project_Id) is Data : constant Builder_Data_Access := Builder_Data (Tree); B_Index : Binding_Data; Language_Name : Name_Id; Binder_Driver_Name : File_Name_Type := No_File; Binder_Driver_Path : String_Access; Binder_Prefix : Name_Id; Language : Language_Ptr; Config : Language_Config; Project : Project_List; begin -- Have we already processed this tree ? if Data.There_Are_Binder_Drivers and then Data.Binding /= null then return; end if; if Current_Verbosity = High then Debug_Output ("Find_Binding_Languages for", Debug_Name (Tree)); end if; Data.There_Are_Binder_Drivers := False; Project := Tree.Projects; while Project /= null loop Language := Project.Project.Languages; while Language /= No_Language_Index loop Config := Language.Config; Binder_Driver_Name := Config.Binder_Driver; if Language.First_Source /= No_Source and then Binder_Driver_Name /= No_File then Data.There_Are_Binder_Drivers := True; Language_Name := Language.Name; B_Index := Data.Binding; while B_Index /= null and then B_Index.Language_Name /= Language_Name loop B_Index := B_Index.Next; end loop; if B_Index = null then Get_Name_String (Binder_Driver_Name); Binder_Driver_Path := Locate_Exec_On_Path (Name_Buffer (1 .. Name_Len)); if Binder_Driver_Path = null then Fail_Program (Tree, "unable to find binder driver " & Name_Buffer (1 .. Name_Len)); end if; if Current_Verbosity = High then Debug_Output ("Binder_Driver=" & Binder_Driver_Path.all & " for Lang", Language_Name); end if; if Config.Binder_Prefix = No_Name then Binder_Prefix := Empty_String; else Binder_Prefix := Config.Binder_Prefix; end if; B_Index := Data.Binding; while B_Index /= null loop if Binder_Prefix = B_Index.Binder_Prefix then Fail_Program (Tree, "binding prefix cannot be the same for" & " two languages"); end if; B_Index := B_Index.Next; end loop; Data.Binding := new Binding_Data_Record' (Language => Language, Language_Name => Language_Name, Binder_Driver_Name => Binder_Driver_Name, Binder_Driver_Path => Binder_Driver_Path, Binder_Prefix => Binder_Prefix, Next => Data.Binding); end if; end if; Language := Language.Next; end loop; Project := Project.Next; end loop; if Root_Project.Qualifier = Aggregate then declare Agg : Aggregated_Project_List := Root_Project.Aggregated_Projects; begin while Agg /= null loop Find_Binding_Languages (Agg.Tree, Agg.Project); Agg := Agg.Next; end loop; end; end if; end Find_Binding_Languages; ---------------- -- Get_Target -- ---------------- function Get_Target return String is begin if Target_Name = null or else Target_Name.all = "" then return GprConfig.Sdefault.Hostname; else return Target_Name.all; end if; end Get_Target; -------------------- -- Locate_Runtime -- -------------------- procedure Locate_Runtime (Project_Tree : Project_Tree_Ref; Language : Name_Id) is function Is_RTS_Directory (Path : String) return Boolean; -- Returns True if Path is a directory for a runtime. This simply check -- that Path has a "adalib" subdirectoy, which is a property for -- runtimes on the project path. function Is_Base_Name (Path : String) return Boolean; -- Returns True if Path has no directory separator ---------------------- -- Is_RTS_Directory -- ---------------------- function Is_RTS_Directory (Path : String) return Boolean is begin return Is_Directory (Path & Directory_Separator & "adalib"); end Is_RTS_Directory; -- Local declarations function Find_Rts_In_Path is new GPR.Env.Find_Name_In_Path (Check_Filename => Is_RTS_Directory); ------------------ -- Is_Base_Name -- ------------------ function Is_Base_Name (Path : String) return Boolean is begin for I in Path'Range loop if Path (I) = Directory_Separator or else Path (I) = '/' then return False; end if; end loop; return True; end Is_Base_Name; RTS_Name : constant String := GPR.Conf.Runtime_Name_For (Language); Full_Path : String_Access; begin Full_Path := Find_Rts_In_Path (Root_Environment.Project_Path, RTS_Name); if Full_Path /= null then GPR.Conf.Set_Runtime_For (Language, Normalize_Pathname (Full_Path.all)); Free (Full_Path); elsif not Is_Base_Name (RTS_Name) then Fail_Program (Project_Tree, "cannot find RTS " & RTS_Name); end if; end Locate_Runtime; ------------------------------ -- Look_For_Default_Project -- ------------------------------ procedure Look_For_Default_Project (Never_Fail : Boolean := False) is begin No_Project_File_Found := False; if Is_Regular_File (Default_Project_File_Name) then Project_File_Name := new String'(Default_Project_File_Name); else -- Check if there is a single project file in the current -- directory. If there is one and only one, use it. declare Dir : Dir_Type; Str : String (1 .. 255); Last : Natural; Single : String_Access := null; begin No_Project_File_Found := True; Open (Dir, "."); loop Read (Dir, Str, Last); exit when Last = 0; if Last > Project_File_Extension'Length and then Is_Regular_File (Str (1 .. Last)) then Canonical_Case_File_Name (Str (1 .. Last)); if Str (Last - Project_File_Extension'Length + 1 .. Last) = Project_File_Extension then No_Project_File_Found := False; if Single = null then Single := new String'(Str (1 .. Last)); else -- There are several project files in the current -- directory. Reset Single to null and exit. Single := null; exit; end if; end if; end if; end loop; Close (Dir); Project_File_Name := Single; end; if No_Project_File_Found or else (Never_Fail and then Project_File_Name = null) then Project_File_Name := new String'(Executable_Prefix_Path & Implicit_Project_File_Path); if not Is_Regular_File (Project_File_Name.all) then Project_File_Name := null; end if; end if; end if; if (not Quiet_Output) and then Project_File_Name /= null then Put ("using project file "); Put_Line (Project_File_Name.all); end if; end Look_For_Default_Project; ------------------- -- Major_Id_Name -- ------------------- function Major_Id_Name (Lib_Filename : String; Lib_Version : String) return String is Maj_Version : constant String := Lib_Version; Last_Maj : Positive; Last : Positive; Ok_Maj : Boolean := False; begin Last_Maj := Maj_Version'Last; while Last_Maj > Maj_Version'First loop if Maj_Version (Last_Maj) in '0' .. '9' then Last_Maj := Last_Maj - 1; else Ok_Maj := Last_Maj /= Maj_Version'Last and then Maj_Version (Last_Maj) = '.'; if Ok_Maj then Last_Maj := Last_Maj - 1; end if; exit; end if; end loop; if Ok_Maj then Last := Last_Maj; while Last > Maj_Version'First loop if Maj_Version (Last) in '0' .. '9' then Last := Last - 1; else Ok_Maj := Last /= Last_Maj and then Maj_Version (Last) = '.'; if Ok_Maj then Last := Last - 1; Ok_Maj := Maj_Version (Maj_Version'First .. Last) = Lib_Filename; end if; exit; end if; end loop; end if; if Ok_Maj then return Maj_Version (Maj_Version'First .. Last_Maj); else return ""; end if; end Major_Id_Name; ------------------ -- Partial_Name -- ------------------ function Partial_Name (Lib_Name : String; Number : Natural; Object_Suffix : String) return String is Img : constant String := Number'Img; begin return Partial_Prefix & Lib_Name & '_' & Img (Img'First + 1 .. Img'Last) & Object_Suffix; end Partial_Name; -------------------------------- -- Project_Compilation_Failed -- -------------------------------- function Project_Compilation_Failed (Prj : Project_Id; Recursive : Boolean := True) return Boolean is use Project_Name_Boolean_Htable; begin if Get (Project_Failure, Prj.Name) then return True; elsif not Recursive then return False; else -- Check all imported projects directly or indirectly declare Plist : Project_List := Prj.All_Imported_Projects; begin while Plist /= null loop if Get (Project_Failure, Plist.Project.Name) then return True; else Plist := Plist.Next; end if; end loop; return False; end; end if; end Project_Compilation_Failed; ----------------------------------- -- Set_Failed_Compilation_Status -- ----------------------------------- procedure Set_Failed_Compilation_Status (Prj : Project_Id) is begin Project_Name_Boolean_Htable.Set (Project_Failure, Prj.Name, True); end Set_Failed_Compilation_Status; ----------------------- -- Shared_Libgcc_Dir -- ----------------------- function Shared_Libgcc_Dir (Run_Time_Dir : String) return String is Path : String (1 .. Run_Time_Dir'Length + 15); Path_Last : constant Natural := Run_Time_Dir'Length; GCC_Index : Natural := 0; begin Path (1 .. Path_Last) := Run_Time_Dir; GCC_Index := Index (Path (1 .. Path_Last), "gcc-lib"); if GCC_Index /= 0 then -- This is gcc 2.8.2: the shared version of libgcc is -- located in the parent directory of "gcc-lib". GCC_Index := GCC_Index - 1; else GCC_Index := Index (Path (1 .. Path_Last), "/lib/"); if GCC_Index = 0 then GCC_Index := Index (Path (1 .. Path_Last), Directory_Separator & "lib" & Directory_Separator); end if; if GCC_Index /= 0 then -- We have found "lib" as a subdirectory in the runtime dir path. -- The declare Subdir : constant String := Interfaces.C.Strings.Value (Libgcc_Subdir_Ptr); begin Path (GCC_Index + 1 .. GCC_Index + Subdir'Length) := Subdir; GCC_Index := GCC_Index + Subdir'Length; end; end if; end if; return Path (1 .. GCC_Index); end Shared_Libgcc_Dir; --------------------- -- Need_To_Compile -- --------------------- procedure Need_To_Compile (Source : GPR.Source_Id; Tree : Project_Tree_Ref; In_Project : Project_Id; Must_Compile : out Boolean; The_ALI : out ALI.ALI_Id; Object_Check : Boolean; Always_Compile : Boolean) is Source_Path : constant String := Get_Name_String (Source.Path.Display_Name); C_Source_Path : constant String := Get_Name_String (Source.Path.Name); Runtime_Source_Dirs : constant Name_List_Index := Source.Language.Config.Runtime_Source_Dirs; Start : Natural; Finish : Natural; Last_Obj : Natural; Stamp : Time_Stamp_Type; Looping : Boolean := False; -- Set to True at the end of the first Big_Loop for Makefile fragments Source_In_Dependencies : Boolean := False; -- Set True if source was found in dependency file of its object file C_Object_Name : String_Access := null; -- The canonical file name for the object file Object_Path : String_Access := null; -- The absolute path name for the object file Switches_Name : String_Access := null; -- The file name of the file that contains the switches that were used -- in the last compilation. Num_Ext : Natural; -- Number of extending projects ALI_Project : Project_Id; -- If the ALI file is in the object directory of a project, this is -- the project id. Externally_Built : constant Boolean := In_Project.Externally_Built; -- True if the project of the source is externally built function Process_Makefile_Deps (Dep_Name, Obj_Dir : String) return Boolean; function Process_ALI_Deps return Boolean; function Process_ALI_Closure_Deps return Boolean; -- Process the dependencies for the current source file for the various -- dependency modes. -- They return True if the file needs to be recompiled procedure Cleanup; -- Cleanup local variables function Check_Time_Stamps (Path : String; Stamp : Time_Stamp_Type) return Boolean; ----------------------- -- Check_Time_Stamps -- ----------------------- function Check_Time_Stamps (Path : String; Stamp : Time_Stamp_Type) return Boolean is begin Name_Len := 0; Add_Str_To_Name_Buffer (Path); declare TS : constant Time_Stamp_Type := File_Stamp (Path_Name_Type'(Name_Find)); begin if TS /= Empty_Time_Stamp and then TS /= Stamp then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> different time stamp for " & Path); if Debug.Debug_Flag_T then Put_Line (" in ALI file: " & String (Stamp)); Put_Line (" actual file: " & String (TS)); end if; end if; return True; end if; end; return False; end Check_Time_Stamps; --------------------------- -- Process_Makefile_Deps -- --------------------------- function Process_Makefile_Deps (Dep_Name, Obj_Dir : String) return Boolean is Dep_File : GPR.Util.Text_File; Last_Source : String_Access; Last_TS : Time_Stamp_Type := Empty_Time_Stamp; function Is_Time_Stamp (S : String) return Boolean; -- Return True iff S has the format of a Time_Stamp_Type ------------------- -- Is_Time_Stamp -- ------------------- function Is_Time_Stamp (S : String) return Boolean is Result : Boolean := False; begin if S'Length = Time_Stamp_Length then Result := True; for J in S'Range loop if S (J) not in '0' .. '9' then Result := False; exit; end if; end loop; end if; return Result; end Is_Time_Stamp; begin Open (Dep_File, Dep_Name); -- If dependency file cannot be open, we need to recompile -- the source. if not Is_Valid (Dep_File) then if Opt.Verbosity_Level > Opt.Low then Put (" -> could not open dependency file "); Put_Line (Dep_Name); end if; return True; end if; -- Loop Big_Loop is executed several times only when the -- dependency file contains several times -- <object file>: <source1> ... -- When there is only one of such occurence, Big_Loop is exited -- successfully at the beginning of the second loop. Big_Loop : loop declare End_Of_File_Reached : Boolean := False; Object_Found : Boolean := False; begin loop if End_Of_File (Dep_File) then End_Of_File_Reached := True; exit; end if; Get_Line (Dep_File, Name_Buffer, Name_Len); if Name_Len > 0 and then Name_Buffer (1) /= '#' then -- Skip a first line that is an empty continuation line for J in 1 .. Name_Len - 1 loop if Name_Buffer (J) /= ' ' then Object_Found := True; exit; end if; end loop; exit when Object_Found or else Name_Buffer (Name_Len) /= '\'; end if; end loop; -- If dependency file contains only empty lines or comments, -- then dependencies are unknown, and the source needs to be -- recompiled. if End_Of_File_Reached then -- If we have reached the end of file after the first -- loop, there is nothing else to do. exit Big_Loop when Looping; if Opt.Verbosity_Level > Opt.Low then Put (" -> dependency file "); Put (Dep_Name); Put_Line (" is empty"); end if; Close (Dep_File); return True; end if; end; Start := 1; Finish := Index (Name_Buffer (1 .. Name_Len), ": "); if Finish = 0 then Finish := Index (Name_Buffer (1 .. Name_Len), (1 => ':', 2 => ASCII.HT)); end if; if Finish /= 0 then Last_Obj := Finish; loop Last_Obj := Last_Obj - 1; exit when Last_Obj = Start or else Name_Buffer (Last_Obj) /= ' '; end loop; while Start < Last_Obj and then Name_Buffer (Start) = ' ' loop Start := Start + 1; end loop; Canonical_Case_File_Name (Name_Buffer (Start .. Last_Obj)); end if; -- First line must start with name of object file, followed by -- colon. if Finish = 0 or else (C_Object_Name /= null and then Name_Buffer (Start .. Last_Obj) /= C_Object_Name.all) then if Opt.Verbosity_Level > Opt.Low then Put (" -> dependency file "); Put (Dep_Name); Put_Line (" has wrong format"); if Finish = 0 then Put_Line (" no colon"); else Put (" expected object file name "); Put (C_Object_Name.all); Put (", got "); Put_Line (Name_Buffer (Start .. Last_Obj)); end if; end if; Close (Dep_File); return True; else Start := Finish + 2; -- Process each line Line_Loop : loop declare Line : String := Name_Buffer (1 .. Name_Len); Last : Natural := Name_Len; begin Name_Loop : loop -- Find the beginning of the next source path name while Start <= Last and then Line (Start) = ' ' loop Start := Start + 1; end loop; exit Line_Loop when Start > Last; -- Go to next line when there is a continuation -- character \ at the end of the line. exit Name_Loop when Start = Last and then Line (Start) = '\'; -- We should not be at the end of the line, without -- a continuation character \. if Start = Last then if Opt.Verbosity_Level > Opt.Low then Put (" -> dependency file "); Put (Dep_Name); Put_Line (" has wrong format"); end if; Close (Dep_File); return True; end if; -- Look for the end of the source path name Finish := Start; while Finish < Last loop if Line (Finish) = '\' then -- On Windows, a '\' is part of the path -- name, except when it is not the first -- character followed by another '\' or by a -- space. On other platforms, when we are -- getting a '\' that is not the last -- character of the line, the next character -- is part of the path name, even if it is a -- space. if On_Windows and then Finish = Start and then Line (Finish + 1) = '\' then Finish := Finish + 2; elsif On_Windows and then Line (Finish + 1) /= '\' and then Line (Finish + 1) /= ' ' then Finish := Finish + 1; else Line (Finish .. Last - 1) := Line (Finish + 1 .. Last); Last := Last - 1; end if; else -- A space that is not preceded by '\' -- indicates the end of the path name. exit when Line (Finish + 1) = ' '; Finish := Finish + 1; end if; end loop; if Last_Source /= null and then Is_Time_Stamp (Line (Start .. Finish)) then -- If we have a time stamp, check if it is the -- same as the source time stamp. declare Tstring : constant String (1 .. Time_Stamp_Length) := Line (Start .. Finish); TS : constant Time_Stamp_Type := Time_Stamp_Type (Tstring); OK : constant Boolean := Last_TS = TS; begin if not OK and then Opt.Verbosity_Level > Opt.Low then Put (" -> source "); Put (Last_Source.all); Put_Line (" has modified time stamp"); end if; Free (Last_Source); if not OK then Close (Dep_File); return True; end if; end; else -- Check this source declare Src_Name : constant String := Normalize_Pathname (Name => Line (Start .. Finish), Directory => Obj_Dir, Resolve_Links => False); C_Src_Name : String := Src_Name; Src_TS : Time_Stamp_Type; Source_2 : GPR.Source_Id; begin Canonical_Case_File_Name (C_Src_Name); -- If it is original source, set -- Source_In_Dependencies. if C_Src_Name = C_Source_Path then Source_In_Dependencies := True; end if; -- Get the time stamp of the source, which is -- not necessarily a source of any project. Name_Len := 0; Add_Str_To_Name_Buffer (Src_Name); Src_TS := File_Stamp (Path_Name_Type'(Name_Find)); -- If the source does not exist, we need to -- recompile. if Src_TS = Empty_Time_Stamp then if Opt.Verbosity_Level > Opt.Low then Put (" -> source "); Put (Src_Name); Put_Line (" does not exist"); end if; Close (Dep_File); return True; -- If the source has been modified after the -- object file, we need to recompile. elsif Object_Check and then Source.Language.Config.Object_Generated and then Src_TS > Source.Object_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> source "); Put (Src_Name); Put_Line (" more recent than object file"); end if; Close (Dep_File); return True; else Name_Len := Src_Name'Length; Name_Buffer (1 .. Name_Len) := Src_Name; Source_2 := Source_Paths_Htable.Get (Tree.Source_Paths_HT, Name_Find); if Source_2 /= No_Source and then Source_2.Replaced_By /= No_Source then if Opt.Verbosity_Level > Opt.Low then Put (" -> source "); Put (Src_Name); Put_Line (" has been replaced"); end if; Close (Dep_File); return True; else Last_Source := new String'(Src_Name); Last_TS := Src_TS; end if; end if; end; end if; -- If the source path name ends the line, we are -- done. exit Line_Loop when Finish = Last; -- Go get the next source on the line Start := Finish + 1; end loop Name_Loop; end; -- If we are here, we had a continuation character \ at -- the end of the line, so we continue with the next -- line. Get_Line (Dep_File, Name_Buffer, Name_Len); Start := 1; Finish := 1; end loop Line_Loop; end if; -- Set Looping at the end of the first loop Looping := True; end loop Big_Loop; Close (Dep_File); -- If the original sources were not in the dependency file, then -- we need to recompile. It may mean that we are using a different -- source (different variant) for this object file. if not Source_In_Dependencies then if Opt.Verbosity_Level > Opt.Low then Put (" -> source "); Put (Source_Path); Put_Line (" is not in the dependencies"); end if; return True; end if; return False; end Process_Makefile_Deps; ---------------------- -- Process_ALI_Deps -- ---------------------- function Process_ALI_Deps return Boolean is Text : Text_Buffer_Ptr := Read_Library_Info_From_Full (File_Name_Type (Source.Dep_Path), Source.Dep_TS'Access); Sfile : File_Name_Type; Dep_Src : GPR.Source_Id; Proj : Project_Id; Found : Boolean := False; begin if Text = null then if Opt.Verbosity_Level > Opt.Low then Put (" -> cannot read "); Put_Line (Get_Name_String (Source.Dep_Path)); end if; return True; end if; -- Read only the necessary lines of the ALI file The_ALI := ALI.Scan_ALI (File_Name_Type (Source.Dep_Path), Text, Ignore_ED => False, Err => True, Read_Lines => "PDW"); Free (Text); if The_ALI = ALI.No_ALI_Id then if Opt.Verbosity_Level > Opt.Low then Put (" -> "); Put (Get_Name_String (Source.Dep_Path)); Put_Line (" is incorrectly formatted"); end if; return True; end if; if ALI.ALIs.Table (The_ALI).Compile_Errors then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> last compilation had errors"); end if; return True; end if; if Object_Check and then ALI.ALIs.Table (The_ALI).No_Object then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> no object generated during last compilation"); end if; return True; end if; if Check_Source_Info_In_ALI (The_ALI, Tree) = No_Name then return True; end if; -- We need to check that the ALI file is in the correct object -- directory. If it is in the object directory of a project -- that is extended and it depends on a source that is in one -- of its extending projects, then the ALI file is not in the -- correct object directory. ALI_Project := Source.Object_Project; -- Count the extending projects Num_Ext := 0; Proj := ALI_Project; loop Proj := Proj.Extended_By; exit when Proj = No_Project; Num_Ext := Num_Ext + 1; end loop; declare Projects : array (1 .. Num_Ext) of Project_Id; begin Proj := ALI_Project; for J in Projects'Range loop Proj := Proj.Extended_By; Projects (J) := Proj; end loop; for D in ALI.ALIs.Table (The_ALI).First_Sdep .. ALI.ALIs.Table (The_ALI).Last_Sdep loop Sfile := ALI.Sdep.Table (D).Sfile; if ALI.Sdep.Table (D).Stamp /= Empty_Time_Stamp then Dep_Src := Source_Files_Htable.Get (Tree.Source_Files_HT, Sfile); Found := False; if Dep_Src = No_Source and then ALI.Sdep.Table (D).Checksum = 0 then -- Probably preprocessing dependencies. Look for the -- file in the object directory. declare Path : Path_Name_Type; File : constant String := Get_Name_String (Sfile); Stamp : Time_Stamp_Type; begin if Is_Absolute_Path (File) then Path := Path_Name_Type (Sfile); else Name_Len := 0; Add_Str_To_Name_Buffer (Source_Dir_Of (Source)); Add_Char_To_Name_Buffer (Directory_Separator); Add_Str_To_Name_Buffer (File); Path := Name_Find; end if; Stamp := File_Stamp (Path); if Stamp /= ALI.Sdep.Table (D).Stamp then if Opt.Verbosity_Level > Opt.Low then if Stamp = Empty_Time_Stamp then Put (" -> """); Put (Get_Name_String (Sfile)); Put_Line (""" missing"); else Put (" -> different time stamp for "); Put_Line (Get_Name_String (Path)); if Debug.Debug_Flag_T then Put (" in ALI file: "); Put_Line (String (ALI.Sdep.Table (D).Stamp)); Put (" actual file: "); Put_Line (String (Stamp)); end if; end if; end if; return True; end if; end; else if Dep_Src = No_Source and then not Is_Ada_Predefined_File_Name (Sfile) then if Opt.Verbosity_Level > Opt.Low then Put (" -> """); Put (Get_Name_String (Sfile)); Put_Line (""" missing"); end if; return True; end if; while Dep_Src /= No_Source loop Initialize_Source_Record (Dep_Src); if not Dep_Src.Locally_Removed and then Dep_Src.Unit /= No_Unit_Index then Found := True; if Opt.Minimal_Recompilation and then ALI.Sdep.Table (D).Stamp /= Dep_Src.Source_TS then -- If minimal recompilation is in action, -- replace the stamp of the source file in -- the table if checksums match. declare Source_Index : Source_File_Index; use Scans; begin Source_Index := Sinput.Load_File (Get_Name_String (Dep_Src.Path.Display_Name)); if Source_Index /= No_Source_File then Err.Scanner.Initialize_Scanner (Source_Index, Err.Scanner.Ada); -- Scan the complete file to compute its -- checksum. loop Err.Scanner.Scan; exit when Token = Tok_EOF; end loop; if Scans.Checksum = ALI.Sdep.Table (D).Checksum then if Opt.Verbosity_Level > Opt.Low then Put (" "); Put (Get_Name_String (ALI.Sdep.Table (D).Sfile)); Put (": up to date, " & "different timestamps " & "but same checksum"); New_Line; end if; ALI.Sdep.Table (D).Stamp := Dep_Src.Source_TS; end if; end if; -- To avoid using too much memory, free the -- memory allocated. Sinput.Clear_Source_File_Table; end; end if; if ALI.Sdep.Table (D).Stamp /= Dep_Src.Source_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> different time stamp for "); Put_Line (Get_Name_String (Sfile)); if Debug.Debug_Flag_T then Put (" in ALI file: "); Put_Line (String (ALI.Sdep.Table (D).Stamp)); Put (" actual file: "); Put_Line (String (Dep_Src.Source_TS)); end if; end if; return True; else for J in Projects'Range loop if Dep_Src.Project = Projects (J) then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> wrong object directory"); end if; return True; end if; end loop; exit; end if; end if; Dep_Src := Dep_Src.Next_With_File_Name; end loop; -- If the source was not found and the runtime source -- directory is defined, check if the file exists there, -- and if it does, check its timestamp. if not Found and then (Runtime_Source_Dirs /= No_Name_List or else Is_Absolute_Path (Get_Name_String (Sfile))) then if Is_Absolute_Path (Get_Name_String (Sfile)) then if Check_Time_Stamps (Get_Name_String (Sfile), ALI.Sdep.Table (D).Stamp) then return True; end if; else declare R_Dirs : Name_List_Index := Runtime_Source_Dirs; begin while R_Dirs /= No_Name_List loop declare Nam_Nod : constant Name_Node := Tree.Shared.Name_Lists.Table (R_Dirs); begin if Check_Time_Stamps (Get_Name_String (Nam_Nod.Name) & Directory_Separator & Get_Name_String (Sfile), ALI.Sdep.Table (D).Stamp) then return True; end if; R_Dirs := Nam_Nod.Next; end; end loop; end; end if; end if; end if; end if; end loop; end; return False; end Process_ALI_Deps; package Processed_Sources is new GNAT.Table (Table_Component_Type => GPR.Source_Id, Table_Index_Type => Positive, Table_Low_Bound => 1, Table_Initial => 10, Table_Increment => 100); ------------------------------ -- Process_ALI_Closure_Deps -- ------------------------------ function Process_ALI_Closure_Deps return Boolean is Attr : aliased File_Attributes := Unknown_Attributes; Text : Text_Buffer_Ptr := Read_Library_Info_From_Full (File_Name_Type (Source.Dep_Path), Attr'Access); Sfile : File_Name_Type; Dep_Src : GPR.Source_Id; Proj : Project_Id; TS0 : Time_Stamp_Type; Found : Boolean := False; Last_Processed_Source : Natural := 0; Next_Source : GPR.Source_Id; Insert_Source : Boolean := False; Other_ALI : ALI.ALI_Id; begin if Text = null then if Opt.Verbosity_Level > Opt.Low then Put (" -> cannot read "); Put_Line (Get_Name_String (Source.Dep_Path)); end if; return True; end if; TS0 := File_Stamp (Source.Dep_Path); -- Read only the necessary lines of the ALI file The_ALI := ALI.Scan_ALI (File_Name_Type (Source.Dep_Path), Text, Ignore_ED => False, Err => True, Read_Lines => "PDW"); Free (Text); if The_ALI = ALI.No_ALI_Id then if Opt.Verbosity_Level > Opt.Low then Put (" -> "); Put (Get_Name_String (Source.Dep_Path)); Put_Line (" is incorrectly formatted"); end if; return True; end if; if ALI.ALIs.Table (The_ALI).Compile_Errors then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> last compilation had errors"); end if; return True; end if; if Object_Check and then ALI.ALIs.Table (The_ALI).No_Object then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> no object generated during last compilation"); end if; return True; end if; if Check_Source_Info_In_ALI (The_ALI, Tree) = No_Name then return True; end if; Processed_Sources.Init; Processed_Sources.Append (Source); Last_Processed_Source := 2; -- We need to check that the ALI file is in the correct object -- directory. If it is in the object directory of a project -- that is extended and it depends on a source that is in one -- of its extending projects, then the ALI file is not in the -- correct object directory. ALI_Project := Source.Object_Project; -- Count the extending projects Num_Ext := 0; Proj := ALI_Project; loop Proj := Proj.Extended_By; exit when Proj = No_Project; Num_Ext := Num_Ext + 1; end loop; declare Projects : array (1 .. Num_Ext) of Project_Id; begin Proj := ALI_Project; for J in Projects'Range loop Proj := Proj.Extended_By; Projects (J) := Proj; end loop; for D in ALI.ALIs.Table (The_ALI).First_Sdep .. ALI.ALIs.Table (The_ALI).Last_Sdep loop Sfile := ALI.Sdep.Table (D).Sfile; if ALI.Sdep.Table (D).Stamp /= Empty_Time_Stamp then Dep_Src := Source_Files_Htable.Get (Tree.Source_Files_HT, Sfile); Found := False; if Dep_Src /= No_Source then Insert_Source := True; for J in 1 .. Processed_Sources.Last loop if Processed_Sources.Table (J) = Dep_Src then Insert_Source := False; exit; end if; end loop; if Insert_Source then Processed_Sources.Append (Dep_Src); end if; end if; while Dep_Src /= No_Source loop Initialize_Source_Record (Dep_Src); if not Dep_Src.Locally_Removed and then Dep_Src.Unit /= No_Unit_Index then Found := True; if Opt.Minimal_Recompilation and then ALI.Sdep.Table (D).Stamp /= Dep_Src.Source_TS then -- If minimal recompilation is in action, replace -- the stamp of the source file in the table if -- checksums match. declare Source_Index : Source_File_Index; use Scans; begin Source_Index := Sinput.Load_File (Get_Name_String (Dep_Src.Path.Display_Name)); if Source_Index /= No_Source_File then Err.Scanner.Initialize_Scanner (Source_Index, Err.Scanner.Ada); -- Scan the complete file to compute its -- checksum. loop Err.Scanner.Scan; exit when Token = Tok_EOF; end loop; if Scans.Checksum = ALI.Sdep.Table (D).Checksum then if Opt.Verbosity_Level > Opt.Low then Put (" "); Put (Get_Name_String (ALI.Sdep.Table (D).Sfile)); Put (": up to date, " & "different timestamps " & "but same checksum"); New_Line; end if; ALI.Sdep.Table (D).Stamp := Dep_Src.Source_TS; end if; end if; -- To avoid using too much memory, free the -- memory allocated. Sinput.Clear_Source_File_Table; end; end if; if ALI.Sdep.Table (D).Stamp /= Dep_Src.Source_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> different time stamp for "); Put_Line (Get_Name_String (Sfile)); if Debug.Debug_Flag_T then Put (" in ALI file: "); Put_Line (String (ALI.Sdep.Table (D).Stamp)); Put (" actual file: "); Put_Line (String (Dep_Src.Source_TS)); end if; end if; return True; else for J in Projects'Range loop if Dep_Src.Project = Projects (J) then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> wrong object directory"); end if; return True; end if; end loop; exit; end if; end if; Dep_Src := Dep_Src.Next_With_File_Name; end loop; -- If the source was not found and the runtime source -- directory is defined, check if the file exists there, and -- if it does, check its timestamp. if not Found and then Runtime_Source_Dirs /= No_Name_List then declare R_Dirs : Name_List_Index := Runtime_Source_Dirs; begin while R_Dirs /= No_Name_List loop declare Nam_Nod : constant Name_Node := Tree.Shared.Name_Lists.Table (R_Dirs); begin if Check_Time_Stamps (Get_Name_String (Nam_Nod.Name) & Directory_Separator & Get_Name_String (Sfile), ALI.Sdep.Table (D).Stamp) then return True; end if; R_Dirs := Nam_Nod.Next; end; end loop; end; end if; end if; end loop; end; while Last_Processed_Source <= Processed_Sources.Last loop Next_Source := Processed_Sources.Table (Last_Processed_Source); if not Next_Source.Project.Externally_Built and then (Next_Source.Unit = No_Unit_Index or else Next_Source.Kind /= Sep) then declare Attrib : aliased File_Attributes := Unknown_Attributes; begin Text := Read_Library_Info_From_Full (File_Name_Type (Next_Source.Dep_Path), Attrib'Access); end; if Text = null then if Opt.Verbosity_Level > Opt.Low then Put (" -> cannot read "); Put_Line (Get_Name_String (Next_Source.Dep_Path)); end if; return True; end if; -- Read only the necessary lines of the ALI file Other_ALI := ALI.Scan_ALI (File_Name_Type (Next_Source.Dep_Path), Text, Ignore_ED => False, Err => True, Read_Lines => "PDW"); Free (Text); if Other_ALI = ALI.No_ALI_Id then if Opt.Verbosity_Level > Opt.Low then Put (" -> "); Put (Get_Name_String (Next_Source.Dep_Path)); Put_Line (" is incorrectly formatted"); end if; return True; end if; if ALI.ALIs.Table (Other_ALI).Compile_Errors then if Opt.Verbosity_Level > Opt.Low then Put (" -> last compilation of "); Put (Get_Name_String (Next_Source.Dep_Path)); Put_Line (" had errors"); end if; return True; end if; for D in ALI.ALIs.Table (Other_ALI).First_Sdep .. ALI.ALIs.Table (Other_ALI).Last_Sdep loop Sfile := ALI.Sdep.Table (D).Sfile; if ALI.Sdep.Table (D).Stamp /= Empty_Time_Stamp then Dep_Src := Source_Files_Htable.Get (Tree.Source_Files_HT, Sfile); Found := False; if Dep_Src /= No_Source then Insert_Source := True; for J in 1 .. Processed_Sources.Last loop if Processed_Sources.Table (J) = Dep_Src then Insert_Source := False; exit; end if; end loop; if Insert_Source then Processed_Sources.Append (Dep_Src); end if; end if; while Dep_Src /= No_Source loop Initialize_Source_Record (Dep_Src); if not Dep_Src.Locally_Removed and then Dep_Src.Unit /= No_Unit_Index then Found := True; if Opt.Minimal_Recompilation and then ALI.Sdep.Table (D).Stamp /= Dep_Src.Source_TS then -- If minimal recompilation is in action, -- replace the stamp of the source file in -- the table if checksums match. declare Source_Index : Source_File_Index; use Scans; begin Source_Index := Sinput.Load_File (Get_Name_String (Dep_Src.Path.Display_Name)); if Source_Index /= No_Source_File then Err.Scanner.Initialize_Scanner (Source_Index, Err.Scanner.Ada); -- Scan the complete file to compute its -- checksum. loop Err.Scanner.Scan; exit when Token = Tok_EOF; end loop; if Scans.Checksum = ALI.Sdep.Table (D).Checksum then ALI.Sdep.Table (D).Stamp := Dep_Src.Source_TS; end if; end if; -- To avoid using too much memory, free the -- memory allocated. Sinput.Clear_Source_File_Table; end; end if; if ALI.Sdep.Table (D).Stamp /= Dep_Src.Source_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> different time stamp for "); Put_Line (Get_Name_String (Sfile)); if Debug.Debug_Flag_T then Put (" in ALI file: "); Put_Line (String (ALI.Sdep.Table (D).Stamp)); Put (" actual file: "); Put_Line (String (Dep_Src.Source_TS)); end if; end if; return True; -- Favor comparison against object file if possible -- since object file may have been created later -- than ALI file. elsif Object_Check and then Source.Language.Config.Object_Generated then if Dep_Src.Source_TS > Source.Object_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> file "); Put (Get_Name_String (Dep_Src.Path.Display_Name)); Put_Line (" more recent than object file"); end if; return True; end if; elsif Dep_Src.Source_TS > TS0 then if Opt.Verbosity_Level > Opt.Low then Put (" -> file "); Put (Get_Name_String (Dep_Src.Path.Display_Name)); Put_Line (" more recent than ALI file"); end if; return True; end if; end if; Dep_Src := Dep_Src.Next_With_File_Name; end loop; end if; end loop; end if; Last_Processed_Source := Last_Processed_Source + 1; end loop; return False; end Process_ALI_Closure_Deps; ------------- -- Cleanup -- ------------- procedure Cleanup is begin Free (C_Object_Name); Free (Object_Path); Free (Switches_Name); end Cleanup; begin The_ALI := ALI.No_ALI_Id; -- Never attempt to compile header files if Source.Language.Config.Kind = File_Based and then Source.Kind = Spec then Must_Compile := False; return; end if; if Force_Compilations then Must_Compile := Always_Compile or else (not Externally_Built); return; end if; -- No need to compile if there is no "compiler" if Length_Of_Name (Source.Language.Config.Compiler_Driver) = 0 then Must_Compile := False; return; end if; if Source.Language.Config.Object_Generated and then Object_Check then C_Object_Name := new String'(Get_Name_String (Source.Object)); Canonical_Case_File_Name (C_Object_Name.all); Object_Path := new String'(Get_Name_String (Source.Object_Path)); if Source.Switches_Path /= No_Path then Switches_Name := new String'(Get_Name_String (Source.Switches_Path)); end if; end if; if Opt.Verbosity_Level > Opt.Low then Put (" Checking "); Put (Source_Path); if Source.Index /= 0 then Put (" at"); Put (Source.Index'Img); end if; Put_Line (" ... "); end if; -- No need to compile if project is externally built if Externally_Built then if Opt.Verbosity_Level > Opt.Low then Put_Line (" project is externally built"); end if; Must_Compile := False; Cleanup; return; end if; if not Source.Language.Config.Object_Generated then -- If no object file is generated, the "compiler" need to be invoked -- if there is no dependency file. if Source.Language.Config.Dependency_Kind = None then if Opt.Verbosity_Level > Opt.Low then Put_Line (" -> no object file generated"); end if; Must_Compile := True; Cleanup; return; end if; elsif Object_Check then -- If object file does not exist, of course source need to be -- compiled. if Source.Object_TS = Empty_Time_Stamp then if Opt.Verbosity_Level > Opt.Low then Put (" -> object file "); Put (Object_Path.all); Put_Line (" does not exist"); end if; Must_Compile := True; Cleanup; return; end if; -- If the object file has been created before the last modification -- of the source, the source need to be recompiled. if (not Opt.Minimal_Recompilation) and then Source.Object_TS < Source.Source_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> object file "); Put (Object_Path.all); Put_Line (" has time stamp earlier than source"); end if; Must_Compile := True; Cleanup; return; end if; if Opt.Verbosity_Level > Opt.Low and then Debug.Debug_Flag_T then Put (" object file "); Put (Object_Path.all); Put (": "); Put_Line (String (Source.Object_TS)); Put (" source file: "); Put_Line (String (Source.Source_TS)); end if; end if; if Source.Language.Config.Dependency_Kind /= None then -- If there is no dependency file, then the source needs to be -- recompiled and the dependency file need to be created. Stamp := File_Time_Stamp (Source.Dep_Path, Source.Dep_TS'Access); if Stamp = Empty_Time_Stamp then if Opt.Verbosity_Level > Opt.Low then Put (" -> dependency file "); Put (Get_Name_String (Source.Dep_Path)); Put_Line (" does not exist"); end if; Must_Compile := True; Cleanup; return; end if; -- If the ALI file has been created after the object file, we need -- to recompile. if Object_Check and then (Source.Language.Config.Dependency_Kind = ALI_File or else Source.Language.Config.Dependency_Kind = ALI_Closure) and then Source.Object_TS < Stamp then if Opt.Verbosity_Level > Opt.Low then Put (" -> ALI file "); Put (Get_Name_String (Source.Dep_Path)); Put_Line (" has timestamp earlier than object file"); end if; Must_Compile := True; Cleanup; return; end if; -- The source needs to be recompiled if the source has been modified -- after the dependency file has been created. if not Opt.Minimal_Recompilation and then Stamp < Source.Source_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> dependency file "); Put (Get_Name_String (Source.Dep_Path)); Put_Line (" has time stamp earlier than source"); end if; Must_Compile := True; Cleanup; return; end if; end if; -- If we are checking the switches and there is no switches file, then -- the source needs to be recompiled and the switches file need to be -- created. if Check_Switches and then Switches_Name /= null then if Source.Switches_TS = Empty_Time_Stamp then if Opt.Verbosity_Level > Opt.Low then Put (" -> switches file "); Put (Switches_Name.all); Put_Line (" does not exist"); end if; Must_Compile := True; Cleanup; return; end if; -- The source needs to be recompiled if the source has been modified -- after the switches file has been created. if not Opt.Minimal_Recompilation and then Source.Switches_TS < Source.Source_TS then if Opt.Verbosity_Level > Opt.Low then Put (" -> switches file "); Put (Switches_Name.all); Put_Line (" has time stamp earlier than source"); end if; Must_Compile := True; Cleanup; return; end if; end if; case Source.Language.Config.Dependency_Kind is when None => null; when Makefile => if Process_Makefile_Deps (Get_Name_String (Source.Dep_Path), Get_Name_String (Source.Project.Object_Directory.Display_Name)) then Must_Compile := True; Cleanup; return; end if; when ALI_File => if Process_ALI_Deps then Must_Compile := True; Cleanup; return; end if; when ALI_Closure => if Process_ALI_Closure_Deps then Must_Compile := True; Cleanup; return; end if; end case; -- If we are here, then everything is OK, and we don't need -- to recompile. if (not Object_Check) and then Opt.Verbosity_Level > Opt.Low then Put_Line (" -> up to date"); end if; Must_Compile := False; Cleanup; end Need_To_Compile; --------------------------- -- Set_Default_Verbosity -- --------------------------- procedure Set_Default_Verbosity is Gpr_Verbosity : String_Access := Getenv ("GPR_VERBOSITY"); begin if Gpr_Verbosity /= null and then Gpr_Verbosity'Length > 0 then declare Verbosity : String := Gpr_Verbosity.all; begin To_Lower (Verbosity); if Verbosity = "quiet" then Quiet_Output := True; Verbose_Mode := False; Verbosity_Level := Opt.None; elsif Verbosity = "default" then Quiet_Output := False; Verbose_Mode := False; Verbosity_Level := Opt.None; elsif Verbosity = "verbose" or else Verbosity = "verbose_low" then Quiet_Output := False; Verbose_Mode := True; Verbosity_Level := Opt.Low; elsif Verbosity = "verbose_medium" then Quiet_Output := False; Verbose_Mode := True; Verbosity_Level := Opt.Medium; elsif Verbosity = "verbose_high" then Quiet_Output := False; Verbose_Mode := True; Verbosity_Level := Opt.High; end if; end; end if; Free (Gpr_Verbosity); end Set_Default_Verbosity; --------------- -- Knowledge -- --------------- package body Knowledge is separate; -------------- -- UTC_Time -- -------------- function UTC_Time return Time_Stamp_Type is Now : constant Time := Clock - Duration (UTC_Time_Offset) * 60; -- The UTC_Time_Offset is in minutes begin return Time_Stamp_Type (Image (Now, "%Y%m%d%H%M%S")); end UTC_Time; ---------------- -- Check_Diff -- ---------------- function Check_Diff (Ts1, Ts2 : Time_Stamp_Type; Max_Drift : Duration := 5.0) return Boolean is use GNAT.Calendar; function Get (T : String) return Time is (Time_Of (Year => Year_Number'Value (T (T'First .. T'First + 3)), Month => Month_Number'Value (T (T'First + 4 .. T'First + 5)), Day => Day_Number'Value (T (T'First + 6 .. T'First + 7)), Hour => Hour_Number'Value (T (T'First + 8 .. T'First + 9)), Minute => Minute_Number'Value (T (T'First + 10 .. T'First + 11)), Second => Second_Number'Value (T (T'First + 12 .. T'First + 13)))); T1 : constant Time := Get (String (Ts1)); T2 : constant Time := Get (String (Ts2)); begin return abs (T1 - T2) <= Max_Drift; end Check_Diff; ------------------- -- To_Time_Stamp -- ------------------- function To_Time_Stamp (Time : Calendar.Time) return Stamps.Time_Stamp_Type is begin return Time_Stamp_Type (Image (Time, "%Y%m%d%H%M%S")); end To_Time_Stamp; package body Project_Output is ---------------- -- Write_Char -- ---------------- procedure Write_A_Char (C : Character) is begin Write_A_String ((1 => C)); end Write_A_Char; --------------- -- Write_Eol -- --------------- procedure Write_Eol is begin Write_A_String ((1 => ASCII.LF)); end Write_Eol; -------------------- -- Write_A_String -- -------------------- procedure Write_A_String (S : String) is Str : String (1 .. S'Length); begin if S'Length > 0 then Str := S; if Write (Output_FD, Str (1)'Address, Str'Length) /= Str'Length then GPR.Com.Fail ("disk full"); end if; end if; end Write_A_String; end Project_Output; end Gpr_Util;
zhmu/ananas
Ada
6,257
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 1 1 9 -- -- -- -- 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_119 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_119; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_Cluster_Ref is access Rev_Cluster; ------------ -- Get_119 -- ------------ function Get_119 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_119 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_119; ------------ -- Set_119 -- ------------ procedure Set_119 (Arr : System.Address; N : Natural; E : Bits_119; 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_119; end System.Pack_119;
reznikmm/matreshka
Ada
6,861
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.Dde_Links_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Dde_Links_Element_Node is begin return Self : Table_Dde_Links_Element_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Table_Dde_Links_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_Table_Dde_Links (ODF.DOM.Table_Dde_Links_Elements.ODF_Table_Dde_Links_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 Table_Dde_Links_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Dde_Links_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Table_Dde_Links_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_Table_Dde_Links (ODF.DOM.Table_Dde_Links_Elements.ODF_Table_Dde_Links_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 Table_Dde_Links_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_Table_Dde_Links (Visitor, ODF.DOM.Table_Dde_Links_Elements.ODF_Table_Dde_Links_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.Table_URI, Matreshka.ODF_String_Constants.Dde_Links_Element, Table_Dde_Links_Element_Node'Tag); end Matreshka.ODF_Table.Dde_Links_Elements;
reznikmm/matreshka
Ada
3,765
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. ------------------------------------------------------------------------------ with AMF.Internals.Generic_Element_Table; with AMF.Internals.Tables.MOFEXT_Types; package AMF.Internals.Tables.MOFEXT_Element_Table is new AMF.Internals.Generic_Element_Table (AMF.Internals.Tables.MOFEXT_Types.Element_Record); pragma Preelaborate (AMF.Internals.Tables.MOFEXT_Element_Table);
zhmu/ananas
Ada
288
adb
-- { dg-do compile } procedure Self_Ref1 is type Integer_Ptr is access all Integer; Ptr : constant Integer_Ptr := Integer_Ptr (Ptr); -- { dg-error "object \"Ptr\" cannot be used before end of its declaration" } begin if Ptr /= null then null; end if; end Self_Ref1;
mirror/ncurses
Ada
11,042
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1999-2011,2014 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: -- $Revision: 1.29 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; with Ada.Unchecked_Deallocation; with System.Address_To_Access_Conversions; -- | -- |===================================================================== -- | man page form_fieldtype.3x -- |===================================================================== -- | package body Terminal_Interface.Curses.Forms.Field_Types is use type System.Address; package Argument_Conversions is new System.Address_To_Access_Conversions (Argument); function Get_Fieldtype (F : Field) return C_Field_Type; pragma Import (C, Get_Fieldtype, "field_type"); function Get_Arg (F : Field) return System.Address; pragma Import (C, Get_Arg, "field_arg"); -- | -- |===================================================================== -- | man page form_field_validation.3x -- |===================================================================== -- | -- | -- | function Get_Type (Fld : Field) return Field_Type_Access is Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); Arg : Argument_Access; begin if Low_Level = Null_Field_Type then return null; else if Low_Level = M_Builtin_Router or else Low_Level = M_Generic_Type or else Low_Level = M_Choice_Router or else Low_Level = M_Generic_Choice then Arg := Argument_Access (Argument_Conversions.To_Pointer (Get_Arg (Fld))); if Arg = null then raise Form_Exception; else return Arg.all.Typ; end if; else raise Form_Exception; end if; end if; end Get_Type; function Copy_Arg (Usr : System.Address) return System.Address is begin return Usr; end Copy_Arg; procedure Free_Arg (Usr : System.Address) is procedure Free_Type is new Ada.Unchecked_Deallocation (Field_Type'Class, Field_Type_Access); procedure Freeargs is new Ada.Unchecked_Deallocation (Argument, Argument_Access); To_Be_Free : Argument_Access := Argument_Access (Argument_Conversions.To_Pointer (Usr)); Low_Level : C_Field_Type; begin if To_Be_Free /= null then if To_Be_Free.all.Usr /= System.Null_Address then Low_Level := To_Be_Free.all.Cft; if Low_Level.all.Freearg /= null then Low_Level.all.Freearg (To_Be_Free.all.Usr); end if; end if; if To_Be_Free.all.Typ /= null then Free_Type (To_Be_Free.all.Typ); end if; Freeargs (To_Be_Free); end if; end Free_Arg; procedure Wrap_Builtin (Fld : Field; Typ : Field_Type'Class; Cft : C_Field_Type := C_Builtin_Router) is Usr_Arg : constant System.Address := Get_Arg (Fld); Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); Arg : Argument_Access; function Set_Fld_Type (F : Field := Fld; Cf : C_Field_Type := Cft; Arg1 : Argument_Access) return Eti_Error; pragma Import (C, Set_Fld_Type, "set_field_type_user"); begin pragma Assert (Low_Level /= Null_Field_Type); if Cft /= C_Builtin_Router and then Cft /= C_Choice_Router then raise Form_Exception; else Arg := new Argument'(Usr => System.Null_Address, Typ => new Field_Type'Class'(Typ), Cft => Get_Fieldtype (Fld)); if Usr_Arg /= System.Null_Address then if Low_Level.all.Copyarg /= null then Arg.all.Usr := Low_Level.all.Copyarg (Usr_Arg); else Arg.all.Usr := Usr_Arg; end if; end if; Eti_Exception (Set_Fld_Type (Arg1 => Arg)); end if; end Wrap_Builtin; function Field_Check_Router (Fld : Field; Usr : System.Address) return Curses_Bool is Arg : constant Argument_Access := Argument_Access (Argument_Conversions.To_Pointer (Usr)); begin pragma Assert (Arg /= null and then Arg.all.Cft /= Null_Field_Type and then Arg.all.Typ /= null); if Arg.all.Cft.all.Fcheck /= null then return Arg.all.Cft.all.Fcheck (Fld, Arg.all.Usr); else return 1; end if; end Field_Check_Router; function Char_Check_Router (Ch : C_Int; Usr : System.Address) return Curses_Bool is Arg : constant Argument_Access := Argument_Access (Argument_Conversions.To_Pointer (Usr)); begin pragma Assert (Arg /= null and then Arg.all.Cft /= Null_Field_Type and then Arg.all.Typ /= null); if Arg.all.Cft.all.Ccheck /= null then return Arg.all.Cft.all.Ccheck (Ch, Arg.all.Usr); else return 1; end if; end Char_Check_Router; function Next_Router (Fld : Field; Usr : System.Address) return Curses_Bool is Arg : constant Argument_Access := Argument_Access (Argument_Conversions.To_Pointer (Usr)); begin pragma Assert (Arg /= null and then Arg.all.Cft /= Null_Field_Type and then Arg.all.Typ /= null); if Arg.all.Cft.all.Next /= null then return Arg.all.Cft.all.Next (Fld, Arg.all.Usr); else return 1; end if; end Next_Router; function Prev_Router (Fld : Field; Usr : System.Address) return Curses_Bool is Arg : constant Argument_Access := Argument_Access (Argument_Conversions.To_Pointer (Usr)); begin pragma Assert (Arg /= null and then Arg.all.Cft /= Null_Field_Type and then Arg.all.Typ /= null); if Arg.all.Cft.all.Prev /= null then return Arg.all.Cft.all.Prev (Fld, Arg.all.Usr); else return 1; end if; end Prev_Router; -- ----------------------------------------------------------------------- -- function C_Builtin_Router return C_Field_Type is T : C_Field_Type; begin if M_Builtin_Router = Null_Field_Type then T := New_Fieldtype (Field_Check_Router'Access, Char_Check_Router'Access); if T = Null_Field_Type then raise Form_Exception; else Eti_Exception (Set_Fieldtype_Arg (T, Make_Arg'Access, Copy_Arg'Access, Free_Arg'Access)); end if; M_Builtin_Router := T; end if; pragma Assert (M_Builtin_Router /= Null_Field_Type); return M_Builtin_Router; end C_Builtin_Router; -- ----------------------------------------------------------------------- -- function C_Choice_Router return C_Field_Type is T : C_Field_Type; begin if M_Choice_Router = Null_Field_Type then T := New_Fieldtype (Field_Check_Router'Access, Char_Check_Router'Access); if T = Null_Field_Type then raise Form_Exception; else Eti_Exception (Set_Fieldtype_Arg (T, Make_Arg'Access, Copy_Arg'Access, Free_Arg'Access)); Eti_Exception (Set_Fieldtype_Choice (T, Next_Router'Access, Prev_Router'Access)); end if; M_Choice_Router := T; end if; pragma Assert (M_Choice_Router /= Null_Field_Type); return M_Choice_Router; end C_Choice_Router; end Terminal_Interface.Curses.Forms.Field_Types;
AdaCore/training_material
Ada
5,612
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with SDL_stdinc_h; package SDL_cpuinfo_h is SDL_CACHELINE_SIZE : constant := 128; -- ..\SDL2_tmp\SDL_cpuinfo.h:95 -- Simple DirectMedia Layer -- Copyright (C) 1997-2018 Sam Lantinga <[email protected]> -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. -- --* -- * \file SDL_cpuinfo.h -- * -- * CPU feature detection for SDL. -- -- Need to do this here because intrin.h has C++ code in it -- Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h -- Many of the intrinsics SDL uses are not implemented by clang with Visual Studio -- Set up for C function definitions, even when using C++ -- This is a guess for the cacheline size used for padding. -- * Most x86 processors have a 64 byte cache line. -- * The 64-bit PowerPC processors have a 128 byte cache line. -- * We'll use the larger value to be generally safe. -- --* -- * This function returns the number of CPU cores available. -- function SDL_GetCPUCount return int; -- ..\SDL2_tmp\SDL_cpuinfo.h:100 pragma Import (C, SDL_GetCPUCount, "SDL_GetCPUCount"); --* -- * This function returns the L1 cache line size of the CPU -- * -- * This is useful for determining multi-threaded structure padding -- * or SIMD prefetch sizes. -- function SDL_GetCPUCacheLineSize return int; -- ..\SDL2_tmp\SDL_cpuinfo.h:108 pragma Import (C, SDL_GetCPUCacheLineSize, "SDL_GetCPUCacheLineSize"); --* -- * This function returns true if the CPU has the RDTSC instruction. -- function SDL_HasRDTSC return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:113 pragma Import (C, SDL_HasRDTSC, "SDL_HasRDTSC"); --* -- * This function returns true if the CPU has AltiVec features. -- function SDL_HasAltiVec return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:118 pragma Import (C, SDL_HasAltiVec, "SDL_HasAltiVec"); --* -- * This function returns true if the CPU has MMX features. -- function SDL_HasMMX return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:123 pragma Import (C, SDL_HasMMX, "SDL_HasMMX"); --* -- * This function returns true if the CPU has 3DNow! features. -- function SDL_Has3DNow return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:128 pragma Import (C, SDL_Has3DNow, "SDL_Has3DNow"); --* -- * This function returns true if the CPU has SSE features. -- function SDL_HasSSE return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:133 pragma Import (C, SDL_HasSSE, "SDL_HasSSE"); --* -- * This function returns true if the CPU has SSE2 features. -- function SDL_HasSSE2 return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:138 pragma Import (C, SDL_HasSSE2, "SDL_HasSSE2"); --* -- * This function returns true if the CPU has SSE3 features. -- function SDL_HasSSE3 return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:143 pragma Import (C, SDL_HasSSE3, "SDL_HasSSE3"); --* -- * This function returns true if the CPU has SSE4.1 features. -- function SDL_HasSSE41 return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:148 pragma Import (C, SDL_HasSSE41, "SDL_HasSSE41"); --* -- * This function returns true if the CPU has SSE4.2 features. -- function SDL_HasSSE42 return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:153 pragma Import (C, SDL_HasSSE42, "SDL_HasSSE42"); --* -- * This function returns true if the CPU has AVX features. -- function SDL_HasAVX return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:158 pragma Import (C, SDL_HasAVX, "SDL_HasAVX"); --* -- * This function returns true if the CPU has AVX2 features. -- function SDL_HasAVX2 return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:163 pragma Import (C, SDL_HasAVX2, "SDL_HasAVX2"); --* -- * This function returns true if the CPU has AVX-512F (foundation) features. -- function SDL_HasAVX512F return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:168 pragma Import (C, SDL_HasAVX512F, "SDL_HasAVX512F"); --* -- * This function returns true if the CPU has NEON (ARM SIMD) features. -- function SDL_HasNEON return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_cpuinfo.h:173 pragma Import (C, SDL_HasNEON, "SDL_HasNEON"); --* -- * This function returns the amount of RAM configured in the system, in MB. -- function SDL_GetSystemRAM return int; -- ..\SDL2_tmp\SDL_cpuinfo.h:178 pragma Import (C, SDL_GetSystemRAM, "SDL_GetSystemRAM"); -- Ends C function definitions when using C++ -- vi: set ts=4 sw=4 expandtab: end SDL_cpuinfo_h;
onox/orka
Ada
15,849
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Numerics.Generic_Elementary_Functions; with AUnit.Assertions; with AUnit.Test_Caller; with AUnit.Test_Fixtures; package body Generic_Test_Transforms_Matrices is use Orka; use Matrices; use type Matrices.Element_Type; use AUnit.Assertions; use type Vector4; package EF is new Ada.Numerics.Generic_Elementary_Functions (Element_Type); function To_Radians (Angle : Element_Type) return Element_Type renames Vectors.To_Radians; function Is_Equivalent (Expected, Result : Element_Type) return Boolean is (abs (Result - Expected) <= 2.0 * Element_Type'Model_Epsilon); procedure Assert_Equivalent (Expected, Result : Vector4; Column : Index_4D) is begin for Row in Index_4D loop Assert (Is_Equivalent (Expected (Row), Result (Row)), "Unexpected element " & Expected (Row)'Image & " instead of " & Result (Row)'Image & " at (" & Column'Image & ", " & Row'Image & ")"); end loop; end Assert_Equivalent; type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_T (Object : in out Test) is Offset : constant Vector4 := (2.0, 3.0, 4.0, 1.0); Expected : constant Matrix4 := ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), Offset); Result : constant Matrix4 := T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_T; procedure Test_Rx (Object : in out Test) is Angle : constant Element_Type := 60.0; CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((1.0, 0.0, 0.0, 0.0), (0.0, CA, SA, 0.0), (0.0, -SA, CA, 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := Rx (To_Radians (Angle)); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rx; procedure Test_Ry (Object : in out Test) is Angle : constant Element_Type := 60.0; CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((CA, 0.0, -SA, 0.0), (0.0, 1.0, 0.0, 0.0), (SA, 0.0, CA, 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := Ry (To_Radians (Angle)); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Ry; procedure Test_Rz (Object : in out Test) is Angle : constant Element_Type := 60.0; CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((CA, SA, 0.0, 0.0), (-SA, CA, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := Rz (To_Radians (Angle)); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rz; procedure Test_R (Object : in out Test) is Angle : constant Element_Type := 90.0; Expected : constant Matrix4 := Rz (To_Radians (Angle)) * Ry (To_Radians (Angle)) * Rx (To_Radians (Angle)); Result : constant Matrix4 := R ((0.0, 1.0, 0.0, 1.0), To_Radians (Angle)); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_R; procedure Test_S (Object : in out Test) is Factors : constant Vector4 := (2.0, 3.0, 4.0, 1.0); Expected : constant Matrix4 := ((Factors (X), 0.0, 0.0, 0.0), (0.0, Factors (Y), 0.0, 0.0), (0.0, 0.0, Factors (Z), 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := S (Factors); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_S; procedure Test_Add_Offset (Object : in out Test) is -- W of sum must be 1.0 Offset_A : constant Vector4 := (2.0, 3.0, 4.0, 1.0); Offset_B : constant Vector4 := (-5.0, 3.0, 6.0, 0.0); Expected : constant Matrix4 := ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), Vectors."+" (Offset_A, Offset_B)); Result : constant Matrix4 := Offset_A + (Offset_B + Identity_Matrix); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Add_Offset; procedure Test_Multiply_Factor (Object : in out Test) is Factor_A : constant Element_Type := 2.0; Factor_B : constant Element_Type := 2.0; Total : constant Element_Type := Factor_A * Factor_B; Expected : constant Matrix4 := ((Total, 0.0, 0.0, 0.0), (0.0, Total, 0.0, 0.0), (0.0, 0.0, Total, 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := Factor_A * (Factor_B * Identity_Matrix); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Multiply_Factor; procedure Test_Rotate_At_Origin (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vector4 := (2.0, 3.0, 4.0, 1.0); Expected : constant Matrix4 := Rz (To_Radians (Angle)) * Ry (To_Radians (Angle)) * Rx (To_Radians (Angle)) * T (Offset); Result : constant Matrix4 := R ((0.0, 1.0, 0.0, 1.0), To_Radians (Angle)) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_At_Origin; procedure Test_Rotate (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vectors.Point := (2.0, 3.0, 4.0, 1.0); Expected : Matrix4 := Rz (To_Radians (Angle)) * Ry (To_Radians (Angle)) * Rx (To_Radians (Angle)); Result : constant Matrix4 := R ((0.0, 1.0, 0.0, 1.0), To_Radians (Angle), Offset) * T (Offset); begin Expected (W) := Vector4 (Offset); for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate; procedure Test_Rotate_X_At_Origin (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vector4 := (2.0, 3.0, 4.0, 1.0); CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((1.0, 0.0, 0.0, 0.0), (0.0, CA, SA, 0.0), (0.0, -SA, CA, 0.0), (2.0, -4.0, 3.0, 1.0)); Result : constant Matrix4 := Rx (To_Radians (Angle)) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_X_At_Origin; procedure Test_Rotate_Y_At_Origin (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vector4 := (2.0, 3.0, 4.0, 1.0); CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((CA, 0.0, -SA, 0.0), (0.0, 1.0, 0.0, 0.0), (SA, 0.0, CA, 0.0), (4.0, 3.0, -2.0, 1.0)); Result : constant Matrix4 := Ry (To_Radians (Angle)) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_Y_At_Origin; procedure Test_Rotate_Z_At_Origin (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vector4 := (2.0, 3.0, 4.0, 1.0); CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((CA, SA, 0.0, 0.0), (-SA, CA, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (-3.0, 2.0, 4.0, 1.0)); Result : constant Matrix4 := Rz (To_Radians (Angle)) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_Z_At_Origin; procedure Test_Rotate_X (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vectors.Point := (2.0, 3.0, 4.0, 1.0); CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((1.0, 0.0, 0.0, 0.0), (0.0, CA, SA, 0.0), (0.0, -SA, CA, 0.0), Vector4 (Offset)); Result : constant Matrix4 := Rx (To_Radians (Angle), Offset) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_X; procedure Test_Rotate_Y (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vectors.Point := (2.0, 3.0, 4.0, 1.0); CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((CA, 0.0, -SA, 0.0), (0.0, 1.0, 0.0, 0.0), (SA, 0.0, CA, 0.0), Vector4 (Offset)); Result : constant Matrix4 := Ry (To_Radians (Angle), Offset) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_Y; procedure Test_Rotate_Z (Object : in out Test) is Angle : constant Element_Type := 90.0; Offset : constant Vectors.Point := (2.0, 3.0, 4.0, 1.0); CA : constant Element_Type := EF.Cos (Angle, 360.0); SA : constant Element_Type := EF.Sin (Angle, 360.0); Expected : constant Matrix4 := ((CA, SA, 0.0, 0.0), (-SA, CA, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), Vector4 (Offset)); Result : constant Matrix4 := Rz (To_Radians (Angle), Offset) * T (Offset); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Rotate_Z; procedure Test_Translate (Object : in out Test) is Offset : constant Vector4 := (2.0, 3.0, 4.0, 1.0); Expected : constant Matrix4 := ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), Offset); Result : constant Matrix4 := Offset + Identity_Matrix; begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Translate; procedure Test_Scale_Factors (Object : in out Test) is Factors : constant Vector4 := (2.0, 3.0, 4.0, 0.0); Expected : constant Matrix4 := ((Factors (X), 0.0, 0.0, 0.0), (0.0, Factors (Y), 0.0, 0.0), (0.0, 0.0, Factors (Z), 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := S (Factors) * Identity_Matrix; begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Scale_Factors; procedure Test_Scale_Factor (Object : in out Test) is Factor : constant Element_Type := 2.0; Expected : constant Matrix4 := ((Factor, 0.0, 0.0, 0.0), (0.0, Factor, 0.0, 0.0), (0.0, 0.0, Factor, 0.0), (0.0, 0.0, 0.0, 1.0)); Result : constant Matrix4 := Factor * Identity_Matrix; begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Scale_Factor; procedure Test_Transpose (Object : in out Test) is Value : constant Matrix4 := ((1.0, 11.0, 14.0, 16.0), (5.0, 2.0, 12.0, 15.0), (8.0, 6.0, 3.0, 13.0), (10.0, 9.0, 7.0, 4.0)); Expected : constant Matrix4 := ((1.0, 5.0, 8.0, 10.0), (11.0, 2.0, 6.0, 9.0), (14.0, 12.0, 3.0, 7.0), (16.0, 15.0, 13.0, 4.0)); Result : constant Matrix4 := Transpose (Value); begin for I in Index_4D loop Assert_Equivalent (Expected (I), Result (I), I); end loop; end Test_Transpose; ---------------------------------------------------------------------------- package Caller is new AUnit.Test_Caller (Test); Test_Suite : aliased AUnit.Test_Suites.Test_Suite; function Suite return AUnit.Test_Suites.Access_Test_Suite is Name : constant String := "(Transforms - " & Suite_Name & " - Matrices) "; begin Test_Suite.Add_Test (Caller.Create (Name & "Test T function", Test_T'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rx function", Test_Rx'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Ry function", Test_Ry'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rz function", Test_Rz'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test R function", Test_R'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test S function", Test_S'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test '+' operator (translate)", Test_Add_Offset'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test '*' operator (scale)", Test_Multiply_Factor'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_At_Origin procedure", Test_Rotate_At_Origin'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate procedure", Test_Rotate'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_X_At_Origin procedure", Test_Rotate_X_At_Origin'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_Y_At_Origin procedure", Test_Rotate_Y_At_Origin'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_Z_At_Origin procedure", Test_Rotate_Z_At_Origin'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_X procedure", Test_Rotate_X'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_Y procedure", Test_Rotate_Y'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Rotate_Z procedure", Test_Rotate_Z'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Translate procedure", Test_Translate'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Scale_Factors procedure", Test_Scale_Factors'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Scale_Factor procedure", Test_Scale_Factor'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Transpose function", Test_Transpose'Access)); return Test_Suite'Access; end Suite; end Generic_Test_Transforms_Matrices;
charlie5/cBound
Ada
1,666
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_list_properties_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; atoms_len : aliased Interfaces.Unsigned_16; pad1 : aliased swig.int8_t_Array (0 .. 21); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_list_properties_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_properties_reply_t.Item, Element_Array => xcb.xcb_list_properties_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_list_properties_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_properties_reply_t.Pointer, Element_Array => xcb.xcb_list_properties_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_list_properties_reply_t;
AdaCore/Ada_Drivers_Library
Ada
5,938
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body STM32F4_DMA_Interrupts is protected body Handler is ----------------- -- Await_Event -- ----------------- entry Await_Event (Occurrence : out DMA_Interrupt) when Event_Occurred is begin Occurrence := Event_Kind; Event_Occurred := False; end Await_Event; ----------------- -- IRQ_Handler -- ----------------- procedure IRQ_Handler is begin if Status (Controller.all, Stream, Transfer_Error_Indicated) then if Interrupt_Enabled (Controller.all, Stream, Transfer_Error_Interrupt) then Disable_Interrupt (Controller.all, Stream, Transfer_Error_Interrupt); Clear_Status (Controller.all, Stream, Transfer_Error_Indicated); Event_Kind := Transfer_Error_Interrupt; Event_Occurred := True; end if; end if; if Status (Controller.all, Stream, FIFO_Error_Indicated) then if Interrupt_Enabled (Controller.all, Stream, FIFO_Error_Interrupt) then Disable_Interrupt (Controller.all, Stream, FIFO_Error_Interrupt); Clear_Status (Controller.all, Stream, FIFO_Error_Indicated); Event_Kind := FIFO_Error_Interrupt; Event_Occurred := True; end if; end if; if Status (Controller.all, Stream, Direct_Mode_Error_Indicated) then if Interrupt_Enabled (Controller.all, Stream, Direct_Mode_Error_Interrupt) then Disable_Interrupt (Controller.all, Stream, Direct_Mode_Error_Interrupt); Clear_Status (Controller.all, Stream, Direct_Mode_Error_Indicated); Event_Kind := Direct_Mode_Error_Interrupt; Event_Occurred := True; end if; end if; if Status (Controller.all, Stream, Half_Transfer_Complete_Indicated) then if Interrupt_Enabled (Controller.all, Stream, Half_Transfer_Complete_Interrupt) then if Double_Buffered (Controller.all, Stream) then Clear_Status (Controller.all, Stream, Half_Transfer_Complete_Indicated); else -- not double buffered if not Circular_Mode (Controller.all, Stream) then Disable_Interrupt (Controller.all, Stream, Half_Transfer_Complete_Interrupt); end if; Clear_Status (Controller.all, Stream, Half_Transfer_Complete_Indicated); end if; Event_Kind := Half_Transfer_Complete_Interrupt; Event_Occurred := True; end if; end if; if Status (Controller.all, Stream, Transfer_Complete_Indicated) then if Interrupt_Enabled (Controller.all, Stream, Transfer_Complete_Interrupt) then if Double_Buffered (Controller.all, Stream) then Clear_Status (Controller.all, Stream, Transfer_Complete_Indicated); -- TODO: handle the difference between M0 and M1 callbacks else if not Circular_Mode (Controller.all, Stream) then Disable_Interrupt (Controller.all, Stream, Transfer_Complete_Interrupt); end if; Clear_Status (Controller.all, Stream, Transfer_Complete_Indicated); end if; Event_Kind := Transfer_Complete_Interrupt; Event_Occurred := True; end if; end if; end IRQ_Handler; end Handler; end STM32F4_DMA_Interrupts;
reznikmm/matreshka
Ada
3,916
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.ODF_Attributes.Style.Print_Orientation; package ODF.DOM.Attributes.Style.Print_Orientation.Internals is function Create (Node : Matreshka.ODF_Attributes.Style.Print_Orientation.Style_Print_Orientation_Access) return ODF.DOM.Attributes.Style.Print_Orientation.ODF_Style_Print_Orientation; function Wrap (Node : Matreshka.ODF_Attributes.Style.Print_Orientation.Style_Print_Orientation_Access) return ODF.DOM.Attributes.Style.Print_Orientation.ODF_Style_Print_Orientation; end ODF.DOM.Attributes.Style.Print_Orientation.Internals;
ctdempsey/programming-language-inception
Ada
676
adb
with Ada.Text_IO; use Ada.Text_IO; with GNAT.OS_Lib; use GNAT.OS_Lib; procedure AdaLang is Result : Boolean; Arguments : Argument_List := ( 1=> new String'("erl"), 2=> new String'("-noshell"), 3=> new String'("-run"), 4=> new String'("erlanglang"), 5=> new String'("-run"), 6=> new String'("init"), 7=> new String'("stop") ); begin Put_Line ("Hello from Ada!"); Spawn ( Program_Name => "/usr/bin/erl", Args => Arguments, Success => Result ); Put_Line ("Goodbye from Ada!"); end AdaLang;
zhmu/ananas
Ada
7,944
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (VxWorks 6.x ARM RTP) -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- 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. -- -- -- -- In particular, you can freely distribute your programs built with the -- -- GNAT Pro compiler, including any required library run-time units, using -- -- any licensing terms of your choosing. See the AdaCore Software License -- -- for full details. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the VxWorks version of this package for RTPs package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). pragma No_Elaboration_Code_All; -- Allow the use of that restriction in units that WITH this unit type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1); Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1; Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := Standard'Max_Integer_Size - 1; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 1.0 / 60.0; -- Storage-related Declarations type Address is private; pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; Word_Size : constant := 32; Memory_Size : constant := 2 ** 32; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := Low_Order_First; pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) -- Ada priorities are mapped to VxWorks priorities using the following -- transformation: 255 - Ada Priority -- Ada priorities are used as follows: -- 256 is reserved for the VxWorks kernel -- 248 - 255 correspond to hardware interrupt levels 0 .. 7 -- 247 is a catchall default "interrupt" priority for signals, -- allowing higher priority than normal tasks, but lower than -- hardware priority levels. Protected Object ceilings can -- override these values. -- 246 is used by the Interrupt_Manager task Max_Priority : constant Positive := 245; Max_Interrupt_Priority : constant Positive := 255; subtype Any_Priority is Integer range 0 .. 255; subtype Priority is Any_Priority range 0 .. 245; subtype Interrupt_Priority is Any_Priority range 246 .. 255; Default_Priority : constant Priority := 122; private pragma Linker_Options ("--specs=vxworks-arm-link.spec"); -- Setup proper set of -L's for this configuration type Address is mod Memory_Size; Null_Address : constant Address := 0; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used -- by the compiler. They are in the private part of System, where they -- can be accessed using the special circuitry in the Targparm unit -- whose source should be consulted for more detailed descriptions -- of the individual switch values. Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := False; Exit_Status_Supported : constant Boolean := True; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; Frontend_Exceptions : constant Boolean := False; ZCX_By_Default : constant Boolean := True; Executable_Extension : constant String := ".vxe"; end System;
reznikmm/matreshka
Ada
4,583
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.Edition_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Edition_Attribute_Node is begin return Self : Text_Edition_Attribute_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Text_Edition_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Edition_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Edition_Attribute, Text_Edition_Attribute_Node'Tag); end Matreshka.ODF_Text.Edition_Attributes;
reznikmm/matreshka
Ada
3,734
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.Constants; package body Matreshka.ODF_Attributes.FO is ----------------------- -- Get_Namespace_URI -- ----------------------- overriding function Get_Namespace_URI (Self : not null access constant FO_Node_Base) return League.Strings.Universal_String is begin return ODF.Constants.FO_URI; end Get_Namespace_URI; end Matreshka.ODF_Attributes.FO;
Rodeo-McCabe/orka
Ada
1,630
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 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.Real_Time; with Orka.Jobs; with Orka.Resources.Locations; package Orka.Resources.Loaders is type Resource_Data is record Bytes : Byte_Array_Pointers.Pointer; Reading_Time : Ada.Real_Time.Time_Span; Start_Time : Ada.Real_Time.Time; Path : SU.Unbounded_String; end record; subtype Extension_String is String with Dynamic_Predicate => Extension_String'Length <= 4; type Loader is limited interface; function Extension (Object : Loader) return Extension_String is abstract; -- Return the extension of files that the loader can load procedure Load (Object : Loader; Data : Resource_Data; Enqueue : not null access procedure (Element : Jobs.Job_Ptr); Location : Locations.Location_Ptr) is abstract; -- Load the given resource data type Loader_Access is access Loader'Class; subtype Loader_Ptr is not null Loader_Access; end Orka.Resources.Loaders;
procrastiraptor/euler
Ada
651
adb
with Ada.Text_IO; with String_Int; procedure Euler13 is Num_Addends: constant Positive := 100; Addend_Size: constant Positive := 50; use type String_Int.Number; Result: String_Int.Number(1 .. Addend_Size + Num_Addends) := (others => '0'); Len: Positive := Addend_Size; begin for I in Positive range 1 .. Num_Addends loop declare Sum: constant String_Int.Number := Result(1 .. Len) + String_Int.From_String(Ada.Text_IO.Get_Line); begin Len := Sum'Length; Result(1 .. Len) := Sum; end; end loop; Ada.Text_IO.Put_Line(String_Int.To_String(Result(1 .. 10))); end Euler13;
ficorax/PortAudioAda
Ada
7,716
adb
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO; with Ada.Text_IO; use Ada.Text_IO; with System; with PortAudioAda; use PortAudioAda; procedure PA_Devices is procedure Print_Supported_Standard_Sample_Rates (inputParameters : access PA_Stream_Parameters; outputParameters : access PA_Stream_Parameters); procedure Print_Supported_Standard_Sample_Rates (inputParameters : access PA_Stream_Parameters; outputParameters : access PA_Stream_Parameters) is standardSampleRates : constant array (Natural range <>) of Long_Float := (8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0, 44100.0, 48000.0, 88200.0, 96000.0, 192000.0 ); printCount : Integer; err : PA_Error; begin printCount := 0; for i in standardSampleRates'Range loop err := PA_Is_Format_Supported (inputParameters, outputParameters, standardSampleRates (i)); if err = paFormatIsSupported then if printCount = 0 then Put (ASCII.HT); Put (standardSampleRates (i), 8, 2, 0); printCount := 1; elsif printCount = 4 then Put (","); New_Line; Put (ASCII.HT); Put (standardSampleRates (i), 8, 2, 0); printCount := 1; else Put (", "); Put (standardSampleRates (i), 8, 2, 0); printCount := printCount + 1; end if; end if; end loop; if printCount = 0 then Put_Line ("None"); else New_Line; end if; end Print_Supported_Standard_Sample_Rates; err : PA_Error; numHostApi : PA_Host_Api_Index; numDevices : PA_Device_Index; begin err := PA_Initialize; New_Line; if err /= paNoError then Put_Line ("ERROR: PA_Initialize returned " & err'Image); raise PortAudio_Exception; end if; Put_Line ("PortAudio version: " & PA_Get_Version); numHostApi := PA_Get_Host_API_Count; if numHostApi < 0 then Put_Line ("ERROR: Get_API_Count returned " & numHostApi'Image); raise PortAudio_Exception; end if; Put_Line ("Number of Host API:" & numHostApi'Image); numDevices := PA_Get_Device_Count; if numDevices < 0 then Put_Line ("ERROR: Get_Device_Count returned " & numDevices'Image); raise PortAudio_Exception; end if; Put_Line ("Number of devices:" & numDevices'Image); for i in 0 .. numDevices - 1 loop declare deviceInfo : constant PA_Device_Info := PA_Get_Device_Info (i); defaultDisplayed : Boolean := False; inputParameters, outputParameters : aliased PA_Stream_Parameters; begin Put_Line ("--------------------------------------- device #" & i'Image); -- Mark global and API specific default devices if i = PA_Get_Default_Input_Device then Put ("[ Default Input"); defaultDisplayed := True; elsif i = PA_Get_Host_Api_Info (deviceInfo.hostApi).defaultInputDevice then declare hostInfo : constant PA_Host_Api_Info := PA_Get_Host_Api_Info (deviceInfo.hostApi); begin Put ("[ Default " & hostInfo.name & " Input"); defaultDisplayed := True; end; end if; if i = PA_Get_Default_Output_Device then Put ((if defaultDisplayed then "," else "[")); Put (" Default Output"); defaultDisplayed := True; elsif i = PA_Get_Host_Api_Info (deviceInfo.hostApi).defaultOutputDevice then declare hostInfo : constant PA_Host_Api_Info := PA_Get_Host_Api_Info (deviceInfo.hostApi); begin Put ((if defaultDisplayed then "," else "[")); Put (" Default " & hostInfo.name & " Output"); defaultDisplayed := True; end; end if; if defaultDisplayed then Put_Line (" ]"); end if; -- print device info fields Put_Line ("Name = " & deviceInfo.name); Put_Line ("Host API = " & PA_Get_Host_Api_Info (deviceInfo.hostApi).name); Put ("Max inputs = " & deviceInfo.maxInputChannels'Image); Put_Line (", Max outputs = " & deviceInfo.maxOutputChannels'Image); Put ("Default low input latency = "); Put (Long_Float (deviceInfo.defaultLowInputLatency), 8, 4, 0); New_Line; Put ("Default low output latency = "); Put (Long_Float (deviceInfo.defaultLowOutputLatency), 8, 4, 0); New_Line; Put ("Default high input latency = "); Put (Long_Float (deviceInfo.defaultHighInputLatency), 8, 4, 0); New_Line; Put ("Default high output latency = "); Put (Long_Float (deviceInfo.defaultHighOutputLatency), 8, 4, 0); New_Line; Put ("Default sample rate = "); Put (Long_Float (deviceInfo.defaultSampleRate), 8, 2, 0); New_Line; -- poll for standard sample rates inputParameters.device := i; inputParameters.channelCount := deviceInfo.maxInputChannels; inputParameters.sampleFormat := paInt16; inputParameters.suggestedLatency := 0.0; inputParameters.hostApiSpecificStreamInfo := System.Null_Address; outputParameters.device := i; outputParameters.channelCount := deviceInfo.maxOutputChannels; outputParameters.sampleFormat := paInt16; outputParameters.suggestedLatency := 0.0; outputParameters.hostApiSpecificStreamInfo := System.Null_Address; if inputParameters.channelCount > 0 then Put_Line ("Supported standard sample rates"); Put (" for half-duplex 16 bit "); Put (inputParameters.channelCount, 0); Put_Line (" channel input = "); Print_Supported_Standard_Sample_Rates (inputParameters'Unchecked_Access, null); end if; if outputParameters.channelCount > 0 then Put_Line ("Supported standard sample rates"); Put (" for half-duplex 16 bit "); Put (outputParameters.channelCount, 0); Put_Line (" channel output = "); Print_Supported_Standard_Sample_Rates (null, outputParameters'Unchecked_Access); end if; if inputParameters.channelCount > 0 and then outputParameters.channelCount > 0 then Put_Line ("Supported standard sample rates"); Put (" for full-duplex 16 bit "); Put (inputParameters.channelCount, 0); Put (" channel input, "); Put (outputParameters.channelCount, 0); Put_Line (" channel output = "); Print_Supported_Standard_Sample_Rates (inputParameters'Unchecked_Access, outputParameters'Unchecked_Access); end if; end; end loop; err := PA_Terminate; exception when PortAudio_Exception => err := PA_Terminate; Put_Line ("Error number: " & err'Image); Put_Line ("Error message: " & PA_Get_Error_Text (err)); end PA_Devices;
reznikmm/matreshka
Ada
4,075
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Objects.Impl; with AWF.HTML_Writers; with AWF.Layouts; package AWF.Internals.AWF_Layouts is type AWF_Layout_Proxy is new League.Objects.Impl.Object_Impl and AWF.Layouts.AWF_Layout with private; type AWF_Layout_Proxy_Access is access all AWF_Layout_Proxy'Class; not overriding procedure Render_Body (Self : not null access AWF_Layout_Proxy; Context : in out AWF.HTML_Writers.HTML_Writer'Class); package Constructors is procedure Initialize (Self : not null access AWF_Layout_Proxy'Class); end Constructors; private type AWF_Layout_Proxy is new League.Objects.Impl.Object_Impl and AWF.Layouts.AWF_Layout with null record; end AWF.Internals.AWF_Layouts;
reznikmm/matreshka
Ada
3,705
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- Several children packages provides interfaces for several kinds of -- SAX events handlers. Each handler subprogram can raise any exception to -- report error and stop future processing of document. Every handler's -- interface also has Error_String function which must return description of -- the error. package XML.SAX is pragma Pure; end XML.SAX;
AdaCore/libadalang
Ada
81
ads
with A; package D is pragma Test (A.Foo); pragma Test (A.B.C.Foo); end D;
ekoeppen/MSP430_Generic_Ada_Drivers
Ada
2,134
adb
with Interfaces; use Interfaces; package body Drivers.Text_IO is procedure Put (C : Character) is begin USART.Transmit (Character'Pos (C)); end Put; procedure Put (S : String) is begin for C of S loop Put (C); end loop; end Put; procedure Put_Line (S : String) is begin Put (S); New_Line; end Put_Line; procedure New_Line is begin USART.Transmit (10); end New_Line; procedure Put_Integer (N : Integer; Width : Natural := 0) is Buffer : array (Unsigned_8 range 0 .. 15) of Character; I : Unsigned_8 := Buffer'Last; V : Integer := N; begin if N /= 0 then if V < 0 then Put ('-'); V := -V; end if; while V > 0 loop Buffer (I) := Character'Val (Unsigned_8 (V mod 10) + Character'Pos ('0')); V := V / 10; I := I - 1; end loop; for J in Unsigned_8 range I + 1 .. 15 loop USART.Transmit (Character'Pos (Buffer (J))); end loop; else Put ('0'); end if; end Put_Integer; procedure Put_Hex (N : Unsigned_32; Width : Natural := 0) is Buffer : array (Unsigned_8 range 0 .. 15) of Character; I : Unsigned_8 := 15; Nibble : Unsigned_8; V : Unsigned_32 := N; begin while V > 0 or else I = 15 loop Nibble := Unsigned_8 (V mod 16); if Nibble < 10 then Nibble := Nibble + Character'Pos ('0'); else Nibble := Nibble - 10 + Character'Pos ('a'); end if; Buffer (I) := Character'Val (Nibble); V := V / 16; I := I - 1; end loop; for J in Unsigned_8 range I + 1 .. 15 loop USART.Transmit (Character'Pos (Buffer (J))); end loop; end Put_Hex; procedure Get_Line (S : out String; Count : out Natural) is C : Character; begin Count := 0; for I in S'range loop C := Character'Val (USART.Receive); exit when C = Character'Val (10); S (I) := C; Count := Count + 1; end loop; end Get_Line; end Drivers.Text_IO;
AdaCore/gpr
Ada
955
adb
with p7_3; use p7_3; package body p7_2 is function p7_2_0 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p7_3_0 (Item - 1)) + 720; return Integer (Result rem Long_Long_Integer (Integer'Last)); end p7_2_0; function p7_2_1 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p7_3_1 (Item - 1)) + 721; return Integer (Result rem Long_Long_Integer (Integer'Last)); end p7_2_1; function p7_2_2 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p7_3_2 (Item - 1)) + 722; return Integer (Result rem Long_Long_Integer (Integer'Last)); end p7_2_2; end p7_2;
houey/Amass
Ada
1,014
ads
-- Copyright 2017-2021 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 = "HackerTarget" type = "api" function start() setratelimit(1) end function vertical(ctx, domain) scrape(ctx, {url=buildurl(domain)}) end function buildurl(domain) return "http://api.hackertarget.com/hostsearch/?q=" .. domain end function asn(ctx, addr, asn) if addr == "" then return end local aurl = asnurl(addr) local resp, err = request(ctx, {url=aurl}) if (err ~= nil and err ~= "") then return end local j = json.decode("{\"results\": [" .. resp .. "]}") if (j == nil or #(j.results) < 4) then return end newasn(ctx, { ['addr']=addr, asn=tonumber(j.results[2]), prefix=j.results[3], desc=j.results[4], }) end function asnurl(addr) return "https://api.hackertarget.com/aslookup/?q=" .. addr end
muharihar/Amass
Ada
538
ads
-- Copyright 2017-2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "BufferOver" type = "api" function start() set_rate_limit(1) end function vertical(ctx, domain) scrape(ctx, {url=build_url(domain, "dns")}) -- The owner requested that this endpoint not be used for now -- scrape(ctx, {url=build_url(domain, "tls")}) end function build_url(domain, sub) return "https://" .. sub .. ".bufferover.run/dns?q=." .. domain end
Fabien-Chouteau/GESTE
Ada
3,197
ads
------------------------------------------------------------------------------ -- -- -- GESTE -- -- -- -- Copyright (C) 2018 Fabien Chouteau -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package GESTE.Tile_Bank is type Instance (Tiles : not null Tile_Array_Ref; Collisions : Tile_Collisions_Array_Ref; Palette : Palette_Ref) is tagged limited private; subtype Class is Instance'Class; type Ref is access all Class; type Const_Ref is access constant Class; private type Instance (Tiles : not null Tile_Array_Ref; Collisions : Tile_Collisions_Array_Ref; Palette : Palette_Ref) is tagged limited null record; end GESTE.Tile_Bank;
gitter-badger/libAnne
Ada
1,762
adb
with Numerics; use Numerics; package body Generics.Mathematics.Percents is function Add_Integer_Percent(Left : Integer_Type; Right : Percent_Type) return Integer_Type is begin return Left + Integer_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Add_Integer_Percent; function Subtract_Integer_Percent(Left : Integer_Type; Right : Percent_Type) return Integer_Type is begin return Left - Integer_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Subtract_Integer_Percent; function Add_Fixed_Percent(Left : Fixed_Type; Right : Percent_Type) return Fixed_Type is begin return Left + Fixed_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Add_Fixed_Percent; function Subtract_Fixed_Percent(Left : Fixed_Type; Right : Percent_Type) return Fixed_Type is begin return Left - Fixed_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Subtract_Fixed_Percent; function Add_Decimal_Percent(Left : Decimal_Type; Right : Percent_Type) return Decimal_Type is begin return Left + Decimal_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Add_Decimal_Percent; function Subtract_Decimal_Percent(Left : Decimal_Type; Right : Percent_Type) return Decimal_Type is begin return Left - Decimal_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Subtract_Decimal_Percent; function Add_Float_Percent(Left : Float_Type; Right : Percent_Type) return Float_Type is begin return Left + Float_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Add_Float_Percent; function Subtract_Float_Percent(Left : Float_Type; Right : Percent_Type) return Float_Type is begin return Left - Float_Type(Long_Fixed(Left) * Long_Fixed(Right / 100.0)); end Subtract_Float_Percent; end Generics.Mathematics.Percents;
annexi-strayline/AURA
Ada
5,312
adb
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Directories; with Registrar.Registration; separate (Configuration) procedure Step_4 (Target: in out Subsystem) is use Ada.Directories; SS_Root_Path: constant String := Current_Directory & '/' & Target.Name.To_UTF8_String; Search: Search_Type; Subdir: Directory_Entry_Type; begin -- Note that Codepaths will always be empty for the root configuration -- unit, since codepaths are explicitly disallowed. It seemed better form to -- let it come here anyways, rather than explicitly ending at Step_3 with a -- special case, since the outcome is identical, and performance impact very -- minimal. In fact, the root config is only explictly processed once, so -- having a check in step 3 would be less performant for Codepath of Target.Configuration.Codepaths loop declare Full_Path: constant String := SS_Root_Path & '/' & UBS.To_String (Codepath.Value); Subdir_Name: constant String := Simple_Name (Full_Path); begin Start_Search (Search => Search, Directory => Containing_Directory (Full_Path), Pattern => Subdir_Name, Filter => Filter_Type'(Directory => True, others => False)); Assert (Check => More_Entries (Search), Message => "Could not find codepath """ & UBS.To_String (Codepath.Value) & '"'); Get_Next_Entry (Search => Search, Directory_Entry => Subdir); Registrar.Registration.Enter_Directory (Directory => Subdir, AURA_Subsystem => Target); end; end loop; Complete (Target); end Step_4;
reznikmm/matreshka
Ada
4,107
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.Style_Wrap_Dynamic_Threshold_Attributes; package Matreshka.ODF_Style.Wrap_Dynamic_Threshold_Attributes is type Style_Wrap_Dynamic_Threshold_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Wrap_Dynamic_Threshold_Attributes.ODF_Style_Wrap_Dynamic_Threshold_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Wrap_Dynamic_Threshold_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Wrap_Dynamic_Threshold_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Wrap_Dynamic_Threshold_Attributes;
annexi-strayline/AURA
Ada
5,372
adb
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ separate (Registrar.Executive.Unit_Entry.Execute) package body Parse_Pack is Source: Source_Buffer (Source_Pack.Stream'Access); -- The parse buffer E: Lexical_Element; -- Last element parsed ------------- -- Content -- ------------- function Content return Wide_Wide_String is (WWU.To_Wide_Wide_String (E.Content)); -------------- -- Category -- -------------- function Category return Lexical_Category is (E.Category); ------------------ -- Next_Element -- ------------------ procedure Next_Element is begin loop -- Also skip comments E := Next_Element (Source); exit when Category /= Comment; end loop; end Next_Element; ----------------------- -- Skip_To_Semicolon -- ----------------------- procedure Skip_To_Semicolon is begin -- Keep going until we find a ';' delimiter loop Next_Element; exit when Category = Delimiter and then Content = ";"; end loop; end Skip_To_Semicolon; ----------------------- -- File_And_Position -- ----------------------- function File_And_Position return String is Pos: Source_Position := Last_Position (Source); begin return UBS.To_String (Order.File_Full_Name) & ':' & Positive'Image (Pos.Line) & ':' & Positive'Image (Pos.Column); end File_And_Position; ----------------- -- Abort_Parse -- ----------------- procedure Abort_Parse is begin raise Invalid_Unit with "Unexpected " & Lexical_Category'Image (E.Category) & " element " & '"' & Ada.Characters.Conversions.To_String (WWU.To_Wide_Wide_String (E.Content)) & '"' & " at " & File_And_Position; end Abort_Parse; end Parse_Pack;
reznikmm/matreshka
Ada
6,086
ads
------------------------------------------------------------------------------ -- -- -- 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 Ada.Containers.Hashed_Maps; with League.Strings.Hash; with Matreshka.XML_Schema.AST.Types; with XML.Schema; package Matreshka.XML_Schema.AST.Schemas is pragma Preelaborate; type Schema_Node is new Abstract_Node with record -- Properties: -- Annotations : Types.Annotation_Lists.List; -- {annotations} -- A sequence of Annotation components. Type_Definitions : Types.Type_Definition_Maps.Map; -- {type definitions} -- A set of Type Definition components. Attribute_Declarations : Types.Attribute_Declaration_Maps.Map; -- {attribute declarations} -- A set of Attribute Declaration components. Element_Declarations : Types.Element_Declaration_Maps.Map; -- {element declarations} -- A set of Element Declaration components. Attribute_Group_Definitions : Types.Attribute_Group_Maps.Map; -- {attribute group definitions} -- A set of Attribute Group Definition components. Model_Group_Definitions : Types.Model_Group_Definition_Maps.Map; -- {model group definitions} -- A set of Model Group Definition components. Notation_Declarations : Types.Notation_Declaration_Maps.Map; -- {notation declarations} -- A set of Notation Declaration components. Identity_Constraint_Definitions : Types.Identity_Constraint_Definition_Sets.List; -- {identity-constraint definitions} -- A set of Identity-Constraint Definition components. -- Internal data. Final_Default : XML.Schema.Derivation_Set; Target_Namespace : League.Strings.Universal_String; Target_Namespace_Defined : Boolean; end record; overriding procedure Enter_Node (Self : not null access Schema_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Node (Self : not null access Schema_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Node (Self : not null access Schema_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); -- Dispatch call to corresponding subprogram of iterator interface. end Matreshka.XML_Schema.AST.Schemas;
zhmu/ananas
Ada
7,945
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (VxWorks 6.x PPC RTP) -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- 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 VxWorks version of this package for RTPs package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). pragma No_Elaboration_Code_All; -- Allow the use of that restriction in units that WITH this unit type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1); Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1; Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := Standard'Max_Integer_Size - 1; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 1.0 / 60.0; -- Storage-related Declarations type Address is private; pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; Word_Size : constant := 32; Memory_Size : constant := 2 ** 32; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := High_Order_First; pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) -- Ada priorities are mapped to VxWorks priorities using the following -- transformation: 255 - Ada Priority -- Ada priorities are used as follows: -- 256 is reserved for the VxWorks kernel -- 248 - 255 correspond to hardware interrupt levels 0 .. 7 -- 247 is a catchall default "interrupt" priority for signals, -- allowing higher priority than normal tasks, but lower than -- hardware priority levels. Protected Object ceilings can -- override these values. -- 246 is used by the Interrupt_Manager task Max_Priority : constant Positive := 245; Max_Interrupt_Priority : constant Positive := 255; subtype Any_Priority is Integer range 0 .. 255; subtype Priority is Any_Priority range 0 .. 245; subtype Interrupt_Priority is Any_Priority range 246 .. 255; Default_Priority : constant Priority := 122; private pragma Linker_Options ("--specs=vxworks-ppc-link.spec"); -- Setup proper set of -L's for this configuration type Address is mod Memory_Size; Null_Address : constant Address := 0; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used -- by the compiler. They are in the private part of System, where they -- can be accessed using the special circuitry in the Targparm unit -- whose source should be consulted for more detailed descriptions -- of the individual switch values. Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := False; Exit_Status_Supported : constant Boolean := True; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; Frontend_Exceptions : constant Boolean := False; ZCX_By_Default : constant Boolean := True; Executable_Extension : constant String := ".vxe"; end System;
mfkiwl/ewok-kernel-security-OS
Ada
24
adb
../stm32f407/soc-rcc.adb
Fabien-Chouteau/coffee-clock
Ada
9,075
adb
------------------------------------------------------------------------------- -- -- -- Coffee Clock -- -- -- -- Copyright (C) 2016-2017 Fabien Chouteau -- -- -- -- Coffee Clock 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. -- -- -- -- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------- with STM32; use STM32; with STM32.DMA2D; use STM32.DMA2D; with STM32.DMA2D_Bitmap; with STM32.Board; use STM32.Board; with HAL.Bitmap; use HAL.Bitmap; with HAL; use HAL; with Giza.Image.DMA2D; package body LCD_Graphic_Backend is Initialized : Boolean := False; subtype Height is Integer range 0 .. 480 - 1; subtype Width is Integer range 0 .. 800 - 1; function Is_In_Screen (Pt : Point_T) return Boolean; function HAL_To_DMA2D (Mode : HAL.Bitmap.Bitmap_Color_Mode) return STM32.DMA2D.DMA2D_Color_Mode; ------------------ -- HAL_To_DMA2D -- ------------------ function HAL_To_DMA2D (Mode : HAL.Bitmap.Bitmap_Color_Mode) return STM32.DMA2D.DMA2D_Color_Mode is (case Mode is when ARGB_8888 => DMA2D.ARGB8888, when RGB_888 => DMA2D.RGB888, when RGB_565 => DMA2D.RGB565, when ARGB_1555 => DMA2D.ARGB1555, when ARGB_4444 => DMA2D.ARGB4444, when L_8 => DMA2D.L8, when AL_44 => DMA2D.AL44, when AL_88 => DMA2D.AL88, when L_4 => DMA2D.L4, when A_8 => DMA2D.A8, when A_4 => DMA2D.A4); ---------------- -- Initialize -- ---------------- procedure Initialize is begin if not Initialized then Initialized := True; -- Initialize LCD Display.Initialize; Display.Initialize_Layer (1, ARGB_8888); Display.Get_Hidden_Buffer (1).Fill ((Alpha => 255, others => 64)); Display.Update_Layer (1, Copy_Back => True); end if; end Initialize; ------------------ -- Is_In_Screen -- ------------------ function Is_In_Screen (Pt : Point_T) return Boolean is begin return Pt.X in Dim (Width'First) .. Dim (Width'Last) and then Pt.Y in Dim (Height'First) .. Dim (Height'Last); end Is_In_Screen; --------------- -- Set_Pixel -- --------------- overriding procedure Set_Pixel (This : in out Instance; Pt : Point_T) is begin if Is_In_Screen (Pt) then Display.Get_Hidden_Buffer (1).Set_Pixel (X => Pt.X, Y => Pt.Y, Value => This.RGB_Color); end if; end Set_Pixel; --------------- -- Set_Color -- --------------- overriding procedure Set_Color (This : in out Instance; C : Giza.Colors.Color) is begin This.RGB_Color := (255, Byte (C.R), Byte (C.G), Byte (C.B)); end Set_Color; ---------- -- Size -- ---------- overriding function Size (This : Instance) return Size_T is pragma Unreferenced (This); begin return (Dim (Width'Last), Dim (Height'Last)); end Size; ------------------------- -- Has_Double_Buffring -- ------------------------- overriding function Has_Double_Buffring (This : Instance) return Boolean is pragma Unreferenced (This); begin return True; end Has_Double_Buffring; ------------------ -- Swap_Buffers -- ------------------ overriding procedure Swap_Buffers (This : in out Instance) is pragma Unreferenced (This); begin Display.Update_Layer (1, Copy_Back => False); Display.Get_Hidden_Buffer (1).Fill ((Alpha => 255, others => 64)); end Swap_Buffers; --------------- -- Rectangle -- --------------- overriding procedure Rectangle (This : in out Instance; Start, Stop : Point_T) is X0 : constant Integer := Start.X; Y0 : constant Integer := Start.Y; X1 : constant Integer := Stop.X; Y1 : constant Integer := Stop.Y; begin if Is_In_Screen (Start) and then Is_In_Screen (Stop) then Display.Get_Hidden_Buffer (1).Draw_Rect (Color => This.RGB_Color, X => X0, Y => Y0, Width => X1 - X0 + 1, Height => Y1 - Y0 + 1); end if; end Rectangle; -------------------- -- Fill_Rectangle -- -------------------- overriding procedure Fill_Rectangle (This : in out Instance; Start, Stop : Point_T) is X0 : constant Integer := Dim'Min (Start.X, Stop.X); Y0 : constant Integer := Dim'Min (Start.Y, Stop.Y); X1 : constant Integer := Dim'Max (Start.X, Stop.X); Y1 : constant Integer := Dim'Max (Start.Y, Stop.Y); begin if Is_In_Screen (Start) and then Is_In_Screen (Stop) then Display.Get_Hidden_Buffer (1).Fill_Rect (Color => This.RGB_Color, X => X0, Y => Y0, Width => X1 - X0 + 1, Height => Y1 - Y0 + 1); end if; end Fill_Rectangle; ---------------- -- Draw_Image -- ---------------- overriding procedure Draw_Image (This : in out Instance; Img : Giza.Image.Class; Pt : Point_T) is begin if Img in Giza.Image.DMA2D.Class then declare DMA2D_Img : Giza.Image.DMA2D.Instance renames Giza.Image.DMA2D.Instance (Img); DMA2D_Mode : constant STM32.DMA2D.DMA2D_Color_Mode := (case DMA2D_Img.Mode is when Giza.Image.DMA2D.RGB888 => STM32.DMA2D.RGB888, when Giza.Image.DMA2D.L8 => STM32.DMA2D.L8, when Giza.Image.DMA2D.L4 => STM32.DMA2D.L4); DMA2D_Buffer : STM32.DMA2D.DMA2D_Buffer (Color_Mode => DMA2D_Mode); begin case DMA2D_Img.Mode is when Giza.Image.DMA2D.RGB888 => DMA2D_Buffer.Addr := DMA2D_Img.RGB888_Data (DMA2D_Img.RGB888_Data'First)'Address; when Giza.Image.DMA2D.L8 => DMA2D_Buffer.CLUT_Color_Mode := STM32.DMA2D.RGB888; DMA2D_Buffer.CLUT_Addr := DMA2D_Img.L8_CLUT (DMA2D_Img.L8_CLUT'First)'Address; DMA2D_Buffer.Addr := DMA2D_Img.L8_Data (DMA2D_Img.L8_Data'First)'Address; when Giza.Image.DMA2D.L4 => DMA2D_Buffer.CLUT_Color_Mode := STM32.DMA2D.RGB888; DMA2D_Buffer.CLUT_Addr := DMA2D_Img.L4_CLUT (DMA2D_Img.L4_CLUT'First)'Address; DMA2D_Buffer.Addr := DMA2D_Img.L4_Data (DMA2D_Img.L4_Data'First)'Address; end case; DMA2D_Buffer.Width := DMA2D_Img.W; DMA2D_Buffer.Height := DMA2D_Img.H; STM32.DMA2D.DMA2D_Copy_Rect (Src_Buffer => DMA2D_Buffer, X_Src => 0, Y_Src => 0, Dst_Buffer => STM32.DMA2D_Bitmap.To_DMA2D_Buffer (Display.Get_Hidden_Buffer (1)), X_Dst => Pt.X, Y_Dst => Pt.Y, Bg_Buffer => STM32.DMA2D.Null_Buffer, X_Bg => 0, Y_Bg => 0, Width => DMA2D_Img.Size.W, Height => DMA2D_Img.Size.H, Synchronous => False); end; else Draw_Image (Parent (This), Img, Pt); end if; end Draw_Image; end LCD_Graphic_Backend;
BrickBot/Bound-T-H8-300
Ada
9,838
ads
-- Growing_Vectors (decl) -- -- Vector structure of unbounded (dynamic) length, generic in -- the element type, indexed by Positive, intended for vectors -- that frequently grow beyond their current allocation. -- -- 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.5 $ -- $Date: 2015/10/24 19:36:49 $ -- -- $Log: growing_vectors.ads,v $ -- Revision 1.5 2015/10/24 19:36:49 niklas -- Moved to free licence. -- -- Revision 1.4 2007-10-26 12:44:36 niklas -- BT-CH-0091: Reanalyse a boundable edge only if its domain grows. -- -- Revision 1.3 2007/04/18 18:34:39 niklas -- BT-CH-0057. -- -- Revision 1.2 2007/03/29 15:18:03 niklas -- BT-CH-0056. -- -- Revision 1.1 2007/03/28 13:38:10 niklas -- First version. -- --:dbpool with GNAT.Debug_Pools; generic type Element_Type is private; -- -- The vector element type. type Vector_Type is array (Positive range <>) of Element_Type; -- -- An unbounded vector can be converted to a "normal" vector -- of this type. Initial_Size : Positive := 5; -- -- The initial storage allocation for an unbounded vector, -- in terms of the number of elements it can hold without -- any dynamic memory allocation. First_Increment : Positive := 10; -- -- When an unbounded vector grows past its Initial_Size, an -- extension is dynamically allocated to hold this number of -- additional elements, for a total maximum length of Initial_Size -- plus First_Increment. Later increases follow a Fibonacci-like -- sequence so that the size of the new extension is the sum of -- of sizes of the last two extensions. The size of the second -- extension is thus Initial_Size + First_Increment, etc. -- However, see Max_Increment below. Max_Increment : Positive := 1_000; -- -- An upper bound on the size of the dynamically allocated extensions -- to an unbounded vector. Deallocate : in out Boolean; -- -- Option variable to enable or disable the use of -- Unchecked_Deallocation to discard unused heap memory. package Growing_Vectors is type Unbounded_Vector is private; -- -- An ordered sequence of values of Element_Type, indexed -- by a dense sequence (range) of values 1 .. Last (vector). -- Given an index, the element at that index can be read -- or written. New elements can be added after the last one, -- but not before the first one. -- -- The initial value of an unbounded vector is the null sequence -- (no elements). -- -- Partly reference semantics, should be derived from -- a controlled type. function Length (V : Unbounded_Vector) return Natural; -- -- The number of elements in the vector. function First (V : Unbounded_Vector) return Positive; -- -- The index of the first element in the vector. -- Currently, this is always 1, but this function is provided -- for symmetry and for possible future extensions. function Last (V : Unbounded_Vector) return Natural; -- -- The index of the last element in the vector. -- -- If the vector is null (length = 0), the returned -- value is Index_Type'Pred (First (V)). -- This will currently be zero, since First = 1. function Next (V : Unbounded_Vector) return Positive; -- -- The index that follows the last index in the vector. -- If the vector is null (length = 0) the return value is -- First (V) otherwise is it Index_Type'succ (Last (V)). procedure Set ( Vector : in out Unbounded_Vector; Index : in Positive; To : in Element_Type); -- -- Changes the value of the Vector element at Index To a given value. -- -- If Index is greater than Last (Vector), the values of elements for -- the indices between Last (Vector) and Index are undefined (unless -- Element_Type has a defined default value). -- -- After Set, Length (Vector) and Last (Vector) will reflect the -- possible growth in the vector's length. procedure Append ( To : in out Unbounded_Vector; Value : in Element_Type); -- -- Extends the To vector by one element, assigning it the given Value. -- This is equivalent to Set (To, Next (To), Value). procedure Erase (Item : in out Unbounded_Vector); -- -- Truncates the vector to a null vector (zero length), deallocating -- all dynamically allocated memory (if allowed by Deallocate). function Element ( Vector : Unbounded_Vector; Index : Positive) return Element_Type; -- -- Returns the value of the element at the given Index in the -- given Vector. -- -- If Index is not in the range First (Vector) .. Last (Vector), -- Constraint_Error is raised. function Index ( Source : Unbounded_Vector; Value : Element_Type) return Positive; -- -- Searches the Source vector for an element with the given -- Value, and returns the (first) index where the value -- is found. If no element matches Value, the function -- returns Index_Type'Succ (Last(Vector)). procedure Drop ( Index : in Positive; From : in out Unbounded_Vector); -- -- Removes the element at the given Index From the given vector -- and fills the gap by shifting later elements down one index -- position. Raises Constraint_Error if the Index is not in the -- range First (From) .. Last (From). function Is_Element ( Source : Unbounded_Vector; Value : Element_Type) return Boolean; -- -- Whether the given Value is an element of the Source vector. procedure Find_Or_Add ( Value : in Element_Type; Vector : in out Unbounded_Vector; Index : out Positive); -- -- Finds the Value in the Vector and returns the (first) Index -- where Element (Vector, Index) = Value). If the Value is not -- in the Vector originally, the procedure adds it to the Vector -- (using Append) and returns the new Index which in this case -- equals Last (Vector). procedure Add ( Value : in Element_Type; To : in out Unbounded_Vector); -- -- Adds the Value To the vector, if the Value is not in the -- vector originally. Same as Find_Or_Add but ignoring the Index. function To_Vector (Item : Unbounded_Vector) return Vector_Type; -- -- Returns a normal (bounded) array that contains the same -- index range and the same values as the given vector. private type Piece_Type (First, Last : Positive); type Piece_Ref is access Piece_Type; --:dbpool Piece_Pool : GNAT.Debug_Pools.Debug_Pool; --:dbpool for Piece_Ref'Storage_Pool use Piece_Pool; type Piece_Type (First, Last : Positive) is record Prev : Piece_Ref; Store : Vector_Type (First .. Last); end record; -- -- One piece of a growing vector. -- -- Store holds the elements. -- Prev is a link to the preceding dynamically allocated piece, -- or (special case) to the last dynamically allocated piece. subtype First_Piece_Type is Piece_Type (First => 1, Last => Initial_Size); -- -- The first piece, a direct component of the growing vector. -- Prev points to the last dynamically allocated piece. type Unbounded_Vector is record Length : Natural := 0; First : First_Piece_Type; end record; -- -- An unbounded vector object. -- -- Length -- The current length. The valid indices are 1 .. Length. -- First -- The first piece. The head of the chain of dynamically added pieces. -- -- The index ranges of all the pieces cover the total index range -- 1 .. Length with no gaps and no overlap. The index range of the -- highest piece usually extends beyond Length. -- -- The pieces are linked in _descending_ order of index range. Thus, -- the piece First.Prev covers the highest part of the index range, and -- its Last component shows the total allocated capacity. The piece -- list ends with the first dynamically allocated piece which has a -- null Prev link. end Growing_Vectors;
reznikmm/matreshka
Ada
4,631
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.Continue_List_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Continue_List_Attribute_Node is begin return Self : Text_Continue_List_Attribute_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Text_Continue_List_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Continue_List_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Continue_List_Attribute, Text_Continue_List_Attribute_Node'Tag); end Matreshka.ODF_Text.Continue_List_Attributes;
apple-oss-distributions/old_ncurses
Ada
17,004
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses2.trace_set -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 2000 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno <[email protected]> 2000 -- Version Control -- $Revision: 1.1.1.1 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Trace; use Terminal_Interface.Curses.Trace; with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus; with Ada.Strings.Bounded; -- interactively set the trace level procedure ncurses2.trace_set is function menu_virtualize (c : Key_Code) return Menu_Request_Code; function subset (super, sub : Trace_Attribute_Set) return Boolean; function trace_or (a, b : Trace_Attribute_Set) return Trace_Attribute_Set; function trace_num (tlevel : Trace_Attribute_Set) return String; function tracetrace (tlevel : Trace_Attribute_Set) return String; function run_trace_menu (m : Menu) return Boolean; function menu_virtualize (c : Key_Code) return Menu_Request_Code is begin case c is when Character'Pos (newl) | Key_Exit => return Menu_Request_Code'Last + 1; -- MAX_COMMAND? TODO when Character'Pos ('u') => return M_ScrollUp_Line; when Character'Pos ('d') => return M_ScrollDown_Line; when Character'Pos ('b') | Key_Next_Page => return M_ScrollUp_Page; when Character'Pos ('f') | Key_Previous_Page => return M_ScrollDown_Page; when Character'Pos ('n') | Key_Cursor_Down => return M_Next_Item; when Character'Pos ('p') | Key_Cursor_Up => return M_Previous_Item; when Character'Pos (' ') => return M_Toggle_Item; when Key_Mouse => return c; when others => Beep; return c; end case; end menu_virtualize; type string_a is access String; type tbl_entry is record name : string_a; mask : Trace_Attribute_Set; end record; t_tbl : constant array (Positive range <>) of tbl_entry := ( (new String'("Disable"), Trace_Disable), (new String'("Times"), Trace_Attribute_Set'(Times => True, others => False)), (new String'("Tputs"), Trace_Attribute_Set'(Tputs => True, others => False)), (new String'("Update"), Trace_Attribute_Set'(Update => True, others => False)), (new String'("Cursor_Move"), Trace_Attribute_Set'(Cursor_Move => True, others => False)), (new String'("Character_Output"), Trace_Attribute_Set'(Character_Output => True, others => False)), (new String'("Ordinary"), Trace_Ordinary), (new String'("Calls"), Trace_Attribute_Set'(Calls => True, others => False)), (new String'("Virtual_Puts"), Trace_Attribute_Set'(Virtual_Puts => True, others => False)), (new String'("Input_Events"), Trace_Attribute_Set'(Input_Events => True, others => False)), (new String'("TTY_State"), Trace_Attribute_Set'(TTY_State => True, others => False)), (new String'("Internal_Calls"), Trace_Attribute_Set'(Internal_Calls => True, others => False)), (new String'("Character_Calls"), Trace_Attribute_Set'(Character_Calls => True, others => False)), (new String'("Termcap_TermInfo"), Trace_Attribute_Set'(Termcap_TermInfo => True, others => False)), (new String'("Maximium"), Trace_Maximum) ); package BS is new Ada.Strings.Bounded.Generic_Bounded_Length (300); function subset (super, sub : Trace_Attribute_Set) return Boolean is begin if (super.Times or not sub.Times) and (super.Tputs or not sub.Tputs) and (super.Update or not sub.Update) and (super.Cursor_Move or not sub.Cursor_Move) and (super.Character_Output or not sub.Character_Output) and (super.Calls or not sub.Calls) and (super.Virtual_Puts or not sub.Virtual_Puts) and (super.Input_Events or not sub.Input_Events) and (super.TTY_State or not sub.TTY_State) and (super.Internal_Calls or not sub.Internal_Calls) and (super.Character_Calls or not sub.Character_Calls) and (super.Termcap_TermInfo or not sub.Termcap_TermInfo) and True then return True; else return False; end if; end subset; function trace_or (a, b : Trace_Attribute_Set) return Trace_Attribute_Set is retval : Trace_Attribute_Set := Trace_Disable; begin retval.Times := (a.Times or b.Times); retval.Tputs := (a.Tputs or b.Tputs); retval.Update := (a.Update or b.Update); retval.Cursor_Move := (a.Cursor_Move or b.Cursor_Move); retval.Character_Output := (a.Character_Output or b.Character_Output); retval.Calls := (a.Calls or b.Calls); retval.Virtual_Puts := (a.Virtual_Puts or b.Virtual_Puts); retval.Input_Events := (a.Input_Events or b.Input_Events); retval.TTY_State := (a.TTY_State or b.TTY_State); retval.Internal_Calls := (a.Internal_Calls or b.Internal_Calls); retval.Character_Calls := (a.Character_Calls or b.Character_Calls); retval.Termcap_TermInfo := (a.Termcap_TermInfo or b.Termcap_TermInfo); return retval; end trace_or; -- Print the hexadecimal value of the mask so -- users can set it from the command line. function trace_num (tlevel : Trace_Attribute_Set) return String is result : Integer := 0; m : Integer := 1; begin if tlevel.Times then result := result + m; end if; m := m * 2; if tlevel.Tputs then result := result + m; end if; m := m * 2; if tlevel.Update then result := result + m; end if; m := m * 2; if tlevel.Cursor_Move then result := result + m; end if; m := m * 2; if tlevel.Character_Output then result := result + m; end if; m := m * 2; if tlevel.Calls then result := result + m; end if; m := m * 2; if tlevel.Virtual_Puts then result := result + m; end if; m := m * 2; if tlevel.Input_Events then result := result + m; end if; m := m * 2; if tlevel.TTY_State then result := result + m; end if; m := m * 2; if tlevel.Internal_Calls then result := result + m; end if; m := m * 2; if tlevel.Character_Calls then result := result + m; end if; m := m * 2; if tlevel.Termcap_TermInfo then result := result + m; end if; m := m * 2; return result'Img; end trace_num; function tracetrace (tlevel : Trace_Attribute_Set) return String is use BS; buf : Bounded_String := To_Bounded_String (""); begin -- The C version prints the hexadecimal value of the mask, we -- won't do that here because this is Ada. if tlevel = Trace_Disable then Append (buf, "Trace_Disable"); else if subset (tlevel, Trace_Attribute_Set'(Times => True, others => False)) then Append (buf, "Times"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Tputs => True, others => False)) then Append (buf, "Tputs"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Update => True, others => False)) then Append (buf, "Update"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Cursor_Move => True, others => False)) then Append (buf, "Cursor_Move"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Character_Output => True, others => False)) then Append (buf, "Character_Output"); Append (buf, ", "); end if; if subset (tlevel, Trace_Ordinary) then Append (buf, "Ordinary"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Calls => True, others => False)) then Append (buf, "Calls"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Virtual_Puts => True, others => False)) then Append (buf, "Virtual_Puts"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Input_Events => True, others => False)) then Append (buf, "Input_Events"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(TTY_State => True, others => False)) then Append (buf, "TTY_State"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Internal_Calls => True, others => False)) then Append (buf, "Internal_Calls"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Character_Calls => True, others => False)) then Append (buf, "Character_Calls"); Append (buf, ", "); end if; if subset (tlevel, Trace_Attribute_Set'(Termcap_TermInfo => True, others => False)) then Append (buf, "Termcap_TermInfo"); Append (buf, ", "); end if; if subset (tlevel, Trace_Maximum) then Append (buf, "Maximium"); Append (buf, ", "); end if; end if; if To_String (buf) (Length (buf) - 1) = ',' then Delete (buf, Length (buf) - 1, Length (buf)); end if; return To_String (buf); end tracetrace; function run_trace_menu (m : Menu) return Boolean is i, p : Item; changed : Boolean; c, v : Key_Code; begin loop changed := False; c := Getchar (Get_Window (m)); v := menu_virtualize (c); case Driver (m, v) is when Unknown_Request => return False; when others => i := Current (m); if i = Menus.Items (m, 1) then -- the first item for n in t_tbl'First + 1 .. t_tbl'Last loop if Value (i) then Set_Value (i, False); changed := True; end if; end loop; else for n in t_tbl'First + 1 .. t_tbl'Last loop p := Menus.Items (m, n); if Value (p) then Set_Value (Menus.Items (m, 1), False); changed := True; exit; end if; end loop; end if; if not changed then return True; end if; end case; end loop; end run_trace_menu; nc_tracing, mask : Trace_Attribute_Set; pragma Import (C, nc_tracing, "_nc_tracing"); items_a : Item_Array_Access := new Item_Array (t_tbl'First .. t_tbl'Last + 1); mrows : Line_Count; mcols : Column_Count; menuwin : Window; menu_y : constant Line_Position := 8; menu_x : constant Column_Position := 8; ip : Item; m : Menu; newtrace : Trace_Attribute_Set; begin Add (Line => 0, Column => 0, Str => "Interactively set trace level:"); Add (Line => 2, Column => 0, Str => " Press space bar to toggle a selection."); Add (Line => 3, Column => 0, Str => " Use up and down arrow to move the select bar."); Add (Line => 4, Column => 0, Str => " Press return to set the trace level."); Add (Line => 6, Column => 0, Str => "(Current trace level is "); Add (Str => tracetrace (nc_tracing) & " numerically: " & trace_num (nc_tracing)); Add (Ch => ')'); Refresh; for n in t_tbl'Range loop items_a (n) := New_Item (t_tbl (n).name.all); end loop; items_a (t_tbl'Last + 1) := Null_Item; m := New_Menu (items_a); Set_Format (m, 16, 2); Scale (m, mrows, mcols); Switch_Options (m, (One_Valued => True, others => False), On => False); menuwin := New_Window (mrows + 2, mcols + 2, menu_y, menu_x); Set_Window (m, menuwin); Set_KeyPad_Mode (menuwin, SwitchOn => True); Box (menuwin); Set_Sub_Window (m, Derived_Window (menuwin, mrows, mcols, 1, 1)); Post (m); for n in t_tbl'Range loop ip := Items (m, n); mask := t_tbl (n).mask; if mask = Trace_Disable then Set_Value (ip, nc_tracing = Trace_Disable); elsif subset (sub => mask, super => nc_tracing) then Set_Value (ip, True); end if; end loop; while run_trace_menu (m) loop null; end loop; newtrace := Trace_Disable; for n in t_tbl'Range loop ip := Items (m, n); if Value (ip) then mask := t_tbl (n).mask; newtrace := trace_or (newtrace, mask); end if; end loop; Trace_On (newtrace); Trace_Put ("trace level interactively set to " & tracetrace (nc_tracing)); Move_Cursor (Line => Lines - 4, Column => 0); Add (Str => "Trace level is "); Add (Str => tracetrace (nc_tracing)); Add (Ch => newl); Pause; -- was just Add(); Getchar Post (m, False); -- menuwin has subwindows I think, which makes an error. declare begin Delete (menuwin); exception when Curses_Exception => null; end; -- free_menu(m); -- free_item() end ncurses2.trace_set;
charlie5/lace
Ada
393
adb
package body openGL.Screen is -- function Thin (Self : in Item) return xcb.xcb_screen_t.Pointer -- is -- begin -- return Self.Thin; -- end Thin; -- procedure Thin_is (Self : in out Item; Now : in xcb.xcb_screen_t.Pointer) -- is -- begin -- Self.Thin := Now; -- end Thin_is; procedure dummy is begin null; end dummy; end openGL.Screen;
grim7reaper/SipHash
Ada
6,087
adb
------------------------------------------------------------------------ -- Copyright (c) 2014 Sylvain Laperche <[email protected]> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in -- the documentation and/or other materials provided with the -- distribution. -- 3. Neither the name of author 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 HOLDERS AND CONTRIBUTORSBE 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 Ada.Text_IO; with SipHash.PRF; --------------------------------------------------------------------- -- Tests.Streaming_Interface -- -- Purpose: -- This procedure tests the Streaming interface of SipHash. -- Exceptions: -- None. -- References: -- [1]J.-P. Aumasson and D. J. Bernstein, “SipHash: a fast short-input -- PRF.” 18-Sep-2012 (https://131002.net/siphash/siphash.pdf) -- [2]J.-P. Aumasson and D. J. Bernstein, "Reference C implementation" -- (https://131002.net/siphash/siphash24.c) --------------------------------------------------------------------- procedure Tests.Streaming_Interface is package T_IO renames Ada.Text_IO; package SipHash24 is new SipHash.PRF(Nb_Compression_Rounds => 2, Nb_Finalization_Rounds => 4); --------------------------------------------------------------------- -- Test_Paper -- -- Purpose: -- This function tests the implementation against the test values -- provided in the original paper (Cf. Appendix A, p. 19 of [1]). -- Return: -- Returns True if the test passed, otherwise False. -- Exceptions: -- None. --------------------------------------------------------------------- function Test_Paper return Boolean is Hash : SipHash24.Object := SipHash24.Initialize(Key); Result : SipHash.U64; begin for I in Paper_Input'Range loop SipHash24.Update(Hash, Paper_Input(I)); end loop; SipHash24.Finalize(Hash, Result); if Result /= Paper_Output then Put_Error("Test_Paper", Paper_Output, Result); return False; else return True; end if; end Test_Paper; --------------------------------------------------------------------- -- Test_Empty_Input -- -- Purpose: -- This function tests the implementation with an empty input. -- Return: -- Returns True if the test passed, otherwise False. -- Exceptions: -- None. --------------------------------------------------------------------- function Test_Empty_Input return Boolean is Hash : SipHash24.Object := SipHash24.Initialize(Key); Result : SipHash.U64; begin SipHash24.Finalize(Hash, Result); if Result /= Empty_Output then Put_Error("Test_Empty_Input", Empty_Output, Result); return False; else return True; end if; end Test_Empty_Input; --------------------------------------------------------------------- -- Test_Reference_Implementation -- -- Purpose: -- This function tests the implementation against the test values -- provided in the reference C implementation (Cf. [2]). -- Return: -- Returns True if the test passed, otherwise False. -- Exceptions: -- None. --------------------------------------------------------------------- function Test_Reference_Implementation return Boolean is Hash : SipHash24.Object := SipHash24.Initialize(Key); Input : SipHash.Byte_Sequence(1..63); Result : SipHash.U64; Status : Boolean := True; begin -- Test the following inputs: -- Input = 00 (1 byte) -- Input = 00 01 (2 bytes) -- Input = 00 01 02 (3 bytes) -- ... -- Input = 00 01 02 ... 3e (63 bytes) for I in Input'Range loop Input(I) := SipHash.U8(I-1); SipHash24.Update(Hash, Input(Input'First)); if I > 1 then SipHash24.Update(Hash, Input(Input'First + 1.. I)); end if; SipHash24.Finalize(Hash, Result); if Result /= C_Ref_Output(I) then Put_Error("Test_Reference_Implementation", C_Ref_Output(I), Result); Status := False; exit; end if; SipHash24.Reset(Hash, Key); end loop; return Status; end Test_Reference_Implementation; Status : Boolean := True; begin T_IO.Put_Line("SipHash v" & SipHash.Version_String); Status := Status and Test_Paper; Status := Status and Test_Empty_Input; Status := Status and Test_Reference_Implementation; -- Check if everything went well. if Status then T_IO.Put_Line("All tests passed!"); end if; end Tests.Streaming_Interface;
zhmu/ananas
Ada
2,596
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . E X P _ L L U -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- This package does not require a body, since it is an instantiation. We -- provide a dummy file containing a No_Body pragma so that previous versions -- of the body (which did exist) will not interfere. pragma No_Body;
reznikmm/matreshka
Ada
11,797
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_Packageable_Elements; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements.Collections; with AMF.UML.Namespaces; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements; with AMF.UML.String_Expressions; with AMF.UML.Template_Parameters; with AMF.UML.Usages; with AMF.Visitors; package AMF.Internals.UML_Usages is type UML_Usage_Proxy is limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy and AMF.UML.Usages.UML_Usage with null record; overriding function Get_Client (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Dependency::client. -- -- The element(s) dependent on the supplier element(s). In some cases -- (such as a Trace Abstraction) the assignment of direction (that is, the -- designation of the client element) is at the discretion of the modeler, -- and is a stipulation. overriding function Get_Supplier (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Dependency::supplier. -- -- The element(s) independent of the client element(s), in the same -- respect and the same dependency relationship. In some directed -- dependency relationships (such as Refinement Abstractions), a common -- convention in the domain of class-based OO software is to put the more -- abstract element in this role. Despite this convention, users of UML -- may stipulate a sense of dependency suitable for their domain, which -- makes a more abstract element dependent on that which is more specific. overriding function Get_Source (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of DirectedRelationship::source. -- -- Specifies the sources of the DirectedRelationship. overriding function Get_Target (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of DirectedRelationship::target. -- -- Specifies the targets of the DirectedRelationship. overriding function Get_Related_Element (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Relationship::relatedElement. -- -- Specifies the elements related by the Relationship. overriding function Get_Client_Dependency (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Usage_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Usage_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Usage_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Usage_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding function Get_Template_Parameter (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access UML_Usage_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function All_Owning_Packages (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Usage_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Usage_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Is_Compatible_With (Self : not null access constant UML_Usage_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean; -- Operation ParameterableElement::isCompatibleWith. -- -- The query isCompatibleWith() determines if this parameterable element -- is compatible with the specified parameterable element. By default -- parameterable element P is compatible with parameterable element Q if -- the kind of P is the same or a subtype as the kind of Q. Subclasses -- should override this operation to specify different compatibility -- constraints. overriding function Is_Template_Parameter (Self : not null access constant UML_Usage_Proxy) return Boolean; -- Operation ParameterableElement::isTemplateParameter. -- -- The query isTemplateParameter() determines if this parameterable -- element is exposed as a formal template parameter. overriding procedure Enter_Element (Self : not null access constant UML_Usage_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_Usage_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_Usage_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_Usages;
AdaCore/gpr
Ada
111
adb
with Ada.Text_IO; use Ada.Text_IO; procedure Crashclean is begin Put_Line ("Clean crash"); end Crashclean;
AdaDoom3/wayland_ada_binding
Ada
10,813
adb
------------------------------------------------------------------------------ -- Copyright (C) 2015-2016, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 3, or (at your option) any later -- -- version. This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY 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/>. -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; package body Conts.Algorithms is -------------------------------- -- Count_If_With_External_Get -- -------------------------------- function Count_If_With_External_Get (Self : Cursors.Container; Map : Getters.Map; Predicate : not null access function (E : Getters.Element) return Boolean) return Natural is C : Cursors.Cursor := Cursors.First (Self); Count : Natural := 0; begin while Cursors.Has_Element (Self, C) loop if Predicate (Getters.Get (Map, C)) then Count := Count + 1; end if; C := Cursors.Next (Self, C); end loop; return Count; end Count_If_With_External_Get; -------------- -- Count_If -- -------------- function Count_If (Self : Cursors.Container; Predicate : not null access function (E : Getters.Element) return Boolean) return Natural is function Internal is new Count_If_With_External_Get (Cursors, Getters); begin return Internal (Self, Self, Predicate); end Count_If; ------------- -- Shuffle -- ------------- procedure Shuffle (Self : in out Cursors.Container; Gen : in out Random.Generator) is use Cursors; First : constant Cursors.Index := Cursors.First (Self); Next_To_First : constant Cursors.Index := First + 1; Last : constant Cursors.Index := Cursors.Last (Self); C : Cursors.Index := Last; G : Cursors.Index; begin -- Fisher and Yates algorithm -- http://en.wikipedia.org/wiki/Fisher-Yates_shuffle while C /= Next_To_First loop declare -- The cost of the instance is limited (just a few instructions) -- thanks to inlining. procedure Rand is new Conts.Ranged_Random (Random, First, C); begin Rand (Gen, Result => G); Swap (Self, G, C); C := C - 1; end; end loop; end Shuffle; -------------------- -- Insertion_Sort -- -------------------- procedure Insertion_Sort (Self : in out Cursors.Container) is C : Cursors.Index := Cursors.First (Self); begin if Cursors.Has_Element (Self, C) then C := Cursors.Next (Self, C); while Cursors.Has_Element (Self, C) loop declare Elem : constant Getters.Element := Getters.Get (Self, C); D, E : Cursors.Index; begin E := C; loop D := Cursors.Previous (Self, E); exit when not Cursors.Has_Element (Self, D) or else "<" (Getters.Get (Self, D), Elem); Swap (Self, E, D); E := D; end loop; end; C := Cursors.Next (Self, C); end loop; end if; end Insertion_Sort; ---------------- -- Shell_Sort -- ---------------- procedure Shell_Sort (Self : in out Cursors.Container) is -- See https://en.wikipedia.org/wiki/Shellsort First : constant Cursors.Index := Cursors.First (Self); C : Cursors.Index; begin for Gap of reverse Gaps loop -- Do a gapped insertion sort for this gap size. -- The first gap elements are already in gap order. C := Cursors.Add (First, Gap); while Cursors.Has_Element (Self, C) loop declare Elem : constant Getters.Element := Getters.Get (Self, C); D, E : Cursors.Index; begin E := C; loop D := Cursors."+" (E, -Gap); exit when "<" (Getters.Get (Self, D), Elem); Swap (Self, E, D); exit when Cursors.Distance (D, First) < Gap; E := D; end loop; end; C := Cursors.Next (Self, C); end loop; end loop; end Shell_Sort; ---------------------------------- -- Ranged_Random_Access_Cursors -- ---------------------------------- package body Ranged_Random_Access_Cursors is ---------- -- Swap -- ---------- procedure Swap (Self : in out Rg; Left, Right : Cursors.Index) is begin Base_Swap (Self.Base.all, Left, Right); end Swap; end Ranged_Random_Access_Cursors; --------------- -- Quicksort -- --------------- procedure Quicksort (Self : in out Cursors.Container) is package Ranges is new Ranged_Random_Access_Cursors (Cursors, Getters, Swap); procedure Shell is new Shell_Sort (Ranges.Cursors, Ranges.Getters, "<", Ranges.Swap); procedure Recurse (Low, High : Cursors.Index); procedure Recurse (Low, High : Cursors.Index) is Dist : Integer; L : Cursors.Index := Low; H : Cursors.Index := High; Left, Right : Cursors.Index; begin loop Dist := Cursors.Dist (H, L); exit when Dist <= 0; if Dist < Threshold then declare S : Ranges.Rg := Ranges.Subset (Self'Unrestricted_Access, L, H); begin Shell (S); end; return; end if; Left := L; Right := H; declare Pivot : constant Getters.Element := Getters.Value (Self, Cursors.Add (L, Dist / 2)); begin -- ??? Should handle cases where the element is equal to the -- pivot, to avoid the worst case where the sequences contains -- only equal items. loop while "<" (Getters.Value (Self, Left), Pivot) loop Left := Cursors.Next (Self, Left); end loop; while "<" (Pivot, Getters.Value (Self, Right)) loop Right := Cursors.Previous (Self, Right); end loop; exit when Cursors.Dist (Right, Left) <= 0; Swap (Self, Right, Left); Left := Cursors.Next (Self, Left); Right := Cursors.Previous (Self, Right); end loop; end; -- Recurse for smaller sequence, and tail recursion for longer -- one. Do not keep pivot on the stack while recursing. if Cursors.Dist (Right, L) > Cursors.Dist (H, Right) then Recurse (Cursors.Next (Self, Right), H); H := Right; -- loop on L..Right else Recurse (L, Right); L := Cursors.Next (Self, Right); -- loop on Right+1 .. H end if; end loop; end Recurse; begin Recurse (Cursors.First_Index (Self), Cursors.Last_Index (Self)); end Quicksort; --------------- -- Is_Sorted -- --------------- function Is_Sorted (Self : Cursors.Container) return Boolean is Prev : Cursors.Cursor := Cursors.First (Self); C : Cursors.Cursor; begin if not Cursors.Has_Element (Self, Prev) then return True; -- an empty sequence is always sorted end if; C := Cursors.Next (Self, Prev); while Cursors.Has_Element (Self, C) loop if Getters.Get (Self, C) < Getters.Get (Self, Prev) then return False; end if; Prev := C; C := Cursors.Next (Self, C); end loop; return True; end Is_Sorted; ---------- -- Find -- ---------- function Find (Self : Cursors.Container; E : Getters.Element) return Cursors.Cursor is C : Cursors.Cursor := Cursors.First (Self); begin while Cursors.Has_Element (Self, C) loop if Getters.Get (Self, C) = E then return C; end if; C := Cursors.Next (Self, C); end loop; return Cursors.No_Element; end Find; -------------- -- Contains -- -------------- function Contains (Self : Cursors.Container; E : Getters.Element) return Boolean is function F is new Find (Cursors, Getters, "="); use type Cursors.Cursor_Type; begin return F (Self, E) /= Cursors.No_Element; end Contains; ------------ -- Equals -- ------------ function Equals (Left, Right : Cursors.Container) return Boolean is use Cursors; L_First : constant Cursors.Index_Type := Cursors.First (Left); L_Last : constant Cursors.Index_Type := Cursors.Last (Left); R_First : constant Cursors.Index_Type := Cursors.First (Right); R_Last : constant Cursors.Index_Type := Cursors.Last (Right); begin if Distance (L_Last, L_First) /= Distance (R_Last, R_First) then return False; end if; for L in L_First .. L_Last loop if Getters.Get (Left, L) /= Getters.Get (Right, R_First + Distance (L, L_First)) then return False; end if; end loop; return True; end Equals; end Conts.Algorithms;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
2,830
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.WWDG is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_T_Field is STM32_SVD.UInt7; subtype CR_WDGA_Field is STM32_SVD.Bit; -- Control register type CR_Register is record -- 7-bit counter T : CR_T_Field := 16#7F#; -- Activation bit WDGA : CR_WDGA_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record T at 0 range 0 .. 6; WDGA at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype CFR_W_Field is STM32_SVD.UInt7; subtype CFR_WDGTB_Field is STM32_SVD.UInt2; subtype CFR_EWI_Field is STM32_SVD.Bit; -- Configuration register type CFR_Register is record -- 7-bit window value W : CFR_W_Field := 16#7F#; -- Timer base WDGTB : CFR_WDGTB_Field := 16#0#; -- Early wakeup interrupt EWI : CFR_EWI_Field := 16#0#; -- unspecified Reserved_10_31 : STM32_SVD.UInt22 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CFR_Register use record W at 0 range 0 .. 6; WDGTB at 0 range 7 .. 8; EWI at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; subtype SR_EWIF_Field is STM32_SVD.Bit; -- Status register type SR_Register is record -- Early wakeup interrupt flag EWIF : SR_EWIF_Field := 16#0#; -- unspecified Reserved_1_31 : STM32_SVD.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record EWIF at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Window watchdog type WWDG_Peripheral is record -- Control register CR : aliased CR_Register; -- Configuration register CFR : aliased CFR_Register; -- Status register SR : aliased SR_Register; end record with Volatile; for WWDG_Peripheral use record CR at 16#0# range 0 .. 31; CFR at 16#4# range 0 .. 31; SR at 16#8# range 0 .. 31; end record; -- Window watchdog WWDG_Periph : aliased WWDG_Peripheral with Import, Address => System'To_Address (16#40002C00#); end STM32_SVD.WWDG;
reznikmm/matreshka
Ada
3,744
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Text_Sender_State_Or_Province_Elements is pragma Preelaborate; type ODF_Text_Sender_State_Or_Province is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_Sender_State_Or_Province_Access is access all ODF_Text_Sender_State_Or_Province'Class with Storage_Size => 0; end ODF.DOM.Text_Sender_State_Or_Province_Elements;
AdaCore/Ada_Drivers_Library
Ada
5,103
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; package body Bluetooth_Low_Energy.Packets is function As_UInt8 is new Ada.Unchecked_Conversion (Interfaces.Integer_8, UInt8); ----------------- -- Get_Address -- ----------------- function Memory_Address (This : BLE_Packet) return System.Address is begin return This'Address; end Memory_Address; ---------------- -- Set_Header -- ---------------- procedure Set_Header (This : in out BLE_Packet; Header : UInt8) is begin This.Header := Header; end Set_Header; ---------- -- Push -- ---------- procedure Push (This : in out BLE_Packet; Data : UInt8) is Next_Index : constant Integer := This.Data'First + Integer (This.Packet_Length); begin if This.Packet_Length < BLE_PACKET_MAX_PAYLOAD then This.Data (Next_Index) := Data; This.Packet_Length := This.Packet_Length + 1; end if; end Push; ---------- -- Push -- ---------- procedure Push (This : in out BLE_Packet; Data : Interfaces.Integer_8) is begin Push (This, As_UInt8 (Data)); end Push; ---------- -- Push -- ---------- procedure Push (This : in out BLE_Packet; Data : UInt16) is type As_Array is array (1 .. 2) of UInt8 with Pack, Size => 16; Data_As_Array : As_Array; for Data_As_Array'Address use Data'Address; begin Push (This, Data_As_Array (1)); Push (This, Data_As_Array (2)); end Push; ---------- -- Push -- ---------- procedure Push (This : in out BLE_Packet; Data : UInt32) is type As_Array is array (1 .. 4) of UInt8 with Pack, Size => 32; Data_As_Array : As_Array; for Data_As_Array'Address use Data'Address; begin Push (This, Data_As_Array (1)); Push (This, Data_As_Array (2)); Push (This, Data_As_Array (3)); Push (This, Data_As_Array (4)); end Push; ---------- -- Push -- ---------- procedure Push (This : in out BLE_Packet; Data : UInt8_Array) is begin for Elt of Data loop Push (This, Elt); end loop; end Push; --------------- -- Push_UUID -- --------------- procedure Push_UUID (This : in out BLE_Packet; UUID : BLE_UUID) is begin case UUID.Kind is when UUID_16bits => Push (This, UUID.UUID_16); when UUID_32bits => Push (This, UUID.UUID_32); when UUID_16UInt8s => Push (This, UUID.UUID_16_UInt8s); end case; end Push_UUID; end Bluetooth_Low_Energy.Packets;
reznikmm/matreshka
Ada
3,734
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Track_Changes_Attributes is pragma Preelaborate; type ODF_Table_Track_Changes_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Track_Changes_Attribute_Access is access all ODF_Table_Track_Changes_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Track_Changes_Attributes;
sungyeon/drake
Ada
14,290
ads
pragma License (Unrestricted); -- Ada 2005 with Ada.Iterator_Interfaces; with Ada.References; private with Ada.Containers.Copy_On_Write; private with Ada.Finalization; private with Ada.Streams; generic type Index_Type is range <>; type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Vectors is pragma Preelaborate; pragma Remote_Types; subtype Extended_Index is Index_Type'Base range Index_Type'First - 1 .. Index_Type'Min (Index_Type'Base'Last - 1, Index_Type'Last) + 1; No_Index : constant Extended_Index := Extended_Index'First; type Vector is tagged private with -- Constant_Indexing => Constant_Reference, -- is overloaded -- Variable_Indexing => Reference, Constant_Indexing => Constant_Indexing, Variable_Indexing => Indexing, Default_Iterator => Iterate, Iterator_Element => Element_Type; pragma Preelaborable_Initialization (Vector); -- modified -- type Cursor is private; -- pragma Preelaborable_Initialization (Cursor); subtype Cursor is Extended_Index; -- modified -- Empty_Vector : constant Vector; function Empty_Vector return Vector; No_Element : Cursor renames No_Index; function Has_Element (Position : Cursor) return Boolean; package Vector_Iterator_Interfaces is new Iterator_Interfaces (Cursor, Has_Element); overriding function "=" (Left, Right : Vector) return Boolean; function To_Vector (Length : Count_Type) return Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector; -- extended generic type Element_Array is array (Index_Type range <>) of Element_Type; function Generic_Array_To_Vector (S : Element_Array) return Vector; function "&" (Left, Right : Vector) return Vector; function "&" (Left : Vector; Right : Element_Type) return Vector; function "&" (Left : Element_Type; Right : Vector) return Vector; function "&" (Left, Right : Element_Type) return Vector; function Capacity (Container : Vector) return Count_Type; procedure Reserve_Capacity ( Container : in out Vector; Capacity : Count_Type); function Length (Container : Vector) return Count_Type; procedure Set_Length (Container : in out Vector; Length : Count_Type); function Is_Empty (Container : Vector) return Boolean; procedure Clear (Container : in out Vector); -- modified function To_Cursor ( Container : Vector'Class; -- not primitive Index : Extended_Index) return Cursor; function To_Index (Position : Cursor) return Extended_Index renames "+"; -- modified function Element ( Container : Vector'Class; -- not primitive Index : Index_Type) return Element_Type; -- function Element (Position : Cursor) return Element_Type; -- procedure Replace_Element ( -- Container : in out Vector; -- Index : Index_Type; -- New_Item : Element_Type); procedure Replace_Element ( Container : in out Vector; Position : Cursor; New_Item : Element_Type); -- modified procedure Query_Element ( Container : Vector'Class; -- not primitive Index : Index_Type; Process : not null access procedure (Element : Element_Type)); -- procedure Query_Element ( -- Position : Cursor; -- Process : not null access procedure (Element : Element_Type)); -- procedure Update_Element ( -- Container : in out Vector; -- Index : Index_Type; -- Process : not null access procedure (Element : in out Element_Type)); -- modified procedure Update_Element ( Container : in out Vector'Class; -- not primitive Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); type Constant_Reference_Type ( Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; type Reference_Type (Element : not null access Element_Type) is private with Implicit_Dereference => Element; -- function Constant_Reference ( -- Container : aliased Vector; -- Index : Index_Type) -- return Constant_Reference_Type; -- function Reference (Container : aliased in out Vector; Index : Index_Type) -- return Reference_Type; function Constant_Reference (Container : aliased Vector; Position : Cursor) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Position : Cursor) return Reference_Type; procedure Assign (Target : in out Vector; Source : Vector); function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector; procedure Move (Target : in out Vector; Source : in out Vector); -- procedure Insert ( -- Container : in out Vector; -- Before : Extended_Index; -- New_Item : Vector); procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Vector); procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Vector; Position : out Cursor); -- procedure Insert ( -- Container : in out Vector; -- Before : Extended_Index; -- New_Item : Element_Type; -- Count : Count_Type := 1); procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1); procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1); -- procedure Insert ( -- Container : in out Vector; -- Before : Extended_Index; -- Count : Count_Type := 1); -- procedure Insert ( -- Container : in out Vector; -- Before : Cursor; -- Position : out Cursor; -- Count : Count_Type := 1); procedure Prepend (Container : in out Vector; New_Item : Vector); procedure Prepend ( Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1); procedure Append (Container : in out Vector; New_Item : Vector); procedure Append ( Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1); -- modified procedure Insert_Space ( Container : in out Vector'Class; -- not primitive Before : Extended_Index; Count : Count_Type := 1); procedure Insert_Space ( Container : in out Vector; Before : Cursor; Position : out Cursor; Count : Count_Type := 1); -- procedure Delete ( -- Container : in out Vector; -- Index : Extended_Index; -- Count : Count_Type := 1); procedure Delete ( Container : in out Vector; Position : in out Cursor; Count : Count_Type := 1); -- modified procedure Delete_First ( Container : in out Vector'Class; -- not primitive Count : Count_Type := 1); -- modified procedure Delete_Last ( Container : in out Vector'Class; -- not primitive Count : Count_Type := 1); procedure Reverse_Elements (Container : in out Vector); -- procedure Swap (Container : in out Vector; I, J : Index_Type); procedure Swap (Container : in out Vector; I, J : Cursor); -- modified function First_Index (Container : Vector'Class) -- not primitive return Index_Type; pragma Inline (First_Index); function First (Container : Vector) return Cursor; -- modified function First_Element (Container : Vector'Class) -- not primitive return Element_Type; -- modified function Last_Index (Container : Vector'Class) -- not primitive return Extended_Index; pragma Inline (Last_Index); function Last (Container : Vector) return Cursor; -- modified function Last_Element (Container : Vector'Class) -- not primitive return Element_Type; -- function Next (Position : Cursor) return Cursor; -- procedure Next (Position : in out Cursor); -- function Previous (Position : Cursor) return Cursor; -- procedure Previous (Position : in out Cursor); -- modified function Find_Index ( Container : Vector'Class; -- not primitive Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index; -- modified -- function Find ( -- Container : Vector; -- Item : Element_Type; -- Position : Cursor := No_Element) -- return Cursor; function Find ( Container : Vector; Item : Element_Type) return Cursor; function Find ( Container : Vector; Item : Element_Type; Position : Cursor) return Cursor; -- modified function Reverse_Find_Index ( Container : Vector'Class; -- not primitive Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index; -- modified -- function Reverse_Find ( -- Container : Vector; -- Item : Element_Type; -- Position : Cursor := No_Element) -- return Cursor; function Reverse_Find ( Container : Vector; Item : Element_Type) return Cursor; function Reverse_Find ( Container : Vector; Item : Element_Type; Position : Cursor) return Cursor; function Contains (Container : Vector; Item : Element_Type) return Boolean; -- modified procedure Iterate ( Container : Vector'Class; -- not primitive Process : not null access procedure (Position : Cursor)); -- modified procedure Reverse_Iterate ( Container : Vector'Class; -- not primitive Process : not null access procedure (Position : Cursor)); -- modified function Iterate (Container : Vector'Class) -- not primitive return Vector_Iterator_Interfaces.Reversible_Iterator'Class; -- function Iterate (Container : Vector; Start : Cursor) -- return Vector_Iterator_Interfaces.Reversible_Iterator'Class; -- extended function Iterate (Container : Vector'Class; First, Last : Cursor) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; -- extended from here -- Convenient way to direct access. type Element_Array is array (Index_Type range <>) of aliased Element_Type; package Slicing is new References.Generic_Slicing (Index_Type, Element_Type, Element_Array); function Constant_Reference (Container : aliased Vector) return Slicing.Constant_Reference_Type; function Reference (Container : aliased in out Vector) return Slicing.Reference_Type; -- to here generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : Vector) return Boolean; procedure Sort (Container : in out Vector); procedure Merge (Target : in out Vector; Source : in out Vector); end Generic_Sorting; -- diff (Equivalents) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- non-overloaded subprograms function Constant_Indexing ( Container : aliased Vector'Class; Index : Index_Type) return Constant_Reference_Type; function Indexing ( Container : aliased in out Vector'Class; Index : Index_Type) return Reference_Type; pragma Inline (Constant_Indexing); pragma Inline (Indexing); private -- diff (Element_Access) -- diff (Element_Array) type Data (Capacity_Last : Extended_Index) is limited record Super : aliased Copy_On_Write.Data; Max_Length : aliased Count_Type; Items : aliased Element_Array (Index_Type'First .. Capacity_Last); end record; -- place Super at first for Data use record Super at 0 range 0 .. Copy_On_Write.Data_Size - 1; end record; type Data_Access is access all Data; type Vector is new Finalization.Controlled with record Super : aliased Copy_On_Write.Container; Length : Count_Type := 0; end record; overriding procedure Adjust (Object : in out Vector); overriding procedure Finalize (Object : in out Vector) renames Clear; type Constant_Reference_Type ( Element : not null access constant Element_Type) is null record; type Reference_Type (Element : not null access Element_Type) is null record; type Vector_Iterator is new Vector_Iterator_Interfaces.Reversible_Iterator with record First : Extended_Index; Last : Extended_Index; end record; overriding function First (Object : Vector_Iterator) return Cursor; overriding function Next (Object : Vector_Iterator; Position : Cursor) return Cursor; overriding function Last (Object : Vector_Iterator) return Cursor; overriding function Previous (Object : Vector_Iterator; Position : Cursor) return Cursor; package Streaming is procedure Read ( Stream : not null access Streams.Root_Stream_Type'Class; Item : out Vector); procedure Write ( Stream : not null access Streams.Root_Stream_Type'Class; Item : Vector); procedure Missing_Read ( Stream : access Streams.Root_Stream_Type'Class; Item : out Constant_Reference_Type) with Import, Convention => Ada, External_Name => "__drake_program_error"; procedure Missing_Write ( Stream : access Streams.Root_Stream_Type'Class; Item : Constant_Reference_Type) with Import, Convention => Ada, External_Name => "__drake_program_error"; procedure Missing_Read ( Stream : access Streams.Root_Stream_Type'Class; Item : out Reference_Type) with Import, Convention => Ada, External_Name => "__drake_program_error"; procedure Missing_Write ( Stream : access Streams.Root_Stream_Type'Class; Item : Reference_Type) with Import, Convention => Ada, External_Name => "__drake_program_error"; end Streaming; for Vector'Read use Streaming.Read; for Vector'Write use Streaming.Write; for Constant_Reference_Type'Read use Streaming.Missing_Read; for Constant_Reference_Type'Write use Streaming.Missing_Write; for Reference_Type'Read use Streaming.Missing_Read; for Reference_Type'Write use Streaming.Missing_Write; end Ada.Containers.Vectors;
reznikmm/matreshka
Ada
4,133
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Fo_Hyphenation_Remain_Char_Count_Attributes; package Matreshka.ODF_Fo.Hyphenation_Remain_Char_Count_Attributes is type Fo_Hyphenation_Remain_Char_Count_Attribute_Node is new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node and ODF.DOM.Fo_Hyphenation_Remain_Char_Count_Attributes.ODF_Fo_Hyphenation_Remain_Char_Count_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Fo_Hyphenation_Remain_Char_Count_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Fo_Hyphenation_Remain_Char_Count_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Fo.Hyphenation_Remain_Char_Count_Attributes;
reznikmm/matreshka
Ada
4,017
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Stream_Element_Vectors; with League.Strings; with Web_Socket.Listeners; package Web_Socket.Connections is pragma Preelaborate; type Connection is limited interface; not overriding procedure Set_Web_Socket_Listener (Self : in out Connection; Listener : not null Web_Socket.Listeners.Web_Socket_Listener_Access) is abstract; not overriding procedure Send_Text (Self : in out Connection; Text : League.Strings.Universal_String) is abstract; not overriding procedure Send_Binary (Self : in out Connection; Data : League.Stream_Element_Vectors.Stream_Element_Vector) is abstract; end Web_Socket.Connections;
reznikmm/matreshka
Ada
4,011
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.Style_List_Level_Attributes; package Matreshka.ODF_Style.List_Level_Attributes is type Style_List_Level_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_List_Level_Attributes.ODF_Style_List_Level_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_List_Level_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_List_Level_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.List_Level_Attributes;
optikos/oasis
Ada
4,295
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Formal_Signed_Integer_Type_Definitions is function Create (Range_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return Formal_Signed_Integer_Type_Definition is begin return Result : Formal_Signed_Integer_Type_Definition := (Range_Token => Range_Token, Box_Token => Box_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Formal_Signed_Integer_Type_Definition is begin return Result : Implicit_Formal_Signed_Integer_Type_Definition := (Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Range_Token (Self : Formal_Signed_Integer_Type_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Range_Token; end Range_Token; overriding function Box_Token (Self : Formal_Signed_Integer_Type_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Box_Token; end Box_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Formal_Signed_Integer_Type_Definition) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Formal_Signed_Integer_Type_Definition) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Formal_Signed_Integer_Type_Definition) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Formal_Signed_Integer_Type_Definition'Class) is begin null; end Initialize; overriding function Is_Formal_Signed_Integer_Type_Definition_Element (Self : Base_Formal_Signed_Integer_Type_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Signed_Integer_Type_Definition_Element; overriding function Is_Formal_Type_Definition_Element (Self : Base_Formal_Signed_Integer_Type_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Type_Definition_Element; overriding function Is_Definition_Element (Self : Base_Formal_Signed_Integer_Type_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition_Element; overriding procedure Visit (Self : not null access Base_Formal_Signed_Integer_Type_Definition; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Formal_Signed_Integer_Type_Definition (Self); end Visit; overriding function To_Formal_Signed_Integer_Type_Definition_Text (Self : aliased in out Formal_Signed_Integer_Type_Definition) return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Text_Access is begin return Self'Unchecked_Access; end To_Formal_Signed_Integer_Type_Definition_Text; overriding function To_Formal_Signed_Integer_Type_Definition_Text (Self : aliased in out Implicit_Formal_Signed_Integer_Type_Definition) return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Text_Access is pragma Unreferenced (Self); begin return null; end To_Formal_Signed_Integer_Type_Definition_Text; end Program.Nodes.Formal_Signed_Integer_Type_Definitions;
AdaCore/training_material
Ada
53,505
adb
with Interfaces; use Interfaces; with Interfaces.C; use Interfaces.C; with SDL_video_h; use SDL_video_h; with SDL_pixels_h; use SDL_pixels_h; package body Display.Basic.Fonts is type Byte is new Interfaces.Unsigned_8; -- for shift/rotate type Half_Word is new Interfaces.Unsigned_16; -- for shift/rotate BMP_Font16x24 : constant array (0 .. 2279) of Half_Word := (16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#00CC#, 16#00CC#, 16#00CC#, 16#00CC#, 16#00CC#, 16#00CC#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0C60#, 16#0C60#, 16#0C60#, 16#0630#, 16#0630#, 16#1FFE#, 16#1FFE#, 16#0630#, 16#0738#, 16#0318#, 16#1FFE#, 16#1FFE#, 16#0318#, 16#0318#, 16#018C#, 16#018C#, 16#018C#, 16#0000#, 16#0000#, 16#0080#, 16#03E0#, 16#0FF8#, 16#0E9C#, 16#1C8C#, 16#188C#, 16#008C#, 16#0098#, 16#01F8#, 16#07E0#, 16#0E80#, 16#1C80#, 16#188C#, 16#188C#, 16#189C#, 16#0CB8#, 16#0FF0#, 16#03E0#, 16#0080#, 16#0080#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#180E#, 16#0C1B#, 16#0C11#, 16#0611#, 16#0611#, 16#0311#, 16#0311#, 16#019B#, 16#018E#, 16#38C0#, 16#6CC0#, 16#4460#, 16#4460#, 16#4430#, 16#4430#, 16#4418#, 16#6C18#, 16#380C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#01E0#, 16#03F0#, 16#0738#, 16#0618#, 16#0618#, 16#0330#, 16#01F0#, 16#00F0#, 16#00F8#, 16#319C#, 16#330E#, 16#1E06#, 16#1C06#, 16#1C06#, 16#3F06#, 16#73FC#, 16#21F0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0200#, 16#0300#, 16#0180#, 16#00C0#, 16#00C0#, 16#0060#, 16#0060#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0060#, 16#0060#, 16#00C0#, 16#00C0#, 16#0180#, 16#0300#, 16#0200#, 16#0000#, 16#0000#, 16#0020#, 16#0060#, 16#00C0#, 16#0180#, 16#0180#, 16#0300#, 16#0300#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0300#, 16#0300#, 16#0180#, 16#0180#, 16#00C0#, 16#0060#, 16#0020#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#06D8#, 16#07F8#, 16#01E0#, 16#0330#, 16#0738#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#3FFC#, 16#3FFC#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0100#, 16#0100#, 16#0080#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07E0#, 16#07E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0C00#, 16#0C00#, 16#0600#, 16#0600#, 16#0600#, 16#0300#, 16#0300#, 16#0300#, 16#0380#, 16#0180#, 16#0180#, 16#0180#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0060#, 16#0060#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#07F0#, 16#0E38#, 16#0C18#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#0C18#, 16#0E38#, 16#07F0#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0100#, 16#0180#, 16#01C0#, 16#01F0#, 16#0198#, 16#0188#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#0FF8#, 16#0C18#, 16#180C#, 16#180C#, 16#1800#, 16#1800#, 16#0C00#, 16#0600#, 16#0300#, 16#0180#, 16#00C0#, 16#0060#, 16#0030#, 16#0018#, 16#1FFC#, 16#1FFC#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#01E0#, 16#07F8#, 16#0E18#, 16#0C0C#, 16#0C0C#, 16#0C00#, 16#0600#, 16#03C0#, 16#07C0#, 16#0C00#, 16#1800#, 16#1800#, 16#180C#, 16#180C#, 16#0C18#, 16#07F8#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0C00#, 16#0E00#, 16#0F00#, 16#0F00#, 16#0D80#, 16#0CC0#, 16#0C60#, 16#0C60#, 16#0C30#, 16#0C18#, 16#0C0C#, 16#3FFC#, 16#3FFC#, 16#0C00#, 16#0C00#, 16#0C00#, 16#0C00#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0FF8#, 16#0FF8#, 16#0018#, 16#0018#, 16#000C#, 16#03EC#, 16#07FC#, 16#0E1C#, 16#1C00#, 16#1800#, 16#1800#, 16#1800#, 16#180C#, 16#0C1C#, 16#0E18#, 16#07F8#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07C0#, 16#0FF0#, 16#1C38#, 16#1818#, 16#0018#, 16#000C#, 16#03CC#, 16#0FEC#, 16#0E3C#, 16#1C1C#, 16#180C#, 16#180C#, 16#180C#, 16#1C18#, 16#0E38#, 16#07F0#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1FFC#, 16#1FFC#, 16#0C00#, 16#0600#, 16#0600#, 16#0300#, 16#0380#, 16#0180#, 16#01C0#, 16#00C0#, 16#00E0#, 16#0060#, 16#0060#, 16#0070#, 16#0030#, 16#0030#, 16#0030#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#07F0#, 16#0E38#, 16#0C18#, 16#0C18#, 16#0C18#, 16#0638#, 16#07F0#, 16#07F0#, 16#0C18#, 16#180C#, 16#180C#, 16#180C#, 16#180C#, 16#0C38#, 16#0FF8#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#07F0#, 16#0E38#, 16#0C1C#, 16#180C#, 16#180C#, 16#180C#, 16#1C1C#, 16#1E38#, 16#1BF8#, 16#19E0#, 16#1800#, 16#0C00#, 16#0C00#, 16#0E1C#, 16#07F8#, 16#01F0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0100#, 16#0100#, 16#0080#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#1C00#, 16#0F80#, 16#03E0#, 16#00F8#, 16#0018#, 16#00F8#, 16#03E0#, 16#0F80#, 16#1C00#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1FF8#, 16#0000#, 16#0000#, 16#0000#, 16#1FF8#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0008#, 16#0038#, 16#01F0#, 16#07C0#, 16#1F00#, 16#1800#, 16#1F00#, 16#07C0#, 16#01F0#, 16#0038#, 16#0008#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#0FF8#, 16#0C18#, 16#180C#, 16#180C#, 16#1800#, 16#0C00#, 16#0600#, 16#0300#, 16#0180#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07E0#, 16#1818#, 16#2004#, 16#29C2#, 16#4A22#, 16#4411#, 16#4409#, 16#4409#, 16#4409#, 16#2209#, 16#1311#, 16#0CE2#, 16#4002#, 16#2004#, 16#1818#, 16#07E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0380#, 16#0380#, 16#06C0#, 16#06C0#, 16#06C0#, 16#0C60#, 16#0C60#, 16#1830#, 16#1830#, 16#1830#, 16#3FF8#, 16#3FF8#, 16#701C#, 16#600C#, 16#600C#, 16#C006#, 16#C006#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03FC#, 16#0FFC#, 16#0C0C#, 16#180C#, 16#180C#, 16#180C#, 16#0C0C#, 16#07FC#, 16#0FFC#, 16#180C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#180C#, 16#1FFC#, 16#07FC#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07C0#, 16#1FF0#, 16#3838#, 16#301C#, 16#700C#, 16#6006#, 16#0006#, 16#0006#, 16#0006#, 16#0006#, 16#0006#, 16#0006#, 16#6006#, 16#700C#, 16#301C#, 16#1FF0#, 16#07E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03FE#, 16#0FFE#, 16#0E06#, 16#1806#, 16#1806#, 16#3006#, 16#3006#, 16#3006#, 16#3006#, 16#3006#, 16#3006#, 16#3006#, 16#1806#, 16#1806#, 16#0E06#, 16#0FFE#, 16#03FE#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3FFC#, 16#3FFC#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#1FFC#, 16#1FFC#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#3FFC#, 16#3FFC#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3FF8#, 16#3FF8#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#1FF8#, 16#1FF8#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0FE0#, 16#3FF8#, 16#783C#, 16#600E#, 16#E006#, 16#C007#, 16#0003#, 16#0003#, 16#FE03#, 16#FE03#, 16#C003#, 16#C007#, 16#C006#, 16#C00E#, 16#F03C#, 16#3FF8#, 16#0FE0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#3FFC#, 16#3FFC#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0600#, 16#0618#, 16#0618#, 16#0738#, 16#03F0#, 16#01E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3006#, 16#1806#, 16#0C06#, 16#0606#, 16#0306#, 16#0186#, 16#00C6#, 16#0066#, 16#0076#, 16#00DE#, 16#018E#, 16#0306#, 16#0606#, 16#0C06#, 16#1806#, 16#3006#, 16#6006#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#1FF8#, 16#1FF8#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#E00E#, 16#F01E#, 16#F01E#, 16#F01E#, 16#D836#, 16#D836#, 16#D836#, 16#D836#, 16#CC66#, 16#CC66#, 16#CC66#, 16#C6C6#, 16#C6C6#, 16#C6C6#, 16#C6C6#, 16#C386#, 16#C386#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#300C#, 16#301C#, 16#303C#, 16#303C#, 16#306C#, 16#306C#, 16#30CC#, 16#30CC#, 16#318C#, 16#330C#, 16#330C#, 16#360C#, 16#360C#, 16#3C0C#, 16#3C0C#, 16#380C#, 16#300C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07E0#, 16#1FF8#, 16#381C#, 16#700E#, 16#6006#, 16#C003#, 16#C003#, 16#C003#, 16#C003#, 16#C003#, 16#C003#, 16#C003#, 16#6006#, 16#700E#, 16#381C#, 16#1FF8#, 16#07E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0FFC#, 16#1FFC#, 16#380C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#180C#, 16#1FFC#, 16#07FC#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07E0#, 16#1FF8#, 16#381C#, 16#700E#, 16#6006#, 16#E003#, 16#C003#, 16#C003#, 16#C003#, 16#C003#, 16#C003#, 16#E007#, 16#6306#, 16#3F0E#, 16#3C1C#, 16#3FF8#, 16#F7E0#, 16#C000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0FFE#, 16#1FFE#, 16#3806#, 16#3006#, 16#3006#, 16#3006#, 16#3806#, 16#1FFE#, 16#07FE#, 16#0306#, 16#0606#, 16#0C06#, 16#1806#, 16#1806#, 16#3006#, 16#3006#, 16#6006#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#0FF8#, 16#0C1C#, 16#180C#, 16#180C#, 16#000C#, 16#001C#, 16#03F8#, 16#0FE0#, 16#1E00#, 16#3800#, 16#3006#, 16#3006#, 16#300E#, 16#1C1C#, 16#0FF8#, 16#07E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7FFE#, 16#7FFE#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#300C#, 16#1818#, 16#1FF8#, 16#07E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#6003#, 16#3006#, 16#3006#, 16#3006#, 16#180C#, 16#180C#, 16#180C#, 16#0C18#, 16#0C18#, 16#0E38#, 16#0630#, 16#0630#, 16#0770#, 16#0360#, 16#0360#, 16#01C0#, 16#01C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#6003#, 16#61C3#, 16#61C3#, 16#61C3#, 16#3366#, 16#3366#, 16#3366#, 16#3366#, 16#3366#, 16#3366#, 16#1B6C#, 16#1B6C#, 16#1B6C#, 16#1A2C#, 16#1E3C#, 16#0E38#, 16#0E38#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#E00F#, 16#700C#, 16#3018#, 16#1830#, 16#0C70#, 16#0E60#, 16#07C0#, 16#0380#, 16#0380#, 16#03C0#, 16#06E0#, 16#0C70#, 16#1C30#, 16#1818#, 16#300C#, 16#600E#, 16#E007#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#C003#, 16#6006#, 16#300C#, 16#381C#, 16#1838#, 16#0C30#, 16#0660#, 16#07E0#, 16#03C0#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7FFC#, 16#7FFC#, 16#6000#, 16#3000#, 16#1800#, 16#0C00#, 16#0600#, 16#0300#, 16#0180#, 16#00C0#, 16#0060#, 16#0030#, 16#0018#, 16#000C#, 16#0006#, 16#7FFE#, 16#7FFE#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#03E0#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#0060#, 16#03E0#, 16#03E0#, 16#0000#, 16#0000#, 16#0030#, 16#0030#, 16#0060#, 16#0060#, 16#0060#, 16#00C0#, 16#00C0#, 16#00C0#, 16#01C0#, 16#0180#, 16#0180#, 16#0180#, 16#0300#, 16#0300#, 16#0300#, 16#0600#, 16#0600#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#03E0#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#0300#, 16#03E0#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#01C0#, 16#01C0#, 16#0360#, 16#0360#, 16#0360#, 16#0630#, 16#0630#, 16#0C18#, 16#0C18#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#FFFF#, 16#FFFF#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03F0#, 16#07F8#, 16#0C1C#, 16#0C0C#, 16#0F00#, 16#0FF0#, 16#0CF8#, 16#0C0C#, 16#0C0C#, 16#0F1C#, 16#0FF8#, 16#18F0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#03D8#, 16#0FF8#, 16#0C38#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#0C38#, 16#0FF8#, 16#03D8#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03C0#, 16#07F0#, 16#0E30#, 16#0C18#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0C18#, 16#0E30#, 16#07F0#, 16#03C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1800#, 16#1800#, 16#1800#, 16#1800#, 16#1800#, 16#1BC0#, 16#1FF0#, 16#1C30#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1C30#, 16#1FF0#, 16#1BC0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03C0#, 16#0FF0#, 16#0C30#, 16#1818#, 16#1FF8#, 16#1FF8#, 16#0018#, 16#0018#, 16#1838#, 16#1C30#, 16#0FF0#, 16#07C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0F80#, 16#0FC0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#07F0#, 16#07F0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0DE0#, 16#0FF8#, 16#0E18#, 16#0C0C#, 16#0C0C#, 16#0C0C#, 16#0C0C#, 16#0C0C#, 16#0C0C#, 16#0E18#, 16#0FF8#, 16#0DE0#, 16#0C00#, 16#0C0C#, 16#061C#, 16#07F8#, 16#01F0#, 16#0000#, 16#0000#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#07D8#, 16#0FF8#, 16#1C38#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00F8#, 16#0078#, 16#0000#, 16#0000#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#000C#, 16#0C0C#, 16#060C#, 16#030C#, 16#018C#, 16#00CC#, 16#006C#, 16#00FC#, 16#019C#, 16#038C#, 16#030C#, 16#060C#, 16#0C0C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3C7C#, 16#7EFF#, 16#E3C7#, 16#C183#, 16#C183#, 16#C183#, 16#C183#, 16#C183#, 16#C183#, 16#C183#, 16#C183#, 16#C183#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0798#, 16#0FF8#, 16#1C38#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03C0#, 16#0FF0#, 16#0C30#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#0C30#, 16#0FF0#, 16#03C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03D8#, 16#0FF8#, 16#0C38#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#0C38#, 16#0FF8#, 16#03D8#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0018#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1BC0#, 16#1FF0#, 16#1C30#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1C30#, 16#1FF0#, 16#1BC0#, 16#1800#, 16#1800#, 16#1800#, 16#1800#, 16#1800#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#07B0#, 16#03F0#, 16#0070#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0030#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#03E0#, 16#03F0#, 16#0E38#, 16#0C18#, 16#0038#, 16#03F0#, 16#07C0#, 16#0C00#, 16#0C18#, 16#0E38#, 16#07F0#, 16#03E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0080#, 16#00C0#, 16#00C0#, 16#00C0#, 16#07F0#, 16#07F0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#07C0#, 16#0780#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1818#, 16#1C38#, 16#1FF0#, 16#19E0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#180C#, 16#0C18#, 16#0C18#, 16#0C18#, 16#0630#, 16#0630#, 16#0630#, 16#0360#, 16#0360#, 16#0360#, 16#01C0#, 16#01C0#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#41C1#, 16#41C1#, 16#61C3#, 16#6363#, 16#6363#, 16#6363#, 16#3636#, 16#3636#, 16#3636#, 16#1C1C#, 16#1C1C#, 16#1C1C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#381C#, 16#1C38#, 16#0C30#, 16#0660#, 16#0360#, 16#0360#, 16#0360#, 16#0360#, 16#0660#, 16#0C30#, 16#1C38#, 16#381C#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3018#, 16#1830#, 16#1830#, 16#1870#, 16#0C60#, 16#0C60#, 16#0CE0#, 16#06C0#, 16#06C0#, 16#0380#, 16#0380#, 16#0380#, 16#0180#, 16#0180#, 16#01C0#, 16#00F0#, 16#0070#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#1FFC#, 16#1FFC#, 16#0C00#, 16#0600#, 16#0300#, 16#0180#, 16#00C0#, 16#0060#, 16#0030#, 16#0018#, 16#1FFC#, 16#1FFC#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0300#, 16#0180#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0060#, 16#0060#, 16#0030#, 16#0060#, 16#0040#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#00C0#, 16#0180#, 16#0300#, 16#0000#, 16#0000#, 16#0000#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0000#, 16#0000#, 16#0060#, 16#00C0#, 16#01C0#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0300#, 16#0300#, 16#0600#, 16#0300#, 16#0100#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#0180#, 16#00C0#, 16#0060#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#10F0#, 16#1FF8#, 16#0F08#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#); BMP_Font12x12 : constant array (0 .. 1151) of Half_Word := (16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#5000#, 16#5000#, 16#5000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0900#, 16#0900#, 16#1200#, 16#7f00#, 16#1200#, 16#7f00#, 16#1200#, 16#2400#, 16#2400#, 16#0000#, 16#0000#, 16#1000#, 16#3800#, 16#5400#, 16#5000#, 16#5000#, 16#3800#, 16#1400#, 16#5400#, 16#5400#, 16#3800#, 16#1000#, 16#0000#, 16#0000#, 16#3080#, 16#4900#, 16#4900#, 16#4a00#, 16#32c0#, 16#0520#, 16#0920#, 16#0920#, 16#10c0#, 16#0000#, 16#0000#, 16#0000#, 16#0c00#, 16#1200#, 16#1200#, 16#1400#, 16#1800#, 16#2500#, 16#2300#, 16#2300#, 16#1d80#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0800#, 16#1000#, 16#1000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#1000#, 16#1000#, 16#0000#, 16#4000#, 16#2000#, 16#2000#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#2000#, 16#2000#, 16#0000#, 16#2000#, 16#7000#, 16#2000#, 16#5000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0800#, 16#0800#, 16#7f00#, 16#0800#, 16#0800#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#2000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#1000#, 16#1000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#2800#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#2800#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#3000#, 16#5000#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#3000#, 16#4800#, 16#4400#, 16#0400#, 16#0800#, 16#1000#, 16#2000#, 16#4000#, 16#7c00#, 16#0000#, 16#0000#, 16#0000#, 16#3000#, 16#4800#, 16#0400#, 16#0800#, 16#1000#, 16#0800#, 16#4400#, 16#4800#, 16#3000#, 16#0000#, 16#0000#, 16#0000#, 16#0800#, 16#1800#, 16#1800#, 16#2800#, 16#2800#, 16#4800#, 16#7c00#, 16#0800#, 16#0800#, 16#0000#, 16#0000#, 16#0000#, 16#3c00#, 16#2000#, 16#4000#, 16#7000#, 16#4800#, 16#0400#, 16#4400#, 16#4800#, 16#3000#, 16#0000#, 16#0000#, 16#0000#, 16#1800#, 16#2400#, 16#4000#, 16#5000#, 16#6800#, 16#4400#, 16#4400#, 16#2800#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#7c00#, 16#0400#, 16#0800#, 16#1000#, 16#1000#, 16#1000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#2800#, 16#4400#, 16#2800#, 16#1000#, 16#2800#, 16#4400#, 16#2800#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#2800#, 16#4400#, 16#4400#, 16#2c00#, 16#1400#, 16#0400#, 16#4800#, 16#3000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#2000#, 16#4000#, 16#0000#, 16#0000#, 16#0400#, 16#0800#, 16#3000#, 16#4000#, 16#3000#, 16#0800#, 16#0400#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7c00#, 16#0000#, 16#0000#, 16#7c00#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#2000#, 16#1800#, 16#0400#, 16#1800#, 16#2000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3800#, 16#6400#, 16#4400#, 16#0400#, 16#0800#, 16#1000#, 16#1000#, 16#0000#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#0f80#, 16#1040#, 16#2ea0#, 16#51a0#, 16#5120#, 16#5120#, 16#5120#, 16#5320#, 16#4dc0#, 16#2020#, 16#1040#, 16#0000#, 16#0800#, 16#1400#, 16#1400#, 16#1400#, 16#2200#, 16#3e00#, 16#2200#, 16#4100#, 16#4100#, 16#0000#, 16#0000#, 16#0000#, 16#3c00#, 16#2200#, 16#2200#, 16#2200#, 16#3c00#, 16#2200#, 16#2200#, 16#2200#, 16#3c00#, 16#0000#, 16#0000#, 16#0000#, 16#0e00#, 16#1100#, 16#2100#, 16#2000#, 16#2000#, 16#2000#, 16#2100#, 16#1100#, 16#0e00#, 16#0000#, 16#0000#, 16#0000#, 16#3c00#, 16#2200#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2200#, 16#3c00#, 16#0000#, 16#0000#, 16#0000#, 16#3e00#, 16#2000#, 16#2000#, 16#2000#, 16#3e00#, 16#2000#, 16#2000#, 16#2000#, 16#3e00#, 16#0000#, 16#0000#, 16#0000#, 16#3e00#, 16#2000#, 16#2000#, 16#2000#, 16#3c00#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0e00#, 16#1100#, 16#2100#, 16#2000#, 16#2700#, 16#2100#, 16#2100#, 16#1100#, 16#0e00#, 16#0000#, 16#0000#, 16#0000#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#3f00#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#4800#, 16#4800#, 16#3000#, 16#0000#, 16#0000#, 16#0000#, 16#2200#, 16#2400#, 16#2800#, 16#2800#, 16#3800#, 16#2800#, 16#2400#, 16#2400#, 16#2200#, 16#0000#, 16#0000#, 16#0000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#3e00#, 16#0000#, 16#0000#, 16#0000#, 16#2080#, 16#3180#, 16#3180#, 16#3180#, 16#2a80#, 16#2a80#, 16#2a80#, 16#2a80#, 16#2480#, 16#0000#, 16#0000#, 16#0000#, 16#2100#, 16#3100#, 16#3100#, 16#2900#, 16#2900#, 16#2500#, 16#2300#, 16#2300#, 16#2100#, 16#0000#, 16#0000#, 16#0000#, 16#0c00#, 16#1200#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#1200#, 16#0c00#, 16#0000#, 16#0000#, 16#0000#, 16#3c00#, 16#2200#, 16#2200#, 16#2200#, 16#3c00#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0c00#, 16#1200#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#1600#, 16#0d00#, 16#0100#, 16#0000#, 16#0000#, 16#3e00#, 16#2100#, 16#2100#, 16#2100#, 16#3e00#, 16#2400#, 16#2200#, 16#2100#, 16#2080#, 16#0000#, 16#0000#, 16#0000#, 16#1c00#, 16#2200#, 16#2200#, 16#2000#, 16#1c00#, 16#0200#, 16#2200#, 16#2200#, 16#1c00#, 16#0000#, 16#0000#, 16#0000#, 16#3e00#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0000#, 16#0000#, 16#0000#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#2100#, 16#1200#, 16#0c00#, 16#0000#, 16#0000#, 16#0000#, 16#4100#, 16#4100#, 16#2200#, 16#2200#, 16#2200#, 16#1400#, 16#1400#, 16#1400#, 16#0800#, 16#0000#, 16#0000#, 16#0000#, 16#4440#, 16#4a40#, 16#2a40#, 16#2a80#, 16#2a80#, 16#2a80#, 16#2a80#, 16#2a80#, 16#1100#, 16#0000#, 16#0000#, 16#0000#, 16#4100#, 16#2200#, 16#1400#, 16#1400#, 16#0800#, 16#1400#, 16#1400#, 16#2200#, 16#4100#, 16#0000#, 16#0000#, 16#0000#, 16#4100#, 16#2200#, 16#2200#, 16#1400#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0800#, 16#0000#, 16#0000#, 16#0000#, 16#7e00#, 16#0200#, 16#0400#, 16#0800#, 16#1000#, 16#1000#, 16#2000#, 16#4000#, 16#7e00#, 16#0000#, 16#0000#, 16#0000#, 16#3000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#4000#, 16#4000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#1000#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#6000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#1000#, 16#2800#, 16#2800#, 16#2800#, 16#4400#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7e00#, 16#4000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3800#, 16#4400#, 16#0400#, 16#3c00#, 16#4400#, 16#4400#, 16#3c00#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#4000#, 16#5800#, 16#6400#, 16#4400#, 16#4400#, 16#4400#, 16#6400#, 16#5800#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3000#, 16#4800#, 16#4000#, 16#4000#, 16#4000#, 16#4800#, 16#3000#, 16#0000#, 16#0000#, 16#0000#, 16#0400#, 16#0400#, 16#3400#, 16#4c00#, 16#4400#, 16#4400#, 16#4400#, 16#4c00#, 16#3400#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3800#, 16#4400#, 16#4400#, 16#7c00#, 16#4000#, 16#4400#, 16#3800#, 16#0000#, 16#0000#, 16#0000#, 16#6000#, 16#4000#, 16#e000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3400#, 16#4c00#, 16#4400#, 16#4400#, 16#4400#, 16#4c00#, 16#3400#, 16#0400#, 16#4400#, 16#0000#, 16#4000#, 16#4000#, 16#5800#, 16#6400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#0000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#0000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#0000#, 16#4000#, 16#4000#, 16#4800#, 16#5000#, 16#6000#, 16#5000#, 16#5000#, 16#4800#, 16#4800#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#5200#, 16#6d00#, 16#4900#, 16#4900#, 16#4900#, 16#4900#, 16#4900#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#5800#, 16#6400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3800#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#3800#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#5800#, 16#6400#, 16#4400#, 16#4400#, 16#4400#, 16#6400#, 16#5800#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#3400#, 16#4c00#, 16#4400#, 16#4400#, 16#4400#, 16#4c00#, 16#3400#, 16#0400#, 16#0400#, 16#0000#, 16#0000#, 16#0000#, 16#5000#, 16#6000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#3000#, 16#4800#, 16#4000#, 16#3000#, 16#0800#, 16#4800#, 16#3000#, 16#0000#, 16#0000#, 16#0000#, 16#4000#, 16#4000#, 16#e000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#4000#, 16#6000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#4400#, 16#4c00#, 16#3400#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#4400#, 16#4400#, 16#2800#, 16#2800#, 16#2800#, 16#2800#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#4900#, 16#4900#, 16#5500#, 16#5500#, 16#5500#, 16#5500#, 16#2200#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#4400#, 16#2800#, 16#2800#, 16#1000#, 16#2800#, 16#2800#, 16#4400#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#4400#, 16#4400#, 16#2800#, 16#2800#, 16#2800#, 16#1000#, 16#1000#, 16#1000#, 16#1000#, 16#0000#, 16#0000#, 16#0000#, 16#7800#, 16#0800#, 16#1000#, 16#2000#, 16#2000#, 16#4000#, 16#7800#, 16#0000#, 16#0000#, 16#0000#, 16#1000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#4000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#4000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#1000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#2000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7400#, 16#5800#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#0000#, 16#7000#, 16#5000#, 16#5000#, 16#5000#, 16#5000#, 16#5000#, 16#5000#, 16#7000#, 16#0000#, 16#0000#); BMP_Font8x8 : constant array (0 .. 767) of Byte := (16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#40#, 16#40#, 16#40#, 16#40#, 16#40#, 16#00#, 16#40#, 16#a0#, 16#a0#, 16#a0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#24#, 16#24#, 16#fe#, 16#48#, 16#fc#, 16#48#, 16#48#, 16#38#, 16#54#, 16#50#, 16#38#, 16#14#, 16#14#, 16#54#, 16#38#, 16#44#, 16#a8#, 16#a8#, 16#50#, 16#14#, 16#1a#, 16#2a#, 16#24#, 16#10#, 16#28#, 16#28#, 16#10#, 16#74#, 16#4c#, 16#4c#, 16#30#, 16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#08#, 16#10#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#10#, 16#00#, 16#00#, 16#24#, 16#18#, 16#3c#, 16#18#, 16#24#, 16#00#, 16#00#, 16#00#, 16#10#, 16#10#, 16#7c#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#08#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3c#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#18#, 16#08#, 16#08#, 16#08#, 16#10#, 16#10#, 16#20#, 16#20#, 16#20#, 16#18#, 16#24#, 16#24#, 16#24#, 16#24#, 16#24#, 16#24#, 16#18#, 16#08#, 16#18#, 16#28#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#38#, 16#44#, 16#00#, 16#04#, 16#08#, 16#10#, 16#20#, 16#7c#, 16#18#, 16#24#, 16#04#, 16#18#, 16#04#, 16#04#, 16#24#, 16#18#, 16#04#, 16#0c#, 16#14#, 16#24#, 16#44#, 16#7e#, 16#04#, 16#04#, 16#3c#, 16#20#, 16#20#, 16#38#, 16#04#, 16#04#, 16#24#, 16#18#, 16#18#, 16#24#, 16#20#, 16#38#, 16#24#, 16#24#, 16#24#, 16#18#, 16#3c#, 16#04#, 16#08#, 16#08#, 16#08#, 16#10#, 16#10#, 16#10#, 16#18#, 16#24#, 16#24#, 16#18#, 16#24#, 16#24#, 16#24#, 16#18#, 16#18#, 16#24#, 16#24#, 16#24#, 16#1c#, 16#04#, 16#24#, 16#18#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#08#, 16#10#, 16#00#, 16#00#, 16#00#, 16#04#, 16#18#, 16#20#, 16#18#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#18#, 16#04#, 16#18#, 16#20#, 16#00#, 16#18#, 16#24#, 16#04#, 16#08#, 16#10#, 16#10#, 16#00#, 16#10#, 16#3c#, 16#42#, 16#99#, 16#a5#, 16#a5#, 16#9d#, 16#42#, 16#38#, 16#38#, 16#44#, 16#44#, 16#44#, 16#7c#, 16#44#, 16#44#, 16#44#, 16#78#, 16#44#, 16#44#, 16#78#, 16#44#, 16#44#, 16#44#, 16#78#, 16#1c#, 16#22#, 16#42#, 16#40#, 16#40#, 16#42#, 16#22#, 16#1c#, 16#70#, 16#48#, 16#44#, 16#44#, 16#44#, 16#44#, 16#48#, 16#70#, 16#7c#, 16#40#, 16#40#, 16#7c#, 16#40#, 16#40#, 16#40#, 16#7c#, 16#3c#, 16#20#, 16#20#, 16#38#, 16#20#, 16#20#, 16#20#, 16#20#, 16#1c#, 16#22#, 16#42#, 16#40#, 16#4e#, 16#42#, 16#22#, 16#1c#, 16#44#, 16#44#, 16#44#, 16#7c#, 16#44#, 16#44#, 16#44#, 16#44#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#24#, 16#24#, 16#18#, 16#44#, 16#48#, 16#50#, 16#70#, 16#50#, 16#48#, 16#48#, 16#44#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#3c#, 16#82#, 16#c6#, 16#c6#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#92#, 16#42#, 16#62#, 16#52#, 16#52#, 16#4a#, 16#4a#, 16#46#, 16#42#, 16#18#, 16#24#, 16#42#, 16#42#, 16#42#, 16#42#, 16#24#, 16#18#, 16#78#, 16#44#, 16#44#, 16#44#, 16#78#, 16#40#, 16#40#, 16#40#, 16#18#, 16#24#, 16#42#, 16#42#, 16#42#, 16#42#, 16#2c#, 16#1a#, 16#78#, 16#44#, 16#44#, 16#78#, 16#50#, 16#48#, 16#44#, 16#42#, 16#38#, 16#44#, 16#40#, 16#38#, 16#04#, 16#44#, 16#44#, 16#38#, 16#7c#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#42#, 16#42#, 16#42#, 16#42#, 16#42#, 16#42#, 16#24#, 16#18#, 16#44#, 16#44#, 16#28#, 16#28#, 16#28#, 16#28#, 16#28#, 16#10#, 16#92#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#44#, 16#42#, 16#24#, 16#24#, 16#18#, 16#18#, 16#24#, 16#24#, 16#42#, 16#44#, 16#28#, 16#28#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#7c#, 16#04#, 16#08#, 16#10#, 16#10#, 16#20#, 16#40#, 16#7c#, 16#1c#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#1c#, 16#10#, 16#10#, 16#08#, 16#08#, 16#08#, 16#08#, 16#04#, 16#04#, 16#1c#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#1c#, 16#10#, 16#28#, 16#44#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#04#, 16#1c#, 16#24#, 16#24#, 16#1c#, 16#20#, 16#20#, 16#28#, 16#34#, 16#24#, 16#24#, 16#34#, 16#28#, 16#00#, 16#00#, 16#18#, 16#24#, 16#20#, 16#20#, 16#24#, 16#18#, 16#04#, 16#04#, 16#14#, 16#2c#, 16#24#, 16#24#, 16#2c#, 16#14#, 16#00#, 16#00#, 16#18#, 16#24#, 16#3c#, 16#20#, 16#24#, 16#18#, 16#00#, 16#18#, 16#10#, 16#10#, 16#18#, 16#10#, 16#10#, 16#10#, 16#00#, 16#18#, 16#24#, 16#24#, 16#18#, 16#04#, 16#24#, 16#18#, 16#20#, 16#20#, 16#28#, 16#34#, 16#24#, 16#24#, 16#24#, 16#24#, 16#10#, 16#00#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#08#, 16#00#, 16#08#, 16#08#, 16#08#, 16#08#, 16#28#, 16#10#, 16#20#, 16#20#, 16#24#, 16#28#, 16#30#, 16#28#, 16#24#, 16#24#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#a6#, 16#da#, 16#92#, 16#92#, 16#92#, 16#92#, 16#00#, 16#00#, 16#28#, 16#34#, 16#24#, 16#24#, 16#24#, 16#24#, 16#00#, 16#00#, 16#18#, 16#24#, 16#24#, 16#24#, 16#24#, 16#18#, 16#00#, 16#28#, 16#34#, 16#24#, 16#38#, 16#20#, 16#20#, 16#20#, 16#00#, 16#14#, 16#2c#, 16#24#, 16#1c#, 16#04#, 16#04#, 16#04#, 16#00#, 16#00#, 16#2c#, 16#30#, 16#20#, 16#20#, 16#20#, 16#20#, 16#00#, 16#00#, 16#18#, 16#24#, 16#10#, 16#08#, 16#24#, 16#18#, 16#00#, 16#10#, 16#38#, 16#10#, 16#10#, 16#10#, 16#10#, 16#18#, 16#00#, 16#00#, 16#24#, 16#24#, 16#24#, 16#24#, 16#2c#, 16#14#, 16#00#, 16#00#, 16#44#, 16#44#, 16#28#, 16#28#, 16#28#, 16#10#, 16#00#, 16#00#, 16#92#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#44#, 16#00#, 16#00#, 16#44#, 16#28#, 16#10#, 16#10#, 16#28#, 16#44#, 16#00#, 16#28#, 16#28#, 16#28#, 16#10#, 16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#3c#, 16#04#, 16#08#, 16#10#, 16#20#, 16#3c#, 16#00#, 16#08#, 16#10#, 16#10#, 16#20#, 16#10#, 16#10#, 16#08#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#00#, 16#10#, 16#08#, 16#08#, 16#04#, 16#08#, 16#08#, 16#10#, 16#00#, 16#00#, 16#00#, 16#60#, 16#92#, 16#0c#, 16#00#, 16#00#, 16#ff#, 16#ff#, 16#ff#, 16#ff#, 16#ff#, 16#ff#, 16#ff#, 16#ff#); ------------------- -- Draw_Char_8x8 -- ------------------- procedure Draw_Char_8x8 (S : access SDL_Surface; P : Screen_Point; Char : Character; FG, BG : Uint32; BG_Transparent : Boolean := False) is Char_Index : constant Natural := (Character'Pos (Char) - 32) * 8; begin -- Character outside screen if P.X > Integer(S.w - 8) or else P.Y > Integer(S.h - 8) then return; end if; for H in 0 .. 7 loop for W in 0 .. 7 loop if (BMP_Font8x8 (Char_Index + H) and (2**(8 - W))) /= 0 then Put_Pixel (S, P.X + W, P.Y + H, FG); else if not BG_Transparent then Put_Pixel (S, P.X + W, P.Y + H, BG); end if; end if; end loop; end loop; end Draw_Char_8x8; procedure Draw_Char_8x8 (Canvas : T_Internal_Canvas; P : Screen_Point; Char : Character; FG, BG : Uint32; BG_Transparent : Boolean := False) is Char_Index : constant Natural := (Character'Pos (Char) - 32) * 8; begin -- Character outside screen if P.X > Integer(Canvas.Surface.w - 8) or else P.Y > Integer(Canvas.Surface.h - 8) then return; end if; Draw_Char_8x8 (Canvas.Surface, P, Char, FG, BG, BG_Transparent); end Draw_Char_8x8; --------------------- -- Draw_Char_12x12 -- --------------------- procedure Draw_Char_12x12 (S : access SDL_Surface; P : Screen_Point; Char : Character; FG, BG : Uint32; BG_Transparent : Boolean := False) is Char_Index : constant Natural := (Character'Pos (Char) - 32) * 12; begin -- Character outside screen if P.X > Integer(S.w - 12) or else P.Y > Integer(S.h - 12) then return; end if; for H in 0 .. 11 loop for W in 0 .. 11 loop if (BMP_Font12x12 (Char_Index + H) and (2**(16 - W))) /= 0 then Put_Pixel (S, P.X + W, P.Y + H, FG); else if not BG_Transparent then Put_Pixel (S, P.X + W, P.Y + H, BG); end if; end if; end loop; end loop; end Draw_Char_12x12; procedure Draw_Char_12x12 (Canvas : T_Internal_Canvas; P : Screen_Point; Char : Character; FG, BG : Uint32; BG_Transparent : Boolean := False) is Char_Index : constant Natural := (Character'Pos (Char) - 32) * 12; begin -- Character outside screen if P.X > Integer(Canvas.Surface.w - 12) or else P.Y > Integer(Canvas.Surface.h - 12) then return; end if; Draw_Char_12x12 (Canvas.Surface, P, Char, FG, BG, BG_Transparent); end Draw_Char_12x12; --------------------- -- Draw_Char_16x24 -- --------------------- procedure Draw_Char_16x24 (S : access SDL_Surface; P : Screen_Point; Char : Character; FG, BG : Uint32; BG_Transparent : Boolean := False) is Char_Index : constant Natural := (Character'Pos (Char) - 32) * 24; begin -- Character outside screen if P.X > Integer(S.w - 16) or else P.Y > Integer(S.h - 16) then return; end if; for H in 0 .. 23 loop for W in 0 .. 15 loop if (BMP_Font16x24 (Char_Index + H) and (2**W)) /= 0 then Put_Pixel (S, P.X + W, P.Y + H, FG); else if not BG_Transparent then Put_Pixel (S, P.X + W, P.Y + H, BG); end if; end if; end loop; end loop; end Draw_Char_16x24; procedure Draw_Char_16x24 (Canvas : T_Internal_Canvas; P : Screen_Point; Char : Character; FG, BG : Uint32; BG_Transparent : Boolean := False) is Char_Index : constant Natural := (Character'Pos (Char) - 32) * 24; begin -- Character outside screen if P.X > Integer(Canvas.Surface.w - 16) or else P.Y > Integer(Canvas.Surface.h - 16) then return; end if; Draw_Char_16x24 (Canvas.Surface, P, Char, FG, BG, BG_Transparent); end Draw_Char_16x24; --------------- -- Draw_Char -- --------------- procedure Draw_Char (Canvas : T_Internal_Canvas; P : Screen_Point; Char : Character; Font : BMP_Font; FG, BG : Uint32) is begin case Font is when Font8x8 => Draw_Char_8x8 (Canvas, P, Char, FG, BG); when Font12x12 => Draw_Char_12x12 (Canvas, P, Char, FG, BG); when Font16x24 => Draw_Char_16x24 (Canvas, P, Char, FG, BG); end case; end Draw_Char; procedure Draw_Char (S : access SDL_Surface; P : Screen_Point; Char : Character; Font : BMP_Font; FG, BG : Uint32) is begin case Font is when Font8x8 => Draw_Char_8x8 (S, P, Char, FG, BG); when Font12x12 => Draw_Char_12x12 (S, P, Char, FG, BG); when Font16x24 => Draw_Char_16x24 (S, P, Char, FG, BG); end case; end Draw_Char; --------------- -- Draw_Char -- --------------- procedure Draw_Char (Canvas : T_Internal_Canvas; P : Screen_Point; Char : Character; Font : BMP_Font; FG, BG : Uint32; Transparent_BG : Boolean) is begin case Font is when Font8x8 => Draw_Char_8x8 (Canvas.Surface, P, Char, FG, BG, Transparent_BG); when Font12x12 => Draw_Char_12x12 (Canvas.Surface, P, Char, FG, BG, Transparent_BG); when Font16x24 => Draw_Char_16x24 (Canvas.Surface, P, Char, FG, BG, Transparent_BG); end case; end Draw_Char; ----------------- -- Draw_String -- ----------------- procedure Draw_String (S : access SDL_Surface; P : Screen_Point; Str : String; Font : BMP_Font; FG, BG : RGBA_T; Wrap : Boolean := False) is Cursor : Screen_Point := P; FG_U, BG_U : Uint32; begin FG_U := SDL_MapRGBA (S.format, unsigned_char (FG.R), unsigned_char (FG.G), unsigned_char (FG.B), unsigned_char (FG.A)); BG_U := SDL_MapRGBA (S.format, unsigned_char (BG.R), unsigned_char (BG.G), unsigned_char (BG.B), unsigned_char (BG.A)); for C of Str loop Draw_Char (S, Cursor, C, Font, FG_U, BG_U); if Cursor.X + Char_Size (Font).X > Integer(S.w) then if Wrap then Cursor.Y := Cursor.Y + Char_Size (Font).Y; Cursor.X := 0; else exit; end if; else Cursor.X := Cursor.X + Char_Size (Font).X; --exit; end if; --Count := Count + 1; end loop; end Draw_String; procedure Draw_String (Canvas : T_Internal_Canvas; P : Screen_Point; Str : String; Font : BMP_Font; FG, BG : RGBA_T; Wrap : Boolean := False) is -- Count : Natural := 0; Cursor : Screen_Point := P; FG_U, BG_U : Uint32; begin FG_U := SDL_MapRGBA (Canvas.Surface.format, unsigned_char (FG.R), unsigned_char (FG.G), unsigned_char (FG.B), unsigned_char (FG.A)); BG_U := SDL_MapRGBA (Canvas.Surface.format, unsigned_char (BG.R), unsigned_char (BG.G), unsigned_char (BG.B), unsigned_char (BG.A)); for C of Str loop -- Character outside screen -- Draw_Char ((P.X + Count * Char_Size (Font).X, P.Y), C, Font, FG, BG); if BG.A = 0 then Draw_Char (Canvas, Cursor, C, Font, FG_U, BG_U, True); else Draw_Char (Canvas, Cursor, C, Font, FG_U, BG_U); end if; if Cursor.X + Char_Size (Font).X > Integer(Canvas.Surface.w) then if Wrap then Cursor.Y := Cursor.Y + Char_Size (Font).Y; Cursor.X := 0; else exit; end if; else Cursor.X := Cursor.X + Char_Size (Font).X; --exit; end if; --Count := Count + 1; end loop; end Draw_String; --------------- -- Char_Size -- --------------- function Char_Size (Font : BMP_Font) return Screen_Point is begin case Font is when Font8x8 => return (8, 8); when Font12x12 => return (12, 12); when Font16x24 => return (16, 24); end case; end Char_Size; function String_Size (Font : BMP_Font; Text : String) return Screen_Point is begin case Font is when Font8x8 => return (8 * Text'Length, 8); when Font12x12 => return (12 * Text'Length, 12); when Font16x24 => return (16 * Text'Length, 24); end case; end String_Size; end Display.Basic.Fonts;
godunko/adawebpack
Ada
5,830
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . W C H _ S T W -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.WCh_Con; use System.WCh_Con; with System.WCh_Cnv; use System.WCh_Cnv; package body System.WCh_StW is ----------------------- -- Local Subprograms -- ----------------------- procedure Get_Next_Code (S : String; P : in out Natural; V : out UTF_32_Code; EM : WC_Encoding_Method); -- Scans next character starting at S(P) and returns its value in V. On -- exit P is updated past the last character read. Raises Constraint_Error -- if the string is not well formed. Raises Constraint_Error if the code -- value is greater than 16#7FFF_FFFF#. On entry P <= S'Last. ------------------- -- Get_Next_Code -- ------------------- procedure Get_Next_Code (S : String; P : in out Natural; V : out UTF_32_Code; EM : WC_Encoding_Method) is function In_Char return Character; -- Function to return a character, bumping P, raises Constraint_Error -- if P > S'Last on entry. function Get_UTF_32 is new Char_Sequence_To_UTF_32 (In_Char); -- Function to get next UFT_32 value ------------- -- In_Char -- ------------- function In_Char return Character is begin if P > S'Last then raise Constraint_Error with "badly formed wide character code"; else P := P + 1; return S (P - 1); end if; end In_Char; -- Start of processing for Get_Next_Code begin -- Check for wide character encoding case EM is when WCEM_UTF8 => if S (P) >= Character'Val (16#80#) then V := Get_UTF_32 (In_Char, EM); return; end if; when WCEM_Brackets => if P + 2 <= S'Last and then S (P) = '[' and then S (P + 1) = '"' and then S (P + 2) /= '"' then V := Get_UTF_32 (In_Char, EM); return; end if; end case; -- If it is not a wide character code, just get it V := Character'Pos (S (P)); P := P + 1; end Get_Next_Code; --------------------------- -- String_To_Wide_String -- --------------------------- procedure String_To_Wide_String (S : String; R : out Wide_String; L : out Natural; EM : System.WCh_Con.WC_Encoding_Method) is SP : Natural; V : UTF_32_Code; begin pragma Assert (S'First = 1); SP := S'First; L := 0; while SP <= S'Last loop Get_Next_Code (S, SP, V, EM); if V > 16#FFFF# then raise Constraint_Error with "out of range value for wide character"; end if; L := L + 1; R (L) := Wide_Character'Val (V); end loop; end String_To_Wide_String; -------------------------------- -- String_To_Wide_Wide_String -- -------------------------------- procedure String_To_Wide_Wide_String (S : String; R : out Wide_Wide_String; L : out Natural; EM : System.WCh_Con.WC_Encoding_Method) is pragma Assert (S'First = 1); SP : Natural; V : UTF_32_Code; begin SP := S'First; L := 0; while SP <= S'Last loop Get_Next_Code (S, SP, V, EM); L := L + 1; R (L) := Wide_Wide_Character'Val (V); end loop; end String_To_Wide_Wide_String; end System.WCh_StW;