repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
reznikmm/matreshka
Ada
3,749
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Style_Master_Page_Name_Attributes is pragma Preelaborate; type ODF_Style_Master_Page_Name_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Style_Master_Page_Name_Attribute_Access is access all ODF_Style_Master_Page_Name_Attribute'Class with Storage_Size => 0; end ODF.DOM.Style_Master_Page_Name_Attributes;
cborao/Ada-P3
Ada
1,247
ads
--PRÁCTICA 3: CÉSAR BORAO MORATINOS (Chat_Messages.ads) with Lower_Layer_UDP; with Ada.Strings.Unbounded; package Chat_Messages is package LLU renames Lower_Layer_UDP; package ASU renames Ada.Strings.Unbounded; type Message_Type is (Init, Welcome, Writer, Server, Logout); procedure Init_Message (Server_EP: LLU.End_Point_Type; Client_EP_Receive: LLU.End_Point_Type; Client_EP_Handler: LLU.End_Point_Type; Nick: ASU.Unbounded_String; O_Buffer: Access LLU.Buffer_Type); procedure Welcome_Message (Client_EP_Handler: LLU.End_Point_Type; Accepted: Boolean; O_Buffer: Access LLU.Buffer_Type); procedure Server_Message (Client_EP_Handler: LLU.End_Point_Type; Nick: ASU.Unbounded_String; Comment: ASU.Unbounded_String; O_Buffer: Access LLU.Buffer_Type); procedure Writer_Message (Server_EP: LLU.End_Point_Type; Client_EP_Handler: LLU.End_Point_Type; Nick: ASU.Unbounded_String; Comment: ASU.Unbounded_String; O_Buffer: Access LLU.Buffer_Type); procedure Logout_Message (Server_EP: LLU.End_Point_Type; Client_EP_Handler: LLU.End_Point_Type; Nick: ASU.Unbounded_String; O_Buffer: Access LLU.Buffer_Type); end Chat_Messages;
Hamster-Furtif/JeremyPlusPlus
Ada
1,271
adb
with ada.text_io, ada.Float_Text_IO, ada.Integer_Text_IO, utils, ada.Strings.Unbounded, montecarlo, botIO, opstrat, Mastermind; use ada.text_io, ada.Float_Text_IO, ada.Integer_Text_IO, utils, ada.Strings.Unbounded, montecarlo, botIO, opstrat, Mastermind; with read_preflop; use read_preflop; with Ada.Numerics; with Ada.Numerics.Discrete_Random; procedure debug is package Rand_Int is new Ada.Numerics.Discrete_Random(Positive); gen : Rand_Int.Generator; hand, table: T_set; c1: T_card; game: T_set; ch : Float; begin emptySet(game); for i in 1..9 loop loop c1 := randomCard(52); exit when not cardInSet(c1, game); end loop; addToSet(c1, game); end loop; hand := get_card(game,0) + get_card(game,1); table := get_card(game,2)+get_card(game,3); --As,Ac hand Put_Line("----------------------------------------"); Put_Line("CARTES DE JEREMY :"); printCard(get_card(game,0));printCard(get_card(game,1)); Put_Line("----------------------------------------"); Put_Line("CARTES DE LA TABLE :"); printCard(get_card(game,2));printCard(get_card(game,3)); ch := chancesOfWinning(hand,table); Put_Line("CHANCES DE GAGNER :"&ch'Img); end debug;
sparre/Command-Line-Parser-Generator
Ada
1,686
adb
-- Copyright: JSA Research & Innovation <[email protected]> -- License: Beer Ware pragma License (Unrestricted); with Ada.Characters.Conversions, Ada.Environment_Variables, Ada.Strings.Fixed, Ada.Strings.Unbounded; with Asis.Ada_Environments, Asis.Implementation; procedure Command_Line_Parser_Generator.Setup (Context : out Asis.Context) is function Source_Directories return Wide_String; function Source_Directories return Wide_String is use Ada.Characters.Conversions, Ada.Environment_Variables, Ada.Strings.Fixed, Ada.Strings.Unbounded; Ada_Include_Path : constant String := "ADA_INCLUDE_PATH"; List : String renames Value (Name => Ada_Include_Path, Default => "."); Next : Positive := List'First; Cut : Natural; Buffer : Unbounded_String; begin while Next in List'Range loop Cut := Index (Source => List (Next .. List'Last), Pattern => ":"); if Cut = 0 then Cut := List'Last + 1; end if; if Cut > Next then Append (Source => Buffer, New_Item => " -I" & List (Next .. Cut - 1)); end if; Next := Cut + 1; end loop; return To_Wide_String (To_String (Buffer)); end Source_Directories; begin Asis.Implementation.Initialize (""); Asis.Ada_Environments.Associate (The_Context => Context, Name => "CLPG", Parameters => "-CA -FM" & Source_Directories); Asis.Ada_Environments.Open (The_Context => Context); end Command_Line_Parser_Generator.Setup;
persan/AdaYaml
Ada
824
ads
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Yaml.Dom.Sequence_Data; with Yaml.Dom.Mapping_Data; package Yaml.Dom.Node is type Instance (Kind : Node_Kind) is record Tag : Text.Reference; case Kind is when Scalar => Scalar_Style : Scalar_Style_Type; Content : Text.Reference; when Sequence => Sequence_Style : Collection_Style_Type; Items : Sequence_Data.Instance; when Mapping => Mapping_Style : Collection_Style_Type; Pairs : Mapping_Data.Instance; end case; end record; function "=" (Left, Right : Instance) return Boolean; function Hash (Object : Instance) return Ada.Containers.Hash_Type; end Yaml.Dom.Node;
reznikmm/matreshka
Ada
4,761
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Text_Variable_Decls_Elements; package Matreshka.ODF_Text.Variable_Decls_Elements is type Text_Variable_Decls_Element_Node is new Matreshka.ODF_Text.Abstract_Text_Element_Node and ODF.DOM.Text_Variable_Decls_Elements.ODF_Text_Variable_Decls with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Variable_Decls_Element_Node; overriding function Get_Local_Name (Self : not null access constant Text_Variable_Decls_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Text_Variable_Decls_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Text_Variable_Decls_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Text_Variable_Decls_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Text.Variable_Decls_Elements;
godunko/adawebpack
Ada
4,295
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the WASM version of this package with Interfaces; package body System.IO is Current_Out : File_Type := Stdout; pragma Atomic (Current_Out); -- Current output file (modified by Set_Output) -------------- -- New_Line -- -------------- procedure New_Line (Spacing : Positive := 1) is begin for J in 1 .. Spacing loop Put (ASCII.LF); end loop; end New_Line; --------- -- Put -- --------- procedure Put (X : Integer) is procedure Put_Int (X : Integer); pragma Import (C, Put_Int, "__gnat_put_int"); begin case Current_Out is when Stdout => Put_Int (X); when Stderr => Put_Int (X); end case; end Put; procedure Put (C : Character) is procedure Put_Char (C : Character); pragma Import (C, Put_Char, "__gnat_put_char"); begin case Current_Out is when Stdout => Put_Char (C); when Stderr => Put_Char (C); end case; end Put; procedure Put (S : String) is procedure Put_String (S : System.Address; Size : Interfaces.Unsigned_32); pragma Import (C, Put_String, "__gnat_put_string"); begin Put_String (S (S'First)'Address, S'Length); end Put; -------------- -- Put_Line -- -------------- procedure Put_Line (S : String) is begin Put (S); New_Line; end Put_Line; --------------------- -- Standard_Output -- --------------------- function Standard_Output return File_Type is begin return Stdout; end Standard_Output; -------------------- -- Standard_Error -- -------------------- function Standard_Error return File_Type is begin return Stderr; end Standard_Error; ---------------- -- Set_Output -- ---------------- procedure Set_Output (File : File_Type) is begin Current_Out := File; end Set_Output; end System.IO;
strenkml/EE368
Ada
8,936
adb
with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Containers.Ordered_Maps; use Ada.Containers; with Interfaces.C; use Interfaces.C; with GNAT.Regpat; use GNAT.Regpat; with Device; use Device; with Memory.Cache; use Memory.Cache; with Memory.SPM; use Memory.SPM; package body CACTI is subtype file is char; type file_ptr is access file; type Parameter_Type is record size : Positive; block_size : Positive; bus_bits : Positive; associativity : Natural := 1; is_cache : Boolean := False; end record; type Result_Type is record area : Cost_Type; time : Time_Type; end record; function "<"(a, b : Parameter_Type) return Boolean is begin if a.size /= b.size then return a.size < b.size; end if; if a.block_size /= b.block_size then return a.block_size < b.block_size; end if; if a.bus_bits /= b.bus_bits then return a.bus_bits < b.bus_bits; end if; if a.associativity /= b.associativity then return a.associativity < b.associativity; end if; if a.is_cache /= b.is_cache then return a.is_cache; end if; return False; end "<"; package Result_Maps is new Ordered_Maps(Parameter_Type, Result_Type); function popen(c, t : char_array) return file_ptr; pragma Import(C, popen, "popen"); procedure pclose(s : file_ptr); pragma Import(C, pclose, "pclose"); function fgetc(ptr : file_ptr) return int; pragma Import(C, fgetc, "fgetc"); -- Regular expressions for extracting area and time information. area_matcher : constant Pattern_Matcher := Compile("Data array: Area \(mm2\): ([0-9\.]+)"); time_matcher : constant Pattern_Matcher := Compile("Access time \(ns\): ([0-9\.]+)"); -- Cache of results. results : Result_Maps.Map; -- Generate CACTI input. procedure Generate(file : in File_Type; param : in Parameter_Type) is begin -- Size in bytes. Put_Line(file, "-size (bytes) " & To_String(param.size)); -- Line size in bytes. Put_Line(file, "-block size (bytes) " & To_String(param.block_size)); -- Associativity (0 for fully-associativity). Put_Line(file, "-associativity " & To_String(param.associativity)); -- Ports. Put_Line(file, "-read-write port 1"); Put_Line(file, "-exclusive read port 0"); Put_Line(file, "-exclusive write port 0"); Put_Line(file, "-single ended read ports 0"); -- Banks. Put_Line(file, "-UCA bank count 1"); -- Technology. -- TODO support other technologies. Put_Line(file, "-technology (u) 0.032"); -- Cell types. Put_Line(file, "-Data array cell type - ""itrs-hp"""); Put_Line(file, "-Data array peripheral type - ""itrs-hp"""); Put_Line(file, "-Tag array cell type - ""itrs-hp"""); Put_Line(file, "-Tag array peripheral type - ""itrs-hp"""); -- Bus width. Put_Line(file, "-output/input bus width " & To_String(param.bus_bits)); -- Operating temperature. Put_Line(file, "-operating temperature (K) 350"); -- Type of memory. if param.is_cache then Put_Line(file, "-cache type ""cache"""); else Put_Line(file, "-cache type ""ram"""); end if; -- Tag size. Put_Line(file, "-tag size (b) ""default"""); -- Access mode. Put_Line(file, "-access mode (normal, sequential, fast) - ""normal"""); -- Cache model. Put_Line(file, "-Cache model (NUCA, UCA) - ""UCA"""); -- Design objective. Put_Line(file, "-design objective (weight delay, dynamic power, " & "leakage power, cycle time, area) 0:0:0:0:100"); Put_Line(file, "-deviate (delay, dynamic power, leakage power, " & "cycle time, area) 60:100000:100000:100000:1000000"); -- Make sure we get all the information we need. Put_Line(file, "-Print level (DETAILED, CONCISE) - ""DETAILED"""); -- Prefetch width (needed to prevent cacti from crashing). Put_Line(file, "-internal prefetch width 8"); end Generate; -- Get CACTI parameters for a cache. function Get_Cache(cache : Cache_Type) return Parameter_Type is wsize : constant Positive := Get_Word_Size(cache); lsize : constant Positive := Get_Line_Size(cache); lcount : constant Positive := Get_Line_Count(cache); bsize : constant Positive := wsize * lsize; size : constant Positive := bsize * lcount; assoc : constant Natural := Get_Associativity(cache); abits : constant Positive := Get_Address_Bits; bus_bits : constant Positive := abits + wsize * 8; param : Parameter_Type; begin param.size := size; param.block_size := bsize; param.bus_bits := bus_bits; param.is_cache := True; if assoc = lcount then param.associativity := 0; else param.associativity := assoc; end if; return param; end Get_Cache; -- Get CACTI parameters for an SPM. function Get_SPM(spm : SPM_Type) return Parameter_Type is wsize : constant Positive := Get_Word_Size(spm); size : constant Positive := Get_Size(spm); bus_bits : constant Positive := 8 * wsize; param : Parameter_Type; begin param.size := size; param.block_size := wsize; param.bus_bits := bus_bits; return param; end Get_SPM; -- Get CACTI parameters. function Get_Parameter(mem : Memory_Type'Class) return Parameter_Type is begin if mem in Cache_Type'Class then return Get_Cache(Cache_Type(mem)); elsif mem in SPM_Type'Class then return Get_SPM(SPM_Type(mem)); else raise CACTI_Error; end if; end Get_Parameter; -- Run the CACTI program with parameters from the specified memory. function Run(mem : Memory_Type'Class) return Result_Type is param : constant Parameter_Type := Get_Parameter(mem); command : constant String := "./cacti -infile "; cacti_type : constant char_array := To_C("r"); cursor : Result_Maps.Cursor; buffer : Unbounded_String; ptr : file_ptr; temp : File_Type; result : Result_Type; matches : Match_Array(0 .. 1); begin -- Check if we've already run CACTI with these parameters. cursor := results.Find(param); if Result_Maps."/="(cursor, Result_Maps.No_Element) then return Result_Maps.Element(cursor); end if; -- Create a temporary file with the parameters. Create(File => temp); Generate(temp, param); Flush(temp); -- Run CACTI. declare cacti_name : constant char_array := To_C(command & Name(temp)); begin ptr := popen(cacti_name, cacti_type); end; if ptr /= null then loop declare ch : constant int := fgetc(ptr); begin exit when ch < 0; Append(buffer, Character'Val(ch)); end; end loop; pclose(ptr); else Put_Line("ERROR: popen failed"); Delete(temp); raise CACTI_Error; end if; -- Destroy the temporary file. Delete(temp); -- Extract the area and time from the CACTI results. declare str : constant String := To_String(buffer); value : Float; begin -- Here we use units of nm^2, so we need to convert from mm^2. Match(area_matcher, str, matches); value := Float'Value(str(matches(1).First .. matches(1).Last)); result.area := Cost_Type(Float'Ceiling(value * 1000.0 * 1000.0)); -- Here we assume 1 cycle is 1 ns. Match(time_matcher, str, matches); value := Float'Value(str(matches(1).First .. matches(1).Last)); result.time := Time_Type(Float'Ceiling(value)); exception when others => result.area := Cost_Type'Last; result.time := Time_Type'Last; end; -- Insert the result to our results map. results.Insert(param, result); return result; end Run; function Get_Area(mem : Memory_Type'Class) return Cost_Type is result : constant Result_Type := Run(mem); begin return result.area; end Get_Area; function Get_Time(mem : Memory_Type'Class) return Time_Type is result : constant Result_Type := Run(mem); begin return result.time; end Get_Time; end CACTI;
reznikmm/matreshka
Ada
9,562
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with League.Characters; package body Generator.Contexts is use type League.Characters.Universal_Character; use type League.Strings.Universal_String; procedure Free is new Ada.Unchecked_Deallocation (Context_Information, Context_Information_Access); procedure Remove_Parents (Self : in out Context; Unit : League.Strings.Universal_String; Is_Limited : Boolean; Is_Private : Boolean); -- Looks for context clauses for parent packages and removes them when they -- doesn't needed. function Parent_Compilation_Unit (Unit : League.Strings.Universal_String) return League.Strings.Universal_String; -- Returns name of the parent compilation unit is any. Returns empty string -- when there is no parent compilation unit for the specified compilation -- unit. function Is_Hidden (Self : in out Context; Unit : League.Strings.Universal_String; Is_Limited : Boolean; Is_Private : Boolean) return Boolean; -- Returns True when specified compilation unit is "hidden" by one of the -- context clauses. --------- -- Add -- --------- procedure Add (Self : in out Context; Unit : League.Strings.Universal_String; Is_Limited : Boolean := False; Is_Private : Boolean := False) is Position : String_Context_Maps.Cursor := Self.Map.Find (Unit); Info : Context_Information_Access; begin if Unit.Is_Empty then return; end if; Remove_Parents (Self, Unit, Is_Limited, Is_Private); if String_Context_Maps.Has_Element (Position) then Info := String_Context_Maps.Element (Position); if not Is_Limited then Info.Is_Limited := False; end if; elsif not Is_Hidden (Self, Unit, Is_Limited, Is_Private) then Self.Map.Insert (Unit, new Context_Information'(Is_Limited, Is_Private)); end if; end Add; ----------------- -- Instantiate -- ----------------- procedure Instantiate (Self : in out Context; Unit : League.Strings.Universal_String) is begin -- Remove context clauses for all parent packages. Remove_Parents (Self, Unit, False, False); -- Remove record for package itself if any. declare Position : String_Context_Maps.Cursor := Self.Map.Find (Unit); Info : Context_Information_Access; begin if String_Context_Maps.Has_Element (Position) then Info := String_Context_Maps.Element (Position); Free (Info); Self.Map.Delete (Position); end if; end; end Instantiate; ------------- -- Iterate -- ------------- procedure Iterate (Self : Context; Iterator : not null access procedure (Unit : League.Strings.Universal_String; Is_Limited : Boolean := False; Is_Private : Boolean := False)) is procedure Call_Iterator (Position : String_Context_Maps.Cursor); ------------------- -- Call_Iterator -- ------------------- procedure Call_Iterator (Position : String_Context_Maps.Cursor) is Info : constant Context_Information_Access := String_Context_Maps.Element (Position); begin Iterator (String_Context_Maps.Key (Position), Info.Is_Limited, Info.Is_Private); end Call_Iterator; begin Self.Map.Iterate (Call_Iterator'Access); end Iterate; --------------- -- Is_Hidden -- --------------- function Is_Hidden (Self : in out Context; Unit : League.Strings.Universal_String; Is_Limited : Boolean; Is_Private : Boolean) return Boolean is Unit_Dot : constant League.Strings.Universal_String := Unit & '.'; Result : Boolean := False; procedure Check (Position : String_Context_Maps.Cursor); ----------- -- Check -- ----------- procedure Check (Position : String_Context_Maps.Cursor) is Info : constant Context_Information_Access := String_Context_Maps.Element (Position); begin if String_Context_Maps.Key (Position).Starts_With (Unit_Dot) then if Info.Is_Limited = Is_Limited or not Info.Is_Limited then -- Non-limited with clause hides any other clauses for parent -- units; Result := True; end if; end if; end Check; begin Self.Map.Iterate (Check'Access); return Result; end Is_Hidden; ----------------------------- -- Parent_Compilation_Unit -- ----------------------------- function Parent_Compilation_Unit (Unit : League.Strings.Universal_String) return League.Strings.Universal_String is Separator : Natural := 0; begin for J in reverse 1 .. Unit.Length loop if Unit.Element (J) = '.' then Separator := J; exit; end if; end loop; if Separator = 0 then return League.Strings.Empty_Universal_String; else return Unit.Slice (1, Separator - 1); end if; end Parent_Compilation_Unit; -------------------- -- Remove_Parents -- -------------------- procedure Remove_Parents (Self : in out Context; Unit : League.Strings.Universal_String; Is_Limited : Boolean; Is_Private : Boolean) is Parent : constant League.Strings.Universal_String := Parent_Compilation_Unit (Unit); Position : String_Context_Maps.Cursor := Self.Map.Find (Parent); Info : Context_Information_Access; begin if not Parent.Is_Empty then Remove_Parents (Self, Parent, Is_Limited, Is_Private); end if; if String_Context_Maps.Has_Element (Position) then Info := String_Context_Maps.Element (Position); if not Is_Limited or else (Is_Limited and Info.Is_Limited) then Free (Info); Self.Map.Delete (Position); end if; end if; end Remove_Parents; end Generator.Contexts;
reznikmm/matreshka
Ada
3,746
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package body XML.SAX.Locators.Internals is ------------ -- Create -- ------------ function Create (Shared : Matreshka.Internals.SAX_Locators.Shared_Locator_Access) return SAX_Locator is begin Matreshka.Internals.SAX_Locators.Reference (Shared); return SAX_Locator'(Ada.Finalization.Controlled with Data => Shared); end Create; end XML.SAX.Locators.Internals;
Gabriel-Degret/adalib
Ada
10,536
ads
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <[email protected]> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Iterator_Interfaces; generic type Index_Type is range <>; type Element_Type (<>) is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Indefinite_Vectors is pragma Preelaborate(Indefinite_Vectors); pragma Remote_Types(Indefinite_Vectors); 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, Variable_Indexing => Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type; pragma Preelaborable_Initialization(Vector); type Cursor is private; pragma Preelaborable_Initialization(Cursor); Empty_Vector : constant Vector; No_Element : constant Cursor; function Has_Element (Position : Cursor) return Boolean; package Vector_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); 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; 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 : in Count_Type); function Length (Container : Vector) return Count_Type; procedure Set_Length (Container : in out Vector; Length : in Count_Type); function Is_Empty (Container : Vector) return Boolean; procedure Clear (Container : in out Vector); function To_Cursor (Container : Vector; Index : Extended_Index) return Cursor; function To_Index (Position : Cursor) return Extended_Index; function Element (Container : Vector; Index : Index_Type) return Element_Type; function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Vector; Index : in Index_Type; New_Item : in Element_Type); procedure Replace_Element (Container : in out Vector; Position : in Cursor; New_item : in Element_Type); procedure Query_Element (Container : in Vector; Index : in Index_Type; Process : not null access procedure (Element : in Element_Type)); procedure Query_Element (Position : in Cursor; Process : not null access procedure (Element : in Element_Type)); procedure Update_Element (Container : in out Vector; Index : in Index_Type; Process : not null access procedure (Element : in out Element_Type)); procedure Update_Element (Container : in out Vector; Position : in 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 in Vector; Index : in Index_Type) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Index : in Index_Type) return Reference_Type; function Constant_Reference (Container : aliased in Vector; Position : in Cursor) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Position : in Cursor) return Reference_Type; procedure Assign (Target : in out Vector; Source : in 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 : in Extended_Index; New_Item : in Vector); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Vector); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Vector; Position : out Cursor); procedure Insert (Container : in out Vector; Before : in Extended_Index; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Element_Type; Position : out Cursor; Count : in Count_Type := 1); procedure Prepend (Container : in out Vector; New_Item : in Vector); procedure Prepend (Container : in out Vector; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Append (Container : in out Vector; New_Item : in Vector); procedure Append (Container : in out Vector; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : in Extended_Index; Count : in Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : in Cursor; Position : out Cursor; Count : in Count_Type := 1); procedure Delete (Container : in out Vector; Index : in Extended_Index; Count : in Count_Type := 1); procedure Delete (Container : in out Vector; Position : in out Cursor; Count : in Count_Type := 1); procedure Delete_First (Container : in out Vector; Count : in Count_Type := 1); procedure Delete_Last (Container : in out Vector; Count : in Count_Type := 1); procedure Reverse_Elements (Container : in out Vector); procedure Swap (Container : in out Vector; I, J : in Index_Type); procedure Swap (Container : in out Vector; I, J : in Cursor); function First_Index (Container : Vector) return Index_Type; function First (Container : Vector) return Cursor; function First_Element (Container : Vector) return Element_Type; function Last_Index (Container : Vector) return Extended_Index; function Last (Container : Vector) return Cursor; function Last_Element (Container : Vector) 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); function Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index; function Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Reverse_Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index; function Reverse_Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Contains (Container : Vector; Item : Element_Type) return Boolean; procedure Iterate (Container : in Vector; Process : not null access procedure (Position : in Cursor)); procedure Reverse_Iterate (Container : in Vector; Process : not null access procedure (Position : in Cursor)); function Iterate (Container : in Vector) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; function Iterate (Container : in Vector; Start : in Cursor) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; 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; private -- not specified by the language type Vector is tagged null record; Empty_Vector : constant Vector := (null record); type Cursor is null record; No_Element : constant Cursor := (null record); end Ada.Containers.Indefinite_Vectors;
sebsgit/textproc
Ada
411
ads
with AUnit; use AUnit; with AUnit.Test_Cases; use AUnit.Test_Cases; package OpenCLTests is type TestCase is new AUnit.Test_Cases.Test_Case with null record; procedure Register_Tests(T: in out TestCase); function Name(T: TestCase) return Message_String; procedure testLoad(T : in out Test_Cases.Test_Case'Class); procedure testObjectAPI(T: in out Test_Cases.Test_Case'Class); end OpenCLTests;
reznikmm/matreshka
Ada
5,493
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$ ------------------------------------------------------------------------------ private with Ada.Finalization; with League.Strings; with Matreshka.XML_Schema.Named_Maps; with XML.Schema.Objects; package XML.Schema.Named_Maps is pragma Preelaborate; type XS_Named_Map is tagged private; function Length (Self : XS_Named_Map'Class) return Natural; -- The number of XSObjects in the XSObjectList. -- The range of valid child object indices is 1 to Length inclusive. function Item (Self : XS_Named_Map'Class; Index : Positive) return XML.Schema.Objects.XS_Object; -- Returns the Index-th item in the collection or null if index is greater -- than the number of objects in the list. The index starts at 1. -- -- Parameters -- -- index of type Positive - index into the collection. -- -- Return Value -- -- The XSObject at the indexth position in the XSObjectList, or null if the -- index specified is not valid. function Item_By_Name (Self : XS_Named_Map'Class; Name : League.Strings.Universal_String; Namespace : League.Strings.Universal_String) return XML.Schema.Objects.XS_Object; -- Retrieves an XSObject specified by local Name and Namespace URI. -- Per [XML Namespaces], applications must use the value null as the -- namespace parameter for methods if they wish to specify no namespace. -- -- Parameters -- -- namespace of type GenericString -- The namespace URI of the XSObject to retrieve, or null if the -- XSObject has no namespace. -- localName of type GenericString -- The local name of the XSObject to retrieve. -- -- Return Value -- -- A XSObject (of any type) with the specified local name and namespace -- URI, or null if they do not identify any object in this map. private type XS_Named_Map is new Ada.Finalization.Controlled with record Node : Matreshka.XML_Schema.Named_Maps.Named_Map_Access; end record; overriding procedure Adjust (Self : in out XS_Named_Map) with Inline => True; overriding procedure Finalize (Self : in out XS_Named_Map); end XML.Schema.Named_Maps;
AdaCore/libadalang
Ada
56
ads
package Types is type Int is mod 2 ** 32; end Types;
HackInvent/Ada_Drivers_Library
Ada
33,397
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2018, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f429xx.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides declarations for devices on the STM32F42xxx MCUs -- manufactured by ST Microelectronics. For example, an STM32F429. private with ADL_Config; with STM32_SVD; use STM32_SVD; with STM32_SVD.SAI; with STM32_SVD.SDMMC; with STM32.ADC; use STM32.ADC; with STM32.DAC; use STM32.DAC; with STM32.DMA; use STM32.DMA; with STM32.GPIO; use STM32.GPIO; with STM32.USARTs; use STM32.USARTs; with STM32.I2C; use STM32.I2C; with STM32.SDMMC; use STM32.SDMMC; with STM32.SPI; use STM32.SPI; with STM32.SPI.DMA; use STM32.SPI.DMA; with STM32.I2S; use STM32.I2S; with STM32.Timers; use STM32.Timers; with STM32.RTC; use STM32.RTC; package STM32.Device is pragma Elaborate_Body; Unknown_Device : exception; -- Raised by the routines below for a device passed as an actual parameter -- when that device is not present on the given hardware instance. HSI_VALUE : constant := 16_000_000; -- Internal oscillator in Hz HSE_VALUE : constant UInt32; -- External oscillator in Hz procedure Enable_Clock (This : aliased in out GPIO_Port) with Inline; procedure Enable_Clock (Point : GPIO_Point) with Inline; procedure Enable_Clock (Points : GPIO_Points) with Inline; procedure Reset (This : aliased in out GPIO_Port) with Inline; procedure Reset (Point : GPIO_Point) with Inline; procedure Reset (Points : GPIO_Points) with Inline; GPIO_A : aliased GPIO_Port with Import, Volatile, Address => GPIOA_Base; GPIO_B : aliased GPIO_Port with Import, Volatile, Address => GPIOB_Base; GPIO_C : aliased GPIO_Port with Import, Volatile, Address => GPIOC_Base; GPIO_D : aliased GPIO_Port with Import, Volatile, Address => GPIOD_Base; GPIO_E : aliased GPIO_Port with Import, Volatile, Address => GPIOE_Base; GPIO_F : aliased GPIO_Port with Import, Volatile, Address => GPIOF_Base; GPIO_G : aliased GPIO_Port with Import, Volatile, Address => GPIOG_Base; GPIO_H : aliased GPIO_Port with Import, Volatile, Address => GPIOH_Base; GPIO_I : aliased GPIO_Port with Import, Volatile, Address => GPIOI_Base; GPIO_J : aliased GPIO_Port with Import, Volatile, Address => GPIOJ_Base; GPIO_K : aliased GPIO_Port with Import, Volatile, Address => GPIOK_Base; PA0 : aliased GPIO_Point := (GPIO_A'Access, Pin_0); PA1 : aliased GPIO_Point := (GPIO_A'Access, Pin_1); PA2 : aliased GPIO_Point := (GPIO_A'Access, Pin_2); PA3 : aliased GPIO_Point := (GPIO_A'Access, Pin_3); PA4 : aliased GPIO_Point := (GPIO_A'Access, Pin_4); PA5 : aliased GPIO_Point := (GPIO_A'Access, Pin_5); PA6 : aliased GPIO_Point := (GPIO_A'Access, Pin_6); PA7 : aliased GPIO_Point := (GPIO_A'Access, Pin_7); PA8 : aliased GPIO_Point := (GPIO_A'Access, Pin_8); PA9 : aliased GPIO_Point := (GPIO_A'Access, Pin_9); PA10 : aliased GPIO_Point := (GPIO_A'Access, Pin_10); PA11 : aliased GPIO_Point := (GPIO_A'Access, Pin_11); PA12 : aliased GPIO_Point := (GPIO_A'Access, Pin_12); PA13 : aliased GPIO_Point := (GPIO_A'Access, Pin_13); PA14 : aliased GPIO_Point := (GPIO_A'Access, Pin_14); PA15 : aliased GPIO_Point := (GPIO_A'Access, Pin_15); PB0 : aliased GPIO_Point := (GPIO_B'Access, Pin_0); PB1 : aliased GPIO_Point := (GPIO_B'Access, Pin_1); PB2 : aliased GPIO_Point := (GPIO_B'Access, Pin_2); PB3 : aliased GPIO_Point := (GPIO_B'Access, Pin_3); PB4 : aliased GPIO_Point := (GPIO_B'Access, Pin_4); PB5 : aliased GPIO_Point := (GPIO_B'Access, Pin_5); PB6 : aliased GPIO_Point := (GPIO_B'Access, Pin_6); PB7 : aliased GPIO_Point := (GPIO_B'Access, Pin_7); PB8 : aliased GPIO_Point := (GPIO_B'Access, Pin_8); PB9 : aliased GPIO_Point := (GPIO_B'Access, Pin_9); PB10 : aliased GPIO_Point := (GPIO_B'Access, Pin_10); PB11 : aliased GPIO_Point := (GPIO_B'Access, Pin_11); PB12 : aliased GPIO_Point := (GPIO_B'Access, Pin_12); PB13 : aliased GPIO_Point := (GPIO_B'Access, Pin_13); PB14 : aliased GPIO_Point := (GPIO_B'Access, Pin_14); PB15 : aliased GPIO_Point := (GPIO_B'Access, Pin_15); PC0 : aliased GPIO_Point := (GPIO_C'Access, Pin_0); PC1 : aliased GPIO_Point := (GPIO_C'Access, Pin_1); PC2 : aliased GPIO_Point := (GPIO_C'Access, Pin_2); PC3 : aliased GPIO_Point := (GPIO_C'Access, Pin_3); PC4 : aliased GPIO_Point := (GPIO_C'Access, Pin_4); PC5 : aliased GPIO_Point := (GPIO_C'Access, Pin_5); PC6 : aliased GPIO_Point := (GPIO_C'Access, Pin_6); PC7 : aliased GPIO_Point := (GPIO_C'Access, Pin_7); PC8 : aliased GPIO_Point := (GPIO_C'Access, Pin_8); PC9 : aliased GPIO_Point := (GPIO_C'Access, Pin_9); PC10 : aliased GPIO_Point := (GPIO_C'Access, Pin_10); PC11 : aliased GPIO_Point := (GPIO_C'Access, Pin_11); PC12 : aliased GPIO_Point := (GPIO_C'Access, Pin_12); PC13 : aliased GPIO_Point := (GPIO_C'Access, Pin_13); PC14 : aliased GPIO_Point := (GPIO_C'Access, Pin_14); PC15 : aliased GPIO_Point := (GPIO_C'Access, Pin_15); PD0 : aliased GPIO_Point := (GPIO_D'Access, Pin_0); PD1 : aliased GPIO_Point := (GPIO_D'Access, Pin_1); PD2 : aliased GPIO_Point := (GPIO_D'Access, Pin_2); PD3 : aliased GPIO_Point := (GPIO_D'Access, Pin_3); PD4 : aliased GPIO_Point := (GPIO_D'Access, Pin_4); PD5 : aliased GPIO_Point := (GPIO_D'Access, Pin_5); PD6 : aliased GPIO_Point := (GPIO_D'Access, Pin_6); PD7 : aliased GPIO_Point := (GPIO_D'Access, Pin_7); PD8 : aliased GPIO_Point := (GPIO_D'Access, Pin_8); PD9 : aliased GPIO_Point := (GPIO_D'Access, Pin_9); PD10 : aliased GPIO_Point := (GPIO_D'Access, Pin_10); PD11 : aliased GPIO_Point := (GPIO_D'Access, Pin_11); PD12 : aliased GPIO_Point := (GPIO_D'Access, Pin_12); PD13 : aliased GPIO_Point := (GPIO_D'Access, Pin_13); PD14 : aliased GPIO_Point := (GPIO_D'Access, Pin_14); PD15 : aliased GPIO_Point := (GPIO_D'Access, Pin_15); PE0 : aliased GPIO_Point := (GPIO_E'Access, Pin_0); PE1 : aliased GPIO_Point := (GPIO_E'Access, Pin_1); PE2 : aliased GPIO_Point := (GPIO_E'Access, Pin_2); PE3 : aliased GPIO_Point := (GPIO_E'Access, Pin_3); PE4 : aliased GPIO_Point := (GPIO_E'Access, Pin_4); PE5 : aliased GPIO_Point := (GPIO_E'Access, Pin_5); PE6 : aliased GPIO_Point := (GPIO_E'Access, Pin_6); PE7 : aliased GPIO_Point := (GPIO_E'Access, Pin_7); PE8 : aliased GPIO_Point := (GPIO_E'Access, Pin_8); PE9 : aliased GPIO_Point := (GPIO_E'Access, Pin_9); PE10 : aliased GPIO_Point := (GPIO_E'Access, Pin_10); PE11 : aliased GPIO_Point := (GPIO_E'Access, Pin_11); PE12 : aliased GPIO_Point := (GPIO_E'Access, Pin_12); PE13 : aliased GPIO_Point := (GPIO_E'Access, Pin_13); PE14 : aliased GPIO_Point := (GPIO_E'Access, Pin_14); PE15 : aliased GPIO_Point := (GPIO_E'Access, Pin_15); PF0 : aliased GPIO_Point := (GPIO_F'Access, Pin_0); PF1 : aliased GPIO_Point := (GPIO_F'Access, Pin_1); PF2 : aliased GPIO_Point := (GPIO_F'Access, Pin_2); PF3 : aliased GPIO_Point := (GPIO_F'Access, Pin_3); PF4 : aliased GPIO_Point := (GPIO_F'Access, Pin_4); PF5 : aliased GPIO_Point := (GPIO_F'Access, Pin_5); PF6 : aliased GPIO_Point := (GPIO_F'Access, Pin_6); PF7 : aliased GPIO_Point := (GPIO_F'Access, Pin_7); PF8 : aliased GPIO_Point := (GPIO_F'Access, Pin_8); PF9 : aliased GPIO_Point := (GPIO_F'Access, Pin_9); PF10 : aliased GPIO_Point := (GPIO_F'Access, Pin_10); PF11 : aliased GPIO_Point := (GPIO_F'Access, Pin_11); PF12 : aliased GPIO_Point := (GPIO_F'Access, Pin_12); PF13 : aliased GPIO_Point := (GPIO_F'Access, Pin_13); PF14 : aliased GPIO_Point := (GPIO_F'Access, Pin_14); PF15 : aliased GPIO_Point := (GPIO_F'Access, Pin_15); PG0 : aliased GPIO_Point := (GPIO_G'Access, Pin_0); PG1 : aliased GPIO_Point := (GPIO_G'Access, Pin_1); PG2 : aliased GPIO_Point := (GPIO_G'Access, Pin_2); PG3 : aliased GPIO_Point := (GPIO_G'Access, Pin_3); PG4 : aliased GPIO_Point := (GPIO_G'Access, Pin_4); PG5 : aliased GPIO_Point := (GPIO_G'Access, Pin_5); PG6 : aliased GPIO_Point := (GPIO_G'Access, Pin_6); PG7 : aliased GPIO_Point := (GPIO_G'Access, Pin_7); PG8 : aliased GPIO_Point := (GPIO_G'Access, Pin_8); PG9 : aliased GPIO_Point := (GPIO_G'Access, Pin_9); PG10 : aliased GPIO_Point := (GPIO_G'Access, Pin_10); PG11 : aliased GPIO_Point := (GPIO_G'Access, Pin_11); PG12 : aliased GPIO_Point := (GPIO_G'Access, Pin_12); PG13 : aliased GPIO_Point := (GPIO_G'Access, Pin_13); PG14 : aliased GPIO_Point := (GPIO_G'Access, Pin_14); PG15 : aliased GPIO_Point := (GPIO_G'Access, Pin_15); PH0 : aliased GPIO_Point := (GPIO_H'Access, Pin_0); PH1 : aliased GPIO_Point := (GPIO_H'Access, Pin_1); PH2 : aliased GPIO_Point := (GPIO_H'Access, Pin_2); PH3 : aliased GPIO_Point := (GPIO_H'Access, Pin_3); PH4 : aliased GPIO_Point := (GPIO_H'Access, Pin_4); PH5 : aliased GPIO_Point := (GPIO_H'Access, Pin_5); PH6 : aliased GPIO_Point := (GPIO_H'Access, Pin_6); PH7 : aliased GPIO_Point := (GPIO_H'Access, Pin_7); PH8 : aliased GPIO_Point := (GPIO_H'Access, Pin_8); PH9 : aliased GPIO_Point := (GPIO_H'Access, Pin_9); PH10 : aliased GPIO_Point := (GPIO_H'Access, Pin_10); PH11 : aliased GPIO_Point := (GPIO_H'Access, Pin_11); PH12 : aliased GPIO_Point := (GPIO_H'Access, Pin_12); PH13 : aliased GPIO_Point := (GPIO_H'Access, Pin_13); PH14 : aliased GPIO_Point := (GPIO_H'Access, Pin_14); PH15 : aliased GPIO_Point := (GPIO_H'Access, Pin_15); PI0 : aliased GPIO_Point := (GPIO_I'Access, Pin_0); PI1 : aliased GPIO_Point := (GPIO_I'Access, Pin_1); PI2 : aliased GPIO_Point := (GPIO_I'Access, Pin_2); PI3 : aliased GPIO_Point := (GPIO_I'Access, Pin_3); PI4 : aliased GPIO_Point := (GPIO_I'Access, Pin_4); PI5 : aliased GPIO_Point := (GPIO_I'Access, Pin_5); PI6 : aliased GPIO_Point := (GPIO_I'Access, Pin_6); PI7 : aliased GPIO_Point := (GPIO_I'Access, Pin_7); PI8 : aliased GPIO_Point := (GPIO_I'Access, Pin_8); PI9 : aliased GPIO_Point := (GPIO_I'Access, Pin_9); PI10 : aliased GPIO_Point := (GPIO_I'Access, Pin_10); PI11 : aliased GPIO_Point := (GPIO_I'Access, Pin_11); PI12 : aliased GPIO_Point := (GPIO_I'Access, Pin_12); PI13 : aliased GPIO_Point := (GPIO_I'Access, Pin_13); PI14 : aliased GPIO_Point := (GPIO_I'Access, Pin_14); PI15 : aliased GPIO_Point := (GPIO_I'Access, Pin_15); PJ0 : aliased GPIO_Point := (GPIO_J'Access, Pin_0); PJ1 : aliased GPIO_Point := (GPIO_J'Access, Pin_1); PJ2 : aliased GPIO_Point := (GPIO_J'Access, Pin_2); PJ3 : aliased GPIO_Point := (GPIO_J'Access, Pin_3); PJ4 : aliased GPIO_Point := (GPIO_J'Access, Pin_4); PJ5 : aliased GPIO_Point := (GPIO_J'Access, Pin_5); PJ6 : aliased GPIO_Point := (GPIO_J'Access, Pin_6); PJ7 : aliased GPIO_Point := (GPIO_J'Access, Pin_7); PJ8 : aliased GPIO_Point := (GPIO_J'Access, Pin_8); PJ9 : aliased GPIO_Point := (GPIO_J'Access, Pin_9); PJ10 : aliased GPIO_Point := (GPIO_J'Access, Pin_10); PJ11 : aliased GPIO_Point := (GPIO_J'Access, Pin_11); PJ12 : aliased GPIO_Point := (GPIO_J'Access, Pin_12); PJ13 : aliased GPIO_Point := (GPIO_J'Access, Pin_13); PJ14 : aliased GPIO_Point := (GPIO_J'Access, Pin_14); PJ15 : aliased GPIO_Point := (GPIO_J'Access, Pin_15); PK0 : aliased GPIO_Point := (GPIO_K'Access, Pin_0); PK1 : aliased GPIO_Point := (GPIO_K'Access, Pin_1); PK2 : aliased GPIO_Point := (GPIO_K'Access, Pin_2); PK3 : aliased GPIO_Point := (GPIO_K'Access, Pin_3); PK4 : aliased GPIO_Point := (GPIO_K'Access, Pin_4); PK5 : aliased GPIO_Point := (GPIO_K'Access, Pin_5); PK6 : aliased GPIO_Point := (GPIO_K'Access, Pin_6); PK7 : aliased GPIO_Point := (GPIO_K'Access, Pin_7); PK8 : aliased GPIO_Point := (GPIO_K'Access, Pin_8); PK9 : aliased GPIO_Point := (GPIO_K'Access, Pin_9); PK10 : aliased GPIO_Point := (GPIO_K'Access, Pin_10); PK11 : aliased GPIO_Point := (GPIO_K'Access, Pin_11); PK12 : aliased GPIO_Point := (GPIO_K'Access, Pin_12); PK13 : aliased GPIO_Point := (GPIO_K'Access, Pin_13); PK14 : aliased GPIO_Point := (GPIO_K'Access, Pin_14); PK15 : aliased GPIO_Point := (GPIO_K'Access, Pin_15); GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function; GPIO_AF_MCO_0 : constant GPIO_Alternate_Function; GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function; GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function; GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function; GPIO_AF_TIM1_1 : constant GPIO_Alternate_Function; GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function; GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function; GPIO_AF_TIM4_2 : constant GPIO_Alternate_Function; GPIO_AF_TIM5_2 : constant GPIO_Alternate_Function; GPIO_AF_TIM8_3 : constant GPIO_Alternate_Function; GPIO_AF_TIM9_3 : constant GPIO_Alternate_Function; GPIO_AF_TIM10_3 : constant GPIO_Alternate_Function; GPIO_AF_TIM11_3 : constant GPIO_Alternate_Function; GPIO_AF_LPTIM1_3 : constant GPIO_Alternate_Function; GPIO_AF_CEC_3 : constant GPIO_Alternate_Function; GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function; GPIO_AF_I2C2_4 : constant GPIO_Alternate_Function; GPIO_AF_I2C3_4 : constant GPIO_Alternate_Function; GPIO_AF_I2C4_4 : constant GPIO_Alternate_Function; GPIO_AF_CEC_4 : constant GPIO_Alternate_Function; GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function; GPIO_AF_SPI2_5 : constant GPIO_Alternate_Function; GPIO_AF_SPI3_5 : constant GPIO_Alternate_Function; GPIO_AF_SPI4_5 : constant GPIO_Alternate_Function; GPIO_AF_SPI5_5 : constant GPIO_Alternate_Function; GPIO_AF_SPI6_5 : constant GPIO_Alternate_Function; GPIO_AF_SPI3_6 : constant GPIO_Alternate_Function; GPIO_AF_SAI1_6 : constant GPIO_Alternate_Function; GPIO_AF_SPI2_7 : constant GPIO_Alternate_Function; GPIO_AF_SPI3_7 : constant GPIO_Alternate_Function; GPIO_AF_USART1_7 : constant GPIO_Alternate_Function; GPIO_AF_USART2_7 : constant GPIO_Alternate_Function; GPIO_AF_USART3_7 : constant GPIO_Alternate_Function; GPIO_AF_UART5_7 : constant GPIO_Alternate_Function; GPIO_AF_SPDIF_7 : constant GPIO_Alternate_Function; GPIO_AF_SAI2_8 : constant GPIO_Alternate_Function; GPIO_AF_UART4_8 : constant GPIO_Alternate_Function; GPIO_AF_UART5_8 : constant GPIO_Alternate_Function; GPIO_AF_USART6_8 : constant GPIO_Alternate_Function; GPIO_AF_UART7_8 : constant GPIO_Alternate_Function; GPIO_AF_UART8_8 : constant GPIO_Alternate_Function; GPIO_AF_SPDIF_8 : constant GPIO_Alternate_Function; GPIO_AF_CAN1_9 : constant GPIO_Alternate_Function; GPIO_AF_CAN2_9 : constant GPIO_Alternate_Function; GPIO_AF_TIM12_9 : constant GPIO_Alternate_Function; GPIO_AF_TIM13_9 : constant GPIO_Alternate_Function; GPIO_AF_TIM14_9 : constant GPIO_Alternate_Function; GPIO_AF_QUADSPI_9 : constant GPIO_Alternate_Function; GPIO_AF_LTDC_9 : constant GPIO_Alternate_Function; GPIO_AF_SAI2_10 : constant GPIO_Alternate_Function; GPIO_AF_QUADSPI_10 : constant GPIO_Alternate_Function; GPIO_AF_OTG1_FS_10 : constant GPIO_Alternate_Function; GPIO_AF_OTG2_HS_10 : constant GPIO_Alternate_Function; GPIO_AF_I2C4_11 : constant GPIO_Alternate_Function; GPIO_AF_ETH_11 : constant GPIO_Alternate_Function; GPIO_AF_OTG1_FS_11 : constant GPIO_Alternate_Function; GPIO_AF_FMC_12 : constant GPIO_Alternate_Function; GPIO_AF_SDMMC1_12 : constant GPIO_Alternate_Function; GPIO_AF_OTG2_FS_12 : constant GPIO_Alternate_Function; GPIO_AF_DCMI_13 : constant GPIO_Alternate_Function; GPIO_AF_LTDC_14 : constant GPIO_Alternate_Function; GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function; function GPIO_Port_Representation (Port : GPIO_Port) return UInt4 with Inline; ADC_1 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC1_Base; ADC_2 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC2_Base; ADC_3 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC3_Base; VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel); Temperature_Sensor : constant ADC_Point := VBat; -- see RM pg 410, section 13.10, also pg 389 VBat_Bridge_Divisor : constant := 4; -- The VBAT pin is internally connected to a bridge divider. The actual -- voltage is the raw conversion value * the divisor. See section 13.11, -- pg 412 of the RM. procedure Enable_Clock (This : aliased in out Analog_To_Digital_Converter); procedure Reset_All_ADC_Units; DAC_1 : aliased Digital_To_Analog_Converter with Import, Volatile, Address => DAC_Base; -- ??? Taken from the STM32F429 definition, TO BE CHECKED FOR THE F7 DAC_Channel_1_IO : constant GPIO_Point := PA4; DAC_Channel_2_IO : constant GPIO_Point := PA5; procedure Enable_Clock (This : aliased in out Digital_To_Analog_Converter); procedure Reset (This : aliased in out Digital_To_Analog_Converter); Internal_USART_1 : aliased Internal_USART with Import, Volatile, Address => USART1_Base; Internal_USART_2 : aliased Internal_USART with Import, Volatile, Address => USART2_Base; Internal_USART_3 : aliased Internal_USART with Import, Volatile, Address => USART3_Base; Internal_UART_4 : aliased Internal_USART with Import, Volatile, Address => UART4_Base; Internal_UART_5 : aliased Internal_USART with Import, Volatile, Address => UART5_Base; Internal_USART_6 : aliased Internal_USART with Import, Volatile, Address => USART6_Base; Internal_UART_7 : aliased Internal_USART with Import, Volatile, Address => UART7_Base; Internal_UART_8 : aliased Internal_USART with Import, Volatile, Address => UART8_Base; USART_1 : aliased USART (Internal_USART_1'Access); USART_2 : aliased USART (Internal_USART_2'Access); USART_3 : aliased USART (Internal_USART_3'Access); UART_4 : aliased USART (Internal_UART_4'Access); UART_5 : aliased USART (Internal_UART_5'Access); USART_6 : aliased USART (Internal_USART_6'Access); UART_7 : aliased USART (Internal_UART_7'Access); UART_8 : aliased USART (Internal_UART_8'Access); procedure Enable_Clock (This : aliased in out USART); procedure Reset (This : aliased in out USART); --------- -- DMA -- --------- DMA_1 : aliased DMA_Controller with Import, Volatile, Address => DMA1_Base; DMA_2 : aliased DMA_Controller with Import, Volatile, Address => DMA2_Base; procedure Enable_Clock (This : aliased in out DMA_Controller); procedure Reset (This : aliased in out DMA_Controller); --------- -- I2C -- --------- Internal_I2C_Port_1 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C1_Base; Internal_I2C_Port_2 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C2_Base; Internal_I2C_Port_3 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C3_Base; Internal_I2C_Port_4 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C4_Base; I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access); I2C_2 : aliased I2C_Port (Internal_I2C_Port_2'Access); I2C_3 : aliased I2C_Port (Internal_I2C_Port_3'Access); I2C_4 : aliased I2C_Port (Internal_I2C_Port_4'Access); type I2C_Port_Id is (I2C_Id_1, I2C_Id_2, I2C_Id_3, I2C_Id_4); function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id with Inline; procedure Enable_Clock (This : aliased I2C_Port'Class); procedure Enable_Clock (This : I2C_Port_Id); procedure Reset (This : I2C_Port'Class); procedure Reset (This : I2C_Port_Id); --------- -- SPI -- --------- Internal_SPI_1 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI1_Base; Internal_SPI_2 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI2_Base; Internal_SPI_3 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI3_Base; Internal_SPI_4 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI4_Base; Internal_SPI_5 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI5_Base; Internal_SPI_6 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI6_Base; SPI_1 : aliased SPI_Port (Internal_SPI_1'Access); SPI_2 : aliased SPI_Port (Internal_SPI_2'Access); SPI_3 : aliased SPI_Port (Internal_SPI_3'Access); SPI_4 : aliased SPI_Port (Internal_SPI_4'Access); SPI_5 : aliased SPI_Port (Internal_SPI_5'Access); SPI_6 : aliased SPI_Port (Internal_SPI_6'Access); SPI_1_DMA : aliased SPI_Port_DMA (Internal_SPI_1'Access); SPI_2_DMA : aliased SPI_Port_DMA (Internal_SPI_2'Access); SPI_3_DMA : aliased SPI_Port_DMA (Internal_SPI_3'Access); SPI_4_DMA : aliased SPI_Port_DMA (Internal_SPI_4'Access); SPI_5_DMA : aliased SPI_Port_DMA (Internal_SPI_5'Access); SPI_6_DMA : aliased SPI_Port_DMA (Internal_SPI_6'Access); procedure Enable_Clock (This : SPI_Port'Class); procedure Reset (This : SPI_Port'Class); Internal_I2S_1 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI1_Base; Internal_I2S_2 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI2_Base; Internal_I2S_3 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI3_Base; Internal_I2S_4 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI4_Base; Internal_I2S_5 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI5_Base; Internal_I2S_6 : aliased Internal_I2S_Port with Import, Volatile, Address => SPI6_Base; I2S_1 : aliased I2S_Port (Internal_I2S_1'Access, Extended => False); I2S_2 : aliased I2S_Port (Internal_I2S_2'Access, Extended => False); I2S_3 : aliased I2S_Port (Internal_I2S_3'Access, Extended => False); I2S_4 : aliased I2S_Port (Internal_I2S_4'Access, Extended => False); I2S_5 : aliased I2S_Port (Internal_I2S_5'Access, Extended => False); I2S_6 : aliased I2S_Port (Internal_I2S_6'Access, Extended => False); procedure Enable_Clock (This : I2S_Port); procedure Reset (This : in out I2S_Port); ------------ -- Timers -- ------------ Timer_1 : aliased Timer with Volatile, Address => TIM1_Base; pragma Import (Ada, Timer_1); Timer_2 : aliased Timer with Volatile, Address => TIM2_Base; pragma Import (Ada, Timer_2); Timer_3 : aliased Timer with Volatile, Address => TIM3_Base; pragma Import (Ada, Timer_3); Timer_4 : aliased Timer with Volatile, Address => TIM4_Base; pragma Import (Ada, Timer_4); Timer_5 : aliased Timer with Volatile, Address => TIM5_Base; pragma Import (Ada, Timer_5); Timer_6 : aliased Timer with Volatile, Address => TIM6_Base; pragma Import (Ada, Timer_6); Timer_7 : aliased Timer with Volatile, Address => TIM7_Base; pragma Import (Ada, Timer_7); Timer_8 : aliased Timer with Volatile, Address => TIM8_Base; pragma Import (Ada, Timer_8); Timer_9 : aliased Timer with Volatile, Address => TIM9_Base; pragma Import (Ada, Timer_9); Timer_10 : aliased Timer with Volatile, Address => TIM10_Base; pragma Import (Ada, Timer_10); Timer_11 : aliased Timer with Volatile, Address => TIM11_Base; pragma Import (Ada, Timer_11); Timer_12 : aliased Timer with Volatile, Address => TIM12_Base; pragma Import (Ada, Timer_12); Timer_13 : aliased Timer with Volatile, Address => TIM13_Base; pragma Import (Ada, Timer_13); Timer_14 : aliased Timer with Volatile, Address => TIM14_Base; pragma Import (Ada, Timer_14); procedure Enable_Clock (This : in out Timer); procedure Reset (This : in out Timer); ----------- -- Audio -- ----------- subtype SAI_Port is STM32_SVD.SAI.SAI_Peripheral; SAI_1 : SAI_Port renames STM32_SVD.SAI.SAI1_Periph; SAI_2 : SAI_Port renames STM32_SVD.SAI.SAI2_Periph; procedure Enable_Clock (This : in out SAI_Port); procedure Reset (This : in out SAI_Port); function Get_Input_Clock (Periph : SAI_Port) return UInt32; ----------- -- SDMMC -- ----------- type SDMMC_Clock_Source is (Src_Sysclk, Src_48Mhz); SDMMC_1 : aliased SDMMC_Controller (STM32_SVD.SDMMC.SDMMC_Periph'Access); procedure Enable_Clock (This : in out SDMMC_Controller); procedure Reset (This : in out SDMMC_Controller); procedure Set_Clock_Source (This : in out SDMMC_Controller; Src : SDMMC_Clock_Source); ----------------------------- -- Reset and Clock Control -- ----------------------------- type RCC_System_Clocks is record SYSCLK : UInt32; HCLK : UInt32; PCLK1 : UInt32; PCLK2 : UInt32; TIMCLK1 : UInt32; TIMCLK2 : UInt32; I2SCLK : UInt32; end record; function System_Clock_Frequencies return RCC_System_Clocks; procedure Set_PLLI2S_Factors (Pll_N : UInt9; Pll_R : UInt3); function PLLI2S_Enabled return Boolean; procedure Enable_PLLI2S with Post => PLLI2S_Enabled; procedure Disable_PLLI2S with Post => not PLLI2S_Enabled; type PLLSAI_DivR is new UInt2; PLLSAI_DIV2 : constant PLLSAI_DivR := 0; PLLSAI_DIV4 : constant PLLSAI_DivR := 1; PLLSAI_DIV8 : constant PLLSAI_DivR := 2; PLLSAI_DIV16 : constant PLLSAI_DivR := 3; procedure Set_PLLSAI_Factors (LCD : UInt3; VCO : UInt9; DivR : PLLSAI_DivR); procedure Enable_PLLSAI; procedure Disable_PLLSAI; function PLLSAI_Ready return Boolean; subtype DIVQ is Natural range 1 .. 32; procedure Configure_SAI_I2S_Clock (Periph : SAI_Port; PLLI2SN : UInt9; PLLI2SQ : UInt4; PLLI2SDIVQ : DIVQ); procedure Enable_DCMI_Clock; procedure Reset_DCMI; RTC : aliased RTC_Device; private HSE_VALUE : constant UInt32 := ADL_Config.High_Speed_External_Clock; GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0; GPIO_AF_MCO_0 : constant GPIO_Alternate_Function := 0; GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function := 0; GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function := 0; GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function := 0; GPIO_AF_TIM1_1 : constant GPIO_Alternate_Function := 1; GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function := 1; GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function := 2; GPIO_AF_TIM4_2 : constant GPIO_Alternate_Function := 2; GPIO_AF_TIM5_2 : constant GPIO_Alternate_Function := 2; GPIO_AF_TIM8_3 : constant GPIO_Alternate_Function := 3; GPIO_AF_TIM9_3 : constant GPIO_Alternate_Function := 3; GPIO_AF_TIM10_3 : constant GPIO_Alternate_Function := 3; GPIO_AF_TIM11_3 : constant GPIO_Alternate_Function := 3; GPIO_AF_LPTIM1_3 : constant GPIO_Alternate_Function := 3; GPIO_AF_CEC_3 : constant GPIO_Alternate_Function := 3; GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function := 4; GPIO_AF_I2C2_4 : constant GPIO_Alternate_Function := 4; GPIO_AF_I2C3_4 : constant GPIO_Alternate_Function := 4; GPIO_AF_I2C4_4 : constant GPIO_Alternate_Function := 4; GPIO_AF_CEC_4 : constant GPIO_Alternate_Function := 4; GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function := 5; GPIO_AF_SPI2_5 : constant GPIO_Alternate_Function := 5; GPIO_AF_SPI3_5 : constant GPIO_Alternate_Function := 5; GPIO_AF_SPI4_5 : constant GPIO_Alternate_Function := 5; GPIO_AF_SPI5_5 : constant GPIO_Alternate_Function := 5; GPIO_AF_SPI6_5 : constant GPIO_Alternate_Function := 5; GPIO_AF_SPI3_6 : constant GPIO_Alternate_Function := 6; GPIO_AF_SAI1_6 : constant GPIO_Alternate_Function := 6; GPIO_AF_SPI2_7 : constant GPIO_Alternate_Function := 7; GPIO_AF_SPI3_7 : constant GPIO_Alternate_Function := 7; GPIO_AF_USART1_7 : constant GPIO_Alternate_Function := 7; GPIO_AF_USART2_7 : constant GPIO_Alternate_Function := 7; GPIO_AF_USART3_7 : constant GPIO_Alternate_Function := 7; GPIO_AF_UART5_7 : constant GPIO_Alternate_Function := 7; GPIO_AF_SPDIF_7 : constant GPIO_Alternate_Function := 8; GPIO_AF_SAI2_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_UART4_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_UART5_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_USART6_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_UART7_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_UART8_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_SPDIF_8 : constant GPIO_Alternate_Function := 8; GPIO_AF_CAN1_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_CAN2_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_TIM12_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_TIM13_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_TIM14_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_QUADSPI_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_LTDC_9 : constant GPIO_Alternate_Function := 9; GPIO_AF_SAI2_10 : constant GPIO_Alternate_Function := 10; GPIO_AF_QUADSPI_10 : constant GPIO_Alternate_Function := 10; GPIO_AF_OTG1_FS_10 : constant GPIO_Alternate_Function := 10; GPIO_AF_OTG2_HS_10 : constant GPIO_Alternate_Function := 10; GPIO_AF_I2C4_11 : constant GPIO_Alternate_Function := 11; GPIO_AF_ETH_11 : constant GPIO_Alternate_Function := 11; GPIO_AF_OTG1_FS_11 : constant GPIO_Alternate_Function := 11; GPIO_AF_FMC_12 : constant GPIO_Alternate_Function := 12; GPIO_AF_SDMMC1_12 : constant GPIO_Alternate_Function := 12; GPIO_AF_OTG2_FS_12 : constant GPIO_Alternate_Function := 12; GPIO_AF_DCMI_13 : constant GPIO_Alternate_Function := 13; GPIO_AF_LTDC_14 : constant GPIO_Alternate_Function := 14; GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function := 15; end STM32.Device;
damaki/SPARKNaCl
Ada
3,290
ads
with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Sign; use SPARKNaCl.Sign; with SPARKNaCl.Cryptobox; use SPARKNaCl.Cryptobox; with SPARKNaCl.Hashing; use SPARKNaCl.Hashing; with SPARKNaCl.Stream; use SPARKNaCl.Stream; with SPARKNaCl.Core; use SPARKNaCl.Core; with Interfaces; use Interfaces; with Interfaces.C; package TweetNaCl_API is GF_Add : Unsigned_64 with Import, Convention => C, Link_Name => "tweet_gf_add"; GF_Sub : Unsigned_64 with Import, Convention => C, Link_Name => "tweet_gf_sub"; GF_Mul : Unsigned_64 with Import, Convention => C, Link_Name => "tweet_gf_mul"; GF_Car : Unsigned_64 with Import, Convention => C, Link_Name => "tweet_gf_car"; procedure Crypto_Sign (SM : out Byte_Seq; SMLen : out Unsigned_64; M : in Byte_Seq; N : in Unsigned_64; SK : in Signing_SK) with Import, Convention => C, Link_Name => "crypto_sign_ed25519_tweet"; procedure Crypto_Sign2 (SM : out Byte_Seq; SMLen : out Unsigned_64; M : in Byte_Seq; N : in Unsigned_64; SK : in Signing_SK; Hash_SK : out Unsigned_64; Hash_Reduce_SM1 : out Unsigned_64; Scalarbase_R : out Unsigned_64; Pack_P : out Unsigned_64; Hash_Reduce_SM2 : out Unsigned_64; Initialize_X : out Unsigned_64; Assign_X : out Unsigned_64; ModL_X : out Unsigned_64) with Import, Convention => C, Link_Name => "crypto_sign2_ed25519_tweet"; function Crypto_Sign_Open (M : out Byte_Seq; MLen : out Unsigned_64; SM : in Byte_Seq; N : in Unsigned_64; PK : in Signing_PK) return Interfaces.C.int with Import, Convention => C, Link_Name => "crypto_sign_ed25519_tweet_open"; procedure Crypto_Hash (SM : out Digest; M : in Byte_Seq; N : in Unsigned_64) with Import, Convention => C, Link_Name => "crypto_hash_sha512_tweet"; procedure Crypto_Box (C : out Byte_Seq; M : in Byte_Seq; MLen : in Unsigned_64; N : in Stream.HSalsa20_Nonce; Recipient_PK : in Public_Key; Sender_SK : in Secret_Key) with Import, Convention => C, Link_Name => "crypto_box_curve25519xsalsa20poly1305_tweet"; procedure Reset with Import, Convention => C, Link_Name => "tweet_reset"; procedure Crypto_Scalarmult (Q : out Bytes_32; N : in Bytes_32; P : in Bytes_32) with Import, Convention => C, Link_Name => "crypto_scalarmult_curve25519_tweet"; procedure HSalsa20 (C : out Byte_Seq; -- Output stream CLen : in Unsigned_64; N : in HSalsa20_Nonce; -- Nonce K : in Salsa20_Key) -- Key with Import, Convention => C, Link_Name => "crypto_stream_xsalsa20_tweet"; end TweetNaCl_API;
optikos/oasis
Ada
4,520
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Enumeration_Types is function Create (Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Literals : not null Program.Elements .Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Enumeration_Type is begin return Result : Enumeration_Type := (Left_Bracket_Token => Left_Bracket_Token, Literals => Literals, Right_Bracket_Token => Right_Bracket_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Literals : not null Program.Elements .Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Enumeration_Type is begin return Result : Implicit_Enumeration_Type := (Literals => Literals, 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 Literals (Self : Base_Enumeration_Type) return not null Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Vector_Access is begin return Self.Literals; end Literals; overriding function Left_Bracket_Token (Self : Enumeration_Type) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Enumeration_Type) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Enumeration_Type) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Enumeration_Type) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Enumeration_Type) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Enumeration_Type'Class) is begin for Item in Self.Literals.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Enumeration_Type_Element (Self : Base_Enumeration_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Enumeration_Type_Element; overriding function Is_Type_Definition_Element (Self : Base_Enumeration_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Type_Definition_Element; overriding function Is_Definition_Element (Self : Base_Enumeration_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition_Element; overriding procedure Visit (Self : not null access Base_Enumeration_Type; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Enumeration_Type (Self); end Visit; overriding function To_Enumeration_Type_Text (Self : aliased in out Enumeration_Type) return Program.Elements.Enumeration_Types.Enumeration_Type_Text_Access is begin return Self'Unchecked_Access; end To_Enumeration_Type_Text; overriding function To_Enumeration_Type_Text (Self : aliased in out Implicit_Enumeration_Type) return Program.Elements.Enumeration_Types.Enumeration_Type_Text_Access is pragma Unreferenced (Self); begin return null; end To_Enumeration_Type_Text; end Program.Nodes.Enumeration_Types;
reznikmm/matreshka
Ada
3,789
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.Db_Parameter_Name_Substitution_Attributes is pragma Preelaborate; type ODF_Db_Parameter_Name_Substitution_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Db_Parameter_Name_Substitution_Attribute_Access is access all ODF_Db_Parameter_Name_Substitution_Attribute'Class with Storage_Size => 0; end ODF.DOM.Db_Parameter_Name_Substitution_Attributes;
reznikmm/matreshka
Ada
3,687
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 XML.DOM.Attributes; package ODF.DOM.Attributes.Style.Text_Underline_Style is type ODF_Style_Text_Underline_Style is new XML.DOM.Attributes.DOM_Attribute with private; private type ODF_Style_Text_Underline_Style is new XML.DOM.Attributes.DOM_Attribute with null record; end ODF.DOM.Attributes.Style.Text_Underline_Style;
ekoeppen/MSP430_Generic_Ada_Drivers
Ada
2,695
adb
with MSP430_SVD; use MSP430_SVD; with MSP430_SVD.PORT_1_2; use MSP430_SVD.PORT_1_2; with MSP430_SVD.ADC10; use MSP430_SVD.ADC10; with System.Machine_Code; use System.Machine_Code; with System; package body MSPGD.GPIO.Pin is procedure BIS (N : System.Address; Bit: UInt3) is begin -- Asm ("bis #%1, &%0", Volatile => True, -- Inputs => (System.Address'Asm_Input ("I", N), UInt3'Asm_Input ("I", Bit))); null; end BIS; procedure BIS_B (N : System.Address; Bits: Byte) is begin -- Asm ("bis.b %1, %0", Volatile => True, -- Inputs => (System.Address'Asm_Input ("m", N), Byte'Asm_Input ("i", Bits))); null; end BIS_B; procedure Init is begin case Port is when 1 => if Direction = Output then PORT_1_2_Periph.P1DIR.Arr (Pin) := 1; end if; if Pull_Resistor /= None then PORT_1_2_Periph.P1REN.Arr (Pin) := 1; if Pull_Resistor = Up then PORT_1_2_Periph.P1OUT.Arr (Pin) := 1; end if; end if; case Alt_Func is when IO => null; when Primary => PORT_1_2_Periph.P1SEL.Arr (Pin) := 1; when Secondary => PORT_1_2_Periph.P1SEL.Arr (Pin) := 1; PORT_1_2_Periph.P1SEL2.Arr (Pin) := 1; when Device_Specific => PORT_1_2_Periph.P1SEL2.Arr (Pin) := 1; when Analog => BIS (ADC10_Periph.ADC10AE0'Address, 2 ** Pin); when Comparator => null; end case; when 2 => if Direction = Output then PORT_1_2_Periph.P2DIR.Arr (Pin) := 1; end if; if Pull_Resistor /= None then PORT_1_2_Periph.P2REN.Arr (Pin) := 1; if Pull_Resistor = Up then PORT_1_2_Periph.P2OUT.Arr (Pin) := 1; end if; end if; when others => null; end case; end Init; procedure Set is begin case Port is when 1 => PORT_1_2_Periph.P1OUT.Arr (Pin) := 1; when 2 => PORT_1_2_Periph.P2OUT.Arr (Pin) := 1; when others => null; end case; end Set; procedure Clear is begin case Port is when 1 => PORT_1_2_Periph.P1OUT.Arr (Pin) := 0; when 2 => PORT_1_2_Periph.P2OUT.Arr (Pin) := 0; when others => null; end case; end Clear; function Is_Set return Boolean is begin case Port is when 1 => return (PORT_1_2_Periph.P1IN.Val and 2 ** Pin) /= 0; when 2 => return (PORT_1_2_Periph.P2IN.Val and 2 ** Pin) /= 0; when others => return false; end case; end Is_Set; end MSPGD.GPIO.Pin;
rveenker/sdlada
Ada
4,490
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Inputs.Joysticks -------------------------------------------------------------------------------------------------------------------- with Ada.Finalization; private with SDL.C_Pointers; with SDL.Events.Joysticks; package SDL.Inputs.Joysticks is Joystick_Error : exception; -- Use to determine whether there are no joysticks. type All_Devices is range 0 .. 2 ** 31 - 1 with Convention => C, Size => 32; -- This range is the range of all connected joysticks. subtype Devices is All_Devices range All_Devices'First + 1 .. All_Devices'Last; -- SDL_Joystick_ID = instance ID. type Instances is range 0 .. 2 ** 31 - 1 with Convention => C, Size => 32; type GUID_Element is range 0 .. 255 with convention => C, Size => 8; type GUID_Array is array (1 .. 16) of aliased GUID_Element with Convention => C; -- Pack => True; type GUIDs is record Data : GUID_Array; end record with Convention => C_Pass_By_Copy; -- Device specific information. function Total return All_Devices; function Name (Device : in Devices) return String; function GUID (Device : in Devices) return GUIDs; -- GUID utilities. function Image (GUID : in GUIDs) return String; function Value (GUID : in String) return GUIDs; -- Joysticks. type Joystick is new Ada.Finalization.Limited_Controlled with private; Null_Joystick : constant Joystick; function "=" (Left, Right : in Joystick) return Boolean with Inline => True; procedure Close (Self : in out Joystick); -- Information. function Axes (Self : in Joystick) return SDL.Events.Joysticks.Axes; function Balls (Self : in Joystick) return SDL.Events.Joysticks.Balls; function Buttons (Self : in Joystick) return SDL.Events.Joysticks.Buttons; function Hats (Self : in Joystick) return SDL.Events.Joysticks.Hats; function Name (Self : in Joystick) return String; function Is_Haptic (Self : in Joystick) return Boolean; function Is_Attached (Self : in Joystick) return Boolean with Inline => True; function GUID (Self : in Joystick) return GUIDs with Inline => True; function Instance (Self : in Joystick) return Instances; -- Data. function Axis_Value (Self : in Joystick; Axis : in SDL.Events.Joysticks.Axes) return SDL.Events.Joysticks.Axes_Values; procedure Ball_Value (Self : in Joystick; Ball : in SDL.Events.Joysticks.Balls; Delta_X, Delta_Y : out SDL.Events.Joysticks.Ball_Values); function Hat_Value (Self : in Joystick; Hat : in SDL.Events.Joysticks.Hats) return SDL.Events.Joysticks.Hat_Positions; function Is_Button_Pressed (Self : in Joystick; Button : in SDL.Events.Joysticks.Buttons) return SDL.Events.Button_State; private type Joystick is new Ada.Finalization.Limited_Controlled with record Internal : SDL.C_Pointers.Joystick_Pointer := null; Owns : Boolean := True; end record; Null_Joystick : constant Joystick := (Ada.Finalization.Limited_Controlled with Internal => null, Owns => True); end SDL.Inputs.Joysticks;
damaki/libkeccak
Ada
8,724
ads
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * The name of the copyright holder may not be used to endorse or promote -- Products derived from this software without specific prior written -- permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY -- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with Keccak.Generic_XOF; with Keccak.Generic_Parallel_XOF; with Keccak.Types; -- @summary -- Generic implementation of the KangarooTwelve hash algorithm. -- -- @description -- This API is used as follows: -- -- 1 Initialise a new context by calling Init. -- -- 2 Call Update one or more times to input an arbitrary amount of data. -- -- 3 Call Finish after all input data has been processed. An optional -- customisation string can be given to provide domain separation -- between different uses of KangarooTwelve. -- -- 4 Call Extract one or more times to produce an arbitrary number of output bytes. -- -- @group KangarooTwelve generic CV_Size_Bytes : Positive; -- The size of each chaining value (CV) in bytes. -- This is set to 256 bits (32 bytes) for KangarooTwelve -- and 512 bits (64 bytes) for MarsupilamiFourteen. with package XOF_Serial is new Keccak.Generic_XOF (<>); -- This XOF must be configured with NO SUFFIX BITS. -- The Generic_KangarooTwelve implementation takes care of the appropriate -- suffix bits when using this XOF_Serial. with package XOF_Parallel_2 is new Keccak.Generic_Parallel_XOF (<>); -- This XOF must be configured to add the 3 suffix bits 2#011#. with package XOF_Parallel_4 is new Keccak.Generic_Parallel_XOF (<>); -- This XOF must be configured to add the 3 suffix bits 2#011#. with package XOF_Parallel_8 is new Keccak.Generic_Parallel_XOF (<>); -- This XOF must be configured to add the 3 suffix bits 2#011#. package Keccak.Generic_KangarooTwelve is -- Assertions to check that the correct parallel instances have -- been provided. pragma Assert (XOF_Parallel_2.Num_Parallel_Instances = 2); pragma Assert (XOF_Parallel_4.Num_Parallel_Instances = 4); pragma Assert (XOF_Parallel_8.Num_Parallel_Instances = 8); Block_Size_Bytes : constant := 8192; -- Size of each parallel block. -- This is set to 8 kiB in the K12 documentation. type Context is private; type States is (Updating, Ready_To_Extract, Extracting); -- The possible states for the context. -- -- @value Updating When in this state the context can be fed -- with input data by calling the Update procedure. -- -- @value Ready_To_Extract When in this state the Update procedure can -- no longer be called (i.e. no more data can be input to the context), -- and the context is ready to generate output data. -- -- @value Extracting When in this state the context can produce output -- bytes by calling the Extract procedure. type Byte_Count is new Long_Long_Integer range 0 .. Long_Long_Integer'Last; -- Represents a quantity of bytes. procedure Init (Ctx : out Context) with Global => null, Post => State_Of (Ctx) = Updating; -- Initialise the KangarooTwelve state. procedure Update (Ctx : in out Context; Data : in Types.Byte_Array) with Global => null, Pre => (State_Of (Ctx) = Updating and Byte_Count (Data'Length) <= Max_Input_Length (Ctx)), Post => (State_Of (Ctx) = Updating and Num_Bytes_Processed (Ctx) = Num_Bytes_Processed (Ctx'Old) + Byte_Count (Data'Length)); -- Process input bytes. -- -- This may be called multiple times to process long messages. -- -- The total number of input bytes that can be processed cannot -- exceed Byte_Count'Last (a subtype of Long_Long_Integer). This is -- because KangarooTwelve feeds the total input length into the -- calculation. The total number of input bytes processed so far -- can be retrieved by calling the Num_Bytes_Processed function, -- and the maximum allowed input size remaining can be retrieved -- by calling Max_Input_Length. -- -- @param Ctx The KangarooTwelve context. -- @param Data The input bytes to process. The entire array is processed. procedure Finish (Ctx : in out Context; Customization : in String) with Global => null, Pre => (State_Of (Ctx) = Updating and then (Byte_Count (Customization'Length) + Byte_Count (Long_Long_Integer'Size / 8) + 2 <= Max_Input_Length (Ctx))), Post => State_Of (Ctx) = Ready_To_Extract; -- Prepare the KangarooTwelve context to produce output. -- -- This is called once only, after all input bytes have been -- processed, and must be called before calling Extract. -- -- An optional Customization string can be applied to provide -- domain separation between different KangarooTwelve instances. -- I.e. processing the exact same input data twice, but with -- different customization strings will result in unrelated outputs. -- -- @param Ctx The KangarooTwelve context. -- @param Customization An optional customization string for domain -- separation. If not needed, then an empty string can be used. procedure Extract (Ctx : in out Context; Data : out Types.Byte_Array) with Global => null, Pre => State_Of (Ctx) in Ready_To_Extract | Extracting, Post => State_Of (Ctx) = Extracting; -- Get output bytes. -- -- This can be called multiple times to produce very long outputs. -- -- The Finish procedure must be called before the first call to Extract. function State_Of (Ctx : in Context) return States with Global => null; -- Get the current state of the context. function Num_Bytes_Processed (Ctx : in Context) return Byte_Count with Inline, Global => null; -- Get the total number of input bytes processed so far. function Max_Input_Length (Ctx : in Context) return Byte_Count with Inline, Global => null; -- Get the maximum input length that may be provided to as input -- to KangarooTwelve. This decreases as input bytes are processed. private use type XOF_Serial.States; subtype Partial_Block_Length_Number is Natural range 0 .. Block_Size_Bytes - 1; type Context is record Outer_XOF : XOF_Serial.Context; Partial_Block_XOF : XOF_Serial.Context; Input_Len : Byte_Count; Partial_Block_Length : Partial_Block_Length_Number; Finished : Boolean; end record; function State_Of (Ctx : in Context) return States is (if (XOF_Serial.State_Of (Ctx.Outer_XOF) = XOF_Serial.Updating and XOF_Serial.State_Of (Ctx.Partial_Block_XOF) = XOF_Serial.Updating) then (if Ctx.Finished then Ready_To_Extract else Updating) elsif XOF_Serial.State_Of (Ctx.Outer_XOF) = XOF_Serial.Ready_To_Extract then Ready_To_Extract else Extracting); function Num_Bytes_Processed (Ctx : in Context) return Byte_Count is (Ctx.Input_Len); function Max_Input_Length (Ctx : in Context) return Byte_Count is (Byte_Count'Last - Num_Bytes_Processed (Ctx)); end Keccak.Generic_KangarooTwelve;
reznikmm/matreshka
Ada
5,153
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-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 Matreshka.Internals.Finite_Automatons; with League.Strings; package UAFLEX.Generator.Tables is type State_Map is array (Matreshka.Internals.Finite_Automatons.State range <>) of Matreshka.Internals.Finite_Automatons.State; -- Map from original states to remaped states procedure Map_Final_Dead_Ends (DFA : Matreshka.Internals.Finite_Automatons.DFA; First_Dead_End : out Matreshka.Internals.Finite_Automatons.State; First_Final : out Matreshka.Internals.Finite_Automatons.State; Dead_End_Map : out State_Map); -- Remap final states without any further edges to the end of state range procedure Split_To_Distinct (List : Matreshka.Internals.Finite_Automatons.Vectors.Vector; Result : out Matreshka.Internals.Finite_Automatons.Vectors.Vector); procedure Go (DFA : Matreshka.Internals.Finite_Automatons.DFA; Dead_End_Map : State_Map; First_Dead_End : Matreshka.Internals.Finite_Automatons.State; First_Final : Matreshka.Internals.Finite_Automatons.State; Unit : League.Strings.Universal_String; File : String; Types : League.Strings.Universal_String; Scanner : League.Strings.Universal_String; Classes : Matreshka.Internals.Finite_Automatons.Vectors.Vector); procedure Types (DFA : Matreshka.Internals.Finite_Automatons.DFA; Dead_End_Map : State_Map; First_Dead_End : Matreshka.Internals.Finite_Automatons.State; First_Final : Matreshka.Internals.Finite_Automatons.State; Unit : League.Strings.Universal_String; File : String; Classes : Matreshka.Internals.Finite_Automatons.Vectors.Vector); end UAFLEX.Generator.Tables;
davidkristola/vole
Ada
31,814
adb
with Ada.Exceptions; use Ada.Exceptions; with kv.avm.Symbol_Tables; with kv.avm.References; with kv.avm.Instructions; with kv.avm.Registers; use kv.avm.Registers; with kv.avm.Log; use kv.avm.Log; package body kv.avm.Code_Generator is ---------------------------------------------------------------------------- procedure Init (Self : in out Code_Generator_Class) is begin null; end Init; ---------------------------------------------------------------------------- procedure Finalize (Self : in out Code_Generator_Class) is begin null; end Finalize; ---------------------------------------------------------------------------- procedure Explore_Next (Self : in out Code_Generator_Class; Target : in Node_Base_Class'CLASS; Depth : in Natural) is Next : Node_Pointer; begin Next := Target.Get_Association(My_Next); if Next /= null then Next.Visit(Self'ACCESS, Depth); end if; end Explore_Next; ---------------------------------------------------------------------------- procedure Explore (Self : in out Code_Generator_Class; Target : in Node_Base_Class'CLASS; Depth : in Natural; Go_Next : in Boolean := True) is Child : Node_Pointer; begin for Association in Child_Association_Type loop Child := Target.Get_Association(Association); if Child /= null then Child.Visit(Self'ACCESS, Depth+1); end if; end loop; if Go_Next then Explore_Next(Self, Target, Depth); end if; end Explore; ---------------------------------------------------------------------------- procedure Visit_Id (Self : in out Code_Generator_Class; Target : in out Id_Node_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Id, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Actor_Definition (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Actor_Node : Actor_Definition_Class; Table : access kv.avm.Symbol_Tables.Symbol_Table; Super_Name_Node : Node_Pointer; ---------------------------------------------------------------------------- procedure Print_Symbol (Name : in String; Kind : in kv.avm.Registers.Data_Kind; Indx : in Natural; Init : in String) is function Default return String is begin if Init = "" then return ""; end if; return " := " & Init; end Default; function Constant_Name(Index : Natural) return String is Img : String := Natural'IMAGE(Index); begin Img(1) := 'C'; return Img; end Constant_Name; begin Self.Buffer.Put_Meta(" " & Constant_Name(Indx) & " : " & kv.avm.Registers.Data_Kind'IMAGE(Kind) & Default & " # " & Name); end Print_Symbol; begin Actor_Node := Actor_Definition_Class(Target); Super_Name_Node := Actor_Node.Get_Super_Class; Self.Buffer.Put_Meta(".actor " & Target.Get_Name); if Super_Name_Node /= null then Self.Buffer.Put_Meta("..subclassof " & Super_Name_Node.Get_Name); end if; Self.Buffer.Put_Meta("..constants"); Table := Actor_Definition_Class(Target).Get_Symbol_Table(CONSTANT_SYMBOLS); Table.For_Each(Print_Symbol'ACCESS); Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Actor_Definition, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Attribute_Definition (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Attribute_Definition, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Message_Definition (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Predicate : Node_Pointer := Target.Get_Association(My_Condition); function Offset_For(P : Node_Pointer) return String is Image : constant String := Resolve_Register(P.all); begin return Image(2 .. Image'LAST); end Offset_For; begin Self.Buffer.Put_Meta("..message " & Target.Get_Name); if Predicate /= null then Self.Buffer.Put_Meta("...predicate " & Offset_For(Predicate)); end if; Explore(Self, Target, Depth, False); Self.Buffer.Put_Instruction(" STOP_FRAME"); Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Message_Definition, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Kind_Node (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Kind_Node, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Argument (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Argument, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Constructor_Send_Node (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Father : Node_Pointer := Target.Get_Association(My_Parent); Grandpa : Node_Pointer := Father.Get_Association(My_Parent); Arguments : Node_Pointer := Target.Get_Association(My_Arguments); New_Actor : Node_Pointer := Target.Get_Association(My_Destination); Out_Count : Positive; procedure Put_New_Actor(Arguments : in String) is begin Self.Buffer.Put_Instruction(" NEW_ACTOR " & Resolve_Register(Grandpa.all) & " := " & Arguments & " => " & Resolve_Register(New_Actor.all)); end Put_New_Actor; begin Explore(Self, Target, Depth); Out_Count := Arguments.Get_Length; if Out_Count > 1 then Self.Buffer.Put_Comment(" # fold " & Positive'IMAGE(Out_Count) & " arguments."); Put_New_Actor("the_new_fold"); else Put_New_Actor(Resolve_Register(Arguments.all)); end if; exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Constructor_Send_Node, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Expression_List (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Expression_List, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Op (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Rhs : Node_Pointer := Target.Get_Association(My_Right); Lhs : Node_Pointer := Target.Get_Association(My_Left); begin Explore(Self, Target, Depth); if Lhs = null then -- emit a unary set --!@#$ what about transformative unary operators like '-' or abs? --!@#$ maybe emit nothing! Self.Buffer.Put_Instruction(" SET " & Resolve_Register(Target) & " := " & Resolve_Register(Rhs.all)); null; else Self.Buffer.Put_Instruction(" COMPUTE " & Resolve_Register(Target) & " := " & Resolve_Register(Lhs.all) & " " & kv.avm.Instructions.Encode_Operation(Expression_Op_Class(Target).Get_Op) & " " & Resolve_Register(Rhs.all)); end if; exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Expression_Op, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Var (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Expression_Var, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Literal (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Expression_Literal, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Send (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_Call_Class := Expression_Call_Class(Target)'ACCESS; procedure Format_5a2(Instruction : String) is begin Self.Buffer.Put_Instruction(" " & Instruction & " " & Resolve_Register(Target.Get_Association(My_Arguments).all) & " => " & Resolve_Register(Target.Get_Association(My_Destination).all) & " . " & Resolve_Register(Target.Get_Association(My_Name).all)); -- 5a2 end Format_5a2; procedure Format_5b2(Instruction : String) is begin Self.Buffer.Put_Instruction(" " & Instruction & " " & Resolve_Register(Target.Get_Association(My_Arguments).all) & " => " & Resolve_Register(Target.Get_Association(My_Name).all)); -- 5b2 end Format_5b2; begin Explore(Self, Target, Depth); if E.Is_Gosub then if E.Is_Call then if E.Is_Tail then Format_5b2("SELF_TAIL_CALL"); else Self.Buffer.Put_Instruction(" SELF_CALL " & Resolve_Register(Target) & " := " & Resolve_Register(Target.Get_Association(My_Arguments).all) & " => " & Resolve_Register(Target.Get_Association(My_Name).all) ); -- 5b1 end if; else if E.Is_Tail then Format_5b2("SELF_TAIL_SEND"); else Format_5b2("SELF_SEND"); end if; end if; else if E.Is_Call then if E.Is_Tail then Format_5a2("ACTOR_TAIL_CALL"); else Self.Buffer.Put_Instruction(" ACTOR_CALL " & Resolve_Register(Target) & " := " & Resolve_Register(Target.Get_Association(My_Arguments).all) & " => " & Resolve_Register(Target.Get_Association(My_Destination).all) & " . " & Resolve_Register(Target.Get_Association(My_Name).all)); -- 5a1 end if; else if E.Is_Tail then Format_5a2("ACTOR_TAIL_SEND"); else Format_5a2("ACTOR_SEND"); end if; end if; end if; exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Expression_Send, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Fold (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_Fold_Class := Expression_Fold_Class(Target)'ACCESS; begin Explore(Self, Target, Depth); Self.Buffer.Put_Instruction(" FOLD " & Resolve_Register(Target) & " := " & Resolve_Ref_Name(Target, E.Get_Tuple_Map_Name) & " # [" & E.Get_Tuple_Map_Init & "]"); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Expression_Fold, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_List (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth, False); Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_List, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Assign (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Dst : Node_Pointer := Target.Get_Association(My_Destination); Src : Node_Pointer := Target.Get_Association(My_Value); Destination : constant String := Resolve_Name(Dst.all); Source : constant String := Resolve_Name(Src.all); begin declare Dst_Reg : constant String := Resolve_Register(Dst.all, True); Src_Reg : constant String := Resolve_Register(Src.all, True); Dst_Kind : kv.avm.Registers.Data_Kind := Dst.Get_Kind; Src_Kind : kv.avm.Registers.Data_Kind := Src.Get_Kind; begin Explore(Self, Target, Depth, False); -- If the source is a 1-tuple and the dest is not, then we are unfolding, not setting if Src_Kind = Tuple and Dst_Kind /= Tuple then Self.Buffer.Put_Instruction(" PEEK_IMMEDIATE " & Dst_Reg & " := " & Src_Reg & " [ 0 ]"); else Self.Buffer.Put_Instruction(" SET " & Dst_Reg & " := " & Src_Reg & " # " & Destination & " := " & Source); end if; Explore_Next(Self, Target, Depth); end; exception when Terminate_Parsing => raise; -- Quietly leave when kv.avm.vole_tree.Variable_Undefined => Put_Error("Error: assignment statement (line" & Positive'IMAGE(Target.Get_Line) & ") to undefined varaiable '" & Destination & "'."); raise Terminate_Parsing; when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_Assign, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Var_Def (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Kind_Node : Node_Pointer := Target.Get_Association(My_Kind); Init_Node : Node_Pointer; procedure Initialize_Var(Src : Node_Pointer; Dst : Node_Pointer) is begin declare Destination : constant String := Resolve_Name(Dst.all); Source : constant String := Resolve_Name(Src.all); Dst_Reg : constant String := Resolve_Register(Dst.all, True); Src_Reg : constant String := Resolve_Register(Src.all, True); Dst_Kind : kv.avm.Registers.Data_Kind := Dst.Get_Kind; Src_Kind : kv.avm.Registers.Data_Kind := Src.Get_Kind; begin --!@#$ new_actor makes this redundant (and not work) if Source /= "Could not Resolve_Name" then Self.Buffer.Put_Instruction(" SET " & Dst_Reg & " := " & Src_Reg & " # " & Destination & " := " & Source); end if; end; exception when Unresolveable_Name => null; -- It is okay to skip this if the name can't be resolved. when Variable_Undefined => null; -- It is okay to skip this if the name can't be resolved. end Initialize_Var; begin --Self.Buffer.Put_Comment(" # local variable " & Target.Get_Name & " defined."); Explore(Self, Target, Depth, False); if Kind_Node /= null then Init_Node := Kind_Node.Get_Association(My_Value); if Init_Node /= null then Initialize_Var(Init_Node, Target.Get_Association(My_Name)); end if; else null; --!@#$ This should be an internal error because the grammar should not let us get here. end if; Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_Var_Def, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Emit (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Src_Reg : constant String := Resolve_Register(Target.Get_Association(My_Value).all); begin Explore(Self, Target, Depth, False); Self.Buffer.Put_Instruction(" EMIT " & Src_Reg); Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_Emit, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Return (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Value : Node_Pointer := Target.Get_Association(My_Value); Method : Node_Pointer := Message_Of(Target); Out_Count : Positive; begin Explore(Self, Target, Depth, False); if Value = null then -- Return the specified value(s) Out_Count := Method.Get_Association(My_Outputs).Get_Length; if Out_Count = 1 then -- default single output (always in local 0) Self.Buffer.Put_Instruction(" REPLY " & kv.avm.References.Make_Register_Name(0, kv.avm.References.Local)); else Self.Buffer.Put_Instruction(" fold " & Positive'IMAGE(Out_Count) & " parameter(s)."); Self.Buffer.Put_Instruction(" REPLY x # default out of" & Positive'IMAGE(Out_Count) & " parameter(s)."); end if; else -- Return some non-default value if Value.all in Expression_Call_Class'CLASS then -- Tail call null; -- Nothing to return since a tail call was made. else Self.Buffer.Put_Instruction(" REPLY " & Resolve_Register(Target.Get_Association(My_Value).all)); -- Something else end if; end if; Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_Return, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_If (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is use kv.avm.Code_Buffers; Condition_Node : Node_Pointer := Target.Get_Association(My_Condition); Then_Part_Node : Node_Pointer := Target.Get_Association(My_Then_Part); Else_Part_Node : Node_Pointer := Target.Get_Association(My_Else_Part); Src_Reg : constant String := Resolve_Register(Condition_Node.all); Skip_Then_Count : Natural := 0; Skip_Else_Count : Natural := 0; Main_Buffer : kv.avm.Code_Buffers.Buffer_Type; Then_Buffer : kv.avm.Code_Buffers.Buffer_Type; Else_Buffer : kv.avm.Code_Buffers.Buffer_Type; procedure Visit_Part(Part_Node : in Node_Pointer; Buffer : in out Buffer_Type; Count : out Natural) is begin Self.Buffer := Buffer; if Part_Node /= null then Part_Node.Visit(Self'ACCESS, Depth + 1); end if; Buffer := Self.Buffer; Count := Buffer.Code_Count; end Visit_Part; begin if Condition_Node /= null then Condition_Node.Visit(Self'ACCESS, Depth+1); end if; Main_Buffer := Self.Buffer; Visit_Part(Then_Part_Node, Then_Buffer, Skip_Then_Count); Visit_Part(Else_Part_Node, Else_Buffer, Skip_Else_Count); Self.Buffer := Main_Buffer; -- BRANCH_REL branches when Src_Reg is True so we fall through to the else part. -- Note the "+ 1"; skip the added JUMP_REL instruction to jump over the then part. -- Self.Buffer.Put_Instruction(" BRANCH_REL " & Src_Reg & Natural'IMAGE(Skip_Else_Count + 1)); Self.Buffer.Append(Else_Buffer); Self.Buffer.Put_Instruction(" JUMP_REL " & Natural'IMAGE(Skip_Then_Count)); -- Jump over then part Self.Buffer.Append(Then_Buffer); Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_If, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Assert (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Condition : Node_Pointer := Target.Get_Association(My_Condition); Condition_Name : constant String := Resolve_Name(Condition.all); Condition_Reg : constant String := Resolve_Register(Condition.all); Condition_Kind : kv.avm.Registers.Data_Kind := Condition.Get_Kind; begin Explore(Self, Target, Depth, False); if Condition_Kind = Bit_Or_Boolean then Self.Buffer.Put_Instruction(" ASSERT " & Condition_Reg & " # " & Condition_Name); else --!@#$ warn the user Self.Buffer.Put_Instruction(" TERMINATE_PROGRAM # ill-formed assertion"); end if; Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_Assert, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Send (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_Send_Class := Statement_Send_Class(Target)'ACCESS; begin Explore(Self, Target, Depth, False); case S.Get_Destination is when Actor => Self.Buffer.Put_Instruction(" ACTOR_SEND " & Resolve_Register(Target.Get_Association(My_Arguments).all) & " => " & Resolve_Register(Target.Get_Association(My_Destination).all) & " . " & Resolve_Register(Target.Get_Association(My_Name).all)); -- 5a2 when kv.avm.vole_tree.Self => Self.Buffer.Put_Instruction(" SELF_SEND " & Resolve_Register(Target.Get_Association(My_Arguments).all) & " => " & Resolve_Register(Target.Get_Association(My_Name).all)); -- 5b2 when Super => --!@#$ warn the user Self.Buffer.Put_Instruction(" TERMINATE_PROGRAM # unimplemented super send"); end case; Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_Send, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Statement_While (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is use kv.avm.Code_Buffers; Condition_Node : Node_Pointer := Target.Get_Association(My_Condition); Loop_Part_Node : Node_Pointer := Target.Get_Association(My_Loop_Part); -- Src_Reg : constant String := Resolve_Register(Condition_Node.all); -- Condition_Kind : kv.avm.Registers.Data_Kind := Condition_Node.Get_Kind; Skip_Loop_Count : Natural := 0; Skip_Cond_Count : Natural := 0; Jump_Back_Count : Natural; Main_Buffer : kv.avm.Code_Buffers.Buffer_Type; Cond_Buffer : kv.avm.Code_Buffers.Buffer_Type; Loop_Buffer : kv.avm.Code_Buffers.Buffer_Type; procedure Visit_Part(Part_Node : in Node_Pointer; Buffer : in out Buffer_Type; Count : out Natural) is begin Self.Buffer := Buffer; if Part_Node /= null then Part_Node.Visit(Self'ACCESS, Depth + 1); end if; Buffer := Self.Buffer; Count := Buffer.Code_Count; end Visit_Part; begin --!@#$ move this kind of checking to rewrite -- if Condition_Kind /= Bit_Or_Boolean then -- raise Non_Boolean_Condition_Error; -- end if; Main_Buffer := Self.Buffer; if Condition_Node /= null then Visit_Part(Condition_Node, Cond_Buffer, Skip_Cond_Count); end if; Visit_Part(Loop_Part_Node, Loop_Buffer, Skip_Loop_Count); Jump_Back_Count := Skip_Loop_Count + 1; Self.Buffer := Main_Buffer; if Condition_Node /= null then Self.Buffer.Append(Cond_Buffer); Self.Buffer.Put_Instruction(" BRANCH_NEQ " & Resolve_Register(Condition_Node.all) & Natural'IMAGE(Skip_Loop_Count + 1)); Jump_Back_Count := Jump_Back_Count + Skip_Cond_Count + 1; end if; Self.Buffer.Append(Loop_Buffer); Self.Buffer.Put_Instruction(" JUMP_REL " & Natural'IMAGE(-Jump_Back_Count)); Explore_Next(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Statement_While, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Program (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Self.Buffer.Put_Comment("################################################################################"); Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Program, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Visit_Unimp (Self : in out Code_Generator_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Terminate_Parsing => raise; -- Quietly leave when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Code_Gen.Visit_Unimp, line " & Positive'IMAGE(Target.Get_Line)); raise Terminate_Parsing; end; ---------------------------------------------------------------------------- procedure Print (Self : in Code_Generator_Class) is begin Self.Buffer.Print; end Print; ---------------------------------------------------------------------------- procedure Process_Lines (Self : in Code_Generator_Class; Processor : access procedure(Line : String)) is begin -- Self.Buffer.Process_Lines(Processor.all'ACCESS); Self.Buffer.Process_Lines(Processor); end Process_Lines; end kv.avm.Code_Generator;
AdaCore/gpr
Ada
26
ads
package PckB is end PckB;
AdaCore/training_material
Ada
819
adb
package body Basics is procedure Bump_Pair (P : in out Pair) is begin P.X := P.X + 1; P.Y := P.Y + 1; end Bump_Pair; procedure Swap_Pair (P : in out Pair) is Tmp : Integer := P.X; begin P.X := P.Y; P.Y := Tmp; end Swap_Pair; procedure Bump_Triplet (T : in out Triplet) is begin T.A := T.A + 1; T.B := T.B + 1; end Bump_Triplet; procedure Swap_Triplet (T : in out Triplet) is begin T.A := T.B; T.B := T.C; T.C := T.A; end Swap_Triplet; procedure Bump_And_Swap_Pair (P : in out Pair) is begin P.Bump_Pair; P.Swap_Pair; end Bump_And_Swap_Pair; procedure Bump_And_Swap_Triplet (T : in out Triplet) is begin T.Bump_Triplet; T.Swap_Triplet; end Bump_And_Swap_Triplet; end Basics;
kjseefried/coreland-cgbc
Ada
676
adb
with BS_Support; with CGBC; with Test; procedure T_BS_01 is package BS renames BS_Support.Natural_Stacks; TC : Test.Context_t; use type CGBC.Count_Type; begin Test.Initialize (Test_Context => TC, Program => "t_bs_01", Test_DB => "TEST_DB", Test_Results => "TEST_RESULTS"); Test.Check (Test_Context => TC, Test => 100, Condition => BS.Length (BS_Support.Stack) = 0, Statement => "BS.Length (BS_Support.Stack) = 0"); Test.Check (Test_Context => TC, Test => 101, Condition => BS.Is_Empty (BS_Support.Stack), Statement => "BS.Is_Empty (BS_Support.Stack)"); end T_BS_01;
reznikmm/matreshka
Ada
3,774
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_Fill_Image_Ref_Point_X_Attributes is pragma Preelaborate; type ODF_Draw_Fill_Image_Ref_Point_X_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Fill_Image_Ref_Point_X_Attribute_Access is access all ODF_Draw_Fill_Image_Ref_Point_X_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Fill_Image_Ref_Point_X_Attributes;
zhmu/ananas
Ada
621
ads
package Varsize2 is type Key_Type is (Nul, Cntrl, Stx, Etx, Eot, Enq, Ack, Spad, Clr, Dc_1, Dc_2, Dc_3, Dc_4); for Key_Type use (Nul => 0, Cntrl => 1, Stx => 2, Etx => 3, Eot => 4, Enq => 5, Ack => 6, Spad => 7, Clr => 8, Dc_1 => 17, Dc_2 => 18, Dc_3 => 19, Dc_4 => 20); type Page_Type(D : Boolean := False) is record case D is when True => I : Integer; when False => null; end case; end record; function F (Key : Key_Type) return Page_Type; end Varsize2;
AaronC98/PlaneSystem
Ada
3,528
ads
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2004-2012, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- Some ready to use write procedures package AWS.Net.Log.Callbacks is procedure Initialize (Filename : String; Callback : Write_Callback); -- Initialize the logging, must be called before using the callbacks below procedure Finalize; -- Stop logging, close log file procedure Text (Direction : Data_Direction; Socket : Socket_Type'Class; Data : Stream_Element_Array; Last : Stream_Element_Offset); -- A text output, each chunk is output with an header and footer: -- Data sent/received to/from socket <FD> (<size>/<buffer size>) -- <data> -- Total data sent: <nnn> received: <nnn> procedure Binary (Direction : Data_Direction; Socket : Socket_Type'Class; Data : Stream_Element_Array; Last : Stream_Element_Offset); -- A binary output, each chunk is output with an header and footer. The -- data itself is written using a format close to the Emacs hexl-mode: -- Data sent/received to/from socket <FD> (<size>/<buffer size>) -- HH HH HH HH HH HH HH HH HH HH HH HH az.rt.mpl..q -- Total data sent: <nnn> received: <nnn> -- -- HH is the hex character number, if the character is not printable a dot -- is written. end AWS.Net.Log.Callbacks;
jrmarino/AdaBase
Ada
9,806
adb
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Strings.Fixed; with Ada.Strings.UTF_Encoding.Strings; package body CommonText is package AS renames Ada.Strings; package UES renames Ada.Strings.UTF_Encoding.Strings; ----------- -- USS -- ----------- function USS (US : Text) return String is begin return SU.To_String (US); end USS; ----------- -- SUS -- ----------- function SUS (S : String) return Text is begin return SU.To_Unbounded_String (S); end SUS; ------------- -- UTF8S -- ------------- function UTF8S (S8 : UTF8) return String is begin return UES.Decode (S8); end UTF8S; ------------- -- SUTF8 -- ------------- function SUTF8 (S : String) return UTF8 is begin return UES.Encode (S); end SUTF8; ----------------- -- IsBlank #1 -- ----------------- function IsBlank (US : Text) return Boolean is begin return SU.Length (US) = 0; end IsBlank; ----------------- -- IsBlank #2 -- ----------------- function IsBlank (S : String) return Boolean is begin return S'Length = 0; end IsBlank; ------------------ -- equivalent -- ------------------ function equivalent (A, B : Text) return Boolean is use type Text; begin return A = B; end equivalent; ------------------ -- equivalent -- ------------------ function equivalent (A : Text; B : String) return Boolean is AS : constant String := USS (A); begin return AS = B; end equivalent; -------------- -- trim #1 -- -------------- function trim (US : Text) return Text is begin return SU.Trim (US, AS.Both); end trim; -------------- -- trim #2 -- -------------- function trim (S : String) return String is begin return AS.Fixed.Trim (S, AS.Both); end trim; --------------- -- int2str -- --------------- function int2str (A : Integer) return String is raw : constant String := A'Img; begin return trim (raw); end int2str; ---------------- -- int2text -- ---------------- function int2text (A : Integer) return Text is begin return SUS (int2str (A)); end int2text; ---------------- -- bool2str -- ---------------- function bool2str (A : Boolean) return String is begin if A then return "true"; end if; return "false"; end bool2str; ----------------- -- bool2text -- ----------------- function bool2text (A : Boolean) return Text is begin return SUS (bool2str (A)); end bool2text; ---------------- -- pinpoint -- ---------------- function pinpoint (S : String; fragment : String) return Natural is begin return AS.Fixed.Index (Source => S, Pattern => fragment); end pinpoint; -------------------- -- contains #1 -- -------------------- function contains (S : String; fragment : String) return Boolean is begin return (AS.Fixed.Index (Source => S, Pattern => fragment) > 0); end contains; -------------------- -- contains #2 -- -------------------- function contains (US : Text; fragment : String) return Boolean is begin return (SU.Index (Source => US, Pattern => fragment) > 0); end contains; -------------- -- part_1 -- -------------- function part_1 (S : String; separator : String := "/") return String is slash : constant Integer := AS.Fixed.Index (S, separator); begin if slash = 0 then return S; end if; return S (S'First .. slash - 1); end part_1; -------------- -- part_2 -- -------------- function part_2 (S : String; separator : String := "/") return String is slash : constant Integer := AS.Fixed.Index (S, separator); begin if slash = 0 then return S; end if; return S (slash + separator'Length .. S'Last); end part_2; --------------- -- replace -- --------------- function replace (S : String; reject, shiny : Character) return String is rejectstr : constant String (1 .. 1) := (1 => reject); focus : constant Natural := AS.Fixed.Index (Source => S, Pattern => rejectstr); returnstr : String := S; begin if focus > 0 then returnstr (focus) := shiny; end if; return returnstr; end replace; --------------- -- zeropad -- --------------- function zeropad (N : Natural; places : Positive) return String is template : String (1 .. places) := (others => '0'); myimage : constant String := trim (N'Img); startpos : constant Integer := 1 + places - myimage'Length; begin if startpos < 1 then return myimage; else template (startpos .. places) := myimage; return template; end if; end zeropad; -------------- -- len #1 -- -------------- function len (US : Text) return Natural is begin return SU.Length (US); end len; -------------- -- len #2 -- -------------- function len (S : String) return Natural is begin return S'Length; end len; ------------------ -- count_char -- ------------------ function count_char (S : String; focus : Character) return Natural is result : Natural := 0; begin for x in S'Range loop if S (x) = focus then result := result + 1; end if; end loop; return result; end count_char; --------------------- -- redact_quotes -- --------------------- function redact_quotes (sql : String) return String is -- This block will mask matching quotes (single or double) -- These are considered to be literal and not suitable for binding -- It also will mask "::" which is used by postgresql for casting type seeking is (none, single, double); redacted : String := sql; seek_status : seeking := none; arrow : Positive := 1; mask : constant Character := '#'; cast : constant String := "::"; ndx : Natural; begin if IsBlank (sql) then return ""; end if; loop ndx := AS.Fixed.Index (Source => redacted, Pattern => cast); exit when ndx = 0; redacted (ndx .. ndx + 1) := "##"; end loop; loop case sql (arrow) is when ''' => case seek_status is when none => seek_status := single; redacted (arrow) := mask; when single => seek_status := none; redacted (arrow) := mask; when double => null; end case; when ASCII.Quotation => case seek_status is when none => seek_status := double; redacted (arrow) := mask; when double => seek_status := none; redacted (arrow) := mask; when single => null; end case; when others => null; end case; exit when arrow = sql'Length; arrow := arrow + 1; end loop; return redacted; end redact_quotes; ---------------- -- trim_sql -- ---------------- function trim_sql (sql : String) return String is pass1 : constant String := trim (sql); pass2 : constant String (1 .. pass1'Length) := pass1; begin if pass2 (pass2'Last) = ASCII.Semicolon then return pass2 (1 .. pass2'Length - 1); else return pass2; end if; end trim_sql; --------------------- -- count_queries -- --------------------- function count_queries (trimmed_sql : String) return Natural is mask : constant String := redact_quotes (trimmed_sql); begin return count_char (S => mask, focus => ASCII.Semicolon) + 1; end count_queries; ---------------- -- subquery -- ---------------- function subquery (trimmed_sql : String; index : Positive) return String is mask : constant String := redact_quotes (trimmed_sql); start : Natural := trimmed_sql'First; segment : Natural := 1; scanning : Boolean := (index = segment); begin for x in mask'Range loop if mask (x) = ASCII.Semicolon then if scanning then return trimmed_sql (start .. x - 1); else segment := segment + 1; start := x + 1; scanning := (index = segment); end if; end if; end loop; -- Here we're either scanning (return current segment) or we aren't, -- meaning the index was too high, so return nothing. (This should -- never happen because caller knows how many segments there are and -- thus would not request something impossible like this.) if scanning then return trim (trimmed_sql (start .. trimmed_sql'Last)); else return ""; end if; end subquery; --------------------- -- num_set_items -- --------------------- function num_set_items (nv : String) return Natural is result : Natural := 0; begin if not IsBlank (nv) then result := 1; for x in nv'Range loop if nv (x) = ',' then result := result + 1; end if; end loop; end if; return result; end num_set_items; end CommonText;
charlie5/lace
Ada
902
ads
-- This file is generated by SWIG. Please do *not* modify by hand. -- with swig; with interfaces.C; package box2d_c is -- Shape -- subtype Shape is swig.opaque_structure; type Shape_array is array (interfaces.C.Size_t range <>) of aliased box2d_c.Shape; -- Object -- subtype Object is swig.opaque_structure; type Object_array is array (interfaces.C.Size_t range <>) of aliased box2d_c.Object; -- Joint -- subtype Joint is swig.opaque_structure; type Joint_array is array (interfaces.C.Size_t range <>) of aliased box2d_c.Joint; -- Space -- subtype Space is swig.opaque_structure; type Space_array is array (interfaces.C.Size_t range <>) of aliased box2d_c.Space; -- b2Joint -- subtype b2Joint is swig.opaque_structure; type b2Joint_array is array (interfaces.C.Size_t range <>) of aliased box2d_c.b2Joint; end box2d_c;
AaronC98/PlaneSystem
Ada
2,382
ads
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2004-2012, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- Waiting on group of sockets for input/output availability with AWS.Utils; with AWS.Net.Generic_Sets; package AWS.Net.Sets is new Generic_Sets (Utils.Null_Record);
ytomino/xml-ada
Ada
9,945
adb
with Ada.Characters.Latin_1; with Ada.Command_Line; with Ada.Streams.Stream_IO; with Ada.Text_IO; with XML.Streams; procedure read_rss is package Latin_1 renames Ada.Characters.Latin_1; procedure Read_RSS (Reader : in out XML.Reader) is type RSS_Version_Type is (RSS_1, RSS_2); RSS_Version : RSS_Version_Type; begin loop declare type T1 is (RSS_1, RSS_2, Processing_Instruction); S1 : T1; procedure Process (Event : in XML.Event) is begin case Event.Event_Type is when XML.Element_Start => if Event.Name.all = "rdf:RDF" then S1 := RSS_1; elsif Event.Name.all = "rss" then S1 := RSS_2; else raise XML.Data_Error; end if; when XML.Processing_Instruction => S1 := Processing_Instruction; when others => raise XML.Data_Error; end case; end Process; begin XML.Get (Reader, Process'Access); case S1 is when RSS_1 => Ada.Text_IO.Put_Line (XML.Base_URI (Reader) & " is RSS 1.0."); RSS_Version := RSS_1; exit; when RSS_2 => Ada.Text_IO.Put_Line (XML.Base_URI (Reader) & " is RSS 2.0."); RSS_Version := RSS_2; exit; when Processing_Instruction => null; -- read one more event end case; end; end loop; case RSS_Version is when RSS_1 => declare type T is (Root, Channel, Title, Link, Creator, Item, Item_Title, Item_Link, Unknown); S : array (1 .. 10) of T := (1 => Root, others => Unknown); Top : Natural := S'First; procedure Push (N : T) is begin Top := Top + 1; S (Top) := N; end Push; procedure Process (Event : in XML.Event) is begin case S (Top) is when Root => case Event.Event_Type is when XML.Attribute => null; -- skip xmlns when XML.Element_Start => if Event.Name.all = "channel" then Push (Channel); elsif Event.Name.all = "item" then Push (Item); else Push (Unknown); end if; when XML.Significant_Whitespace => null; when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Channel => case Event.Event_Type is when XML.Attribute => if Event.Name.all = "rdf:about" then Ada.Text_IO.Put_Line (Latin_1.HT & "about: " & Event.Value.all); end if; when XML.Element_Start => if Event.Name.all = "title" then Push (Title); elsif Event.Name.all = "link" then Push (Link); elsif Event.Name.all = "dc:creator" then Push (Creator); else Push (Unknown); end if; when XML.Significant_Whitespace => null; when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Title => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "title: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Link => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "link: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Creator => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "creator: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Item => case Event.Event_Type is when XML.Attribute => if Event.Name.all = "rdf:about" then Ada.Text_IO.Put_Line (Latin_1.HT & "item about: " & Event.Value.all); end if; when XML.Element_Start => if Event.Name.all = "title" then Push (Item_Title); elsif Event.Name.all = "link" then Push (Item_Link); else Push (Unknown); end if; when XML.Element_End => Top := Top - 1; when XML.Significant_Whitespace => null; when others => raise XML.Data_Error; end case; when Item_Title => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "item title: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Item_Link => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "item link: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Unknown => raise Program_Error; end case; end Process; begin loop if S (Top) = Unknown then XML.Get_Until_Element_End (Reader); Top := Top - 1; else XML.Get (Reader, Process'Access); end if; exit when Top < S'First; end loop; end; when RSS_2 => declare type T is (Root, Channel, Title, Link, Creator, Item, Item_Title, Item_Link, Unknown); S : array (1 .. 10) of T := (1 => Root, others => Unknown); Top : Natural := S'First; procedure Push (N : T) is begin Top := Top + 1; S (Top) := N; end Push; procedure Process (Event : in XML.Event) is begin case S (Top) is when Root => case Event.Event_Type is when XML.Attribute => null; -- skip xmlns when XML.Element_Start => if Event.Name.all = "channel" then Push (Channel); else Push (Unknown); end if; when XML.Significant_Whitespace => null; when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Channel => case Event.Event_Type is when XML.Element_Start => if Event.Name.all = "title" then Push (Title); elsif Event.Name.all = "link" then Push (Link); elsif Event.Name.all = "dc:creator" then Push (Creator); elsif Event.Name.all = "item" then Push (Item); else Push (Unknown); end if; when XML.Significant_Whitespace => null; when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Title => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "title: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Link => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "link: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Creator => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "creator: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Item => case Event.Event_Type is when XML.Element_Start => if Event.Name.all = "title" then Push (Item_Title); elsif Event.Name.all = "link" then Push (Item_Link); else Push (Unknown); end if; when XML.Element_End => Top := Top - 1; when XML.Significant_Whitespace => null; when others => raise XML.Data_Error; end case; when Item_Title => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "item title: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Item_Link => case Event.Event_Type is when XML.Text => Ada.Text_IO.Put_Line (Latin_1.HT & "item link: " & Event.Content.all); when XML.Element_End => Top := Top - 1; when others => raise XML.Data_Error; end case; when Unknown => raise Program_Error; end case; end Process; begin loop if S (Top) = Unknown then XML.Get_Until_Element_End (Reader); Top := Top - 1; else XML.Get (Reader, Process'Access); end if; exit when Top < S'First; end loop; end; end case; end Read_RSS; procedure Read_RSS_From_File (Name : in String) is File : Ada.Streams.Stream_IO.File_Type; begin Ada.Streams.Stream_IO.Open (File, Ada.Streams.Stream_IO.In_File, Name => Name); declare R : XML.Reader := XML.Streams.Create (Ada.Streams.Stream_IO.Stream (File), URI => "file://" & Name); begin Read_RSS (R); XML.Finish (R); end; Ada.Streams.Stream_IO.Close (File); end Read_RSS_From_File; begin if Ada.Command_Line.Argument_Count = 0 then Ada.Text_IO.Put_Line ("please tell RSS file name."); else for I in 1 .. Ada.Command_Line.Argument_Count loop Read_RSS_From_File (Ada.Command_Line.Argument (I)); end loop; end if; end read_rss;
sungyeon/drake
Ada
36
adb
../machine-apple-darwin/s-termin.adb
albinjal/ada_basic
Ada
2,800
adb
with Ada.Sequential_IO; with Ada.Text_IO; use Ada.Text_IO; with Sorted_List; use Sorted_List; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Lab6 is type Array_Type is Array(1..10) of Integer; type Person_Type is record S_Name : String(1..20); F_Name : String(1..20); G_Adress : String(1..20); P_Adress : String(1..20); Number : Integer; Interest : Array_Type; end record; package My_IO is new Ada.Sequential_IO(Person_Type); use My_IO; -------------------------------------------------------- procedure Get(L1 : out List_Type) is X : Integer := 5; begin while X<=15 and X>0 loop Get(X); if X<=15 and X>0 then Insert(X,L1); end if; end loop; end Get; --------------------------------------------------- procedure Compare(L1 : in List_Type; P1 : in Person_Type; L2 : out List_Type) is begin Delete(L2); for I in 1..P1.Number loop if Member(P1.Interest(I), L1) then Insert(P1.Interest(I), L2); end if; end loop; end Compare; --------------------------------------------------- procedure Put_S(File : in Ada.Text_IO.File_Type; S : in String) is begin for I in 1..19 loop if S(I)=' ' and S(I+1)=' ' then exit; end if; Put(File, S(I)); end loop; Put(File," "); end Put_S; ------------------------------------------------- procedure Put(F2 : in Ada.Text_IO.File_Type; P1 : in Person_Type; L2 : in out List_Type) is begin if not Empty(L2) then Put(F2,"-------------------------------------------------------------------"); New_Line(F2); Put_S(F2,P1.S_Name(1..20)); Put_S(F2,P1.F_Name(1..20)); Put_S(F2,P1.G_Adress(1..20)); Put_S(F2,P1.P_Adress(1..20)); Put(F2," *** "); Put(F2,"Intressen: "); Put(F2,L2); New_Line(F2); end if; end Put; --------------------------------------------------- procedure Interest(F1 : in My_IO.File_Type; L1 : in List_Type) is F2 : Ada.Text_IO.File_Type; P1 : Person_Type; L2 : List_Type; begin Create(F2,Out_File,"RESULT.TXT"); while not End_Of_File(F1) loop Read(F1,P1); Compare(L1,P1,L2); Put(F2,P1,L2); end loop; Reset(F2,In_File); end Interest; ------------------------------------------------- L1 : List_Type; F1 : My_IO.File_Type; begin Put("Ange en följd av intressen 1 till 15, max 10 st. Avsluta med 0: "); New_Line; Get(L1); Open(F1,In_File,"REG.BIN"); Interest(F1,L1); Put("KLART! Resultatet på filen RESULT.TXT"); end Lab6;
smola/language-dataset
Ada
9,349
ads
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../../License.txt -- -- Some of these definitions originate from the Matresha Project -- http://forge.ada-ru.org/matreshka -- Used with permission from Vadim Godunko <[email protected]> with System; with Interfaces.C.Strings; package AdaBase.Bindings.PostgreSQL is pragma Preelaborate; package IC renames Interfaces.C; package ICS renames Interfaces.C.Strings; ------------------------ -- Type Definitions -- ------------------------ type PGconn is limited private; type PGconn_Access is access all PGconn; pragma Convention (C, PGconn_Access); type PGresult is limited private; type PGresult_Access is access all PGresult; pragma Convention (C, PGresult_Access); type Oid is new IC.int; type Oid_Access is access all Oid; pragma Convention (C, Oid_Access); type ConnStatusType is (CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE, CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV, CONNECTION_SSL_STARTUP, CONNECTION_NEEDED); pragma Convention (C, ConnStatusType); type ExecStatusType is (PGRES_EMPTY_QUERY, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT, PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR); pragma Convention (C, ExecStatusType); type PGTransactionStatusType is (PQTRANS_IDLE, -- connection idle PQTRANS_ACTIVE, -- command in progress PQTRANS_INTRANS, -- idle, within transaction block PQTRANS_INERROR, -- idle, within failed transaction PQTRANS_UNKNOWN); -- cannot determine status pragma Convention (C, PGTransactionStatusType); type int_Access is access all IC.int; pragma Convention (C, int_Access); type Param_Int_Array is array (Positive range <>) of aliased IC.int; pragma Convention (C, Param_Int_Array); type Param_Oid_Array is array (Positive range <>) of aliased Oid; pragma Convention (C, Param_Oid_Array); type PValues_Container is record buffer : ICS.char_array_access; end record; pragma Convention (C, PValues_Container); type Param_Val_Array is array (Positive range <>) of aliased PValues_Container; pragma Convention (C, Param_Val_Array); ------------------------ -- Type Definitions -- ------------------------ PG_DIAG_SEVERITY : constant IC.int := IC.int (Character'Pos ('S')); PG_DIAG_SQLSTATE : constant IC.int := IC.int (Character'Pos ('C')); PG_DIAG_MESSAGE_PRIMARY : constant IC.int := IC.int (Character'Pos ('M')); PG_DIAG_MESSAGE_DETAIL : constant IC.int := IC.int (Character'Pos ('D')); PG_DIAG_SCHEMA_NAME : constant IC.int := IC.int (Character'Pos ('s')); PG_DIAG_TABLE_NAME : constant IC.int := IC.int (Character'Pos ('t')); PG_DIAG_COLUMN_NAME : constant IC.int := IC.int (Character'Pos ('c')); PG_DIAG_DATATYPE_NAME : constant IC.int := IC.int (Character'Pos ('d')); PG_DIAG_CONSTRAINT_NAME : constant IC.int := IC.int (Character'Pos ('n')); InvalidOid : constant Oid := Oid (0); PG_TYPE_refcursor : constant Oid := Oid (1790); ----------------- -- Subprograms -- ----------------- function pg_encoding_to_char (encoding_id : IC.int) return ICS.chars_ptr; pragma Import (C, pg_encoding_to_char); procedure PQclear (res : PGresult_Access); pragma Import (C, PQclear, "PQclear"); function PQclientEncoding (conn : PGconn_Access) return IC.int; pragma Import (C, PQclientEncoding, "PQclientEncoding"); function PQconnectdb (conninfo : ICS.chars_ptr) return PGconn_Access; pragma Import (C, PQconnectdb, "PQconnectdb"); function PQconnectdbParams (keywords : ICS.chars_ptr_array; values : ICS.chars_ptr_array; expand_dbnam : IC.int) return PGconn_Access; pragma Import (C, PQconnectdbParams, "PQconnectdbParams"); function PQerrorMessage (conn : PGconn_Access) return ICS.chars_ptr; pragma Import (C, PQerrorMessage, "PQerrorMessage"); function PQresultErrorMessage (res : PGresult_Access) return ICS.chars_ptr; pragma Import (C, PQresultErrorMessage, "PQresultErrorMessage"); function PQresultErrorField (res : PGresult_Access; fieldcode : IC.int) return ICS.chars_ptr; pragma Import (C, PQresultErrorField, "PQresultErrorField"); function PQexec (conn : PGconn_Access; command : ICS.chars_ptr) return PGresult_Access; pragma Import (C, PQexec, "PQexec"); function PQexecParams (conn : PGconn_Access; command : ICS.chars_ptr; nParams : IC.int; paramTypes : Oid_Access; paramValues : access PValues_Container; paramLengths : int_Access; paramFormats : int_Access; resultFormat : IC.int) return PGresult_Access; pragma Import (C, PQexecParams, "PQexecParams"); function PQexecPrepared (conn : PGconn_Access; stmtName : ICS.chars_ptr; nParams : IC.int; paramValues : access PValues_Container; paramLengths : int_Access; paramFormats : int_Access; resultFormat : IC.int) return PGresult_Access; pragma Import (C, PQexecPrepared, "PQexecPrepared"); procedure PQfinish (conn : PGconn_Access); pragma Import (C, PQfinish, "PQfinish"); function PQftype (res : PGresult_Access; column_number : IC.int) return Oid; pragma Import (C, PQftype, "PQftype"); function PQftable (res : PGresult_Access; column_number : IC.int) return Oid; pragma Import (C, PQftable, "PQftable"); function PQgetisnull (res : PGresult_Access; row_number : IC.int; column_number : IC.int) return IC.int; pragma Import (C, PQgetisnull, "PQgetisnull"); function PQgetlength (res : PGresult_Access; row_number : IC.int; column_number : IC.int) return IC.int; pragma Import (C, PQgetlength, "PQgetlength"); function PQgetvalue (res : PGresult_Access; row_number : IC.int; column_number : IC.int) return ICS.chars_ptr; pragma Import (C, PQgetvalue, "PQgetvalue"); function PQfformat (res : PGresult_Access; column_number : IC.int) return IC.int; pragma Import (C, PQfformat, "PQfformat"); function PQisthreadsafe return IC.int; pragma Import (C, PQisthreadsafe, "PQisthreadsafe"); function PQntuples (res : PGresult_Access) return IC.int; pragma Import (C, PQntuples, "PQntuples"); function PQnfields (res : PGresult_Access) return IC.int; pragma Import (C, PQnfields, "PQnfields"); function PQnparams (res : PGresult_Access) return IC.int; pragma Import (C, PQnparams, "PQnparams"); function PQcmdTuples (res : PGresult_Access) return ICS.chars_ptr; pragma Import (C, PQcmdTuples, "PQcmdTuples"); function PQfname (res : PGresult_Access; column_number : IC.int) return ICS.chars_ptr; pragma Import (C, PQfname, "PQfname"); function PQprepare (conn : PGconn_Access; stmtName : ICS.chars_ptr; query : ICS.chars_ptr; nParams : IC.int; paramTypes : Oid_Access) return PGresult_Access; pragma Import (C, PQprepare, "PQprepare"); function PQdescribePrepared (conn : PGconn_Access; stmtName : ICS.chars_ptr) return PGresult_Access; pragma Import (C, PQdescribePrepared, "PQdescribePrepared"); function PQresultStatus (res : PGresult_Access) return ExecStatusType; pragma Import (C, PQresultStatus, "PQresultStatus"); function PQsetClientEncoding (conn : PGconn_Access; encoding : ICS.chars_ptr) return IC.int; pragma Import (C, PQsetClientEncoding, "PQsetClientEncoding"); function PQstatus (conn : PGconn_Access) return ConnStatusType; pragma Import (C, PQstatus, "PQstatus"); function PQserverVersion (conn : PGconn_Access) return IC.int; pragma Import (C, PQserverVersion, "PQserverVersion"); function PQprotocolVersion (conn : PGconn_Access) return IC.int; pragma Import (C, PQprotocolVersion, "PQprotocolVersion"); function PQlibVersion return IC.int; pragma Import (C, PQlibVersion, "PQlibVersion"); function PQtransactionStatus (conn : PGconn_Access) return PGTransactionStatusType; pragma Import (C, PQtransactionStatus, "PQtransactionStatus"); private type PGconn is limited null record; type PGresult is limited null record; end AdaBase.Bindings.PostgreSQL;
PThierry/ewok-kernel
Ada
2,300
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- package body m4.systick with spark_mode => on is procedure init is begin SYSTICK.LOAD.RELOAD := bits_24 (MAIN_CLOCK_FREQUENCY / TICKS_PER_SECOND); SYSTICK.VAL.CURRENT := 0; SYSTICK.CTRL := (ENABLE => true, TICKINT => true, CLKSOURCE => PROCESSOR_CLOCK, COUNTFLAG => 0); end init; procedure increment is current : constant t_tick := ticks; begin ticks := current + 1; end increment; function get_ticks return unsigned_64 is current : constant t_tick := ticks; begin return unsigned_64 (current); end get_ticks; function to_milliseconds (t : t_tick) return milliseconds is begin return t * (1000 / TICKS_PER_SECOND); end to_milliseconds; function to_microseconds (t : t_tick) return microseconds is begin return t * (1000000 / TICKS_PER_SECOND); end to_microseconds; function to_ticks (ms : milliseconds) return t_tick is begin return ms * TICKS_PER_SECOND / 1000; end to_ticks; function get_milliseconds return milliseconds is current : constant t_tick := ticks; begin return to_milliseconds (current); end get_milliseconds; function get_microseconds return microseconds is current : constant t_tick := ticks; begin return to_microseconds (current); end get_microseconds; end m4.systick;
charlie5/aIDE
Ada
899
ads
with AdaM.raw_Source, gtk.Widget; private with gtk.Text_View, gtk.Frame, gtk.Button, gtk.Alignment; package aIDE.Editor.of_raw_source is type Item is new Editor.item with private; type View is access all Item'Class; package Forge is function to_comment_Editor (the_Comment : in AdaM.raw_Source.view) return View; end Forge; overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; private use gtk.Button, gtk.Text_View, gtk.Alignment, gtk.Frame; type Item is new Editor.item with record Comment : AdaM.raw_Source.view; Top : gtk_Frame; comment_text_View : gtk_Text_View; parameters_Alignment : Gtk_Alignment; rid_Button : gtk_Button; end record; end aIDE.Editor.of_raw_source;
reznikmm/matreshka
Ada
3,938
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.Footnote_Max_Height; package ODF.DOM.Attributes.Style.Footnote_Max_Height.Internals is function Create (Node : Matreshka.ODF_Attributes.Style.Footnote_Max_Height.Style_Footnote_Max_Height_Access) return ODF.DOM.Attributes.Style.Footnote_Max_Height.ODF_Style_Footnote_Max_Height; function Wrap (Node : Matreshka.ODF_Attributes.Style.Footnote_Max_Height.Style_Footnote_Max_Height_Access) return ODF.DOM.Attributes.Style.Footnote_Max_Height.ODF_Style_Footnote_Max_Height; end ODF.DOM.Attributes.Style.Footnote_Max_Height.Internals;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
268
adb
with STM32GD.Board; procedure Main is I : Integer with volatile; begin STM32GD.Board.Init; STM32GD.Board.LED.Set; loop I := 100000; while I > 0 loop I := I - 1; end loop; STM32GD.Board.LED.Toggle; end loop; end Main;
fnarenji/BezierToSTL
Ada
1,116
ads
with Liste_Generique; package Vecteurs is type Vecteur is array(Positive range<>) of Float; subtype Point2D is Vecteur(1..2); subtype Point3D is Vecteur(1..3); package Liste_Points is new Liste_Generique(Point2D); type Facette is record P1, P2, P3 : Point3D; end record; package Liste_Facettes is new Liste_Generique(Facette); -- addition de 2 vecteurs -- Requiert A, B de taille identique function "+" (A : Vecteur ; B : Vecteur) return Vecteur; -- soustraction de 2 vecteurs -- Requiert A, B de taille identique function "-" (A : Vecteur ; B : Vecteur) return Vecteur; -- multiplication scalaire vecteur function "*" (Facteur : Float ; V : Vecteur) return Vecteur; -- expo scalaire vecteur function "**" (V : Vecteur; Facteur : Positive) return Vecteur; -- division scalaire vecteur function "/" (V : Vecteur; Facteur : Float) return Vecteur; -- Renvoie une réprésentation chainée d'un point function To_String (P : Point2D) return String; function To_String_3D (P : Point3D) return String; end Vecteurs;
persan/protobuf-ada
Ada
266
adb
with Message, Ada.Text_IO; procedure Main is Person : Message.Person.Instance; begin Person.Set_Name ("Joakim"); Person.Set_Id (2); Ada.Text_IO.Put_Line ("Age: " & String(Person.Name)); Ada.Text_IO.Put_Line ("Id: " & Person.Id'Img); end Main;
reznikmm/matreshka
Ada
7,943
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ private with Ada.Containers.Hashed_Maps; private with Ada.Containers.Vectors; with Qt4.Abstract_Item_Models; private with Qt4.Abstract_Item_Models.Directors; private with Qt4.Mime_Datas; private with Qt4.Model_Indices; private with Qt4.Model_Index_Lists; with Qt4.Objects; private with Qt4.String_Lists; private with Qt4.Variants; private with AMF.CMOF.Associations; private with AMF.CMOF.Elements.Hash; private with AMF.CMOF.Properties; private with AMF.Elements; with AMF.Listeners; private with League.Holders; package Modeler.Containment_Tree_Models is type Containment_Tree_Model is limited new Qt4.Abstract_Item_Models.Q_Abstract_Item_Model and AMF.Listeners.Abstract_Listener with private; type Containment_Tree_Model_Access is access all Containment_Tree_Model'Class; package Constructors is function Create (Parent : access Qt4.Objects.Q_Object'Class := null) return not null Containment_Tree_Model_Access; end Constructors; private subtype Q_Natural is Qt4.Q_Integer range 0 .. Qt4.Q_Integer'Last; type Node; type Node_Access is access all Node; package Node_Vectors is new Ada.Containers.Vectors (Q_Natural, Node_Access); package Node_Maps is new Ada.Containers.Hashed_Maps (AMF.CMOF.Elements.CMOF_Element_Access, Node_Access, AMF.CMOF.Elements.Hash, AMF.CMOF.Elements."="); type Node is record Element : AMF.CMOF.Elements.CMOF_Element_Access; Parent : Node_Access; Children : Node_Vectors.Vector; end record; type Containment_Tree_Model is limited new Qt4.Abstract_Item_Models.Directors.Q_Abstract_Item_Model_Director and AMF.Listeners.Abstract_Listener with record Root : Node_Access := new Node; Map : Node_Maps.Map; end record; ------------------------------------- -- QAbstractItemModel's operations -- ------------------------------------- overriding function Column_Count (Self : not null access constant Containment_Tree_Model; Parent : Qt4.Model_Indices.Q_Model_Index) return Qt4.Q_Integer; overriding function Data (Self : not null access Containment_Tree_Model; Index : Qt4.Model_Indices.Q_Model_Index; Role : Qt4.Item_Data_Role) return Qt4.Variants.Q_Variant; overriding function Flags (Self : not null access constant Containment_Tree_Model; Index : Qt4.Model_Indices.Q_Model_Index) return Qt4.Item_Flags; overriding function Index (Self : not null access constant Containment_Tree_Model; Row : Qt4.Q_Integer; Column : Qt4.Q_Integer; Parent : Qt4.Model_Indices.Q_Model_Index) return Qt4.Model_Indices.Q_Model_Index; overriding function Mime_Data (Self : not null access constant Containment_Tree_Model; Indexes : Qt4.Model_Index_Lists.Q_Model_Index_List) return access Qt4.Mime_Datas.Q_Mime_Data'Class; overriding function Mime_Types (Self : not null access constant Containment_Tree_Model) return Qt4.String_Lists.Q_String_List; overriding function Parent (Self : not null access constant Containment_Tree_Model; Child : Qt4.Model_Indices.Q_Model_Index) return Qt4.Model_Indices.Q_Model_Index; overriding function Row_Count (Self : not null access constant Containment_Tree_Model; Parent : Qt4.Model_Indices.Q_Model_Index) return Qt4.Q_Integer; overriding function Set_Data (Self : not null access Containment_Tree_Model; Index : Qt4.Model_Indices.Q_Model_Index; Value : Qt4.Variants.Q_Variant; Role : Qt4.Item_Data_Role) return Boolean; ------------------------------------ -- Abstract_Listener's operations -- ------------------------------------ overriding procedure Attribute_Set (Self : not null access Containment_Tree_Model; Element : not null AMF.Elements.Element_Access; Property : not null AMF.CMOF.Properties.CMOF_Property_Access; Position : AMF.Optional_Integer; Old_Value : League.Holders.Holder; New_Value : League.Holders.Holder); overriding procedure Instance_Create (Self : not null access Containment_Tree_Model; Element : not null AMF.Elements.Element_Access); overriding procedure Link_Add (Self : not null access Containment_Tree_Model; Association : not null AMF.CMOF.Associations.CMOF_Association_Access; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access); end Modeler.Containment_Tree_Models;
optikos/oasis
Ada
1,451
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Statements; with Program.Lexical_Elements; package Program.Elements.Terminate_Alternative_Statements is pragma Pure (Program.Elements.Terminate_Alternative_Statements); type Terminate_Alternative_Statement is limited interface and Program.Elements.Statements.Statement; type Terminate_Alternative_Statement_Access is access all Terminate_Alternative_Statement'Class with Storage_Size => 0; type Terminate_Alternative_Statement_Text is limited interface; type Terminate_Alternative_Statement_Text_Access is access all Terminate_Alternative_Statement_Text'Class with Storage_Size => 0; not overriding function To_Terminate_Alternative_Statement_Text (Self : aliased in out Terminate_Alternative_Statement) return Terminate_Alternative_Statement_Text_Access is abstract; not overriding function Terminate_Token (Self : Terminate_Alternative_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Terminate_Alternative_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Terminate_Alternative_Statements;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
604
ads
with Ada.Interrupts; use Ada.Interrupts; with Ada.Real_Time; use Ada.Real_Time; with STM32_SVD.Interrupts; use STM32_SVD.Interrupts; generic Timer : STM32GD.Timer.Timer_Type := Timer_3; IRQ : Interrupt_ID := TIM3; package STM32GD.Timer.Peripheral is procedure Init; procedure Stop; procedure After (Time : Time_Span; Callback : Timer_Callback_Type); procedure Every (Interval : Time_Span; Callback : Timer_Callback_Type); private protected IRQ_Handler is procedure Handler; pragma Attach_Handler (Handler, IRQ); end IRQ_Handler; end STM32GD.Timer.Peripheral;
sbksba/Concurrence-LI330
Ada
398
ads
with Ada.Text_Io,Ada.Command_Line; use Ada.Text_Io, Ada.Command_Line; package Polynomes is type T_PP is array (Natural range <>) of Integer; procedure Affiche_PP(P : in T_PP); function Somme_PP(PP1,PP2 : T_PP) return T_PP ; function Somme_Aux(PP1,PP2 : T_PP) return T_PP ; function Derive_PP(PP : T_PP) return T_PP; function Evalue_PP(PP : T_PP; X : Integer) return Integer; end Polynomes;
AdaCore/training_material
Ada
1,064
adb
with Except; with Screen_Output; use Screen_Output; with Stack; with Tokens; use Tokens; with Ada.Text_IO; use Ada.Text_IO; with Ada.Command_Line; use Ada.Command_Line; procedure Sdc is File : File_Type; begin Msg ("Welcome to sdc. Go ahead type your commands ..."); if Argument_Count = 1 then begin Open (File, In_File, Argument (1)); exception when Use_Error | Name_Error => Error_Msg ("Could not open input file, exiting."); return; end; Set_Input (File); end if; loop -- Open a block to catch Stack Overflow and Underflow exceptions. begin Process (Next); -- Read the next Token from the input and process it. exception when Stack.Underflow => Error_Msg ("Not enough values in the Stack."); when Stack.Overflow => null; end; end loop; exception when Except.Exit_SDC => Msg ("Thank you for using sdc."); when others => Msg ("*** Internal Error ***."); end Sdc;
sungyeon/drake
Ada
647
ads
pragma License (Unrestricted); -- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux) package System.Synchronous_Objects.Abortable is pragma Preelaborate; -- queue procedure Take ( Object : in out Queue; Item : out Queue_Node_Access; Params : Address; Filter : Queue_Filter; Aborted : out Boolean); -- waiting -- event procedure Wait ( Object : in out Event; Aborted : out Boolean); procedure Wait ( Object : in out Event; Timeout : Duration; Value : out Boolean; Aborted : out Boolean); end System.Synchronous_Objects.Abortable;
reznikmm/matreshka
Ada
5,645
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.UML_Elements; with AMF.Standard_Profile_L2.Derives; with AMF.UML.Abstractions; with AMF.UML.Value_Specifications; with AMF.Visitors; package AMF.Internals.Standard_Profile_L2_Derives is type Standard_Profile_L2_Derive_Proxy is limited new AMF.Internals.UML_Elements.UML_Element_Base and AMF.Standard_Profile_L2.Derives.Standard_Profile_L2_Derive with null record; overriding function Get_Base_Abstraction (Self : not null access constant Standard_Profile_L2_Derive_Proxy) return AMF.UML.Abstractions.UML_Abstraction_Access; -- Getter of Derive::base_Abstraction. -- overriding procedure Set_Base_Abstraction (Self : not null access Standard_Profile_L2_Derive_Proxy; To : AMF.UML.Abstractions.UML_Abstraction_Access); -- Setter of Derive::base_Abstraction. -- overriding function Get_Computation (Self : not null access constant Standard_Profile_L2_Derive_Proxy) return AMF.UML.Value_Specifications.UML_Value_Specification_Access; -- Getter of Derive::computation. -- -- The specification for computing the derived client element from the -- derivation supplier element. overriding procedure Set_Computation (Self : not null access Standard_Profile_L2_Derive_Proxy; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access); -- Setter of Derive::computation. -- -- The specification for computing the derived client element from the -- derivation supplier element. overriding procedure Enter_Element (Self : not null access constant Standard_Profile_L2_Derive_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant Standard_Profile_L2_Derive_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant Standard_Profile_L2_Derive_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.Standard_Profile_L2_Derives;
optikos/oasis
Ada
3,856
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Defining_Character_Literals is function Create (Character_Literal_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Defining_Character_Literal is begin return Result : Defining_Character_Literal := (Character_Literal_Token => Character_Literal_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_Defining_Character_Literal is begin return Result : Implicit_Defining_Character_Literal := (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 Character_Literal_Token (Self : Defining_Character_Literal) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Character_Literal_Token; end Character_Literal_Token; overriding function Image (Self : Defining_Character_Literal) return Text is begin return Self.Character_Literal_Token.Image; end Image; overriding function Is_Part_Of_Implicit (Self : Implicit_Defining_Character_Literal) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Defining_Character_Literal) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Defining_Character_Literal) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Image (Self : Implicit_Defining_Character_Literal) return Text is pragma Unreferenced (Self); begin return ""; end Image; procedure Initialize (Self : aliased in out Base_Defining_Character_Literal'Class) is begin null; end Initialize; overriding function Is_Defining_Character_Literal_Element (Self : Base_Defining_Character_Literal) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Defining_Character_Literal_Element; overriding function Is_Defining_Name_Element (Self : Base_Defining_Character_Literal) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Defining_Name_Element; overriding procedure Visit (Self : not null access Base_Defining_Character_Literal; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Defining_Character_Literal (Self); end Visit; overriding function To_Defining_Character_Literal_Text (Self : aliased in out Defining_Character_Literal) return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Text_Access is begin return Self'Unchecked_Access; end To_Defining_Character_Literal_Text; overriding function To_Defining_Character_Literal_Text (Self : aliased in out Implicit_Defining_Character_Literal) return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Text_Access is pragma Unreferenced (Self); begin return null; end To_Defining_Character_Literal_Text; end Program.Nodes.Defining_Character_Literals;
faelys/natools
Ada
75,871
adb
------------------------------------------------------------------------------ -- Copyright (c) 2016-2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Command Line Interface for primitives in Natools.Smaz.Tools. -- ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; with Ada.Command_Line; with Ada.Containers.Indefinite_Doubly_Linked_Lists; with Ada.Containers.Indefinite_Holders; with Ada.Streams; with Ada.Strings.Fixed; with Ada.Strings.Unbounded; with Ada.Text_IO.Text_Streams; with Natools.Getopt_Long; with Natools.Parallelism; with Natools.S_Expressions.Parsers; with Natools.S_Expressions.Printers; with Natools.Smaz; with Natools.Smaz.Tools; with Natools.Smaz_256; with Natools.Smaz_4096; with Natools.Smaz_64; with Natools.Smaz_Generic.Tools; with Natools.Smaz_Implementations.Base_4096; with Natools.Smaz_Implementations.Base_64_Tools; with Natools.Smaz_Tools; with Natools.Smaz_Tools.GNAT; with Natools.String_Escapes; procedure Smaz is function To_SEA (S : String) return Ada.Streams.Stream_Element_Array renames Natools.S_Expressions.To_Atom; package Tools_256 is new Natools.Smaz_256.Tools; package Tools_4096 is new Natools.Smaz_4096.Tools; package Tools_64 is new Natools.Smaz_64.Tools; package Methods renames Natools.Smaz_Tools.Methods; package Actions is type Enum is (Nothing, Adjust_Dictionary, Decode, Encode, Evaluate); end Actions; package Algorithms is type Enum is (Base_256, Base_4096, Base_64, Base_256_Retired); end Algorithms; package Dict_Sources is type Enum is (S_Expression, Text_List, Unoptimized_Text_List); end Dict_Sources; package Options is type Id is (Base_256, Base_4096, Base_64, Output_Ada_Dict, Check_Roundtrip, Dictionary_Input, Decode, Encode, Evaluate, Filter_Threshold, Output_Hash, Job_Count, Help, Sx_Dict_Output, Min_Sub_Size, Max_Sub_Size, Dict_Size, Max_Pending, Base_256_Retired, Stat_Output, No_Stat_Output, Text_List_Input, Fast_Text_Input, Max_Word_Size, Sx_Output, No_Sx_Output, Force_Word, Max_Dict_Size, Min_Dict_Size, No_Vlen_Verbatim, Score_Method, Vlen_Verbatim); end Options; package Getopt is new Natools.Getopt_Long (Options.Id); type Callback is new Getopt.Handlers.Callback with record Algorithm : Algorithms.Enum := Algorithms.Base_256; Display_Help : Boolean := False; Need_Dictionary : Boolean := False; Stat_Output : Boolean := False; Sx_Output : Boolean := False; Sx_Dict_Output : Boolean := False; Min_Sub_Size : Positive := 1; Max_Sub_Size : Positive := 3; Max_Word_Size : Positive := 10; Max_Dict_Size : Positive := 254; Min_Dict_Size : Positive := 254; Vlen_Verbatim : Boolean := True; Max_Pending : Ada.Containers.Count_Type := Ada.Containers.Count_Type'Last; Job_Count : Natural := 0; Filter_Threshold : Natools.Smaz_Tools.String_Count := 0; Score_Method : Methods.Enum := Methods.Encoded; Action : Actions.Enum := Actions.Nothing; Ada_Dictionary : Ada.Strings.Unbounded.Unbounded_String; Hash_Package : Ada.Strings.Unbounded.Unbounded_String; Dict_Source : Dict_Sources.Enum := Dict_Sources.S_Expression; Check_Roundtrip : Boolean := False; Forced_Words : Natools.Smaz_Tools.String_Lists.List; end record; overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String); overriding procedure Argument (Handler : in out Callback; Argument : in String) is null; function Activate_Dictionary (Dict : in Natools.Smaz_256.Dictionary) return Natools.Smaz_256.Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_4096.Dictionary) return Natools.Smaz_4096.Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_64.Dictionary) return Natools.Smaz_64.Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz.Dictionary) return Natools.Smaz.Dictionary; -- Update Dictionary.Hash so that it can be actually used procedure Build_Perfect_Hash (Word_List : in Natools.Smaz.Tools.String_Lists.List; Package_Name : in String); -- Adapter between Smaz_256 generator and retired Smaz types procedure Convert (Input : in Natools.Smaz_Tools.String_Lists.List; Output : out Natools.Smaz.Tools.String_Lists.List); -- Convert between old and new string lists function Getopt_Config return Getopt.Configuration; -- Build the configuration object function Last_Code (Dict : in Natools.Smaz_256.Dictionary) return Ada.Streams.Stream_Element is (Dict.Last_Code); function Last_Code (Dict : in Natools.Smaz_4096.Dictionary) return Natools.Smaz_Implementations.Base_4096.Base_4096_Digit is (Dict.Last_Code); function Last_Code (Dict : in Natools.Smaz_64.Dictionary) return Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit is (Dict.Last_Code); function Last_Code (Dict : in Natools.Smaz.Dictionary) return Ada.Streams.Stream_Element is (Dict.Dict_Last); -- Return the last valid entry function Length (Dict : in Natools.Smaz_256.Dictionary) return Positive is (Dict.Offsets'Length + 1); function Length (Dict : in Natools.Smaz_4096.Dictionary) return Positive is (Dict.Offsets'Length + 1); function Length (Dict : in Natools.Smaz_64.Dictionary) return Positive is (Dict.Offsets'Length + 1); function Length (Dict : in Natools.Smaz.Dictionary) return Positive is (Dict.Offsets'Length); -- Return the number of entries in Dict procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_256.Dictionary; Hash_Package_Name : in String := ""); procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_4096.Dictionary; Hash_Package_Name : in String := ""); procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_64.Dictionary; Hash_Package_Name : in String := ""); procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz.Dictionary; Hash_Package_Name : in String := ""); -- print the given dictionary in the given file procedure Print_Help (Opt : in Getopt.Configuration; Output : in Ada.Text_IO.File_Type); -- Print the help text to the given file generic type Dictionary (<>) is private; type Dictionary_Entry is (<>); type Methods is (<>); type Score_Value is range <>; type String_Count is range <>; type Word_Counter is private; type Dictionary_Counts is array (Dictionary_Entry) of String_Count; with package String_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists (String); with function Activate_Dictionary (Dict : in Dictionary) return Dictionary is <>; with procedure Add_Substrings (Counter : in out Word_Counter; Phrase : in String; Min_Size : in Positive; Max_Size : in Positive); with procedure Add_Words (Counter : in out Word_Counter; Phrase : in String; Min_Size : in Positive; Max_Size : in Positive); with function Append_String (Dict : in Dictionary; Element : in String) return Dictionary; with procedure Build_Perfect_Hash (Word_List : in String_Lists.List; Package_Name : in String); with function Compress (Dict : in Dictionary; Input : in String) return Ada.Streams.Stream_Element_Array; with function Decompress (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array) return String; with function Dict_Entry (Dict : in Dictionary; Element : in Dictionary_Entry) return String; with procedure Evaluate_Dictionary (Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); with procedure Evaluate_Dictionary_Partial (Dict : in Dictionary; Corpus_Entry : in String; Compressed_Size : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts); with procedure Filter_By_Count (Counter : in out Word_Counter; Threshold_Count : in String_Count); with function Last_Code (Dict : in Dictionary) return Dictionary_Entry; with function Length (Dict : in Dictionary) return Positive is <>; with procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dict : in Dictionary; Hash_Package_Name : in String := "") is <>; with function Remove_Element (Dict : in Dictionary; Element : in Dictionary_Entry) return Dictionary; with function Replace_Element (Dict : in Dictionary; Element : in Dictionary_Entry; Value : in String) return Dictionary; Score_Encoded, Score_Frequency, Score_Gain : in access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value; with function Simple_Dictionary (Counter : in Word_Counter; Word_Count : in Natural; Method : in Methods) return String_Lists.List; with procedure Simple_Dictionary_And_Pending (Counter : in Word_Counter; Word_Count : in Natural; Selected : out String_Lists.List; Pending : out String_Lists.List; Method : in Methods; Max_Pending_Count : in Ada.Containers.Count_Type); with function To_Dictionary (List : in String_Lists.List; Variable_Length_Verbatim : in Boolean) return Dictionary; with function Worst_Element (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods; First, Last : in Dictionary_Entry) return Dictionary_Entry; package Dictionary_Subprograms is package Holders is new Ada.Containers.Indefinite_Holders (Dictionary); function Adjust_Dictionary (Handler : in Callback'Class; Dict : in Dictionary; Corpus : in String_Lists.List; Method : in Methods) return Dictionary; -- Adjust the given dictionary according to info in Handle procedure Evaluate_Dictionary (Job_Count : in Natural; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); -- Dispatch to parallel or non-parallel version of -- Evaluate_Dictionary depending on Job_Count. function Image (Dict : in Dictionary; Code : in Dictionary_Entry) return Natools.S_Expressions.Atom; -- S-expression image of Code function Is_In_Dict (Dict : Dictionary; Word : String) return Boolean; -- Return whether Word is in Dict (inefficient) function Make_Word_Counter (Handler : in Callback'Class; Input : in String_Lists.List) return Word_Counter; -- Make a word counter from an input word list procedure Optimization_Round (Dict : in out Holders.Holder; Score : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts; First : in Dictionary_Entry; Pending_Words : in out String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive; Updated : out Boolean); -- Try to improve on Dict by replacing a single entry from it with -- one of the substring in Pending_Words. function Optimize_Dictionary (Base : in Dictionary; First : in Dictionary_Entry; Pending_Words : in String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive) return Dictionary; -- Optimize the dictionary on Input_Texts, starting with Base and -- adding substrings from Pending_Words. Operates only on words -- at First and beyond. procedure Parallel_Evaluate_Dictionary (Job_Count : in Positive; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); -- Return the same results as Natools.Smaz.Tools.Evaluate_Dictionary, -- but hopefully more quickly, using Job_Count tasks. procedure Print_Dictionary (Filename : in String; Dict : in Dictionary; Hash_Package_Name : in String := ""); -- print the given dictionary in the given file procedure Process (Handler : in Callback'Class; Word_List : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods); -- Perform the requested operations function To_Dictionary (Handler : in Callback'Class; Input : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods) return Dictionary; -- Convert the input into a dictionary given the option in Handler end Dictionary_Subprograms; package body Dictionary_Subprograms is function Adjust_Dictionary (Handler : in Callback'Class; Dict : in Dictionary; Corpus : in String_Lists.List; Method : in Methods) return Dictionary is begin if Handler.Forced_Words.Is_Empty or else Corpus.Is_Empty then return Dict; end if; Add_Forced_Words : declare Actual_Dict : constant Dictionary := Activate_Dictionary (Dict); Counts : Dictionary_Counts; Discarded_Size : Ada.Streams.Stream_Element_Count; Replacement_Count : String_Count; Current : Holders.Holder := Holders.To_Holder (Actual_Dict); begin Evaluate_Dictionary (Handler.Job_Count, Actual_Dict, Corpus, Discarded_Size, Counts); Replacement_Count := Counts (Counts'First); for I in Counts'Range loop if Replacement_Count < Counts (I) then Replacement_Count := Counts (I); end if; end loop; for Word of Handler.Forced_Words loop if not Is_In_Dict (Actual_Dict, Word) then declare Worst_Index : constant Dictionary_Entry := Worst_Element (Actual_Dict, Counts, Method, Dictionary_Entry'First, Last_Code (Actual_Dict)); New_Dict : constant Dictionary := Replace_Element (Current.Element, Worst_Index, Word); begin Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "Removing" & Counts (Worst_Index)'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Dict_Entry (Actual_Dict, Worst_Index), True) & " at" & Worst_Index'Img & ", replaced by " & Natools.String_Escapes.C_Escape_Hex (Word, True)); Current := Holders.To_Holder (New_Dict); Counts (Worst_Index) := Replacement_Count; end; end if; end loop; return Current.Element; end Add_Forced_Words; end Adjust_Dictionary; procedure Evaluate_Dictionary (Job_Count : in Natural; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts) is Actual_Dict : constant Dictionary := Activate_Dictionary (Dict); begin if Job_Count > 0 then Parallel_Evaluate_Dictionary (Job_Count, Actual_Dict, Corpus, Compressed_Size, Counts); else Evaluate_Dictionary (Actual_Dict, Corpus, Compressed_Size, Counts); end if; end Evaluate_Dictionary; function Image (Dict : in Dictionary; Code : in Dictionary_Entry) return Natools.S_Expressions.Atom is begin return Compress (Dict, Dict_Entry (Dict, Code)); end Image; function Is_In_Dict (Dict : Dictionary; Word : String) return Boolean is begin for Code in Dictionary_Entry'First .. Last_Code (Dict) loop if Dict_Entry (Dict, Code) = Word then return True; end if; end loop; return False; end Is_In_Dict; function Make_Word_Counter (Handler : in Callback'Class; Input : in String_Lists.List) return Word_Counter is use type Natools.Smaz_Tools.String_Count; Counter : Word_Counter; begin for S of Input loop Add_Substrings (Counter, S, Handler.Min_Sub_Size, Handler.Max_Sub_Size); if Handler.Max_Word_Size > Handler.Max_Sub_Size then Add_Words (Counter, S, Handler.Max_Sub_Size + 1, Handler.Max_Word_Size); end if; end loop; if Handler.Filter_Threshold > 0 then Filter_By_Count (Counter, String_Count (Handler.Filter_Threshold)); end if; return Counter; end Make_Word_Counter; procedure Optimization_Round (Dict : in out Holders.Holder; Score : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts; First : in Dictionary_Entry; Pending_Words : in out String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive; Updated : out Boolean) is use type Ada.Streams.Stream_Element_Offset; No_Longer_Pending : String_Lists.Cursor; Log_Message : Ada.Strings.Unbounded.Unbounded_String; Original : constant Dictionary := Dict.Element; Worst_Index : constant Dictionary_Entry := Worst_Element (Original, Counts, Method, First, Last_Code (Original)); Worst_Value : constant String := Dict_Entry (Original, Worst_Index); Worst_Count : constant String_Count := Counts (Worst_Index); Worst_Removed : Boolean := False; Base : constant Dictionary := Remove_Element (Original, Worst_Index); Old_Score : constant Ada.Streams.Stream_Element_Count := Score; begin Updated := False; for Position in Pending_Words.Iterate loop declare Word : constant String := String_Lists.Element (Position); New_Dict : constant Dictionary := Append_String (Base, Word); New_Score : Ada.Streams.Stream_Element_Count; New_Counts : Dictionary_Counts; begin Evaluate_Dictionary (Job_Count, New_Dict, Input_Texts, New_Score, New_Counts); if New_Score < Score then Dict := Holders.To_Holder (New_Dict); Score := New_Score; Counts := New_Counts; No_Longer_Pending := Position; Worst_Removed := True; Updated := True; Log_Message := Ada.Strings.Unbounded.To_Unbounded_String ("Removing" & Worst_Count'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Worst_Value, True) & ", adding" & Counts (Last_Code (New_Dict))'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Word, True) & ", size" & Score'Img & " (" & Ada.Streams.Stream_Element_Offset'Image (Score - Old_Score) & ')'); end if; end; end loop; if Length (Original) < Max_Dict_Size then for Position in Pending_Words.Iterate loop declare Word : constant String := String_Lists.Element (Position); New_Dict : constant Dictionary := Append_String (Original, Word); New_Score : Ada.Streams.Stream_Element_Count; New_Counts : Dictionary_Counts; begin Evaluate_Dictionary (Job_Count, New_Dict, Input_Texts, New_Score, New_Counts); if New_Score < Score then Dict := Holders.To_Holder (New_Dict); Score := New_Score; Counts := New_Counts; No_Longer_Pending := Position; Worst_Removed := False; Updated := True; Log_Message := Ada.Strings.Unbounded.To_Unbounded_String ("Adding" & Counts (Last_Code (New_Dict))'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Word, True) & ", size" & Score'Img & " (" & Ada.Streams.Stream_Element_Offset'Image (Score - Old_Score) & ')'); end if; end; end loop; end if; if Length (Base) >= Min_Dict_Size then declare New_Score : Ada.Streams.Stream_Element_Count; New_Counts : Dictionary_Counts; begin Evaluate_Dictionary (Job_Count, Base, Input_Texts, New_Score, New_Counts); if New_Score <= Score then Dict := Holders.To_Holder (Base); Score := New_Score; Counts := New_Counts; No_Longer_Pending := String_Lists.No_Element; Worst_Removed := True; Updated := True; Log_Message := Ada.Strings.Unbounded.To_Unbounded_String ("Removing" & Worst_Count'Img & "x " & Natools.String_Escapes.C_Escape_Hex (Worst_Value, True) & ", size" & Score'Img & " (" & Ada.Streams.Stream_Element_Offset'Image (Score - Old_Score) & ')'); end if; end; end if; if Updated then if String_Lists.Has_Element (No_Longer_Pending) then Pending_Words.Delete (No_Longer_Pending); end if; if Worst_Removed then Pending_Words.Append (Worst_Value); end if; Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, Ada.Strings.Unbounded.To_String (Log_Message)); end if; end Optimization_Round; function Optimize_Dictionary (Base : in Dictionary; First : in Dictionary_Entry; Pending_Words : in String_Lists.List; Input_Texts : in String_Lists.List; Job_Count : in Natural; Method : in Methods; Min_Dict_Size : in Positive; Max_Dict_Size : in Positive) return Dictionary is Holder : Holders.Holder := Holders.To_Holder (Base); Pending : String_Lists.List := Pending_Words; Score : Ada.Streams.Stream_Element_Count; Counts : Dictionary_Counts; Running : Boolean := True; begin Evaluate_Dictionary (Job_Count, Base, Input_Texts, Score, Counts); while Running loop Optimization_Round (Holder, Score, Counts, First, Pending, Input_Texts, Job_Count, Method, Min_Dict_Size, Max_Dict_Size, Running); end loop; return Holder.Element; end Optimize_Dictionary; procedure Parallel_Evaluate_Dictionary (Job_Count : in Positive; Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts) is type Result_Values is record Compressed_Size : Ada.Streams.Stream_Element_Count; Counts : Dictionary_Counts; end record; procedure Initialize (Result : in out Result_Values); procedure Get_Next_Job (Global : in out String_Lists.Cursor; Job : out String_Lists.Cursor; Terminated : out Boolean); procedure Do_Job (Result : in out Result_Values; Job : in String_Lists.Cursor); procedure Gather_Result (Global : in out String_Lists.Cursor; Partial : in Result_Values); procedure Initialize (Result : in out Result_Values) is begin Result := (Compressed_Size => 0, Counts => (others => 0)); end Initialize; procedure Get_Next_Job (Global : in out String_Lists.Cursor; Job : out String_Lists.Cursor; Terminated : out Boolean) is begin Job := Global; Terminated := not String_Lists.Has_Element (Global); if not Terminated then String_Lists.Next (Global); end if; end Get_Next_Job; procedure Do_Job (Result : in out Result_Values; Job : in String_Lists.Cursor) is begin Evaluate_Dictionary_Partial (Dict, String_Lists.Element (Job), Result.Compressed_Size, Result.Counts); end Do_Job; procedure Gather_Result (Global : in out String_Lists.Cursor; Partial : in Result_Values) is pragma Unreferenced (Global); use type Ada.Streams.Stream_Element_Count; use type Natools.Smaz_Tools.String_Count; begin Compressed_Size := Compressed_Size + Partial.Compressed_Size; for I in Counts'Range loop Counts (I) := Counts (I) + Partial.Counts (I); end loop; end Gather_Result; procedure Parallel_Run is new Natools.Parallelism.Per_Task_Accumulator_Run (String_Lists.Cursor, Result_Values, String_Lists.Cursor); Cursor : String_Lists.Cursor := String_Lists.First (Corpus); begin Compressed_Size := 0; Counts := (others => 0); Parallel_Run (Cursor, Job_Count); end Parallel_Evaluate_Dictionary; procedure Print_Dictionary (Filename : in String; Dict : in Dictionary; Hash_Package_Name : in String := "") is begin if Filename = "-" then Print_Dictionary (Ada.Text_IO.Current_Output, Dict, Hash_Package_Name); elsif Filename'Length > 0 then declare File : Ada.Text_IO.File_Type; begin Ada.Text_IO.Create (File, Name => Filename); Print_Dictionary (File, Dict, Hash_Package_Name); Ada.Text_IO.Close (File); end; end if; end Print_Dictionary; procedure Process (Handler : in Callback'Class; Word_List : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods) is Dict : constant Dictionary := Activate_Dictionary (To_Dictionary (Handler, Word_List, Data_List, Method)); Sx_Output : Natools.S_Expressions.Printers.Canonical (Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Current_Output)); Ada_Dictionary : constant String := Ada.Strings.Unbounded.To_String (Handler.Ada_Dictionary); Hash_Package : constant String := Ada.Strings.Unbounded.To_String (Handler.Hash_Package); begin if Ada_Dictionary'Length > 0 then Print_Dictionary (Ada_Dictionary, Dict, Hash_Package); end if; if Hash_Package'Length > 0 then Build_Perfect_Hash (Word_List, Hash_Package); end if; if Handler.Sx_Dict_Output then Sx_Output.Open_List; for I in Dictionary_Entry'First .. Last_Code (Dict) loop Sx_Output.Append_String (Dict_Entry (Dict, I)); end loop; Sx_Output.Close_List; end if; case Handler.Action is when Actions.Nothing | Actions.Adjust_Dictionary => null; when Actions.Decode => if Handler.Sx_Output then Sx_Output.Open_List; for S of Data_List loop Sx_Output.Append_String (Decompress (Dict, To_SEA (S))); end loop; Sx_Output.Close_List; end if; if Handler.Check_Roundtrip then for S of Data_List loop declare use type Ada.Streams.Stream_Element_Array; Input : constant Ada.Streams.Stream_Element_Array := To_SEA (S); Processed : constant String := Decompress (Dict, Input); Roundtrip : constant Ada.Streams.Stream_Element_Array := Compress (Dict, Processed); begin if Input /= Roundtrip then Sx_Output.Open_List; Sx_Output.Append_String ("decompress-roundtrip-failed"); Sx_Output.Append_Atom (Input); Sx_Output.Append_String (Processed); Sx_Output.Append_Atom (Roundtrip); Sx_Output.Close_List; end if; end; end loop; end if; if Handler.Stat_Output then declare procedure Print_Line (Original, Output : Natural); procedure Print_Line (Original, Output : Natural) is begin Ada.Text_IO.Put_Line (Natural'Image (Original) & Ada.Characters.Latin_1.HT & Natural'Image (Output) & Ada.Characters.Latin_1.HT & Float'Image (Float (Original) / Float (Output))); end Print_Line; Original_Total : Natural := 0; Output_Total : Natural := 0; begin for S of Data_List loop declare Original_Size : constant Natural := S'Length; Output_Size : constant Natural := Decompress (Dict, To_SEA (S))'Length; begin Print_Line (Original_Size, Output_Size); Original_Total := Original_Total + Original_Size; Output_Total := Output_Total + Output_Size; end; end loop; Print_Line (Original_Total, Output_Total); end; end if; when Actions.Encode => if Handler.Sx_Output then Sx_Output.Open_List; for S of Data_List loop Sx_Output.Append_Atom (Compress (Dict, S)); end loop; Sx_Output.Close_List; end if; if Handler.Check_Roundtrip then for S of Data_List loop declare Processed : constant Ada.Streams.Stream_Element_Array := Compress (Dict, S); Roundtrip : constant String := Decompress (Dict, Processed); begin if S /= Roundtrip then Sx_Output.Open_List; Sx_Output.Append_String ("compress-roundtrip-failed"); Sx_Output.Append_String (S); Sx_Output.Append_Atom (Processed); Sx_Output.Append_String (Roundtrip); Sx_Output.Close_List; end if; end; end loop; end if; if Handler.Stat_Output then declare procedure Print_Line (Original, Output, Base64 : Natural); procedure Print_Line (Original, Output, Base64 : in Natural) is begin Ada.Text_IO.Put_Line (Natural'Image (Original) & Ada.Characters.Latin_1.HT & Natural'Image (Output) & Ada.Characters.Latin_1.HT & Natural'Image (Base64) & Ada.Characters.Latin_1.HT & Float'Image (Float (Output) / Float (Original)) & Ada.Characters.Latin_1.HT & Float'Image (Float (Base64) / Float (Original))); end Print_Line; Original_Total : Natural := 0; Output_Total : Natural := 0; Base64_Total : Natural := 0; begin for S of Data_List loop declare Original_Size : constant Natural := S'Length; Output_Size : constant Natural := Compress (Dict, S)'Length; Base64_Size : constant Natural := ((Output_Size + 2) / 3) * 4; begin Print_Line (Original_Size, Output_Size, Base64_Size); Original_Total := Original_Total + Original_Size; Output_Total := Output_Total + Output_Size; Base64_Total := Base64_Total + Base64_Size; end; end loop; Print_Line (Original_Total, Output_Total, Base64_Total); end; end if; when Actions.Evaluate => declare Total_Size : Ada.Streams.Stream_Element_Count; Counts : Dictionary_Counts; begin Evaluate_Dictionary (Handler.Job_Count, Dict, Data_List, Total_Size, Counts); if Handler.Sx_Output then Sx_Output.Open_List; Sx_Output.Append_String (Ada.Strings.Fixed.Trim (Ada.Streams.Stream_Element_Count'Image (Total_Size), Ada.Strings.Both)); for E in Dictionary_Entry'First .. Last_Code (Dict) loop Sx_Output.Open_List; Sx_Output.Append_Atom (Image (Dict, E)); Sx_Output.Append_String (Dict_Entry (Dict, E)); Sx_Output.Append_String (Ada.Strings.Fixed.Trim (String_Count'Image (Counts (E)), Ada.Strings.Both)); Sx_Output.Close_List; end loop; Sx_Output.Close_List; end if; if Handler.Stat_Output then declare procedure Print (Label : in String; E : in Dictionary_Entry; Score : in Score_Value); procedure Print_Min_Max (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value); procedure Print_Value (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value; Ref : in Score_Value); procedure Print (Label : in String; E : in Dictionary_Entry; Score : in Score_Value) is begin if Handler.Sx_Output then Sx_Output.Open_List; Sx_Output.Append_Atom (Image (Dict, E)); Sx_Output.Append_String (Dict_Entry (Dict, E)); Sx_Output.Append_String (Ada.Strings.Fixed.Trim (Score'Img, Ada.Strings.Both)); Sx_Output.Close_List; else Ada.Text_IO.Put_Line (Label & Ada.Characters.Latin_1.HT & Dictionary_Entry'Image (E) & Ada.Characters.Latin_1.HT & Natools.String_Escapes.C_Escape_Hex (Dict_Entry (Dict, E), True) & Ada.Characters.Latin_1.HT & Score'Img); end if; end Print; procedure Print_Min_Max (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value) is Min_Score, Max_Score : Score_Value := Score (Dict, Counts, Dictionary_Entry'First); S : Score_Value; begin for E in Dictionary_Entry'Succ (Dictionary_Entry'First) .. Last_Code (Dict) loop S := Score (Dict, Counts, E); if S < Min_Score then Min_Score := S; end if; if S > Max_Score then Max_Score := S; end if; end loop; Print_Value ("best-" & Label, Score, Max_Score); Print_Value ("worst-" & Label, Score, Min_Score); end Print_Min_Max; procedure Print_Value (Label : in String; Score : not null access function (D : in Dictionary; C : in Dictionary_Counts; E : in Dictionary_Entry) return Score_Value; Ref : in Score_Value) is begin if Handler.Sx_Output then Sx_Output.Open_List; Sx_Output.Append_String (Label); end if; for E in Dictionary_Entry'First .. Last_Code (Dict) loop if Score (Dict, Counts, E) = Ref then Print (Label, E, Ref); end if; end loop; if Handler.Sx_Output then Sx_Output.Close_List; end if; end Print_Value; begin Print_Min_Max ("encoded", Score_Encoded); Print_Min_Max ("frequency", Score_Frequency); Print_Min_Max ("gain", Score_Gain); end; end if; end; end case; end Process; function To_Dictionary (Handler : in Callback'Class; Input : in String_Lists.List; Data_List : in String_Lists.List; Method : in Methods) return Dictionary is begin case Handler.Dict_Source is when Dict_Sources.S_Expression => return Adjust_Dictionary (Handler, To_Dictionary (Input, Handler.Vlen_Verbatim), Data_List, Method); when Dict_Sources.Text_List => declare Needed : constant Integer := Handler.Max_Dict_Size - Natural (Handler.Forced_Words.Length); Selected, Pending : String_Lists.List; First : Dictionary_Entry := Dictionary_Entry'First; begin if Needed <= 0 then for Word of reverse Handler.Forced_Words loop Selected.Prepend (Word); exit when Positive (Selected.Length) = Handler.Max_Dict_Size; end loop; return To_Dictionary (Selected, Handler.Vlen_Verbatim); end if; Simple_Dictionary_And_Pending (Make_Word_Counter (Handler, Input), Needed, Selected, Pending, Method, Handler.Max_Pending); for Word of reverse Handler.Forced_Words loop Selected.Prepend (Word); First := Dictionary_Entry'Succ (First); end loop; return Optimize_Dictionary (To_Dictionary (Selected, Handler.Vlen_Verbatim), First, Pending, Input, Handler.Job_Count, Method, Handler.Min_Dict_Size, Handler.Max_Dict_Size); end; when Dict_Sources.Unoptimized_Text_List => declare Needed : constant Integer := Handler.Max_Dict_Size - Natural (Handler.Forced_Words.Length); All_Words : String_Lists.List; begin if Needed > 0 then All_Words := Simple_Dictionary (Make_Word_Counter (Handler, Input), Needed, Method); for Word of reverse Handler.Forced_Words loop All_Words.Prepend (Word); end loop; else for Word of reverse Handler.Forced_Words loop All_Words.Prepend (Word); exit when Positive (All_Words.Length) >= Handler.Max_Dict_Size; end loop; end if; return To_Dictionary (All_Words, Handler.Vlen_Verbatim); end; end case; end To_Dictionary; end Dictionary_Subprograms; package Dict_256 is new Dictionary_Subprograms (Dictionary => Natools.Smaz_256.Dictionary, Dictionary_Entry => Ada.Streams.Stream_Element, Methods => Natools.Smaz_Tools.Methods.Enum, Score_Value => Natools.Smaz_Tools.Score_Value, String_Count => Natools.Smaz_Tools.String_Count, Word_Counter => Natools.Smaz_Tools.Word_Counter, Dictionary_Counts => Tools_256.Dictionary_Counts, String_Lists => Natools.Smaz_Tools.String_Lists, Add_Substrings => Natools.Smaz_Tools.Add_Substrings, Add_Words => Natools.Smaz_Tools.Add_Words, Append_String => Tools_256.Append_String, Build_Perfect_Hash => Natools.Smaz_Tools.GNAT.Build_Perfect_Hash, Compress => Natools.Smaz_256.Compress, Decompress => Natools.Smaz_256.Decompress, Dict_Entry => Natools.Smaz_256.Dict_Entry, Evaluate_Dictionary => Tools_256.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Tools_256.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz_Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Tools_256.Remove_Element, Replace_Element => Tools_256.Replace_Element, Score_Encoded => Tools_256.Score_Encoded'Access, Score_Frequency => Tools_256.Score_Frequency'Access, Score_Gain => Tools_256.Score_Gain'Access, Simple_Dictionary => Natools.Smaz_Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz_Tools.Simple_Dictionary_And_Pending, To_Dictionary => Tools_256.To_Dictionary, Worst_Element => Tools_256.Worst_Index); package Dict_4096 is new Dictionary_Subprograms (Dictionary => Natools.Smaz_4096.Dictionary, Dictionary_Entry => Natools.Smaz_Implementations.Base_4096.Base_4096_Digit, Methods => Natools.Smaz_Tools.Methods.Enum, Score_Value => Natools.Smaz_Tools.Score_Value, String_Count => Natools.Smaz_Tools.String_Count, Word_Counter => Natools.Smaz_Tools.Word_Counter, Dictionary_Counts => Tools_4096.Dictionary_Counts, String_Lists => Natools.Smaz_Tools.String_Lists, Add_Substrings => Natools.Smaz_Tools.Add_Substrings, Add_Words => Natools.Smaz_Tools.Add_Words, Append_String => Tools_4096.Append_String, Build_Perfect_Hash => Natools.Smaz_Tools.GNAT.Build_Perfect_Hash, Compress => Natools.Smaz_4096.Compress, Decompress => Natools.Smaz_4096.Decompress, Dict_Entry => Natools.Smaz_4096.Dict_Entry, Evaluate_Dictionary => Tools_4096.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Tools_4096.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz_Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Tools_4096.Remove_Element, Replace_Element => Tools_4096.Replace_Element, Score_Encoded => Tools_4096.Score_Encoded'Access, Score_Frequency => Tools_4096.Score_Frequency'Access, Score_Gain => Tools_4096.Score_Gain'Access, Simple_Dictionary => Natools.Smaz_Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz_Tools.Simple_Dictionary_And_Pending, To_Dictionary => Tools_4096.To_Dictionary, Worst_Element => Tools_4096.Worst_Index); package Dict_64 is new Dictionary_Subprograms (Dictionary => Natools.Smaz_64.Dictionary, Dictionary_Entry => Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit, Methods => Natools.Smaz_Tools.Methods.Enum, Score_Value => Natools.Smaz_Tools.Score_Value, String_Count => Natools.Smaz_Tools.String_Count, Word_Counter => Natools.Smaz_Tools.Word_Counter, Dictionary_Counts => Tools_64.Dictionary_Counts, String_Lists => Natools.Smaz_Tools.String_Lists, Add_Substrings => Natools.Smaz_Tools.Add_Substrings, Add_Words => Natools.Smaz_Tools.Add_Words, Append_String => Tools_64.Append_String, Build_Perfect_Hash => Natools.Smaz_Tools.GNAT.Build_Perfect_Hash, Compress => Natools.Smaz_64.Compress, Decompress => Natools.Smaz_64.Decompress, Dict_Entry => Natools.Smaz_64.Dict_Entry, Evaluate_Dictionary => Tools_64.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Tools_64.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz_Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Tools_64.Remove_Element, Replace_Element => Tools_64.Replace_Element, Score_Encoded => Tools_64.Score_Encoded'Access, Score_Frequency => Tools_64.Score_Frequency'Access, Score_Gain => Tools_64.Score_Gain'Access, Simple_Dictionary => Natools.Smaz_Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz_Tools.Simple_Dictionary_And_Pending, To_Dictionary => Tools_64.To_Dictionary, Worst_Element => Tools_64.Worst_Index); package Dict_Retired is new Dictionary_Subprograms (Dictionary => Natools.Smaz.Dictionary, Dictionary_Entry => Ada.Streams.Stream_Element, Methods => Natools.Smaz.Tools.Methods.Enum, Score_Value => Natools.Smaz.Tools.Score_Value, String_Count => Natools.Smaz.Tools.String_Count, Word_Counter => Natools.Smaz.Tools.Word_Counter, Dictionary_Counts => Natools.Smaz.Tools.Dictionary_Counts, String_Lists => Natools.Smaz.Tools.String_Lists, Add_Substrings => Natools.Smaz.Tools.Add_Substrings, Add_Words => Natools.Smaz.Tools.Add_Words, Append_String => Natools.Smaz.Tools.Append_String, Build_Perfect_Hash => Build_Perfect_Hash, Compress => Natools.Smaz.Compress, Decompress => Natools.Smaz.Decompress, Dict_Entry => Natools.Smaz.Dict_Entry, Evaluate_Dictionary => Natools.Smaz.Tools.Evaluate_Dictionary, Evaluate_Dictionary_Partial => Natools.Smaz.Tools.Evaluate_Dictionary_Partial, Filter_By_Count => Natools.Smaz.Tools.Filter_By_Count, Last_Code => Last_Code, Remove_Element => Natools.Smaz.Tools.Remove_Element, Replace_Element => Natools.Smaz.Tools.Replace_Element, Score_Encoded => Natools.Smaz.Tools.Score_Encoded'Access, Score_Frequency => Natools.Smaz.Tools.Score_Frequency'Access, Score_Gain => Natools.Smaz.Tools.Score_Gain'Access, Simple_Dictionary => Natools.Smaz.Tools.Simple_Dictionary, Simple_Dictionary_And_Pending => Natools.Smaz.Tools.Simple_Dictionary_And_Pending, To_Dictionary => Natools.Smaz.Tools.To_Dictionary, Worst_Element => Natools.Smaz.Tools.Worst_Index); overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String) is begin case Id is when Options.Help => Handler.Display_Help := True; when Options.Decode => Handler.Need_Dictionary := True; Handler.Action := Actions.Decode; when Options.Encode => Handler.Need_Dictionary := True; Handler.Action := Actions.Encode; when Options.Evaluate => Handler.Need_Dictionary := True; Handler.Action := Actions.Evaluate; when Options.No_Stat_Output => Handler.Stat_Output := False; when Options.No_Sx_Output => Handler.Sx_Output := False; when Options.Output_Ada_Dict => Handler.Need_Dictionary := True; if Argument'Length > 0 then Handler.Ada_Dictionary := Ada.Strings.Unbounded.To_Unbounded_String (Argument); else Handler.Ada_Dictionary := Ada.Strings.Unbounded.To_Unbounded_String ("-"); end if; when Options.Output_Hash => Handler.Need_Dictionary := True; Handler.Hash_Package := Ada.Strings.Unbounded.To_Unbounded_String (Argument); when Options.Stat_Output => Handler.Stat_Output := True; when Options.Sx_Output => Handler.Sx_Output := True; when Options.Dictionary_Input => Handler.Dict_Source := Dict_Sources.S_Expression; when Options.Text_List_Input => Handler.Dict_Source := Dict_Sources.Text_List; when Options.Fast_Text_Input => Handler.Dict_Source := Dict_Sources.Unoptimized_Text_List; when Options.Sx_Dict_Output => Handler.Need_Dictionary := True; Handler.Sx_Dict_Output := True; when Options.Min_Sub_Size => Handler.Min_Sub_Size := Positive'Value (Argument); when Options.Max_Sub_Size => Handler.Max_Sub_Size := Positive'Value (Argument); when Options.Max_Word_Size => Handler.Max_Word_Size := Positive'Value (Argument); when Options.Job_Count => Handler.Job_Count := Natural'Value (Argument); when Options.Filter_Threshold => Handler.Filter_Threshold := Natools.Smaz_Tools.String_Count'Value (Argument); when Options.Score_Method => Handler.Score_Method := Methods.Enum'Value (Argument); when Options.Max_Pending => Handler.Max_Pending := Ada.Containers.Count_Type'Value (Argument); when Options.Dict_Size => Handler.Min_Dict_Size := Positive'Value (Argument); Handler.Max_Dict_Size := Positive'Value (Argument); when Options.Vlen_Verbatim => Handler.Vlen_Verbatim := True; when Options.No_Vlen_Verbatim => Handler.Vlen_Verbatim := False; when Options.Base_256 => Handler.Algorithm := Algorithms.Base_256; when Options.Base_256_Retired => Handler.Algorithm := Algorithms.Base_256_Retired; when Options.Base_64 => Handler.Algorithm := Algorithms.Base_64; when Options.Base_4096 => Handler.Algorithm := Algorithms.Base_4096; when Options.Check_Roundtrip => Handler.Check_Roundtrip := True; when Options.Force_Word => if Argument'Length > 0 then Handler.Need_Dictionary := True; Handler.Forced_Words.Append (Argument); if Handler.Action in Actions.Nothing then Handler.Action := Actions.Adjust_Dictionary; end if; end if; when Options.Max_Dict_Size => Handler.Max_Dict_Size := Positive'Value (Argument); when Options.Min_Dict_Size => Handler.Min_Dict_Size := Positive'Value (Argument); end case; end Option; function Activate_Dictionary (Dict : in Natools.Smaz_256.Dictionary) return Natools.Smaz_256.Dictionary is Result : Natools.Smaz_256.Dictionary := Dict; begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Tools_256.To_String_List (Result)); Result.Hash := Natools.Smaz_Tools.Trie_Search'Access; pragma Assert (Natools.Smaz_256.Is_Valid (Result)); return Result; end Activate_Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_4096.Dictionary) return Natools.Smaz_4096.Dictionary is Result : Natools.Smaz_4096.Dictionary := Dict; begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Tools_4096.To_String_List (Result)); Result.Hash := Natools.Smaz_Tools.Trie_Search'Access; pragma Assert (Natools.Smaz_4096.Is_Valid (Result)); return Result; end Activate_Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz_64.Dictionary) return Natools.Smaz_64.Dictionary is Result : Natools.Smaz_64.Dictionary := Dict; begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Tools_64.To_String_List (Result)); Result.Hash := Natools.Smaz_Tools.Trie_Search'Access; pragma Assert (Natools.Smaz_64.Is_Valid (Result)); return Result; end Activate_Dictionary; function Activate_Dictionary (Dict : in Natools.Smaz.Dictionary) return Natools.Smaz.Dictionary is Result : Natools.Smaz.Dictionary := Dict; begin Natools.Smaz.Tools.Set_Dictionary_For_Trie_Search (Result); Result.Hash := Natools.Smaz.Tools.Trie_Search'Access; for I in Result.Offsets'Range loop if Natools.Smaz.Tools.Trie_Search (Natools.Smaz.Dict_Entry (Result, I)) /= Natural (I) then Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "Fail at" & Ada.Streams.Stream_Element'Image (I) & " -> " & Natools.String_Escapes.C_Escape_Hex (Natools.Smaz.Dict_Entry (Result, I), True) & " ->" & Natural'Image (Natools.Smaz.Tools.Trie_Search (Natools.Smaz.Dict_Entry (Result, I)))); end if; end loop; return Result; end Activate_Dictionary; procedure Build_Perfect_Hash (Word_List : in Natools.Smaz.Tools.String_Lists.List; Package_Name : in String) is Other_Word_List : Natools.Smaz_Tools.String_Lists.List; begin for S of Word_List loop Natools.Smaz_Tools.String_Lists.Append (Other_Word_List, S); end loop; Natools.Smaz_Tools.GNAT.Build_Perfect_Hash (Other_Word_List, Package_Name); end Build_Perfect_Hash; procedure Convert (Input : in Natools.Smaz_Tools.String_Lists.List; Output : out Natools.Smaz.Tools.String_Lists.List) is begin Natools.Smaz.Tools.String_Lists.Clear (Output); for S of Input loop Natools.Smaz.Tools.String_Lists.Append (Output, S); end loop; end Convert; function Getopt_Config return Getopt.Configuration is use Getopt; use Options; R : Getopt.Configuration; begin R.Add_Option ("base-256", '2', No_Argument, Base_256); R.Add_Option ("base-4096", '4', No_Argument, Base_4096); R.Add_Option ("base-64", '6', No_Argument, Base_64); R.Add_Option ("ada-dict", 'A', Optional_Argument, Output_Ada_Dict); R.Add_Option ("check", 'C', No_Argument, Check_Roundtrip); R.Add_Option ("decode", 'd', No_Argument, Decode); R.Add_Option ("dict", 'D', No_Argument, Dictionary_Input); R.Add_Option ("encode", 'e', No_Argument, Encode); R.Add_Option ("evaluate", 'E', No_Argument, Evaluate); R.Add_Option ("filter", 'F', Required_Argument, Filter_Threshold); R.Add_Option ("help", 'h', No_Argument, Help); R.Add_Option ("hash-pkg", 'H', Required_Argument, Output_Hash); R.Add_Option ("jobs", 'j', Required_Argument, Job_Count); R.Add_Option ("sx-dict", 'L', No_Argument, Sx_Dict_Output); R.Add_Option ("min-substring", 'm', Required_Argument, Min_Sub_Size); R.Add_Option ("max-substring", 'M', Required_Argument, Max_Sub_Size); R.Add_Option ("dict-size", 'n', Required_Argument, Dict_Size); R.Add_Option ("max-pending", 'N', Required_Argument, Max_Pending); R.Add_Option ("retired", 'R', No_Argument, Base_256_Retired); R.Add_Option ("stats", 's', No_Argument, Stat_Output); R.Add_Option ("no-stats", 'S', No_Argument, No_Stat_Output); R.Add_Option ("text-list", 't', No_Argument, Text_List_Input); R.Add_Option ("fast-text-list", 'T', No_Argument, Fast_Text_Input); R.Add_Option ("max-word-len", 'W', Required_Argument, Max_Word_Size); R.Add_Option ("s-expr", 'x', No_Argument, Sx_Output); R.Add_Option ("no-s-expr", 'X', No_Argument, No_Sx_Output); R.Add_Option ("force-word", Required_Argument, Force_Word); R.Add_Option ("max-dict-size", Required_Argument, Max_Dict_Size); R.Add_Option ("min-dict-size", Required_Argument, Min_Dict_Size); R.Add_Option ("no-vlen-verbatim", No_Argument, No_Vlen_Verbatim); R.Add_Option ("score-method", Required_Argument, Score_Method); R.Add_Option ("vlen-verbatim", No_Argument, Vlen_Verbatim); return R; end Getopt_Config; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_256.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Tools_256.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_4096.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Tools_4096.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_64.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Tools_64.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz.Dictionary; Hash_Package_Name : in String := "") is procedure Put_Line (Line : in String); procedure Put_Line (Line : in String) is begin Ada.Text_IO.Put_Line (Output, Line); end Put_Line; procedure Print_Dictionary_In_Ada is new Natools.Smaz.Tools.Print_Dictionary_In_Ada (Put_Line); begin if Hash_Package_Name'Length > 0 then Print_Dictionary_In_Ada (Dictionary, Hash_Image => Hash_Package_Name & ".Hash'Access"); else Print_Dictionary_In_Ada (Dictionary); end if; end Print_Dictionary; procedure Print_Help (Opt : in Getopt.Configuration; Output : in Ada.Text_IO.File_Type) is use Ada.Text_IO; Indent : constant String := " "; begin Put_Line (Output, "Usage:"); for Id in Options.Id loop Put (Output, Indent & Opt.Format_Names (Id)); case Id is when Options.Help => New_Line (Output); Put_Line (Output, Indent & Indent & "Display this help text"); when Options.Decode => New_Line (Output); Put_Line (Output, Indent & Indent & "Read a list of strings and decode them"); when Options.Encode => New_Line (Output); Put_Line (Output, Indent & Indent & "Read a list of strings and encode them"); when Options.No_Stat_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Do not output filter statistics"); when Options.No_Sx_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Do not output filtered results in a S-expression"); when Options.Output_Ada_Dict => Put_Line (Output, " [filename]"); Put_Line (Output, Indent & Indent & "Output the current dictionary as Ada code in the given"); Put_Line (Output, Indent & Indent & "file, or standard output if filename is empty or ""-"""); when Options.Output_Hash => Put_Line (Output, " <Hash_Package_Name>"); Put_Line (Output, Indent & Indent & "Build a package with a perfect hash function for the"); Put_Line (Output, Indent & Indent & "current dictionary."); when Options.Stat_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Output filter statistics"); when Options.Sx_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Output filtered results in a S-expression"); when Options.Dictionary_Input => New_Line (Output); Put_Line (Output, Indent & Indent & "Read dictionary directly in input S-expression (default)"); when Options.Text_List_Input => New_Line (Output); Put_Line (Output, Indent & Indent & "Compute dictionary from sample texts" & " in input S-expression"); when Options.Fast_Text_Input => New_Line (Output); Put_Line (Output, Indent & Indent & "Compute dictionary from sample texts" & " in input S-expression, without optimization"); when Options.Sx_Dict_Output => New_Line (Output); Put_Line (Output, Indent & Indent & "Output the dictionary as a S-expression"); when Options.Min_Sub_Size => Put_Line (Output, " <length>"); Put_Line (Output, Indent & Indent & "Minimum substring size when building a dictionary"); when Options.Max_Sub_Size => Put_Line (Output, " <length>"); Put_Line (Output, Indent & Indent & "Maximum substring size when building a dictionary"); when Options.Max_Word_Size => Put_Line (Output, " <length>"); Put_Line (Output, Indent & Indent & "Maximum word size when building a dictionary"); when Options.Evaluate => New_Line (Output); Put_Line (Output, Indent & Indent & "Evaluate the dictionary on the input given corpus"); when Options.Job_Count => Put_Line (Output, " <number>"); Put_Line (Output, Indent & Indent & "Number of parallel jobs in long calculations"); when Options.Filter_Threshold => Put_Line (Output, " <threshold>"); Put_Line (Output, Indent & Indent & "Before building a dictionary from substrings, remove"); Put_Line (Output, Indent & Indent & "substrings whose count is below the threshold."); when Options.Score_Method => Put_Line (Output, " <method>"); Put_Line (Output, Indent & Indent & "Select heuristic method to replace dictionary items" & " during optimization"); when Options.Max_Pending => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Maximum size of candidate list" & " when building a dictionary"); when Options.Dict_Size => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Number of words in the dictionary to build"); when Options.Vlen_Verbatim => New_Line (Output); Put_Line (Output, Indent & Indent & "Enable variable-length verbatim in built dictionary"); when Options.No_Vlen_Verbatim => New_Line (Output); Put_Line (Output, Indent & Indent & "Disable variable-length verbatim in built dictionary"); when Options.Base_256 => New_Line (Output); Put_Line (Output, Indent & Indent & "Use base-256 implementation (default)"); when Options.Base_256_Retired => New_Line (Output); Put_Line (Output, Indent & Indent & "Use retired base-256 implementation"); when Options.Base_64 => New_Line (Output); Put_Line (Output, Indent & Indent & "Use base-64 implementation"); when Options.Base_4096 => New_Line (Output); Put_Line (Output, Indent & Indent & "Use base-4096 implementation"); when Options.Check_Roundtrip => New_Line (Output); Put_Line (Output, Indent & Indent & "Check roundtrip of compression or decompression"); when Options.Force_Word => Put_Line (Output, " <word>"); Put_Line (Output, Indent & Indent & "Force <word> into the dictionary," & " replacing the worst entry"); Put_Line (Output, Indent & Indent & "Can be specified multiple times to force many words."); when Options.Max_Dict_Size => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Maximum number of words in the dictionary to build"); when Options.Min_Dict_Size => Put_Line (Output, " <count>"); Put_Line (Output, Indent & Indent & "Minimum number of words in the dictionary to build"); end case; end loop; end Print_Help; Opt_Config : constant Getopt.Configuration := Getopt_Config; Handler : Callback; Input_List, Input_Data : Natools.Smaz_Tools.String_Lists.List; begin Process_Command_Line : begin Opt_Config.Process (Handler); exception when Getopt.Option_Error => Print_Help (Opt_Config, Ada.Text_IO.Current_Error); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end Process_Command_Line; if Handler.Display_Help then Print_Help (Opt_Config, Ada.Text_IO.Current_Output); end if; if not Handler.Need_Dictionary then return; end if; if not (Handler.Stat_Output or Handler.Sx_Output or Handler.Check_Roundtrip) then Handler.Sx_Output := True; end if; Read_Input_List : declare use type Actions.Enum; Input : constant access Ada.Streams.Root_Stream_Type'Class := Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Current_Input); Parser : Natools.S_Expressions.Parsers.Stream_Parser (Input); begin Parser.Next; Natools.Smaz_Tools.Read_List (Input_List, Parser); if Handler.Action /= Actions.Nothing then Parser.Next; Natools.Smaz_Tools.Read_List (Input_Data, Parser); end if; end Read_Input_List; case Handler.Algorithm is when Algorithms.Base_256 => Dict_256.Process (Handler, Input_List, Input_Data, Handler.Score_Method); when Algorithms.Base_64 => Dict_64.Process (Handler, Input_List, Input_Data, Handler.Score_Method); when Algorithms.Base_4096 => Dict_4096.Process (Handler, Input_List, Input_Data, Handler.Score_Method); when Algorithms.Base_256_Retired => declare Converted_Input_List : Natools.Smaz.Tools.String_Lists.List; Converted_Input_Data : Natools.Smaz.Tools.String_Lists.List; begin Convert (Input_List, Converted_Input_List); Convert (Input_Data, Converted_Input_Data); Dict_Retired.Process (Handler, Converted_Input_List, Converted_Input_Data, Natools.Smaz.Tools.Methods.Enum'Val (Natools.Smaz_Tools.Methods.Enum'Pos (Handler.Score_Method))); end; end case; end Smaz;
reznikmm/matreshka
Ada
4,618
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Text_H_Elements; package Matreshka.ODF_Text.H_Elements is type Text_H_Element_Node is new Matreshka.ODF_Text.Abstract_Text_Element_Node and ODF.DOM.Text_H_Elements.ODF_Text_H with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_H_Element_Node; overriding function Get_Local_Name (Self : not null access constant Text_H_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Text_H_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Text_H_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Text_H_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Text.H_Elements;
charlie5/aIDE
Ada
2,011
adb
with AdaM.Factory; package body AdaM.library_Item is -- Storage Pool -- record_Version : constant := 1; pool_Size : constant := 5_000; package Pool is new AdaM.Factory.Pools (".adam-store", "library_items", pool_Size, record_Version, library_Item.item, library_Item.view); -- Forge -- procedure define (Self : in out Item) is begin null; end define; procedure destruct (Self : in out Item) is begin null; end destruct; function new_Item (Unit : in AdaM.library_Unit.view) return library_Item.view is new_View : constant library_Item.view := Pool.new_Item; begin define (library_Item.item (new_View.all)); new_View.library_Unit := Unit; return new_View; end new_Item; procedure free (Self : in out library_Item.view) is begin destruct (library_Item.item (Self.all)); Pool.free (Self); end free; -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id is begin return Pool.to_Id (Self); end Id; procedure Unit_is (Self : in out Item; Now : AdaM.library_Unit.view) is begin Self.library_Unit := Now; end Unit_is; function Unit (Self : in Item) return AdaM.library_Unit.view is begin return Self.library_Unit; end Unit; -- Streams -- procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View) renames Pool.View_write; procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View) renames Pool.View_read; end AdaM.library_Item;
reznikmm/matreshka
Ada
4,017
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.Dr3d_Focal_Length_Attributes; package Matreshka.ODF_Dr3d.Focal_Length_Attributes is type Dr3d_Focal_Length_Attribute_Node is new Matreshka.ODF_Dr3d.Abstract_Dr3d_Attribute_Node and ODF.DOM.Dr3d_Focal_Length_Attributes.ODF_Dr3d_Focal_Length_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Dr3d_Focal_Length_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Dr3d_Focal_Length_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Dr3d.Focal_Length_Attributes;
io7m/coreland-openal-ada
Ada
84
ads
package OpenAL.Extension is pragma Pure (OpenAL.Extension); end OpenAL.Extension;
stcarrez/ada-keystore
Ada
2,682
adb
----------------------------------------------------------------------- -- akt-commands-list -- List content of keystore -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces; with Ada.Calendar.Formatting; package body AKT.Commands.List is -- ------------------------------ -- List the value entries of the keystore. -- ------------------------------ overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is pragma Unreferenced (Command, Name); use AKT.Commands.Consoles; List : Keystore.Entry_Map; Iter : Keystore.Entry_Cursor; begin Context.Open_Keystore (Args); Context.Wallet.List (Content => List); if List.Is_Empty then return; end if; Context.Console.Start_Title; Context.Console.Print_Title (1, -("Name"), 53); Context.Console.Print_Title (2, -("Size"), 9, J_RIGHT); Context.Console.Print_Title (3, -("Block"), 7, J_RIGHT); Context.Console.Print_Title (4, -("Date"), 20); Context.Console.End_Title; Iter := List.First; while Keystore.Entry_Maps.Has_Element (Iter) loop declare Name : constant String := Keystore.Entry_Maps.Key (Iter); Item : constant Keystore.Entry_Info := Keystore.Entry_Maps.Element (Iter); begin Context.Console.Start_Row; Context.Console.Print_Field (1, Name); Context.Console.Print_Field (2, Interfaces.Unsigned_64'Image (Item.Size), J_RIGHT); Context.Console.Print_Field (3, Natural'Image (Item.Block_Count), J_RIGHT); Context.Console.Print_Field (4, Ada.Calendar.Formatting.Image (Item.Create_Date)); Context.Console.End_Row; end; Keystore.Entry_Maps.Next (Iter); end loop; end Execute; end AKT.Commands.List;
AdaCore/ada-traits-containers
Ada
1,756
ads
-- -- Copyright (C) 2015-2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- -- This unit provides a specialization of the element traits, for use with -- definite elements, i.e. elements whose size is known at compile time. -- Such elements do not need an extra level of indirection via pointers to -- be stored in a container. pragma Ada_2012; generic type Element_Type is private; -- Must be a copyable type (as defined in conts-elements.ads), and -- therefore not a pointer type. In such a case, use -- conts-elements-indefinite.ads instead, and let it do the allocations -- itself. with procedure Free (E : in out Element_Type) is null; -- Free is called when the element is no longer used (removed from -- its container for instance). Most of the time this will do -- nothing, but this procedure is useful if the Element_Type is an -- access type that you want to deallocate. Movable : Boolean := True; -- should be False for controlled types package Conts.Elements.Definite with SPARK_Mode is function Identity (E : Element_Type) return Element_Type is (E) with Inline; package Traits is new Conts.Elements.Traits (Element_Type => Element_Type, Stored_Type => Element_Type, Returned_Type => Element_Type, Constant_Returned_Type => Element_Type, Copyable => True, Movable => Movable, Release => Free, To_Stored => Identity, To_Returned => Identity, To_Constant_Returned => Identity, To_Element => Identity, Copy => Identity); end Conts.Elements.Definite;
reznikmm/matreshka
Ada
4,348
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides implementation of SQL statement parameter rewriter -- for PostgreSQL: every :name parameter placeholder is replaced by $N -- parameter placeholder. Duplicate names are replaced by the same parameter -- placeholder. ------------------------------------------------------------------------------ package Matreshka.Internals.SQL_Parameter_Rewriters.PostgreSQL is type PostgreSQL_Parameter_Rewriter is new Abstract_Parameter_Rewriter with null record; overriding procedure Database_Placeholder (Self : PostgreSQL_Parameter_Rewriter; Name : League.Strings.Universal_String; Number : Positive; Placeholder : out League.Strings.Universal_String; Parameters : in out SQL_Parameter_Sets.Parameter_Set); -- Sets Placeholder to database specific placeholder for parameter with -- Name and number Number. Implementation must modify Parameters -- accordingly. end Matreshka.Internals.SQL_Parameter_Rewriters.PostgreSQL;
AdaCore/Ada_Drivers_Library
Ada
20,899
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body SGTL5000 is ------------ -- Modify -- ------------ procedure Modify (This : in out SGTL5000_DAC; Reg : UInt16; Mask : UInt16; Value : UInt16) is Tmp : UInt16 := This.I2C_Read (Reg); begin Tmp := Tmp and (not Mask); Tmp := Tmp or Value; This.I2C_Write (Reg, Tmp); end Modify; --------------- -- I2C_Write -- --------------- procedure I2C_Write (This : in out SGTL5000_DAC; Reg : UInt16; Value : UInt16) is Status : I2C_Status; begin This.Port.Master_Transmit (Addr => SGTL5000_QFN20_I2C_Addr, Data => (1 => UInt8 (Shift_Right (Reg, 8) and 16#FF#), 2 => UInt8 (Reg and 16#FF#), 3 => UInt8 (Shift_Right (Value, 8) and 16#FF#), 4 => UInt8 (Value and 16#FF#)), Status => Status); if Status /= Ok then raise Program_Error; end if; end I2C_Write; -------------- -- I2C_Read -- -------------- function I2C_Read (This : SGTL5000_DAC; Reg : UInt16) return UInt16 is Status : I2C_Status; Data : I2C_Data (1 .. 2); begin This.Port.Mem_Read (Addr => SGTL5000_QFN20_I2C_Addr, Mem_Addr => Reg, Mem_Addr_Size => Memory_Size_16b, Data => Data, Status => Status); if Status /= Ok then raise Program_Error; end if; return Shift_Left (UInt16 (Data (1)), 8) or UInt16 (Data (2)); end I2C_Read; -------------- -- Valid_Id -- -------------- function Valid_Id (This : SGTL5000_DAC) return Boolean is Id : constant UInt16 := This.I2C_Read (Chip_ID_Reg); begin return (Id and 16#FF00#) = SGTL5000_Chip_ID; end Valid_Id; -------------------- -- Set_DAC_Volume -- -------------------- procedure Set_DAC_Volume (This : in out SGTL5000_DAC; Left, Right : DAC_Volume) is begin This.I2C_Write (DAC_VOL_REG, UInt16 (Left) or Shift_Left (UInt16 (Right), 8)); end Set_DAC_Volume; -------------------- -- Set_ADC_Volume -- -------------------- procedure Set_ADC_Volume (This : in out SGTL5000_DAC; Left, Right : ADC_Volume; Minus_6db : Boolean) is begin This.Modify (ANA_ADC_CTRL_REG, 2#0000_0001_1111_1111#, UInt16 (Left) or Shift_Left (UInt16 (Right), 4) or (if Minus_6db then 2#000_0001_0000_0000# else 0)); end Set_ADC_Volume; --------------------------- -- Set_Headphones_Volume -- --------------------------- procedure Set_Headphones_Volume (This : in out SGTL5000_DAC; Left, Right : HP_Volume) is begin This.Modify (ANA_HP_CTRL_REG, 2#0111_1111_0111_1111#, UInt16 (Left) or Shift_Left (UInt16 (Right), 8)); end Set_Headphones_Volume; ------------------------- -- Set_Line_Out_Volume -- ------------------------- procedure Set_Line_Out_Volume (This : in out SGTL5000_DAC; Left, Right : Line_Out_Volume) is begin This.Modify (LINE_OUT_VOL_REG, 2#0001_1111_0001_1111#, UInt16 (Left) or Shift_Left (UInt16 (Right), 8)); end Set_Line_Out_Volume; --------------------- -- Mute_Headphones -- --------------------- procedure Mute_Headphones (This : in out SGTL5000_DAC; Mute : Boolean := True) is begin This.Modify (ANA_CTRL_REG, 2#0000_0000_0001_0000#, (if Mute then 2#0000_0000_0001_0000# else 0)); end Mute_Headphones; ------------------- -- Mute_Line_Out -- ------------------- procedure Mute_Line_Out (This : in out SGTL5000_DAC; Mute : Boolean := True) is begin This.Modify (ANA_CTRL_REG, 2#0000_0001_0000_0000#, (if Mute then 2#0000_0001_0000_0000# else 0)); end Mute_Line_Out; -------------- -- Mute_ADC -- -------------- procedure Mute_ADC (This : in out SGTL5000_DAC; Mute : Boolean := True) is begin This.Modify (ANA_CTRL_REG, 2#0000_0000_0000_0001#, (if Mute then 2#0000_0000_0000_0001# else 0)); end Mute_ADC; -------------- -- Mute_DAC -- -------------- procedure Mute_DAC (This : in out SGTL5000_DAC; Mute : Boolean := True) is begin This.Modify (ADCDAC_CTRL_REG, 2#0000_0000_0000_1100#, (if Mute then 2#0000_0000_0000_1100# else 0)); end Mute_DAC; ----------------------- -- Set_Power_Control -- ----------------------- procedure Set_Power_Control (This : in out SGTL5000_DAC; ADC : Power_State; DAC : Power_State; DAP : Power_State; I2S_Out : Power_State; I2S_In : Power_State) is Value : UInt16 := 0; begin if ADC = On then Value := Value or 2#0000_0000_0100_0000#; end if; if DAC = On then Value := Value or 2#0000_0000_0010_0000#; end if; if DAP = On then Value := Value or 2#0000_0000_0001_0000#; end if; if I2S_Out = On then Value := Value or 2#0000_0000_0000_0010#; end if; if I2S_In = On then Value := Value or 2#0000_0000_0000_0001#; end if; This.Modify (DIG_POWER_REG, 2#0000_0000_0111_0011#, Value); end Set_Power_Control; --------------------------- -- Set_Reference_Control -- --------------------------- procedure Set_Reference_Control (This : in out SGTL5000_DAC; VAG : Analog_Ground_Voltage; Bias : Current_Bias; Slow_VAG_Ramp : Boolean) is Value : UInt16 := 0; begin Value := Value or Shift_Left (UInt16 (VAG), 4); Value := Value or Shift_Left (UInt16 (Bias), 1); Value := Value or (if Slow_VAG_Ramp then 1 else 0); This.I2C_Write (REF_CTRL_REG, Value); end Set_Reference_Control; ------------------------- -- Set_Short_Detectors -- ------------------------- procedure Set_Short_Detectors (This : in out SGTL5000_DAC; Right_HP : Short_Detector_Level; Left_HP : Short_Detector_Level; Center_HP : Short_Detector_Level; Mode_LR : UInt2; Mode_CM : UInt2) is Value : UInt16 := 0; begin Value := Value or (Shift_Left (UInt16 (Right_HP), 12)); Value := Value or (Shift_Left (UInt16 (Left_HP), 8)); Value := Value or (Shift_Left (UInt16 (Center_HP), 4)); Value := Value or (Shift_Left (UInt16 (Mode_LR), 2)); Value := Value or UInt16 (Mode_CM); This.I2C_Write (SHORT_CTRL_REG, Value); end Set_Short_Detectors; ------------------------- -- Set_Linereg_Control -- ------------------------- procedure Set_Linereg_Control (This : in out SGTL5000_DAC; Charge_Pump_Src_Override : Boolean; Charge_Pump_Src : Charge_Pump_Source; Linereg_Out_Voltage : Linear_Regulator_Out_Voltage) is Value : UInt16 := 0; begin if Charge_Pump_Src_Override then Value := Value or 2#10_0000#; end if; if Charge_Pump_Src = VDDIO then Value := Value or 2#100_0000#; end if; Value := Value or UInt16 (Linereg_Out_Voltage); This.I2C_Write (LINREG_CTRL_REG, Value); end Set_Linereg_Control; ------------------------- -- Set_Lineout_Control -- ------------------------- procedure Set_Lineout_Control (This : in out SGTL5000_DAC; Out_Current : Lineout_Current; Amp_Analog_GND_Voltage : UInt6) is begin This.I2C_Write (LINE_OUT_CTRL_REG, Shift_Left (UInt16 (Out_Current'Enum_Rep), 8) or UInt16 (Amp_Analog_GND_Voltage)); end Set_Lineout_Control; ---------------------- -- Set_Analog_Power -- ---------------------- procedure Set_Analog_Power (This : in out SGTL5000_DAC; DAC_Mono : Boolean := False; Linreg_Simple_PowerUp : Boolean := False; Startup_PowerUp : Boolean := False; VDDC_Charge_Pump_PowerUp : Boolean := False; PLL_PowerUp : Boolean := False; Linereg_D_PowerUp : Boolean := False; VCOAmp_PowerUp : Boolean := False; VAG_PowerUp : Boolean := False; ADC_Mono : Boolean := False; Reftop_PowerUp : Boolean := False; Headphone_PowerUp : Boolean := False; DAC_PowerUp : Boolean := False; Capless_Headphone_PowerUp : Boolean := False; ADC_PowerUp : Boolean := False; Linout_PowerUp : Boolean := False) is Value : UInt16 := 0; begin if Linout_PowerUp then Value := Value or 2**0; end if; if ADC_PowerUp then Value := Value or 2**1; end if; if Capless_Headphone_PowerUp then Value := Value or 2**2; end if; if DAC_PowerUp then Value := Value or 2**3; end if; if Headphone_PowerUp then Value := Value or 2**4; end if; if Reftop_PowerUp then Value := Value or 2**5; end if; if not ADC_Mono then Value := Value or 2**6; end if; if VAG_PowerUp then Value := Value or 2**7; end if; if VCOAmp_PowerUp then Value := Value or 2**8; end if; if Linereg_D_PowerUp then Value := Value or 2**9; end if; if PLL_PowerUp then Value := Value or 2**10; end if; if VDDC_Charge_Pump_PowerUp then Value := Value or 2**11; end if; if Startup_PowerUp then Value := Value or 2**12; end if; if Linreg_Simple_PowerUp then Value := Value or 2**13; end if; if not DAC_Mono then Value := Value or 2**14; end if; This.I2C_Write (ANA_POWER_REG, Value); end Set_Analog_Power; ----------------------- -- Set_Clock_Control -- ----------------------- procedure Set_Clock_Control (This : in out SGTL5000_DAC; Rate : Rate_Mode; FS : SYS_FS_Freq; MCLK : MCLK_Mode) is Value : UInt16 := 0; begin Value := Value or (case Rate is when SYS_FS => 2#00_0000#, when Half_SYS_FS => 2#01_0000#, when Quarter_SYS_FS => 2#10_0000#, when Sixth_SYS_FS => 2#11_0000#); Value := Value or (case FS is when SYS_FS_32kHz => 2#0000#, when SYS_FS_44kHz => 2#0100#, when SYS_FS_48kHz => 2#1000#, when SYS_FS_96kHz => 2#1100#); Value := Value or (case MCLK is when MCLK_256FS => 2#00#, when MCLK_384FS => 2#01#, when MCLK_512FS => 2#10#, when Use_PLL => 2#11#); This.I2C_Write (CLK_CTRL_REG, Value); end Set_Clock_Control; ------------- -- Set_PLL -- ------------- procedure Set_PLL (This : in out SGTL5000_DAC; PLL_Output_Freq : Natural; MCLK_Freq : Natural) is Int_Divisor : constant Natural := PLL_Output_Freq / MCLK_Freq; Frac_Divisor : constant Natural := Natural (((Float (PLL_Output_Freq) / Float (MCLK_Freq)) - Float (Int_Divisor)) * 2048.0); begin This.I2C_Write (PLL_CTRL_REG, Shift_Left (UInt16 (Int_Divisor), 11) or UInt16 (Frac_Divisor)); -- Wait for PLL lock loop declare Status : constant UInt16 := This.I2C_Read (ANA_STATUS_REG); begin -- Check PLL_IS_LOCKED bit exit when (Status and 2#0001_0000#) /= 0; end; end loop; end Set_PLL; --------------------- -- Set_I2S_Control -- --------------------- procedure Set_I2S_Control (This : in out SGTL5000_DAC; SCLKFREQ : SCLKFREQ_Mode; Invert_SCLK : Boolean; Master_Mode : Boolean; Data_Len : Data_Len_Mode; I2S : I2S_Mode; LR_Align : Boolean; LR_Polarity : Boolean) is Value : UInt16 := 0; begin Value := Value or (case SCLKFREQ is when SCLKFREQ_64FS => 2#0_0000_0000#, when SCLKFREQ_32FS => 2#1_0000_0000#); if Master_Mode then Value := Value or 2#1000_0000#; end if; if Invert_SCLK then Value := Value or 2#0100_0000#; end if; Value := Value or (case Data_Len is when Data_32b => 2#00_0000#, when Data_24b => 2#01_0000#, when Data_20b => 2#10_0000#, when Data_16b => 2#11_0000#); Value := Value or (case I2S is when I2S_Left_Justified => 2#0000#, when Right_Justified => 2#0100#, when PCM => 2#1000#); if LR_Align then Value := Value or 2#10#; end if; if LR_Polarity then Value := Value or 2#1#; end if; This.I2C_Write (I2S_CTRL_REG, Value); end Set_I2S_Control; ----------------------- -- Select_ADC_Source -- ----------------------- procedure Select_ADC_Source (This : in out SGTL5000_DAC; Source : ADC_Source; Enable_ZCD : Boolean) is begin This.Modify (ANA_CTRL_REG, 2#0000_0000_0000_0100#, (case Source is when Microphone => 2#0000_0000_0000_0000#, when Line_In => 2#0000_0000_0000_0100#) or (if Enable_ZCD then 2#0000_0000_0000_0010# else 0)); end Select_ADC_Source; ----------------------- -- Select_DAP_Source -- ----------------------- procedure Select_DAP_Source (This : in out SGTL5000_DAC; Source : DAP_Source) is begin This.Modify (SSS_CTRL_REG, 2#0000_0000_1100_0000#, (case Source is when ADC => 2#0000_0000_0000_0000#, when I2S_In => 2#0000_0000_0100_0000#)); end Select_DAP_Source; --------------------------- -- Select_DAP_Mix_Source -- --------------------------- procedure Select_DAP_Mix_Source (This : in out SGTL5000_DAC; Source : DAP_Mix_Source) is begin This.Modify (SSS_CTRL_REG, 2#0000_0011_0000_0000#, (case Source is when ADC => 2#0000_0000_0000_0000#, when I2S_In => 2#0000_0001_0000_0000#)); end Select_DAP_Mix_Source; ----------------------- -- Select_DAC_Source -- ----------------------- procedure Select_DAC_Source (This : in out SGTL5000_DAC; Source : DAC_Source) is begin This.Modify (SSS_CTRL_REG, 2#0000_0000_0011_0000#, (case Source is when ADC => 2#0000_0000_0000_0000#, when I2S_In => 2#0000_0000_0001_0000#, when DAP => 2#0000_0000_0011_0000#)); end Select_DAC_Source; ---------------------- -- Select_HP_Source -- ---------------------- procedure Select_HP_Source (This : in out SGTL5000_DAC; Source : HP_Source; Enable_ZCD : Boolean) is begin This.Modify (ANA_CTRL_REG, 2#0000_0000_0100_0000#, (case Source is when DAC => 2#0000_0000_0000_0000#, when Line_In => 2#0000_0000_0100_0000#) or (if Enable_ZCD then 2#0000_0000_0010_0000# else 0)); end Select_HP_Source; --------------------------- -- Select_I2S_Out_Source -- --------------------------- procedure Select_I2S_Out_Source (This : in out SGTL5000_DAC; Source : I2S_Out_Source) is begin This.Modify (SSS_CTRL_REG, 2#0000_0000_0000_0011#, (case Source is when ADC => 2#0000_0000_0000_0000#, when I2S_In => 2#0000_0000_0000_0001#, when DAP => 2#0000_0000_0000_0011#)); end Select_I2S_Out_Source; end SGTL5000;
meowthsli/veriflight_boards
Ada
5,711
adb
with HAL; use HAL; with Ada.Real_Time; use Ada.Real_Time; with Ada.Unchecked_Conversion; package body mpu6000_spi is -- -- Types -- type Register_Address is new HAL.UInt8; subtype Read_Buffer is SPI_Data_8b (1 .. 6); -- -- Constants -- MPU_RA_ACCEL_XOUT_H : constant Register_Address := 16#3B#; MPU_RA_GYRO_XOUT_H : constant Register_Address := 16#43#; pragma Unreferenced (MPU_RA_GYRO_XOUT_H); MPU_RA_PWR_MGMT_1 : constant Register_Address := 16#6B#; MPU_RA_PWR_MGMT_2 : constant Register_Address := 16#6C#; MPU_RA_USER_CTRL : constant Register_Address := 16#6A#; MPU_RA_WHOAMI : constant Register_Address := 16#75#; MPU_PRODUCT_ID : constant Register_Address := 16#0C#; BIT_H_RESET : constant HAL.UInt8 := 16#80#; MPU_CLK_SEL_PLLGYROZ : constant := 16#03#; BIT_I2C_IF_DIS : constant := 16#10#; SPI_Read_Flag : constant Register_Address := 16#80#; SPI_Write_Flag : constant Register_Address := 16#00#; ----------------------- -- Forward declarations ------------------------- -- procedure IO_Read -- (This : in out Six_Axis_Accelerometer; -- Value : out HAL.UInt8; -- ReadAddr : Register_Address); procedure IO_Write (This : in out Six_Axis_Accelerometer; Value : HAL.UInt8; WriteAddr : Register_Address); procedure IO_Read_Buffer (This : in out Six_Axis_Accelerometer; Value : out Read_Buffer; ReadAddr : Register_Address); procedure IO_Read_Value (This : in out Six_Axis_Accelerometer; Value : out HAL.UInt8; ReadAddr : Register_Address); function fuse (high : HAL.UInt8; low : HAL.UInt8) return Short_Integer with Inline_Always => True; ----------------- -- Package body ----------------- procedure Configure (this : in out Six_Axis_Accelerometer) is begin IO_Write (this, BIT_H_RESET, MPU_RA_PWR_MGMT_1); -- reset delay until Clock + Milliseconds (15); IO_Write (this, MPU_CLK_SEL_PLLGYROZ, MPU_RA_PWR_MGMT_1); -- wake up, use Z-axis delay until Clock + Milliseconds (15); IO_Write (this, BIT_I2C_IF_DIS, MPU_RA_USER_CTRL); -- disable i2c delay until Clock + Milliseconds (15); IO_Write (this, 0, MPU_RA_PWR_MGMT_2); -- enable all sensors delay until Clock + Milliseconds (15); -- TODO: setup sample rate and others end Configure; function Read (this : in out Six_Axis_Accelerometer) return Acc_Data is buffer : Read_Buffer; d : Acc_Data := Acc_Data'(others => <>); begin IO_Read_Buffer (this, buffer, MPU_RA_ACCEL_XOUT_H); -- burst read d.Xacc := fuse (buffer (1), buffer (2)); d.Yacc := fuse (buffer (3), buffer (4)); d.Zacc := fuse (buffer (5), buffer (6)); return d; end Read; function Id (this : in out Six_Axis_Accelerometer; product : out Unsigned_8) return Unsigned_8 is buffer : HAL.UInt8; device : Unsigned_8; begin IO_Read_Value (this, buffer, MPU_RA_WHOAMI); device := Unsigned_8 (buffer); IO_Read_Value (this, buffer, MPU_PRODUCT_ID); product := Unsigned_8 (buffer); return device; end Id; ---------- -- Private ---------- procedure IO_Read_Buffer (This : in out Six_Axis_Accelerometer; Value : out Read_Buffer; ReadAddr : Register_Address) is Data : SPI_Data_8b (1 .. Read_Buffer'Length); Status : SPI_Status; begin This.Chip_Select.Clear; This.Port.Transmit (SPI_Data_8b'(1 => HAL.UInt8 (ReadAddr or SPI_Read_Flag)), Status); if Status /= Ok then -- No error handling... raise Program_Error; end if; This.Port.Receive (Data, Status); if Status /= Ok then -- No error handling... raise Program_Error; end if; This.Chip_Select.Set; Value (1 .. 6) := Data (1 .. 6); end IO_Read_Buffer; procedure IO_Read_Value (This : in out Six_Axis_Accelerometer; Value : out HAL.UInt8; ReadAddr : Register_Address) is Data : SPI_Data_8b (1 .. 1); Status : SPI_Status; begin This.Chip_Select.Clear; This.Port.Transmit (SPI_Data_8b'(1 => HAL.UInt8 (ReadAddr or SPI_Read_Flag)), Status); if Status /= Ok then -- No error handling... raise Program_Error; end if; This.Port.Receive (Data, Status); This.Chip_Select.Set; if Status /= Ok then -- No error handling... raise Program_Error; end if; Value := Data (1); end IO_Read_Value; procedure IO_Write (This : in out Six_Axis_Accelerometer; Value : HAL.UInt8; WriteAddr : Register_Address) is Status : SPI_Status; begin This.Chip_Select.Clear; This.Port.Transmit (SPI_Data_8b'(HAL.UInt8 (WriteAddr or SPI_Write_Flag), Value), Status); This.Chip_Select.Set; if Status /= Ok then -- No error handling... raise Program_Error; end if; end IO_Write; ------------------------------------- -- Utils ------------------------------------- function fuse (high : HAL.UInt8; low : HAL.UInt8) return Short_Integer is --------------------- -- Uint16_To_Int16 -- --------------------- function Uint16_To_Int16 is new Ada.Unchecked_Conversion (HAL.UInt16, Short_Integer); reg : HAL.UInt16; begin reg := HAL.Shift_Left (HAL.UInt16 (high), 8); reg := reg or HAL.UInt16 (low); return Uint16_To_Int16 (reg); end fuse; end mpu6000_spi;
reznikmm/matreshka
Ada
3,739
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Presentation_Animation_Group_Elements is pragma Preelaborate; type ODF_Presentation_Animation_Group is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Presentation_Animation_Group_Access is access all ODF_Presentation_Animation_Group'Class with Storage_Size => 0; end ODF.DOM.Presentation_Animation_Group_Elements;
zhmu/ananas
Ada
3,729
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . T R A C E B A C K . S Y M B O L I C . M O D U L E _ N A M E -- -- -- -- B o d y -- -- -- -- Copyright (C) 2012-2022, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the Windows specific version of this package with System.Win32; use System.Win32; separate (System.Traceback.Symbolic) package body Module_Name is --------------------------------- -- Build_Cache_For_All_Modules -- --------------------------------- procedure Build_Cache_For_All_Modules is begin null; end Build_Cache_For_All_Modules; --------- -- Get -- --------- function Get (Addr : System.Address; Load_Addr : access System.Address) return String is Res : DWORD; hModule : aliased HANDLE; Path : String (1 .. 1_024); begin Load_Addr.all := System.Null_Address; if GetModuleHandleEx (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, Addr, hModule'Access) = Win32.TRUE then Res := GetModuleFileName (hModule, Path'Address, Path'Length); if FreeLibrary (hModule) = Win32.FALSE then null; end if; if Res > 0 then return Path (1 .. Positive (Res)); end if; end if; return ""; exception when others => return ""; end Get; ------------------ -- Is_Supported -- ------------------ function Is_Supported return Boolean is begin return True; end Is_Supported; end Module_Name;
oresat/oresat-c3-rf
Ada
26,793
adb
M:display_com0 T:Fdisplay_com0$axradio_status_receive[({0}S:S$phy$0$0({10}STaxradio_status_receive_phy:S),Z,0,0)({10}S:S$mac$0$0({12}STaxradio_status_receive_mac:S),Z,0,0)({22}S:S$pktdata$0$0({2}DX,SC:U),Z,0,0)({24}S:S$pktlen$0$0({2}SI:U),Z,0,0)] T:Fdisplay_com0$axradio_address[({0}S:S$addr$0$0({5}DA5d,SC:U),Z,0,0)] T:Fdisplay_com0$axradio_address_mask[({0}S:S$addr$0$0({5}DA5d,SC:U),Z,0,0)({5}S:S$mask$0$0({5}DA5d,SC:U),Z,0,0)] T:Fdisplay_com0$__00000000[({0}S:S$rx$0$0({26}STaxradio_status_receive:S),Z,0,0)({0}S:S$cs$0$0({3}STaxradio_status_channelstate:S),Z,0,0)] T:Fdisplay_com0$axradio_status_channelstate[({0}S:S$rssi$0$0({2}SI:S),Z,0,0)({2}S:S$busy$0$0({1}SC:U),Z,0,0)] T:Fdisplay_com0$axradio_status_receive_mac[({0}S:S$remoteaddr$0$0({5}DA5d,SC:U),Z,0,0)({5}S:S$localaddr$0$0({5}DA5d,SC:U),Z,0,0)({10}S:S$raw$0$0({2}DX,SC:U),Z,0,0)] T:Fdisplay_com0$calsector[({0}S:S$id$0$0({5}DA5d,SC:U),Z,0,0)({5}S:S$len$0$0({1}SC:U),Z,0,0)({6}S:S$devid$0$0({6}DA6d,SC:U),Z,0,0)({12}S:S$calg00gain$0$0({2}DA2d,SC:U),Z,0,0)({14}S:S$calg01gain$0$0({2}DA2d,SC:U),Z,0,0)({16}S:S$calg10gain$0$0({2}DA2d,SC:U),Z,0,0)({18}S:S$caltempgain$0$0({2}DA2d,SC:U),Z,0,0)({20}S:S$caltempoffs$0$0({2}DA2d,SC:U),Z,0,0)({22}S:S$frcoscfreq$0$0({2}DA2d,SC:U),Z,0,0)({24}S:S$lposcfreq$0$0({2}DA2d,SC:U),Z,0,0)({26}S:S$lposcfreq_fast$0$0({2}DA2d,SC:U),Z,0,0)({28}S:S$powctrl0$0$0({1}SC:U),Z,0,0)({29}S:S$powctrl1$0$0({1}SC:U),Z,0,0)({30}S:S$ref$0$0({1}SC:U),Z,0,0)] T:Fdisplay_com0$axradio_status_receive_phy[({0}S:S$rssi$0$0({2}SI:S),Z,0,0)({2}S:S$offset$0$0({4}SL:S),Z,0,0)({6}S:S$timeoffset$0$0({2}SI:S),Z,0,0)({8}S:S$period$0$0({2}SI:S),Z,0,0)] T:Fdisplay_com0$axradio_status[({0}S:S$status$0$0({1}SC:U),Z,0,0)({1}S:S$error$0$0({1}SC:U),Z,0,0)({2}S:S$time$0$0({4}SL:U),Z,0,0)({6}S:S$u$0$0({26}ST__00000000:S),Z,0,0)] S:G$random_seed$0$0({2}SI:U),E,0,0 S:G$ADCCH0VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH0VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH0VAL$0$0({2}SI:U),F,0,0 S:G$ADCCH1VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH1VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH1VAL$0$0({2}SI:U),F,0,0 S:G$ADCCH2VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH2VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH2VAL$0$0({2}SI:U),F,0,0 S:G$ADCCH3VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH3VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH3VAL$0$0({2}SI:U),F,0,0 S:G$ADCTUNE0$0$0({1}SC:U),F,0,0 S:G$ADCTUNE1$0$0({1}SC:U),F,0,0 S:G$ADCTUNE2$0$0({1}SC:U),F,0,0 S:G$DMA0ADDR0$0$0({1}SC:U),F,0,0 S:G$DMA0ADDR1$0$0({1}SC:U),F,0,0 S:G$DMA0ADDR$0$0({2}SI:U),F,0,0 S:G$DMA0CONFIG$0$0({1}SC:U),F,0,0 S:G$DMA1ADDR0$0$0({1}SC:U),F,0,0 S:G$DMA1ADDR1$0$0({1}SC:U),F,0,0 S:G$DMA1ADDR$0$0({2}SI:U),F,0,0 S:G$DMA1CONFIG$0$0({1}SC:U),F,0,0 S:G$FRCOSCCONFIG$0$0({1}SC:U),F,0,0 S:G$FRCOSCCTRL$0$0({1}SC:U),F,0,0 S:G$FRCOSCFREQ0$0$0({1}SC:U),F,0,0 S:G$FRCOSCFREQ1$0$0({1}SC:U),F,0,0 S:G$FRCOSCFREQ$0$0({2}SI:U),F,0,0 S:G$FRCOSCKFILT0$0$0({1}SC:U),F,0,0 S:G$FRCOSCKFILT1$0$0({1}SC:U),F,0,0 S:G$FRCOSCKFILT$0$0({2}SI:U),F,0,0 S:G$FRCOSCPER0$0$0({1}SC:U),F,0,0 S:G$FRCOSCPER1$0$0({1}SC:U),F,0,0 S:G$FRCOSCPER$0$0({2}SI:U),F,0,0 S:G$FRCOSCREF0$0$0({1}SC:U),F,0,0 S:G$FRCOSCREF1$0$0({1}SC:U),F,0,0 S:G$FRCOSCREF$0$0({2}SI:U),F,0,0 S:G$ANALOGA$0$0({1}SC:U),F,0,0 S:G$GPIOENABLE$0$0({1}SC:U),F,0,0 S:G$EXTIRQ$0$0({1}SC:U),F,0,0 S:G$INTCHGA$0$0({1}SC:U),F,0,0 S:G$INTCHGB$0$0({1}SC:U),F,0,0 S:G$INTCHGC$0$0({1}SC:U),F,0,0 S:G$PALTA$0$0({1}SC:U),F,0,0 S:G$PALTB$0$0({1}SC:U),F,0,0 S:G$PALTC$0$0({1}SC:U),F,0,0 S:G$PALTRADIO$0$0({1}SC:U),F,0,0 S:G$PINCHGA$0$0({1}SC:U),F,0,0 S:G$PINCHGB$0$0({1}SC:U),F,0,0 S:G$PINCHGC$0$0({1}SC:U),F,0,0 S:G$PINSEL$0$0({1}SC:U),F,0,0 S:G$LPOSCCONFIG$0$0({1}SC:U),F,0,0 S:G$LPOSCFREQ0$0$0({1}SC:U),F,0,0 S:G$LPOSCFREQ1$0$0({1}SC:U),F,0,0 S:G$LPOSCFREQ$0$0({2}SI:U),F,0,0 S:G$LPOSCKFILT0$0$0({1}SC:U),F,0,0 S:G$LPOSCKFILT1$0$0({1}SC:U),F,0,0 S:G$LPOSCKFILT$0$0({2}SI:U),F,0,0 S:G$LPOSCPER0$0$0({1}SC:U),F,0,0 S:G$LPOSCPER1$0$0({1}SC:U),F,0,0 S:G$LPOSCPER$0$0({2}SI:U),F,0,0 S:G$LPOSCREF0$0$0({1}SC:U),F,0,0 S:G$LPOSCREF1$0$0({1}SC:U),F,0,0 S:G$LPOSCREF$0$0({2}SI:U),F,0,0 S:G$LPXOSCGM$0$0({1}SC:U),F,0,0 S:G$MISCCTRL$0$0({1}SC:U),F,0,0 S:G$OSCCALIB$0$0({1}SC:U),F,0,0 S:G$OSCFORCERUN$0$0({1}SC:U),F,0,0 S:G$OSCREADY$0$0({1}SC:U),F,0,0 S:G$OSCRUN$0$0({1}SC:U),F,0,0 S:G$RADIOFDATAADDR0$0$0({1}SC:U),F,0,0 S:G$RADIOFDATAADDR1$0$0({1}SC:U),F,0,0 S:G$RADIOFDATAADDR$0$0({2}SI:U),F,0,0 S:G$RADIOFSTATADDR0$0$0({1}SC:U),F,0,0 S:G$RADIOFSTATADDR1$0$0({1}SC:U),F,0,0 S:G$RADIOFSTATADDR$0$0({2}SI:U),F,0,0 S:G$RADIOMUX$0$0({1}SC:U),F,0,0 S:G$SCRATCH0$0$0({1}SC:U),F,0,0 S:G$SCRATCH1$0$0({1}SC:U),F,0,0 S:G$SCRATCH2$0$0({1}SC:U),F,0,0 S:G$SCRATCH3$0$0({1}SC:U),F,0,0 S:G$SILICONREV$0$0({1}SC:U),F,0,0 S:G$XTALAMPL$0$0({1}SC:U),F,0,0 S:G$XTALOSC$0$0({1}SC:U),F,0,0 S:G$XTALREADY$0$0({1}SC:U),F,0,0 S:Fdisplay_com0$flash_deviceid$0$0({6}DA6d,SC:U),F,0,0 S:Fdisplay_com0$flash_calsector$0$0({31}STcalsector:S),F,0,0 S:G$ACC$0$0({1}SC:U),I,0,0 S:G$B$0$0({1}SC:U),I,0,0 S:G$DPH$0$0({1}SC:U),I,0,0 S:G$DPH1$0$0({1}SC:U),I,0,0 S:G$DPL$0$0({1}SC:U),I,0,0 S:G$DPL1$0$0({1}SC:U),I,0,0 S:G$DPTR0$0$0({2}SI:U),I,0,0 S:G$DPTR1$0$0({2}SI:U),I,0,0 S:G$DPS$0$0({1}SC:U),I,0,0 S:G$E2IE$0$0({1}SC:U),I,0,0 S:G$E2IP$0$0({1}SC:U),I,0,0 S:G$EIE$0$0({1}SC:U),I,0,0 S:G$EIP$0$0({1}SC:U),I,0,0 S:G$IE$0$0({1}SC:U),I,0,0 S:G$IP$0$0({1}SC:U),I,0,0 S:G$PCON$0$0({1}SC:U),I,0,0 S:G$PSW$0$0({1}SC:U),I,0,0 S:G$SP$0$0({1}SC:U),I,0,0 S:G$XPAGE$0$0({1}SC:U),I,0,0 S:G$_XPAGE$0$0({1}SC:U),I,0,0 S:G$ADCCH0CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCH1CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCH2CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCH3CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCLKSRC$0$0({1}SC:U),I,0,0 S:G$ADCCONV$0$0({1}SC:U),I,0,0 S:G$ANALOGCOMP$0$0({1}SC:U),I,0,0 S:G$CLKCON$0$0({1}SC:U),I,0,0 S:G$CLKSTAT$0$0({1}SC:U),I,0,0 S:G$CODECONFIG$0$0({1}SC:U),I,0,0 S:G$DBGLNKBUF$0$0({1}SC:U),I,0,0 S:G$DBGLNKSTAT$0$0({1}SC:U),I,0,0 S:G$DIRA$0$0({1}SC:U),I,0,0 S:G$DIRB$0$0({1}SC:U),I,0,0 S:G$DIRC$0$0({1}SC:U),I,0,0 S:G$DIRR$0$0({1}SC:U),I,0,0 S:G$PINA$0$0({1}SC:U),I,0,0 S:G$PINB$0$0({1}SC:U),I,0,0 S:G$PINC$0$0({1}SC:U),I,0,0 S:G$PINR$0$0({1}SC:U),I,0,0 S:G$PORTA$0$0({1}SC:U),I,0,0 S:G$PORTB$0$0({1}SC:U),I,0,0 S:G$PORTC$0$0({1}SC:U),I,0,0 S:G$PORTR$0$0({1}SC:U),I,0,0 S:G$IC0CAPT0$0$0({1}SC:U),I,0,0 S:G$IC0CAPT1$0$0({1}SC:U),I,0,0 S:G$IC0CAPT$0$0({2}SI:U),I,0,0 S:G$IC0MODE$0$0({1}SC:U),I,0,0 S:G$IC0STATUS$0$0({1}SC:U),I,0,0 S:G$IC1CAPT0$0$0({1}SC:U),I,0,0 S:G$IC1CAPT1$0$0({1}SC:U),I,0,0 S:G$IC1CAPT$0$0({2}SI:U),I,0,0 S:G$IC1MODE$0$0({1}SC:U),I,0,0 S:G$IC1STATUS$0$0({1}SC:U),I,0,0 S:G$NVADDR0$0$0({1}SC:U),I,0,0 S:G$NVADDR1$0$0({1}SC:U),I,0,0 S:G$NVADDR$0$0({2}SI:U),I,0,0 S:G$NVDATA0$0$0({1}SC:U),I,0,0 S:G$NVDATA1$0$0({1}SC:U),I,0,0 S:G$NVDATA$0$0({2}SI:U),I,0,0 S:G$NVKEY$0$0({1}SC:U),I,0,0 S:G$NVSTATUS$0$0({1}SC:U),I,0,0 S:G$OC0COMP0$0$0({1}SC:U),I,0,0 S:G$OC0COMP1$0$0({1}SC:U),I,0,0 S:G$OC0COMP$0$0({2}SI:U),I,0,0 S:G$OC0MODE$0$0({1}SC:U),I,0,0 S:G$OC0PIN$0$0({1}SC:U),I,0,0 S:G$OC0STATUS$0$0({1}SC:U),I,0,0 S:G$OC1COMP0$0$0({1}SC:U),I,0,0 S:G$OC1COMP1$0$0({1}SC:U),I,0,0 S:G$OC1COMP$0$0({2}SI:U),I,0,0 S:G$OC1MODE$0$0({1}SC:U),I,0,0 S:G$OC1PIN$0$0({1}SC:U),I,0,0 S:G$OC1STATUS$0$0({1}SC:U),I,0,0 S:G$RADIOACC$0$0({1}SC:U),I,0,0 S:G$RADIOADDR0$0$0({1}SC:U),I,0,0 S:G$RADIOADDR1$0$0({1}SC:U),I,0,0 S:G$RADIOADDR$0$0({2}SI:U),I,0,0 S:G$RADIODATA0$0$0({1}SC:U),I,0,0 S:G$RADIODATA1$0$0({1}SC:U),I,0,0 S:G$RADIODATA2$0$0({1}SC:U),I,0,0 S:G$RADIODATA3$0$0({1}SC:U),I,0,0 S:G$RADIODATA$0$0({4}SL:U),I,0,0 S:G$RADIOSTAT0$0$0({1}SC:U),I,0,0 S:G$RADIOSTAT1$0$0({1}SC:U),I,0,0 S:G$RADIOSTAT$0$0({2}SI:U),I,0,0 S:G$SPCLKSRC$0$0({1}SC:U),I,0,0 S:G$SPMODE$0$0({1}SC:U),I,0,0 S:G$SPSHREG$0$0({1}SC:U),I,0,0 S:G$SPSTATUS$0$0({1}SC:U),I,0,0 S:G$T0CLKSRC$0$0({1}SC:U),I,0,0 S:G$T0CNT0$0$0({1}SC:U),I,0,0 S:G$T0CNT1$0$0({1}SC:U),I,0,0 S:G$T0CNT$0$0({2}SI:U),I,0,0 S:G$T0MODE$0$0({1}SC:U),I,0,0 S:G$T0PERIOD0$0$0({1}SC:U),I,0,0 S:G$T0PERIOD1$0$0({1}SC:U),I,0,0 S:G$T0PERIOD$0$0({2}SI:U),I,0,0 S:G$T0STATUS$0$0({1}SC:U),I,0,0 S:G$T1CLKSRC$0$0({1}SC:U),I,0,0 S:G$T1CNT0$0$0({1}SC:U),I,0,0 S:G$T1CNT1$0$0({1}SC:U),I,0,0 S:G$T1CNT$0$0({2}SI:U),I,0,0 S:G$T1MODE$0$0({1}SC:U),I,0,0 S:G$T1PERIOD0$0$0({1}SC:U),I,0,0 S:G$T1PERIOD1$0$0({1}SC:U),I,0,0 S:G$T1PERIOD$0$0({2}SI:U),I,0,0 S:G$T1STATUS$0$0({1}SC:U),I,0,0 S:G$T2CLKSRC$0$0({1}SC:U),I,0,0 S:G$T2CNT0$0$0({1}SC:U),I,0,0 S:G$T2CNT1$0$0({1}SC:U),I,0,0 S:G$T2CNT$0$0({2}SI:U),I,0,0 S:G$T2MODE$0$0({1}SC:U),I,0,0 S:G$T2PERIOD0$0$0({1}SC:U),I,0,0 S:G$T2PERIOD1$0$0({1}SC:U),I,0,0 S:G$T2PERIOD$0$0({2}SI:U),I,0,0 S:G$T2STATUS$0$0({1}SC:U),I,0,0 S:G$U0CTRL$0$0({1}SC:U),I,0,0 S:G$U0MODE$0$0({1}SC:U),I,0,0 S:G$U0SHREG$0$0({1}SC:U),I,0,0 S:G$U0STATUS$0$0({1}SC:U),I,0,0 S:G$U1CTRL$0$0({1}SC:U),I,0,0 S:G$U1MODE$0$0({1}SC:U),I,0,0 S:G$U1SHREG$0$0({1}SC:U),I,0,0 S:G$U1STATUS$0$0({1}SC:U),I,0,0 S:G$WDTCFG$0$0({1}SC:U),I,0,0 S:G$WDTRESET$0$0({1}SC:U),I,0,0 S:G$WTCFGA$0$0({1}SC:U),I,0,0 S:G$WTCFGB$0$0({1}SC:U),I,0,0 S:G$WTCNTA0$0$0({1}SC:U),I,0,0 S:G$WTCNTA1$0$0({1}SC:U),I,0,0 S:G$WTCNTA$0$0({2}SI:U),I,0,0 S:G$WTCNTB0$0$0({1}SC:U),I,0,0 S:G$WTCNTB1$0$0({1}SC:U),I,0,0 S:G$WTCNTB$0$0({2}SI:U),I,0,0 S:G$WTCNTR1$0$0({1}SC:U),I,0,0 S:G$WTEVTA0$0$0({1}SC:U),I,0,0 S:G$WTEVTA1$0$0({1}SC:U),I,0,0 S:G$WTEVTA$0$0({2}SI:U),I,0,0 S:G$WTEVTB0$0$0({1}SC:U),I,0,0 S:G$WTEVTB1$0$0({1}SC:U),I,0,0 S:G$WTEVTB$0$0({2}SI:U),I,0,0 S:G$WTEVTC0$0$0({1}SC:U),I,0,0 S:G$WTEVTC1$0$0({1}SC:U),I,0,0 S:G$WTEVTC$0$0({2}SI:U),I,0,0 S:G$WTEVTD0$0$0({1}SC:U),I,0,0 S:G$WTEVTD1$0$0({1}SC:U),I,0,0 S:G$WTEVTD$0$0({2}SI:U),I,0,0 S:G$WTIRQEN$0$0({1}SC:U),I,0,0 S:G$WTSTAT$0$0({1}SC:U),I,0,0 S:G$ACC_0$0$0({1}SX:U),J,0,0 S:G$ACC_1$0$0({1}SX:U),J,0,0 S:G$ACC_2$0$0({1}SX:U),J,0,0 S:G$ACC_3$0$0({1}SX:U),J,0,0 S:G$ACC_4$0$0({1}SX:U),J,0,0 S:G$ACC_5$0$0({1}SX:U),J,0,0 S:G$ACC_6$0$0({1}SX:U),J,0,0 S:G$ACC_7$0$0({1}SX:U),J,0,0 S:G$B_0$0$0({1}SX:U),J,0,0 S:G$B_1$0$0({1}SX:U),J,0,0 S:G$B_2$0$0({1}SX:U),J,0,0 S:G$B_3$0$0({1}SX:U),J,0,0 S:G$B_4$0$0({1}SX:U),J,0,0 S:G$B_5$0$0({1}SX:U),J,0,0 S:G$B_6$0$0({1}SX:U),J,0,0 S:G$B_7$0$0({1}SX:U),J,0,0 S:G$E2IE_0$0$0({1}SX:U),J,0,0 S:G$E2IE_1$0$0({1}SX:U),J,0,0 S:G$E2IE_2$0$0({1}SX:U),J,0,0 S:G$E2IE_3$0$0({1}SX:U),J,0,0 S:G$E2IE_4$0$0({1}SX:U),J,0,0 S:G$E2IE_5$0$0({1}SX:U),J,0,0 S:G$E2IE_6$0$0({1}SX:U),J,0,0 S:G$E2IE_7$0$0({1}SX:U),J,0,0 S:G$E2IP_0$0$0({1}SX:U),J,0,0 S:G$E2IP_1$0$0({1}SX:U),J,0,0 S:G$E2IP_2$0$0({1}SX:U),J,0,0 S:G$E2IP_3$0$0({1}SX:U),J,0,0 S:G$E2IP_4$0$0({1}SX:U),J,0,0 S:G$E2IP_5$0$0({1}SX:U),J,0,0 S:G$E2IP_6$0$0({1}SX:U),J,0,0 S:G$E2IP_7$0$0({1}SX:U),J,0,0 S:G$EIE_0$0$0({1}SX:U),J,0,0 S:G$EIE_1$0$0({1}SX:U),J,0,0 S:G$EIE_2$0$0({1}SX:U),J,0,0 S:G$EIE_3$0$0({1}SX:U),J,0,0 S:G$EIE_4$0$0({1}SX:U),J,0,0 S:G$EIE_5$0$0({1}SX:U),J,0,0 S:G$EIE_6$0$0({1}SX:U),J,0,0 S:G$EIE_7$0$0({1}SX:U),J,0,0 S:G$EIP_0$0$0({1}SX:U),J,0,0 S:G$EIP_1$0$0({1}SX:U),J,0,0 S:G$EIP_2$0$0({1}SX:U),J,0,0 S:G$EIP_3$0$0({1}SX:U),J,0,0 S:G$EIP_4$0$0({1}SX:U),J,0,0 S:G$EIP_5$0$0({1}SX:U),J,0,0 S:G$EIP_6$0$0({1}SX:U),J,0,0 S:G$EIP_7$0$0({1}SX:U),J,0,0 S:G$IE_0$0$0({1}SX:U),J,0,0 S:G$IE_1$0$0({1}SX:U),J,0,0 S:G$IE_2$0$0({1}SX:U),J,0,0 S:G$IE_3$0$0({1}SX:U),J,0,0 S:G$IE_4$0$0({1}SX:U),J,0,0 S:G$IE_5$0$0({1}SX:U),J,0,0 S:G$IE_6$0$0({1}SX:U),J,0,0 S:G$IE_7$0$0({1}SX:U),J,0,0 S:G$EA$0$0({1}SX:U),J,0,0 S:G$IP_0$0$0({1}SX:U),J,0,0 S:G$IP_1$0$0({1}SX:U),J,0,0 S:G$IP_2$0$0({1}SX:U),J,0,0 S:G$IP_3$0$0({1}SX:U),J,0,0 S:G$IP_4$0$0({1}SX:U),J,0,0 S:G$IP_5$0$0({1}SX:U),J,0,0 S:G$IP_6$0$0({1}SX:U),J,0,0 S:G$IP_7$0$0({1}SX:U),J,0,0 S:G$P$0$0({1}SX:U),J,0,0 S:G$F1$0$0({1}SX:U),J,0,0 S:G$OV$0$0({1}SX:U),J,0,0 S:G$RS0$0$0({1}SX:U),J,0,0 S:G$RS1$0$0({1}SX:U),J,0,0 S:G$F0$0$0({1}SX:U),J,0,0 S:G$AC$0$0({1}SX:U),J,0,0 S:G$CY$0$0({1}SX:U),J,0,0 S:G$PINA_0$0$0({1}SX:U),J,0,0 S:G$PINA_1$0$0({1}SX:U),J,0,0 S:G$PINA_2$0$0({1}SX:U),J,0,0 S:G$PINA_3$0$0({1}SX:U),J,0,0 S:G$PINA_4$0$0({1}SX:U),J,0,0 S:G$PINA_5$0$0({1}SX:U),J,0,0 S:G$PINA_6$0$0({1}SX:U),J,0,0 S:G$PINA_7$0$0({1}SX:U),J,0,0 S:G$PINB_0$0$0({1}SX:U),J,0,0 S:G$PINB_1$0$0({1}SX:U),J,0,0 S:G$PINB_2$0$0({1}SX:U),J,0,0 S:G$PINB_3$0$0({1}SX:U),J,0,0 S:G$PINB_4$0$0({1}SX:U),J,0,0 S:G$PINB_5$0$0({1}SX:U),J,0,0 S:G$PINB_6$0$0({1}SX:U),J,0,0 S:G$PINB_7$0$0({1}SX:U),J,0,0 S:G$PINC_0$0$0({1}SX:U),J,0,0 S:G$PINC_1$0$0({1}SX:U),J,0,0 S:G$PINC_2$0$0({1}SX:U),J,0,0 S:G$PINC_3$0$0({1}SX:U),J,0,0 S:G$PINC_4$0$0({1}SX:U),J,0,0 S:G$PINC_5$0$0({1}SX:U),J,0,0 S:G$PINC_6$0$0({1}SX:U),J,0,0 S:G$PINC_7$0$0({1}SX:U),J,0,0 S:G$PORTA_0$0$0({1}SX:U),J,0,0 S:G$PORTA_1$0$0({1}SX:U),J,0,0 S:G$PORTA_2$0$0({1}SX:U),J,0,0 S:G$PORTA_3$0$0({1}SX:U),J,0,0 S:G$PORTA_4$0$0({1}SX:U),J,0,0 S:G$PORTA_5$0$0({1}SX:U),J,0,0 S:G$PORTA_6$0$0({1}SX:U),J,0,0 S:G$PORTA_7$0$0({1}SX:U),J,0,0 S:G$PORTB_0$0$0({1}SX:U),J,0,0 S:G$PORTB_1$0$0({1}SX:U),J,0,0 S:G$PORTB_2$0$0({1}SX:U),J,0,0 S:G$PORTB_3$0$0({1}SX:U),J,0,0 S:G$PORTB_4$0$0({1}SX:U),J,0,0 S:G$PORTB_5$0$0({1}SX:U),J,0,0 S:G$PORTB_6$0$0({1}SX:U),J,0,0 S:G$PORTB_7$0$0({1}SX:U),J,0,0 S:G$PORTC_0$0$0({1}SX:U),J,0,0 S:G$PORTC_1$0$0({1}SX:U),J,0,0 S:G$PORTC_2$0$0({1}SX:U),J,0,0 S:G$PORTC_3$0$0({1}SX:U),J,0,0 S:G$PORTC_4$0$0({1}SX:U),J,0,0 S:G$PORTC_5$0$0({1}SX:U),J,0,0 S:G$PORTC_6$0$0({1}SX:U),J,0,0 S:G$PORTC_7$0$0({1}SX:U),J,0,0 S:G$delay$0$0({2}DF,SV:S),C,0,0 S:G$random$0$0({2}DF,SI:U),C,0,0 S:G$signextend12$0$0({2}DF,SL:S),C,0,0 S:G$signextend16$0$0({2}DF,SL:S),C,0,0 S:G$signextend20$0$0({2}DF,SL:S),C,0,0 S:G$signextend24$0$0({2}DF,SL:S),C,0,0 S:G$hweight8$0$0({2}DF,SC:U),C,0,0 S:G$hweight16$0$0({2}DF,SC:U),C,0,0 S:G$hweight32$0$0({2}DF,SC:U),C,0,0 S:G$signedlimit16$0$0({2}DF,SI:S),C,0,0 S:G$checksignedlimit16$0$0({2}DF,SC:U),C,0,0 S:G$signedlimit32$0$0({2}DF,SL:S),C,0,0 S:G$checksignedlimit32$0$0({2}DF,SC:U),C,0,0 S:G$gray_encode8$0$0({2}DF,SC:U),C,0,0 S:G$gray_decode8$0$0({2}DF,SC:U),C,0,0 S:G$rev8$0$0({2}DF,SC:U),C,0,0 S:G$fmemset$0$0({2}DF,SV:S),C,0,0 S:G$fmemcpy$0$0({2}DF,SV:S),C,0,0 S:G$get_startcause$0$0({2}DF,SC:U),C,0,0 S:G$wtimer_standby$0$0({2}DF,SV:S),C,0,0 S:G$enter_standby$0$0({2}DF,SV:S),C,0,0 S:G$enter_deepsleep$0$0({2}DF,SV:S),C,0,0 S:G$enter_sleep$0$0({2}DF,SV:S),C,0,0 S:G$enter_sleep_cont$0$0({2}DF,SV:S),C,0,0 S:G$reset_cpu$0$0({2}DF,SV:S),C,0,0 S:G$turn_off_xosc$0$0({2}DF,SV:S),C,0,0 S:G$turn_off_lpxosc$0$0({2}DF,SV:S),C,0,0 S:G$enter_critical$0$0({2}DF,SC:U),C,0,0 S:G$exit_critical$0$0({2}DF,SV:S),C,0,0 S:G$reenter_critical$0$0({2}DF,SV:S),C,0,0 S:G$__enable_irq$0$0({2}DF,SV:S),C,0,0 S:G$__disable_irq$0$0({2}DF,SV:S),C,0,0 S:G$axradio_init$0$0({2}DF,SC:U),C,0,0 S:G$axradio_cansleep$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_mode$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_mode$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_channel$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_channel$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_pllrange$0$0({2}DF,SI:U),C,0,0 S:G$axradio_get_pllvcoi$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_local_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_get_local_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_set_default_remote_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_get_default_remote_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_transmit$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_freqoffset$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_freqoffset$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_freq_tohz$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_freq_fromhz$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_timeinterval_totimer0$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_time_totimer0$0$0({2}DF,SL:U),C,0,0 S:G$axradio_statuschange$0$0({2}DF,SV:S),C,0,0 S:G$axradio_agc_freeze$0$0({2}DF,SC:U),C,0,0 S:G$axradio_agc_thaw$0$0({2}DF,SC:U),C,0,0 S:G$axradio_calibrate_lposc$0$0({2}DF,SV:S),C,0,0 S:G$axradio_check_fourfsk_modulation$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_transmitter_pa_type$0$0({2}DF,SC:U),C,0,0 S:G$axradio_setup_pincfg1$0$0({2}DF,SV:S),C,0,0 S:G$axradio_setup_pincfg2$0$0({2}DF,SV:S),C,0,0 S:G$axradio_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$axradio_dbgpkt_enableIRQ$0$0({2}DF,SV:S),C,0,0 S:G$axradio_isr$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_irq$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_poll$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_txbufptr$0$0({2}DF,DX,SC:U),C,0,0 S:G$dbglink_txfreelinear$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_txidle$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_txfree$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_rxbufptr$0$0({2}DF,DX,SC:U),C,0,0 S:G$dbglink_rxcountlinear$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_rxcount$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_txbuffersize$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_rxbuffersize$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_rxpeek$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_txpoke$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_txpokehex$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_rxadvance$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_txadvance$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_init$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_wait_txdone$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_wait_txfree$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_wait_rxcount$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_rx$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_tx$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_writestr$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_writenum16$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_writehex16$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_writenum32$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_writehex32$0$0({2}DF,SC:U),C,0,0 S:G$dbglink_writehexu16$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_writehexu32$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_writeu16$0$0({2}DF,SV:S),C,0,0 S:G$dbglink_writeu32$0$0({2}DF,SV:S),C,0,0 S:G$crc_ccitt_byte$0$0({2}DF,SI:U),C,0,0 S:G$crc_ccitt_msb_byte$0$0({2}DF,SI:U),C,0,0 S:G$crc_ccitt$0$0({2}DF,SI:U),C,0,0 S:G$crc_ccitt_msb$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16_byte$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16_msb_byte$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16_msb$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16dnp_byte$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16dnp_msb_byte$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16dnp$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc16dnp_msb$0$0({2}DF,SI:U),C,0,0 S:G$crc_crc32_byte$0$0({2}DF,SL:U),C,0,0 S:G$crc_crc32_msb_byte$0$0({2}DF,SL:U),C,0,0 S:G$crc_crc32$0$0({2}DF,SL:U),C,0,0 S:G$crc_crc32_msb$0$0({2}DF,SL:U),C,0,0 S:G$crc_crc8ccitt_byte$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8ccitt_msb_byte$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8ccitt$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8ccitt_msb$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8onewire_byte$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8onewire_msb_byte$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8onewire$0$0({2}DF,SC:U),C,0,0 S:G$crc_crc8onewire_msb$0$0({2}DF,SC:U),C,0,0 S:G$crc8_ccitt_byte$0$0({2}DF,SC:U),C,0,0 S:G$crc8_ccitt$0$0({2}DF,SC:U),C,0,0 S:G$crc8_onewire_byte$0$0({2}DF,SC:U),C,0,0 S:G$crc8_onewire$0$0({2}DF,SC:U),C,0,0 S:G$pn9_advance$0$0({2}DF,SI:U),C,0,0 S:G$pn9_advance_bit$0$0({2}DF,SI:U),C,0,0 S:G$pn9_advance_bits$0$0({2}DF,SI:U),C,0,0 S:G$pn9_advance_byte$0$0({2}DF,SI:U),C,0,0 S:G$pn9_buffer$0$0({2}DF,SI:U),C,0,0 S:G$pn15_advance$0$0({2}DF,SI:U),C,0,0 S:G$pn15_output$0$0({2}DF,SC:U),C,0,0 S:G$flash_unlock$0$0({2}DF,SV:S),C,0,0 S:G$flash_lock$0$0({2}DF,SV:S),C,0,0 S:G$flash_wait$0$0({2}DF,SC:S),C,0,0 S:G$flash_pageerase$0$0({2}DF,SC:S),C,0,0 S:G$flash_write$0$0({2}DF,SC:S),C,0,0 S:G$flash_read$0$0({2}DF,SI:U),C,0,0 S:G$flash_apply_calibration$0$0({2}DF,SC:U),C,0,0 S:G$uart_timer0_baud$0$0({2}DF,SV:S),C,0,0 S:G$uart_timer1_baud$0$0({2}DF,SV:S),C,0,0 S:G$uart_timer2_baud$0$0({2}DF,SV:S),C,0,0 S:G$adc_measure_temperature$0$0({2}DF,SI:S),C,0,0 S:G$adc_calibrate_gain$0$0({2}DF,SV:S),C,0,0 S:G$adc_calibrate_temp$0$0({2}DF,SV:S),C,0,0 S:G$adc_calibrate$0$0({2}DF,SV:S),C,0,0 S:G$adc_uncalibrate$0$0({2}DF,SV:S),C,0,0 S:G$adc_singleended_offset_x01$0$0({2}DF,SI:U),C,0,0 S:G$adc_singleended_offset_x1$0$0({2}DF,SI:U),C,0,0 S:G$adc_singleended_offset_x10$0$0({2}DF,SI:U),C,0,0 S:G$bch3121_syndrome$0$0({2}DF,SI:U),C,0,0 S:G$bch3121_encode$0$0({2}DF,SL:U),C,0,0 S:G$bch3121_encode_parity$0$0({2}DF,SL:U),C,0,0 S:G$bch3121_decode$0$0({2}DF,SL:U),C,0,0 S:G$bch3121_decode_parity$0$0({2}DF,SL:U),C,0,0 S:G$radio_read16$0$0({2}DF,SI:U),C,0,0 S:G$radio_read24$0$0({2}DF,SL:U),C,0,0 S:G$radio_read32$0$0({2}DF,SL:U),C,0,0 S:G$radio_write16$0$0({2}DF,SV:S),C,0,0 S:G$radio_write24$0$0({2}DF,SV:S),C,0,0 S:G$radio_write32$0$0({2}DF,SV:S),C,0,0 S:G$ax5031_comminit$0$0({2}DF,SV:S),C,0,0 S:G$ax5031_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$ax5031_reset$0$0({2}DF,SC:U),C,0,0 S:G$ax5031_rclk_enable$0$0({2}DF,SV:S),C,0,0 S:G$ax5031_rclk_disable$0$0({2}DF,SV:S),C,0,0 S:G$ax5031_readfifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5031_writefifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5042_comminit$0$0({2}DF,SV:S),C,0,0 S:G$ax5042_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$ax5042_reset$0$0({2}DF,SC:U),C,0,0 S:G$ax5042_rclk_enable$0$0({2}DF,SV:S),C,0,0 S:G$ax5042_rclk_disable$0$0({2}DF,SV:S),C,0,0 S:G$ax5042_readfifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5042_writefifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_comminit$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_reset$0$0({2}DF,SC:U),C,0,0 S:G$ax5043_enter_deepsleep$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_wakeup_deepsleep$0$0({2}DF,SC:U),C,0,0 S:G$ax5043_rclk_enable$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_rclk_disable$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_rclk_wait_stable$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_readfifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_writefifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_set_pwramp_pin$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_get_pwramp_pin$0$0({2}DF,SC:U),C,0,0 S:G$ax5043_set_antsel_pin$0$0({2}DF,SV:S),C,0,0 S:G$ax5043_get_antsel_pin$0$0({2}DF,SC:U),C,0,0 S:G$ax5044_45_comminit$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_reset$0$0({2}DF,SC:U),C,0,0 S:G$ax5044_45_enter_deepsleep$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_wakeup_deepsleep$0$0({2}DF,SC:U),C,0,0 S:G$ax5044_45_rclk_enable$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_rclk_disable$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_rclk_wait_stable$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_readfifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_writefifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_set_pwramp_pin$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_get_pwramp_pin$0$0({2}DF,SC:U),C,0,0 S:G$ax5044_45_set_antsel_pin$0$0({2}DF,SV:S),C,0,0 S:G$ax5044_45_get_antsel_pin$0$0({2}DF,SC:U),C,0,0 S:G$ax5051_comminit$0$0({2}DF,SV:S),C,0,0 S:G$ax5051_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$ax5051_reset$0$0({2}DF,SC:U),C,0,0 S:G$ax5051_rclk_enable$0$0({2}DF,SV:S),C,0,0 S:G$ax5051_rclk_disable$0$0({2}DF,SV:S),C,0,0 S:G$ax5051_readfifo$0$0({2}DF,SV:S),C,0,0 S:G$ax5051_writefifo$0$0({2}DF,SV:S),C,0,0 S:G$uart0_irq$0$0({2}DF,SV:S),C,0,0 S:G$uart0_poll$0$0({2}DF,SC:U),C,0,0 S:G$uart0_txbufptr$0$0({2}DF,DX,SC:U),C,0,0 S:G$uart0_txfreelinear$0$0({2}DF,SC:U),C,0,0 S:G$uart0_txidle$0$0({2}DF,SC:U),C,0,0 S:G$uart0_txbusy$0$0({2}DF,SC:U),C,0,0 S:G$uart0_txfree$0$0({2}DF,SC:U),C,0,0 S:G$uart0_rxbufptr$0$0({2}DF,DX,SC:U),C,0,0 S:G$uart0_rxcountlinear$0$0({2}DF,SC:U),C,0,0 S:G$uart0_rxcount$0$0({2}DF,SC:U),C,0,0 S:G$uart0_txbuffersize$0$0({2}DF,SC:U),C,0,0 S:G$uart0_rxbuffersize$0$0({2}DF,SC:U),C,0,0 S:G$uart0_rxpeek$0$0({2}DF,SC:U),C,0,0 S:G$uart0_txpoke$0$0({2}DF,SV:S),C,0,0 S:G$uart0_txpokehex$0$0({2}DF,SV:S),C,0,0 S:G$uart0_rxadvance$0$0({2}DF,SV:S),C,0,0 S:G$uart0_txadvance$0$0({2}DF,SV:S),C,0,0 S:G$uart0_init$0$0({2}DF,SV:S),C,0,0 S:G$uart0_stop$0$0({2}DF,SV:S),C,0,0 S:G$uart0_wait_txdone$0$0({2}DF,SV:S),C,0,0 S:G$uart0_wait_txfree$0$0({2}DF,SV:S),C,0,0 S:G$uart0_wait_rxcount$0$0({2}DF,SV:S),C,0,0 S:G$uart0_rx$0$0({2}DF,SC:U),C,0,0 S:G$uart0_tx$0$0({2}DF,SV:S),C,0,0 S:G$uart0_writestr$0$0({2}DF,SV:S),C,0,0 S:G$uart0_writenum16$0$0({2}DF,SC:U),C,0,0 S:G$uart0_writehex16$0$0({2}DF,SC:U),C,0,0 S:G$uart0_writenum32$0$0({2}DF,SC:U),C,0,0 S:G$uart0_writehex32$0$0({2}DF,SC:U),C,0,0 S:G$uart0_writehexu16$0$0({2}DF,SV:S),C,0,0 S:G$uart0_writehexu32$0$0({2}DF,SV:S),C,0,0 S:G$uart0_writeu16$0$0({2}DF,SV:S),C,0,0 S:G$uart0_writeu32$0$0({2}DF,SV:S),C,0,0 S:G$uart1_irq$0$0({2}DF,SV:S),C,0,0 S:G$uart1_poll$0$0({2}DF,SC:U),C,0,0 S:G$uart1_txbufptr$0$0({2}DF,DX,SC:U),C,0,0 S:G$uart1_txfreelinear$0$0({2}DF,SC:U),C,0,0 S:G$uart1_txidle$0$0({2}DF,SC:U),C,0,0 S:G$uart1_txbusy$0$0({2}DF,SC:U),C,0,0 S:G$uart1_txfree$0$0({2}DF,SC:U),C,0,0 S:G$uart1_rxbufptr$0$0({2}DF,DX,SC:U),C,0,0 S:G$uart1_rxcountlinear$0$0({2}DF,SC:U),C,0,0 S:G$uart1_rxcount$0$0({2}DF,SC:U),C,0,0 S:G$uart1_txbuffersize$0$0({2}DF,SC:U),C,0,0 S:G$uart1_rxbuffersize$0$0({2}DF,SC:U),C,0,0 S:G$uart1_rxpeek$0$0({2}DF,SC:U),C,0,0 S:G$uart1_txpoke$0$0({2}DF,SV:S),C,0,0 S:G$uart1_txpokehex$0$0({2}DF,SV:S),C,0,0 S:G$uart1_rxadvance$0$0({2}DF,SV:S),C,0,0 S:G$uart1_txadvance$0$0({2}DF,SV:S),C,0,0 S:G$uart1_init$0$0({2}DF,SV:S),C,0,0 S:G$uart1_stop$0$0({2}DF,SV:S),C,0,0 S:G$uart1_wait_txdone$0$0({2}DF,SV:S),C,0,0 S:G$uart1_wait_txfree$0$0({2}DF,SV:S),C,0,0 S:G$uart1_wait_rxcount$0$0({2}DF,SV:S),C,0,0 S:G$uart1_rx$0$0({2}DF,SC:U),C,0,0 S:G$uart1_tx$0$0({2}DF,SV:S),C,0,0 S:G$uart1_writestr$0$0({2}DF,SV:S),C,0,0 S:G$uart1_writenum16$0$0({2}DF,SC:U),C,0,0 S:G$uart1_writehex16$0$0({2}DF,SC:U),C,0,0 S:G$uart1_writenum32$0$0({2}DF,SC:U),C,0,0 S:G$uart1_writehex32$0$0({2}DF,SC:U),C,0,0 S:G$uart1_writehexu16$0$0({2}DF,SV:S),C,0,0 S:G$uart1_writehexu32$0$0({2}DF,SV:S),C,0,0 S:G$uart1_writeu16$0$0({2}DF,SV:S),C,0,0 S:G$uart1_writeu32$0$0({2}DF,SV:S),C,0,0 S:G$com0_inituart0$0$0({2}DF,SV:S),C,0,0 S:G$com0_portinit$0$0({2}DF,SV:S),C,0,0 S:G$com0_init$0$0({2}DF,SV:S),C,0,0 S:G$com0_setpos$0$0({2}DF,SV:S),C,0,0 S:G$com0_writestr$0$0({2}DF,SV:S),C,0,0 S:G$com0_tx$0$0({2}DF,SV:S),C,0,0 S:G$com0_clear$0$0({2}DF,SV:S),C,0,0 S:G$axradio_framing_maclen$0$0({1}SC:U),D,0,0 S:G$axradio_framing_addrlen$0$0({1}SC:U),D,0,0 S:G$remoteaddr$0$0({5}STaxradio_address:S),D,0,0 S:G$localaddr$0$0({10}STaxradio_address_mask:S),D,0,0 S:G$demo_packet$0$0({6}DA6d,SC:U),D,0,0 S:G$framing_insert_counter$0$0({1}SC:U),D,0,0 S:G$framing_counter_pos$0$0({1}SC:U),D,0,0 S:G$lpxosc_settlingtime$0$0({2}SI:U),D,0,0 S:G$crc_ccitt_table$0$0({512}DA256d,SI:U),D,0,0 S:G$crc_ccitt_msbtable$0$0({512}DA256d,SI:U),D,0,0 S:G$crc_crc16_table$0$0({512}DA256d,SI:U),D,0,0 S:G$crc_crc16_msbtable$0$0({512}DA256d,SI:U),D,0,0 S:G$crc_crc16dnp_table$0$0({512}DA256d,SI:U),D,0,0 S:G$crc_crc16dnp_msbtable$0$0({512}DA256d,SI:U),D,0,0 S:G$crc_crc32_table$0$0({1024}DA256d,SL:U),D,0,0 S:G$crc_crc32_msbtable$0$0({1024}DA256d,SL:U),D,0,0 S:G$crc_crc8ccitt_table$0$0({256}DA256d,SC:U),D,0,0 S:G$crc_crc8ccitt_msbtable$0$0({256}DA256d,SC:U),D,0,0 S:G$crc_crc8onewire_table$0$0({256}DA256d,SC:U),D,0,0 S:G$crc_crc8onewire_msbtable$0$0({256}DA256d,SC:U),D,0,0 S:G$pn9_table$0$0({512}DA512d,SC:U),D,0,0 S:G$pn15_adv_table$0$0({512}DA256d,SI:U),D,0,0 S:G$pn15_out_table$0$0({256}DA256d,SC:U),D,0,0 S:G$bch3121_syndrometable$0$0({2048}DA1024d,SI:U),D,0,0
jhumphry/PRNG_Zoo
Ada
1,011
ads
-- -- PRNG Zoo -- Copyright (c) 2014 - 2015, James Humphry -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. with PRNG_Zoo; use PRNG_Zoo; use all type PRNG_Zoo.U32; use all type PRNG_Zoo.U64; with AUnit.Test_Suites; package PRNGTests_Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end PRNGTests_Suite;
OneWingedShark/Byron
Ada
135
adb
Pragma Ada_2012; Pragma Assertion_Policy( Check ); Package body Byron.Internals.Types is --PLACEHOLDER End Byron.Internals.Types;
persan/a-vulkan
Ada
1,518
ads
pragma Ada_2012; pragma Style_Checks (Off); with System; package Vulkan.Low_Level.vulkan_metal_h is VULKAN_METAL_H_u : constant := 1; -- vulkan_metal.h:2 VK_EXT_metal_surface : constant := 1; -- vulkan_metal.h:32 VK_EXT_METAL_SURFACE_SPEC_VERSION : constant := 1; -- vulkan_metal.h:40 VK_EXT_METAL_SURFACE_EXTENSION_NAME : aliased constant String := "VK_EXT_metal_surface" & ASCII.NUL; -- vulkan_metal.h:41 --** Copyright (c) 2015-2019 The Khronos Group Inc. --** --** 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. -- --** This header is generated from the Khronos Vulkan XML API Registry. --** -- subtype CAMetalLayer is System.Address; -- vulkan_metal.h:37 type VkMetalSurfaceCreateInfoEXT is record pNext : System.Address; -- vulkan_metal.h:45 pLayer : System.Address; -- vulkan_metal.h:47 end record with Convention => C_Pass_By_Copy; -- vulkan_metal.h:43 end Vulkan.Low_Level.vulkan_metal_h;
liy535042/coinapi-sdk
Ada
32,043
adb
-- OEML _ REST API -- This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> -- -- The version of the OpenAPI document: v1 -- Contact: [email protected] -- -- NOTE: This package is auto generated by OpenAPI-Generator 4.3.1. -- https://openapi-generator.tech -- Do not edit the class manually. package body .Models is use Swagger.Streams; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : TimeInForce_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrdSide_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id); Into.Write_Entity ("client_order_id", Value.Client_Order_Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id); Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderCancelSingleRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderCancelAllRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrdStatus_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrdType_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Severity_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Severity_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Severity_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Severity_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Severity_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Message_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("type", Value.P_Type); Serialize (Into, "severity", Value.Severity); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("message", Value.Message); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Message_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Message_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "type", Value.P_Type); Deserialize (Object, "severity", Value.Severity); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "message", Value.Message); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Message_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Message_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("asset_id_exchange", Value.Asset_Id_Exchange); Into.Write_Entity ("asset_id_coinapi", Value.Asset_Id_Coinapi); Into.Write_Entity ("balance", Value.Balance); Into.Write_Entity ("available", Value.Available); Into.Write_Entity ("locked", Value.Locked); Into.Write_Entity ("last_updated_by", Value.Last_Updated_By); Into.Write_Entity ("rate_usd", Value.Rate_Usd); Into.Write_Entity ("traded", Value.Traded); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "asset_id_exchange", Value.Asset_Id_Exchange); Swagger.Streams.Deserialize (Object, "asset_id_coinapi", Value.Asset_Id_Coinapi); Swagger.Streams.Deserialize (Object, "balance", Value.Balance); Swagger.Streams.Deserialize (Object, "available", Value.Available); Swagger.Streams.Deserialize (Object, "locked", Value.Locked); Swagger.Streams.Deserialize (Object, "last_updated_by", Value.Last_Updated_By); Swagger.Streams.Deserialize (Object, "rate_usd", Value.Rate_Usd); Swagger.Streams.Deserialize (Object, "traded", Value.Traded); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : BalanceData_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Serialize (Into, "data", Value.Data); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Deserialize (Object, "data", Value.Data); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Balance_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("client_order_id", Value.Client_Order_Id); Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange); Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi); Serialize (Into, "amount_order", Value.Amount_Order); Serialize (Into, "price", Value.Price); Serialize (Into, "side", Value.Side); Serialize (Into, "order_type", Value.Order_Type); Serialize (Into, "time_in_force", Value.Time_In_Force); Serialize (Into, "expire_time", Value.Expire_Time); Serialize (Into, "exec_inst", Value.Exec_Inst); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id); Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange); Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi); Deserialize (Object, "amount_order", Value.Amount_Order); Deserialize (Object, "price", Value.Price); Deserialize (Object, "side", Value.Side); Deserialize (Object, "order_type", Value.Order_Type); Deserialize (Object, "time_in_force", Value.Time_In_Force); Deserialize (Object, "expire_time", Value.Expire_Time); Swagger.Streams.Deserialize (Object, "exec_inst", Value.Exec_Inst); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderNewSingleRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("client_order_id", Value.Client_Order_Id); Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange); Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi); Serialize (Into, "amount_order", Value.Amount_Order); Serialize (Into, "price", Value.Price); Serialize (Into, "side", Value.Side); Serialize (Into, "order_type", Value.Order_Type); Serialize (Into, "time_in_force", Value.Time_In_Force); Serialize (Into, "expire_time", Value.Expire_Time); Serialize (Into, "exec_inst", Value.Exec_Inst); Into.Write_Entity ("client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id); Serialize (Into, "amount_open", Value.Amount_Open); Serialize (Into, "amount_filled", Value.Amount_Filled); Serialize (Into, "status", Value.Status); Serialize (Into, "time_order", Value.Time_Order); Into.Write_Entity ("error_message", Value.Error_Message); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id); Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange); Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi); Deserialize (Object, "amount_order", Value.Amount_Order); Deserialize (Object, "price", Value.Price); Deserialize (Object, "side", Value.Side); Deserialize (Object, "order_type", Value.Order_Type); Deserialize (Object, "time_in_force", Value.Time_In_Force); Deserialize (Object, "expire_time", Value.Expire_Time); Swagger.Streams.Deserialize (Object, "exec_inst", Value.Exec_Inst); Swagger.Streams.Deserialize (Object, "client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id); Deserialize (Object, "amount_open", Value.Amount_Open); Deserialize (Object, "amount_filled", Value.Amount_Filled); Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "time_order", Value.Time_Order); Swagger.Streams.Deserialize (Object, "error_message", Value.Error_Message); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderExecutionReport_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Serialize (Into, "data", Value.Data); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Deserialize (Object, "data", Value.Data); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Position_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("type", Value.P_Type); Into.Write_Entity ("title", Value.Title); Serialize (Into, "status", Value.Status); Into.Write_Entity ("traceId", Value.Trace_Id); Into.Write_Entity ("errors", Value.Errors); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "type", Value.P_Type); Swagger.Streams.Deserialize (Object, "title", Value.Title); Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "traceId", Value.Trace_Id); Swagger.Streams.Deserialize (Object, "errors", Value.Errors); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : ValidationError_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id); Serialize (Into, "amount_open", Value.Amount_Open); Serialize (Into, "amount_filled", Value.Amount_Filled); Serialize (Into, "status", Value.Status); Serialize (Into, "time_order", Value.Time_Order); Into.Write_Entity ("error_message", Value.Error_Message); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id); Deserialize (Object, "amount_open", Value.Amount_Open); Deserialize (Object, "amount_filled", Value.Amount_Filled); Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "time_order", Value.Time_Order); Swagger.Streams.Deserialize (Object, "error_message", Value.Error_Message); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderExecutionReportAllOf_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange); Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi); Serialize (Into, "avg_entry_price", Value.Avg_Entry_Price); Serialize (Into, "quantity", Value.Quantity); Serialize (Into, "side", Value.Side); Serialize (Into, "unrealized_pnl", Value.Unrealized_Pnl); Serialize (Into, "leverage", Value.Leverage); Into.Write_Entity ("cross_margin", Value.Cross_Margin); Serialize (Into, "liquidation_price", Value.Liquidation_Price); Serialize (Into, "raw_data", Value.Raw_Data); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange); Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi); Deserialize (Object, "avg_entry_price", Value.Avg_Entry_Price); Deserialize (Object, "quantity", Value.Quantity); Deserialize (Object, "side", Value.Side); Deserialize (Object, "unrealized_pnl", Value.Unrealized_Pnl); Deserialize (Object, "leverage", Value.Leverage); Swagger.Streams.Deserialize (Object, "cross_margin", Value.Cross_Margin); Deserialize (Object, "liquidation_price", Value.Liquidation_Price); Deserialize (Object, "raw_data", Value.Raw_Data); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : PositionData_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; end .Models;
tum-ei-rcs/StratoX
Ada
9,682
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_ll_fmc.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief Header file of FMC HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ package STM32.FMC is type FMC_SDRAM_Cmd_Target_Bank is (FMC_Bank2_SDRAM, FMC_Bank1_SDRAM, FMC_Banks_1_2_SDRAM) with Size => 2; for FMC_SDRAM_Cmd_Target_Bank use (FMC_Bank2_SDRAM => 2#01#, FMC_Bank1_SDRAM => 2#10#, FMC_Banks_1_2_SDRAM => 2#11#); subtype FMC_SDRAM_Bank_Type is FMC_SDRAM_Cmd_Target_Bank range FMC_Bank2_SDRAM .. FMC_Bank1_SDRAM; FMC_Bank1_NORSRAM1 : constant := 16#00000000#; FMC_Bank1_NORSRAM2 : constant := 16#00000002#; FMC_Bank1_NORSRAM3 : constant := 16#00000004#; FMC_Bank1_NORSRAM4 : constant := 16#00000006#; FMC_Bank2_NAND : constant := 16#00000010#; FMC_Bank3_NAND : constant := 16#00000100#; FMC_Bank4_PCCARD : constant := 16#00001000#; type FMC_SDRAM_Row_Address_Bits is (FMC_RowBits_Number_11b, FMC_RowBits_Number_12b, FMC_RowBits_Number_13b) with Size => 2; type FMC_SDRAM_Column_Address_Bits is (FMC_ColumnBits_Number_8b, FMC_ColumnBits_Number_9b, FMC_ColumnBits_Number_10b, FMC_ColumnBits_Number_11b) with Size => 2; type FMC_SDRAM_Memory_Bus_Width is (FMC_SDMemory_Width_8b, FMC_SDMemory_Width_16b, FMC_SDMemory_Width_32b) with Size => 2; type FMC_SDRAM_Internal_Banks_Number is (FMC_InternalBank_Number_2, FMC_InternalBank_Number_4) with Size => 1; type FMC_SDRAM_CAS_Latency is (FMC_CAS_Latency_1, FMC_CAS_Latency_2, FMC_CAS_Latency_3) with Size => 2; for FMC_SDRAM_CAS_Latency use (FMC_CAS_Latency_1 => 1, FMC_CAS_Latency_2 => 2, FMC_CAS_Latency_3 => 3); type FMC_SDRAM_Write_Protection is (FMC_Write_Protection_Disable, FMC_Write_Protection_Enable) with Size => 1; type FMC_SDRAM_Clock_Configuration is (FMC_SDClock_Disable, FMC_SDClock_Period_2, FMC_SDClock_Period_3) with Size => 2; for FMC_SDRAM_Clock_Configuration use (FMC_SDClock_Disable => 0, FMC_SDClock_Period_2 => 2, FMC_SDClock_Period_3 => 3); type FMC_SDRAM_Burst_Read is (FMC_Read_Burst_Disable, FMC_Read_Burst_Single) with Size => 1; type FMC_SDRAM_Read_Pipe_Delay is (FMC_ReadPipe_Delay_0, FMC_ReadPipe_Delay_1, FMC_ReadPipe_Delay_2) with Size => 2; type FMC_SDRAM_Cmd_Mode is (FMC_Command_Mode_Normal, FMC_Command_Mode_CLK_Enabled, FMC_Command_Mode_PALL, FMC_Command_Mode_AutoRefresh, FMC_Command_Mode_LoadMode, FMC_Command_Mode_Selfrefresh, FMC_Command_Mode_PowerDown) with Size => 3; type FMC_SDRAM_Status_Mode is (Normal_Mode, Self_Refresh_Mode, Power_Down_Mode) with Size => 2; FMC_IT_RisingEdge : constant := 16#0000_0008#; FMC_IT_Level : constant := 16#0000_0010#; FMC_IT_FallingEdge : constant := 16#0000_0020#; FMC_IT_Refresh : constant := 16#0000_4000#; FMC_FLAG_RisingEdge : constant := 16#0000_0001#; FMC_FLAG_Level : constant := 16#0000_0002#; FMC_FLAG_FallingEdge : constant := 16#0000_0004#; FMC_FLAG_FEMPT : constant := 16#0000_0040#; FMC_FLAG_Refresh : constant := 16#0000_0001#; FMC_FLAG_Busy : constant := 16#0000_0020#; type FMC_SDRAM_Timing is range 1 .. 16; type FMC_SDRAM_TimingInit_Config is record LoadToActiveDelay : FMC_SDRAM_Timing; ExitSelfRefreshDelay : FMC_SDRAM_Timing; SelfRefreshTime : FMC_SDRAM_Timing; RowCycleDelay : FMC_SDRAM_Timing; WriteRecoveryTime : FMC_SDRAM_Timing; RPDelay : FMC_SDRAM_Timing; RCDDelay : FMC_SDRAM_Timing; end record; type FMC_SDRAM_Init_Config is record Bank : FMC_SDRAM_Bank_Type; ColumnBitsNumber : FMC_SDRAM_Column_Address_Bits; RowBitsNumber : FMC_SDRAM_Row_Address_Bits; SDMemoryDataWidth : FMC_SDRAM_Memory_Bus_Width; InternalBankNumber : FMC_SDRAM_Internal_Banks_Number; CASLatency : FMC_SDRAM_CAS_Latency; WriteProtection : FMC_SDRAM_Write_Protection; SDClockPeriod : FMC_SDRAM_Clock_Configuration; ReadBurst : FMC_SDRAM_Burst_Read; ReadPipeDelay : FMC_SDRAM_Read_Pipe_Delay; Timing_Conf : FMC_SDRAM_TimingInit_Config; end record; procedure FMC_SDRAM_Init (SDRAM_Conf : FMC_SDRAM_Init_Config); -------------------------- -- SDRAM Mode Register -- -------------------------- type SDRAM_Mode_Burst_Length is (SDRAM_Mode_Burst_Length_1, SDRAM_Mode_Burst_Length_2, SDRAM_Mode_Burst_Length_4, SDRAM_Mode_Burst_Length_8) with Size => 3; for SDRAM_Mode_Burst_Length use (SDRAM_Mode_Burst_Length_1 => 16#0#, SDRAM_Mode_Burst_Length_2 => 16#1#, SDRAM_Mode_Burst_Length_4 => 16#2#, SDRAM_Mode_Burst_Length_8 => 16#4#); type SDRAM_Mode_Burst_Type is (SDRAM_Mode_Burst_Sequential, SDRAM_Mode_Burst_Interleaved) with Size => 1; type SDRAM_Mode_CAS_Latency is (SDRAM_Mode_CAS_Latency_2, SDRAM_Mode_CAS_Latency_3) with Size => 2; for SDRAM_Mode_CAS_Latency use (SDRAM_Mode_CAS_Latency_2 => 2, SDRAM_Mode_CAS_Latency_3 => 3); type SDRAM_Mode_Operating_Mode is (SDRAM_Mode_Writeburst_Mode_Programmed, SDRAM_Mode_Writeburst_Mode_Single); type SDRAM_Mode_Register is record Burst_Length : SDRAM_Mode_Burst_Length; Burst_Type : SDRAM_Mode_Burst_Type; CAS_Latency : SDRAM_Mode_CAS_Latency; Operating_Mode : SDRAM_Mode_Operating_Mode; end record with Size => 13; for SDRAM_Mode_Register use record Burst_Length at 0 range 0 .. 2; Burst_Type at 0 range 3 .. 3; CAS_Latency at 0 range 4 .. 5; Operating_Mode at 0 range 9 .. 9; end record; type SDRAM_Command (Mode : FMC_SDRAM_Cmd_Mode) is record Target : FMC_SDRAM_Cmd_Target_Bank; case Mode is when FMC_Command_Mode_AutoRefresh => Auto_Refresh_Number : FMC_SDRAM_Timing; when FMC_Command_Mode_LoadMode => Mode_Register : SDRAM_Mode_Register; when others => null; end case; end record; procedure FMC_SDRAM_Cmd (Cmd : SDRAM_Command); function FMC_SDRAM_Busy return Boolean with Inline; function FMC_SDRAM_Get_Status (Bank : FMC_SDRAM_Bank_Type) return FMC_SDRAM_Status_Mode; procedure FMC_Set_Refresh_Count (Cnt : Word) with Pre => Cnt < 2 ** 13; end STM32.FMC;
python36/0xfa
Ada
21,060
adb
with ada.text_io; with ada.command_line; with ada.strings.fixed; with gnat.os_lib; with ada.containers.vectors; with numbers; use numbers; with strings; use strings; procedure d0xfa is use type ada.text_io.count; use type byte; use type word; PROGRAMM_NAME : constant string := "d0xfa"; file : ada.text_io.file_type; procedure close_app is begin if ada.text_io.is_open(file) then ada.text_io.close(file); end if; end close_app; procedure error (s : string) is begin close_app; print(s); gnat.os_lib.os_exit(1); end error; subtype label_t is string(1..6); null_label : constant label_t := (others => ' '); label_counter : natural := 1; interrupt_lines_counter : natural := 0; must_be_next_addr : word := 0; type commands is ( f_rrc, f_swpb, f_rra, f_sxt, f_push, f_call, f_reti, f_jne, f_jeq, f_jnc, f_jc, f_jn, f_jge, f_jl, f_jmp, f_mov, f_add, f_addc, f_subc, f_sub, f_cmp, f_dadd, f_bit, f_bic, f_bis, f_xor, f_and, f_jnz, f_jz, f_jlo, f_jhs); subtype single_commands is commands range f_rrc..f_reti; subtype jump_commands is commands range f_jne..f_jmp; subtype two_commands is commands range f_mov..f_and; type command_types is (t_jump, t_single, t_two, t_interrupt); type addressing_modes is ( m_constant, m_immediate, m_indexed, m_symbolic, m_absolute, m_indirect_register, m_indirect_autoincrement, m_register); type address_t is record mode : addressing_modes := m_constant; address : word := 0; register : word := 0; ext_word : boolean := false; label : label_t := null_label; end record; type command_t is record command_raw : word; command : commands; command_type : command_types; address : word; first_op, second_op : word := 0; source, destination : address_t; label : label_t := null_label; num_operands : byte := 0; bw : boolean := true; end record; tmp_command : command_t; package programm_t is new ada.containers.vectors( element_type => command_t, index_type => natural); programm : programm_t.vector; programm_cursor : programm_t.cursor; procedure parse_source (cmd : in out command_t) is as : word := sr(cmd.command_raw, 4) and 3; src : word; begin if cmd.command_type = t_single then src := cmd.command_raw and 15; else src := sr(cmd.command_raw, 8) and 15; end if; cmd.source.register := src; cmd.source.address := src; if as = 0 then if src = 3 then cmd.source.mode := m_constant; cmd.source.address := 0; else cmd.source.mode := m_register; end if; elsif as = 1 then if src = 0 then cmd.source.mode := m_symbolic; elsif src = 2 then cmd.source.mode := m_absolute; elsif src = 3 then cmd.source.mode := m_constant; cmd.source.address := 1; else cmd.source.mode := m_indexed; end if; elsif as = 2 then if src = 2 then cmd.source.mode := m_constant; cmd.source.address := 4; elsif src = 3 then cmd.source.mode := m_constant; cmd.source.address := 2; else cmd.source.mode := m_indirect_register; end if; elsif as = 3 then if src = 0 then cmd.source.mode := m_immediate; elsif src = 2 then cmd.source.mode := m_constant; cmd.source.address := 8; elsif src = 3 then cmd.source.mode := m_constant; cmd.source.address := 16#ffff#; else cmd.source.mode := m_indirect_autoincrement; end if; end if; if cmd.source.mode in m_immediate..m_absolute then inc(cmd.num_operands); cmd.source.ext_word := true; end if; end parse_source; procedure parse_destination (cmd : in out command_t) is ad : word := sr(cmd.command_raw, 7) and 1; dst : word := cmd.command_raw and 15; begin cmd.destination.register := dst; if ad = 0 then cmd.destination.mode := m_register; cmd.destination.address := dst; else inc(cmd.num_operands); cmd.destination.ext_word := true; if dst = 0 then cmd.destination.mode := m_symbolic; elsif dst = 2 then cmd.destination.mode := m_absolute; else cmd.destination.mode := m_indexed; end if; end if; end parse_destination; procedure parse_single (cmd : in out command_t) is begin cmd.command := commands'val( (sr(cmd.command_raw, 7) and 7) + word(single_commands'pos(single_commands'first))); parse_source(cmd); end parse_single; procedure parse_two (cmd : in out command_t) is begin cmd.command := commands'val( (sr(cmd.command_raw, 12) + word(two_commands'pos(two_commands'first)) - 4)); parse_source(cmd); parse_destination(cmd); end parse_two; procedure parse_jump (cmd : in out command_t) is begin cmd.command := commands'val( ((sr(cmd.command_raw, 10) and 7) + word(jump_commands'pos(jump_commands'first)))); end parse_jump; procedure put_operand (op : address_t; op_m : addressing_modes) is begin if op_m = m_register then put('r' & ltrim(op.address'img)); elsif op_m = m_indexed then put(ltrim(word_to_integer(op.address)'img) & "(r" & ltrim(op.register'img) & ')'); elsif op_m = m_constant then put('#' & ltrim(word_to_integer(op.address)'img)); elsif op_m = m_symbolic then if op.label /= null_label then put(rtrim(op.label)); else put("$"); if word_to_integer(op.address) >= 0 then put("+"); end if; put(ltrim(word_to_integer(op.address)'img)); end if; elsif op_m = m_absolute then if op.label /= null_label then put('&' & rtrim(op.label)); else put("&" & hex(op.address)); end if; elsif op_m = m_indirect_register then put("@r" & ltrim(op.register'img)); elsif op_m = m_indirect_autoincrement then put("@r" & ltrim(op.register'img) & "+"); elsif op_m = m_immediate then put("#" & ltrim(word_to_integer(op.address)'img)); end if; end put_operand; function new_command (w, addr : word) return command_t is cmd : command_t; begin cmd.command_raw := w; cmd.address := addr; if addr >= 16#ffc0# then cmd.command_type := t_interrupt; return cmd; end if; cmd.bw := (w and 64) /= 0; case sr(cmd.command_raw, 13) is when 0 => cmd.command_type := t_single; parse_single(cmd); when 1 => cmd.command_type := t_jump; cmd.bw := false; parse_jump(cmd); when others => cmd.command_type := t_two; parse_two(cmd); end case; return cmd; end new_command; procedure operand_to_command (cmd : in out command_t; w : word; tl : byte) is begin if cmd.num_operands = 2 then if tl = 2 then cmd.source.address := w; else cmd.destination.address := w; end if; elsif cmd.source.ext_word then cmd.source.address := w; else cmd.destination.address := w; end if; end operand_to_command; function get_addr_by_offset (cmd : command_t) return word is begin return ((cmd.command_raw and 1023) + 64512 * ( sr(cmd.command_raw, 9) and 1) + 1) * 2 + cmd.address; end get_addr_by_offset; procedure create_label (cmd : command_t; addr : in out address_t) is tmp_addr : word := addr.address; tmp_cursor : programm_t.cursor; tmp_command : command_t; begin if cmd.command_type = t_jump then tmp_addr := get_addr_by_offset(cmd); elsif addr.mode = m_symbolic then tmp_addr := tmp_addr + 2 + cmd.address; if addr = cmd.destination and cmd.source.ext_word then tmp_addr := tmp_addr + 2; end if; elsif addr.mode /= m_absolute then error("programm error"); end if; tmp_cursor := programm.first; while (programm_t.has_element(tmp_cursor)) loop tmp_command := programm_t.element(tmp_cursor); if tmp_command.address = tmp_addr then if tmp_command.label = null_label then tmp_command.label := ada.strings.fixed.head( 'l' & ltrim(label_counter'img), null_label'length); inc(label_counter); programm_t.replace_element(programm, tmp_cursor, tmp_command); end if; addr.label := tmp_command.label; exit; end if; tmp_cursor := programm_t.next(tmp_cursor); end loop; end create_label; procedure end_command (cmd : in out command_t) is tmp_addr : address_t; begin if cmd.command_type = t_jump then create_label(cmd, cmd.destination); else if cmd.source.mode in m_symbolic|m_absolute then create_label(cmd, cmd.source); end if; if cmd.destination.mode in m_symbolic|m_absolute then create_label(cmd, cmd.destination); end if; end if; programm.append(cmd); end end_command; procedure disasm (cmd : in out command_t) is tmp_cur : programm_t.cursor; col : ada.text_io.count := 1; procedure shift_col (v : ada.text_io.count) is begin col := col + v; ada.text_io.set_col(col); end shift_col; procedure set_col (v : ada.text_io.count) is begin col := v; ada.text_io.set_col(col); end set_col; procedure put_hex_raw (w : word) is strword : string(1..4) := image(w, 16); begin put(strword(3..4) & ' ' & strword(1..2)); end put_hex_raw; function repr_bw return string is begin if cmd.bw then return ".b"; end if; return ""; end repr_bw; function repr_commands (command : commands) return string is begin return lowercase(command'img(3..command'img'length)) & repr_bw; end repr_commands; procedure put_alternative (scmd : string) is begin put("; " & scmd); shift_col(9); end put_alternative; procedure put_alternative_with_dst (scmd : string) is begin put_alternative(scmd); put_operand(cmd.destination, cmd.destination.mode); end put_alternative_with_dst; procedure put_jump_offset (jcmd : command_t) is begin if jcmd.destination.label = null_label then put("$"); if (sr(cmd.command_raw, 9) and 1) = 0 then put("+"); end if; put(ltrim(word_to_integer( ((jcmd.command_raw and 1023) + 64512 * ( sr(cmd.command_raw, 9) and 1) + 1) * 2)'img)); else put(jcmd.destination.label); end if; end put_jump_offset; procedure put_comment (sc : string) is begin put("; " & sc); end put_comment; procedure put_label (s : string) is begin put(ada.strings.fixed.head( rtrim(s) & ':', null_label'length)); end put_label; begin if cmd.source.mode in m_symbolic|m_absolute then create_label(cmd, cmd.source); end if; if cmd.destination.mode in m_symbolic|m_absolute then create_label(cmd, cmd.destination); end if; if cmd.command_type = t_jump then create_label(cmd, cmd.destination); end if; if cmd.label /= null_label then put_label(cmd.label); end if; shift_col(7); put(repr_commands(cmd.command)); shift_col(7); if cmd.command_type = t_jump then put_jump_offset(cmd); if cmd.command in f_jne..f_jc then shift_col(24); put_alternative(repr_commands( commands'val(commands'pos(cmd.command) + ( commands'pos(f_jnz) - commands'pos(f_jne))))); put_jump_offset(cmd); end if; elsif cmd.command /= f_reti then put_operand(cmd.source, cmd.source.mode); end if; if cmd.command_type = t_two then put(","); shift_col(12); put_operand(cmd.destination, cmd.destination.mode); shift_col(12); if cmd.command = f_addc then if cmd.source.mode = cmd.destination.mode and cmd.source.address = cmd.destination.address then put_alternative_with_dst("rlc" & repr_bw); elsif cmd.source.mode = m_constant and cmd.source.address = 0 then put_alternative_with_dst("adc" & repr_bw); end if; elsif cmd.command = f_add then if cmd.source.mode = cmd.destination.mode and (cmd.source.address = cmd.destination.address or ( cmd.source.mode = m_symbolic and cmd.source.address - 2 = cmd.destination.address)) then put_alternative_with_dst("rla" & repr_bw); elsif cmd.source.mode = m_constant then if cmd.source.address = 1 then put_alternative_with_dst("inc" & repr_bw); elsif cmd.source.address = 2 then put_alternative_with_dst("incd" & repr_bw); end if; end if; elsif cmd.command = f_xor and cmd.source.mode = m_constant and cmd.source.address = 16#ffff# then put_alternative_with_dst("inv" & repr_bw); elsif cmd.command = f_bic and cmd.destination.mode = m_register and cmd.destination.register = 2 and cmd.source.mode = m_constant then if cmd.source.address = 1 then put_alternative("clrc"); elsif cmd.source.address = 2 then put_alternative("clrz"); elsif cmd.source.address = 4 then put_alternative("clrn"); elsif cmd.source.address = 8 then put_alternative("dint"); end if; elsif cmd.command = f_bis and cmd.source.mode = m_constant and cmd.destination.mode = m_register and cmd.destination.register = 2 then if cmd.source.address = 1 then put_alternative("setc"); elsif cmd.source.address = 2 then put_alternative("setz"); elsif cmd.source.address = 4 then put_alternative("setn"); elsif cmd.source.address = 8 then put_alternative("eint"); end if; elsif cmd.command = f_cmp and cmd.source.mode = m_constant and cmd.source.address = 0 then put_alternative_with_dst("tst" & repr_bw); elsif cmd.command = f_dadd and cmd.source.mode = m_constant and cmd.source.address = 0 then put_alternative_with_dst("dadc" & repr_bw); elsif cmd.command = f_subc and cmd.source.mode = m_constant and cmd.source.address = 0 then put_alternative_with_dst("sbc" & repr_bw); elsif cmd.command = f_sub and cmd.source.mode = m_constant then if cmd.source.address = 1 then put_alternative_with_dst("dec" & repr_bw); elsif cmd.source.address = 2 then put_alternative_with_dst("decd" & repr_bw); end if; elsif cmd.command = f_mov then if cmd.source.mode = m_indirect_autoincrement and cmd.source.address = 1 then if cmd.destination.mode = m_register and cmd.destination.address = 0 then put_alternative("ret"); else put_alternative_with_dst("pop" & repr_bw); end if; elsif cmd.destination.mode = m_register and cmd.destination.address = 0 then put_alternative("br"); put_operand(cmd.source, cmd.source.mode); elsif cmd.source.mode = m_constant and cmd.source.address = 0 then if cmd.destination.mode = m_register and cmd.destination.register = 3 then put_alternative("nop"); else put_alternative_with_dst("clr" & repr_bw); end if; end if; end if; end if; set_col(59); if cmd.command_type = t_jump then put_comment(hex(get_addr_by_offset(cmd))); else if cmd.source.mode = m_immediate then put_comment('#' & hex(cmd.source.address)); elsif cmd.source.mode = m_constant and cmd.source.address = 16#ffff# then put_comment('#' & hex(cmd.source.address)); elsif cmd.source.mode = m_symbolic then put_comment(hex(cmd.address + 2 + cmd.source.address)); elsif cmd.source.mode = m_absolute then put_comment('&' & hex(cmd.source.address)); end if; if cmd.destination.mode = m_symbolic then put_comment(hex(cmd.address + word(cmd.num_operands) * 2 + cmd.destination.address)); elsif cmd.destination.mode = m_absolute then put_comment('&' & hex(cmd.destination.address)); end if; end if; set_col(78); put("; "); put(image(cmd.address, 16)); shift_col(9); put_hex_raw(cmd.command_raw); if cmd.source.ext_word then put(" "); put_hex_raw(cmd.source.address); end if; if cmd.destination.ext_word then put(" "); put_hex_raw(cmd.destination.address); end if; ada.text_io.new_line; end disasm; i : byte; cmd : command_t; l, op_l : byte := 0; is_ssar : boolean := false; is_end : boolean := true; is_first : boolean := true; checksum : byte; first_char : character; b : byte; wt : word; addr, next_addr, op_addr : word := 0; begin print(";;; 0xfa [http://0xfa.space] ;;;"); print("; d0xfa v0.1.0 - msp430 disassembler (ihex format [https://wikipedia.org/wiki/Intel_HEX])"); print(""); if ada.command_line.argument_count = 0 then error("no input files"); end if; ada.text_io.open(file, ada.text_io.in_file, ada.command_line.argument(1)); loop_read: while not ada.text_io.end_of_file(file) loop if l /= 0 or not is_end then error("bad format"); end if; i := 0; checksum := 0; is_end := false; for c of remove_ret_car(ada.text_io.get_line(file)) loop if not (c in '0'..'9' or c in 'A'..'F' or (i = 0 and c = ':')) then error("bad format"); end if; if (i and 1) /= 0 then first_char := c; elsif i /= 0 then b := byte'value("16#" & first_char & c & '#'); checksum := checksum + b; if i = 2 then l := b; elsif i = 4 then addr := word(b); elsif i = 6 then addr := sl(addr, 8) + word(b); if next_addr > 0 and next_addr - word(op_l) * 2 /= addr then if op_l /= 0 then null; -- error("seq addrs"); end if; end if; if op_l = 0 then next_addr := addr; op_addr := next_addr; end if; elsif i = 8 then if b = 1 then if l /= 0 or addr /= 0 then error("bad end record"); end if; exit loop_read; elsif b = 3 then if l /= 4 or addr /= 0 then error("bad SSAR len"); end if; is_ssar := true; end if; elsif i > 9 and l > 0 then if is_first then wt := word(b); is_first := false; else wt := sl(word(b), 8) or wt; is_first := true; end if; if is_first then if op_l = 0 then if is_ssar then op_l := 1; else cmd := new_command(wt, op_addr); op_l := cmd.num_operands; next_addr := op_addr + 2 + word(op_l) * 2; end if; else if is_ssar then ada.text_io.set_col(1); print("; SSAR: " & hex(sl(wt, 8) + sr(wt, 8))); else operand_to_command(cmd, wt, op_l); end if; dec(op_l); end if; if op_l = 0 then if not is_ssar then end_command(cmd); op_addr := next_addr; end if; end if; end if; dec(l); elsif i > 9 and l = 0 then is_end := true; if checksum /= 0 then error("checksum error"); end if; end if; end if; inc(i); end loop; end loop loop_read; print(";label cmd 1st_operand 2nd_operand emulated comments addr raw"); programm_cursor := programm.first; while (programm_t.has_element(programm_cursor)) loop tmp_command := programm_t.element(programm_cursor); if tmp_command.command_type = t_interrupt then if interrupt_lines_counter = 0 then print("; interrupt vectors:"); put(';'); interrupt_lines_counter := 1; end if; if tmp_command.address >= 16#fff0# and interrupt_lines_counter = 1 then interrupt_lines_counter := 2; ada.text_io.new_line; put(';'); end if; ada.text_io.set_col((ada.text_io.count(tmp_command.address - 16#ffe0#) mod 16) * 6 + 3); put(image(tmp_command.address, 16) & ": " & image(tmp_command.command_raw, 16) & " "); else if must_be_next_addr /= 0 and must_be_next_addr /= tmp_command.address then print("; ..."); end if; disasm(tmp_command); must_be_next_addr := tmp_command.address + 2 * word(tmp_command.num_operands) + 2; end if; programm_cursor := programm_t.next(programm_cursor); end loop; close_app; end d0xfa;
charlie5/lace
Ada
3,585
adb
with lace.Text.all_Tokens, ada.Strings.fixed; package body lace.Text.utility is function contains (Self : in Text.item; Pattern : in String) return Boolean is use ada.Strings.fixed; begin return Index (+Self, Pattern) /= 0; end contains; function replace (Self : in Text.item; Pattern : in String; By : in String) return Text.item is Tail_matches_Pattern : Boolean := False; begin -- Corner case: Pattern exactly matches Self. -- if Self.Data (1 .. Self.Length) = Pattern then declare Result : Text.item (Capacity => Natural'Max (By'Length, Self.Capacity)); begin Result.Length := By'Length; Result.Data (1 .. By'Length) := By; return Result; end; end if; -- Corner case: Pattern exactly matches tail of Self. -- if Self.Data (Self.Length - Pattern'Length + 1 .. Self.Length) = Pattern then Tail_matches_Pattern := True; end if; -- General case. -- declare use lace.Text.all_Tokens; the_Tokens : constant Text.items_1k := Tokens (Self, Delimiter => Pattern); Size : Natural := 0; begin for Each of the_Tokens loop Size := Size + Each.Length; end loop; Size := Size + (the_Tokens'Length - 1) * By'Length; if Tail_matches_Pattern then Size := Size + By'Length; end if; declare First : Positive := 1; Last : Natural; Result : Text.item (Capacity => Natural'Max (Size, Self.Capacity)); begin for Each of the_Tokens loop Last := First + Each.Length - 1; Result.Data (First .. Last) := Each.Data (1 .. Each.Length); exit when Last = Size; First := Last + 1; Last := First + By'Length - 1; Result.Data (First .. Last) := By; First := Last + 1; end loop; Result.Length := Size; return Result; end; end; end replace; procedure replace (Self : in out Item; Pattern : in String; By : in String) is Result : Item (Self.Capacity); Cursor : Positive := 1; First : Natural := 1; Last : Natural; begin loop Last := First + Pattern'Length - 1; if Last > Self.Length then Last := Self.Length; end if; if Self.Data (First .. Last) = Pattern then Result.Data (Cursor .. Cursor + By'Length - 1) := By; Cursor := Cursor + By'Length; First := Last + 1; else Result.Data (Cursor) := Self.Data (First); Cursor := Cursor + 1; First := First + 1; end if; exit when First > Self.Length; end loop; Self.Length := Cursor - 1; Self.Data (1 .. Self.Length) := Result.Data (1 .. Self.Length); exception when constraint_Error => raise Text.Error with "'replace' failed ~ insufficient capacity"; end replace; end lace.Text.utility;
reznikmm/matreshka
Ada
4,829
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Style_Default_Page_Layout_Elements; package Matreshka.ODF_Style.Default_Page_Layout_Elements is type Style_Default_Page_Layout_Element_Node is new Matreshka.ODF_Style.Abstract_Style_Element_Node and ODF.DOM.Style_Default_Page_Layout_Elements.ODF_Style_Default_Page_Layout with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Style_Default_Page_Layout_Element_Node; overriding function Get_Local_Name (Self : not null access constant Style_Default_Page_Layout_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Style_Default_Page_Layout_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Style_Default_Page_Layout_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Style_Default_Page_Layout_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Style.Default_Page_Layout_Elements;
GLADORG/glad-cli
Ada
703
ads
with AAA.Strings; with CLIC.Subcommand; with CLIC.TTY; package Commands.Topics.Issues is package TT renames CLIC.TTY; type Topic is new CLIC.Subcommand.Help_Topic with null record; overriding function Name (This : Topic) return CLIC.Subcommand.Identifier is ("issues"); overriding function Title (This : Topic) return String is ("Reporting bugs and feature requests and other issues."); overriding function Content (This : Topic) return AAA.Strings.Vector is (AAA.Strings.Empty_Vector.Append ("Please create issues on the Glad-cli project's GitHub page: ") .Append (TT.Url ("https://github.com/GLADORG/glad-cli/issues"))); end Commands.Topics.Issues;
charlie5/lace
Ada
5,651
adb
with openGL.Primitive.indexed, openGL.Geometry.textured, openGL.io, ada.unchecked_Deallocation; package body openGL.Model.billboard.textured is --------- --- Forge -- package body Forge is function new_Billboard (Size : in Size_t := default_Size; Plane : in billboard.Plane; Texture : in asset_Name; Lucid : in Boolean := False) return View is Self : constant View := new Item (Lucid); begin Self.Plane := Plane; Self.Texture_Name := Texture; Self.define (Size); return Self; end new_Billboard; end Forge; -------------- --- Attributes -- overriding function to_GL_Geometries (Self : access Item; Textures : access openGL.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.textured, openGL.Texture; the_Indices : aliased constant Indices := [1, 2, 3, 4]; the_Sites : constant billboard.Sites := vertex_Sites (Self.Plane, Self.Width, Self.Height); function new_Face (Vertices : in Geometry.textured.Vertex_array) return Geometry.textured.view is use Primitive; the_Geometry : constant Geometry.textured.view := Geometry.textured.new_Geometry; the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan, the_Indices).all'Access; begin the_Geometry.Vertices_are (Vertices); the_Geometry.add (the_Primitive); the_Geometry.is_Transparent; return the_Geometry; end new_Face; the_Face : Geometry.textured.view; begin declare the_Vertices : constant Geometry.textured.Vertex_array := [1 => (site => the_Sites (1), coords => Self.texture_Coords (1)), 2 => (site => the_Sites (2), coords => Self.texture_Coords (2)), 3 => (site => the_Sites (3), coords => Self.texture_Coords (3)), 4 => (site => the_Sites (4), coords => Self.texture_Coords (4))]; begin the_Face := new_Face (Vertices => the_Vertices); if Self.texture_Name /= null_Asset then Self.Texture := IO.to_Texture (Self.texture_Name); end if; if Self.Lucid then if Self.lucid_Image /= null then if Self.Texture /= null_Object then set_Image (Self.Texture, Self.lucid_Image.all); else Self.Texture := openGL.Texture.Forge.to_Texture (Self.lucid_Image.all); end if; end if; else if Self.Image /= null then if Self.Texture /= null_Object then Self.Texture.set_Image (Self.Image.all); else Self.Texture := openGL.Texture.Forge.to_Texture (Self.Image.all); end if; end if; end if; if Self.Texture /= null_Object then the_Face.Texture_is (Self.Texture); end if; end; return [1 => the_Face.all'Access]; end to_GL_Geometries; procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object) is begin Self.Texture := Now; end Texture_is; function Texture (Self : in Item) return openGL.Texture.Object is begin return Self.Texture; end Texture; procedure Texture_Coords_are (Self : in out Item; Now : in Coordinates) is begin Self.texture_Coords := Now; Self.needs_Rebuild := True; end Texture_Coords_are; procedure Size_is (Self : in out Item; Now : in Size_t) is begin Self.Size := Now; Self.needs_Rebuild := True; end Size_is; procedure Image_is (Self : in out Item; Now : in Image) is procedure deallocate is new ada.unchecked_Deallocation (Image, Image_view); begin if Self.Image = null then Self.Image := new Image' (Now); elsif Self.Image'Length (1) = Now'Length (1) and Self.Image'Length (2) = Now'Length (2) then Self.Image.all := Now; else deallocate (Self.Image); Self.Image := new Image' (Now); end if; Self.needs_Rebuild := True; end Image_is; procedure Image_is (Self : in out Item; Now : in lucid_Image) is procedure deallocate is new ada.unchecked_Deallocation (lucid_Image, lucid_Image_view); begin if Self.lucid_Image = null then Self.lucid_Image := new lucid_Image' (Now); elsif Self.lucid_Image'Length (1) = Now'Length (1) and Self.lucid_Image'Length (2) = Now'Length (2) then Self.lucid_Image.all := Now; else deallocate (Self.lucid_Image); Self.lucid_Image := new lucid_Image' (Now); end if; Self.needs_Rebuild := True; end Image_is; end openGL.Model.billboard.textured;
reznikmm/matreshka
Ada
4,344
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.OCL.Navigation_Call_Exps; limited with AMF.UML.Properties; package AMF.OCL.Property_Call_Exps is pragma Preelaborate; type OCL_Property_Call_Exp is limited interface and AMF.OCL.Navigation_Call_Exps.OCL_Navigation_Call_Exp; type OCL_Property_Call_Exp_Access is access all OCL_Property_Call_Exp'Class; for OCL_Property_Call_Exp_Access'Storage_Size use 0; not overriding function Get_Referred_Property (Self : not null access constant OCL_Property_Call_Exp) return AMF.UML.Properties.UML_Property_Access is abstract; -- Getter of PropertyCallExp::referredProperty. -- not overriding procedure Set_Referred_Property (Self : not null access OCL_Property_Call_Exp; To : AMF.UML.Properties.UML_Property_Access) is abstract; -- Setter of PropertyCallExp::referredProperty. -- end AMF.OCL.Property_Call_Exps;
optikos/oasis
Ada
5,724
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Elements.Expressions; with Program.Elements.Component_Definitions; with Program.Elements.Unconstrained_Array_Types; with Program.Element_Visitors; package Program.Nodes.Unconstrained_Array_Types is pragma Preelaborate; type Unconstrained_Array_Type is new Program.Nodes.Node and Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type and Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Text with private; function Create (Array_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Index_Subtypes : not null Program.Elements.Expressions .Expression_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access) return Unconstrained_Array_Type; type Implicit_Unconstrained_Array_Type is new Program.Nodes.Node and Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type with private; function Create (Index_Subtypes : not null Program.Elements.Expressions .Expression_Vector_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Unconstrained_Array_Type with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Unconstrained_Array_Type is abstract new Program.Nodes.Node and Program.Elements.Unconstrained_Array_Types.Unconstrained_Array_Type with record Index_Subtypes : not null Program.Elements.Expressions .Expression_Vector_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access; end record; procedure Initialize (Self : aliased in out Base_Unconstrained_Array_Type'Class); overriding procedure Visit (Self : not null access Base_Unconstrained_Array_Type; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Index_Subtypes (Self : Base_Unconstrained_Array_Type) return not null Program.Elements.Expressions.Expression_Vector_Access; overriding function Component_Definition (Self : Base_Unconstrained_Array_Type) return not null Program.Elements.Component_Definitions .Component_Definition_Access; overriding function Is_Unconstrained_Array_Type_Element (Self : Base_Unconstrained_Array_Type) return Boolean; overriding function Is_Type_Definition_Element (Self : Base_Unconstrained_Array_Type) return Boolean; overriding function Is_Definition_Element (Self : Base_Unconstrained_Array_Type) return Boolean; type Unconstrained_Array_Type is new Base_Unconstrained_Array_Type and Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Text with record Array_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Unconstrained_Array_Type_Text (Self : aliased in out Unconstrained_Array_Type) return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Text_Access; overriding function Array_Token (Self : Unconstrained_Array_Type) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Left_Bracket_Token (Self : Unconstrained_Array_Type) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Right_Bracket_Token (Self : Unconstrained_Array_Type) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Of_Token (Self : Unconstrained_Array_Type) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Unconstrained_Array_Type is new Base_Unconstrained_Array_Type with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Unconstrained_Array_Type_Text (Self : aliased in out Implicit_Unconstrained_Array_Type) return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Unconstrained_Array_Type) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Unconstrained_Array_Type) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Unconstrained_Array_Type) return Boolean; end Program.Nodes.Unconstrained_Array_Types;
reznikmm/matreshka
Ada
3,585
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.Elements.Generic_Hash; function AMF.DG.Paths.Hash is new AMF.Elements.Generic_Hash (DG_Path, DG_Path_Access);
ekoeppen/STM32_Generic_Ada_Drivers
Ada
839
ads
with STM32_SVD.I2C; generic I2C : in out STM32_SVD.I2C.I2C_Peripheral; package STM32GD.I2C.Peripheral is pragma Preelaborate; subtype I2C_Address is UInt10; type I2C_Data is array (Natural range <>) of Byte; procedure Init; function Test (Address : I2C_Address) return Boolean; function Master_Transmit (Address : I2C_Address; Data : Byte; Restart : Boolean := False) return Boolean; function Master_Receive (Address : I2C_Address; Data : out Byte) return Boolean; function Master_Receive (Address : I2C_Address; Data : out I2C_Data) return Boolean; function Write_Register (Address : I2C_Address; Register : Byte; Data : Byte) return Boolean; function Read_Register (Address : I2C_Address; Register : Byte; Data : out Byte) return Boolean; end STM32GD.I2C.Peripheral;
charlie5/lace
Ada
2,640
ads
package collada.Library.geometries -- -- Models a collada 'geometries' library, which is a collection of geometries. -- is type Inputs_view is access library.Inputs; type Int_array_view is access Int_array; type Int_array_List is array (Positive range <>) of Int_array_view; type Int_array_List_view is access int_array_List; ------------ --- Vertices -- type Vertices is record Id : Text; Inputs : Inputs_view; end record; -------------- --- Primitives -- type primitive_Kind is (Unknown, Lines, line_Strips, Polygons, polyList, Triangles, triFans, triStrips); type Primitive (Kind : primitive_Kind := Unknown) is record Count : Natural; Material : Text; Inputs : Inputs_view; P_List : int_array_List_view; case Kind is when polyList => vCount : Int_array_view; when others => null; end case; end record; type Primitives is array (Positive range <>) of Primitive; type Primitives_view is access Primitives; function vertex_Offset_of (Self : in Primitive) return math.Index; function normal_Offset_of (Self : in Primitive) return math.Index; function coord_Offset_of (Self : in Primitive) return math.Index; no_coord_Offset : exception; -------- --- Mesh -- type Mesh is record Sources : library.Sources_view; Vertices : geometries.Vertices; Primitives : geometries.Primitives_view; end record; function Source_of (Self : in Mesh; source_Name : in String) return Source; function Positions_of (Self : in Mesh) return access float_Array; function Normals_of (Self : in Mesh; for_Primitive : in Primitive) return access float_Array; function Coords_of (Self : in Mesh; for_Primitive : in Primitive) return access float_Array; ------------ --- Geometry -- type Geometry is record Name : Text; Id : Text; Mesh : geometries.Mesh; end record; type Geometry_array is array (Positive range <>) of Geometry; type Geometry_array_view is access Geometry_array; ---------------- --- Library Item -- type Item is record Contents : Geometry_array_view; end record; end collada.Library.geometries;
AdaCore/libadalang
Ada
357
adb
procedure TestIfc is package Pkg is type A is interface; procedure Foo (Self : A; O : Natural) is null; type B is interface and A; procedure Bar (Self : B) is null; type C is new B with null record; end Pkg; use Pkg; Inst : C := C'(null record); begin Foo (Inst, 12); pragma Test_Statement; end Testifc;
pdaxrom/Kino2
Ada
3,798
ads
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada -- -- -- -- 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 ------------------------------------------------------------------------------ generic type T is (<>); package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada); function Create (Set : Type_Set := Mixed_Case; Case_Sensitive : Boolean := False; Must_Be_Unique : Boolean := False) return Enumeration_Field; function Value (Fld : Field; Buf : Buffer_Number := Buffer_Number'First) return T; -- Translate the content of the fields buffer - indicated by the -- buffer number - into an enumeration value. If the buffer is empty -- or the content is invalid, a Constraint_Error is raises. end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
ohenley/awt
Ada
1,949
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 - 2019 Joakim Strandberg <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. private with Interfaces.C; with Ada.Streams; with Wayland; package C_Binding is pragma Preelaborate; type File (File_Descriptor : Wayland.File_Descriptor) is limited private; type Read_Result_Kind_Id is (Read_Success, End_Of_File_Reached, Read_Failure); type Read_Result (Kind_Id : Read_Result_Kind_Id) is record case Kind_Id is when Read_Success => Element_Count : Ada.Streams.Stream_Element_Count; when End_Of_File_Reached => null; when Read_Failure => null; end case; end record; function Read (This : File; Bytes : in out Ada.Streams.Stream_Element_Array) return Read_Result with Pre => Is_Open (This); procedure Write (This : File; Bytes : Ada.Streams.Stream_Element_Array) with Pre => Is_Open (This); procedure Close (This : in out File) with Pre => Is_Open (This), Post => not Is_Open (This); function Is_Open (This : File) return Boolean; private use type Interfaces.C.int; type File (File_Descriptor : Wayland.File_Descriptor) is limited record Open : Boolean := True; end record; function Is_Open (This : File) return Boolean is (This.Open); end C_Binding;
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_Chart.Plot_Area_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Chart_Plot_Area_Element_Node is begin return Self : Chart_Plot_Area_Element_Node do Matreshka.ODF_Chart.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Chart_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Chart_Plot_Area_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_Chart_Plot_Area (ODF.DOM.Chart_Plot_Area_Elements.ODF_Chart_Plot_Area_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 Chart_Plot_Area_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Plot_Area_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Chart_Plot_Area_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_Chart_Plot_Area (ODF.DOM.Chart_Plot_Area_Elements.ODF_Chart_Plot_Area_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 Chart_Plot_Area_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_Chart_Plot_Area (Visitor, ODF.DOM.Chart_Plot_Area_Elements.ODF_Chart_Plot_Area_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.Chart_URI, Matreshka.ODF_String_Constants.Plot_Area_Element, Chart_Plot_Area_Element_Node'Tag); end Matreshka.ODF_Chart.Plot_Area_Elements;
reznikmm/ada-skynet
Ada
6,530
adb
-- Copyright (c) 2020 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Characters.Latin_1; with Ada.Directories; with Ada.Streams.Stream_IO; with Ada.Unchecked_Deallocation; with AWS.Client; with AWS.Headers; with AWS.Messages; with AWS.Resources; with AWS.Response; with AWS.Utils; with League.JSON.Documents; with League.JSON.Objects; with League.JSON.Values; package body Skynet is ------------------- -- Download_File -- ------------------- procedure Download_File (Path : League.Strings.Universal_String; Skylink : League.Strings.Universal_String; Portal_URL : League.Strings.Universal_String := +"https://siasky.net") is use type League.Strings.Universal_String; Hash : constant League.Strings.Universal_String := Skylink.Tail_From (URI_Skynet_Prefix'Length); URL : constant League.Strings.Universal_String := Portal_URL & Hash; Response : constant AWS.Response.Data := AWS.Client.Get (URL.To_UTF_8_String, Follow_Redirection => True); Input : AWS.Resources.File_Type; Output : Ada.Streams.Stream_IO.File_Type; Buffer : Ada.Streams.Stream_Element_Array (1 .. 1024); Last : Ada.Streams.Stream_Element_Count; begin if AWS.Response.Status_Code (Response) not in AWS.Messages.Success then raise Program_Error with "request fails"; end if; AWS.Response.Message_Body (Response, Input); Ada.Streams.Stream_IO.Create (Output, Name => Path.To_UTF_8_String); loop AWS.Resources.Read (Input, Buffer, Last); exit when Last in 0; Ada.Streams.Stream_IO.Write (Output, Buffer (1 .. Last)); end loop; Ada.Streams.Stream_IO.Close (Output); AWS.Resources.Close (Input); end Download_File; ----------------- -- Upload_File -- ----------------- procedure Upload_File (Path : League.Strings.Universal_String; Skylink : out League.Strings.Universal_String; Options : Upload_Options := (others => <>)) is use type Ada.Streams.Stream_Element_Count; type Simple_Stream (Size : Ada.Streams.Stream_Element_Count) is new Ada.Streams.Root_Stream_Type with record Last : Ada.Streams.Stream_Element_Offset := 0; Buffer : Ada.Streams.Stream_Element_Array (1 .. Size); end record; procedure Read (Self : in out Simple_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is null; procedure Write (Self : in out Simple_Stream; Item : Ada.Streams.Stream_Element_Array); type Simple_Stream_Access is access all Simple_Stream; procedure Read_File (File_Name : String; Stream : Simple_Stream_Access); procedure Free is new Ada.Unchecked_Deallocation (Simple_Stream, Simple_Stream_Access); --------------- -- Read_File -- --------------- procedure Read_File (File_Name : String; Stream : Simple_Stream_Access) is Input : Ada.Streams.Stream_IO.File_Type; Buffer : Ada.Streams.Stream_Element_Array (1 .. 1024); Last : Ada.Streams.Stream_Element_Count; begin Ada.Streams.Stream_IO.Open (Input, Ada.Streams.Stream_IO.In_File, File_Name); loop Ada.Streams.Stream_IO.Read (Input, Buffer, Last); exit when Last in 0; Stream.Write (Buffer (1 .. Last)); end loop; Ada.Streams.Stream_IO.Close (Input); end Read_File; ----------- -- Write -- ----------- procedure Write (Self : in out Simple_Stream; Item : Ada.Streams.Stream_Element_Array) is begin Self.Buffer (Self.Last + 1 .. Self.Last + Item'Length) := Item; Self.Last := Self.Last + Item'Length; end Write; Boundary_Size : constant := 32; File_Name : constant String := Path.To_UTF_8_String; Base_Name : constant String := Ada.Directories.Simple_Name (File_Name); CD : constant String := AWS.Messages.Content_Disposition (Format => "form-data", Name => Options.Portal.File_Fieldname.To_UTF_8_String, Filename => Base_Name); File_Size : constant Ada.Directories.File_Size := Ada.Directories.Size (File_Name); Buffer_Size : constant Ada.Streams.Stream_Element_Count := 2 + Boundary_Size + 2 -- --BOUNDARY<CRLF> + CD'Length + 2 + 2 -- Content_Disposition<CRLF><CRLF> + Ada.Streams.Stream_Element_Count (File_Size) + 2 -- <CRLF> + 2 + Boundary_Size + 2 + 2; -- --BOUNDARY--<CRLF> CRLF : constant String := (Ada.Characters.Latin_1.CR, Ada.Characters.Latin_1.LF); Boundary : constant String := AWS.Utils.Random_String (Boundary_Size); Stream : Simple_Stream_Access := new Simple_Stream (Buffer_Size); Response : AWS.Response.Data; URL : League.Strings.Universal_String; Document : League.JSON.Documents.JSON_Document; begin URL.Append (Options.Portal.URL); URL.Append ("/"); URL.Append (Options.Portal.Upload_Path); String'Write (Stream, "--"); String'Write (Stream, Boundary); String'Write (Stream, CRLF); String'Write (Stream, CD); String'Write (Stream, CRLF); String'Write (Stream, CRLF); Read_File (File_Name, Stream); String'Write (Stream, CRLF); String'Write (Stream, "--"); String'Write (Stream, Boundary); String'Write (Stream, "--"); String'Write (Stream, CRLF); pragma Assert (Stream.Last = Stream.Size); Response := AWS.Client.Post (URL => URL.To_UTF_8_String, Data => Stream.Buffer, Content_Type => "multipart/form-data; boundary=" & Boundary); Free (Stream); if AWS.Response.Status_Code (Response) not in AWS.Messages.Success then raise Program_Error with "request fails"; end if; Document := League.JSON.Documents.From_JSON (AWS.Response.Message_Body (Response)); Skylink.Clear; Skylink.Append (URI_Skynet_Prefix); Skylink.Append (Document.To_JSON_Object.Value (+"skylink").To_String); end Upload_File; end Skynet;
reznikmm/matreshka
Ada
3,679
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Table_Table_Cell_Elements is pragma Preelaborate; type ODF_Table_Table_Cell is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Table_Table_Cell_Access is access all ODF_Table_Table_Cell'Class with Storage_Size => 0; end ODF.DOM.Table_Table_Cell_Elements;
stcarrez/ada-ado
Ada
2,040
ads
----------------------------------------------------------------------- -- ado-schemas-tests -- Test loading of database schema -- Copyright (C) 2009, 2010, 2011, 2015, 2018, 2022, 2023 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package ADO.Schemas.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test reading the entity cache and the Find_Entity_Type operation procedure Test_Find_Entity_Type (T : in out Test); -- Test calling Find_Entity_Type with an invalid table. procedure Test_Find_Entity_Type_Error (T : in out Test); -- Test the Load_Schema operation and check the result schema. procedure Test_Load_Schema (T : in out Test); -- Test the Table_Cursor operations and check the result schema. procedure Test_Table_Iterator (T : in out Test); -- Test the Has_Table operation procedure Test_Has_Table (T : in out Test); -- Test the Table_Cursor operations on an empty schema. procedure Test_Empty_Schema (T : in out Test); -- Test the creation of database. procedure Test_Create_Schema (T : in out Test); -- Test the sort migration. procedure Test_Sort_Migration (T : in out Test); -- Test the scan of migration. procedure Test_Scan_Migration (T : in out Test); end ADO.Schemas.Tests;
sungyeon/drake
Ada
1,100
adb
with System.Formatting; with System.Img_Uns; with System.Long_Long_Integer_Types; package body System.Img_LLU is subtype Word_Unsigned is Long_Long_Integer_Types.Word_Unsigned; subtype Long_Long_Unsigned is Long_Long_Integer_Types.Long_Long_Unsigned; procedure Image ( V : Long_Long_Unsigned; S : in out String; P : out Natural); procedure Image ( V : Long_Long_Unsigned; S : in out String; P : out Natural) is Error : Boolean; begin pragma Assert (S'Length >= 1); S (S'First) := ' '; Formatting.Image (V, S (S'First + 1 .. S'Last), P, Error => Error); pragma Assert (not Error); end Image; -- implementation procedure Image_Long_Long_Unsigned ( V : Unsigned_Types.Long_Long_Unsigned; S : in out String; P : out Natural) is begin if Unsigned_Types.Long_Long_Unsigned'Size <= Standard'Word_Size then Img_Uns.Image (Word_Unsigned (V), S, P); else Image (Long_Long_Unsigned (V), S, P); end if; end Image_Long_Long_Unsigned; end System.Img_LLU;
stcarrez/ada-wiki
Ada
1,024
adb
----------------------------------------------------------------------- -- Wiki -- Unit tests -- 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 Wiki.Testsuite; with Util.Tests; procedure Wiki_Harness is procedure Harness is new Util.Tests.Harness (Wiki.Testsuite.Suite); begin Harness ("wiki-tests.xml"); end Wiki_Harness;
reznikmm/matreshka
Ada
3,615
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UML.Manifestations.Hash is new AMF.Elements.Generic_Hash (UML_Manifestation, UML_Manifestation_Access);
AdaDoom3/wayland_ada_binding
Ada
2,085
adb
package body Client_Examples.Find_Compositor is procedure Global_Registry_Handler (Compositor : not null Wl.Compositor_Ptr; Registry : Wl.Registry; Id : Wl.Unsigned_32; Name : String; Version : Wl.Unsigned_32) is begin Put_Line ("Got a registry event for " & Name & " id" & Id'Image); if Name = "wl_compositor" then Compositor.Get_Proxy (Registry, Id, Version); end if; end Global_Registry_Handler; procedure Global_Registry_Remover (Data : not null Wl.Compositor_Ptr; Registry : Wl.Registry; Id : Wl.Unsigned_32) is begin Put_Line ("Got a registry losing event for" & Id'Image); end Global_Registry_Remover; package Registry_Events is new Wl.Registry_Events (Data_Type => Wl.Compositor, Data_Ptr => Wl.Compositor_Ptr, Global_Object_Added => Global_Registry_Handler, Global_Object_Removed => Global_Registry_Remover); Display : Wl.Display; Registry : Wl.Registry; Compositor : aliased Wl.Compositor; procedure Run is begin Display.Connect (Wl.Default_Display_Name); if not Display.Is_Connected then Put_Line ("Can't connect to display"); return; end if; Put_Line ("Connected to display"); Display.Get_Registry (Registry); if not Registry.Has_Proxy then Put_Line ("Can't get global registry object"); return; end if; Registry_Events.Subscribe (Registry, Compositor'Access); Display.Dispatch; Display.Roundtrip; if Compositor.Has_Proxy then Put_Line ("Found compositor"); else Put_Line ("Can't find compositor"); end if; Registry.Destroy; Display.Disconnect; Put_Line ("Disconnected from display"); end Run; end Client_Examples.Find_Compositor;
tum-ei-rcs/StratoX
Ada
1,743
adb
-- Data Watchpoint and Trace (DWT) Unit -- Gives access to cycle counter. with STM32.Debug; use STM32.Debug; package body STM32.DWT is ------------ -- Enable -- ------------ procedure Enable is begin Core_Debug.DEMCR.TRCENA := True; end Enable; ------------ -- Disable -- ------------ procedure Disable is begin Core_Debug.DEMCR.TRCENA := False; end Disable; -------------------------- -- Enable_Cycle_Counter -- -------------------------- procedure Enable_Cycle_Counter is begin Enable; Core_DWT.DWT_CYCCNT := 0; Core_DWT.DWT_CTRL.CYCCNTENA := True; end Enable_Cycle_Counter; --------------------------- -- Disable_Cycle_Counter -- --------------------------- procedure Disable_Cycle_Counter is begin Core_DWT.DWT_CTRL.CYCCNTENA := False; end Disable_Cycle_Counter; -------------------------- -- Enable_Sleep_Counter -- -------------------------- procedure Enable_Sleep_Counter is begin Enable; Core_DWT.DWT_SLEEPCNT := 0; Core_DWT.DWT_CTRL.SLEEPEVTENA := True; end Enable_Sleep_Counter; --------------------------- -- Disable_Sleep_Counter -- --------------------------- procedure Disable_Sleep_Counter is begin Core_DWT.DWT_CTRL.SLEEPEVTENA := False; end Disable_Sleep_Counter; ------------------------ -- Read_Cycle_Counter -- ------------------------ function Read_Cycle_Counter return Unsigned_32 is (Unsigned_32 (Core_DWT.DWT_CYCCNT)); ------------------------ -- Read_Sleep_Counter -- ------------------------ function Read_Sleep_Counter return Unsigned_8 is (Unsigned_8 (Core_DWT.DWT_SLEEPCNT)); end STM32.DWT;
AdaCore/libadalang
Ada
216
ads
with Foo; with Foo2; package Root.Pkg is type X is private; package Nested is procedure Proc; use Foo; end Nested; private type X is record Y, Z : Integer; end record; end Root.Pkg;
AdaCore/Ada_Drivers_Library
Ada
6,810
ads
-- This spec has been automatically generated from FE310.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package FE310_SVD.PWM is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CONFIG_SCALE_Field is HAL.UInt4; -- CONFIG_CMP_CENTER array type CONFIG_CMP_CENTER_Field_Array is array (0 .. 3) of Boolean with Component_Size => 1, Size => 4; -- Type definition for CONFIG_CMP_CENTER type CONFIG_CMP_CENTER_Field (As_Array : Boolean := False) is record case As_Array is when False => -- CMP_CENTER as a value Val : HAL.UInt4; when True => -- CMP_CENTER as an array Arr : CONFIG_CMP_CENTER_Field_Array; end case; end record with Unchecked_Union, Size => 4; for CONFIG_CMP_CENTER_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- CONFIG_CMP_GANG array type CONFIG_CMP_GANG_Field_Array is array (0 .. 3) of Boolean with Component_Size => 1, Size => 4; -- Type definition for CONFIG_CMP_GANG type CONFIG_CMP_GANG_Field (As_Array : Boolean := False) is record case As_Array is when False => -- CMP_GANG as a value Val : HAL.UInt4; when True => -- CMP_GANG as an array Arr : CONFIG_CMP_GANG_Field_Array; end case; end record with Unchecked_Union, Size => 4; for CONFIG_CMP_GANG_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- CONFIG_CMP_IP array type CONFIG_CMP_IP_Field_Array is array (0 .. 3) of Boolean with Component_Size => 1, Size => 4; -- Type definition for CONFIG_CMP_IP type CONFIG_CMP_IP_Field (As_Array : Boolean := False) is record case As_Array is when False => -- CMP_IP as a value Val : HAL.UInt4; when True => -- CMP_IP as an array Arr : CONFIG_CMP_IP_Field_Array; end case; end record with Unchecked_Union, Size => 4; for CONFIG_CMP_IP_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- PWM Configuration Register. type CONFIG_Register is record SCALE : CONFIG_SCALE_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; STICKY : Boolean := False; ZEROCMP : Boolean := False; DEGLITCH : Boolean := False; -- unspecified Reserved_11_11 : HAL.Bit := 16#0#; ENALWAYS : Boolean := False; ENONESHOT : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; CMP_CENTER : CONFIG_CMP_CENTER_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_20_23 : HAL.UInt4 := 16#0#; CMP_GANG : CONFIG_CMP_GANG_Field := (As_Array => False, Val => 16#0#); CMP_IP : CONFIG_CMP_IP_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CONFIG_Register use record SCALE at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; STICKY at 0 range 8 .. 8; ZEROCMP at 0 range 9 .. 9; DEGLITCH at 0 range 10 .. 10; Reserved_11_11 at 0 range 11 .. 11; ENALWAYS at 0 range 12 .. 12; ENONESHOT at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; CMP_CENTER at 0 range 16 .. 19; Reserved_20_23 at 0 range 20 .. 23; CMP_GANG at 0 range 24 .. 27; CMP_IP at 0 range 28 .. 31; end record; subtype COUNT_CNT_Field is HAL.UInt31; -- PWM Count Register. type COUNT_Register is record CNT : COUNT_CNT_Field := 16#0#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for COUNT_Register use record CNT at 0 range 0 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype SCALE_COUNT_CNT_Field is HAL.UInt16; -- PWM Scaled Counter Register. type SCALE_COUNT_Register is record CNT : SCALE_COUNT_CNT_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SCALE_COUNT_Register use record CNT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype COMPARE_COMPARE_Field is HAL.UInt16; -- PWM Compare Register. type COMPARE_Register is record COMPARE : COMPARE_COMPARE_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for COMPARE_Register use record COMPARE at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Pulse-Width Modulation. type PWM_Peripheral is record -- PWM Configuration Register. CONFIG : aliased CONFIG_Register; -- PWM Count Register. COUNT : aliased COUNT_Register; -- PWM Scaled Counter Register. SCALE_COUNT : aliased SCALE_COUNT_Register; -- PWM Compare Register. COMPARE0 : aliased COMPARE_Register; -- PWM Compare Register. COMPARE1 : aliased COMPARE_Register; -- PWM Compare Register. COMPARE2 : aliased COMPARE_Register; -- PWM Compare Register. COMPARE3 : aliased COMPARE_Register; end record with Volatile; for PWM_Peripheral use record CONFIG at 16#0# range 0 .. 31; COUNT at 16#8# range 0 .. 31; SCALE_COUNT at 16#10# range 0 .. 31; COMPARE0 at 16#20# range 0 .. 31; COMPARE1 at 16#24# range 0 .. 31; COMPARE2 at 16#28# range 0 .. 31; COMPARE3 at 16#2C# range 0 .. 31; end record; -- Pulse-Width Modulation. PWM0_Periph : aliased PWM_Peripheral with Import, Address => System'To_Address (16#10015000#); -- Pulse-Width Modulation. PWM1_Periph : aliased PWM_Peripheral with Import, Address => System'To_Address (16#10025000#); -- Pulse-Width Modulation. PWM2_Periph : aliased PWM_Peripheral with Import, Address => System'To_Address (16#10035000#); end FE310_SVD.PWM;
reznikmm/matreshka
Ada
7,080
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Text.User_Index_Mark_Start_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_User_Index_Mark_Start_Element_Node is begin return Self : Text_User_Index_Mark_Start_Element_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Text_User_Index_Mark_Start_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Enter_Text_User_Index_Mark_Start (ODF.DOM.Text_User_Index_Mark_Start_Elements.ODF_Text_User_Index_Mark_Start_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Enter_Node (Visitor, Control); end if; end Enter_Node; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Text_User_Index_Mark_Start_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.User_Index_Mark_Start_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Text_User_Index_Mark_Start_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Leave_Text_User_Index_Mark_Start (ODF.DOM.Text_User_Index_Mark_Start_Elements.ODF_Text_User_Index_Mark_Start_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Leave_Node (Visitor, Control); end if; end Leave_Node; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Text_User_Index_Mark_Start_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then ODF.DOM.Iterators.Abstract_ODF_Iterator'Class (Iterator).Visit_Text_User_Index_Mark_Start (Visitor, ODF.DOM.Text_User_Index_Mark_Start_Elements.ODF_Text_User_Index_Mark_Start_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Visit_Node (Iterator, Visitor, Control); end if; end Visit_Node; begin Matreshka.DOM_Documents.Register_Element (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.User_Index_Mark_Start_Element, Text_User_Index_Mark_Start_Element_Node'Tag); end Matreshka.ODF_Text.User_Index_Mark_Start_Elements;
stcarrez/dynamo
Ada
7,703
ads
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . D E C L _ S E M -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2012, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This package contains routines needed for semantic queries from -- the Asis.Declarations package with Asis; use Asis; with Types; use Types; package A4G.Decl_Sem is -- All the routines defined in this package do not check their -- arguments - a caller is responcible for the proper use of these -- routines ------------------------------------------------- -- Routines for Corresponding_Type_Definition -- ------------------------------------------------- function Serach_First_View (Type_Entity : Entity_Id) return Entity_Id; -- taking the node representing the type entity, this function looks -- for the first occurence of this name in the corresponding declarative -- region. The idea is to find the declaration of the private or incomplete -- type for which this type defines the full view. If there is no private -- or incomplete view, the function returns its argument as a result. -- -- Note, that Type_Entity should not represent an implicit type created -- by the compiler. -- -- The reason why we need this function is that some functions from Sinfo -- and Einfo needed for semantic queries from Asis.Declarations do not -- correspond to their documentation or/and have irregular behaviour. If -- and when the corresponding problems in Einfo and Sinfo are fixed, it -- would be very nice to get rid of this function, which in fact is no -- more than ad hoc solution. --------------------------------------------- -- Routines for Corresponding_Declaration -- --------------------------------------------- function Get_Expanded_Spec (Instance_Node : Node_Id) return Node_Id; -- For Instance_Node, which should represent a generic instantiation, -- this function returns the node representing the expanded generic -- specification. This function never returns an Empty node. -- -- Note, that in case of subprogram instantiation GNAT creates an -- artificial package enclosing the resulted subprogram declaration -- -- This is an error to call this function for argument which does not -- represent an instantiation, or for a node representing a library -- unit declaration function Corresponding_Decl_Node (Body_Node : Node_Id) return Node_Id; -- For Body_Node representing a body, renaming-as-body or a body stub, this -- function returns the node representing the corresponding declaration. -- -- It is an error to call this function in case when no explicit separate -- declaration exists (that is, in case of renaming-as-declaration or -- a subprogram body (stub) for which no explicit separate declaration is -- presented. -- -- It is also an error to call this function for a node representing a -- library unit declaration or for a node representing generic -- instantiation. -------------------------------------- -- Routines for Corresponding_Body -- -------------------------------------- function Corresponding_Body_Node (Decl_Node : Node_Id) return Node_Id; -- For Decl_Node representing a declaration of a program unit, -- this function returns the node representing the corresponding -- body or renaming-as-body. In is an error to call this function, -- if a completion of the declaration represented by the argument is -- located in another compilation unit, and the tree being accessed -- does not contain this unit (this is the case for subprograms declared -- immediately within a library package/library generic package). function Get_Renaming_As_Body (Node : Node_Id; Spec_Only : Boolean := False) return Node_Id; -- This function tries to find for Node (which should be of -- N_Subprogram_Declaration kind, otherwise this is an error to call -- this function) the node representing renaming-as-body which is -- the completion of this subprogram declaration. The Spec_Only -- flag should be set to limit the search by a package spec only ------------------------------------------------- -- Routines for Corresponding_Generic_Element -- ------------------------------------------------- function Get_Corresponding_Generic_Element (Gen_Unit : Asis.Declaration; Def_Name : Asis.Element) return Asis.Element; -- This function traverses the declaration of a generic package -- Gen_Unit (by applying an instance of Traverce_Element) in order -- to find A_Defining_Name Element which represents the corresponding -- generic element for Def_Name; Def_Name should represent -- A_Defining_Name element which Is_Part_Of_Instance end A4G.Decl_Sem;
Fabien-Chouteau/Ada_Drivers_Library
Ada
6,200
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with NRF51_SVD.ADC; use NRF51_SVD.ADC; with nRF51.Tasks; use nRF51.Tasks; package body nRF51.ADC is procedure Set_Resolution (Res : Bits_Resolution); procedure Set_Reference (Ref : Reference_Selection); -------------------- -- Set_Resolution -- -------------------- procedure Set_Resolution (Res : Bits_Resolution) is begin ADC_Periph.CONFIG.RES := (case Res is when 8 => CONFIG_RES_Field_8BIT, when 9 => CONFIG_RES_Field_9BIT, when 10 => CONFIG_RES_Field_10BIT); end Set_Resolution; ------------------- -- Set_Reference -- ------------------- procedure Set_Reference (Ref : Reference_Selection) is begin ADC_Periph.CONFIG.EXTREFSEL := None; case Ref is when Internal_1V2 => ADC_Periph.CONFIG.REFSEL := Vbg; when External_AREF0 => ADC_Periph.CONFIG.REFSEL := External; ADC_Periph.CONFIG.EXTREFSEL := Analogreference0; when External_AREF1 => ADC_Periph.CONFIG.REFSEL := External; ADC_Periph.CONFIG.EXTREFSEL := Analogreference1; when VDD_Half => ADC_Periph.CONFIG.REFSEL := Supplyonehalfprescaling; when VDD_One_Third => ADC_Periph.CONFIG.REFSEL := Supplyonethirdprescaling; end case; end Set_Reference; -------------------------- -- Start_Pin_Conversion -- -------------------------- procedure Start_Pin_Conversion (Pin : Analog_Pin; Input : Pin_Input_Selection; Ref : Reference_Selection; Res : Bits_Resolution) is begin Set_Resolution (Res); Set_Reference (Ref); case Input is when Pin_Full => ADC_Periph.CONFIG.INPSEL := Analoginputnoprescaling; when Pin_Two_Third => ADC_Periph.CONFIG.INPSEL := Analoginputtwothirdsprescaling; when Pin_One_Third => ADC_Periph.CONFIG.INPSEL := Analoginputonethirdprescaling; end case; case Pin is when 0 => ADC_Periph.CONFIG.PSEL := Analoginput0; when 1 => ADC_Periph.CONFIG.PSEL := Analoginput1; when 2 => ADC_Periph.CONFIG.PSEL := Analoginput2; when 3 => ADC_Periph.CONFIG.PSEL := Analoginput3; when 4 => ADC_Periph.CONFIG.PSEL := Analoginput4; when 5 => ADC_Periph.CONFIG.PSEL := Analoginput5; when 6 => ADC_Periph.CONFIG.PSEL := Analoginput6; when 7 => ADC_Periph.CONFIG.PSEL := Analoginput7; end case; ADC_Periph.ENABLE.ENABLE := Enabled; Trigger (ADC_START); end Start_Pin_Conversion; -------------------------- -- Start_VDD_Conversion -- -------------------------- procedure Start_VDD_Conversion (Input : VDD_Input_Selection; Ref : Reference_Selection; Res : Bits_Resolution) is begin Set_Resolution (Res); Set_Reference (Ref); ADC_Periph.CONFIG.PSEL := Disabled; case Input is when VDD_Two_Third => ADC_Periph.CONFIG.INPSEL := Supplytwothirdsprescaling; when VDD_One_Third => ADC_Periph.CONFIG.INPSEL := Supplyonethirdprescaling; end case; ADC_Periph.ENABLE.ENABLE := Enabled; Trigger (ADC_START); end Start_VDD_Conversion; ---------- -- Busy -- ---------- function Busy return Boolean is (ADC_Periph.BUSY.BUSY = Busy); --------------------- -- Wait_For_Result -- --------------------- function Wait_For_Result return UInt10 is begin while ADC_Periph.BUSY.BUSY = Busy loop null; end loop; ADC_Periph.ENABLE.ENABLE := Enabled; return ADC_Periph.RESULT.RESULT; end Wait_For_Result; end nRF51.ADC;
usnistgov/rcslib
Ada
15,303
ads
-- -- New Ada Spec File starts here. -- This file should be named posemath_n_ada.ads -- Automatically generated by NML CodeGen Java Applet. -- on Wed Aug 25 13:07:04 EDT 2004 -- with Nml_Msg; use Nml_Msg; with Cms; -- Some standard Ada Packages we always need. with Unchecked_Deallocation; with Unchecked_Conversion; with Interfaces.C; use Interfaces.C; package posemath_n_ada is -- Create Ada versions of the Enumeration types. type PM_AXIS is ( Bad_PM_AXIS_Value, PM_Z, -- 2 PM_Y, -- 1 PM_X --0 ); type PM_AXIS_Array is array(Integer range <>) of PM_AXIS; function Format(Nml_Type : in long; Msg : in NmlMsg_Access; Cms_Ptr : in Cms.Cms_Access) return int; pragma Export(C,Format,"ada_posemath_n_ada_format"); -- Redefine the C++ NML message classes as Ada Records. type PM_CARTESIAN is record x : double; y : double; z : double; end record; type PM_CARTESIAN_Access is access all PM_CARTESIAN; procedure Update_Internal_PM_CARTESIAN(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_CARTESIAN); procedure Free is new Unchecked_Deallocation(PM_CARTESIAN,PM_CARTESIAN_Access); type PM_CARTESIAN_Array is array(Integer range <>) of PM_CARTESIAN; type PM_CYLINDRICAL is record theta : double; r : double; z : double; end record; type PM_CYLINDRICAL_Access is access all PM_CYLINDRICAL; procedure Update_Internal_PM_CYLINDRICAL(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_CYLINDRICAL); procedure Free is new Unchecked_Deallocation(PM_CYLINDRICAL,PM_CYLINDRICAL_Access); type PM_CYLINDRICAL_Array is array(Integer range <>) of PM_CYLINDRICAL; type PM_EULER_ZYX is record z : double; y : double; x : double; end record; type PM_EULER_ZYX_Access is access all PM_EULER_ZYX; procedure Update_Internal_PM_EULER_ZYX(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_EULER_ZYX); procedure Free is new Unchecked_Deallocation(PM_EULER_ZYX,PM_EULER_ZYX_Access); type PM_EULER_ZYX_Array is array(Integer range <>) of PM_EULER_ZYX; type PM_EULER_ZYZ is record z : double; y : double; zp : double; end record; type PM_EULER_ZYZ_Access is access all PM_EULER_ZYZ; procedure Update_Internal_PM_EULER_ZYZ(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_EULER_ZYZ); procedure Free is new Unchecked_Deallocation(PM_EULER_ZYZ,PM_EULER_ZYZ_Access); type PM_EULER_ZYZ_Array is array(Integer range <>) of PM_EULER_ZYZ; type PM_QUATERNION is record s : double; x : double; y : double; z : double; end record; type PM_QUATERNION_Access is access all PM_QUATERNION; procedure Update_Internal_PM_QUATERNION(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_QUATERNION); procedure Free is new Unchecked_Deallocation(PM_QUATERNION,PM_QUATERNION_Access); type PM_QUATERNION_Array is array(Integer range <>) of PM_QUATERNION; type PM_ROTATION_VECTOR is record s : double; x : double; y : double; z : double; end record; type PM_ROTATION_VECTOR_Access is access all PM_ROTATION_VECTOR; procedure Update_Internal_PM_ROTATION_VECTOR(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_ROTATION_VECTOR); procedure Free is new Unchecked_Deallocation(PM_ROTATION_VECTOR,PM_ROTATION_VECTOR_Access); type PM_ROTATION_VECTOR_Array is array(Integer range <>) of PM_ROTATION_VECTOR; type PM_RPY is record r : double; p : double; y : double; end record; type PM_RPY_Access is access all PM_RPY; procedure Update_Internal_PM_RPY(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_RPY); procedure Free is new Unchecked_Deallocation(PM_RPY,PM_RPY_Access); type PM_RPY_Array is array(Integer range <>) of PM_RPY; type PM_SPHERICAL is record theta : double; phi : double; r : double; end record; type PM_SPHERICAL_Access is access all PM_SPHERICAL; procedure Update_Internal_PM_SPHERICAL(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_SPHERICAL); procedure Free is new Unchecked_Deallocation(PM_SPHERICAL,PM_SPHERICAL_Access); type PM_SPHERICAL_Array is array(Integer range <>) of PM_SPHERICAL; type PmCartesian is record x : double; y : double; z : double; end record; type PmCartesian_Access is access all PmCartesian; procedure Update_Internal_PmCartesian(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmCartesian); procedure Free is new Unchecked_Deallocation(PmCartesian,PmCartesian_Access); type PmCartesian_Array is array(Integer range <>) of PmCartesian; type PmCylindrical is record theta : double; r : double; z : double; end record; type PmCylindrical_Access is access all PmCylindrical; procedure Update_Internal_PmCylindrical(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmCylindrical); procedure Free is new Unchecked_Deallocation(PmCylindrical,PmCylindrical_Access); type PmCylindrical_Array is array(Integer range <>) of PmCylindrical; type PmEulerZyx is record z : double; y : double; x : double; end record; type PmEulerZyx_Access is access all PmEulerZyx; procedure Update_Internal_PmEulerZyx(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmEulerZyx); procedure Free is new Unchecked_Deallocation(PmEulerZyx,PmEulerZyx_Access); type PmEulerZyx_Array is array(Integer range <>) of PmEulerZyx; type PmEulerZyz is record z : double; y : double; zp : double; end record; type PmEulerZyz_Access is access all PmEulerZyz; procedure Update_Internal_PmEulerZyz(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmEulerZyz); procedure Free is new Unchecked_Deallocation(PmEulerZyz,PmEulerZyz_Access); type PmEulerZyz_Array is array(Integer range <>) of PmEulerZyz; type PmQuaternion is record s : double; x : double; y : double; z : double; end record; type PmQuaternion_Access is access all PmQuaternion; procedure Update_Internal_PmQuaternion(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmQuaternion); procedure Free is new Unchecked_Deallocation(PmQuaternion,PmQuaternion_Access); type PmQuaternion_Array is array(Integer range <>) of PmQuaternion; type PmRotationVector is record s : double; x : double; y : double; z : double; end record; type PmRotationVector_Access is access all PmRotationVector; procedure Update_Internal_PmRotationVector(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmRotationVector); procedure Free is new Unchecked_Deallocation(PmRotationVector,PmRotationVector_Access); type PmRotationVector_Array is array(Integer range <>) of PmRotationVector; type PmRpy is record r : double; p : double; y : double; end record; type PmRpy_Access is access all PmRpy; procedure Update_Internal_PmRpy(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmRpy); procedure Free is new Unchecked_Deallocation(PmRpy,PmRpy_Access); type PmRpy_Array is array(Integer range <>) of PmRpy; type PmSpherical is record theta : double; phi : double; r : double; end record; type PmSpherical_Access is access all PmSpherical; procedure Update_Internal_PmSpherical(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmSpherical); procedure Free is new Unchecked_Deallocation(PmSpherical,PmSpherical_Access); type PmSpherical_Array is array(Integer range <>) of PmSpherical; type PM_CIRCLE is record center : PM_CARTESIAN; normal : PM_CARTESIAN; rTan : PM_CARTESIAN; rPerp : PM_CARTESIAN; rHelix : PM_CARTESIAN; radius : double; angle : double; spiral : double; end record; type PM_CIRCLE_Access is access all PM_CIRCLE; procedure Update_Internal_PM_CIRCLE(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_CIRCLE); procedure Free is new Unchecked_Deallocation(PM_CIRCLE,PM_CIRCLE_Access); type PM_CIRCLE_Array is array(Integer range <>) of PM_CIRCLE; type PM_POSE is record tran : PM_CARTESIAN; rot : PM_QUATERNION; end record; type PM_POSE_Access is access all PM_POSE; procedure Update_Internal_PM_POSE(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_POSE); procedure Free is new Unchecked_Deallocation(PM_POSE,PM_POSE_Access); type PM_POSE_Array is array(Integer range <>) of PM_POSE; type PM_ROTATION_MATRIX is record x : PM_CARTESIAN; y : PM_CARTESIAN; z : PM_CARTESIAN; end record; type PM_ROTATION_MATRIX_Access is access all PM_ROTATION_MATRIX; procedure Update_Internal_PM_ROTATION_MATRIX(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_ROTATION_MATRIX); procedure Free is new Unchecked_Deallocation(PM_ROTATION_MATRIX,PM_ROTATION_MATRIX_Access); type PM_ROTATION_MATRIX_Array is array(Integer range <>) of PM_ROTATION_MATRIX; type PmCircle is record center : PmCartesian; normal : PmCartesian; rTan : PmCartesian; rPerp : PmCartesian; rHelix : PmCartesian; radius : double; angle : double; spiral : double; end record; type PmCircle_Access is access all PmCircle; procedure Update_Internal_PmCircle(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmCircle); procedure Free is new Unchecked_Deallocation(PmCircle,PmCircle_Access); type PmCircle_Array is array(Integer range <>) of PmCircle; type PmPose is record tran : PmCartesian; rot : PmQuaternion; end record; type PmPose_Access is access all PmPose; procedure Update_Internal_PmPose(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmPose); procedure Free is new Unchecked_Deallocation(PmPose,PmPose_Access); type PmPose_Array is array(Integer range <>) of PmPose; type PmRotationMatrix is record x : PmCartesian; y : PmCartesian; z : PmCartesian; end record; type PmRotationMatrix_Access is access all PmRotationMatrix; procedure Update_Internal_PmRotationMatrix(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmRotationMatrix); procedure Free is new Unchecked_Deallocation(PmRotationMatrix,PmRotationMatrix_Access); type PmRotationMatrix_Array is array(Integer range <>) of PmRotationMatrix; type PM_HOMOGENEOUS is record tran : PM_CARTESIAN; rot : PM_ROTATION_MATRIX; end record; type PM_HOMOGENEOUS_Access is access all PM_HOMOGENEOUS; procedure Update_Internal_PM_HOMOGENEOUS(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_HOMOGENEOUS); procedure Free is new Unchecked_Deallocation(PM_HOMOGENEOUS,PM_HOMOGENEOUS_Access); type PM_HOMOGENEOUS_Array is array(Integer range <>) of PM_HOMOGENEOUS; type PM_LINE is record start : PM_POSE; End_Var : PM_POSE; uVec : PM_CARTESIAN; end record; type PM_LINE_Access is access all PM_LINE; procedure Update_Internal_PM_LINE(Cms_Ptr : in Cms.Cms_Access; Msg : in out PM_LINE); procedure Free is new Unchecked_Deallocation(PM_LINE,PM_LINE_Access); type PM_LINE_Array is array(Integer range <>) of PM_LINE; type PmHomogeneous is record tran : PmCartesian; rot : PmRotationMatrix; end record; type PmHomogeneous_Access is access all PmHomogeneous; procedure Update_Internal_PmHomogeneous(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmHomogeneous); procedure Free is new Unchecked_Deallocation(PmHomogeneous,PmHomogeneous_Access); type PmHomogeneous_Array is array(Integer range <>) of PmHomogeneous; type PmLine is record start : PmPose; End_Var : PmPose; uVec : PmCartesian; qVec : PmQuaternion; tmag : double; rmag : double; tmag_is_greater_than_rmag : int; tmag_zero : int; rmag_zero : int; end record; type PmLine_Access is access all PmLine; procedure Update_Internal_PmLine(Cms_Ptr : in Cms.Cms_Access; Msg : in out PmLine); procedure Free is new Unchecked_Deallocation(PmLine,PmLine_Access); type PmLine_Array is array(Integer range <>) of PmLine; end posemath_n_ada; -- End of Ada spec file posemath_n_ada.ads
onox/orka
Ada
2,070
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2013 Felix Krause <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. private with GL.Low_Level; package GL.Errors is -- not Pure because Error_Flag can change with each call pragma Preelaborate; type Error_Code is (No_Error, Invalid_Enum, Invalid_Value, Invalid_Operation, Stack_Overflow, Stack_Underflow, Out_Of_Memory, Invalid_Framebuffer_Operation, Context_Lost); Invalid_Operation_Error : exception; Out_Of_Memory_Error : exception; Invalid_Value_Error : exception; Stack_Overflow_Error : exception; Stack_Underflow_Error : exception; Invalid_Framebuffer_Operation_Error : exception; Context_Lost_Error : exception; Internal_Error : exception; procedure Raise_Exception_On_OpenGL_Error with Inline; private for Error_Code use (No_Error => 0, Invalid_Enum => 16#0500#, Invalid_Value => 16#0501#, Invalid_Operation => 16#0502#, Stack_Overflow => 16#0503#, Stack_Underflow => 16#0504#, Out_Of_Memory => 16#0505#, Invalid_Framebuffer_Operation => 16#0506#, Context_Lost => 16#0507#); for Error_Code'Size use Low_Level.Enum'Size; end GL.Errors;
AdaCore/langkit
Ada
1,045
adb
with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO; use Ada.Text_IO; with Langkit_Support.Errors; use Langkit_Support.Errors; with Langkit_Support.Text; use Langkit_Support.Text; with Libfoolang.Analysis; use Libfoolang.Analysis; procedure Main is U : constant Analysis_Unit := Create_Context.Get_From_Buffer (Filename => "main.txt", Buffer => "example"); N : constant Example := U.Root.As_Example; procedure Run (S1, S2 : Text_Type); --------- -- Run -- --------- procedure Run (S1, S2 : Text_Type) is begin Put (Image (S1, With_Quotes => True) & " = " & Image (S2, With_Quotes => True) & ": "); begin Put_Line (N.P_Compare_As_Symbols (S1, S2)'Image); exception when Exc : Property_Error => Put_Line ("Property_Error: " & Exception_Message (Exc)); end; end Run; begin Run ("Hello", "HELLO"); Run ("Foo", "Bar"); Run ("Foo.Bar", "Foo.Bar"); New_Line; Put_Line ("main.adb: Done"); end Main;
optikos/oasis
Ada
4,485
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Discriminant_Associations is function Create (Selector_Names : Program.Elements.Identifiers.Identifier_Vector_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access) return Discriminant_Association is begin return Result : Discriminant_Association := (Selector_Names => Selector_Names, Arrow_Token => Arrow_Token, Expression => Expression, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Selector_Names : Program.Elements.Identifiers .Identifier_Vector_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Discriminant_Association is begin return Result : Implicit_Discriminant_Association := (Selector_Names => Selector_Names, Expression => Expression, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Selector_Names (Self : Base_Discriminant_Association) return Program.Elements.Identifiers.Identifier_Vector_Access is begin return Self.Selector_Names; end Selector_Names; overriding function Expression (Self : Base_Discriminant_Association) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Expression; end Expression; overriding function Arrow_Token (Self : Discriminant_Association) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Arrow_Token; end Arrow_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Discriminant_Association) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Discriminant_Association) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Discriminant_Association) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Discriminant_Association'Class) is begin for Item in Self.Selector_Names.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Expression, Self'Unchecked_Access); null; end Initialize; overriding function Is_Discriminant_Association_Element (Self : Base_Discriminant_Association) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Discriminant_Association_Element; overriding function Is_Association_Element (Self : Base_Discriminant_Association) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Association_Element; overriding procedure Visit (Self : not null access Base_Discriminant_Association; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Discriminant_Association (Self); end Visit; overriding function To_Discriminant_Association_Text (Self : aliased in out Discriminant_Association) return Program.Elements.Discriminant_Associations .Discriminant_Association_Text_Access is begin return Self'Unchecked_Access; end To_Discriminant_Association_Text; overriding function To_Discriminant_Association_Text (Self : aliased in out Implicit_Discriminant_Association) return Program.Elements.Discriminant_Associations .Discriminant_Association_Text_Access is pragma Unreferenced (Self); begin return null; end To_Discriminant_Association_Text; end Program.Nodes.Discriminant_Associations;