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
14,478
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$ ------------------------------------------------------------------------------ -- Normalization utilities for public and system identifiers. ------------------------------------------------------------------------------ with Ada.Streams; with League.Characters.Latin; with League.Text_Codecs; package body Matreshka.XML_Catalogs.Normalization is use League.Characters.Latin; use type League.Characters.Universal_Character; PublicId_URN_Namespace : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("urn:publicid:"); UTF8_Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec (League.Strings.To_Universal_String ("utf-8")); -- Codec to encode URI. --------------------------------- -- Normalize_Public_Identifier -- --------------------------------- function Normalize_Public_Identifier (Public_Identifier : League.Strings.Universal_String) return League.Strings.Universal_String is Result : League.Strings.Universal_String; Char : League.Characters.Universal_Character; Is_Space : Boolean; begin -- [XML Catalogs] 6.2. Public Identifier Normalization -- -- In order to accurately and interoperably compare public identifiers, -- catalog processors must perform normalization on public identifiers -- in both the catalog and the input passed to them. -- -- All strings of white space in public identifiers must be normalized -- to single space characters (#x20), and leading and trailing white -- space must be removed. Is_Space := True; for J in 1 .. Public_Identifier.Length loop Char := Public_Identifier.Element (J); if Char = Space or Char = Carriage_Return or Char = Line_Feed or Char = Character_Tabulation then if not Is_Space then Is_Space := True; Result.Append (Space); end if; else Is_Space := False; Result.Append (Public_Identifier.Element (J)); end if; end loop; if Is_Space and not Result.Is_Empty then return Result.Slice (1, Result.Length - 1); else return Result; end if; end Normalize_Public_Identifier; ------------------- -- Normalize_URI -- ------------------- function Normalize_URI (URI : League.Strings.Universal_String) return League.Strings.Universal_String is use type Ada.Streams.Stream_Element; -- [XML Catalogs] 6.3. System Identifier and URI Normalization -- -- "In order to accurately and interoperably compare system identifiers -- and URI references, catalog processors must perform normalization. -- The normalization described in this section must be performed on -- system identifiers and URI references passed as input to the resolver -- and on strings in the catalog that are compared to them. -- -- URI references require encoding and escaping of certain characters. -- The disallowed characters include all non-ASCII characters, plus the -- excluded characters listed in Section 2.4 of [RFC 2396], except for -- the number sign (#) and percent sign (%) characters and the square -- bracket characters re-allowed in [RFC 2732]. These characters are -- summarized in Table 1, “Excluded US-ASCII Characters”. -- -- Table 1. Excluded US-ASCII Characters -- Hex Value Character Hex Value Character Hex Value Character -- 00 NUL 0F SI 1E RS -- 01 SOH 10 DLE 1F US -- 02 STX 11 DC1 20 (space) -- 03 ETX 12 DC2 22 " -- 04 EOT 13 DC3 3C < -- 05 ENQ 14 DC4 3E > -- 06 ACK 15 NAK 5C \ -- 07 BEL 16 SYN 5E ^ -- 08 BS 17 ETB 60 ` -- 09 HT 18 CAN 7B { -- 0A LF 19 EM 7C | -- 0B VT 1A SUB 7D } -- 0C FF 1B ESC 7F DEL -- 0D CR 1C FS -- 0E SO 1D GS -- -- Catalog processors must escape disallowed characters as follows: -- -- 1. Each disallowed character is converted to UTF-8 [RFC 2279] as one -- or more bytes. -- -- 2. Any octets corresponding to a disallowed character are escaped -- with the URI escaping mechanism (that is, converted to %HH, where HH -- is the hexadecimal notation of the octet value). If escaping must be -- performed, uppercase hexadecimal characters should be used. -- -- 3. The original character is replaced by the resulting character -- sequence. Note that this normalization process is idempotent: -- repeated normalization does not change a normalized URI reference." -- Actual algoriphm is slightly differ: it converts URI into UTF-8 and -- escape all disallowed characters. This produce equivalent result, -- because all ASCII characters are mapped to the elements with the same -- codes, and all non-ASCII characters are mapped to multibyte sequences -- with codes outside of ASCII range. Hex : constant array (Ada.Streams.Stream_Element range 0 .. 15) of Wide_Wide_Character := "0123456789ABCDEF"; Encoded : constant Ada.Streams.Stream_Element_Array := UTF8_Codec.Encode (URI).To_Stream_Element_Array; Result : League.Strings.Universal_String; begin for J in Encoded'Range loop case Encoded (J) is when 16#00# .. 16#20# -- NUL .. (space) | 16#22# -- " | 16#3C# -- < | 16#3E# -- > | 16#5C# -- \ | 16#5E# -- ^ | 16#60# -- ` | 16#7B# -- { | 16#7C# -- | | 16#7D# -- } | 16#7F# -- DEL | 16#80# .. 16#FF# -- non-ASCII codes => Result.Append ('%'); Result.Append (Hex (Encoded (J) / 16)); Result.Append (Hex (Encoded (J) mod 16)); when others => Result.Append (Wide_Wide_Character'Val (Encoded (J))); end case; end loop; return Result; end Normalize_URI; ---------------- -- Unwrap_URN -- ---------------- procedure Unwrap_URN (URI : League.Strings.Universal_String; Identifier : out League.Strings.Universal_String; Unwrapped : out Boolean) is -- [XML Catalogs] 6.4. URN "Unwrapping" -- -- This OASIS Standard requires processors to implement special -- treatment of URNs in the publicid URN Namespace ([RFC 3151]). -- -- URNs of this form must, in some contexts, be "unwrapped" by the -- Catalog processor. This unwrapping translates the URN form of the -- public identifier back into the standard ISO 8879 form for the -- purposes of subsequent catalog processing. -- -- Unwrapping a urn:publicid: URN is accomplished by transcribing -- characters in the URN according to the fol- lowing table after -- discarding the leading urn:publicid: string: -- -- URN Characters Public Identifier Characters -- + " " (space) -- : // -- ; :: -- %2B + -- %3A : -- %2F / -- %3B ; -- %27 ' -- %3F ? -- %23 # -- %25 % -- -- URNs in the publicid namespace should always represent normalized -- public identifiers (Section 6.2, “Public Identifier Normalization”). -- In the event that an unwrapped public identifier is not normalized, -- the catalog processor must normalize it." Char : League.Characters.Universal_Character; Char_1 : League.Characters.Universal_Character; Char_2 : League.Characters.Universal_Character; J : Natural; begin Identifier := League.Strings.Empty_Universal_String; if not URI.Starts_With (PublicId_URN_Namespace) then -- Return when URI is not in publicid URN namespace. Unwrapped := False; return; end if; J := PublicId_URN_Namespace.Length + 1; while J <= URI.Length loop Char := URI.Element (J); if Char = Plus_Sign then Identifier.Append (Space); elsif Char = Colon then Identifier.Append (Solidus); Identifier.Append (Solidus); elsif Char = Semicolon then Identifier.Append (Colon); Identifier.Append (Colon); elsif Char = Percent_Sign and then J + 2 <= URI.Length then Char_1 := URI.Element (J + 1); Char_2 := URI.Element (J + 2); if Char_1 = Digit_Two and Char_2 = Latin_Capital_Letter_B then Identifier.Append (Plus_Sign); elsif Char_1 = Digit_Three and Char_2 = Latin_Capital_Letter_A then Identifier.Append (Colon); elsif Char_1 = Digit_Two and Char_2 = Latin_Capital_Letter_F then Identifier.Append (Solidus); elsif Char_1 = Digit_Three and Char_2 = Latin_Capital_Letter_B then Identifier.Append (Semicolon); elsif Char_1 = Digit_Two and Char_2 = Digit_Seven then Identifier.Append (Apostrophe); elsif Char_1 = Digit_Three and Char_2 = Latin_Capital_Letter_F then Identifier.Append (Question_Mark); elsif Char_1 = Digit_Two and Char_2 = Digit_Three then Identifier.Append (Number_Sign); elsif Char_1 = Digit_Two and Char_2 = Digit_Five then Identifier.Append (Percent_Sign); else Identifier.Append (Char); Identifier.Append (Char_1); Identifier.Append (Char_2); end if; J := J + 2; else Identifier.Append (Char); end if; J := J + 1; end loop; Identifier := Normalize_Public_Identifier (Identifier); Unwrapped := True; end Unwrap_URN; end Matreshka.XML_Catalogs.Normalization;
sungyeon/drake
Ada
256
ads
pragma License (Unrestricted); generic type Object (<>) is limited private; type Name is access Object; procedure Ada.Unchecked_Deallocation (X : in out Name) with Import, Convention => Intrinsic; pragma Preelaborate (Ada.Unchecked_Deallocation);
jhumphry/parse_args
Ada
3,192
adb
-- parse_args-generic_indefinite_options.ads -- A simple command line option parser -- Copyright (c) 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. pragma Profile(No_Implementation_Extensions); package body Parse_Args.Generic_Indefinite_Options is use Ada.Finalization; ---------------- -- Set_Option -- ---------------- procedure Set_Option (O : in out Element_Option; A : in out Argument_Parser'Class) is begin if O.Set then A.State := Finish_Erroneous; A.Message := To_Unbounded_String("Argument cannot be specified twice."); else A.State := Required_Argument; end if; end Set_Option; ------------------------- -- Set_Option_Argument -- ------------------------- procedure Set_Option_Argument (O : in out Element_Option; Arg : in String; A : in out Argument_Parser'Class) is Constraint_Met : Boolean := True; begin O.Set := True; O.Value := Value(Arg); Valid(O.Value, Constraint_Met); if not Constraint_Met then A.State := Finish_Erroneous; A.Message := To_Unbounded_String(Arg & " does not meet constraints"); end if; exception when Constraint_Error => A.State := Finish_Erroneous; A.Message := To_Unbounded_String("Not a valid value: " & Arg); end Set_Option_Argument; ----------- -- Value -- ----------- function Value (A : in Argument_Parser; Name : in String) return Element_Access is begin if A.Arguments.Contains(Name) then if A.Arguments(Name).all in Element_Option'Class then return Element_Option'Class(A.Arguments(Name).all).Value; else raise Constraint_Error with "Argument " & Name & " is not of the right type."; end if; else raise Constraint_Error with "No argument: " & Name & "."; end if; end Value; ----------------- -- Make_Option -- ----------------- function Make_Option return Option_Ptr is (new Element_Option'(Limited_Controlled with Set => False, Value =>null )); -------------- -- Finalize -- -------------- procedure Finalize(Object : in out Element_Option) is begin if Object.Value /= null then Free_Element(Object.Value); end if; end Finalize; end Parse_Args.Generic_Indefinite_Options;
DeanHnter/chocolate-box
Ada
3,826
adb
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2004 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- -- $Id: buffer_demo.adb,v 1.1 2006/02/23 21:33:49 BayStone Exp $ -- This demo program provided by Dr Steve Sangwine <[email protected]> -- -- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer -- of exactly the correct size is used for decompressed data, and the last -- few bytes passed in to Zlib are checksum bytes. -- This program compresses a string of text, and then decompresses the -- compressed text into a buffer of the same size as the original text. with Ada.Streams; use Ada.Streams; with Ada.Text_IO; with ZLib; use ZLib; procedure Buffer_Demo is EOL : Character renames ASCII.LF; Text : constant String := "Four score and seven years ago our fathers brought forth," & EOL & "upon this continent, a new nation, conceived in liberty," & EOL & "and dedicated to the proposition that `all men are created equal'."; Source : Stream_Element_Array (1 .. Text'Length); for Source'Address use Text'Address; begin Ada.Text_IO.Put (Text); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes"); declare Compressed_Data : Stream_Element_Array (1 .. Text'Length); L : Stream_Element_Offset; begin Compress : declare Compressor : Filter_Type; I : Stream_Element_Offset; begin Deflate_Init (Compressor); -- Compress the whole of T at once. Translate (Compressor, Source, I, Compressed_Data, L, Finish); pragma Assert (I = Source'Last); Close (Compressor); Ada.Text_IO.Put_Line ("Compressed size : " & Stream_Element_Offset'Image (L) & " bytes"); end Compress; -- Now we decompress the data, passing short blocks of data to Zlib -- (because this demonstrates the problem - the last block passed will -- contain checksum information and there will be no output, only a -- check inside Zlib that the checksum is correct). Decompress : declare Decompressor : Filter_Type; Uncompressed_Data : Stream_Element_Array (1 .. Text'Length); Block_Size : constant := 4; -- This makes sure that the last block contains -- only Adler checksum data. P : Stream_Element_Offset := Compressed_Data'First - 1; O : Stream_Element_Offset; begin Inflate_Init (Decompressor); loop Translate (Decompressor, Compressed_Data (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)), P, Uncompressed_Data (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last), O, No_Flush); Ada.Text_IO.Put_Line ("Total in : " & Count'Image (Total_In (Decompressor)) & ", out : " & Count'Image (Total_Out (Decompressor))); exit when P = L; end loop; Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line ("Decompressed text matches original text : " & Boolean'Image (Uncompressed_Data = Source)); end Decompress; end; end Buffer_Demo;
reznikmm/matreshka
Ada
4,046
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Holders.Long_Floats; with AMF3.Objects; package body AMF3.Slots.Long_Floats is --------- -- Get -- --------- overriding function Get (Self : Long_Float_Slot) return League.Holders.Holder is begin return League.Holders.Long_Floats.To_Holder (Self.Value (Self.Current_Value)); end Get; --------- -- Set -- --------- procedure Set (Self : in out Long_Float_Slot; To : Long_Float) is begin if Self.Current_Value = Self.Initial_Value then Self.Current_Value := not Self.Current_Value; end if; Self.Value (Self.Current_Value) := To; Self.Object.On_Property_Changed; end Set; end AMF3.Slots.Long_Floats;
AdaCore/gpr
Ada
1,078
adb
with p1_2; use p1_2; with p2_1; use p2_1; package body p1_1 is function p1_1_0 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p1_2_0 (Item - 1)) + Long_Long_Integer (p2_1_0 (Item - 2)); return Integer (Result rem Long_Long_Integer (Integer'Last)); end p1_1_0; function p1_1_1 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p1_2_1 (Item - 1)) + Long_Long_Integer (p2_1_1 (Item - 2)); return Integer (Result rem Long_Long_Integer (Integer'Last)); end p1_1_1; function p1_1_2 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p1_2_2 (Item - 1)) + Long_Long_Integer (p2_1_2 (Item - 2)); return Integer (Result rem Long_Long_Integer (Integer'Last)); end p1_1_2; end p1_1;
zhmu/ananas
Ada
7,155
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (DJGPP Version) -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). pragma No_Elaboration_Code_All; -- Allow the use of that restriction in units that WITH this unit type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1); Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1; Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := Standard'Max_Integer_Size - 1; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 0.01; -- Storage-related Declarations type Address is private; pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; Word_Size : constant := 32; Memory_Size : constant := 2 ** 32; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := Low_Order_First; pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) Max_Priority : constant Positive := 30; Max_Interrupt_Priority : constant Positive := 31; subtype Any_Priority is Integer range 0 .. 31; subtype Priority is Any_Priority range 0 .. 30; subtype Interrupt_Priority is Any_Priority range 31 .. 31; Default_Priority : constant Priority := 15; private type Address is mod Memory_Size; Null_Address : constant Address := 0; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used -- by the compiler. They are in the private part of System, where they -- can be accessed using the special circuitry in the Targparm unit -- whose source should be consulted for more detailed descriptions -- of the individual switch values. Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := False; Exit_Status_Supported : constant Boolean := True; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Atomic_Primitives : constant Boolean := False; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; Frontend_Exceptions : constant Boolean := False; ZCX_By_Default : constant Boolean := True; end System;
stcarrez/ada-util
Ada
8,847
adb
----------------------------------------------------------------------- -- util-dates-iso8601 -- ISO8601 dates -- Copyright (C) 2011, 2013, 2015, 2016, 2017, 2018, 2020, 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Dates.ISO8601 is -- ------------------------------ -- Parses an ISO8601 date and return it as a calendar time. -- Raises Constraint_Error if the date format is not recognized. -- ------------------------------ function Value (Date : in String) return Ada.Calendar.Time is use Ada.Calendar; use Ada.Calendar.Formatting; use Ada.Calendar.Time_Zones; Result : Date_Record; Pos : Natural; begin if Date'Length < 4 then raise Constraint_Error with "Invalid date"; end if; Result.Hour := 0; Result.Minute := 0; Result.Second := 0; Result.Sub_Second := 0.0; Result.Time_Zone := 0; Result.Year := Year_Number'Value (Date (Date'First .. Date'First + 3)); if Date'Length = 4 then -- ISO8601 date: YYYY Result.Month := 1; Result.Month_Day := 1; elsif Date'Length = 7 and then Date (Date'First + 4) = '-' then -- ISO8601 date: YYYY-MM Result.Month := Month_Number'Value (Date (Date'First + 5 .. Date'Last)); Result.Month_Day := 1; elsif Date'Length = 8 then -- ISO8601 date: YYYYMMDD Result.Month := Month_Number'Value (Date (Date'First + 4 .. Date'First + 5)); Result.Month_Day := Day_Number'Value (Date (Date'First + 6 .. Date'First + 7)); elsif Date'Length >= 9 and then Date (Date'First + 4) = '-' and then Date (Date'First + 7) = '-' then -- ISO8601 date: YYYY-MM-DD Result.Month := Month_Number'Value (Date (Date'First + 5 .. Date'First + 6)); Result.Month_Day := Day_Number'Value (Date (Date'First + 8 .. Date'First + 9)); -- ISO8601 date: YYYY-MM-DDTHH if Date'Length > 12 then if Date (Date'First + 10) /= 'T' then raise Constraint_Error with "invalid date"; end if; Result.Hour := Hour_Number'Value (Date (Date'First + 11 .. Date'First + 12)); Pos := Date'First + 13; end if; if Date'Length > 15 then if Date (Date'First + 13) /= ':' then raise Constraint_Error with "invalid date"; end if; Result.Minute := Minute_Number'Value (Date (Date'First + 14 .. Date'First + 15)); Pos := Date'First + 16; end if; if Date'Length >= 17 then if Date (Date'First + 16) /= ':' or else Date'Length <= 18 then raise Constraint_Error with "invalid date"; end if; Result.Second := Second_Number'Value (Date (Date'First + 17 .. Date'First + 18)); Pos := Date'First + 19; if Pos <= Date'Last then if Date (Pos) = '.' or else Date (Pos) = ',' then if Date'Length < 22 then raise Constraint_Error with "invalid date"; end if; declare Value : constant Natural := Natural'Value (Date (Pos + 1 .. Pos + 3)); begin Result.Sub_Second := Second_Duration (Duration (Value) / 1000.0); end; Pos := Pos + 4; end if; if Pos <= Date'Last then -- ISO8601 timezone: Z -- ISO8601 timezone: +hh or -hh -- ISO8601 timezone: +hhmm or -hhmm -- ISO8601 timezone: +hh:mm or -hh:mm if Date (Pos) = 'Z' then if Pos /= Date'Last then raise Constraint_Error with "invalid date"; end if; elsif Date (Pos) /= '-' and then Date (Pos) /= '+' then raise Constraint_Error with "invalid date"; elsif Pos + 2 = Date'Last then Result.Time_Zone := 60 * Time_Offset'Value (Date (Pos + 1 .. Date'Last)); elsif Pos + 4 = Date'Last then Result.Time_Zone := 60 * Time_Offset'Value (Date (Pos + 1 .. Pos + 2)) + Time_Offset'Value (Date (Pos + 3 .. Date'Last)); elsif Pos + 5 = Date'Last and then Date (Pos + 3) = ':' then Result.Time_Zone := 60 * Time_Offset'Value (Date (Pos + 1 .. Pos + 2)) + Time_Offset'Value (Date (Pos + 4 .. Date'Last)); else raise Constraint_Error with "invalid date"; end if; end if; end if; end if; else raise Constraint_Error with "invalid date"; end if; return Time_Of (Result); end Value; -- ------------------------------ -- Return the ISO8601 date. -- ------------------------------ function Image (Date : in Ada.Calendar.Time) return String is D : Date_Record; begin Split (D, Date); return Image (D); end Image; function Image (Date : in Date_Record) return String is To_Char : constant array (0 .. 9) of Character := "0123456789"; Result : String (1 .. 10) := "0000-00-00"; begin Result (1) := To_Char (Date.Year / 1000); Result (2) := To_Char (Date.Year / 100 mod 10); Result (3) := To_Char (Date.Year / 10 mod 10); Result (4) := To_Char (Date.Year mod 10); Result (6) := To_Char (Date.Month / 10); Result (7) := To_Char (Date.Month mod 10); Result (9) := To_Char (Date.Month_Day / 10); Result (10) := To_Char (Date.Month_Day mod 10); return Result; end Image; function Image (Date : in Ada.Calendar.Time; Precision : in Precision_Type) return String is D : Date_Record; begin Split (D, Date); return Image (D, Precision); end Image; function Image (Date : in Date_Record; Precision : in Precision_Type) return String is use type Ada.Calendar.Time_Zones.Time_Offset; To_Char : constant array (0 .. 9) of Character := "0123456789"; Result : String (1 .. 29) := "0000-00-00T00:00:00.000-00:00"; N, Tz : Natural; begin Result (1) := To_Char (Date.Year / 1000); Result (2) := To_Char (Date.Year / 100 mod 10); Result (3) := To_Char (Date.Year / 10 mod 10); Result (4) := To_Char (Date.Year mod 10); if Precision = YEAR then return Result (1 .. 4); end if; Result (6) := To_Char (Date.Month / 10); Result (7) := To_Char (Date.Month mod 10); if Precision = MONTH then return Result (1 .. 7); end if; Result (9) := To_Char (Date.Month_Day / 10); Result (10) := To_Char (Date.Month_Day mod 10); if Precision = DAY then return Result (1 .. 10); end if; Result (12) := To_Char (Date.Hour / 10); Result (13) := To_Char (Date.Hour mod 10); if Precision = HOUR then return Result (1 .. 13); end if; Result (15) := To_Char (Date.Minute / 10); Result (16) := To_Char (Date.Minute mod 10); if Precision = MINUTE then return Result (1 .. 16); end if; Result (18) := To_Char (Date.Second / 10); Result (19) := To_Char (Date.Second mod 10); if Precision = SECOND then return Result (1 .. 19); end if; N := Natural (Date.Sub_Second * 1000.0); Result (21) := To_Char (N / 100); Result (22) := To_Char ((N mod 100) / 10); Result (23) := To_Char (N mod 10); if Date.Time_Zone < 0 then Tz := Natural (-Date.Time_Zone); else Result (24) := '+'; Tz := Natural (Date.Time_Zone); end if; Result (25) := To_Char (Tz / 600); Result (26) := To_Char ((Tz / 60) mod 10); Tz := Tz mod 60; Result (28) := To_Char (Tz / 10); Result (29) := To_Char (Tz mod 10); return Result; end Image; end Util.Dates.ISO8601;
Vovanium/libusb1.0-ada
Ada
12,548
ads
with Interfaces; use Interfaces; -- Definitions of standard USB protocol: Data structures, Values, etc package USB.Protocol is -- Those types are used in structures -- Per Table 9-3 USB 3-2 rev 1.0 type Request_Type_Code is ( Request_Type_Standard, Request_Type_Class, Request_Type_Vendor, Request_Type_Reserved ); for Request_Type_Code use ( 16#00#, 16#01#, 16#02#, 16#03# ); type Request_Recipient is ( Recipient_Device, Recipient_Interface, Recipient_Endpoint, Recipient_Other, Recipient_Vendor_Specific ); for Request_Recipient use ( 0, 1, 2, 3, 31 ); type Transfer_Direction is ( Direction_Host_to_Device, Direction_Device_to_Host ); for Transfer_Direction use (0, 1); type Request_Type is record Recipient: Request_Recipient; Code: Request_Type_Code; Direction: Transfer_Direction; end record; for Request_Type use record Recipient at 0 range 0..4; Code at 0 range 5..6; Direction at 0 range 7..7; end record; for Request_Type'Size use 8; pragma Convention(C_Pass_by_Copy, Request_Type); type Request_Code is mod 2**8; for Request_Code'Size use 8; -- Standard requests type Standard_Request_Code is ( Request_Get_Status, Request_Clear_Feature, Request_Set_Feature, Request_Set_Address, Request_Get_Descriptor, Request_Set_Descriptor, Request_Get_Configuration, Request_Set_Configuration, Request_Get_Interface, Request_Set_Interface, Request_Synch_Frame, Request_Set_Sel, Request_Isoch_Delay ); for Standard_Request_Code use ( 0, 1, 3, 5, 6, 7, 8, 9, 16#0A#, 16#0B#, 16#0C#, 16#30#, 16#31# ); type Control_Setup is record bmRequestType: Request_Type; bRequest: Request_Code; wValue: Unsigned_16; wIndex: Unsigned_16; wLength: Unsigned_16; end record; ---- Descriptors type Class_Code is ( Class_Per_Interface, Class_Audio, Class_Comm, Class_HID, Class_Physical, Class_Image, Class_Printer, Class_Mass_Storage, Class_Hub, Class_Data, Class_Smart_Card, Class_Content_Security, Class_Video, Class_Personal_Healthcare, Class_Diagnostic_Device, Class_Wireless, Class_Application, Class_Vendor_Spec ) with Size => 8; for Class_Code use ( 16#00#, 16#01#, 16#02#, 16#03#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#, 16#0A#, 16#0B#, 16#0D#, 16#0E#, 16#0F#, 16#DC#, 16#E0#, 16#FE#, 16#FF# ); -- Per Table 9-6 of USB 3.2 rev 1.0 type Descriptor_Type is ( DT_Device, DT_Config, DT_String, DT_Interface, DT_Endpoint, DT_BOS, DT_Device_Capability, DT_HID, -- ?? DT_Report, DT_Physical, -- ?? ?? DT_Hub, DT_Superspeed_Hub, -- ?? ?? DT_SS_Endpoint_Companion ) with Size => 8; for Descriptor_Type use ( 1, 2, 3, 4, 5, 15, 16, 16#21#, 16#22#, 16#23#, 16#29#, 16#2A#, 48 ); type Vendor_Id is mod 2**16; pragma Convention(C, Vendor_Id); type Product_Id is mod 2**16; pragma Convention(C, Product_Id); -- Per Table 9-11 of USB 3.2 rev 1.0 type Device_Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bcdUSB: Unsigned_16; bDeviceClass: Class_Code; bDeviceSubClass: Unsigned_8; -- Should be distinct type bDeviceProtocol: Unsigned_8; -- Should be distinct type bMaxPacketSize0: Unsigned_8; idVendor: Vendor_Id; idProduct: Product_Id; bcdDevice: Unsigned_16; iManufacturer: Unsigned_8; iProduct: Unsigned_8; iSerialNumber: Unsigned_8; bNumConfigurations: Unsigned_8; end record with Size => 18*8; pragma Convention(C, Device_Descriptor); -- Per Table 9-12 of USB 3.2 rev 1.0 type BOS_Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; wTotalLength: Unsigned_16; bNumDeviceCaps: Unsigned_8; -- Dev_Capability: BOS_Dev_Capability_Descriptor_Array; end record with Size => 5*8; pragma Convention(C, BOS_Descriptor); -- Per Table 9-14 of USB 3.2 rev 1.0 type BOS_Device_Capability_Type is ( Wireless_USB, USB_2_0_Extension, Superspeed_USB, Container_Id, Platform, Power_Delivery_Capability, Battery_Info_Capability, PD_Consumer_Port_Capability, PD_Provider_Port_Capability, Superspeed_Plus, Precision_Time_Meaurement, Wireless_USB_Ext, Billboard, Authentication, Billboard_Ex, Configuration_Summary ) with Size => 8; for BOS_Device_Capability_Type use ( 16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#, 16#0A#, 16#0B#, 16#0C#, 16#0D#, 16#0E#, 16#0F#, 16#10# ); -- Per Table 9-13 of USB 3.2 rev 1.0 type BOS_Device_Capability_Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bDevCapabilityType: BOS_Device_Capability_Type; -- Dev_Capability_Data: BOS_Dev_Capability_Data_Array; end record with Size => 3*8; pragma Convention(C, BOS_Device_Capability_Descriptor); -- Per Table 9-15 of USB 3.2 rev 1.0 package USB_2_0_Extension_Descriptors is pragma Warnings (Off, "24 bits of ""Attributes"" unused"); type Attributes is record LPM: Boolean; end record with Size => 32; for Attributes use record LPM at 0 range 1..1; end record; pragma Convention(C_Pass_by_Copy, Attributes); pragma Warnings (On, "24 bits of ""Attributes"" unused"); type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bDevCapabilityType: BOS_Device_Capability_Type; bmAttributes: Attributes; end record with Size => 7*8; pragma Convention(C, Descriptor); end USB_2_0_Extension_Descriptors; subtype USB_2_0_Extension_Descriptor is USB_2_0_Extension_Descriptors.Descriptor; -- Per Table 9-16 of USB 2.3 rev 1.0 package Superspeed_USB_Device_Capability_Descriptors is type Attributes is record LTM_Capable: Boolean; end record; for Attributes use record LTM_Capable at 0 range 1..1; end record; for Attributes'Size use 8; pragma Convention(C_Pass_by_Copy, Attributes); pragma Warnings (Off, "8 bits of ""Speeds_Supported"" unused"); type Speeds_Supported is record Low: Boolean; Full: Boolean; High: Boolean; Gen1: Boolean; end record; for Speeds_Supported use record Low at 0 range 0..0; Full at 0 range 1..1; High at 0 range 2..2; Gen1 at 0 range 3..3; end record; for Speeds_Supported'Size use 16; pragma Convention(C_Pass_by_Copy, Speeds_Supported); pragma Warnings (On, "8 bits of ""Speeds_Supported"" unused"); type Functionality_Support is ( Low_Speed, Full_Speed, High_Speed, Gen1_Speed ) with Size => 8; for Functionality_Support use ( 0, 1, 2, 3 ); type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bDevCapabilityType: BOS_Device_Capability_Type; bmAttributes: Attributes; wSpeedsSupported: Speeds_Supported; bFunctionalitySupport: Functionality_Support; bU1DevExitLat: Unsigned_8; bU2DevExitLat: Unsigned_16; end record with Size => 10*8; pragma Convention(C, Descriptor); end Superspeed_USB_Device_Capability_Descriptors; subtype Superspeed_USB_Device_Capability_Descriptor is Superspeed_USB_Device_Capability_Descriptors.Descriptor; -- Per Table 9-17 of USB 2.3 rev 1.0 package Container_Id_Descriptors is type UUID is array (0..15) of Unsigned_8; type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bDevCapabilityType: BOS_Device_Capability_Type; bReserved: Unsigned_8; ContainerID: UUID; end record with Size => 20*8; pragma Convention(C, Descriptor); end Container_Id_Descriptors; subtype Container_Id_Descriptor is Container_Id_Descriptors.Descriptor; -- Per Table 9-22 of USB 2.3 rev 1.0 package Configuration_Descriptors is type Attributes is record Remote_Wakeup: Boolean; Self_Powered: Boolean; Set_True: Boolean; end record with Size => 8; for Attributes use record Remote_Wakeup at 0 range 5..5; Self_Powered at 0 range 6..6; Set_True at 0 range 7..7; end record; pragma Convention(C_Pass_by_Copy, Attributes); type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; wTotalLength: Unsigned_16; bNumInterfaces: Unsigned_8; bConfigurationValue: Unsigned_8; iConfiguration: Unsigned_8; bmAttributes: Attributes; bMaxPower: Unsigned_8; end record with Size => 9*8; end Configuration_Descriptors; subtype Configuration_Descriptor is Configuration_Descriptors.Descriptor; -- Per Table 9-24 of USB 2.3 rev 1.0 package Interface_Descriptors is type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bInterfaceNumber: Unsigned_8; bAlternateSetting: Unsigned_8; bNumEndpoints: Unsigned_8; bInterfaceClass: Class_Code; bInterfaceSubClass: Unsigned_8; bInterfaceProtocol: Unsigned_8; iInterface: Unsigned_8; end record with Size => 9*8; end Interface_Descriptors; subtype Interface_Descriptor is Interface_Descriptors.Descriptor; -- !!!should be record (7 bit number + 1 bit direction) type Endpoint_Address is mod 2**8; for Endpoint_Address'Size use 8; pragma Convention(C, Endpoint_Address); -- Per Table 9-25 of USB 2.3 rev 1.0 package Endpoint_Descriptors is type Transfer_Type is ( Transfer_Type_Control, Transfer_Type_Isochronous, Transfer_Type_Bulk, Transfer_Type_Interrupt ); for Transfer_Type use ( 0, 1, 2, 3 ); pragma Convention(C, Transfer_Type); type Iso_Sync_Type is ( Iso_Sync_Type_None, Iso_Sync_Type_Async, Iso_Sync_Type_Adaptive, Iso_Sync_Type_Sync ); for Iso_Sync_Type use ( 0, 1, 2, 3 ); pragma Convention(C, Iso_Sync_Type); type Iso_Usage_Type is ( Iso_Usage_Type_Data, Iso_Usage_Type_Feedback, Iso_Usage_Type_Implicit ); pragma Convention(C, Iso_Usage_Type); type Attributes is record Transfer_Type: Endpoint_Descriptors.Transfer_Type; Iso_Sync_Type: Endpoint_Descriptors.Iso_Sync_Type; Iso_Usage_Type: Endpoint_Descriptors.Iso_Usage_Type; end record with Size => 8; for Attributes use record Transfer_Type at 0 range 0..1; Iso_Sync_Type at 0 range 2..3; Iso_Usage_Type at 0 range 4..5; end record; pragma Convention(C_Pass_by_Copy, Attributes); type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bEndpointAddress: Endpoint_Address; bmAttributes: Attributes; wMaxPacketSize: Unsigned_16; bInterval: Unsigned_8; end record with Size => 7*8; pragma Convention(C, Descriptor); end Endpoint_Descriptors; subtype Endpoint_Descriptor is Endpoint_Descriptors.Descriptor; -- Per Table 9-27 of USB 2.3 rev 1.0 package Superspeed_Endpoint_Companion_Descriptors is type Attributes is mod 2**8; for Attributes'Size use 8; pragma Convention(C, Attributes); type Descriptor is record bLength: Unsigned_8; bDescriptorType: Descriptor_Type; bMaxBurst: Unsigned_8; bmAttributes: Attributes; wBytesPerInterval: Unsigned_16; end record with Size => 6*8; pragma Convention(C, Descriptor); end Superspeed_Endpoint_Companion_Descriptors; subtype Superspeed_Endpoint_Companion_Descriptor is Superspeed_Endpoint_Companion_Descriptors.Descriptor; end USB.Protocol;
michael-hardeman/contacts_app
Ada
14,445
adb
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../../License.txt package body AdaBase.Driver.Base.SQLite is --------------- -- execute -- --------------- overriding function execute (driver : SQLite_Driver; sql : String) return Affected_Rows is trsql : String := CT.trim_sql (sql); nquery : Natural := CT.count_queries (trsql); aborted : constant Affected_Rows := 0; err1 : constant CT.Text := CT.SUS ("ACK! Execution attempted on inactive connection"); err2 : constant String := "Driver is configured to allow only one query at " & "time, but this SQL contains multiple queries: "; begin if not driver.connection_active then -- Fatal attempt to query an unccnnected database driver.log_problem (category => execution, message => err1, break => True); return aborted; end if; if nquery > 1 and then not driver.trait_multiquery_enabled then -- Fatal attempt to execute multiple queries when it's not permitted driver.log_problem (category => execution, message => CT.SUS (err2 & trsql), break => True); return aborted; end if; declare result : Affected_Rows; begin -- SQLITE3 execute supports multiquery in all cases, so it is not -- necessary to loop through subqueries. We send the trimmed -- compound query as it was received. driver.connection.execute (trsql); driver.log_nominal (execution, CT.SUS (trsql)); result := driver.connection.rows_affected_by_execution; return result; exception when ACS.QUERY_FAIL => driver.log_problem (category => execution, message => CT.SUS (trsql), pull_codes => True); return aborted; end; end execute; ------------------------------------------------------------------------ -- ROUTINES OF ALL DRIVERS NOT COVERED BY INTERFACES (TECH REASON) -- ------------------------------------------------------------------------ ------------- -- query -- ------------- function query (driver : SQLite_Driver; sql : String) return ASS.SQLite_statement is begin return driver.private_statement (sql => sql, prepared => False); end query; --------------- -- prepare -- --------------- function prepare (driver : SQLite_Driver; sql : String) return ASS.SQLite_statement is begin return driver.private_statement (sql => sql, prepared => True); end prepare; -------------------- -- query_select -- -------------------- function query_select (driver : SQLite_Driver; distinct : Boolean := False; tables : String; columns : String; conditions : String := blankstring; groupby : String := blankstring; having : String := blankstring; order : String := blankstring; null_sort : Null_Priority := native; limit : Trax_ID := 0; offset : Trax_ID := 0) return ASS.SQLite_statement is begin return driver.private_statement (prepared => False, sql => driver.sql_assemble (distinct => distinct, tables => tables, columns => columns, conditions => conditions, groupby => groupby, having => having, order => order, null_sort => null_sort, limit => limit, offset => offset)); end query_select; ---------------------- -- prepare_select -- ---------------------- function prepare_select (driver : SQLite_Driver; distinct : Boolean := False; tables : String; columns : String; conditions : String := blankstring; groupby : String := blankstring; having : String := blankstring; order : String := blankstring; null_sort : Null_Priority := native; limit : Trax_ID := 0; offset : Trax_ID := 0) return ASS.SQLite_statement is begin return driver.private_statement (prepared => True, sql => driver.sql_assemble (distinct => distinct, tables => tables, columns => columns, conditions => conditions, groupby => groupby, having => having, order => order, null_sort => null_sort, limit => limit, offset => offset)); end prepare_select; ------------------------------------------------------------------------ -- PRIVATE ROUTINES NOT COVERED BY INTERFACES -- ------------------------------------------------------------------------ ------------------ -- initialize -- ------------------ overriding procedure initialize (Object : in out SQLite_Driver) is begin Object.connection := Object.local_connection'Unchecked_Access; Object.dialect := driver_sqlite; end initialize; ----------------------- -- private_connect -- ----------------------- overriding procedure private_connect (driver : out SQLite_Driver; database : String; username : String; password : String; hostname : String := blankstring; socket : String := blankstring; port : Posix_Port := portless) is err1 : constant CT.Text := CT.SUS ("ACK! Reconnection attempted on active connection"); nom : constant CT.Text := CT.SUS ("Connection to " & database & " database succeeded."); begin if driver.connection_active then driver.log_problem (category => execution, message => err1); return; end if; driver.connection.connect (database => database, username => username, password => password, socket => socket, hostname => hostname, port => port); driver.connection_active := driver.connection.all.connected; driver.log_nominal (category => connecting, message => nom); exception when Error : others => driver.log_problem (category => connecting, break => True, message => CT.SUS (ACS.EX.Exception_Message (X => Error))); end private_connect; ------------------------- -- private_statement -- ------------------------- function private_statement (driver : SQLite_Driver; sql : String; prepared : Boolean) return ASS.SQLite_statement is stype : AID.ASB.Stmt_Type := AID.ASB.direct_statement; logcat : Log_Category := execution; err1 : constant CT.Text := CT.SUS ("ACK! Query attempted on inactive connection"); duplicate : aliased String := sql; begin if prepared then stype := AID.ASB.prepared_statement; logcat := statement_preparation; end if; if driver.connection_active then declare statement : ASS.SQLite_statement (type_of_statement => stype, log_handler => logger'Access, sqlite_conn => ACS.SQLite_Connection_Access (driver.connection), initial_sql => duplicate'Unchecked_Access, con_error_mode => driver.trait_error_mode, con_case_mode => driver.trait_column_case, con_max_blob => driver.trait_max_blob_size); begin if not prepared then if statement.successful then driver.log_nominal (category => logcat, message => CT.SUS ("query succeeded," & statement.rows_returned'Img & " rows returned")); else driver.log_nominal (category => execution, message => CT.SUS ("Query failed!")); end if; end if; return statement; exception when RES : others => -- Fatal attempt to prepare a statement -- Logged already by stmt initialization -- Should be internally marked as unsuccessful return statement; end; else -- Fatal attempt to query an unconnected database driver.log_problem (category => logcat, message => err1, break => True); end if; -- We never get here, the driver.log_problem throws exception first raise ACS.STMT_NOT_VALID with "failed to return SQLite statement"; end private_statement; ------------------------ -- query_drop_table -- ------------------------ overriding procedure query_drop_table (driver : SQLite_Driver; tables : String; when_exists : Boolean := False; cascade : Boolean := False) is sql : CT.Text; AR : Affected_Rows; begin if CT.contains (tables, ",") then driver.log_problem (category => execution, message => CT.SUS ("Multiple tables detected -- SQLite" & " can only drop one table at a time : " & tables)); return; end if; case when_exists is when True => sql := CT.SUS ("DROP TABLE IF EXISTS " & tables); when False => sql := CT.SUS ("DROP TABLE " & tables); end case; if cascade then driver.log_nominal (category => note, message => CT.SUS ("Requested CASCADE has no effect on SQLite")); end if; AR := driver.execute (sql => CT.USS (sql)); exception when ACS.QUERY_FAIL => driver.log_problem (category => execution, message => sql, pull_codes => True); end query_drop_table; ------------------------- -- query_clear_table -- ------------------------- overriding procedure query_clear_table (driver : SQLite_Driver; table : String) is -- SQLite has no "truncate" commands sql : constant String := "DELETE FROM " & table; AR : Affected_Rows; begin AR := driver.execute (sql => sql); exception when ACS.QUERY_FAIL => driver.log_problem (category => execution, message => CT.SUS (sql), pull_codes => True); end query_clear_table; -------------------- -- sql_assemble -- -------------------- function sql_assemble (driver : SQLite_Driver; distinct : Boolean := False; tables : String; columns : String; conditions : String := blankstring; groupby : String := blankstring; having : String := blankstring; order : String := blankstring; null_sort : Null_Priority := native; limit : Trax_ID := 0; offset : Trax_ID := 0) return String is vanilla : String := assembly_common_select (distinct, tables, columns, conditions, groupby, having, order); begin if null_sort /= native then driver.log_nominal (category => execution, message => CT.SUS ("Note that NULLS FIRST/LAST is not " & "supported by SQLite so the null_sort setting is ignored")); end if; if limit > 0 then if offset > 0 then return vanilla & " LIMIT" & limit'Img & " OFFSET" & offset'Img; else return vanilla & " LIMIT" & limit'Img; end if; end if; return vanilla; end sql_assemble; ----------------------------- -- call_stored_procedure -- ----------------------------- function call_stored_procedure (driver : SQLite_Driver; stored_procedure : String; proc_arguments : String) return ASS.SQLite_statement is begin raise ACS.UNSUPPORTED_BY_SQLITE with "SQLite does not have the capability of stored procedures"; return driver.query ("this never runs."); end call_stored_procedure; end AdaBase.Driver.Base.SQLite;
zhmu/ananas
Ada
541
adb
-- { dg-do compile } with Ada.Text_IO; package body Iter1 is type Table is array (Integer range <>) of Float; My_Table : Table := (1.0, 2.0, 3.0); procedure Dummy (L : My_Lists.List) is begin for Item : Boolean of L loop -- { dg-error "subtype indication does not match element type" } Ada.Text_IO.Put_Line (Integer'Image (Item)); end loop; for Item : Boolean of My_Table loop -- { dg-error "subtype indication does not match component type" } null; end loop; end; end Iter1;
Letractively/ada-ado
Ada
1,418
ads
----------------------------------------------------------------------- -- ADO Statements -- Database statements -- Copyright (C) 2009, 2010, 2011 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package ADO.Statements.Create is -- Create the query statement function Create_Statement (Proxy : Query_Statement_Access) return Query_Statement; -- Create the delete statement function Create_Statement (Proxy : Delete_Statement_Access) return Delete_Statement; -- Create an update statement function Create_Statement (Proxy : Update_Statement_Access) return Update_Statement; -- Create the insert statement. function Create_Statement (Proxy : Update_Statement_Access) return Insert_Statement; end ADO.Statements.Create;
stcarrez/ada-servlet
Ada
1,191
adb
----------------------------------------------------------------------- -- servlet_harness -- Ada Servlet unit tests -- Copyright (C) 2009, 2010, 2015, 2018 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with Servlet.Tests; with Servlet.Testsuite; procedure Servlet_Harness is procedure Harness is new Util.Tests.Harness (Suite => Servlet.Testsuite.Suite, Finish => Servlet.Tests.Finish); begin Harness ("servlet-tests.xml"); end Servlet_Harness;
strenkml/EE368
Ada
4,909
adb
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Characters.Latin_1; with Util; use Util; package body HDL_Generator is procedure Line(dest : in out Unbounded_String; str : in String := "") is begin Append(dest, str); Append(dest, Ada.Characters.Latin_1.LF); end Line; procedure Declare_Ports(dest : in out Unbounded_String; mem : in Memory_Pointer) is ports : constant Port_Vector_Type := Get_Ports(mem.all); begin for i in ports.First_Index .. ports.Last_Index loop declare port : constant Port_Type := ports.Element(i); name : constant String := "port" & To_String(i); wbits : constant Natural := 8 * port.word_size; wbs : constant String := To_String(wbits); begin Line(dest, " " & name & "_addr : out " & "std_logic_vector(ADDR_WIDTH - 1 downto 0);"); Line(dest, " " & name & "_din : in " & "std_logic_vector(" & wbs & " - 1 downto 0);"); Line(dest, " " & name & "_dout : out " & "std_logic_vector(" & wbs & " - 1 downto 0);"); Line(dest, " " & name & "_re : out std_logic;"); Line(dest, " " & name & "_we : out std_logic;"); Line(dest, " " & name & "_mask : out " & "std_logic_vector(" & To_String((wbits / 8) - 1) & " downto 0);"); Line(dest, " " & name & "_ready : in std_logic;"); end; end loop; end Declare_Ports; procedure Connect_Ports(dest : in out Unbounded_String; mem : in Memory_Pointer) is ports : constant Port_Vector_Type := Get_Ports(mem.all); begin for i in ports.First_Index .. ports.Last_Index loop declare port : constant Port_Type := ports.Element(i); pname : constant String := "port" & To_String(i); oname : constant String := "p" & To_String(port.id); begin Line(dest, pname & "_addr <= " & oname & "_addr;"); Line(dest, pname & "_dout <= " & oname & "_din;"); Line(dest, oname & "_dout <= " & pname & "_din;"); Line(dest, pname & "_re <= " & oname & "_re;"); Line(dest, pname & "_we <= " & oname & "_we;"); Line(dest, pname & "_mask <= " & oname & "_mask;"); Line(dest, oname & "_ready <= " & pname & "_ready;"); end; end loop; end Connect_Ports; function Generate(mem : Memory_Pointer; name : String; addr_bits : Positive) return String is mname : constant String := "m" & To_String(Get_ID(mem.all)); word_bits : constant Positive := 8 * Get_Word_Size(mem.all); sigs : Unbounded_String; code : Unbounded_String; r : Unbounded_String; begin Generate(mem.all, sigs, code); Line(code, " " & mname & "_addr <= addr;"); Line(code, " " & mname & "_din <= din;"); Line(code, " dout <= " & mname & "_dout;"); Line(code, " " & mname & "_re <= re;"); Line(code, " " & mname & "_we <= we;"); Line(code, " " & mname & "_mask <= mask;"); Line(code, " ready <= " & mname & "_ready;"); Line(r, "library ieee;"); Line(r, "use ieee.std_logic_1164.all;"); Line(r, "use ieee.numeric_std.all;"); Line(r); Line(r, "entity " & name & " is"); Line(r, " generic ("); Line(r, " ADDR_WIDTH : in natural := " & To_String(addr_bits) & ";"); Line(r, " WORD_WIDTH : in natural := " & To_String(word_bits)); Line(r, " );"); Line(r, " port ("); Line(r, " clk : in std_logic;"); Line(r, " rst : in std_logic;"); Declare_Ports(r, mem); Line(r, " addr : in std_logic_vector(" & "ADDR_WIDTH - 1 downto 0);"); Line(r, " din : in std_logic_vector(" & "WORD_WIDTH - 1 downto 0);"); Line(r, " dout : out std_logic_vector(" & "WORD_WIDTH - 1 downto 0);"); Line(r, " re : in std_logic;"); Line(r, " we : in std_logic;"); Line(r, " mask : in std_logic_vector(" & "(WORD_WIDTH / 8) - 1 downto 0);"); Line(r, " ready : out std_logic"); Line(r, " );"); Line(r, "end " & name & ";"); Line(r); Line(r, "architecture " & name & "_arch of " & name & " is"); Append(r, sigs); Line(r, "begin"); Append(r, code); Connect_Ports(r, mem); Line(r, "end " & name & "_arch;"); return To_String(r); end Generate; end HDL_Generator;
twdroeger/ada-awa
Ada
10,018
adb
----------------------------------------------------------------------- -- awa-workspaces-tests -- Unit tests for workspaces and invitations -- Copyright (C) 2017, 2018 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with ASF.Requests.Mockup; with ASF.Responses.Mockup; with ASF.Helpers.Beans; with ASF.Tests; with AWA.Users.Models; with AWA.Tests.Helpers.Users; with AWA.Workspaces.Beans; package body AWA.Workspaces.Tests is use Ada.Strings.Unbounded; function Get_Invitation_Bean is new ASF.Helpers.Beans.Get_Request_Bean (Element_Type => Beans.Invitation_Bean, Element_Access => Beans.Invitation_Bean_Access); package Caller is new Util.Test_Caller (Test, "Workspaces.Beans"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test AWA.Workspaces.Beans.Send", Test_Invite_User'Access); Caller.Add_Test (Suite, "Test AWA.Workspaces.Beans.Delete", Test_Delete_Member'Access); Caller.Add_Test (Suite, "Test AWA.Workspaces.Beans.Accept", Test_Accept_Invitation'Access); Caller.Add_Test (Suite, "Test AWA.Workspaces.Beans.Accept (with Email)", Test_Accept_Invitation_With_Email'Access); Caller.Add_Test (Suite, "Test AWA.Workspaces.Beans.Member_List", Test_List_Members'Access); end Add_Tests; -- ------------------------------ -- Verify the anonymous access for the invitation page. -- ------------------------------ procedure Verify_Anonymous (T : in out Test; Key : in String) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin ASF.Tests.Do_Get (Request, Reply, "/auth/invitation.html", "invitation-view.html"); ASF.Tests.Assert_Contains (T, "Bad or invalid invitation", Reply, "This invitation is invalid"); ASF.Tests.Do_Get (Request, Reply, "/auth/invitation.html?key=test", "invitation-bad.html"); ASF.Tests.Assert_Contains (T, "This invitation is invalid or has expired", Reply, "This invitation is invalid (key)"); ASF.Tests.Do_Get (Request, Reply, "/auth/invitation.html?key=x" & key, "invitation-bad2.html"); ASF.Tests.Assert_Contains (T, "This invitation is invalid or has expired", Reply, "This invitation is invalid (key)"); if Key = "" then return; end if; ASF.Tests.Do_Get (Request, Reply, "/auth/invitation.html?key=" & Key, "invitation-ok.html"); ASF.Tests.Assert_Contains (T, "Accept invitation", Reply, "Accept invitation page is invalid"); end Verify_Anonymous; -- ------------------------------ -- Test sending an invitation. -- ------------------------------ procedure Test_Invite_User (T : in out Test) is use type ADO.Identifier; use type AWA.Workspaces.Beans.Invitation_Bean_Access; Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Invite : AWA.Workspaces.Beans.Invitation_Bean_Access; begin AWA.Tests.Helpers.Users.Login ("[email protected]", Request); Request.Set_Parameter ("email", "[email protected]"); Request.Set_Parameter ("message", "I invite you to this application"); Request.Set_Parameter ("send", "1"); Request.Set_Parameter ("invite", "1"); ASF.Tests.Do_Post (Request, Reply, "/workspaces/invite.html", "invite.html"); T.Assert (Reply.Get_Status = ASF.Responses.SC_MOVED_TEMPORARILY, "Invalid response after invitation creation"); -- Verify the invitation by looking at the inviteUser bean. Invite := Get_Invitation_Bean (Request, "inviteUser"); T.Assert (Invite /= null, "Null inviteUser bean"); T.Assert (Invite.Get_Id /= ADO.NO_IDENTIFIER, "The invite ID is invalid"); T.Assert (not Invite.Get_Access_Key.Is_Null, "The invite access key is null"); T.Assert (Invite.Get_Member.Is_Inserted, "The invitation has a workspace member"); T.Key := Invite.Get_Access_Key.Get_Access_Key; T.Verify_Anonymous (Invite.Get_Access_Key.Get_Access_Key); T.Member_ID := Invite.Get_Member.Get_Id; end Test_Invite_User; -- ------------------------------ -- Test deleting the member. -- ------------------------------ procedure Test_Delete_Member (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin T.Test_Invite_User; AWA.Tests.Helpers.Users.Login ("[email protected]", Request); declare Id : constant String := ADO.Identifier'Image (T.Member_Id); begin Request.Set_Parameter ("member-id", Id); Request.Set_Parameter ("delete", "1"); Request.Set_Parameter ("delete-member-form", "1"); ASF.Tests.Do_Post (Request, Reply, "/workspaces/forms/delete-member.html", "delete-member.html"); T.Assert (Reply.Get_Status = ASF.Responses.SC_OK, "Invalid response after delete member operation"); ASF.Tests.Assert_Contains (T, "deleteDialog_" & Id (Id'First + 1 .. Id'Last), Reply, "Delete member dialog operation response is invalid"); end; end Test_Delete_Member; -- ------------------------------ -- Test accepting the invitation. -- ------------------------------ procedure Test_Accept_Invitation (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin T.Test_Invite_User; AWA.Tests.Helpers.Users.Recover_Password ("[email protected]"); AWA.Tests.Helpers.Users.Login ("[email protected]", Request); ASF.Tests.Do_Get (Request, Reply, "/workspaces/accept-invitation.html?key=" & To_String (T.Key), "accept-member.html"); T.Assert (Reply.Get_Status = ASF.Responses.SC_MOVED_TEMPORARILY, "Accept invitation page failed"); Util.Tests.Assert_Equals (T, "/asfunit/workspaces/main.html", Reply.Get_Header ("Location"), "The accept invitation page must redirect to the workspace"); end Test_Accept_Invitation; -- ------------------------------ -- Test accepting the invitation with a email and password process. -- ------------------------------ procedure Test_Accept_Invitation_With_Email (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin T.Test_Invite_User; Request.Set_Parameter ("key", To_String (T.Key)); ASF.Tests.Do_Get (Request, Reply, "/auth/invitation.html?key=" & To_String (T.Key), "accept-invitation-email-1.html"); ASF.Tests.Assert_Contains (T, "input type=""hidden"" name=""key"" value=""" & To_String (T.Key), Reply, "The invitation form must setup the invitation key form"); Request.Set_Parameter ("key", To_String (T.Key)); Request.Set_Parameter ("register", "1"); Request.Set_Parameter ("register-button", "1"); Request.Set_Parameter ("firstName", "Invitee"); Request.Set_Parameter ("lastName", "With_Email"); Request.Set_Parameter ("email", "[email protected]"); Request.Set_Parameter ("email", "[email protected]"); Request.Set_Parameter ("password", "admin"); Request.Set_Parameter ("password2", "admin"); ASF.Tests.Do_Post (Request, Reply, "/auth/invitation.html", "accept-invitation-email-2.html"); T.Assert (Reply.Get_Status = ASF.Responses.SC_MOVED_TEMPORARILY, "Accept invitation page failed"); Util.Tests.Assert_Equals (T, "/asfunit/workspaces/accept-invitation.html?key=" & To_String (T.Key), Reply.Get_Header ("Location"), "The accept invitation page must redirect to the workspace"); end Test_Accept_Invitation_With_Email; -- ------------------------------ -- Test listing the members of the workspace. -- ------------------------------ procedure Test_List_Members (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; begin T.Test_Invite_User; AWA.Tests.Helpers.Users.Login ("[email protected]", Request); ASF.Tests.Do_Get (Request, Reply, "/workspaces/members.html", "member-list.html"); ASF.Tests.Assert_Contains (T, "[email protected]", Reply, "The invited user is listed in the members page"); ASF.Tests.Assert_Contains (T, "[email protected]", Reply, "The invite user (owner) is listed in the members page"); end Test_List_Members; end AWA.Workspaces.Tests;
dan76/Amass
Ada
808
ads
-- Copyright © by Jeff Foley 2017-2023. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 local url = require("url") name = "Yahoo" type = "scrape" function start() set_rate_limit(1) end function vertical(ctx, domain) for i=1,201,10 do local ok = scrape(ctx, {['url']=build_url(domain, i)}) if not ok then break end end end function build_url(domain, pagenum) local query = "site:" .. domain .. " -domain:www." .. domain local params = { ['p']=query, ['b']=pagenum, ['pz']="10", ['bct']="0", ['xargs']="0", } return "https://search.yahoo.com/search?" .. url.build_query_string(params) end
stcarrez/ada-util
Ada
4,787
adb
----------------------------------------------------------------------- -- util-log-locations -- General purpose source file location -- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; package body Util.Log.Locations is -- ------------------------------ -- Create a <b>File_Info</b> record to identify the file whose path is <b>Path</b> -- and whose relative path portion starts at <b>Relative_Position</b>. -- ------------------------------ function Create_File_Info (Path : in String; Relative_Position : in Natural) return File_Info_Access is begin return new File_Info '(Length => Path'Length, Path => Path, Relative_Pos => Relative_Position); end Create_File_Info; -- ------------------------------ -- Get the relative path name -- ------------------------------ function Relative_Path (File : in File_Info) return String is begin return File.Path (File.Relative_Pos .. File.Path'Last); end Relative_Path; -- ------------------------------ -- Get the line number -- ------------------------------ function Line (Info : Line_Info) return Natural is begin return Info.Line; end Line; -- ------------------------------ -- Get the column number -- ------------------------------ function Column (Info : Line_Info) return Natural is begin return Info.Column; end Column; -- ------------------------------ -- Get the source file -- ------------------------------ function File (Info : Line_Info) return String is begin return Info.File.Path; end File; -- ------------------------------ -- Compare the two source location. The comparison is made on: -- o the source file, -- o the line number, -- o the column. -- ------------------------------ function "<" (Left, Right : in Line_Info) return Boolean is begin if Left.File.Path < Right.File.Path then return True; elsif Left.File.Path > Right.File.Path then return False; elsif Left.Line < Right.Line then return True; elsif Left.Line > Right.Line then return False; else return Left.Column < Right.Column; end if; end "<"; -- ------------------------------ -- Create a source line information. -- ------------------------------ function Create_Line_Info (File : in File_Info_Access; Line : in Natural; Column : in Natural := 0) return Line_Info is Result : Line_Info; begin Result.Line := Line; Result.Column := Column; if File = null then Result.File := NO_FILE'Access; else Result.File := File; end if; return Result; end Create_Line_Info; -- ------------------------------ -- Get a printable representation of the line information using -- the format: -- <path>:<line>[:<column>] -- The path can be reported as relative or absolute path. -- The column is optional and reported by default. -- ------------------------------ function To_String (Info : in Line_Info; Relative : in Boolean := True; Column : in Boolean := True) return String is begin if Relative then if Column then return Relative_Path (Info.File.all) & ":" & Util.Strings.Image (Info.Line) & ":" & Util.Strings.Image (Info.Column); else return Relative_Path (Info.File.all) & ":" & Util.Strings.Image (Info.Line); end if; else if Column then return Info.File.Path & ":" & Util.Strings.Image (Info.Line) & ":" & Util.Strings.Image (Info.Column); else return Info.File.Path & ":" & Util.Strings.Image (Info.Line); end if; end if; end To_String; end Util.Log.Locations;
reznikmm/matreshka
Ada
6,960
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.Sender_Lastname_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Sender_Lastname_Element_Node is begin return Self : Text_Sender_Lastname_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_Sender_Lastname_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_Sender_Lastname (ODF.DOM.Text_Sender_Lastname_Elements.ODF_Text_Sender_Lastname_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_Sender_Lastname_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Sender_Lastname_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Text_Sender_Lastname_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_Sender_Lastname (ODF.DOM.Text_Sender_Lastname_Elements.ODF_Text_Sender_Lastname_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_Sender_Lastname_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_Sender_Lastname (Visitor, ODF.DOM.Text_Sender_Lastname_Elements.ODF_Text_Sender_Lastname_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.Sender_Lastname_Element, Text_Sender_Lastname_Element_Node'Tag); end Matreshka.ODF_Text.Sender_Lastname_Elements;
gerr135/ada_composition
Ada
2,822
adb
package body Lists.bounded is overriding function Element_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type is CR : Constant_Reference_Type(Container.data(Position.Index)'Access); begin return CR; end; overriding function Element_Constant_Reference (Container : aliased in List; Index : in Index_Type) return Constant_Reference_Type is CR : Constant_Reference_Type(Container.data(Index)'Access); begin return CR; end; overriding function Element_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type is R : Reference_Type(Container.data(Position.Index)'Access); begin return R; end; overriding function Element_Reference (Container : aliased in out List; Index : in Index_Type) return Reference_Type is R : Reference_Type(Container.data(Index)'Access); begin return R; end; overriding function Iterate (Container : in List) return Iterator_Interface'Class is It : Iterator := (Container'Unrestricted_Access, Index_Base'First); begin return It; end; function Has_Element (L : List; Position : Index_Base) return Boolean is -- Iterators are unrolled into calling First/Last to assign index -- and then increment/decrement it inside a "while Has_Element(Cursor)" loop -- So we simply check if our index passed outside boundaries.. begin return (Position >= L.data'First) and (Position <= L.Last); end; overriding function First (Object : Iterator) return Cursor is C : Cursor := (Object.Container, Index_Type'First); begin return C; end; overriding function Last (Object : Iterator) return Cursor is C : Cursor := (Object.Container, List(Object.Container.all).Last); begin return C; end; overriding function Next (Object : Iterator; Position : Cursor) return Cursor is C : Cursor := (Object.Container, Position.Index + 1); begin return C; end; overriding function Previous (Object : Iterator; Position : Cursor) return Cursor is C : Cursor := (Object.Container, Position.Index - 1); begin return C; end; ---- Extras -- overriding function Length (Container : aliased in out List) return Index_Base is begin return Container.data'Length; end; overriding function First_Index(Container : aliased in out List) return Index_Type is begin return Container.data'First; end; overriding function Last_Index (Container : aliased in out List) return Index_Type is begin return Container.data'Last; end; end Lists.bounded;
psyomn/ash
Ada
758
ads
-- Copyright 2019 Simon Symeonidis (psyomn) -- -- 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 AUnit.Test_Suites; use AUnit.Test_Suites; package Common_Utils_Suite is function Suite return Access_Test_Suite; end Common_Utils_Suite;
AdaCore/langkit
Ada
838
adb
with Langkit_Support.Adalog.Main_Support; use Langkit_Support.Adalog.Main_Support; -- Test a combination of features at the same time: -- * Predicates -- * Custom bind -- * Domains. procedure Main is use T_Solver, Refs, Solver_Ifc; X : constant Refs.Logic_Var := Create ("X"); Y : constant Refs.Logic_Var := Create ("Y"); function Is_Even (V : Integer) return Boolean is (V mod 2 = 0); function Convert (I : Integer) return Integer is (I * 3); R3 : constant Relation := R_All ((R_Any ((X = 1, X = 2, X = 3, X = 4, X = 5, X = 6)), Propagate (X, Y, Converter (Convert'Access, "*3")), Predicate (X, Predicate (Is_Even'Access, "Is_Even")), Domain (Y, (12, 18)))); begin Solve_All (R3); end Main;
docandrew/troodon
Ada
9,949
ads
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; package bits_types_h is -- bits/types.h -- definitions of __*_t types underlying *_t types. -- Copyright (C) 2002-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- * Never include this file directly; use <sys/types.h> instead. -- -- Convenience types. subtype uu_u_char is unsigned_char; -- /usr/include/bits/types.h:31 subtype uu_u_short is unsigned_short; -- /usr/include/bits/types.h:32 subtype uu_u_int is unsigned; -- /usr/include/bits/types.h:33 subtype uu_u_long is unsigned_long; -- /usr/include/bits/types.h:34 -- Fixed-size types, underlying types depend on word size and compiler. subtype uu_int8_t is signed_char; -- /usr/include/bits/types.h:37 subtype uu_uint8_t is unsigned_char; -- /usr/include/bits/types.h:38 subtype uu_int16_t is short; -- /usr/include/bits/types.h:39 subtype uu_uint16_t is unsigned_short; -- /usr/include/bits/types.h:40 subtype uu_int32_t is int; -- /usr/include/bits/types.h:41 subtype uu_uint32_t is unsigned; -- /usr/include/bits/types.h:42 subtype uu_int64_t is long; -- /usr/include/bits/types.h:44 subtype uu_uint64_t is unsigned_long; -- /usr/include/bits/types.h:45 -- Smallest types with at least a given width. subtype uu_int_least8_t is uu_int8_t; -- /usr/include/bits/types.h:52 subtype uu_uint_least8_t is uu_uint8_t; -- /usr/include/bits/types.h:53 subtype uu_int_least16_t is uu_int16_t; -- /usr/include/bits/types.h:54 subtype uu_uint_least16_t is uu_uint16_t; -- /usr/include/bits/types.h:55 subtype uu_int_least32_t is uu_int32_t; -- /usr/include/bits/types.h:56 subtype uu_uint_least32_t is uu_uint32_t; -- /usr/include/bits/types.h:57 subtype uu_int_least64_t is uu_int64_t; -- /usr/include/bits/types.h:58 subtype uu_uint_least64_t is uu_uint64_t; -- /usr/include/bits/types.h:59 -- quad_t is also 64 bits. subtype uu_quad_t is long; -- /usr/include/bits/types.h:63 subtype uu_u_quad_t is unsigned_long; -- /usr/include/bits/types.h:64 -- Largest integral types. subtype uu_intmax_t is long; -- /usr/include/bits/types.h:72 subtype uu_uintmax_t is unsigned_long; -- /usr/include/bits/types.h:73 -- The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE -- macros for each of the OS types we define below. The definitions -- of those macros must use the following macros for underlying types. -- We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned -- variants of each of the following integer types on this machine. -- 16 -- "natural" 16-bit type (always short) -- 32 -- "natural" 32-bit type (always int) -- 64 -- "natural" 64-bit type (long or long long) -- LONG32 -- 32-bit type, traditionally long -- QUAD -- 64-bit type, traditionally long long -- WORD -- natural type of __WORDSIZE bits (int or long) -- LONGWORD -- type of __WORDSIZE bits, traditionally long -- We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the -- conventional uses of `long' or `long long' type modifiers match the -- types we define, even when a less-adorned type would be the same size. -- This matters for (somewhat) portably writing printf/scanf formats for -- these types, where using the appropriate l or ll format modifiers can -- make the typedefs and the formats match up across all GNU platforms. If -- we used `long' when it's 64 bits where `long long' is expected, then the -- compiler would warn about the formats not matching the argument types, -- and the programmer changing them to shut up the compiler would break the -- program's portability. -- Here we assume what is presently the case in all the GCC configurations -- we support: long long is always 64 bits, long is always word/address size, -- and int is always 32 bits. -- We want __extension__ before typedef's that use nonstandard base types -- such as `long long' in C89 mode. -- No need to mark the typedef with __extension__. -- Defines __*_T_TYPE macros. -- Defines __TIME*_T_TYPE macros. -- Type of device numbers. subtype uu_dev_t is unsigned_long; -- /usr/include/bits/types.h:145 -- Type of user identifications. subtype uu_uid_t is unsigned; -- /usr/include/bits/types.h:146 -- Type of group identifications. subtype uu_gid_t is unsigned; -- /usr/include/bits/types.h:147 -- Type of file serial numbers. subtype uu_ino_t is unsigned_long; -- /usr/include/bits/types.h:148 -- Type of file serial numbers (LFS). subtype uu_ino64_t is unsigned_long; -- /usr/include/bits/types.h:149 -- Type of file attribute bitmasks. subtype uu_mode_t is unsigned; -- /usr/include/bits/types.h:150 -- Type of file link counts. subtype uu_nlink_t is unsigned_long; -- /usr/include/bits/types.h:151 -- Type of file sizes and offsets. subtype uu_off_t is long; -- /usr/include/bits/types.h:152 -- Type of file sizes and offsets (LFS). subtype uu_off64_t is long; -- /usr/include/bits/types.h:153 -- Type of process identifications. subtype uu_pid_t is int; -- /usr/include/bits/types.h:154 -- Type of file system IDs. -- skipped anonymous struct anon_0 type uu_fsid_t_array857 is array (0 .. 1) of aliased int; type uu_fsid_t is record uu_val : aliased uu_fsid_t_array857; -- /usr/include/bits/types.h:155 end record with Convention => C_Pass_By_Copy; -- /usr/include/bits/types.h:155 -- Type of CPU usage counts. subtype uu_clock_t is long; -- /usr/include/bits/types.h:156 -- Type for resource measurement. subtype uu_rlim_t is unsigned_long; -- /usr/include/bits/types.h:157 -- Type for resource measurement (LFS). subtype uu_rlim64_t is unsigned_long; -- /usr/include/bits/types.h:158 -- General type for IDs. subtype uu_id_t is unsigned; -- /usr/include/bits/types.h:159 -- Seconds since the Epoch. subtype uu_time_t is long; -- /usr/include/bits/types.h:160 -- Count of microseconds. subtype uu_useconds_t is unsigned; -- /usr/include/bits/types.h:161 -- Signed count of microseconds. subtype uu_suseconds_t is long; -- /usr/include/bits/types.h:162 subtype uu_suseconds64_t is long; -- /usr/include/bits/types.h:163 -- The type of a disk address. subtype uu_daddr_t is int; -- /usr/include/bits/types.h:165 -- Type of an IPC key. subtype uu_key_t is int; -- /usr/include/bits/types.h:166 -- Clock ID used in clock and timer functions. subtype uu_clockid_t is int; -- /usr/include/bits/types.h:169 -- Timer ID returned by `timer_create'. type uu_timer_t is new System.Address; -- /usr/include/bits/types.h:172 -- Type to represent block size. subtype uu_blksize_t is long; -- /usr/include/bits/types.h:175 -- Types from the Large File Support interface. -- Type to count number of disk blocks. subtype uu_blkcnt_t is long; -- /usr/include/bits/types.h:180 subtype uu_blkcnt64_t is long; -- /usr/include/bits/types.h:181 -- Type to count file system blocks. subtype uu_fsblkcnt_t is unsigned_long; -- /usr/include/bits/types.h:184 subtype uu_fsblkcnt64_t is unsigned_long; -- /usr/include/bits/types.h:185 -- Type to count file system nodes. subtype uu_fsfilcnt_t is unsigned_long; -- /usr/include/bits/types.h:188 subtype uu_fsfilcnt64_t is unsigned_long; -- /usr/include/bits/types.h:189 -- Type of miscellaneous file system fields. subtype uu_fsword_t is long; -- /usr/include/bits/types.h:192 -- Type of a byte count, or error. subtype uu_ssize_t is long; -- /usr/include/bits/types.h:194 -- Signed long type used in system calls. subtype uu_syscall_slong_t is long; -- /usr/include/bits/types.h:197 -- Unsigned long type used in system calls. subtype uu_syscall_ulong_t is unsigned_long; -- /usr/include/bits/types.h:199 -- These few don't really vary by system, they always correspond -- to one of the other defined types. -- Type of file sizes and offsets (LFS). subtype uu_loff_t is uu_off64_t; -- /usr/include/bits/types.h:203 type uu_caddr_t is new Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types.h:204 -- Duplicates info from stdint.h but this is used in unistd.h. subtype uu_intptr_t is long; -- /usr/include/bits/types.h:207 -- Duplicate info from sys/socket.h. subtype uu_socklen_t is unsigned; -- /usr/include/bits/types.h:210 -- C99: An integer type that can be accessed as an atomic entity, -- even in the presence of asynchronous interrupts. -- It is not currently necessary for this to be machine-specific. subtype uu_sig_atomic_t is int; -- /usr/include/bits/types.h:215 -- Seconds since the Epoch, visible to user code when time_t is too -- narrow only for consistency with the old way of widening too-narrow -- types. User code should never use __time64_t. end bits_types_h;
AdaCore/libadalang
Ada
58
adb
package body a.b is procedure pb is separate; end a.b;
stcarrez/ada-wiki
Ada
4,427
ads
----------------------------------------------------------------------- -- wiki-html_parser -- Wiki HTML parser -- Copyright (C) 2015, 2016, 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 Wiki.Strings; with Wiki.Attributes; -- This is a small HTML parser that is called to deal with embedded HTML in wiki text. -- The parser is intended to handle incorrect HTML and clean the result as much as possible. -- We cannot use a real XML/Sax parser (such as XML/Ada) because we must handle errors and -- backtrack from HTML parsing to wiki or raw text parsing. -- -- When parsing HTML content, we call the `Parse_Element` and it calls back the `Process` -- parameter procedure with the element name and the optional attributes. private package Wiki.Html_Parser is pragma Preelaborate; type State_Type is (HTML_START, HTML_END, HTML_START_END, HTML_ERROR); type Entity_State_Type is (ENTITY_NONE, ENTITY_MIDDLE, ENTITY_VALID); type Parser_Type is limited private; function Is_Empty (Parser : in Parser_Type) return Boolean; -- Parse a HTML element `<XXX attributes>` or parse an end of HTML element </XXX> -- The first '<' is assumed to have been already verified. procedure Parse_Element (Parser : in out Parser_Type; Text : in Wiki.Strings.WString; From : in Positive; Process : not null access procedure (Kind : in State_Type; Name : in Wiki.Strings.WString; Attr : in out Wiki.Attributes.Attribute_List); Last : out Positive); -- Parse an HTML entity such as `&nbsp;` and return its value with the last position -- if it was correct. The first `&` is assumed to have been already verified. -- When `Entity` is not 0, the parsing is finished. When `Last` exceeds the input -- text position, it is necessary to call `Parse_Entity` with the next input chunk. procedure Parse_Entity (Parser : in out Parser_Type; Text : in Wiki.Strings.WString; From : in Positive; Status : in out Entity_State_Type; Entity : out Wiki.Strings.WChar; Last : out Natural); NUL : constant Wiki.Strings.WChar := Wiki.Strings.WChar'Val (0); private type Html_Parser_State is (State_None, State_Start, State_Comment_Or_Doctype, State_Doctype, State_Comment, State_Element, State_Check_Attribute, State_Parse_Attribute, State_Check_Attribute_Value, State_Parse_Attribute_Value, State_Valid_Attribute_Value, State_No_Attribute_Value, State_Expect_Start_End_Element, State_Expect_End_Element, State_End_Element); MAX_ENTITY_LENGTH : constant := 32; type Parser_Type is limited record State : Html_Parser_State := State_None; Elt_Name : Wiki.Strings.BString (64); Attr_Name : Wiki.Strings.BString (64); Attr_Value : Wiki.Strings.BString (256); Attributes : Wiki.Attributes.Attribute_List; Entity_Name : String (1 .. MAX_ENTITY_LENGTH); Counter : Natural := 0; Separator : Wiki.Strings.WChar; end record; end Wiki.Html_Parser;
thierr26/ada-keystore
Ada
19,897
adb
----------------------------------------------------------------------- -- keystore-passwords-gpg -- Password protected by GPG -- 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 Ada.Unchecked_Deallocation; with Ada.Exceptions; with Ada.Strings.Fixed; with GNAT.Regpat; with Util.Streams; with Util.Log.Loggers; with Util.Encoders; with Util.Processes; with Util.Streams.Texts; with Keystore.Random; -- === GPG Header data === -- -- The GPG encrypted data contains the following information: -- ``` -- +------------------+----- -- | TAG | 4b -- +------------------+----- -- | Lock Key | 32b -- | Lock IV | 16b -- | Wallet Key | 32b -- | Wallet IV | 16b -- | Wallet Sign | 32b -- +------------------+----- -- ``` package body Keystore.Passwords.GPG is use Ada.Streams; use Ada.Strings.Unbounded; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Passwords.GPG"); function Get_Le_Long (Data : in Ada.Streams.Stream_Element_Array) return Interfaces.Unsigned_32; function Get_Unsigned_32 (Data : in Stream_Element_Array) return Interfaces.Unsigned_32; procedure Put_Unsigned_32 (Data : out Stream_Element_Array; Value : in Interfaces.Unsigned_32); -- Headers of GPG packet. GPG_OLD_TAG_1 : constant Ada.Streams.Stream_Element := 16#85#; GPG_NEW_VERSION : constant Ada.Streams.Stream_Element := 16#03#; function Get_Unsigned_32 (Data : in Stream_Element_Array) return Interfaces.Unsigned_32 is use Interfaces; begin return Shift_Left (Unsigned_32 (Data (Data'First)), 24) or Shift_Left (Unsigned_32 (Data (Data'First + 1)), 16) or Shift_Left (Unsigned_32 (Data (Data'First + 2)), 8) or Unsigned_32 (Data (Data'First + 3)); end Get_Unsigned_32; procedure Put_Unsigned_32 (Data : out Stream_Element_Array; Value : in Interfaces.Unsigned_32) is use Interfaces; begin Data (Data'First) := Stream_Element (Shift_Right (Value, 24)); Data (Data'First + 1) := Stream_Element (Shift_Right (Value, 16) and 16#0ff#); Data (Data'First + 2) := Stream_Element (Shift_Right (Value, 8) and 16#0ff#); Data (Data'First + 3) := Stream_Element (Value and 16#0ff#); end Put_Unsigned_32; function Get_Le_Long (Data : in Ada.Streams.Stream_Element_Array) return Interfaces.Unsigned_32 is use Interfaces; begin return Shift_Left (Unsigned_32 (Data (Data'First)), 24) or Shift_Left (Unsigned_32 (Data (Data'First + 1)), 16) or Shift_Left (Unsigned_32 (Data (Data'First + 2)), 8) or Unsigned_32 (Data (Data'First + 3)); end Get_Le_Long; -- ------------------------------ -- Extract the Key ID from the data content when it is encrypted by GPG2. -- ------------------------------ function Extract_Key_Id (Data : in Ada.Streams.Stream_Element_Array) return String is L1 : Interfaces.Unsigned_32; L2 : Interfaces.Unsigned_32; Encode : constant Util.Encoders.Encoder := Util.Encoders.Create ("hex"); begin if Data'Length < 16 then return ""; end if; if Data (Data'First + 4) /= GPG_OLD_TAG_1 then return ""; end if; if Data (Data'First + 7) /= GPG_NEW_VERSION then return ""; end if; if Data (Data'First + 5) > 4 then return ""; end if; L1 := Get_Le_Long (Data (Data'First + 4 + 4 .. Data'Last)); L2 := Get_Le_Long (Data (Data'First + 8 + 4 .. Data'Last)); return Encode.Encode_Unsigned_32 (L1) & Encode.Encode_Unsigned_32 (L2); end Extract_Key_Id; -- ------------------------------ -- Get the list of GPG secret keys that could be capable for decrypting a content for us. -- ------------------------------ procedure List_GPG_Secret_Keys (Context : in out Context_Type; List : in out Util.Strings.Sets.Set) is procedure Parse (Line : in String); -- GPG2 command output: -- ssb:u:<key-size>:<key-algo>:<key-id>:<create-date>:<expire-date>:::::<e>: REGEX2 : constant String := "^(ssb|sec):u?:[1-9][0-9][0-9][0-9]:[0-9]:([0-9a-fA-F]+):[0-9]+:[0-9]*:::::[esa]+::.*"; -- GPG1 command output: -- ssb::<key-size>:<key-algo>:<key-id>:<create-date>:<expire-date>:::::<e>: REGEX1 : constant String := "^(ssb|sec):u?:[1-9][0-9][0-9][0-9]:[0-9]:([0-9a-fA-F]+):[0-9-]+:[0-9-]*:::::.*"; Pattern1 : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (REGEX1); Pattern2 : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (REGEX2); procedure Parse (Line : in String) is Matches : GNAT.Regpat.Match_Array (0 .. 2); begin if GNAT.Regpat.Match (Pattern1, Line) then GNAT.Regpat.Match (Pattern1, Line, Matches); List.Include (Line (Matches (2).First .. Matches (2).Last)); elsif GNAT.Regpat.Match (Pattern2, Line) then GNAT.Regpat.Match (Pattern2, Line, Matches); List.Include (Line (Matches (2).First .. Matches (2).Last)); end if; exception when others => Log.Debug ("Unkown line: {0}", Line); end Parse; Command : constant String := To_String (Context.List_Key_Command); Proc : Util.Processes.Process; Output : Util.Streams.Input_Stream_Access; Input : Util.Streams.Output_Stream_Access; Reader : Util.Streams.Texts.Reader_Stream; begin Log.Info ("Looking for GPG secrets using {0}", Command); Util.Processes.Spawn (Proc => Proc, Command => Command, Mode => Util.Processes.READ_WRITE_ALL); Input := Util.Processes.Get_Input_Stream (Proc); Output := Util.Processes.Get_Output_Stream (Proc); Reader.Initialize (Output, 4096); Input.Close; while not Reader.Is_Eof loop declare Line : Ada.Strings.Unbounded.Unbounded_String; begin Reader.Read_Line (Line); Parse (To_String (Line)); end; end loop; Util.Processes.Wait (Proc); if Util.Processes.Get_Exit_Status (Proc) /= 0 then Log.Warn ("GPG list command '{0}' terminated with exit code{1}", Command, Natural'Image (Util.Processes.Get_Exit_Status (Proc))); end if; exception when E : Util.Processes.Process_Error => Log.Warn ("Cannot execute GPG command '{0}': {1}", Command, Ada.Exceptions.Exception_Message (E)); end List_GPG_Secret_Keys; -- ------------------------------ -- Create a secret to protect the keystore. -- ------------------------------ procedure Create_Secret (Context : in out Context_Type; Data : in Ada.Streams.Stream_Element_Array) is P : Secret_Provider_Access; Tag : constant Tag_Type := Get_Unsigned_32 (Data); begin P := new Secret_Provider '(Tag => Tag, Next => Context.First, others => <>); Context.First := P; Util.Encoders.Create (Data (POS_LOCK_KEY .. POS_LOCK_KEY_LAST), P.Key); Util.Encoders.Create (Data (POS_LOCK_IV .. POS_LOCK_IV_LAST), P.IV); Context.Current := P; end Create_Secret; -- ------------------------------ -- Create a secret to protect the keystore. -- ------------------------------ procedure Create_Secret (Context : in out Context_Type) is Rand : Keystore.Random.Generator; begin Rand.Generate (Context.Data); Context.Create_Secret (Context.Data); end Create_Secret; procedure Create_Secret (Context : in out Context_Type; Image : in Context_Type'Class) is begin Context.Encrypt_Command := Image.Encrypt_Command; Context.Decrypt_Command := Image.Decrypt_Command; Context.List_Key_Command := Image.List_Key_Command; Context.Create_Secret; Context.Data (POS_WALLET_KEY .. POS_WALLET_SIGN_LAST) := Image.Data (POS_WALLET_KEY .. POS_WALLET_SIGN_LAST); end Create_Secret; procedure Create_Secret (Context : in out Context_Type; Key_Provider : in Keys.Key_Provider'Class) is begin Context.Create_Secret; if Key_Provider in Keystore.Passwords.Internal_Key_Provider'Class then Keystore.Passwords.Internal_Key_Provider'Class (Key_Provider).Save_Key (Context.Data (POS_WALLET_KEY .. POS_WALLET_SIGN_LAST)); end if; end Create_Secret; -- ------------------------------ -- Save the GPG secret by encrypting it using the user's GPG key and storing -- the encrypted data in the keystore data header. -- ------------------------------ procedure Save_Secret (Context : in out Context_Type; User : in String; Index : in Keystore.Header_Slot_Index_Type; Wallet : in out Keystore.Files.Wallet_File) is Cmd : constant String := Context.Get_Encrypt_Command (User); Proc : Util.Processes.Process; Result : Ada.Streams.Stream_Element_Array (1 .. MAX_ENCRYPT_SIZE); Last : Ada.Streams.Stream_Element_Offset := 0; Last2 : Ada.Streams.Stream_Element_Offset; Input : Util.Streams.Output_Stream_Access; Output : Util.Streams.Input_Stream_Access; begin Log.Info ("Encrypt GPG secret using {0}", Cmd); Put_Unsigned_32 (Result, Context.Current.Tag); Last := 4; Util.Processes.Spawn (Proc => Proc, Command => Cmd, Mode => Util.Processes.READ_WRITE_ALL); Input := Util.Processes.Get_Input_Stream (Proc); Input.Write (Context.Data (POS_LOCK_KEY .. Context.Data'Last)); Input.Close; Output := Util.Processes.Get_Output_Stream (Proc); while Last < Result'Last loop Output.Read (Result (Last + 1 .. Result'Last), Last2); exit when Last2 = Last; Last := Last2; end loop; Util.Processes.Wait (Proc); if Util.Processes.Get_Exit_Status (Proc) /= 0 or Last <= 4 then Log.Warn ("GPG encrypt command '{0}' terminated with exit code{1}", Cmd, Natural'Image (Util.Processes.Get_Exit_Status (Proc))); raise Keystore.Bad_Password; end if; Keystore.Files.Set_Header_Data (Wallet, Index, Keystore.SLOT_KEY_GPG2, Result (1 .. Last)); Context.Index := Context.Index + 1; exception when E : Util.Processes.Process_Error => Log.Warn ("Cannot execute GPG encrypt command '{0}': {1}", Cmd, Ada.Exceptions.Exception_Message (E)); raise Keystore.Bad_Password; end Save_Secret; -- ------------------------------ -- Load the GPG secrets stored in the keystore header. -- ------------------------------ procedure Load_Secrets (Context : in out Context_Type; Wallet : in out Keystore.Files.Wallet_File) is Data : Ada.Streams.Stream_Element_Array (1 .. MAX_ENCRYPT_SIZE); Last : Ada.Streams.Stream_Element_Offset; Kind : Keystore.Header_Slot_Type; List : Util.Strings.Sets.Set; begin -- Get the list of known secret keys. Context.List_GPG_Secret_Keys (List); for Index in Header_Slot_Index_Type'Range loop Wallet.Get_Header_Data (Index, Kind, Data, Last); exit when Last < Data'First; if Kind = Keystore.SLOT_KEY_GPG2 then declare Key_Id : constant String := Extract_Key_Id (Data (Data'First .. Last)); begin if List.Contains (Key_Id) then Context.Decrypt_GPG_Secret (Data (Data'First .. Last)); exit when Context.Valid_Key; end if; end; end if; end loop; Context.Current := Context.First; end Load_Secrets; -- ------------------------------ -- Get the password through the Getter operation. -- ------------------------------ overriding procedure Get_Password (From : in Context_Type; Getter : not null access procedure (Password : in Secret_Key)) is begin Getter (From.Current.Key); end Get_Password; -- ------------------------------ -- Get the key and IV through the Getter operation. -- ------------------------------ overriding procedure Get_Key (From : in Context_Type; Getter : not null access procedure (Key : in Secret_Key; IV : in Secret_Key)) is begin Getter (From.Current.Key, From.Current.IV); end Get_Key; -- ------------------------------ -- Get the Key, IV and signature. -- ------------------------------ overriding procedure Get_Keys (From : in Context_Type; Key : out Secret_Key; IV : out Secret_Key; Sign : out Secret_Key) is begin Util.Encoders.Create (From.Data (POS_WALLET_KEY .. POS_WALLET_KEY_LAST), Key); Util.Encoders.Create (From.Data (POS_WALLET_IV .. POS_WALLET_IV_LAST), IV); Util.Encoders.Create (From.Data (POS_WALLET_SIGN .. POS_WALLET_SIGN_LAST), Sign); end Get_Keys; -- ------------------------------ -- Get the key slot number associated with the GPG password. -- ------------------------------ overriding function Get_Tag (From : in Context_Type) return Tag_Type is begin return From.Current.Tag; end Get_Tag; -- ------------------------------ -- Returns true if the provider has a GPG password. -- ------------------------------ overriding function Has_Password (From : in Context_Type) return Boolean is begin return From.Current /= null; end Has_Password; -- ------------------------------ -- Move to the next GPG password. -- ------------------------------ overriding procedure Next (From : in out Context_Type) is begin From.Current := From.Current.Next; end Next; -- ------------------------------ -- Get the command to encrypt the secret for the given GPG user/keyid. -- ------------------------------ function Get_Encrypt_Command (Context : in Context_Type; User : in String) return String is use Ada.Strings.Fixed; USER_LABEL : constant String := "$USER"; Cmd : constant String := To_String (Context.Encrypt_Command); Result : Unbounded_String; First : Positive := Cmd'First; Pos : Natural; begin loop Pos := Index (Cmd, USER_LABEL, First); if Pos = 0 then Append (Result, Cmd (First .. Cmd'Last)); return To_String (Result); end if; Append (Result, Cmd (First .. Pos - 1)); Append (Result, User); First := Pos + USER_LABEL'Length; end loop; end Get_Encrypt_Command; -- ------------------------------ -- Decrypt the data array that was encrypted using GPG2. -- ------------------------------ procedure Decrypt_GPG_Secret (Context : in out Context_Type; Data : in Ada.Streams.Stream_Element_Array) is Proc : Util.Processes.Process; Last : Ada.Streams.Stream_Element_Offset := 0; Last2 : Ada.Streams.Stream_Element_Offset; Cmd : constant String := To_String (Context.Decrypt_Command); Status : Natural; begin Log.Info ("Decrypt GPG secret using {0}", Cmd); Context.Data (POS_TAG .. POS_TAG_LAST) := Data (Data'First .. Data'First + 3); Last := POS_TAG_LAST; Util.Processes.Spawn (Proc => Proc, Command => Cmd, Mode => Util.Processes.READ_WRITE_ALL); Util.Processes.Get_Input_Stream (Proc).Write (Data (POS_LOCK_KEY .. Data'Last)); Util.Processes.Get_Input_Stream (Proc).Close; while Last < Context.Data'Last loop Util.Processes.Get_Output_Stream (Proc).Read (Context.Data (Last + 1 .. Context.Data'Last), Last2); exit when Last2 = Last; Last := Last2; end loop; Util.Processes.Wait (Proc); Status := Util.Processes.Get_Exit_Status (Proc); Context.Valid_Key := Status = 0 and Last > 4; if Context.Valid_Key then Context.Create_Secret (Context.Data); elsif Status /= 0 then Log.Warn ("GPG decrypt command '{0}' terminated with exit code{1}", Cmd, Natural'Image (Status)); end if; Context.Data (POS_TAG .. POS_LOCK_IV_LAST) := (others => 0); exception when E : Util.Processes.Process_Error => Log.Warn ("Cannot execute GPG decrypt command '{0}': {1}", Cmd, Ada.Exceptions.Exception_Message (E)); Context.Valid_Key := False; end Decrypt_GPG_Secret; -- ------------------------------ -- Setup the command to be executed to encrypt the secret with GPG2. -- ------------------------------ procedure Set_Encrypt_Command (Into : in out Context_Type; Command : in String) is begin Into.Encrypt_Command := To_Unbounded_String (Command); end Set_Encrypt_Command; -- ------------------------------ -- Setup the command to be executed to decrypt the secret with GPG2. -- ------------------------------ procedure Set_Decrypt_Command (Into : in out Context_Type; Command : in String) is begin Into.Decrypt_Command := To_Unbounded_String (Command); end Set_Decrypt_Command; -- ------------------------------ -- Setup the command to be executed to get the list of available GPG secret keys. -- ------------------------------ procedure Set_List_Key_Command (Into : in out Context_Type; Command : in String) is begin Into.List_Key_Command := To_Unbounded_String (Command); end Set_List_Key_Command; overriding procedure Initialize (Context : in out Context_Type) is begin Context.Encrypt_Command := To_Unbounded_String (ENCRYPT_COMMAND); Context.Decrypt_Command := To_Unbounded_String (DECRYPT_COMMAND); Context.List_Key_Command := To_Unbounded_String (LIST_COMMAND); end Initialize; overriding procedure Finalize (Context : in out Context_Type) is procedure Free is new Ada.Unchecked_Deallocation (Object => Secret_Provider, Name => Secret_Provider_Access); begin Context.Data := (others => 0); while Context.First /= null loop Context.Current := Context.First.Next; Free (Context.First); Context.First := Context.Current; end loop; end Finalize; end Keystore.Passwords.GPG;
persan/AdaYaml
Ada
456
adb
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Text.Chunk_Test; package body Text.Suite is Result : aliased AUnit.Test_Suites.Test_Suite; Chunk_TC : aliased Chunk_Test.TC; function Suite return AUnit.Test_Suites.Access_Test_Suite is begin AUnit.Test_Suites.Add_Test (Result'Access, Chunk_TC'Access); return Result'Access; end Suite; end Text.Suite;
optikos/oasis
Ada
1,654
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Application; with League.String_Vectors; with Meta.Classes; with Meta.Read; with Meta.Writes; procedure Meta.Run is Class_List : Meta.Read.Class_Vectors.Vector; Lists : League.String_Vectors.Universal_String_Vector; begin Meta.Read.Read_AST (File_Name => League.Application.Arguments.Element (1), Result => Class_List); for J of Class_List loop for P of J.Properties loop if P.Capacity in Meta.Classes.Zero_Or_More .. Meta.Classes.One_Or_More and then Lists.Index (P.Type_Name) = 0 then Lists.Append (P.Type_Name); end if; end loop; end loop; Meta.Writes.Write_Elements (Class_List); Meta.Writes.Write_Elements_Body (Class_List); Meta.Writes.Write_Visitors (Class_List); Meta.Writes.Write_Iterators (Class_List); Meta.Writes.Write_Factories (Class_List); Meta.Writes.Write_Factories (Class_List, Implicit => True); Meta.Writes.Write_Factories_Body (Class_List); Meta.Writes.Write_Factories_Body (Class_List, Implicit => True); for J in 2 .. Class_List.Last_Index loop Meta.Writes.Write_One_Element (Class_List (J), With_List => Lists.Index (Class_List (J).Name) > 0); if not Class_List (J).Is_Abstract then Meta.Writes.Write_One_Node (Class_List, Class_List (J)); Meta.Writes.Write_One_Node_Body (Class_List, Class_List (J)); end if; end loop; end Meta.Run;
reznikmm/matreshka
Ada
4,051
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Style_Dynamic_Spacing_Attributes; package Matreshka.ODF_Style.Dynamic_Spacing_Attributes is type Style_Dynamic_Spacing_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Dynamic_Spacing_Attributes.ODF_Style_Dynamic_Spacing_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Dynamic_Spacing_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Dynamic_Spacing_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Dynamic_Spacing_Attributes;
reznikmm/matreshka
Ada
4,741
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- GNAT: enforce generation of preinitialized data section instead of -- generation of elaboration code. package Matreshka.Internals.Unicode.Ucd.Core_002A is pragma Preelaborate; Group_002A : aliased constant Core_Second_Stage := (16#0C# => -- 2A0C (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math | Changes_When_NFKC_Casefolded => True, others => False)), 16#74# .. 16#76# => -- 2A74 .. 2A76 (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math | Changes_When_NFKC_Casefolded => True, others => False)), 16#DC# => -- 2ADC (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math | Changes_When_NFKC_Casefolded => True, others => False)), others => (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False))); end Matreshka.Internals.Unicode.Ucd.Core_002A;
AdaCore/libadalang
Ada
213
adb
procedure Test is type A is range 1 .. 10; subtype B is A range 5 .. 6; subtype C is B; type D is new A; type E is tagged null record; type F is new E with null record; begin null; end Test;
reznikmm/matreshka
Ada
3,627
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.Opaque_Expressions.Hash is new AMF.Elements.Generic_Hash (UML_Opaque_Expression, UML_Opaque_Expression_Access);
zhmu/ananas
Ada
3,726
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . N U M E R I C S . A U X _ F L O A T -- -- -- -- S p e c -- -- (Double-based Version, Float) -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides the basic computational interface for the -- generic elementary functions. The functions in this unit are -- wrappers for those in the Long_Float package. with Ada.Numerics.Aux_Long_Float; package Ada.Numerics.Aux_Float is pragma Pure; subtype T is Float; package Aux renames Ada.Numerics.Aux_Long_Float; subtype W is Aux.T; -- Use the Aux implementation. function Sin (X : T) return T is (T (Aux.Sin (W (X)))); function Cos (X : T) return T is (T (Aux.Cos (W (X)))); function Tan (X : T) return T is (T (Aux.Tan (W (X)))); function Exp (X : T) return T is (T (Aux.Exp (W (X)))); function Sqrt (X : T) return T is (T (Aux.Sqrt (W (X)))); function Log (X : T) return T is (T (Aux.Log (W (X)))); function Acos (X : T) return T is (T (Aux.Acos (W (X)))); function Asin (X : T) return T is (T (Aux.Asin (W (X)))); function Atan (X : T) return T is (T (Aux.Atan (W (X)))); function Sinh (X : T) return T is (T (Aux.Sinh (W (X)))); function Cosh (X : T) return T is (T (Aux.Cosh (W (X)))); function Tanh (X : T) return T is (T (Aux.Tanh (W (X)))); function Pow (X, Y : T) return T is (T (Aux.Pow (W (X), W (Y)))); end Ada.Numerics.Aux_Float;
VMika/DES_Ada
Ada
35,336
ads
pragma Warnings (Off); pragma Ada_95; with System; package ada_main is gnat_argc : Integer; gnat_argv : System.Address; gnat_envp : System.Address; pragma Import (C, gnat_argc); pragma Import (C, gnat_argv); pragma Import (C, gnat_envp); gnat_exit_status : Integer; pragma Import (C, gnat_exit_status); GNAT_Version : constant String := "GNAT Version: GPL 2017 (20170515-63)" & ASCII.NUL; pragma Export (C, GNAT_Version, "__gnat_version"); Ada_Main_Program_Name : constant String := "_ada_mainparallel" & ASCII.NUL; pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name"); procedure adainit; pragma Export (C, adainit, "adainit"); procedure adafinal; pragma Export (C, adafinal, "adafinal"); function main (argc : Integer; argv : System.Address; envp : System.Address) return Integer; pragma Export (C, main, "main"); type Version_32 is mod 2 ** 32; u00001 : constant Version_32 := 16#cca2cd0f#; pragma Export (C, u00001, "mainparallelB"); u00002 : constant Version_32 := 16#b6df930e#; pragma Export (C, u00002, "system__standard_libraryB"); u00003 : constant Version_32 := 16#0a55feef#; pragma Export (C, u00003, "system__standard_libraryS"); u00004 : constant Version_32 := 16#76789da1#; pragma Export (C, u00004, "adaS"); u00005 : constant Version_32 := 16#85a06f66#; pragma Export (C, u00005, "ada__exceptionsB"); u00006 : constant Version_32 := 16#1a0dcc03#; pragma Export (C, u00006, "ada__exceptionsS"); u00007 : constant Version_32 := 16#e947e6a9#; pragma Export (C, u00007, "ada__exceptions__last_chance_handlerB"); u00008 : constant Version_32 := 16#41e5552e#; pragma Export (C, u00008, "ada__exceptions__last_chance_handlerS"); u00009 : constant Version_32 := 16#32a08138#; pragma Export (C, u00009, "systemS"); u00010 : constant Version_32 := 16#4e7785b8#; pragma Export (C, u00010, "system__soft_linksB"); u00011 : constant Version_32 := 16#ac24596d#; pragma Export (C, u00011, "system__soft_linksS"); u00012 : constant Version_32 := 16#b01dad17#; pragma Export (C, u00012, "system__parametersB"); u00013 : constant Version_32 := 16#4c8a8c47#; pragma Export (C, u00013, "system__parametersS"); u00014 : constant Version_32 := 16#30ad09e5#; pragma Export (C, u00014, "system__secondary_stackB"); u00015 : constant Version_32 := 16#88327e42#; pragma Export (C, u00015, "system__secondary_stackS"); u00016 : constant Version_32 := 16#f103f468#; pragma Export (C, u00016, "system__storage_elementsB"); u00017 : constant Version_32 := 16#1f63cb3c#; pragma Export (C, u00017, "system__storage_elementsS"); u00018 : constant Version_32 := 16#41837d1e#; pragma Export (C, u00018, "system__stack_checkingB"); u00019 : constant Version_32 := 16#bc1fead0#; pragma Export (C, u00019, "system__stack_checkingS"); u00020 : constant Version_32 := 16#87a448ff#; pragma Export (C, u00020, "system__exception_tableB"); u00021 : constant Version_32 := 16#6f0ee87a#; pragma Export (C, u00021, "system__exception_tableS"); u00022 : constant Version_32 := 16#ce4af020#; pragma Export (C, u00022, "system__exceptionsB"); u00023 : constant Version_32 := 16#5ac3ecce#; pragma Export (C, u00023, "system__exceptionsS"); u00024 : constant Version_32 := 16#80916427#; pragma Export (C, u00024, "system__exceptions__machineB"); u00025 : constant Version_32 := 16#047ef179#; pragma Export (C, u00025, "system__exceptions__machineS"); u00026 : constant Version_32 := 16#aa0563fc#; pragma Export (C, u00026, "system__exceptions_debugB"); u00027 : constant Version_32 := 16#4c2a78fc#; pragma Export (C, u00027, "system__exceptions_debugS"); u00028 : constant Version_32 := 16#6c2f8802#; pragma Export (C, u00028, "system__img_intB"); u00029 : constant Version_32 := 16#307b61fa#; pragma Export (C, u00029, "system__img_intS"); u00030 : constant Version_32 := 16#39df8c17#; pragma Export (C, u00030, "system__tracebackB"); u00031 : constant Version_32 := 16#6c825ffc#; pragma Export (C, u00031, "system__tracebackS"); u00032 : constant Version_32 := 16#9ed49525#; pragma Export (C, u00032, "system__traceback_entriesB"); u00033 : constant Version_32 := 16#32fb7748#; pragma Export (C, u00033, "system__traceback_entriesS"); u00034 : constant Version_32 := 16#18d5fcc5#; pragma Export (C, u00034, "system__traceback__symbolicB"); u00035 : constant Version_32 := 16#9df1ae6d#; pragma Export (C, u00035, "system__traceback__symbolicS"); u00036 : constant Version_32 := 16#179d7d28#; pragma Export (C, u00036, "ada__containersS"); u00037 : constant Version_32 := 16#701f9d88#; pragma Export (C, u00037, "ada__exceptions__tracebackB"); u00038 : constant Version_32 := 16#20245e75#; pragma Export (C, u00038, "ada__exceptions__tracebackS"); u00039 : constant Version_32 := 16#e865e681#; pragma Export (C, u00039, "system__bounded_stringsB"); u00040 : constant Version_32 := 16#455da021#; pragma Export (C, u00040, "system__bounded_stringsS"); u00041 : constant Version_32 := 16#42315736#; pragma Export (C, u00041, "system__crtlS"); u00042 : constant Version_32 := 16#08e0d717#; pragma Export (C, u00042, "system__dwarf_linesB"); u00043 : constant Version_32 := 16#b1bd2788#; pragma Export (C, u00043, "system__dwarf_linesS"); u00044 : constant Version_32 := 16#5b4659fa#; pragma Export (C, u00044, "ada__charactersS"); u00045 : constant Version_32 := 16#8f637df8#; pragma Export (C, u00045, "ada__characters__handlingB"); u00046 : constant Version_32 := 16#3b3f6154#; pragma Export (C, u00046, "ada__characters__handlingS"); u00047 : constant Version_32 := 16#4b7bb96a#; pragma Export (C, u00047, "ada__characters__latin_1S"); u00048 : constant Version_32 := 16#e6d4fa36#; pragma Export (C, u00048, "ada__stringsS"); u00049 : constant Version_32 := 16#e2ea8656#; pragma Export (C, u00049, "ada__strings__mapsB"); u00050 : constant Version_32 := 16#1e526bec#; pragma Export (C, u00050, "ada__strings__mapsS"); u00051 : constant Version_32 := 16#9dc9b435#; pragma Export (C, u00051, "system__bit_opsB"); u00052 : constant Version_32 := 16#0765e3a3#; pragma Export (C, u00052, "system__bit_opsS"); u00053 : constant Version_32 := 16#0626fdbb#; pragma Export (C, u00053, "system__unsigned_typesS"); u00054 : constant Version_32 := 16#92f05f13#; pragma Export (C, u00054, "ada__strings__maps__constantsS"); u00055 : constant Version_32 := 16#5ab55268#; pragma Export (C, u00055, "interfacesS"); u00056 : constant Version_32 := 16#9f00b3d3#; pragma Export (C, u00056, "system__address_imageB"); u00057 : constant Version_32 := 16#934c1c02#; pragma Export (C, u00057, "system__address_imageS"); u00058 : constant Version_32 := 16#ec78c2bf#; pragma Export (C, u00058, "system__img_unsB"); u00059 : constant Version_32 := 16#99d2c14c#; pragma Export (C, u00059, "system__img_unsS"); u00060 : constant Version_32 := 16#d7aac20c#; pragma Export (C, u00060, "system__ioB"); u00061 : constant Version_32 := 16#ace27677#; pragma Export (C, u00061, "system__ioS"); u00062 : constant Version_32 := 16#11faaec1#; pragma Export (C, u00062, "system__mmapB"); u00063 : constant Version_32 := 16#08d13e5f#; pragma Export (C, u00063, "system__mmapS"); u00064 : constant Version_32 := 16#92d882c5#; pragma Export (C, u00064, "ada__io_exceptionsS"); u00065 : constant Version_32 := 16#9d8ecedc#; pragma Export (C, u00065, "system__mmap__os_interfaceB"); u00066 : constant Version_32 := 16#8f4541b8#; pragma Export (C, u00066, "system__mmap__os_interfaceS"); u00067 : constant Version_32 := 16#54632e7c#; pragma Export (C, u00067, "system__os_libB"); u00068 : constant Version_32 := 16#ed466fde#; pragma Export (C, u00068, "system__os_libS"); u00069 : constant Version_32 := 16#d1060688#; pragma Export (C, u00069, "system__case_utilB"); u00070 : constant Version_32 := 16#16a9e8ef#; pragma Export (C, u00070, "system__case_utilS"); u00071 : constant Version_32 := 16#2a8e89ad#; pragma Export (C, u00071, "system__stringsB"); u00072 : constant Version_32 := 16#4c1f905e#; pragma Export (C, u00072, "system__stringsS"); u00073 : constant Version_32 := 16#769e25e6#; pragma Export (C, u00073, "interfaces__cB"); u00074 : constant Version_32 := 16#70be4e8c#; pragma Export (C, u00074, "interfaces__cS"); u00075 : constant Version_32 := 16#d0bc914c#; pragma Export (C, u00075, "system__object_readerB"); u00076 : constant Version_32 := 16#7f932442#; pragma Export (C, u00076, "system__object_readerS"); u00077 : constant Version_32 := 16#1a74a354#; pragma Export (C, u00077, "system__val_lliB"); u00078 : constant Version_32 := 16#a8846798#; pragma Export (C, u00078, "system__val_lliS"); u00079 : constant Version_32 := 16#afdbf393#; pragma Export (C, u00079, "system__val_lluB"); u00080 : constant Version_32 := 16#7cd4aac9#; pragma Export (C, u00080, "system__val_lluS"); u00081 : constant Version_32 := 16#27b600b2#; pragma Export (C, u00081, "system__val_utilB"); u00082 : constant Version_32 := 16#9e0037c6#; pragma Export (C, u00082, "system__val_utilS"); u00083 : constant Version_32 := 16#5bbc3f2f#; pragma Export (C, u00083, "system__exception_tracesB"); u00084 : constant Version_32 := 16#167fa1a2#; pragma Export (C, u00084, "system__exception_tracesS"); u00085 : constant Version_32 := 16#d178f226#; pragma Export (C, u00085, "system__win32S"); u00086 : constant Version_32 := 16#8c33a517#; pragma Export (C, u00086, "system__wch_conB"); u00087 : constant Version_32 := 16#29dda3ea#; pragma Export (C, u00087, "system__wch_conS"); u00088 : constant Version_32 := 16#9721e840#; pragma Export (C, u00088, "system__wch_stwB"); u00089 : constant Version_32 := 16#04cc8feb#; pragma Export (C, u00089, "system__wch_stwS"); u00090 : constant Version_32 := 16#a831679c#; pragma Export (C, u00090, "system__wch_cnvB"); u00091 : constant Version_32 := 16#266a1919#; pragma Export (C, u00091, "system__wch_cnvS"); u00092 : constant Version_32 := 16#ece6fdb6#; pragma Export (C, u00092, "system__wch_jisB"); u00093 : constant Version_32 := 16#a61a0038#; pragma Export (C, u00093, "system__wch_jisS"); u00094 : constant Version_32 := 16#f64b89a4#; pragma Export (C, u00094, "ada__integer_text_ioB"); u00095 : constant Version_32 := 16#b85ee1d1#; pragma Export (C, u00095, "ada__integer_text_ioS"); u00096 : constant Version_32 := 16#1d1c6062#; pragma Export (C, u00096, "ada__text_ioB"); u00097 : constant Version_32 := 16#95711eac#; pragma Export (C, u00097, "ada__text_ioS"); u00098 : constant Version_32 := 16#10558b11#; pragma Export (C, u00098, "ada__streamsB"); u00099 : constant Version_32 := 16#67e31212#; pragma Export (C, u00099, "ada__streamsS"); u00100 : constant Version_32 := 16#d85792d6#; pragma Export (C, u00100, "ada__tagsB"); u00101 : constant Version_32 := 16#8813468c#; pragma Export (C, u00101, "ada__tagsS"); u00102 : constant Version_32 := 16#c3335bfd#; pragma Export (C, u00102, "system__htableB"); u00103 : constant Version_32 := 16#b66232d2#; pragma Export (C, u00103, "system__htableS"); u00104 : constant Version_32 := 16#089f5cd0#; pragma Export (C, u00104, "system__string_hashB"); u00105 : constant Version_32 := 16#143c59ac#; pragma Export (C, u00105, "system__string_hashS"); u00106 : constant Version_32 := 16#1d9142a4#; pragma Export (C, u00106, "system__val_unsB"); u00107 : constant Version_32 := 16#168e1080#; pragma Export (C, u00107, "system__val_unsS"); u00108 : constant Version_32 := 16#4c01b69c#; pragma Export (C, u00108, "interfaces__c_streamsB"); u00109 : constant Version_32 := 16#b1330297#; pragma Export (C, u00109, "interfaces__c_streamsS"); u00110 : constant Version_32 := 16#6f0d52aa#; pragma Export (C, u00110, "system__file_ioB"); u00111 : constant Version_32 := 16#95d1605d#; pragma Export (C, u00111, "system__file_ioS"); u00112 : constant Version_32 := 16#86c56e5a#; pragma Export (C, u00112, "ada__finalizationS"); u00113 : constant Version_32 := 16#95817ed8#; pragma Export (C, u00113, "system__finalization_rootB"); u00114 : constant Version_32 := 16#7d52f2a8#; pragma Export (C, u00114, "system__finalization_rootS"); u00115 : constant Version_32 := 16#cf3f1b90#; pragma Export (C, u00115, "system__file_control_blockS"); u00116 : constant Version_32 := 16#f6fdca1c#; pragma Export (C, u00116, "ada__text_io__integer_auxB"); u00117 : constant Version_32 := 16#b9793d30#; pragma Export (C, u00117, "ada__text_io__integer_auxS"); u00118 : constant Version_32 := 16#181dc502#; pragma Export (C, u00118, "ada__text_io__generic_auxB"); u00119 : constant Version_32 := 16#a6c327d3#; pragma Export (C, u00119, "ada__text_io__generic_auxS"); u00120 : constant Version_32 := 16#b10ba0c7#; pragma Export (C, u00120, "system__img_biuB"); u00121 : constant Version_32 := 16#c00475f6#; pragma Export (C, u00121, "system__img_biuS"); u00122 : constant Version_32 := 16#4e06ab0c#; pragma Export (C, u00122, "system__img_llbB"); u00123 : constant Version_32 := 16#81c36508#; pragma Export (C, u00123, "system__img_llbS"); u00124 : constant Version_32 := 16#9dca6636#; pragma Export (C, u00124, "system__img_lliB"); u00125 : constant Version_32 := 16#23efd4e9#; pragma Export (C, u00125, "system__img_lliS"); u00126 : constant Version_32 := 16#a756d097#; pragma Export (C, u00126, "system__img_llwB"); u00127 : constant Version_32 := 16#28af469e#; pragma Export (C, u00127, "system__img_llwS"); u00128 : constant Version_32 := 16#eb55dfbb#; pragma Export (C, u00128, "system__img_wiuB"); u00129 : constant Version_32 := 16#ae45f264#; pragma Export (C, u00129, "system__img_wiuS"); u00130 : constant Version_32 := 16#d763507a#; pragma Export (C, u00130, "system__val_intB"); u00131 : constant Version_32 := 16#7a05ab07#; pragma Export (C, u00131, "system__val_intS"); u00132 : constant Version_32 := 16#03fc996e#; pragma Export (C, u00132, "ada__real_timeB"); u00133 : constant Version_32 := 16#c3d451b0#; pragma Export (C, u00133, "ada__real_timeS"); u00134 : constant Version_32 := 16#cb56a7b3#; pragma Export (C, u00134, "system__taskingB"); u00135 : constant Version_32 := 16#70384b95#; pragma Export (C, u00135, "system__taskingS"); u00136 : constant Version_32 := 16#c71f56c0#; pragma Export (C, u00136, "system__task_primitivesS"); u00137 : constant Version_32 := 16#fa769fc7#; pragma Export (C, u00137, "system__os_interfaceS"); u00138 : constant Version_32 := 16#22b0e2af#; pragma Export (C, u00138, "interfaces__c__stringsB"); u00139 : constant Version_32 := 16#603c1c44#; pragma Export (C, u00139, "interfaces__c__stringsS"); u00140 : constant Version_32 := 16#fc754292#; pragma Export (C, u00140, "system__task_primitives__operationsB"); u00141 : constant Version_32 := 16#24684c98#; pragma Export (C, u00141, "system__task_primitives__operationsS"); u00142 : constant Version_32 := 16#1b28662b#; pragma Export (C, u00142, "system__float_controlB"); u00143 : constant Version_32 := 16#d25cc204#; pragma Export (C, u00143, "system__float_controlS"); u00144 : constant Version_32 := 16#da8ccc08#; pragma Export (C, u00144, "system__interrupt_managementB"); u00145 : constant Version_32 := 16#0f60a80c#; pragma Export (C, u00145, "system__interrupt_managementS"); u00146 : constant Version_32 := 16#f65595cf#; pragma Export (C, u00146, "system__multiprocessorsB"); u00147 : constant Version_32 := 16#0a0c1e4b#; pragma Export (C, u00147, "system__multiprocessorsS"); u00148 : constant Version_32 := 16#a99e1d66#; pragma Export (C, u00148, "system__os_primitivesB"); u00149 : constant Version_32 := 16#b82f904e#; pragma Export (C, u00149, "system__os_primitivesS"); u00150 : constant Version_32 := 16#b6166bc6#; pragma Export (C, u00150, "system__task_lockB"); u00151 : constant Version_32 := 16#532ab656#; pragma Export (C, u00151, "system__task_lockS"); u00152 : constant Version_32 := 16#1a9147da#; pragma Export (C, u00152, "system__win32__extS"); u00153 : constant Version_32 := 16#77769007#; pragma Export (C, u00153, "system__task_infoB"); u00154 : constant Version_32 := 16#e54688cf#; pragma Export (C, u00154, "system__task_infoS"); u00155 : constant Version_32 := 16#9471a5c6#; pragma Export (C, u00155, "system__tasking__debugB"); u00156 : constant Version_32 := 16#f1f2435f#; pragma Export (C, u00156, "system__tasking__debugS"); u00157 : constant Version_32 := 16#fd83e873#; pragma Export (C, u00157, "system__concat_2B"); u00158 : constant Version_32 := 16#300056e8#; pragma Export (C, u00158, "system__concat_2S"); u00159 : constant Version_32 := 16#2b70b149#; pragma Export (C, u00159, "system__concat_3B"); u00160 : constant Version_32 := 16#39d0dd9d#; pragma Export (C, u00160, "system__concat_3S"); u00161 : constant Version_32 := 16#18e0e51c#; pragma Export (C, u00161, "system__img_enum_newB"); u00162 : constant Version_32 := 16#53ec87f8#; pragma Export (C, u00162, "system__img_enum_newS"); u00163 : constant Version_32 := 16#118e865d#; pragma Export (C, u00163, "system__stack_usageB"); u00164 : constant Version_32 := 16#3a3ac346#; pragma Export (C, u00164, "system__stack_usageS"); u00165 : constant Version_32 := 16#3791e504#; pragma Export (C, u00165, "ada__strings__unboundedB"); u00166 : constant Version_32 := 16#9fdb1809#; pragma Export (C, u00166, "ada__strings__unboundedS"); u00167 : constant Version_32 := 16#144f64ae#; pragma Export (C, u00167, "ada__strings__searchB"); u00168 : constant Version_32 := 16#c1ab8667#; pragma Export (C, u00168, "ada__strings__searchS"); u00169 : constant Version_32 := 16#933d1555#; pragma Export (C, u00169, "system__compare_array_unsigned_8B"); u00170 : constant Version_32 := 16#9ba3f0b5#; pragma Export (C, u00170, "system__compare_array_unsigned_8S"); u00171 : constant Version_32 := 16#97d13ec4#; pragma Export (C, u00171, "system__address_operationsB"); u00172 : constant Version_32 := 16#21ac3f0b#; pragma Export (C, u00172, "system__address_operationsS"); u00173 : constant Version_32 := 16#a2250034#; pragma Export (C, u00173, "system__storage_pools__subpoolsB"); u00174 : constant Version_32 := 16#cc5a1856#; pragma Export (C, u00174, "system__storage_pools__subpoolsS"); u00175 : constant Version_32 := 16#6abe5dbe#; pragma Export (C, u00175, "system__finalization_mastersB"); u00176 : constant Version_32 := 16#695cb8f2#; pragma Export (C, u00176, "system__finalization_mastersS"); u00177 : constant Version_32 := 16#7268f812#; pragma Export (C, u00177, "system__img_boolB"); u00178 : constant Version_32 := 16#c779f0d3#; pragma Export (C, u00178, "system__img_boolS"); u00179 : constant Version_32 := 16#6d4d969a#; pragma Export (C, u00179, "system__storage_poolsB"); u00180 : constant Version_32 := 16#114d1f95#; pragma Export (C, u00180, "system__storage_poolsS"); u00181 : constant Version_32 := 16#9aad1ff1#; pragma Export (C, u00181, "system__storage_pools__subpools__finalizationB"); u00182 : constant Version_32 := 16#fe2f4b3a#; pragma Export (C, u00182, "system__storage_pools__subpools__finalizationS"); u00183 : constant Version_32 := 16#70f25dad#; pragma Export (C, u00183, "system__atomic_countersB"); u00184 : constant Version_32 := 16#86fcacb5#; pragma Export (C, u00184, "system__atomic_countersS"); u00185 : constant Version_32 := 16#5fc82639#; pragma Export (C, u00185, "system__machine_codeS"); u00186 : constant Version_32 := 16#3c420900#; pragma Export (C, u00186, "system__stream_attributesB"); u00187 : constant Version_32 := 16#8bc30a4e#; pragma Export (C, u00187, "system__stream_attributesS"); u00188 : constant Version_32 := 16#97a2d3b4#; pragma Export (C, u00188, "ada__strings__unbounded__text_ioB"); u00189 : constant Version_32 := 16#f26abf4c#; pragma Export (C, u00189, "ada__strings__unbounded__text_ioS"); u00190 : constant Version_32 := 16#64b60562#; pragma Export (C, u00190, "p_stephandlerB"); u00191 : constant Version_32 := 16#c35ffe0a#; pragma Export (C, u00191, "p_stephandlerS"); u00192 : constant Version_32 := 16#a9261bbe#; pragma Export (C, u00192, "p_structuraltypesB"); u00193 : constant Version_32 := 16#386e2dac#; pragma Export (C, u00193, "p_structuraltypesS"); u00194 : constant Version_32 := 16#a347755d#; pragma Export (C, u00194, "ada__text_io__modular_auxB"); u00195 : constant Version_32 := 16#0d2bef47#; pragma Export (C, u00195, "ada__text_io__modular_auxS"); u00196 : constant Version_32 := 16#3e932977#; pragma Export (C, u00196, "system__img_lluB"); u00197 : constant Version_32 := 16#4feffd78#; pragma Export (C, u00197, "system__img_lluS"); u00198 : constant Version_32 := 16#23e4cea4#; pragma Export (C, u00198, "interfaces__cobolB"); u00199 : constant Version_32 := 16#394647ba#; pragma Export (C, u00199, "interfaces__cobolS"); u00200 : constant Version_32 := 16#5a895de2#; pragma Export (C, u00200, "system__pool_globalB"); u00201 : constant Version_32 := 16#7141203e#; pragma Export (C, u00201, "system__pool_globalS"); u00202 : constant Version_32 := 16#ee101ba4#; pragma Export (C, u00202, "system__memoryB"); u00203 : constant Version_32 := 16#6bdde70c#; pragma Export (C, u00203, "system__memoryS"); u00204 : constant Version_32 := 16#84abf528#; pragma Export (C, u00204, "p_stephandler__feistelhandlerB"); u00205 : constant Version_32 := 16#8e57995f#; pragma Export (C, u00205, "p_stephandler__feistelhandlerS"); u00206 : constant Version_32 := 16#e76fa629#; pragma Export (C, u00206, "p_stephandler__inputhandlerB"); u00207 : constant Version_32 := 16#abe41686#; pragma Export (C, u00207, "p_stephandler__inputhandlerS"); u00208 : constant Version_32 := 16#4b3cf578#; pragma Export (C, u00208, "system__byte_swappingS"); u00209 : constant Version_32 := 16#796b5f0d#; pragma Export (C, u00209, "system__sequential_ioB"); u00210 : constant Version_32 := 16#d8cc2bc8#; pragma Export (C, u00210, "system__sequential_ioS"); u00211 : constant Version_32 := 16#0806edc3#; pragma Export (C, u00211, "system__strings__stream_opsB"); u00212 : constant Version_32 := 16#55d4bd57#; pragma Export (C, u00212, "system__strings__stream_opsS"); u00213 : constant Version_32 := 16#17411e58#; pragma Export (C, u00213, "ada__streams__stream_ioB"); u00214 : constant Version_32 := 16#31fc8e02#; pragma Export (C, u00214, "ada__streams__stream_ioS"); u00215 : constant Version_32 := 16#5de653db#; pragma Export (C, u00215, "system__communicationB"); u00216 : constant Version_32 := 16#2bc0d4ea#; pragma Export (C, u00216, "system__communicationS"); u00217 : constant Version_32 := 16#8500a3df#; pragma Export (C, u00217, "p_stephandler__iphandlerB"); u00218 : constant Version_32 := 16#780e2d9b#; pragma Export (C, u00218, "p_stephandler__iphandlerS"); u00219 : constant Version_32 := 16#c0587cca#; pragma Export (C, u00219, "p_stephandler__keyhandlerB"); u00220 : constant Version_32 := 16#3666019b#; pragma Export (C, u00220, "p_stephandler__keyhandlerS"); u00221 : constant Version_32 := 16#13b3baa7#; pragma Export (C, u00221, "p_stephandler__outputhandlerB"); u00222 : constant Version_32 := 16#3db246c7#; pragma Export (C, u00222, "p_stephandler__outputhandlerS"); u00223 : constant Version_32 := 16#290d89e9#; pragma Export (C, u00223, "p_stephandler__reverseiphandlerB"); u00224 : constant Version_32 := 16#f3f8e71c#; pragma Export (C, u00224, "p_stephandler__reverseiphandlerS"); u00225 : constant Version_32 := 16#96bbd7c2#; pragma Export (C, u00225, "system__tasking__rendezvousB"); u00226 : constant Version_32 := 16#ea18a31e#; pragma Export (C, u00226, "system__tasking__rendezvousS"); u00227 : constant Version_32 := 16#100eaf58#; pragma Export (C, u00227, "system__restrictionsB"); u00228 : constant Version_32 := 16#c1c3a556#; pragma Export (C, u00228, "system__restrictionsS"); u00229 : constant Version_32 := 16#6896b958#; pragma Export (C, u00229, "system__tasking__entry_callsB"); u00230 : constant Version_32 := 16#df420580#; pragma Export (C, u00230, "system__tasking__entry_callsS"); u00231 : constant Version_32 := 16#bc23950c#; pragma Export (C, u00231, "system__tasking__initializationB"); u00232 : constant Version_32 := 16#efd25374#; pragma Export (C, u00232, "system__tasking__initializationS"); u00233 : constant Version_32 := 16#72fc64c4#; pragma Export (C, u00233, "system__soft_links__taskingB"); u00234 : constant Version_32 := 16#5ae92880#; pragma Export (C, u00234, "system__soft_links__taskingS"); u00235 : constant Version_32 := 16#17d21067#; pragma Export (C, u00235, "ada__exceptions__is_null_occurrenceB"); u00236 : constant Version_32 := 16#e1d7566f#; pragma Export (C, u00236, "ada__exceptions__is_null_occurrenceS"); u00237 : constant Version_32 := 16#e774edef#; pragma Export (C, u00237, "system__tasking__task_attributesB"); u00238 : constant Version_32 := 16#6bc95a13#; pragma Export (C, u00238, "system__tasking__task_attributesS"); u00239 : constant Version_32 := 16#8bdfec1d#; pragma Export (C, u00239, "system__tasking__protected_objectsB"); u00240 : constant Version_32 := 16#a9001c61#; pragma Export (C, u00240, "system__tasking__protected_objectsS"); u00241 : constant Version_32 := 16#ee80728a#; pragma Export (C, u00241, "system__tracesB"); u00242 : constant Version_32 := 16#c0bde992#; pragma Export (C, u00242, "system__tracesS"); u00243 : constant Version_32 := 16#17aa7da7#; pragma Export (C, u00243, "system__tasking__protected_objects__entriesB"); u00244 : constant Version_32 := 16#427cf21f#; pragma Export (C, u00244, "system__tasking__protected_objects__entriesS"); u00245 : constant Version_32 := 16#1dc86ab7#; pragma Export (C, u00245, "system__tasking__protected_objects__operationsB"); u00246 : constant Version_32 := 16#ba36ad85#; pragma Export (C, u00246, "system__tasking__protected_objects__operationsS"); u00247 : constant Version_32 := 16#ab2f8f51#; pragma Export (C, u00247, "system__tasking__queuingB"); u00248 : constant Version_32 := 16#d1ba2fcb#; pragma Export (C, u00248, "system__tasking__queuingS"); u00249 : constant Version_32 := 16#f9053daa#; pragma Export (C, u00249, "system__tasking__utilitiesB"); u00250 : constant Version_32 := 16#14a33d48#; pragma Export (C, u00250, "system__tasking__utilitiesS"); u00251 : constant Version_32 := 16#bd6fc52e#; pragma Export (C, u00251, "system__traces__taskingB"); u00252 : constant Version_32 := 16#09f07b39#; pragma Export (C, u00252, "system__traces__taskingS"); u00253 : constant Version_32 := 16#d8fc9f88#; pragma Export (C, u00253, "system__tasking__stagesB"); u00254 : constant Version_32 := 16#e9cef940#; pragma Export (C, u00254, "system__tasking__stagesS"); -- BEGIN ELABORATION ORDER -- ada%s -- ada.characters%s -- ada.characters.latin_1%s -- interfaces%s -- system%s -- system.address_operations%s -- system.address_operations%b -- system.byte_swapping%s -- system.case_util%s -- system.case_util%b -- system.float_control%s -- system.float_control%b -- system.img_bool%s -- system.img_bool%b -- system.img_enum_new%s -- system.img_enum_new%b -- system.img_int%s -- system.img_int%b -- system.img_lli%s -- system.img_lli%b -- system.io%s -- system.io%b -- system.machine_code%s -- system.atomic_counters%s -- system.atomic_counters%b -- system.parameters%s -- system.parameters%b -- system.crtl%s -- interfaces.c_streams%s -- interfaces.c_streams%b -- system.restrictions%s -- system.restrictions%b -- system.storage_elements%s -- system.storage_elements%b -- system.stack_checking%s -- system.stack_checking%b -- system.stack_usage%s -- system.stack_usage%b -- system.string_hash%s -- system.string_hash%b -- system.htable%s -- system.htable%b -- system.strings%s -- system.strings%b -- system.traceback_entries%s -- system.traceback_entries%b -- system.traces%s -- system.traces%b -- system.unsigned_types%s -- system.img_biu%s -- system.img_biu%b -- system.img_llb%s -- system.img_llb%b -- system.img_llu%s -- system.img_llu%b -- system.img_llw%s -- system.img_llw%b -- system.img_uns%s -- system.img_uns%b -- system.img_wiu%s -- system.img_wiu%b -- system.wch_con%s -- system.wch_con%b -- system.wch_jis%s -- system.wch_jis%b -- system.wch_cnv%s -- system.wch_cnv%b -- system.compare_array_unsigned_8%s -- system.compare_array_unsigned_8%b -- system.concat_2%s -- system.concat_2%b -- system.concat_3%s -- system.concat_3%b -- system.traceback%s -- system.traceback%b -- system.val_util%s -- system.standard_library%s -- system.exception_traces%s -- ada.exceptions%s -- system.wch_stw%s -- system.val_util%b -- system.val_llu%s -- system.val_lli%s -- system.os_lib%s -- system.bit_ops%s -- ada.characters.handling%s -- ada.exceptions.traceback%s -- system.soft_links%s -- system.exception_table%s -- system.exception_table%b -- ada.io_exceptions%s -- ada.strings%s -- ada.containers%s -- system.exceptions%s -- system.exceptions%b -- system.secondary_stack%s -- system.address_image%s -- system.bounded_strings%s -- system.soft_links%b -- ada.exceptions.last_chance_handler%s -- system.exceptions_debug%s -- system.exceptions_debug%b -- system.exception_traces%b -- system.memory%s -- system.memory%b -- system.wch_stw%b -- system.val_llu%b -- system.val_lli%b -- interfaces.c%s -- system.win32%s -- system.mmap%s -- system.mmap.os_interface%s -- system.mmap.os_interface%b -- system.mmap%b -- system.os_lib%b -- system.bit_ops%b -- ada.strings.maps%s -- ada.strings.maps.constants%s -- ada.characters.handling%b -- ada.exceptions.traceback%b -- system.exceptions.machine%s -- system.exceptions.machine%b -- system.secondary_stack%b -- system.address_image%b -- system.bounded_strings%b -- ada.exceptions.last_chance_handler%b -- system.standard_library%b -- system.object_reader%s -- system.dwarf_lines%s -- system.dwarf_lines%b -- interfaces.c%b -- ada.strings.maps%b -- system.traceback.symbolic%s -- system.traceback.symbolic%b -- ada.exceptions%b -- system.object_reader%b -- ada.exceptions.is_null_occurrence%s -- ada.exceptions.is_null_occurrence%b -- ada.strings.search%s -- ada.strings.search%b -- interfaces.c.strings%s -- interfaces.c.strings%b -- interfaces.cobol%s -- interfaces.cobol%b -- system.multiprocessors%s -- system.multiprocessors%b -- system.os_interface%s -- system.interrupt_management%s -- system.interrupt_management%b -- system.task_info%s -- system.task_info%b -- system.task_lock%s -- system.task_lock%b -- system.task_primitives%s -- system.val_uns%s -- system.val_uns%b -- ada.tags%s -- ada.tags%b -- ada.streams%s -- ada.streams%b -- system.communication%s -- system.communication%b -- system.file_control_block%s -- system.finalization_root%s -- system.finalization_root%b -- ada.finalization%s -- system.file_io%s -- system.file_io%b -- ada.streams.stream_io%s -- ada.streams.stream_io%b -- system.storage_pools%s -- system.storage_pools%b -- system.finalization_masters%s -- system.finalization_masters%b -- system.storage_pools.subpools%s -- system.storage_pools.subpools.finalization%s -- system.storage_pools.subpools%b -- system.storage_pools.subpools.finalization%b -- system.stream_attributes%s -- system.stream_attributes%b -- ada.strings.unbounded%s -- ada.strings.unbounded%b -- system.val_int%s -- system.val_int%b -- system.win32.ext%s -- system.os_primitives%s -- system.os_primitives%b -- system.tasking%s -- system.task_primitives.operations%s -- system.tasking.debug%s -- system.tasking%b -- system.task_primitives.operations%b -- system.tasking.debug%b -- system.traces.tasking%s -- system.traces.tasking%b -- ada.real_time%s -- ada.real_time%b -- ada.text_io%s -- ada.text_io%b -- ada.strings.unbounded.text_io%s -- ada.strings.unbounded.text_io%b -- ada.text_io.generic_aux%s -- ada.text_io.generic_aux%b -- ada.text_io.integer_aux%s -- ada.text_io.integer_aux%b -- ada.integer_text_io%s -- ada.integer_text_io%b -- ada.text_io.modular_aux%s -- ada.text_io.modular_aux%b -- system.pool_global%s -- system.pool_global%b -- system.sequential_io%s -- system.sequential_io%b -- system.soft_links.tasking%s -- system.soft_links.tasking%b -- system.strings.stream_ops%s -- system.strings.stream_ops%b -- system.tasking.initialization%s -- system.tasking.task_attributes%s -- system.tasking.initialization%b -- system.tasking.task_attributes%b -- system.tasking.protected_objects%s -- system.tasking.protected_objects%b -- system.tasking.protected_objects.entries%s -- system.tasking.protected_objects.entries%b -- system.tasking.queuing%s -- system.tasking.queuing%b -- system.tasking.utilities%s -- system.tasking.utilities%b -- system.tasking.entry_calls%s -- system.tasking.rendezvous%s -- system.tasking.protected_objects.operations%s -- system.tasking.protected_objects.operations%b -- system.tasking.entry_calls%b -- system.tasking.rendezvous%b -- system.tasking.stages%s -- system.tasking.stages%b -- p_structuraltypes%s -- p_structuraltypes%b -- p_stephandler%s -- p_stephandler%b -- p_stephandler.feistelhandler%s -- p_stephandler.feistelhandler%b -- p_stephandler.inputhandler%s -- p_stephandler.inputhandler%b -- p_stephandler.iphandler%s -- p_stephandler.iphandler%b -- p_stephandler.keyhandler%s -- p_stephandler.keyhandler%b -- p_stephandler.outputhandler%s -- p_stephandler.outputhandler%b -- p_stephandler.reverseiphandler%s -- p_stephandler.reverseiphandler%b -- mainparallel%b -- END ELABORATION ORDER end ada_main;
dan76/Amass
Ada
503
ads
-- Copyright © by Jeff Foley 2017-2023. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 name = "UKWebArchive" type = "archive" function start() set_rate_limit(3) end function vertical(ctx, domain) scrape(ctx, {['url']=build_url(domain)}) end function build_url(domain) return "https://www.webarchive.org.uk/wayback/archive/cdx?matchType=domain&output=json&url=" .. domain end
Brawdunoir/administrative-family-tree-manager
Ada
5,243
ads
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package Registre is type T_Registre is private; type T_Donnee is private; Cle_Presente_Exception_Reg : Exception; -- une clé est déjà présente dans un Registre Cle_Absente_Exception_Reg : Exception; -- une clé est absente d'un Registre -- Creer une clé Cle à partir d'une donnée Donnee sous le modèle suivant : -- Cle = 100 000 000*Mois_N + 1 000 000*Jour_N + 100*Annee_N + X (Avec X entre 0 et 99, en assumant qu'il y a au maximum 100 naissances par jour) -- Exemple : clé associée à la donnée Sabrina Tavares 24 Août 1999 F qui est la deuxième personne née le 24 Août 1999. -- sera 0824199900 -- Assure : Cle >= 0 procedure Creer_Cle (Reg : in T_Registre; Cle : out Integer; Donnee : in T_Donnee) with Post => Cle >= 0; -- Initialiser une donnée Donnee -- Paramètres : Donnee out T_Donnee -- Nom in Chaîne de caractères -- Prenom in Chaîne de caractères -- Jour_N in Entier -- Mois_N in Entier -- Annee_N in Entier -- Sexe in Caractère procedure Initialiser_Donnee ( Donnee : out T_Donnee; Nom : in unbounded_string; Prenom : in unbounded_string; Jour_N : in Integer; Mois_N : in Integer; Annee_N : in Integer; Sexe : in Character); -- Initialiser un Registre Reg. Le Registre est vide. -- Paramètres : Reg out T_Registre procedure Initialiser_Reg(Reg: out T_Registre; Cle : in Integer; Donnee : in T_Donnee); -- Supprimer tous les éléments d'un Registre. -- Doit être utilisée dès qu'on sait qu'un Registre ne sera plus utilisé. -- Paramètres : Reg in out T_Registre -- Assure : Est_Vide(Reg) procedure Vider (Reg : in out T_Registre) with Post => Est_Vide (Reg); -- Renvoie True si le registre est vide, False sinon -- Paramètres : Reg in T_Registre function Est_Vide (Reg : in T_Registre) return Boolean; -- Obtenir le nombre d'éléments d'un Registre. -- Paramètres : Reg : in T_Registre -- Assure : Taille >= 0 et Taille = 0 si Est_Vide(Reg) function Taille (Reg : in T_Registre) return Integer with Post => Taille'Result >= 0 and (Taille'Result = 0) = Est_Vide (Reg); -- Insérer la donnée Donnee associée à la clé Cle dans le Registre Reg. -- Paramètres : Reg in out T_Registre -- Cle : in Entier -- Donnee : in T_Donnee -- Exception : Cle_Presente_Exception si Cle est déjà dans Reg. -- Assure : La_Donnee(Reg,Cle) = Donnee et Taill(Reg) = Taille(Reg)'Old + 1 procedure Inserer (Reg : in out T_Registre ; Cle : in Integer ; Donnee : in T_Donnee) with Post => La_Donnee (Reg, Cle) = Donnee -- donnée insérée and Taille (Reg) = Taille (Reg)'Old + 1; -- un élément de plus -- Modifier la donnée Donnee associée à la clé Cle dans le Registre Reg. -- Paramètres : Reg in out T_Registre -- Cle in Entier -- Donnee in T_Donnee -- Exception : Cle_Absente_Exception si Cle n'est pas utilisée dans Reg -- Assure : La_Donnee(Reg,Cle) = Donnee procedure Modifier (Reg : in out T_Registre ; Cle : in Integer ; Donnee : in T_Donnee) with Post => La_Donnee (Reg, Cle) = Donnee; -- donnée mise à jour -- Supprimer la donnée associée à la clé Cle dans le Registre Reg. -- Paramètres : Reg in out T_Registre -- Cle in Entier -- Exception : Cle_Absente_Exception si Cle n'est pas utilisée dans Reg -- Assure : Taille(Reg) = Taille(Reg)'Old - 1 procedure Supprimer (Reg : in out T_Registre ; Cle : in Integer) with Post => Taille (Reg) = Taille (Reg)'Old - 1; -- un élément de moins -- Obtenir la donnée associée à la clé Cle dans le Registre Reg. -- Paramètres : Reg in T_Registre -- Cle in Entier -- Exception : Cle_Absente_Exception si Cle n'est pas utilisée dans Reg function La_Donnee (Reg : in T_Registre ; Cle : in Integer) return T_Donnee; function Retourner_Nom (Reg : in T_Registre; Cle : in Integer) return unbounded_string; -- Afficher un Registre Reg dans l'ordre croissant des clés (parcours infixe) -- Paramètres : Reg in T_Registre procedure Afficher (Reg : in T_Registre); -- Afficher un ABR Abr (en faisant apparaître la strucre grâce à une -- indendation et un signe '<', '>', '/' pour indiquer la sous-arbre -- gauche, '>' pour un sous arbre droit et '/' pour la racine) -- Exemple : -- -- / Cle1 : Valeur1 -- < Cle2 : Valeur2 -- > Cle3 : Valeur3 -- > Cle4 : Valeur 4 -- < Cle5 : Valeur 5 --procedure Afficher_Debug (Abr : in T_Registre); private -- Donnée qu'on souhaite ajouter au registre pour un ancêtre donné. type T_Donnee is record Nom : unbounded_string; Prenom : unbounded_string; Jour_N : Integer; Mois_N : Integer; Annee_N : Integer; Sexe : Character; end record; type T_Cellule; type T_Registre is access T_Cellule; type T_Cellule is record Cle: Integer; Donnee : T_Donnee; Sous_Arbre_Gauche : T_Registre; Sous_Arbre_Droit : T_Registre; end record; end Registre;
strenkml/EE368
Ada
1,498
adb
with Memory.Prefetch; with Util; use Util; separate (Parser) procedure Parse_Prefetch(parser : in out Parser_Type; result : out Memory_Pointer) is mem : Memory_Pointer := null; stride : Address_Type := 1; begin while Get_Type(parser) = Open loop Match(parser, Open); declare name : constant String := Get_Value(parser); begin Match(parser, Literal); if name = "memory" then if mem /= null then Raise_Error(parser, "memory set multiple times in prefetch"); end if; Parse_Memory(parser, mem); else declare value : constant String := Get_Value(parser); begin Match(parser, Literal); if name = "stride" then stride := Address_Type'Value(value); else Raise_Error(parser, "invalid attribute in prefetch: " & name); end if; end; end if; end; Match(parser, Close); end loop; if mem = null then Raise_Error(parser, "memory not set in prefetch"); end if; result := Memory_Pointer(Prefetch.Create_Prefetch(mem, stride)); exception when Data_Error | Constraint_Error => Destroy(mem); Raise_Error(parser, "invalid value in prefetch"); when Parse_Error => Destroy(mem); raise Parse_Error; end Parse_Prefetch;
KipodAfterFree/KAF-2019-FireHog
Ada
10,569
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Form_Demo.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer <[email protected]> 1996 -- Version Control -- $Revision: 1.9 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Sample.Manifest; use Sample.Manifest; with Sample.Helpers; use Sample.Helpers; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Explanation; use Sample.Explanation; package body Sample.Form_Demo.Aux is procedure Geometry (F : in Form; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position) -- Proposed Column for menu is begin Scale (F, L, C); L := L + 2; -- count for frame at top and bottom C := C + 2; -- " -- Calculate horizontal coordinate at the screen center X := (Columns - C) / 2; Y := 1; -- start always in line 1 end Geometry; function Create (F : Form; Title : String; Lin : Line_Position; Col : Column_Position) return Panel is W, S : Window; L : Line_Count; C : Column_Count; Y : Line_Position; X : Column_Position; Pan : Panel; begin Geometry (F, L, C, Y, X); W := New_Window (L, C, Lin, Col); Set_Meta_Mode (W); Set_KeyPad_Mode (W); if Has_Colors then Set_Background (Win => W, Ch => (Ch => ' ', Color => Default_Colors, Attr => Normal_Video)); Set_Character_Attributes (Win => W, Color => Default_Colors, Attr => Normal_Video); Erase (W); end if; S := Derived_Window (W, L - 2, C - 2, 1, 1); Set_Meta_Mode (S); Set_KeyPad_Mode (S); Box (W); Set_Window (F, W); Set_Sub_Window (F, S); if Title'Length > 0 then Window_Title (W, Title); end if; Pan := New_Panel (W); Post (F); return Pan; end Create; procedure Destroy (F : in Form; P : in out Panel) is W, S : Window; begin W := Get_Window (F); S := Get_Sub_Window (F); Post (F, False); Erase (W); Delete (P); Set_Window (F, Null_Window); Set_Sub_Window (F, Null_Window); Delete (S); Delete (W); Update_Panels; end Destroy; function Get_Request (F : Form; P : Panel; Handle_CRLF : Boolean := True) return Key_Code is W : constant Window := Get_Window (F); K : Real_Key_Code; Ch : Character; begin Top (P); loop K := Get_Key (W); if K in Special_Key_Code'Range then case K is when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("FORMKEYS"); when Key_Home => return F_First_Field; when Key_End => return F_Last_Field; when QUIT_CODE => return QUIT; when Key_Cursor_Down => return F_Down_Char; when Key_Cursor_Up => return F_Up_Char; when Key_Cursor_Left => return F_Previous_Char; when Key_Cursor_Right => return F_Next_Char; when Key_Next_Page => return F_Next_Page; when Key_Previous_Page => return F_Previous_Page; when Key_Backspace => return F_Delete_Previous; when Key_Clear_Screen => return F_Clear_Field; when Key_Clear_End_Of_Line => return F_Clear_EOF; when others => return K; end case; elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is when CAN => return QUIT; -- CTRL-X when ACK => return F_Next_Field; -- CTRL-F when STX => return F_Previous_Field; -- CTRL-B when FF => return F_Left_Field; -- CTRL-L when DC2 => return F_Right_Field; -- CTRL-R when NAK => return F_Up_Field; -- CTRL-U when EOT => return F_Down_Field; -- CTRL-D when ETB => return F_Next_Word; -- CTRL-W when DC4 => return F_Previous_Word; -- CTRL-T when SOH => return F_Begin_Field; -- CTRL-A when ENQ => return F_End_Field; -- CTRL-E when HT => return F_Insert_Char; -- CTRL-I when SI => return F_Insert_Line; -- CTRL-O when SYN => return F_Delete_Char; -- CTRL-V when BS => return F_Delete_Previous; -- CTRL-H when EM => return F_Delete_Line; -- CTRL-Y when BEL => return F_Delete_Word; -- CTRL-G when VT => return F_Clear_EOF; -- CTRL-K when SO => return F_Next_Choice; -- CTRL-N when DLE => return F_Previous_Choice; -- CTRL-P when CR | LF => if Handle_CRLF then return F_New_Line; else return K; end if; when others => return K; end case; else return K; end if; end loop; end Get_Request; function Make (Top : Line_Position; Left : Column_Position; Text : String) return Field is Fld : Field; C : Column_Count := Column_Count (Text'Length); begin Fld := New_Field (1, C, Top, Left); Set_Buffer (Fld, 0, Text); Switch_Options (Fld, (Active => True, others => False), False); if Has_Colors then Set_Background (Fld => Fld, Color => Default_Colors); end if; return Fld; end Make; function Make (Height : Line_Count := 1; Width : Column_Count; Top : Line_Position; Left : Column_Position; Off_Screen : Natural := 0) return Field is Fld : Field := New_Field (Height, Width, Top, Left, Off_Screen); begin if Has_Colors then Set_Foreground (Fld => Fld, Color => Form_Fore_Color); Set_Background (Fld => Fld, Color => Form_Back_Color); else Set_Background (Fld, (Reverse_Video => True, others => False)); end if; return Fld; end Make; function Default_Driver (F : Form; K : Key_Code; P : Panel) return Boolean is begin if K in User_Key_Code'Range and then K = QUIT then if Driver (F, F_Validate_Field) = Form_Ok then return True; end if; end if; return False; end Default_Driver; function Count_Active (F : Form) return Natural is N : Natural := 0; O : Field_Option_Set; H : constant Natural := Field_Count (F); begin if H > 0 then for I in 1 .. H loop Get_Options (Fields (F, I), O); if O.Active then N := N + 1; end if; end loop; end if; return N; end Count_Active; end Sample.Form_Demo.Aux;
reznikmm/matreshka
Ada
3,724
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Text_Index_Entry_Link_End_Elements is pragma Preelaborate; type ODF_Text_Index_Entry_Link_End is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_Index_Entry_Link_End_Access is access all ODF_Text_Index_Entry_Link_End'Class with Storage_Size => 0; end ODF.DOM.Text_Index_Entry_Link_End_Elements;
osannolik/Ada_Drivers_Library
Ada
67
ads
package STM32.Board is pragma Elaborate_Body; end STM32.Board;
pok-kernel/pok
Ada
529
ads
-- POK header -- -- The following file is a part of the POK project. Any modification should -- be made according to the POK licence. You CANNOT use this file or a part -- of a file for your own project. -- -- For more information on the POK licence, please see our LICENCE FILE -- -- Please follow the coding guidelines described in doc/CODING_GUIDELINES -- -- Copyright (c) 2007-2022 POK team package Subprograms is procedure Hello_Part1; end Subprograms;
francesco-bongiovanni/ewok-kernel
Ada
752
ads
package types.c with SPARK_Mode => Off is type t_retval is (SUCCESS, FAILURE) with size => 8; for t_retval use (SUCCESS => 0, FAILURE => 1); -- -- C string -- type c_string is array (positive range <>) of aliased character; for c_string'component_size use character'size; -- C_string length (without nul character) function len (s : c_string) return natural; -- String conversion procedure to_c (dst : out c_string; src : in string); procedure to_ada (dst : out string; src : in c_string); -- -- C buffer -- subtype c_buffer is byte_array; -- alias -- -- Boolean -- type bool is new boolean with size => 8; for bool use (true => 1, false => 0); end types.c;
AdaCore/gpr
Ada
43
ads
package Api is procedure Call; end Api;
reznikmm/matreshka
Ada
3,609
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.UMLDI.UML_Styles.Hash is new AMF.Elements.Generic_Hash (UMLDI_UML_Style, UMLDI_UML_Style_Access);
AdaCore/libadalang
Ada
4,669
ads
------------------------------------------------------------------------------ -- -- -- GNATcoverage -- -- -- -- Copyright (C) 2008-2012, AdaCore -- -- -- -- GNATcoverage 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 software is distributed in the hope that it will be useful -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- -- License for more details. You should have received a copy of the GNU -- -- General Public License distributed with this software; see file -- -- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- -- of the license. -- ------------------------------------------------------------------------------ -- Abstract support for disassembly engines with Binary_Files; use Binary_Files; with Traces; use Traces; with Disa_Symbolize; use Disa_Symbolize; with Highlighting; package Disassemblers is type Disassembler is limited interface; function Get_Insn_Length (Self : Disassembler; Insn_Bin : Binary_Content) return Positive is abstract; -- Return the length of the instruction at the beginning of Insn_Bin procedure Disassemble_Insn (Self : Disassembler; Insn_Bin : Binary_Content; Pc : Pc_Type; Buffer : in out Highlighting.Buffer_Type; Insn_Len : out Natural; Sym : Symbolizer'Class) is abstract; -- Disassemble instruction at ADDR, and put the result in LINE/LINE_POS. -- LINE_POS is the index of the next character to be written (ie line -- length if Line'First = 1). type Dest is record Target : Pc_Type; -- Target address of the branch destination Delay_Slot : Pc_Type := No_PC; -- Set to the delay slot address end record; function "<" (Left, Right : Dest) return Boolean; -- Lexicographical order procedure Get_Insn_Properties (Self : Disassembler; Insn_Bin : Binary_Content; Pc : Pc_Type; Branch : out Branch_Kind; Flag_Indir : out Boolean; Flag_Cond : out Boolean; Branch_Dest : out Dest; FT_Dest : out Dest) is abstract; -- Determine whether the given instruction, located at PC, is a branch -- instruction of some kind (indicated by Branch). -- For a branch, indicate whether it is indirect (Flag_Indir) and whether -- it is conditional (Flag_Cond), and determine its destination -- (Branch_Dest); if it is conditional, determine the destination if the -- condition is no verified (FT_Dest). -- Note: Delay_Slot needs to be set even if the case of a fallthrough -- destination, where the Target will be the next sequential instruction -- after the delay slot. function Is_Padding (Self : Disassembler; Insn_Bin : Binary_Content; Pc : Pc_Type) return Boolean is abstract; -- Return whether the given instruction, located at PC, is a potential -- padding (NOP) instruction. procedure Abort_Disassembler_Error (PC : Pc_Type; Insn_Bin : Binary_Content; Exn_Info : String); -- Print an error message suitable for disassembler error reports, giving -- enough context information to investigate and debug disassembly issues. function Get_Mnemonic_Kind (Branch : Branch_Kind; Flag_Cond : Boolean) return Highlighting.Some_Token_Kind is (case Branch is when Br_Call | Br_Ret => (if Flag_Cond then Highlighting.Mnemonic_Branch else Highlighting.Mnemonic_Call), when Br_Jmp => (if Flag_Cond then Highlighting.Mnemonic_Branch else Highlighting.Mnemonic_Call), when others => Highlighting.Mnemonic); -- Given some instruction properties, return the mnemonic token kind -- suitable for it. Note that Disassemble_Insn do not return specialized -- mnemonic tokens itself because it would require information that can -- be costly to compute. end Disassemblers;
shintakezou/drake
Ada
19,089
adb
with Ada.Exceptions.Finally; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with System; package body Ada.Containers.Indefinite_Hashed_Maps is use type Hash_Tables.Table_Access; use type Copy_On_Write.Data_Access; function Upcast is new Unchecked_Conversion (Cursor, Hash_Tables.Node_Access); function Downcast is new Unchecked_Conversion (Hash_Tables.Node_Access, Cursor); function Upcast is new Unchecked_Conversion (Data_Access, Copy_On_Write.Data_Access); function Downcast is new Unchecked_Conversion (Copy_On_Write.Data_Access, Data_Access); procedure Free is new Unchecked_Deallocation (Key_Type, Key_Access); procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access); procedure Free is new Unchecked_Deallocation (Node, Cursor); type Context_Type is limited record Left : not null access Key_Type; end record; pragma Suppress_Initialization (Context_Type); function Equivalent_Key ( Position : not null Hash_Tables.Node_Access; Params : System.Address) return Boolean; function Equivalent_Key ( Position : not null Hash_Tables.Node_Access; Params : System.Address) return Boolean is Context : Context_Type; for Context'Address use Params; begin return Equivalent_Keys ( Context.Left.all, Downcast (Position).Key.all); end Equivalent_Key; procedure Allocate_Element ( Item : out Element_Access; New_Item : Element_Type); procedure Allocate_Element ( Item : out Element_Access; New_Item : Element_Type) is begin Item := new Element_Type'(New_Item); end Allocate_Element; procedure Allocate_Node ( Item : out Cursor; Key : Key_Type; New_Item : Element_Type); procedure Allocate_Node ( Item : out Cursor; Key : Key_Type; New_Item : Element_Type) is procedure Finally (X : in out Cursor); procedure Finally (X : in out Cursor) is begin Free (X.Key); Free (X); end Finally; package Holder is new Exceptions.Finally.Scoped_Holder (Cursor, Finally); X : aliased Cursor := new Node; begin Holder.Assign (X); X.Key := new Key_Type'(Key); Allocate_Element (X.Element, New_Item); Holder.Clear; Item := X; end Allocate_Node; procedure Copy_Node ( Target : out Hash_Tables.Node_Access; Source : not null Hash_Tables.Node_Access); procedure Copy_Node ( Target : out Hash_Tables.Node_Access; Source : not null Hash_Tables.Node_Access) is Source_Node : constant Cursor := Downcast (Source); New_Node : Cursor; begin Allocate_Node (New_Node, Source_Node.Key.all, Source_Node.Element.all); Target := Upcast (New_Node); end Copy_Node; procedure Free_Node (Object : in out Hash_Tables.Node_Access); procedure Free_Node (Object : in out Hash_Tables.Node_Access) is X : Cursor := Downcast (Object); begin Free (X.Key); Free (X.Element); Free (X); Object := null; end Free_Node; procedure Allocate_Data ( Target : out not null Copy_On_Write.Data_Access; New_Length : Count_Type; Capacity : Count_Type); procedure Allocate_Data ( Target : out not null Copy_On_Write.Data_Access; New_Length : Count_Type; Capacity : Count_Type) is pragma Unreferenced (New_Length); New_Data : constant Data_Access := new Data'(Super => <>, Table => null, Length => 0); begin Hash_Tables.Rebuild (New_Data.Table, Capacity); Target := Upcast (New_Data); end Allocate_Data; procedure Copy_Data ( Target : out not null Copy_On_Write.Data_Access; Source : not null Copy_On_Write.Data_Access; Length : Count_Type; New_Length : Count_Type; Capacity : Count_Type); procedure Copy_Data ( Target : out not null Copy_On_Write.Data_Access; Source : not null Copy_On_Write.Data_Access; Length : Count_Type; New_Length : Count_Type; Capacity : Count_Type) is pragma Unreferenced (Length); pragma Unreferenced (New_Length); New_Data : constant Data_Access := new Data'(Super => <>, Table => null, Length => 0); begin Hash_Tables.Copy ( New_Data.Table, New_Data.Length, Downcast (Source).Table, Capacity, Copy => Copy_Node'Access); Target := Upcast (New_Data); end Copy_Data; procedure Free is new Unchecked_Deallocation (Data, Data_Access); procedure Free_Data (Data : in out Copy_On_Write.Data_Access); procedure Free_Data (Data : in out Copy_On_Write.Data_Access) is X : Data_Access := Downcast (Data); begin Hash_Tables.Free (X.Table, X.Length, Free => Free_Node'Access); Free (X); Data := null; end Free_Data; procedure Reallocate ( Container : in out Map; Capacity : Count_Type; To_Update : Boolean); procedure Reallocate ( Container : in out Map; Capacity : Count_Type; To_Update : Boolean) is begin Copy_On_Write.Unique ( Target => Container.Super'Access, Target_Length => 0, -- Length is unused Target_Capacity => Indefinite_Hashed_Maps.Capacity (Container), New_Length => 0, New_Capacity => Capacity, To_Update => To_Update, Allocate => Allocate_Data'Access, Move => Copy_Data'Access, Copy => Copy_Data'Access, Free => Free_Data'Access, Max_Length => Copy_On_Write.Zero'Access); end Reallocate; procedure Unique (Container : in out Map; To_Update : Boolean); procedure Unique (Container : in out Map; To_Update : Boolean) is begin if Copy_On_Write.Shared (Container.Super.Data) then Reallocate ( Container, Capacity (Container), -- not shrinking To_Update); end if; end Unique; function Find (Container : Map; Hash : Hash_Type; Key : Key_Type) return Cursor; function Find (Container : Map; Hash : Hash_Type; Key : Key_Type) return Cursor is begin if Is_Empty (Container) then return null; else Unique (Container'Unrestricted_Access.all, False); declare Context : Context_Type := (Left => Key'Unrestricted_Access); begin return Downcast (Hash_Tables.Find ( Downcast (Container.Super.Data).Table, Hash, Context'Address, Equivalent => Equivalent_Key'Access)); end; end if; end Find; -- implementation function Empty_Map return Map is begin return (Finalization.Controlled with Super => (null, null)); end Empty_Map; function Has_Element (Position : Cursor) return Boolean is begin return Position /= null; end Has_Element; overriding function "=" (Left, Right : Map) return Boolean is function Equivalent (Left, Right : not null Hash_Tables.Node_Access) return Boolean; function Equivalent (Left, Right : not null Hash_Tables.Node_Access) return Boolean is begin return Equivalent_Keys ( Downcast (Left).Key.all, Downcast (Right).Key.all) and then Downcast (Left).Element.all = Downcast (Right).Element.all; end Equivalent; Left_Length : constant Count_Type := Length (Left); Right_Length : constant Count_Type := Length (Right); begin if Left_Length /= Right_Length then return False; elsif Left_Length = 0 or else Left.Super.Data = Right.Super.Data then return True; else Unique (Left'Unrestricted_Access.all, False); -- private Unique (Right'Unrestricted_Access.all, False); -- private declare Left_Data : constant Data_Access := Downcast (Left.Super.Data); Right_Data : constant Data_Access := Downcast (Right.Super.Data); begin return Hash_Tables.Equivalent ( Left_Data.Table, Left_Data.Length, Right_Data.Table, Right_Data.Length, Equivalent => Equivalent'Access); end; end if; end "="; function Capacity (Container : Map) return Count_Type is Data : constant Data_Access := Downcast (Container.Super.Data); begin if Data = null then return 0; else return Hash_Tables.Capacity (Data.Table); end if; end Capacity; procedure Reserve_Capacity ( Container : in out Map; Capacity : Count_Type) is New_Capacity : constant Count_Type := Count_Type'Max (Capacity, Length (Container)); begin Reallocate (Container, New_Capacity, True); end Reserve_Capacity; function Length (Container : Map) return Count_Type is Data : constant Data_Access := Downcast (Container.Super.Data); begin if Data = null then return 0; else return Data.Length; end if; end Length; function Is_Empty (Container : Map) return Boolean is Data : constant Data_Access := Downcast (Container.Super.Data); begin return Data = null or else Data.Length = 0; end Is_Empty; procedure Clear (Container : in out Map) is begin Copy_On_Write.Clear (Container.Super'Access, Free => Free_Data'Access); end Clear; function Key (Position : Cursor) return Key_Type is begin return Position.Key.all; end Key; function Element (Position : Cursor) return Element_Type is begin return Position.Element.all; end Element; procedure Replace_Element ( Container : in out Map; Position : Cursor; New_Item : Element_Type) is begin Unique (Container, True); Free (Position.Element); Allocate_Element (Position.Element, New_Item); end Replace_Element; procedure Query_Element ( Position : Cursor; Process : not null access procedure ( Key : Key_Type; Element : Element_Type)) is begin Process (Position.Key.all, Position.Element.all); end Query_Element; procedure Update_Element ( Container : in out Map'Class; Position : Cursor; Process : not null access procedure ( Key : Key_Type; Element : in out Element_Type)) is begin Process ( Position.Key.all, Reference (Map (Container), Position).Element.all); end Update_Element; function Constant_Reference (Container : aliased Map; Position : Cursor) return Constant_Reference_Type is pragma Unreferenced (Container); begin return (Element => Position.Element.all'Access); end Constant_Reference; function Reference (Container : aliased in out Map; Position : Cursor) return Reference_Type is begin Unique (Container, True); -- diff return (Element => Position.Element.all'Access); end Reference; function Constant_Reference (Container : aliased Map; Key : Key_Type) return Constant_Reference_Type is begin return Constant_Reference (Container, Find (Container, Key)); end Constant_Reference; function Reference (Container : aliased in out Map; Key : Key_Type) return Reference_Type is begin return Reference (Container, Find (Container, Key)); end Reference; procedure Assign (Target : in out Map; Source : Map) is begin Copy_On_Write.Assign ( Target.Super'Access, Source.Super'Access, Free => Free_Data'Access); end Assign; function Copy (Source : Map; Capacity : Count_Type := 0) return Map is begin return Result : Map do Copy_On_Write.Copy ( Result.Super'Access, Source.Super'Access, 0, -- Length is unused Count_Type'Max (Capacity, Length (Source)), Allocate => Allocate_Data'Access, Copy => Copy_Data'Access); end return; end Copy; procedure Move (Target : in out Map; Source : in out Map) is begin Copy_On_Write.Move ( Target.Super'Access, Source.Super'Access, Free => Free_Data'Access); -- diff end Move; procedure Insert ( Container : in out Map; Key : Key_Type; New_Item : Element_Type; Position : out Cursor; Inserted : out Boolean) is -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff New_Hash : constant Hash_Type := Hash (Key); begin -- diff -- diff Position := Find (Container, New_Hash, Key); Inserted := Position = null; if Inserted then Unique (Container, True); Allocate_Node (Position, Key, New_Item); declare Data : constant Data_Access := Downcast (Container.Super.Data); begin Hash_Tables.Insert ( Data.Table, Data.Length, New_Hash, Upcast (Position)); end; end if; end Insert; -- diff (Insert) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Insert ( Container : in out Map; Key : Key_Type; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, Key, New_Item, Position, Inserted); if not Inserted then raise Constraint_Error; end if; end Insert; procedure Include ( Container : in out Map; Key : Key_Type; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, Key, New_Item, Position, Inserted); if not Inserted then Replace_Element (Container, Position, New_Item); end if; end Include; procedure Replace ( Container : in out Map; Key : Key_Type; New_Item : Element_Type) is begin Replace_Element (Container, Find (Container, Key), New_Item); end Replace; procedure Exclude (Container : in out Map; Key : Key_Type) is Position : Cursor := Find (Container, Key); begin if Position /= null then Delete (Container, Position); end if; end Exclude; procedure Delete (Container : in out Map; Key : Key_Type) is Position : Cursor := Find (Container, Key); begin Delete (Container, Position); end Delete; procedure Delete (Container : in out Map; Position : in out Cursor) is Position_2 : Hash_Tables.Node_Access := Upcast (Position); begin Unique (Container, True); declare Data : constant Data_Access := Downcast (Container.Super.Data); begin Hash_Tables.Remove (Data.Table, Data.Length, Position_2); end; Free_Node (Position_2); Position := null; end Delete; function First (Container : Map) return Cursor is begin if Is_Empty (Container) then return null; else Unique (Container'Unrestricted_Access.all, False); return Downcast (Hash_Tables.First ( Downcast (Container.Super.Data).Table)); end if; end First; function Next (Position : Cursor) return Cursor is begin return Downcast (Position.Super.Next); end Next; procedure Next (Position : in out Cursor) is begin Position := Downcast (Position.Super.Next); end Next; function Find (Container : Map; Key : Key_Type) return Cursor is begin return Find (Container, Hash (Key), Key); end Find; function Element ( Container : Map'Class; Key : Key_Type) return Element_Type is begin return Element (Find (Map (Container), Key)); end Element; function Contains (Container : Map; Key : Key_Type) return Boolean is begin return Find (Container, Key) /= null; end Contains; function Equivalent_Keys (Left, Right : Cursor) return Boolean is begin return Equivalent_Keys (Left.Key.all, Right.Key.all); end Equivalent_Keys; function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean is begin return Equivalent_Keys (Left.Key.all, Right); end Equivalent_Keys; function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean is begin return Equivalent_Keys (Left, Right.Key.all); end Equivalent_Keys; procedure Iterate ( Container : Map'Class; Process : not null access procedure (Position : Cursor)) is type P1 is access procedure (Position : Cursor); type P2 is access procedure (Position : Hash_Tables.Node_Access); function Cast is new Unchecked_Conversion (P1, P2); begin if not Is_Empty (Map (Container)) then Unique (Map (Container)'Unrestricted_Access.all, False); Hash_Tables.Iterate ( Downcast (Container.Super.Data).Table, Cast (Process)); end if; end Iterate; function Iterate (Container : Map'Class) return Map_Iterator_Interfaces.Forward_Iterator'Class is begin return Map_Iterator'(First => First (Map (Container))); end Iterate; overriding procedure Adjust (Object : in out Map) is begin Copy_On_Write.Adjust (Object.Super'Access); end Adjust; overriding function First (Object : Map_Iterator) return Cursor is begin return Object.First; end First; overriding function Next (Object : Map_Iterator; Position : Cursor) return Cursor is pragma Unreferenced (Object); begin return Next (Position); end Next; package body Streaming is procedure Read ( Stream : not null access Streams.Root_Stream_Type'Class; Item : out Map) is Length : Count_Type'Base; begin Count_Type'Base'Read (Stream, Length); Clear (Item); for I in 1 .. Length loop declare Key : constant Key_Type := Key_Type'Input (Stream); Element : constant Element_Type := Element_Type'Input (Stream); begin Include (Item, Key, Element); -- diff -- diff -- diff end; end loop; end Read; procedure Write ( Stream : not null access Streams.Root_Stream_Type'Class; Item : Map) is Length : constant Count_Type := Indefinite_Hashed_Maps.Length (Item); begin Count_Type'Write (Stream, Item.Length); if Length > 0 then declare Position : Cursor := First (Item); begin while Position /= null loop Key_Type'Output (Stream, Position.Key.all); Element_Type'Output (Stream, Position.Element.all); Next (Position); end loop; end; end if; end Write; end Streaming; end Ada.Containers.Indefinite_Hashed_Maps;
reznikmm/matreshka
Ada
6,781
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Style.Style_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Style_Style_Element_Node is begin return Self : Style_Style_Element_Node do Matreshka.ODF_Style.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Style_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Style_Style_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_Style_Style (ODF.DOM.Style_Style_Elements.ODF_Style_Style_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 Style_Style_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Style_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Style_Style_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_Style_Style (ODF.DOM.Style_Style_Elements.ODF_Style_Style_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 Style_Style_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_Style_Style (Visitor, ODF.DOM.Style_Style_Elements.ODF_Style_Style_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.Style_URI, Matreshka.ODF_String_Constants.Style_Element, Style_Style_Element_Node'Tag); end Matreshka.ODF_Style.Style_Elements;
AdaCore/libadalang
Ada
480
adb
package body FUAND is function Andthen (Ops : Operands) return Boolean is Ops_Var : Operands := Ops; -- # decl I : Integer_Ref := Integer_Ref'(Ref => new Integer'(12)); A : Integer; B : Boolean; begin A := I ** 2; B := I > 2; if Ops_Var (Op_A) > 0 and then Ops_Var (Op_B) > 0 then -- # eval0 return True; -- # true else return False; -- # false end if; pragma Test_Statement; end; end;
reznikmm/matreshka
Ada
4,079
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This is a global registry of JavaScript code, which is organized as -- separate resource to share JavaScript code between pages. ------------------------------------------------------------------------------ with League.Strings; with League.String_Vectors; package AWF.Internals.Java_Script_Registry is procedure Register (Code : League.Strings.Universal_String); -- Register segment of JavaScript code. function Java_Script_Code return League.Strings.Universal_String; -- Returns all registered JavaScript code. function Java_Script_Resource_Path return League.String_Vectors.Universal_String_Vector; -- Returns path of resource which contains JavaScript code. end AWF.Internals.Java_Script_Registry;
timed-c/ktc
Ada
728
adb
pragma Task_Dispatching_Policy(FIFO_Within_Priorities); with Ada.Text_Io; use Ada.Text_Io; with Ada.Real_Time; use Ada.Real_Time; with Ada.Real_Time.Timing_Events; use Ada.Real_Time.Timing_Events; with Example1; use Example1; procedure Firm is task type Periodic_Firm is pragma Priority(5); end Periodic_Firm; task body Periodic_Firm is Next : Time; Interval : Time_Span := Milliseconds(1); begin Next := Clock + Interval; loop select delay until Next; Put("-"); then abort Sense; end select; delay until Next; Next := Next + Interval; end loop; end Periodic_Firm; ftask : Periodic_Firm; begin Put_Line("Firm_Task!"); end Firm;
AdaCore/ada-traits-containers
Ada
552
adb
-- -- Copyright (C) 2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- pragma Ada_2012; package body Conts.Vectors.Indefinite_Unbounded_SPARK with SPARK_Mode => Off is pragma Assertion_Policy (Pre => Suppressible, Ghost => Suppressible, Post => Ignore); ---------- -- Copy -- ---------- function Copy (Self : Vector'Class) return Vector'Class is begin return Result : Vector do Result.Assign (Self); end return; end Copy; end Conts.Vectors.Indefinite_Unbounded_SPARK;
stcarrez/ada-asf
Ada
3,925
ads
----------------------------------------------------------------------- -- asf-converters-numbers -- Floating point number converters -- Copyright (C) 2010, 2019, 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 EL.Objects; with ASF.Components; with ASF.Contexts.Faces; with ASF.Locales; private with Util.Locales; private with Ada.Text_IO.Editing; -- == Number converter == -- The `ASF.Converters.Numbers` provides a floating point number converter. -- It can be used to print floating point numbers in various formats. package ASF.Converters.Numbers is type Number_Converter is new Converter with private; type Number_Converter_Access is access all Number_Converter'Class; -- Convert the object value into a string. The object value is associated -- with the specified component. -- If the string cannot be converted, the Invalid_Conversion exception should be raised. overriding function To_String (Convert : in Number_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class; Component : in ASF.Components.Base.UIComponent'Class; Value : in EL.Objects.Object) return String; -- Convert the string into an object for the specified component. -- If the string cannot be converted, the Invalid_Conversion exception should be raised. overriding function To_Object (Convert : in Number_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class; Component : in ASF.Components.Base.UIComponent'Class; Value : in String) return EL.Objects.Object; -- Set the picture that must be used for the conversion. procedure Set_Picture (Converter : in out Number_Converter; Picture : in String); -- Get the currency to be used from the resource bundle in the user's current locale. function Get_Currency (Converter : in Number_Converter; Bundle : in ASF.Locales.Bundle) return String; -- Get the separator to be used from the resource bundle in the user's current locale. function Get_Separator (Converter : in Number_Converter; Bundle : in ASF.Locales.Bundle) return Character; -- Get the radix mark to be used from the resource bundle in the user's current locale. function Get_Radix_Mark (Converter : in Number_Converter; Bundle : in ASF.Locales.Bundle) return Character; -- Get the fill character to be used from the resource bundle in the user's current locale. function Get_Fill (Converter : in Number_Converter; Bundle : in ASF.Locales.Bundle) return Character; private type Number_Converter is new Converter with record Picture : Ada.Text_IO.Editing.Picture; Locale : Util.Locales.Locale; Depend_On_Local : Boolean := False; end record; -- Get the locale that must be used to format the number. function Get_Locale (Convert : in Number_Converter; Context : in ASF.Contexts.Faces.Faces_Context'Class) return Util.Locales.Locale; end ASF.Converters.Numbers;
stcarrez/ada-awa
Ada
13,245
adb
----------------------------------------------------------------------- -- awa-wikis-modules-tests -- Unit tests for wikis service -- Copyright (C) 2015, 2017, 2018, 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.Test_Caller; with Util.Strings; with ASF.Tests; with ASF.Requests.Mockup; with ASF.Responses.Mockup; with AWA.Tests.Helpers; with AWA.Tests.Helpers.Users; with AWA.Services.Contexts; with Security.Contexts; package body AWA.Wikis.Modules.Tests is use ASF.Tests; use Util.Tests; use type ADO.Identifier; package Caller is new Util.Test_Caller (Test, "Wikis.Modules"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test AWA.Wikis.Modules.Create_Wiki_Space", Test_Create_Wiki_Space'Access); Caller.Add_Test (Suite, "Test AWA.Wikis.Modules.Create_Wiki_Page", Test_Create_Wiki_Page'Access); Caller.Add_Test (Suite, "Test AWA.Wikis.Modules.Create_Wiki_Content", Test_Create_Wiki_Content'Access); Caller.Add_Test (Suite, "Test AWA.Wikis.Modules.Wiki_Page", Test_Wiki_Page'Access); Caller.Add_Test (Suite, "Test AWA.Wikis.Beans.Save", Test_Update_Page'Access); end Add_Tests; -- ------------------------------ -- Test creation of a wiki space. -- ------------------------------ procedure Test_Create_Wiki_Space (T : in out Test) is Sec_Ctx : Security.Contexts.Security_Context; Context : AWA.Services.Contexts.Service_Context; W : AWA.Wikis.Models.Wiki_Space_Ref; W2 : AWA.Wikis.Models.Wiki_Space_Ref; begin AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]"); T.Manager := AWA.Wikis.Modules.Get_Wiki_Module; T.Assert (T.Manager /= null, "There is no wiki manager"); W.Set_Name ("Test wiki space"); T.Manager.Create_Wiki_Space (W); T.Assert (W.Is_Inserted, "The new wiki space was not created"); W.Set_Name ("Test wiki space update"); W.Set_Is_Public (True); T.Manager.Save_Wiki_Space (W); T.Manager.Load_Wiki_Space (Wiki => W2, Id => W.Get_Id); Util.Tests.Assert_Equals (T, "Test wiki space update", String '(W2.Get_Name), "Invalid wiki space name"); end Test_Create_Wiki_Space; -- ------------------------------ -- Test creation of a wiki page. -- ------------------------------ procedure Test_Create_Wiki_Page (T : in out Test) is Sec_Ctx : Security.Contexts.Security_Context; Context : AWA.Services.Contexts.Service_Context; W : AWA.Wikis.Models.Wiki_Space_Ref; P : AWA.Wikis.Models.Wiki_Page_Ref; C : AWA.Wikis.Models.Wiki_Content_Ref; begin AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]"); T.Manager := AWA.Wikis.Modules.Get_Wiki_Module; T.Assert (T.Manager /= null, "There is no wiki manager"); W.Set_Name ("Test wiki space"); T.Manager.Create_Wiki_Space (W); P.Set_Name ("Private"); P.Set_Title ("The page title"); C.Set_Content ("Something"); T.Manager.Create_Wiki_Page (W, P, C); T.Assert (P.Is_Inserted, "The new wiki page was not created"); P.Set_Content (AWA.Wikis.Models.Null_Wiki_Content); C := AWA.Wikis.Models.Null_Wiki_Content; P := AWA.Wikis.Models.Null_Wiki_Page; P.Set_Name ("Public"); P.Set_Title ("The page title (public)"); P.Set_Is_Public (True); T.Manager.Create_Wiki_Page (W, P, C); T.Assert (P.Is_Inserted, "The new wiki page was not created"); T.Assert (P.Get_Is_Public, "The new wiki page is not public"); P.Set_Content (AWA.Wikis.Models.Null_Wiki_Content); end Test_Create_Wiki_Page; -- ------------------------------ -- Test creation of a wiki page content. -- ------------------------------ procedure Test_Create_Wiki_Content (T : in out Test) is Sec_Ctx : Security.Contexts.Security_Context; Context : AWA.Services.Contexts.Service_Context; W : AWA.Wikis.Models.Wiki_Space_Ref; P : AWA.Wikis.Models.Wiki_Page_Ref; C : AWA.Wikis.Models.Wiki_Content_Ref; begin AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]"); T.Manager := AWA.Wikis.Modules.Get_Wiki_Module; T.Assert (T.Manager /= null, "There is no wiki manager"); W.Set_Name ("Test wiki space"); T.Manager.Create_Wiki_Space (W); T.Wiki_Id := W.Get_Id; P.Set_Name ("PrivatePage"); P.Set_Title ("The page title"); P.Set_Is_Public (False); T.Manager.Create_Wiki_Page (W, P, C); T.Private_Id := P.Get_Id; C := AWA.Wikis.Models.Null_Wiki_Content; C.Set_Format (AWA.Wikis.Models.FORMAT_MARKDOWN); C.Set_Content ("-- Title" & ASCII.LF & "A paragraph"); C.Set_Save_Comment ("A first version"); T.Manager.Create_Wiki_Content (P, C); T.Assert (C.Is_Inserted, "The new wiki content was not created"); T.Assert (not C.Get_Author.Is_Null, "The wiki content has an author"); T.Assert (C.Get_Page_Id /= ADO.NO_IDENTIFIER, "The wiki content is associated with the wiki page"); P := AWA.Wikis.Models.Null_Wiki_Page; C := AWA.Wikis.Models.Null_Wiki_Content; P.Set_Name ("PublicPage"); P.Set_Title ("The public page title"); P.Set_Is_Public (True); T.Manager.Create_Wiki_Page (W, P, C); T.Public_Id := P.Get_Id; C.Set_Format (AWA.Wikis.Models.FORMAT_MARKDOWN); C.Set_Content ("-- Title" & ASCII.LF & "A paragraph" & ASCII.LF & "[Link](http://mylink.com)" & ASCII.LF & "[Image](my-image.png)"); C.Set_Save_Comment ("A first version"); T.Manager.Create_Wiki_Content (P, C); T.Assert (C.Is_Inserted, "The new wiki content was not created"); T.Assert (not C.Get_Author.Is_Null, "The wiki content has an author"); T.Assert (C.Get_Page_Id /= ADO.NO_IDENTIFIER, "The wiki content is associated with the wiki page"); end Test_Create_Wiki_Content; -- ------------------------------ -- Test getting the wiki page as well as info, history pages. -- ------------------------------ procedure Test_Wiki_Page (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Ident : constant String := Util.Strings.Image (Natural (T.Wiki_Id)); Pub_Ident : constant String := Util.Strings.Image (Natural (T.Public_Id)); begin ASF.Tests.Do_Get (Request, Reply, "/wikis/view/" & Ident & "/PublicPage", "wiki-public-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (PublicPage)"); Assert_Matches (T, ".*The public page title.*", Reply, "Invalid PublicPage page returned", Status => ASF.Responses.SC_OK); ASF.Tests.Do_Get (Request, Reply, "/wikis/info/" & Ident & "/" & Pub_Ident, "wiki-public-info-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (PublicPage info)"); Assert_Matches (T, ".*The public page title.*", Reply, "Invalid PublicPage info page returned", Status => ASF.Responses.SC_OK); ASF.Tests.Do_Get (Request, Reply, "/wikis/history/" & Ident & "/" & Pub_Ident, "wiki-public-history-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (PublicPage history)"); Assert_Matches (T, ".*The public page title.*", Reply, "Invalid PublicPage info page returned", Status => ASF.Responses.SC_OK); Request.Remove_Attribute ("wikiView"); ASF.Tests.Do_Get (Request, Reply, "/wikis/view/" & Ident & "/PrivatePage", "wiki-private-1.html"); Assert_Equals (T, ASF.Responses.SC_FORBIDDEN, Reply.Get_Status, "Invalid response (PrivatePage)"); Assert_Matches (T, ".*Protected Wiki Page.*", Reply, "Invalid PrivatePage page returned", Status => ASF.Responses.SC_FORBIDDEN); ASF.Tests.Do_Get (Request, Reply, "/wikis/list/" & Ident & "/recent", "wiki-list-recent-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (list/recent)"); ASF.Tests.Do_Get (Request, Reply, "/wikis/list/" & Ident & "/recent/grid", "wiki-list-grid-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (list/recent/grid)"); ASF.Tests.Do_Get (Request, Reply, "/wikis/list/" & Ident & "/popular", "wiki-list-popular-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (list/popular)"); ASF.Tests.Do_Get (Request, Reply, "/wikis/list/" & Ident & "/popular/grid", "wiki-list-popular-1.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (list/popular/grid)"); end Test_Wiki_Page; -- ------------------------------ -- Test updating the wiki page through a POST request. -- ------------------------------ procedure Test_Update_Page (T : in out Test) is Request : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Ident : constant String := Util.Strings.Image (Natural (T.Wiki_Id)); Pub_Ident : constant String := Util.Strings.Image (Natural (T.Public_Id)); begin AWA.Tests.Helpers.Users.Login ("[email protected]", Request); ASF.Tests.Do_Get (Request, Reply, "/wikis/edit/" & Ident & "/PublicPage", "update-wiki-get.html"); Request.Set_Parameter ("title", "The Blog Title"); Request.Set_Parameter ("page-id", Pub_Ident); Request.Set_Parameter ("page-wiki-id", Ident); Request.Set_Parameter ("name", "NewPageName"); Request.Set_Parameter ("page-title", "New Page Title"); Request.Set_Parameter ("text", "== Title ==" & ASCII.LF & "A paragraph" & ASCII.LF & "[[http://mylink.com|Link]]" & ASCII.LF & "[[Image:my-image.png|My Picture]]" & ASCII.LF & "== Last header ==" & ASCII.LF); Request.Set_Parameter ("comment", "Update through test post simulation"); Request.Set_Parameter ("page-is-public", "TRUE"); Request.Set_Parameter ("wiki-format", "FORMAT_MEDIAWIKI"); Request.Set_Parameter ("qtags[1]", "Test-Tag"); Request.Set_Parameter ("save", "1"); ASF.Tests.Set_CSRF (Request, "post", "update-wiki-get.html"); ASF.Tests.Do_Post (Request, Reply, "/wikis/edit/" & Ident & "/PublicPage", "update-wiki.html"); T.Assert (Reply.Get_Status = ASF.Responses.SC_MOVED_TEMPORARILY, "Invalid response after wiki update"); declare Result : constant String := AWA.Tests.Helpers.Extract_Redirect (Reply, "/asfunit/wikis/view/"); begin Util.Tests.Assert_Equals (T, Ident & "/NewPageName", Result, "The page name was not updated"); ASF.Tests.Do_Get (Request, Reply, "/wikis/view/" & Result, "wiki-public-2.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (NewPageName)"); Assert_Matches (T, ".*Last header.*", Reply, "Last header is present in the response", Status => ASF.Responses.SC_OK); ASF.Tests.Do_Get (Request, Reply, "/wikis/info/" & Ident & "/" & Pub_Ident, "wiki-info-2.html"); Assert_Equals (T, ASF.Responses.SC_OK, Reply.Get_Status, "Invalid response (info NewPageName)"); Assert_Matches (T, ".*wiki-image-name.*my-image.png.*", Reply, "The info page must list the image", Status => ASF.Responses.SC_OK); end; end Test_Update_Page; end AWA.Wikis.Modules.Tests;
optikos/oasis
Ada
523
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Definitions; package Program.Elements.Constraints is pragma Pure (Program.Elements.Constraints); type Constraint is limited interface and Program.Elements.Definitions.Definition; type Constraint_Access is access all Constraint'Class with Storage_Size => 0; end Program.Elements.Constraints;
AntoineLestrade/Automatic_Shutdown
Ada
41
ads
package Widgets is pragma Pure; end;
AdaCore/gpr
Ada
1,243
ads
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- package GPR2.Source_Info.Parser.Registry is procedure Register (Parser : Object'Class); -- Register a source info parser procedure Unregister (Parser : Object'Class); -- Unregister a source info parser function Exists (Language : Language_Id; Kind : Backend) return Boolean; -- Returns True if the parser backend for Language is found. If Kind is -- None then True is returned if either an LI or Source parser exists. function Get (Language : Language_Id; Kind : Backend) return not null access Object'Class with Pre => Exists (Language, Kind); -- Get a parser for the given language and kind. If Kind if Auto then the -- LI based parser is returned and the Source based otherwise. procedure Clear_Cache; -- Clear cache for all registered parsers. While parsing it is possible for -- each parser to store in cache some information (Ada ALI parser does that -- as the same ALI contains information for possibly two units). After -- updating all the sources for a view one can clear the cache to free -- up the memory. end GPR2.Source_Info.Parser.Registry;
AdaCore/Ada_Drivers_Library
Ada
7,945
ads
-- This spec has been automatically generated from STM32F46_79x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.EXTI is pragma Preelaborate; --------------- -- Registers -- --------------- -- IMR_MR array type IMR_MR_Field_Array is array (0 .. 22) of Boolean with Component_Size => 1, Size => 23; -- Type definition for IMR_MR type IMR_MR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- MR as a value Val : HAL.UInt23; when True => -- MR as an array Arr : IMR_MR_Field_Array; end case; end record with Unchecked_Union, Size => 23; for IMR_MR_Field use record Val at 0 range 0 .. 22; Arr at 0 range 0 .. 22; end record; -- Interrupt mask register (EXTI_IMR) type IMR_Register is record -- Interrupt Mask on line 0 MR : IMR_MR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IMR_Register use record MR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- EMR_MR array type EMR_MR_Field_Array is array (0 .. 22) of Boolean with Component_Size => 1, Size => 23; -- Type definition for EMR_MR type EMR_MR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- MR as a value Val : HAL.UInt23; when True => -- MR as an array Arr : EMR_MR_Field_Array; end case; end record with Unchecked_Union, Size => 23; for EMR_MR_Field use record Val at 0 range 0 .. 22; Arr at 0 range 0 .. 22; end record; -- Event mask register (EXTI_EMR) type EMR_Register is record -- Event Mask on line 0 MR : EMR_MR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EMR_Register use record MR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- RTSR_TR array type RTSR_TR_Field_Array is array (0 .. 22) of Boolean with Component_Size => 1, Size => 23; -- Type definition for RTSR_TR type RTSR_TR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TR as a value Val : HAL.UInt23; when True => -- TR as an array Arr : RTSR_TR_Field_Array; end case; end record with Unchecked_Union, Size => 23; for RTSR_TR_Field use record Val at 0 range 0 .. 22; Arr at 0 range 0 .. 22; end record; -- Rising Trigger selection register (EXTI_RTSR) type RTSR_Register is record -- Rising trigger event configuration of line 0 TR : RTSR_TR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RTSR_Register use record TR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- FTSR_TR array type FTSR_TR_Field_Array is array (0 .. 22) of Boolean with Component_Size => 1, Size => 23; -- Type definition for FTSR_TR type FTSR_TR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TR as a value Val : HAL.UInt23; when True => -- TR as an array Arr : FTSR_TR_Field_Array; end case; end record with Unchecked_Union, Size => 23; for FTSR_TR_Field use record Val at 0 range 0 .. 22; Arr at 0 range 0 .. 22; end record; -- Falling Trigger selection register (EXTI_FTSR) type FTSR_Register is record -- Falling trigger event configuration of line 0 TR : FTSR_TR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FTSR_Register use record TR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- SWIER array type SWIER_Field_Array is array (0 .. 22) of Boolean with Component_Size => 1, Size => 23; -- Type definition for SWIER type SWIER_Field (As_Array : Boolean := False) is record case As_Array is when False => -- SWIER as a value Val : HAL.UInt23; when True => -- SWIER as an array Arr : SWIER_Field_Array; end case; end record with Unchecked_Union, Size => 23; for SWIER_Field use record Val at 0 range 0 .. 22; Arr at 0 range 0 .. 22; end record; -- Software interrupt event register (EXTI_SWIER) type SWIER_Register is record -- Software Interrupt on line 0 SWIER : SWIER_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SWIER_Register use record SWIER at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- PR array type PR_Field_Array is array (0 .. 22) of Boolean with Component_Size => 1, Size => 23; -- Type definition for PR type PR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- PR as a value Val : HAL.UInt23; when True => -- PR as an array Arr : PR_Field_Array; end case; end record with Unchecked_Union, Size => 23; for PR_Field use record Val at 0 range 0 .. 22; Arr at 0 range 0 .. 22; end record; -- Pending register (EXTI_PR) type PR_Register is record -- Pending bit 0 PR : PR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PR_Register use record PR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- External interrupt/event controller type EXTI_Peripheral is record -- Interrupt mask register (EXTI_IMR) IMR : aliased IMR_Register; -- Event mask register (EXTI_EMR) EMR : aliased EMR_Register; -- Rising Trigger selection register (EXTI_RTSR) RTSR : aliased RTSR_Register; -- Falling Trigger selection register (EXTI_FTSR) FTSR : aliased FTSR_Register; -- Software interrupt event register (EXTI_SWIER) SWIER : aliased SWIER_Register; -- Pending register (EXTI_PR) PR : aliased PR_Register; end record with Volatile; for EXTI_Peripheral use record IMR at 16#0# range 0 .. 31; EMR at 16#4# range 0 .. 31; RTSR at 16#8# range 0 .. 31; FTSR at 16#C# range 0 .. 31; SWIER at 16#10# range 0 .. 31; PR at 16#14# range 0 .. 31; end record; -- External interrupt/event controller EXTI_Periph : aliased EXTI_Peripheral with Import, Address => System'To_Address (16#40013C00#); end STM32_SVD.EXTI;
charlie5/aIDE
Ada
1,169
ads
with Ada.Containers.Vectors, Ada.Streams; package AdaM.Declaration.of_generic is type Item is new Declaration.item with private; -- View -- type View is access all Item'Class; procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View); procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View); for View'write use View_write; for View'read use View_read; -- Vector -- package Vectors is new ada.Containers.Vectors (Positive, View); subtype Vector is Vectors.Vector; -- Forge -- function new_Declaration return Declaration.of_generic.view; procedure free (Self : in out Declaration.of_generic.view); overriding procedure destruct (Self : in out Declaration.of_generic.item); -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id; private type Item is new Declaration.item with record null; end record; end AdaM.Declaration.of_generic;
johnperry-math/hac
Ada
601
ads
with HAC_Sys.Defs; private package HAC_Sys.Parser.Expressions is use Defs; procedure Boolean_Expression ( CD : in out Compiler_Data; Level : PCode.Nesting_level; FSys : Symset; X : out Exact_Typ ); procedure Expression ( CD : in out Compiler_Data; Level : PCode.Nesting_level; FSys : Symset; X : out Exact_Typ ); procedure Selector ( CD : in out Compiler_Data; Level : PCode.Nesting_level; FSys : Symset; V : in out Exact_Typ ); end HAC_Sys.Parser.Expressions;
reznikmm/matreshka
Ada
4,066
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- 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$ ------------------------------------------------------------------------------ limited with League.Signals; package League.Objects is type Object is limited interface; type Object_Access is access all Object'Class; type Object_Access_Array is array (Positive range <>) of Object_Access; not overriding function Children (Self : not null access constant Object) return Object_Access_Array is abstract; not overriding function Parent (Self : not null access Object) return Object_Access is abstract; not overriding procedure Set_Parent (Self : not null access Object; Parent : access Object'Class) is abstract; not overriding function Destroyed (Self : not null access Object) return League.Signals.Signal is abstract; end League.Objects;
jrmarino/AdaBase
Ada
3,581
adb
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../../License.txt with Ada.Strings.Fixed; package body AdaBase.Driver.Base.Firebird is package ASF renames Ada.Strings.Fixed; --------------- -- execute -- --------------- overriding function execute (driver : Firebird_Driver; sql : String) return AD.AffectedRows is result : AD.AffectedRows := 0; begin return result; -- TODO end execute; ------------------------- -- query_clear_table -- ------------------------- overriding procedure query_clear_table (driver : Firebird_Driver; table : String) is -- Firebird has no "truncate" commands sql : constant String := "DELETE FROM " & table; AR : ACB.AD.AffectedRows; begin AR := driver.execute (sql => sql); end query_clear_table; ------------------------ -- query_drop_table -- ------------------------ overriding procedure query_drop_table (driver : Firebird_Driver; tables : String; when_exists : Boolean := False; cascade : Boolean := False) is sql : AD.textual; AR : AD.AffectedRows; begin if ASF.Index (Source => tables, Pattern => ",", From => 1) /= 0 then driver.log_problem (category => AD.execution, message => SUS ("Multiple tables detected -- Firebird can only drop " & "one table at a time : " & tables)); return; end if; if cascade then driver.log_nominal (category => AD.execution, message => SUS ("Note that requested CASCADE has no effect on Firebird")); end if; case when_exists is when False => sql := SUS ("DROP TABLE " & tables); when True => sql := SUS ("EXECUTE BLOCK AS BEGIN " & "if (exists(select 1 from rdb$relations where " & "rdb$relation_name = '" & tables & "')) then " & "execute statement 'drop table " & tables & ";'; END"); end case; AR := driver.execute (sql => USS (sql)); end query_drop_table; ---------------------- -- last_insert_id -- ---------------------- overriding function last_insert_id (driver : Firebird_Driver) return AD.TraxID is begin return 0; -- TODO end last_insert_id; ---------------------- -- last_sql_state -- ---------------------- overriding function last_sql_state (driver : Firebird_Driver) return AD.TSqlState is begin return AD.stateless; -- TODO end last_sql_state; ----------------------- -- last_error_info -- ----------------------- overriding function last_error_info (driver : Firebird_Driver) return AD.Error_Info is result : AD.Error_Info; begin return result; -- TODO end last_error_info; ------------- -- query -- ------------- overriding function query (driver : Firebird_Driver; sql : String) return AS.Base'Class is result : AS.Base; begin return result; -- TODO end query; ------------------------------------------------------------------------ -- PRIVATE ROUTINES NOT COVERED BY INTERFACES -- ------------------------------------------------------------------------ end AdaBase.Driver.Base.Firebird;
BrickBot/Bound-T-H8-300
Ada
4,787
adb
-- Bounds.Opt (body) -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.3 $ -- $Date: 2015/10/24 20:05:46 $ -- -- $Log: bounds-opt.adb,v $ -- Revision 1.3 2015/10/24 20:05:46 niklas -- Moved to free licence. -- -- Revision 1.2 2013-02-05 20:09:11 niklas -- Using Options.General.Trace_Resolution for Trace_Data_Resolution. -- -- Revision 1.1 2011-08-31 04:17:12 niklas -- Added for BT-CH-0222: Option registry. Option -dump. External help files. -- with Flow.Opt; with License; with Options.General; with Options.Groups; with Output; package body Bounds.Opt is function Trace_Data_Resolution return Boolean is begin return Options.General.Trace_Resolution; end Trace_Data_Resolution; procedure Set_Stack_Analysis (To : in Boolean) is begin if not To then Bound_Stack := False; elsif License.Allows_Stack_Analysis then Bound_Stack := True; else Output.Error ("Not licensed for stack (-path) analysis."); end if; end Set_Stack_Analysis; begin -- Bounds.Opt if License.Allows_Time_Analysis then Options.Register ( Option => Bound_Time_Opt'access, Name => "time", Group => Options.Groups.Analysis); end if; if License.Allows_Stack_Analysis then Options.Register ( Option => Bound_Stack_Opt'access, Name => "stack", Group => Options.Groups.Analysis); end if; Options.Register ( Option => Trace_Phase_Opt'access, Name => Options.Trace_Item ("phase"), Group => Options.Groups.Trace); Options.Register ( Option => Trace_Arith_Opt'access, Name => Options.Trace_Item ("arith"), Group => Options.Groups.Trace); Options.Register ( Option => Trace_Context_Opt'access, Name => Options.Trace_Item ("context"), Group => Options.Groups.Trace); Options.Register ( Option => Trace_Nubs_Opt'access, Name => Options.Trace_Item ("nubs"), Group => Options.Groups.Trace); Options.Register ( Option => Trace_Cell_Sets_Opt'access, Name => Options.Trace_Item ("cells"), Group => Options.Groups.Trace); Options.Register ( Option => Warn_Unresolved_Data_Opt'access, Name => Options.Warn_Item ("access"), Group => Options.Groups.Warn); Options.Register ( Option => Trace_Graphs_Opt'access, Name => Options.Trace_Item ("graph"), Group => Options.Groups.Trace); Options.Register ( Option => Trace_Instructions_Opt'access, Name => Options.Trace_Item ("instr"), Group => Options.Groups.Trace); Options.Register ( Option => Max_Dependency_Depth_Opt'access, Name => "max_par_depth", Groups => (Options.Groups.Analysis, Options.Groups.Resource_Limits)); Options.Register ( Option => Max_Restarts_Opt'access, Name => "model_iter", Group => Options.Groups.Resource_Limits); end Bounds.Opt;
tum-ei-rcs/StratoX
Ada
6,373
ads
-- This spec has been automatically generated from STM32F40x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; with HAL; with System; package STM32_SVD.NVIC is pragma Preelaborate; --------------- -- Registers -- --------------- ------------------- -- ICTR_Register -- ------------------- subtype ICTR_INTLINESNUM_Field is HAL.UInt4; -- Interrupt Controller Type Register type ICTR_Register is record -- Read-only. Total number of interrupt lines in groups INTLINESNUM : ICTR_INTLINESNUM_Field; -- unspecified Reserved_4_31 : HAL.UInt28; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICTR_Register use record INTLINESNUM at 0 range 0 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; ------------------ -- IPR_Register -- ------------------ -- IPR0_IPR_N array element subtype IPR0_IPR_N_Element is HAL.Byte; -- IPR0_IPR_N array type IPR0_IPR_N_Field_Array is array (0 .. 3) of IPR0_IPR_N_Element with Component_Size => 8, Size => 32; -- Interrupt Priority Register type IPR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- IPR_N as a value Val : HAL.Word; when True => -- IPR_N as an array Arr : IPR0_IPR_N_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for IPR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; ------------------- -- STIR_Register -- ------------------- subtype STIR_INTID_Field is HAL.UInt9; -- Software Triggered Interrupt Register type STIR_Register is record -- Write-only. interrupt to be triggered INTID : STIR_INTID_Field := 16#0#; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for STIR_Register use record INTID at 0 range 0 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Nested Vectored Interrupt Controller type NVIC_Peripheral is record -- Interrupt Controller Type Register ICTR : ICTR_Register; -- Interrupt Set-Enable Register ISER0 : HAL.Word; -- Interrupt Set-Enable Register ISER1 : HAL.Word; -- Interrupt Set-Enable Register ISER2 : HAL.Word; -- Interrupt Clear-Enable Register ICER0 : HAL.Word; -- Interrupt Clear-Enable Register ICER1 : HAL.Word; -- Interrupt Clear-Enable Register ICER2 : HAL.Word; -- Interrupt Set-Pending Register ISPR0 : HAL.Word; -- Interrupt Set-Pending Register ISPR1 : HAL.Word; -- Interrupt Set-Pending Register ISPR2 : HAL.Word; -- Interrupt Clear-Pending Register ICPR0 : HAL.Word; -- Interrupt Clear-Pending Register ICPR1 : HAL.Word; -- Interrupt Clear-Pending Register ICPR2 : HAL.Word; -- Interrupt Active Bit Register IABR0 : HAL.Word; -- Interrupt Active Bit Register IABR1 : HAL.Word; -- Interrupt Active Bit Register IABR2 : HAL.Word; -- Interrupt Priority Register IPR0 : IPR_Register; -- Interrupt Priority Register IPR1 : IPR_Register; -- Interrupt Priority Register IPR2 : IPR_Register; -- Interrupt Priority Register IPR3 : IPR_Register; -- Interrupt Priority Register IPR4 : IPR_Register; -- Interrupt Priority Register IPR5 : IPR_Register; -- Interrupt Priority Register IPR6 : IPR_Register; -- Interrupt Priority Register IPR7 : IPR_Register; -- Interrupt Priority Register IPR8 : IPR_Register; -- Interrupt Priority Register IPR9 : IPR_Register; -- Interrupt Priority Register IPR10 : IPR_Register; -- Interrupt Priority Register IPR11 : IPR_Register; -- Interrupt Priority Register IPR12 : IPR_Register; -- Interrupt Priority Register IPR13 : IPR_Register; -- Interrupt Priority Register IPR14 : IPR_Register; -- Interrupt Priority Register IPR15 : IPR_Register; -- Interrupt Priority Register IPR16 : IPR_Register; -- Interrupt Priority Register IPR17 : IPR_Register; -- Interrupt Priority Register IPR18 : IPR_Register; -- Interrupt Priority Register IPR19 : IPR_Register; -- Software Triggered Interrupt Register STIR : STIR_Register; end record with Volatile; for NVIC_Peripheral use record ICTR at 4 range 0 .. 31; ISER0 at 256 range 0 .. 31; ISER1 at 260 range 0 .. 31; ISER2 at 264 range 0 .. 31; ICER0 at 384 range 0 .. 31; ICER1 at 388 range 0 .. 31; ICER2 at 392 range 0 .. 31; ISPR0 at 512 range 0 .. 31; ISPR1 at 516 range 0 .. 31; ISPR2 at 520 range 0 .. 31; ICPR0 at 640 range 0 .. 31; ICPR1 at 644 range 0 .. 31; ICPR2 at 648 range 0 .. 31; IABR0 at 768 range 0 .. 31; IABR1 at 772 range 0 .. 31; IABR2 at 776 range 0 .. 31; IPR0 at 1024 range 0 .. 31; IPR1 at 1028 range 0 .. 31; IPR2 at 1032 range 0 .. 31; IPR3 at 1036 range 0 .. 31; IPR4 at 1040 range 0 .. 31; IPR5 at 1044 range 0 .. 31; IPR6 at 1048 range 0 .. 31; IPR7 at 1052 range 0 .. 31; IPR8 at 1056 range 0 .. 31; IPR9 at 1060 range 0 .. 31; IPR10 at 1064 range 0 .. 31; IPR11 at 1068 range 0 .. 31; IPR12 at 1072 range 0 .. 31; IPR13 at 1076 range 0 .. 31; IPR14 at 1080 range 0 .. 31; IPR15 at 1084 range 0 .. 31; IPR16 at 1088 range 0 .. 31; IPR17 at 1092 range 0 .. 31; IPR18 at 1096 range 0 .. 31; IPR19 at 1100 range 0 .. 31; STIR at 3840 range 0 .. 31; end record; -- Nested Vectored Interrupt Controller NVIC_Periph : aliased NVIC_Peripheral with Import, Address => NVIC_Base; end STM32_SVD.NVIC;
zhmu/ananas
Ada
9,387
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P A N D E R -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This procedure performs any required expansion for the specified node. -- The argument is the node that is a candidate for possible expansion. -- If no expansion is required, then Expand returns without doing anything. -- If the node does need expansion, then the subtree is replaced by the -- tree corresponding to the required rewriting. This tree is a syntactic -- tree, except that all Entity fields must be correctly set on all -- direct names, since the expander presumably knows what it wants, and in -- any case it doesn't work to have the semantic analyzer perform visibility -- analysis on these trees (they may have references to non-visible runtime -- routines etc.) There are a few exceptions to this rule in special cases, -- but they must be documented clearly. -- Expand is called in two different situations: -- Nodes that are not subexpressions (Nkind not in N_Subexpr) -- In this case, Expand is called from the body of Sem, immediately -- after completing semantic analysis by calling the corresponding -- Analyze_N_xxx procedure. If expansion occurs, the given node must -- be replaced with another node that is also not a subexpression. -- This seems naturally to be the case, since it is hard to imagine any -- situation in which it would make sense to replace a non-expression -- subtree with an expression. Once the substitution is completed, the -- Expand routine must call Analyze on the resulting node to do any -- required semantic analysis. Note that references to children copied -- from the old tree won't be reanalyzed, since their Analyzed flag -- is set. -- Nodes that are subexpressions (Nkind in N_Subexpr) -- In this case, Expand is called from Sem_Res.Resolve after completing -- the resolution of the subexpression (this means that the expander sees -- the fully typed subtree). If expansion occurs, the given node must be -- replaced by a node that is also a subexpression. Again it is hard -- to see how this restriction could possibly be violated. Once the -- substitution is completed, the Expand routine must first call Analyze -- on the resulting node to do any required semantic analysis, and then -- call Resolve on the node to set the type (typically the type will be -- the same as the original type of the input node, but this is not -- always the case). -- In both these cases, Replace or Rewrite must be used to achieve the -- expansion of the node, since the Expander routine is only passed the -- Node_Id of the node to be expanded, and the resulting expanded Node_Id -- must be the same (the parameter to Expand is mode in, not mode in-out). -- For nodes other than subexpressions, it is not necessary to preserve the -- original tree in the Expand routines, unlike the case for modifications -- to the tree made in the semantic analyzer. This is because anyone who is -- interested in working with the original tree is required to compile in -- semantics checks only mode. Thus Replace may be freely used in such -- instances. -- For subexpressions, preservation of the original tree is required because -- of the need for conformance checking of default expressions, which occurs -- on expanded trees. This means that Replace should not ever be used on -- on subexpression nodes. Instead use Rewrite. -- Note: the front end avoids calls to any of the expand routines if code -- is not being generated. This is done for three reasons: -- 1. Make sure tree does not get mucked up by the expander if no -- code is being generated, and is thus usable by ASIS etc. -- 2. Save time, since expansion is not needed if a compilation is -- being done only to check the semantics, or if code generation -- has been canceled due to previously detected errors. -- 3. Allow the expand routines to assume that the tree is error free. -- This results from the fact that code generation mode is always -- cancelled when any error occurs. -- If we ever decide to implement a feature allowing object modules to be -- generated even if errors have been detected, then point 3 will no longer -- hold, and the expand routines will have to be modified to operate properly -- in the presence of errors (for many reasons this is not currently true). -- Note: a consequence of this approach is that error messages must never -- be generated in the expander, since this would mean that such error -- messages are not generated when the expander is not being called. -- Expansion is the last stage of analyzing a node, so Expand sets the -- Analyzed flag of the node being analyzed as its last action. This is -- done even if expansion is off (in this case, the only effect of the -- call to Expand is to set the Analyzed flag to True). with Types; use Types; package Expander is -- The flag Opt.Expander_Active controls whether expansion is active -- (True) or deactivated (False). When expansion is deactivated all -- calls to expander routines have no effect. To temporarily disable -- expansion, always call the routines defined below, do NOT change -- Expander_Active directly. -- -- You should not use this flag to test if you are currently processing -- a generic spec or body. Use the flag Inside_A_Generic instead (see -- the spec of package Sem). -- -- There is no good reason for permanently changing the value of this flag -- except after detecting a syntactic or semantic error. In this event -- this flag is set to False to disable all subsequent expansion activity. -- -- In general this flag should be used as a read only value. The only -- exceptions where it makes sense to temporarily change its value are: -- -- (a) when starting/completing the processing of a generic definition -- or declaration (see routines Start_Generic_Processing and -- End_Generic_Processing in Sem_Ch12) -- -- (b) when starting/completing the preanalysis of an expression -- (see the spec of package Sem for more info on preanalysis.) -- -- Note that when processing a spec expression (In_Spec_Expression -- is True) or performing semantic analysis of a generic spec or body -- (Inside_A_Generic) or when performing preanalysis (Full_Analysis is -- False) the Expander_Active flag is False. procedure Expand (N : Node_Id); -- Expand node N, as described above procedure Expander_Mode_Save_And_Set (Status : Boolean); -- Saves the current setting of the Expander_Active flag on an internal -- stack and then sets the flag to the given value. -- -- Note: this routine has no effect in GNATprove mode. In this mode, -- a very light expansion is performed on specific nodes and -- Expander_Active is set to False. -- In situations such as the call to Instantiate_Bodies in Frontend, -- Expander_Mode_Save_And_Set may be called to temporarily turn the -- expander on, but this will have no effect in GNATprove mode. procedure Expander_Mode_Restore; -- Restores the setting of the Expander_Active flag using the top entry -- pushed onto the stack by Expander_Mode_Save_And_Reset, popping the -- stack, except that if any errors have been detected, then the state of -- the flag is left set to False. Disabled for GNATprove mode (see above). end Expander;
charlie5/cBound
Ada
1,785
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with swig; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_booleanv_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; pad1 : aliased swig.int8_t_Array (0 .. 3); n : aliased Interfaces.Unsigned_32; datum : aliased Interfaces.Unsigned_8; pad2 : aliased swig.int8_t_Array (0 .. 14); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_booleanv_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_booleanv_reply_t.Item, Element_Array => xcb.xcb_glx_get_booleanv_reply_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_booleanv_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_booleanv_reply_t.Pointer, Element_Array => xcb.xcb_glx_get_booleanv_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_booleanv_reply_t;
1Crazymoney/LearnAda
Ada
803
adb
with sor; with Ada.Text_IO; use Ada.Text_IO; --use sor; -> you can't do this because it's a generic procedure demo is procedure alma(A : integer) is begin Put_Line(Integer'image(A)); end alma; procedure korte(A : Character) is begin Put_Line(Character'image(A)); end korte; function fele(i : Integer) return Integer is begin return i / 2; end fele; package sorom is new sor(Integer, alma); package sorom2 is new sor(Character, korte); procedure peldany is new sorom.feltetelesKiiras(fele); a: sorom.sora(10); b: sorom2.sora(10); begin sorom.push(a, 100); sorom.push(a, 342); sorom.pop(a); sorom.push(a, 1); sorom.kiir(a); peldany(a); sorom2.push(b, 'a'); sorom2.push(b, 'b'); sorom2.pop(b); sorom2.kiir(b); end demo;
OneWingedShark/Byron
Ada
375
ads
Pragma Ada_2012; Pragma Assertion_Policy( Check ); With Byron.Internals.Types, Byron.Generics.Pass, Ada.Streams, Readington; use all type Byron.Internals.Types.Stream_Class; Function Byron.Reader is new Byron.Generics.Pass( Input_Type => Internals.Types.Stream_Class, Output_Type => Wide_Wide_String, Translate => Readington );
Rodeo-McCabe/orka
Ada
2,390
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with GL.Debug; with Orka.Loggers.Terminal; with Orka.Terminals; package body Orka.Logging is function Image (Value : Ada.Real_Time.Time_Span) return String is (Terminals.Image (Ada.Real_Time.To_Duration (Value))); function Trim (Value : String) return String renames Terminals.Trim; function Image (Value : Orka.Transforms.Singles.Vectors.Vector4) return String is begin return "(" & Trim (Value (X)'Image) & ", " & Trim (Value (Y)'Image) & ", " & Trim (Value (Z)'Image) & ", " & Trim (Value (W)'Image) & ")"; end Image; function Image (Value : Orka.Transforms.Doubles.Vectors.Vector4) return String is begin return "(" & Trim (Value (X)'Image) & ", " & Trim (Value (Y)'Image) & ", " & Trim (Value (Z)'Image) & ", " & Trim (Value (W)'Image) & ")"; end Image; ----------------------------------------------------------------------------- Current_Logger : Loggers.Logger_Ptr := Orka.Loggers.Terminal.Logger; procedure Set_Logger (Logger : Loggers.Logger_Ptr) is begin Current_Logger := Logger; end Set_Logger; procedure Log (From : Source; Kind : Message_Type; Level : Severity; ID : Natural; Message : String) is begin Current_Logger.Log (From, Kind, Level, ID, Message); end Log; package body Messages is Kind : constant Message_Type := Message_Type (GL.Debug.Message_Type'(GL.Debug.Other)); -- TODO Make generic parameter procedure Log (Level : Severity; Message : String) is begin Orka.Logging.Log (From, Kind, Level, ID, Message); end Log; end Messages; end Orka.Logging;
Statkus/json-ada
Ada
16,528
adb
-- Copyright (c) 2016 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Characters.Latin_1; with Ada.Strings.Bounded; with Ada.Strings.Unbounded; package body JSON.Types is package SU renames Ada.Strings.Unbounded; function "+" (Text : String) return SU.Unbounded_String renames SU.To_Unbounded_String; function "+" (Text : SU.Unbounded_String) return String renames SU.To_String; function Unescape (Text : String) return String is -- Add 1 so that the length is always positive package SB is new Ada.Strings.Bounded.Generic_Bounded_Length (Max => Text'Length + 1); Value : SB.Bounded_String; Escaped : Boolean := False; use Ada.Characters.Latin_1; begin for C of Text loop if Escaped then case C is when '"' | '\' | '/' | 'u' => SB.Append (Value, C); when 'b' => SB.Append (Value, BS); when 'f' => SB.Append (Value, FF); when 'n' => SB.Append (Value, LF); when 'r' => SB.Append (Value, CR); when 't' => SB.Append (Value, HT); when others => raise Program_Error; end case; elsif C = '"' then raise Program_Error; elsif C /= '\' then if Character'Pos (C) <= 31 then raise Program_Error; end if; SB.Append (Value, C); end if; Escaped := not Escaped and C = '\'; end loop; return SB.To_String (Value); end Unescape; ----------------------------------------------------------------------------- -- Constructors -- ----------------------------------------------------------------------------- function Create_String (Stream : Streams.Stream_Ptr; Offset, Length : Streams.AS.Stream_Element_Offset) return JSON_Value is begin return (Kind => String_Kind, Stream => Stream, String_Offset => Offset, String_Length => Length); end Create_String; function Create_Integer (Value : Integer_Type) return JSON_Value is begin return (Kind => Integer_Kind, Integer_Value => Value); end Create_Integer; function Create_Float (Value : Float_Type) return JSON_Value is begin return (Kind => Float_Kind, Float_Value => Value); end Create_Float; function Create_Boolean (Value : Boolean) return JSON_Value is begin return (Kind => Boolean_Kind, Boolean_Value => Value); end Create_Boolean; function Create_Null return JSON_Value is begin return (Kind => Null_Kind); end Create_Null; function Create_Array (Allocator : Memory_Allocator_Ptr; Depth : Positive) return JSON_Value is begin return (Kind => Array_Kind, Allocator => Allocator, Depth => Depth, Offset => Allocator.Create_Array (Depth), Length => 0); end Create_Array; function Create_Object (Allocator : Memory_Allocator_Ptr; Depth : Positive) return JSON_Value is begin return (Kind => Object_Kind, Allocator => Allocator, Depth => Depth, Offset => Allocator.Create_Object (Depth), Length => 0); end Create_Object; ----------------------------------------------------------------------------- -- Value -- ----------------------------------------------------------------------------- function Value (Object : JSON_Value) return String is begin if Object.Kind = String_Kind then return Unescape (Object.Stream.Get_String (Object.String_Offset, Object.String_Length)); else raise Invalid_Type_Error with "Value not a string"; end if; end Value; function Value (Object : JSON_Value) return Boolean is begin if Object.Kind = Boolean_Kind then return Object.Boolean_Value; else raise Invalid_Type_Error with "Value not a boolean"; end if; end Value; function Value (Object : JSON_Value) return Integer_Type is begin if Object.Kind = Integer_Kind then return Object.Integer_Value; else raise Invalid_Type_Error with "Value not a integer"; end if; end Value; function Value (Object : JSON_Value) return Float_Type is begin if Object.Kind = Float_Kind then return Object.Float_Value; elsif Object.Kind = Integer_Kind then return Float_Type (Object.Integer_Value); else raise Invalid_Type_Error with "Value not a float"; end if; end Value; ----------------------------------------------------------------------------- function Length (Object : JSON_Value) return Natural is begin if Object.Kind in Array_Kind | Object_Kind then return Object.Length; else raise Invalid_Type_Error with "Value not an object or array"; end if; end Length; function Contains (Object : JSON_Value; Key : String) return Boolean is begin if Object.Kind = Object_Kind then return (for some Pair_Key of Object => Key = Pair_Key.Value); else raise Invalid_Type_Error with "Value not an object"; end if; end Contains; function Get (Object : JSON_Value; Index : Positive) return JSON_Value is begin if Object.Kind = Array_Kind then return Object.Allocator.Array_Levels (Object.Depth).Element (Object.Offset + Index).Value; else raise Invalid_Type_Error with "Value not an array"; end if; exception when Constraint_Error => raise Constraint_Error with "JSON array has no element at index" & Index'Image; end Get; function Get (Object : JSON_Value; Key : String) return JSON_Value is begin if Object.Kind = Object_Kind then for Index in 1 .. Object.Length loop declare Pair : constant Key_Value_Pair := Object.Allocator.Object_Levels (Object.Depth).Element (Object.Offset + Index); begin if Key = Pair.Key.Value then return Pair.Element; end if; end; end loop; raise Constraint_Error with "JSON object has no key '" & Key & "'"; else raise Invalid_Type_Error with "Value not an object"; end if; end Get; procedure Append (Object : in out JSON_Value; Value : JSON_Value) is begin if Object.Kind = Array_Kind then declare Length : constant Natural := Natural (Object.Allocator.Array_Levels (Object.Depth).Length); begin -- Assert that Object is the last array in a particular level -- so that its elements form a continuous array pragma Assert (Length = Object.Offset + Object.Length); end; Object.Allocator.Array_Levels (Object.Depth).Append (Array_Value'(Kind => Value.Kind, Value => Value)); Object.Length := Object.Length + 1; else raise Invalid_Type_Error with "Value not an array"; end if; end Append; procedure Insert (Object : in out JSON_Value; Key : JSON_Value; Value : JSON_Value; Check_Duplicate_Keys : Boolean) is begin if Object.Kind = Object_Kind then if Check_Duplicate_Keys and then Object.Contains (Key.Value) then raise Constraint_Error with "JSON object already has key '" & Key.Value & "'"; end if; declare Length : constant Natural := Natural (Object.Allocator.Object_Levels (Object.Depth).Length); begin -- Assert that Object is the last object in a particular level -- so that its key-value pairs form a continuous array pragma Assert (Length = Object.Offset + Object.Length); end; pragma Assert (Key.Kind = String_Kind); Object.Allocator.Object_Levels (Object.Depth).Append (Key_Value_Pair'(Kind => Value.Kind, Key => Key, Element => Value)); Object.Length := Object.Length + 1; else raise Invalid_Type_Error with "Value not an object"; end if; end Insert; ----------------------------------------------------------------------------- function Constant_Reference (Object : JSON_Value; Index : Positive) return JSON_Value renames Get; function Constant_Reference (Object : JSON_Value; Key : String) return JSON_Value renames Get; function Constant_Reference (Object : aliased JSON_Value; Position : Cursor) return JSON_Value is begin case Position.Kind is when Array_Kind => return Object.Allocator.Array_Levels (Position.Data.Depth).Element (Position.Data.Offset + Position.Index).Value; when Object_Kind => return Object.Allocator.Object_Levels (Position.Data.Depth).Element (Position.Data.Offset + Position.Index).Key; end case; end Constant_Reference; function Has_Element (Position : Cursor) return Boolean is (Position.Index <= Position.Data.Length); overriding function First (Object : Iterator) return Cursor is begin return (Kind => Object.Kind, Data => Object.Data, Index => 1); end First; overriding function Next (Object : Iterator; Position : Cursor) return Cursor is begin return (Kind => Position.Kind, Data => Position.Data, Index => Position.Index + 1); end Next; function Iterate (Object : JSON_Value) return Value_Iterator_Interfaces.Forward_Iterator'Class is begin if Object.Kind in Array_Kind | Object_Kind then return Iterator'(Kind => Object.Kind, Data => Object); else raise Program_Error with "Can only iterate over an array or object"; end if; end Iterate; ----------------------------------------------------------------------------- -- Helpers -- ----------------------------------------------------------------------------- function Get_Array_Or_Empty (Object : JSON_Value; Key : String) return JSON_Value is begin if Object.Contains (Key) then return Object.Get (Key); else return (Kind => Array_Kind, Allocator => Object.Allocator, Depth => Object.Allocator.Array_Levels'First, Offset => 0, Length => 0); end if; end Get_Array_Or_Empty; function Get_Object_Or_Empty (Object : JSON_Value; Key : String) return JSON_Value is begin if Object.Contains (Key) then return Object.Get (Key); else return (Kind => Object_Kind, Allocator => Object.Allocator, Depth => Object.Allocator.Object_Levels'First, Offset => 0, Length => 0); end if; end Get_Object_Or_Empty; function Get (Object : JSON_Value; Key : String; Default : Integer_Type) return JSON_Value is begin if Object.Contains (Key) then return Object.Get (Key); else return Create_Integer (Default); end if; end Get; function Get (Object : JSON_Value; Key : String; Default : Float_Type) return JSON_Value is begin if Object.Contains (Key) then return Object.Get (Key); else return Create_Float (Default); end if; end Get; function Get (Object : JSON_Value; Key : String; Default : Boolean) return JSON_Value is begin if Object.Contains (Key) then return Object.Get (Key); else return Create_Boolean (Default); end if; end Get; ----------------------------------------------------------------------------- -- Image - ----------------------------------------------------------------------------- function Image_String (Object : JSON_Value) return String is Text : String renames Object.Stream.Get_String (Object.String_Offset, Object.String_Length); begin -- A string backed by a stream is always escaped. The tokenizer -- will verify that the string does not contain unexpected characters return '"' & Text & '"'; end Image_String; function Image_Integer (Object : JSON_Value) return String is Result : constant String := Integer_Type'Image (Object.Integer_Value); begin if Object.Integer_Value < 0 then return Result; else return Result (2 .. Result'Last); end if; end Image_Integer; function Image_Float (Object : JSON_Value) return String is Result : constant String := Float_Type'Image (Object.Float_Value); begin if Object.Float_Value < 0.0 then return Result; else return Result (2 .. Result'Last); end if; end Image_Float; function Image_Boolean (Object : JSON_Value) return String is (if Object.Boolean_Value then "true" else "false"); function Image_Null (Object : JSON_Value) return String is ("null"); function Image_Array (Object : JSON_Value) return String is Index : Natural := 0; Result : SU.Unbounded_String := +"["; begin for Element of Object loop Index := Index + 1; if Index > 1 then SU.Append (Result, ","); end if; SU.Append (Result, Element.Image); end loop; SU.Append (Result, "]"); return +Result; end Image_Array; function Image_Object (Object : JSON_Value) return String is Index : Natural := 0; Result : SU.Unbounded_String := +"{"; begin for Key of Object loop Index := Index + 1; if Index > 1 then SU.Append (Result, ','); end if; SU.Append (Result, '"' & Key.Value & '"'); SU.Append (Result, ':'); SU.Append (Result, Object.Get (Key.Value).Image); end loop; SU.Append (Result, '}'); return +Result; end Image_Object; function Image (Object : JSON_Value) return String is begin case Object.Kind is when Array_Kind => return Image_Array (Object); when Object_Kind => return Image_Object (Object); when String_Kind => return Image_String (Object); when Integer_Kind => return Image_Integer (Object); when Float_Kind => return Image_Float (Object); when Boolean_Kind => return Image_Boolean (Object); when Null_Kind => return Image_Null (Object); end case; end Image; ----------------------------------------------------------------------------- function Create_Array (Object : Memory_Allocator; Depth : Positive) return Array_Offset is begin if Depth > Object.Maximum_Depth then raise Constraint_Error with "Maximum depth (" & Object.Maximum_Depth'Image & ") exceeded"; end if; return Array_Offset (Object.Array_Levels (Depth).Length); end Create_Array; function Create_Object (Object : Memory_Allocator; Depth : Positive) return Array_Offset is begin if Depth > Object.Maximum_Depth then raise Constraint_Error with "Maximum depth (" & Object.Maximum_Depth'Image & ") exceeded"; end if; return Array_Offset (Object.Object_Levels (Depth).Length); end Create_Object; end JSON.Types;
AdaDoom3/oto
Ada
44,111
ads
------------------------------------------------------------------------------ -- EMAIL: <[email protected]> -- -- License: ISC -- -- -- -- Copyright © 2014 - 2016 darkestkhan -- ------------------------------------------------------------------------------ -- Permission to use, copy, modify, and/or distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- The software is provided "as is" and the author disclaims all warranties -- -- with regard to this software including all implied warranties of -- -- merchantability and fitness. In no event shall the author be liable for -- -- any special, direct, indirect, or consequential damages or any damages -- -- whatsoever resulting from loss of use, data or profits, whether in an -- -- action of contract, negligence or other tortious action, arising out of -- -- or in connection with the use or performance of this software. -- ------------------------------------------------------------------------------ with Oto.AL; with Oto.ALC; use Oto; use type Oto.AL.Enum; package Oto.EFX is --------------------------------------------------------------------------- ----------------------- -- C O N S T A N T S -- ----------------------- --------------------------------------------------------------------------- ALC_EXT_EFX_NAME : constant String := "ALC_EXT_EFX"; ALC_EFX_MAJOR_VERSION : constant ALC.Enum := 16#20001#; ALC_EFX_MINOR_VERSION : constant ALC.Enum := 16#20002#; ALC_MAX_AUXILIARY_SENDS : constant ALC.Enum := 16#20003#; -- Listener properties. AL_METERS_PER_UNIT : constant AL.Enum := 16#20004#; -- Source properties. AL_DIRECT_FILTER : constant AL.Enum := 16#20005#; AL_AUXILIARY_SEND_FILTER : constant AL.Enum := 16#20006#; AL_AIR_ABSORPTION_FACTOR : constant AL.Enum := 16#20007#; AL_ROOM_ROLLOFF_FACTOR : constant AL.Enum := 16#20008#; AL_CONE_OUTER_GAINHF : constant AL.Enum := 16#20009#; AL_DIRECT_FILTER_GAINHF_AUTO : constant AL.Enum := 16#2000A#; AL_AUXILIARY_SEND_FILTER_GAIN_AUTO : constant AL.Enum := 16#2000B#; AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO : constant AL.Enum := 16#2000C#; -- Effect properties. -- Reverb effect parameters AL_REVERB_DENSITY : constant AL.Enum := 16#0001#; AL_REVERB_DIFFUSION : constant AL.Enum := 16#0002#; AL_REVERB_GAIN : constant AL.Enum := 16#0003#; AL_REVERB_GAINHF : constant AL.Enum := 16#0004#; AL_REVERB_DECAY_TIME : constant AL.Enum := 16#0005#; AL_REVERB_DECAY_HFRATIO : constant AL.Enum := 16#0006#; AL_REVERB_REFLECTIONS_GAIN : constant AL.Enum := 16#0007#; AL_REVERB_REFLECTIONS_DELAY : constant AL.Enum := 16#0008#; AL_REVERB_LATE_REVERB_GAIN : constant AL.Enum := 16#0009#; AL_REVERB_LATE_REVERB_DELAY : constant AL.Enum := 16#000A#; AL_REVERB_AIR_ABSORPTION_GAINHF : constant AL.Enum := 16#000B#; AL_REVERB_ROOM_ROLLOFF_FACTOR : constant AL.Enum := 16#000C#; AL_REVERB_DECAY_HFLIMIT : constant AL.Enum := 16#000D#; -- EAX Reverb effect parameters AL_EAXREVERB_DENSITY : constant AL.Enum := 16#0001#; AL_EAXREVERB_DIFFUSION : constant AL.Enum := 16#0002#; AL_EAXREVERB_GAIN : constant AL.Enum := 16#0003#; AL_EAXREVERB_GAINHF : constant AL.Enum := 16#0004#; AL_EAXREVERB_GAINLF : constant AL.Enum := 16#0005#; AL_EAXREVERB_DECAY_TIME : constant AL.Enum := 16#0006#; AL_EAXREVERB_DECAY_HFRATIO : constant AL.Enum := 16#0007#; AL_EAXREVERB_DECAY_LFRATIO : constant AL.Enum := 16#0008#; AL_EAXREVERB_REFLECTIONS_GAIN : constant AL.Enum := 16#0009#; AL_EAXREVERB_REFLECTIONS_DELAY : constant AL.Enum := 16#000A#; AL_EAXREVERB_REFLECTIONS_PAN : constant AL.Enum := 16#000B#; AL_EAXREVERB_LATE_REVERB_GAIN : constant AL.Enum := 16#000C#; AL_EAXREVERB_LATE_REVERB_DELAY : constant AL.Enum := 16#000D#; AL_EAXREVERB_LATE_REVERB_PAN : constant AL.Enum := 16#000E#; AL_EAXREVERB_ECHO_TIME : constant AL.Enum := 16#000F#; AL_EAXREVERB_ECHO_DEPTH : constant AL.Enum := 16#0010#; AL_EAXREVERB_MODULATION_TIME : constant AL.Enum := 16#0011#; AL_EAXREVERB_MODULATION_DEPTH : constant AL.Enum := 16#0012#; AL_EAXREVERB_AIR_ABSORPTION_GAINHF : constant AL.Enum := 16#0013#; AL_EAXREVERB_HFREFERENCE : constant AL.Enum := 16#0014#; AL_EAXREVERB_LFREFERENCE : constant AL.Enum := 16#0015#; AL_EAXREVERB_ROOM_ROLLOFF_FACTOR : constant AL.Enum := 16#0016#; AL_EAXREVERB_DECAY_HFLIMIT : constant AL.Enum := 16#0017#; -- Chorus effect parameters AL_CHORUS_WAVEFORM : constant AL.Enum := 16#0001#; AL_CHORUS_PHASE : constant AL.Enum := 16#0002#; AL_CHORUS_RATE : constant AL.Enum := 16#0003#; AL_CHORUS_DEPTH : constant AL.Enum := 16#0004#; AL_CHORUS_FEEDBACK : constant AL.Enum := 16#0005#; AL_CHORUS_DELAY : constant AL.Enum := 16#0006#; -- Distortion effect parameters AL_DISTORTION_EDGE : constant AL.Enum := 16#0001#; AL_DISTORTION_GAIN : constant AL.Enum := 16#0002#; AL_DISTORTION_LOWPASS_CUTOFF : constant AL.Enum := 16#0003#; AL_DISTORTION_EQCENTER : constant AL.Enum := 16#0004#; AL_DISTORTION_EQBANDWIDTH : constant AL.Enum := 16#0005#; -- Echo effect parameters AL_ECHO_DELAY : constant AL.Enum := 16#0001#; AL_ECHO_LRDELAY : constant AL.Enum := 16#0002#; AL_ECHO_DAMPING : constant AL.Enum := 16#0003#; AL_ECHO_FEEDBACK : constant AL.Enum := 16#0004#; AL_ECHO_SPREAD : constant AL.Enum := 16#0005#; -- Flanger effect parameters AL_FLANGER_WAVEFORM : constant AL.Enum := 16#0001#; AL_FLANGER_PHASE : constant AL.Enum := 16#0002#; AL_FLANGER_RATE : constant AL.Enum := 16#0003#; AL_FLANGER_DEPTH : constant AL.Enum := 16#0004#; AL_FLANGER_FEEDBACK : constant AL.Enum := 16#0005#; AL_FLANGER_DELAY : constant AL.Enum := 16#0006#; -- Frequency shifter effect parameters AL_FREQUENCY_SHIFTER_FREQUENCY : constant AL.Enum := 16#0001#; AL_FREQUENCY_SHIFTER_LEFT_DIRECTION : constant AL.Enum := 16#0002#; AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION : constant AL.Enum := 16#0003#; -- Vocal morpher effect parameters AL_VOCAL_MORPHER_PHONEMEA : constant AL.Enum := 16#0001#; AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING : constant AL.Enum := 16#0002#; AL_VOCAL_MORPHER_PHONEMEB : constant AL.Enum := 16#0003#; AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING : constant AL.Enum := 16#0004#; AL_VOCAL_MORPHER_WAVEFORM : constant AL.Enum := 16#0005#; AL_VOCAL_MORPHER_RATE : constant AL.Enum := 16#0006#; -- Pitchshifter effect parameters AL_PITCH_SHIFTER_COARSE_TUNE : constant AL.Enum := 16#0001#; AL_PITCH_SHIFTER_FINE_TUNE : constant AL.Enum := 16#0002#; -- Ringmodulator effect parameters AL_RING_MODULATOR_FREQUENCY : constant AL.Enum := 16#0001#; AL_RING_MODULATOR_HIGHPASS_CUTOFF : constant AL.Enum := 16#0002#; AL_RING_MODULATOR_WAVEFORM : constant AL.Enum := 16#0003#; -- Autowah effect parameters AL_AUTOWAH_ATTACK_TIME : constant AL.Enum := 16#0001#; AL_AUTOWAH_RELEASE_TIME : constant AL.Enum := 16#0002#; AL_AUTOWAH_RESONANCE : constant AL.Enum := 16#0003#; AL_AUTOWAH_PEAK_GAIN : constant AL.Enum := 16#0004#; -- Compressor effect parameters AL_COMPRESSOR_ONOFF : constant AL.Enum := 16#0001#; -- Equalizer effect parameters AL_EQUALIZER_LOW_GAIN : constant AL.Enum := 16#0001#; AL_EQUALIZER_LOW_CUTOFF : constant AL.Enum := 16#0002#; AL_EQUALIZER_MID1_GAIN : constant AL.Enum := 16#0003#; AL_EQUALIZER_MID1_CENTER : constant AL.Enum := 16#0004#; AL_EQUALIZER_MID1_WIDTH : constant AL.Enum := 16#0005#; AL_EQUALIZER_MID2_GAIN : constant AL.Enum := 16#0006#; AL_EQUALIZER_MID2_CENTER : constant AL.Enum := 16#0007#; AL_EQUALIZER_MID2_WIDTH : constant AL.Enum := 16#0008#; AL_EQUALIZER_HIGH_GAIN : constant AL.Enum := 16#0009#; AL_EQUALIZER_HIGH_CUTOFF : constant AL.Enum := 16#000A#; -- Effect type AL_EFFECT_FIRST_PARAMETER : constant AL.Enum := 16#0000#; AL_EFFECT_LAST_PARAMETER : constant AL.Enum := 16#8000#; AL_EFFECT_TYPE : constant AL.Enum := 16#8001#; -- Effect types, used with the AL_EFFECT_TYPE property AL_EFFECT_NULL : constant AL.Enum := 16#0000#; AL_EFFECT_REVERB : constant AL.Enum := 16#0001#; AL_EFFECT_CHORUS : constant AL.Enum := 16#0002#; AL_EFFECT_DISTORTION : constant AL.Enum := 16#0003#; AL_EFFECT_ECHO : constant AL.Enum := 16#0004#; AL_EFFECT_FLANGER : constant AL.Enum := 16#0005#; AL_EFFECT_FREQUENCY_SHIFTER : constant AL.Enum := 16#0006#; AL_EFFECT_VOCAL_MORPHER : constant AL.Enum := 16#0007#; AL_EFFECT_PITCH_SHIFTER : constant AL.Enum := 16#0008#; AL_EFFECT_RING_MODULATOR : constant AL.Enum := 16#0009#; AL_EFFECT_AUTOWAH : constant AL.Enum := 16#000A#; AL_EFFECT_COMPRESSOR : constant AL.Enum := 16#000B#; AL_EFFECT_EQUALIZER : constant AL.Enum := 16#000C#; AL_EFFECT_EAXREVERB : constant AL.Enum := 16#8000#; -- Auxiliary Effect Slot properties. AL_EFFECTSLOT_EFFECT : constant AL.Enum := 16#0001#; AL_EFFECTSLOT_GAIN : constant AL.Enum := 16#0002#; AL_EFFECTSLOT_AUXILIARY_SEND_AUTO : constant AL.Enum := 16#0003#; -- NULL Auxiliary Slot ID to disable a source send. AL_EFFECTSLOT_NULL : constant AL.Enum := 16#0000#; -- Filter properties. -- Lowpass filter parameters AL_LOWPASS_GAIN : constant AL.Enum := 16#0001#; AL_LOWPASS_GAINHF : constant AL.Enum := 16#0002#; -- Highpass filter parameters AL_HIGHPASS_GAIN : constant AL.Enum := 16#0001#; AL_HIGHPASS_GAINLF : constant AL.Enum := 16#0002#; -- Bandpass filter parameters AL_BANDPASS_GAIN : constant AL.Enum := 16#0001#; AL_BANDPASS_GAINLF : constant AL.Enum := 16#0002#; AL_BANDPASS_GAINHF : constant AL.Enum := 16#0003#; -- Filter type AL_FILTER_FIRST_PARAMETER : constant AL.Enum := 16#0000#; AL_FILTER_LAST_PARAMETER : constant AL.Enum := 16#8000#; AL_FILTER_TYPE : constant AL.Enum := 16#8001#; -- Filter types, used with the AL_FILTER_TYPE property AL_FILTER_NULL : constant AL.Enum := 16#0000#; AL_FILTER_LOWPASS : constant AL.Enum := 16#0001#; AL_FILTER_HIGHPASS : constant AL.Enum := 16#0002#; AL_FILTER_BANDPASS : constant AL.Enum := 16#0003#; -- Filter ranges and defaults. -- Lowpass filter AL_LOWPASS_MIN_GAIN : constant Float := 0.0; AL_LOWPASS_MAX_GAIN : constant Float := 1.0; AL_LOWPASS_DEFAULT_GAIN : constant Float := 1.0; AL_LOWPASS_MIN_GAINHF : constant Float := 0.0; AL_LOWPASS_MAX_GAINHF : constant Float := 1.0; AL_LOWPASS_DEFAULT_GAINHF : constant Float := 1.0; -- Highpass filter AL_HIGHPASS_MIN_GAIN : constant Float := 0.0; AL_HIGHPASS_MAX_GAIN : constant Float := 1.0; AL_HIGHPASS_DEFAULT_GAIN : constant Float := 1.0; AL_HIGHPASS_MIN_GAINLF : constant Float := 0.0; AL_HIGHPASS_MAX_GAINLF : constant Float := 1.0; AL_HIGHPASS_DEFAULT_GAINLF : constant Float := 1.0; -- Bandpass filter AL_BANDPASS_MIN_GAIN : constant Float := 0.0; AL_BANDPASS_MAX_GAIN : constant Float := 1.0; AL_BANDPASS_DEFAULT_GAIN : constant Float := 1.0; AL_BANDPASS_MIN_GAINHF : constant Float := 0.0; AL_BANDPASS_MAX_GAINHF : constant Float := 1.0; AL_BANDPASS_DEFAULT_GAINHF : constant Float := 1.0; AL_BANDPASS_MIN_GAINLF : constant Float := 0.0; AL_BANDPASS_MAX_GAINLF : constant Float := 1.0; AL_BANDPASS_DEFAULT_GAINLF : constant Float := 1.0; -- Effect parameter ranges and defaults. -- Standard reverb effect AL_REVERB_MIN_DENSITY : constant Float := 0.0; AL_REVERB_MAX_DENSITY : constant Float := 1.0; AL_REVERB_DEFAULT_DENSITY : constant Float := 1.0; AL_REVERB_MIN_DIFFUSION : constant Float := 0.0; AL_REVERB_MAX_DIFFUSION : constant Float := 1.0; AL_REVERB_DEFAULT_DIFFUSION : constant Float := 1.0; AL_REVERB_MIN_GAIN : constant Float := 0.0; AL_REVERB_MAX_GAIN : constant Float := 1.0; AL_REVERB_DEFAULT_GAIN : constant Float := 0.32; AL_REVERB_MIN_GAINHF : constant Float := 0.0; AL_REVERB_MAX_GAINHF : constant Float := 1.0; AL_REVERB_DEFAULT_GAINHF : constant Float := 0.89; AL_REVERB_MIN_DECAY_TIME : constant Float := 0.1; AL_REVERB_MAX_DECAY_TIME : constant Float := 20.0; AL_REVERB_DEFAULT_DECAY_TIME : constant Float := 1.49; AL_REVERB_MIN_DECAY_HFRATIO : constant Float := 0.1; AL_REVERB_MAX_DECAY_HFRATIO : constant Float := 2.0; AL_REVERB_DEFAULT_DECAY_HFRATIO : constant Float := 0.83; AL_REVERB_MIN_REFLECTIONS_GAIN : constant Float := 0.0; AL_REVERB_MAX_REFLECTIONS_GAIN : constant Float := 3.16; AL_REVERB_DEFAULT_REFLECTIONS_GAIN : constant Float := 0.05; AL_REVERB_MIN_REFLECTIONS_DELAY : constant Float := 0.0; AL_REVERB_MAX_REFLECTIONS_DELAY : constant Float := 0.3; AL_REVERB_DEFAULT_REFLECTIONS_DELAY : constant Float := 0.007; AL_REVERB_MIN_LATE_REVERB_GAIN : constant Float := 0.0; AL_REVERB_MAX_LATE_REVERB_GAIN : constant Float := 10.0; AL_REVERB_DEFAULT_LATE_REVERB_GAIN : constant Float := 1.26; AL_REVERB_MIN_LATE_REVERB_DELAY : constant Float := 0.0; AL_REVERB_MAX_LATE_REVERB_DELAY : constant Float := 0.1; AL_REVERB_DEFAULT_LATE_REVERB_DELAY : constant Float := 0.011; AL_REVERB_MIN_AIR_ABSORPTION_GAINHF : constant Float := 0.892; AL_REVERB_MAX_AIR_ABSORPTION_GAINHF : constant Float := 1.0; AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF : constant Float := 0.994; AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR : constant Float := 0.0; AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR : constant Float := 10.0; AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR : constant Float := 0.0; AL_REVERB_MIN_DECAY_HFLIMIT : constant AL.Bool := AL.AL_FALSE; AL_REVERB_MAX_DECAY_HFLIMIT : constant AL.Bool := AL.AL_TRUE; AL_REVERB_DEFAULT_DECAY_HFLIMIT : constant AL.Bool := AL.AL_TRUE; -- EAX reverb effect AL_EAXREVERB_MIN_DENSITY : constant Float := 0.0; AL_EAXREVERB_MAX_DENSITY : constant Float := 1.0; AL_EAXREVERB_DEFAULT_DENSITY : constant Float := 1.0; AL_EAXREVERB_MIN_DIFFUSION : constant Float := 0.0; AL_EAXREVERB_MAX_DIFFUSION : constant Float := 1.0; AL_EAXREVERB_DEFAULT_DIFFUSION : constant Float := 1.0; AL_EAXREVERB_MIN_GAIN : constant Float := 0.0; AL_EAXREVERB_MAX_GAIN : constant Float := 1.0; AL_EAXREVERB_DEFAULT_GAIN : constant Float := 0.32; AL_EAXREVERB_MIN_GAINHF : constant Float := 0.0; AL_EAXREVERB_MAX_GAINHF : constant Float := 1.0; AL_EAXREVERB_DEFAULT_GAINHF : constant Float := 0.89; AL_EAXREVERB_MIN_GAINLF : constant Float := 0.0; AL_EAXREVERB_MAX_GAINLF : constant Float := 1.0; AL_EAXREVERB_DEFAULT_GAINLF : constant Float := 1.0; AL_EAXREVERB_MIN_DECAY_TIME : constant Float := 0.1; AL_EAXREVERB_MAX_DECAY_TIME : constant Float := 20.0; AL_EAXREVERB_DEFAULT_DECAY_TIME : constant Float := 1.49; AL_EAXREVERB_MIN_DECAY_HFRATIO : constant Float := 0.1; AL_EAXREVERB_MAX_DECAY_HFRATIO : constant Float := 2.0; AL_EAXREVERB_DEFAULT_DECAY_HFRATIO : constant Float := 0.83; AL_EAXREVERB_MIN_DECAY_LFRATIO : constant Float := 0.1; AL_EAXREVERB_MAX_DECAY_LFRATIO : constant Float := 2.0; AL_EAXREVERB_DEFAULT_DECAY_LFRATIO : constant Float := 1.0; AL_EAXREVERB_MIN_REFLECTIONS_GAIN : constant Float := 0.0; AL_EAXREVERB_MAX_REFLECTIONS_GAIN : constant Float := 3.16; AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN : constant Float := 0.05; AL_EAXREVERB_MIN_REFLECTIONS_DELAY : constant Float := 0.0; AL_EAXREVERB_MAX_REFLECTIONS_DELAY : constant Float := 0.3; AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY : constant Float := 0.007; AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ : constant Float := 0.0; AL_EAXREVERB_MIN_LATE_REVERB_GAIN : constant Float := 0.0; AL_EAXREVERB_MAX_LATE_REVERB_GAIN : constant Float := 10.0; AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN : constant Float := 1.26; AL_EAXREVERB_MIN_LATE_REVERB_DELAY : constant Float := 0.0; AL_EAXREVERB_MAX_LATE_REVERB_DELAY : constant Float := 0.1; AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY : constant Float := 0.011; AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ : constant Float := 0.0; AL_EAXREVERB_MIN_ECHO_TIME : constant Float := 0.075; AL_EAXREVERB_MAX_ECHO_TIME : constant Float := 0.25; AL_EAXREVERB_DEFAULT_ECHO_TIME : constant Float := 0.25; AL_EAXREVERB_MIN_ECHO_DEPTH : constant Float := 0.0; AL_EAXREVERB_MAX_ECHO_DEPTH : constant Float := 1.0; AL_EAXREVERB_DEFAULT_ECHO_DEPTH : constant Float := 0.0; AL_EAXREVERB_MIN_MODULATION_TIME : constant Float := 0.04; AL_EAXREVERB_MAX_MODULATION_TIME : constant Float := 4.0; AL_EAXREVERB_DEFAULT_MODULATION_TIME : constant Float := 0.25; AL_EAXREVERB_MIN_MODULATION_DEPTH : constant Float := 0.0; AL_EAXREVERB_MAX_MODULATION_DEPTH : constant Float := 1.0; AL_EAXREVERB_DEFAULT_MODULATION_DEPTH : constant Float := 0.0; AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF : constant Float := 0.892; AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF : constant Float := 1.0; AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF : constant Float := 0.994; AL_EAXREVERB_MIN_HFREFERENCE : constant Float := 1000.0; AL_EAXREVERB_MAX_HFREFERENCE : constant Float := 20000.0; AL_EAXREVERB_DEFAULT_HFREFERENCE : constant Float := 5000.0; AL_EAXREVERB_MIN_LFREFERENCE : constant Float := 20.0; AL_EAXREVERB_MAX_LFREFERENCE : constant Float := 1000.0; AL_EAXREVERB_DEFAULT_LFREFERENCE : constant Float := 250.0; AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR : constant Float := 0.0; AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR : constant Float := 10.0; AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR : constant Float := 0.0; AL_EAXREVERB_MIN_DECAY_HFLIMIT : constant AL.Bool := AL.AL_FALSE; AL_EAXREVERB_MAX_DECAY_HFLIMIT : constant AL.Bool := AL.AL_TRUE; AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT : constant AL.Bool := AL.AL_TRUE; -- Chorus effect AL_CHORUS_WAVEFORM_SINUSOID : constant AL.Enum := 0; AL_CHORUS_WAVEFORM_TRIANGLE : constant AL.Enum := 1; AL_CHORUS_MIN_WAVEFORM : constant AL.Enum := 0; AL_CHORUS_MAX_WAVEFORM : constant AL.Enum := 1; AL_CHORUS_DEFAULT_WAVEFORM : constant AL.Enum := 1; AL_CHORUS_MIN_PHASE : constant AL.Enum := -180; AL_CHORUS_MAX_PHASE : constant AL.Enum := 180; AL_CHORUS_DEFAULT_PHASE : constant AL.Enum := 90; AL_CHORUS_MIN_RATE : constant Float := 0.0; AL_CHORUS_MAX_RATE : constant Float := 10.0; AL_CHORUS_DEFAULT_RATE : constant Float := 1.1; AL_CHORUS_MIN_DEPTH : constant Float := 0.0; AL_CHORUS_MAX_DEPTH : constant Float := 1.0; AL_CHORUS_DEFAULT_DEPTH : constant Float := 0.1; AL_CHORUS_MIN_FEEDBACK : constant Float := -1.0; AL_CHORUS_MAX_FEEDBACK : constant Float := 1.0; AL_CHORUS_DEFAULT_FEEDBACK : constant Float := 0.25; AL_CHORUS_MIN_DELAY : constant Float := 0.0; AL_CHORUS_MAX_DELAY : constant Float := 0.016; AL_CHORUS_DEFAULT_DELAY : constant Float := 0.016; -- Distortion effect AL_DISTORTION_MIN_EDGE : constant Float := 0.0; AL_DISTORTION_MAX_EDGE : constant Float := 1.0; AL_DISTORTION_DEFAULT_EDGE : constant Float := 0.2; AL_DISTORTION_MIN_GAIN : constant Float := 0.01; AL_DISTORTION_MAX_GAIN : constant Float := 1.0; AL_DISTORTION_DEFAULT_GAIN : constant Float := 0.05; AL_DISTORTION_MIN_LOWPASS_CUTOFF : constant Float := 80.0; AL_DISTORTION_MAX_LOWPASS_CUTOFF : constant Float := 24000.0; AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF : constant Float := 8000.0; AL_DISTORTION_MIN_EQCENTER : constant Float := 80.0; AL_DISTORTION_MAX_EQCENTER : constant Float := 24000.0; AL_DISTORTION_DEFAULT_EQCENTER : constant Float := 3600.0; AL_DISTORTION_MIN_EQBANDWIDTH : constant Float := 80.0; AL_DISTORTION_MAX_EQBANDWIDTH : constant Float := 24000.0; AL_DISTORTION_DEFAULT_EQBANDWIDTH : constant Float := 3600.0; -- Echo effect AL_ECHO_MIN_DELAY : constant Float := 0.0; AL_ECHO_MAX_DELAY : constant Float := 0.207; AL_ECHO_DEFAULT_DELAY : constant Float := 0.1; AL_ECHO_MIN_LRDELAY : constant Float := 0.0; AL_ECHO_MAX_LRDELAY : constant Float := 0.404; AL_ECHO_DEFAULT_LRDELAY : constant Float := 0.1; AL_ECHO_MIN_DAMPING : constant Float := 0.0; AL_ECHO_MAX_DAMPING : constant Float := 0.99; AL_ECHO_DEFAULT_DAMPING : constant Float := 0.5; AL_ECHO_MIN_FEEDBACK : constant Float := 0.0; AL_ECHO_MAX_FEEDBACK : constant Float := 1.0; AL_ECHO_DEFAULT_FEEDBACK : constant Float := 0.5; AL_ECHO_MIN_SPREAD : constant Float := -1.0; AL_ECHO_MAX_SPREAD : constant Float := 1.0; AL_ECHO_DEFAULT_SPREAD : constant Float := -1.0; -- Flanger effect AL_FLANGER_WAVEFORM_SINUSOID : constant AL.Enum := 0; AL_FLANGER_WAVEFORM_TRIANGLE : constant AL.Enum := 1; AL_FLANGER_MIN_WAVEFORM : constant AL.Enum := 0; AL_FLANGER_MAX_WAVEFORM : constant AL.Enum := 1; AL_FLANGER_DEFAULT_WAVEFORM : constant AL.Enum := 1; AL_FLANGER_MIN_PHASE : constant AL.Enum := -180; AL_FLANGER_MAX_PHASE : constant AL.Enum := 180; AL_FLANGER_DEFAULT_PHASE : constant AL.Enum := 0; AL_FLANGER_MIN_RATE : constant Float := 0.0; AL_FLANGER_MAX_RATE : constant Float := 10.0; AL_FLANGER_DEFAULT_RATE : constant Float := 0.27; AL_FLANGER_MIN_DEPTH : constant Float := 0.0; AL_FLANGER_MAX_DEPTH : constant Float := 1.0; AL_FLANGER_DEFAULT_DEPTH : constant Float := 1.0; AL_FLANGER_MIN_FEEDBACK : constant Float := -1.0; AL_FLANGER_MAX_FEEDBACK : constant Float := 1.0; AL_FLANGER_DEFAULT_FEEDBACK : constant Float := -0.5; AL_FLANGER_MIN_DELAY : constant Float := 0.0; AL_FLANGER_MAX_DELAY : constant Float := 0.004; AL_FLANGER_DEFAULT_DELAY : constant Float := 0.002; -- Frequency shifter effect AL_FREQUENCY_SHIFTER_MIN_FREQUENCY : constant Float := 0.0; AL_FREQUENCY_SHIFTER_MAX_FREQUENCY : constant Float := 24000.0; AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY : constant Float := 0.0; AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION : constant AL.Enum := 0; AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION : constant AL.Enum := 2; AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION : constant AL.Enum := 0; AL_FREQUENCY_SHIFTER_DIRECTION_DOWN : constant AL.Enum := 0; AL_FREQUENCY_SHIFTER_DIRECTION_UP : constant AL.Enum := 1; AL_FREQUENCY_SHIFTER_DIRECTION_OFF : constant AL.Enum := 2; AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION : constant AL.Enum := 0; AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION : constant AL.Enum := 2; AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION : constant AL.Enum := 0; -- Vocal morpher effect AL_VOCAL_MORPHER_MIN_PHONEMEA : constant AL.Enum := 0; AL_VOCAL_MORPHER_MAX_PHONEMEA : constant AL.Enum := 29; AL_VOCAL_MORPHER_DEFAULT_PHONEMEA : constant AL.Enum := 0; AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING : constant AL.Enum := -24; AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING : constant AL.Enum := 24; AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING : constant AL.Enum := 0; AL_VOCAL_MORPHER_MIN_PHONEMEB : constant AL.Enum := 0; AL_VOCAL_MORPHER_MAX_PHONEMEB : constant AL.Enum := 29; AL_VOCAL_MORPHER_DEFAULT_PHONEMEB : constant AL.Enum := 10; AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING : constant AL.Enum := -24; AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING : constant AL.Enum := 24; AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING : constant AL.Enum := 0; AL_VOCAL_MORPHER_PHONEME_A : constant AL.Enum := 0; AL_VOCAL_MORPHER_PHONEME_E : constant AL.Enum := 1; AL_VOCAL_MORPHER_PHONEME_I : constant AL.Enum := 2; AL_VOCAL_MORPHER_PHONEME_O : constant AL.Enum := 3; AL_VOCAL_MORPHER_PHONEME_U : constant AL.Enum := 4; AL_VOCAL_MORPHER_PHONEME_AA : constant AL.Enum := 5; AL_VOCAL_MORPHER_PHONEME_AE : constant AL.Enum := 6; AL_VOCAL_MORPHER_PHONEME_AH : constant AL.Enum := 7; AL_VOCAL_MORPHER_PHONEME_AO : constant AL.Enum := 8; AL_VOCAL_MORPHER_PHONEME_EH : constant AL.Enum := 9; AL_VOCAL_MORPHER_PHONEME_ER : constant AL.Enum := 10; AL_VOCAL_MORPHER_PHONEME_IH : constant AL.Enum := 11; AL_VOCAL_MORPHER_PHONEME_IY : constant AL.Enum := 12; AL_VOCAL_MORPHER_PHONEME_UH : constant AL.Enum := 13; AL_VOCAL_MORPHER_PHONEME_UW : constant AL.Enum := 14; AL_VOCAL_MORPHER_PHONEME_B : constant AL.Enum := 15; AL_VOCAL_MORPHER_PHONEME_D : constant AL.Enum := 16; AL_VOCAL_MORPHER_PHONEME_F : constant AL.Enum := 17; AL_VOCAL_MORPHER_PHONEME_G : constant AL.Enum := 18; AL_VOCAL_MORPHER_PHONEME_J : constant AL.Enum := 19; AL_VOCAL_MORPHER_PHONEME_K : constant AL.Enum := 20; AL_VOCAL_MORPHER_PHONEME_L : constant AL.Enum := 21; AL_VOCAL_MORPHER_PHONEME_M : constant AL.Enum := 22; AL_VOCAL_MORPHER_PHONEME_N : constant AL.Enum := 23; AL_VOCAL_MORPHER_PHONEME_P : constant AL.Enum := 24; AL_VOCAL_MORPHER_PHONEME_R : constant AL.Enum := 25; AL_VOCAL_MORPHER_PHONEME_S : constant AL.Enum := 26; AL_VOCAL_MORPHER_PHONEME_T : constant AL.Enum := 27; AL_VOCAL_MORPHER_PHONEME_V : constant AL.Enum := 28; AL_VOCAL_MORPHER_PHONEME_Z : constant AL.Enum := 29; AL_VOCAL_MORPHER_WAVEFORM_SINUSOID : constant AL.Enum := 0; AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE : constant AL.Enum := 1; AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH : constant AL.Enum := 2; AL_VOCAL_MORPHER_MIN_WAVEFORM : constant AL.Enum := 0; AL_VOCAL_MORPHER_MAX_WAVEFORM : constant AL.Enum := 2; AL_VOCAL_MORPHER_DEFAULT_WAVEFORM : constant AL.Enum := 0; AL_VOCAL_MORPHER_MIN_RATE : constant Float := 0.0; AL_VOCAL_MORPHER_MAX_RATE : constant Float := 10.0; AL_VOCAL_MORPHER_DEFAULT_RATE : constant Float := 1.41; -- Pitch shifter effect AL_PITCH_SHIFTER_MIN_COARSE_TUNE : constant AL.Enum := -12; AL_PITCH_SHIFTER_MAX_COARSE_TUNE : constant AL.Enum := 12; AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE : constant AL.Enum := 12; AL_PITCH_SHIFTER_MIN_FINE_TUNE : constant AL.Enum := -50; AL_PITCH_SHIFTER_MAX_FINE_TUNE : constant AL.Enum := 50; AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE : constant AL.Enum := 0; -- Ring modulator effect AL_RING_MODULATOR_MIN_FREQUENCY : constant Float := 0.0; AL_RING_MODULATOR_MAX_FREQUENCY : constant Float := 8000.0; AL_RING_MODULATOR_DEFAULT_FREQUENCY : constant Float := 440.0; AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF : constant Float := 0.0; AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF : constant Float := 24000.0; AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF : constant Float := 800.0; AL_RING_MODULATOR_SINUSOID : constant AL.Enum := 0; AL_RING_MODULATOR_SAWTOOTH : constant AL.Enum := 1; AL_RING_MODULATOR_SQUARE : constant AL.Enum := 2; AL_RING_MODULATOR_MIN_WAVEFORM : constant AL.Enum := 0; AL_RING_MODULATOR_MAX_WAVEFORM : constant AL.Enum := 2; AL_RING_MODULATOR_DEFAULT_WAVEFORM : constant AL.Enum := 0; -- Autowah effect AL_AUTOWAH_MIN_ATTACK_TIME : constant Float := 0.0001; AL_AUTOWAH_MAX_ATTACK_TIME : constant Float := 1.0; AL_AUTOWAH_DEFAULT_ATTACK_TIME : constant Float := 0.06; AL_AUTOWAH_MIN_RELEASE_TIME : constant Float := 0.0001; AL_AUTOWAH_MAX_RELEASE_TIME : constant Float := 1.0; AL_AUTOWAH_DEFAULT_RELEASE_TIME : constant Float := 0.06; AL_AUTOWAH_MIN_RESONANCE : constant Float := 2.0; AL_AUTOWAH_MAX_RESONANCE : constant Float := 1000.0; AL_AUTOWAH_DEFAULT_RESONANCE : constant Float := 1000.0; AL_AUTOWAH_MIN_PEAK_GAIN : constant Float := 0.00003; AL_AUTOWAH_MAX_PEAK_GAIN : constant Float := 31621.0; AL_AUTOWAH_DEFAULT_PEAK_GAIN : constant Float := 11.22; -- Compressor effect AL_COMPRESSOR_MIN_ONOFF : constant AL.Enum := 0; AL_COMPRESSOR_MAX_ONOFF : constant AL.Enum := 1; AL_COMPRESSOR_DEFAULT_ONOFF : constant AL.Enum := 1; -- Equalizer effect AL_EQUALIZER_MIN_LOW_GAIN : constant Float := 0.126; AL_EQUALIZER_MAX_LOW_GAIN : constant Float := 7.943; AL_EQUALIZER_DEFAULT_LOW_GAIN : constant Float := 1.0; AL_EQUALIZER_MIN_LOW_CUTOFF : constant Float := 50.0; AL_EQUALIZER_MAX_LOW_CUTOFF : constant Float := 800.0; AL_EQUALIZER_DEFAULT_LOW_CUTOFF : constant Float := 200.0; AL_EQUALIZER_MIN_MID1_GAIN : constant Float := 0.126; AL_EQUALIZER_MAX_MID1_GAIN : constant Float := 7.943; AL_EQUALIZER_DEFAULT_MID1_GAIN : constant Float := 1.0; AL_EQUALIZER_MIN_MID1_CENTER : constant Float := 200.0; AL_EQUALIZER_MAX_MID1_CENTER : constant Float := 3000.0; AL_EQUALIZER_DEFAULT_MID1_CENTER : constant Float := 500.0; AL_EQUALIZER_MIN_MID1_WIDTH : constant Float := 0.01; AL_EQUALIZER_MAX_MID1_WIDTH : constant Float := 1.0; AL_EQUALIZER_DEFAULT_MID1_WIDTH : constant Float := 1.0; AL_EQUALIZER_MIN_MID2_GAIN : constant Float := 0.126; AL_EQUALIZER_MAX_MID2_GAIN : constant Float := 7.943; AL_EQUALIZER_DEFAULT_MID2_GAIN : constant Float := 1.0; AL_EQUALIZER_MIN_MID2_CENTER : constant Float := 1000.0; AL_EQUALIZER_MAX_MID2_CENTER : constant Float := 8000.0; AL_EQUALIZER_DEFAULT_MID2_CENTER : constant Float := 3000.0; AL_EQUALIZER_MIN_MID2_WIDTH : constant Float := 0.01; AL_EQUALIZER_MAX_MID2_WIDTH : constant Float := 1.0; AL_EQUALIZER_DEFAULT_MID2_WIDTH : constant Float := 1.0; AL_EQUALIZER_MIN_HIGH_GAIN : constant Float := 0.126; AL_EQUALIZER_MAX_HIGH_GAIN : constant Float := 7.943; AL_EQUALIZER_DEFAULT_HIGH_GAIN : constant Float := 1.0; AL_EQUALIZER_MIN_HIGH_CUTOFF : constant Float := 4000.0; AL_EQUALIZER_MAX_HIGH_CUTOFF : constant Float := 16000.0; AL_EQUALIZER_DEFAULT_HIGH_CUTOFF : constant Float := 6000.0; -- Source parameter value ranges and defaults. AL_MIN_AIR_ABSORPTION_FACTOR : constant Float := 0.0; AL_MAX_AIR_ABSORPTION_FACTOR : constant Float := 10.0; AL_DEFAULT_AIR_ABSORPTION_FACTOR : constant Float := 0.0; AL_MIN_ROOM_ROLLOFF_FACTOR : constant Float := 0.0; AL_MAX_ROOM_ROLLOFF_FACTOR : constant Float := 10.0; AL_DEFAULT_ROOM_ROLLOFF_FACTOR : constant Float := 0.0; AL_MIN_CONE_OUTER_GAINHF : constant Float := 0.0; AL_MAX_CONE_OUTER_GAINHF : constant Float := 1.0; AL_DEFAULT_CONE_OUTER_GAINHF : constant Float := 1.0; AL_MIN_DIRECT_FILTER_GAINHF_AUTO : constant AL.Bool := AL.AL_FALSE; AL_MAX_DIRECT_FILTER_GAINHF_AUTO : constant AL.Bool := AL.AL_TRUE; AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO : constant AL.Bool := AL.AL_TRUE; AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO : constant AL.Bool := AL.AL_FALSE; AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO : constant AL.Bool := AL.AL_TRUE; AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO : constant AL.Bool := AL.AL_TRUE; AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO : constant AL.Bool := AL.AL_FALSE; AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO : constant AL.Bool := AL.AL_TRUE; AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO : constant AL.Bool := AL.AL_TRUE; -- Listener parameter value ranges and defaults. -- AL_MIN_METERS_PER_UNIT value is taken from mysql/my_global.h:FLT_MIN AL_MIN_METERS_PER_UNIT : constant Float := 1.40129846432481707e-45; AL_MAX_METERS_PER_UNIT : constant Float := Float'Last; AL_DEFAULT_METERS_PER_UNIT : constant Float := 1.0; --------------------------------------------------------------------------- --------------------------- -- S U B P R O G R A M S -- --------------------------- --------------------------------------------------------------------------- procedure Gen_Effects (N: in AL.SizeI; Effects: in AL.Pointer) with Import => True, Convention => StdCall, External_Name => "alGenEffects"; procedure Delete_Effects (N: in AL.SizeI; Effects: in AL.Pointer) with Import => True, Convention => StdCall, External_Name => "alDeleteEffects"; function Is_Effect (Effect: in AL.UInt) return AL.Bool with Import => True, Convention => StdCall, External_Name => "alIsEffect"; procedure Effect (Effect: in AL.UInt; Param: in AL.Enum; Value: in AL.Int) with Import => True, Convention => StdCall, External_Name => "alEffecti"; procedure Effect (Effect: in AL.UInt; Param: in AL.Enum; Value: in Float) with Import => True, Convention => StdCall, External_Name => "alEffectf"; procedure Effect_IV ( Effect: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alEffectiv"; procedure Effect_FV ( Effect: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alEffectfv"; procedure Get_Effect_I ( Effect: in AL.UInt; Param : in AL.Enum; Value : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetEffecti"; procedure Get_Effect_IV ( Effect: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGettEffectiv"; procedure Get_Effect_F ( Effect: in AL.UInt; Param : in AL.Enum; Value : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetEffectf"; procedure Get_Effect_FV ( Effect: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetEffectfv"; procedure Gen_Filters (N: in AL.SizeI; Filters: in AL.UInt) with Import => True, Convention => StdCall, External_Name => "alGenFilters"; procedure Delete_Filters (N: in AL.SizeI; Filters: in AL.Pointer) with Import => True, Convention => StdCall, External_Name => "alDeleteFilters"; function Is_Filter (Filter: in AL.UInt) return AL.Bool with Import => True, Convention => StdCall, External_Name => "alIsFilter"; procedure Filter (Filter: in AL.UInt; Param: in AL.Enum; Value: in AL.Int) with Import => True, Convention => StdCall, External_Name => "alFilteri"; procedure Filter (Filter: in AL.UInt; Param: in AL.Enum; Value: in Float) with Import => True, Convention => StdCall, External_Name => "alFilterf"; procedure Filter_IV ( Filter: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alFilteriv"; procedure Filter_FV ( Filter: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alFilterfv"; procedure Get_Filter_I ( Filter: in AL.UInt; Param : in AL.Enum; Value : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetFilteri"; procedure Get_Filter_IV ( Filter: in AL.UInt; Param : in AL.Enum; Values: in AL.Int ) with Import => True, Convention => StdCall, External_Name => "alGetFilteriv"; procedure Get_Filter_F ( Filter: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetFilterf"; procedure Get_Filter_FV ( Filter: in AL.UInt; Param : in AL.Enum; Values: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetFilterfv"; procedure Gen_Auxiliary_Effect_Slot ( N : in AL.SizeI; Effect_Slots: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGenAuxiliaryEffectSlots"; procedure Delete_Auxiliary_Effect_Slots ( N : in AL.SizeI; Effect_Slots: in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alDeleteAuxiliaryEffectSlots"; function Is_Auxiliary_Effect_Slot (Effect_Slot: in AL.UInt) return AL.Bool with Import => True, Convention => StdCall, External_Name => "alIsAuxiliaryEffectSlot"; procedure Auxiliary_Effect_Slot ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Value : in AL.Int ) with Import => True, Convention => StdCall, External_Name => "alAuxiliaryEffectSloti"; procedure Auxiliary_Effect_Slot ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Value : in Float ) with Import => True, Convention => StdCall, External_Name => "alAuxiliaryEffectSlotf"; procedure Auxiliary_Effect_Slot_IV ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Values : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alAuxiliaryEffectSlotiv"; procedure Auxiliary_Effect_Slot_FV ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Values : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alAuxiliaryEffectSlotfv"; procedure Get_Auxiliary_Effects_Slot_I ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Value : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetAuxiliaryEffectSloti"; procedure Get_Auxiliary_Effect_Slot_IV ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Values : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetAuxiliaryEffectSlotiv"; procedure Get_Auxiliary_Effect_Slot_F ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Value : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetAuxiliaryEffectSlotf"; procedure Get_Auxiliary_Effect_Slot_FV ( Effect_Slot : in AL.UInt; Param : in AL.Enum; Values : in AL.Pointer ) with Import => True, Convention => StdCall, External_Name => "alGetAuxiliaryEffectSlotfv"; --------------------------------------------------------------------------- end Oto.EFX;
reznikmm/gela
Ada
2,156
ads
with Ada.Containers.Doubly_Linked_Lists; with Ada.Containers.Hashed_Sets; with Gela.Contexts; with Gela.Dependency_Lists; with Gela.Lexical_Types; package Gela.Plain_Dependency_Lists is pragma Preelaborate; type Dependency_List (Context : Gela.Contexts.Context_Access) is limited new Gela.Dependency_Lists.Dependency_List with private; type Dependency_List_Access is access all Dependency_List; private subtype Unit_Kinds is Gela.Dependency_Lists.Unit_Kinds; use all type Gela.Dependency_Lists.Unit_Kinds; type Unit_Index is record Kind : Unit_Kinds; Name : Gela.Lexical_Types.Symbol; end record; function Hash (Item : Unit_Index) return Ada.Containers.Hash_Type; package Unit_Index_Sets is new Ada.Containers.Hashed_Sets (Element_Type => Unit_Index, Hash => Hash, Equivalent_Elements => "="); package Unit_Data_Lists is new Ada.Containers.Doubly_Linked_Lists (Gela.Dependency_Lists.Unit_Data, Gela.Dependency_Lists."="); type Dependency_List (Context : Gela.Contexts.Context_Access) is limited new Gela.Dependency_Lists.Dependency_List with record Order : Unit_Data_Lists.List; -- List of units with already resolved dependecy Ordered : Unit_Index_Sets.Set; -- Index of Order list Queue : Unit_Data_Lists.List; -- List of units with not yet resolved dependecy Queued : Unit_Index_Sets.Set; -- Index of Queue list Pending : Unit_Index_Sets.Set; -- Set of requested units over Next_Required_Unit call No_Spec : Unit_Index_Sets.Set; -- Set of absent subprogram units over Next_Required_Unit call end record; overriding procedure No_Library_Unit_Declaration (Self : in out Dependency_List; Name : Gela.Lexical_Types.Symbol); overriding procedure Add_Compilation_Unit (Self : in out Dependency_List; Value : Gela.Dependency_Lists.Unit_Data); overriding procedure Next_Action (Self : in out Dependency_List; Action : out Gela.Dependency_Lists.Action); end Gela.Plain_Dependency_Lists;
zhmu/ananas
Ada
3,881
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . F I L E _ A T T R I B U T E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2013-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a binding to the GNAT file attribute query functions with System.OS_Constants; with System.Storage_Elements; package System.File_Attributes is type File_Attributes is private; procedure Reset_Attributes (A : access File_Attributes); function Error_Attributes (A : access File_Attributes) return Integer; function File_Exists_Attr (N : System.Address; A : access File_Attributes) return Integer; function File_Length_Attr (FD : Integer; N : System.Address; A : access File_Attributes) return Long_Long_Integer; function Is_Regular_File_Attr (N : System.Address; A : access File_Attributes) return Integer; function Is_Directory_Attr (N : System.Address; A : access File_Attributes) return Integer; private package SOSC renames System.OS_Constants; type File_Attributes is new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_file_attributes); for File_Attributes'Alignment use Standard'Maximum_Alignment; pragma Import (C, Reset_Attributes, "__gnat_reset_attributes"); pragma Import (C, Error_Attributes, "__gnat_error_attributes"); pragma Import (C, File_Exists_Attr, "__gnat_file_exists_attr"); pragma Import (C, File_Length_Attr, "__gnat_file_length_attr"); pragma Import (C, Is_Regular_File_Attr, "__gnat_is_regular_file_attr"); pragma Import (C, Is_Directory_Attr, "__gnat_is_directory_attr"); end System.File_Attributes;
reznikmm/matreshka
Ada
3,603
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UML.Interfaces.Hash is new AMF.Elements.Generic_Hash (UML_Interface, UML_Interface_Access);
AdaCore/training_material
Ada
2,204
adb
with Ada.Exceptions; with Logs; with Ada.Containers.Vectors; with Ada.Assertions; use Ada.Assertions; package body Test_Suite is function "=" (A, B: Test_Case_Access_T) return Boolean is begin return A.all = B.all; end "="; type Named_Test_Case_T is record TC : Test_Case_Access_T; Name : Unbounded_String; end record; package Test_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Named_Test_Case_T); type Test_Suite_T is tagged record Test_Cases : Test_Vectors.Vector; end record; TS : Test_Suite_T; procedure Register (TC : Test_Case_Access_T; Name : String) is begin TS.Test_Cases.Append (Named_Test_Case_T'(TC, To_Unbounded_String (Name))); end Register; procedure Run_All is use Logs; Successes, Failures, Errors : Natural := 0; begin if not Verbose then Logs.Buffer; end if; for NTC of TS.Test_Cases loop Put (" + " & To_String (NTC.Name) & ": "); begin begin NTC.TC.Run; exception when others => Logs.Put_Buffer; raise; end; Put_Line (Green, "OK"); Successes := Successes + 1; Logs.Drop_Buffer; exception when A : Assertion_Error => Put (Red, "Fail "); Put_Line (Ada.Exceptions.Exception_Message (A)); Failures := Failures + 1; when E : others => Put (White_On_Red, " Error "); Put_Line (" " & Ada.Exceptions.Exception_Name (E)); Put_Line (Ada.Exceptions.Exception_Message (E)); Errors := Errors + 1; end; Logs.Put_Buffer; end loop; Logs.Unbuffer; Put_Line ("success:" & Successes'Image & " failures:" & Failures'Image & " errors:" & Errors'Image); if Failures = 0 then Put_Line (Green, "OK all tests passed"); else Put_Line (Red, "FAIL"); end if; end Run_All; end Test_Suite;
reznikmm/matreshka
Ada
3,432
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$ ------------------------------------------------------------------------------ package AMF.Standard_Profile_L2 is pragma Preelaborate; end AMF.Standard_Profile_L2;
yannickmoy/atomic
Ada
11,933
ads
generic type T is mod <>; package Atomic.Generic32 with Preelaborate, Spark_Mode => On is -- Based on GCC atomic built-ins. See: -- https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html -- -- The specification is exactly the same for all sizes of data (8, 16, 32, -- 64). type Instance is limited private; -- This type is limited and private, it can only be manipulated using the -- primitives below. function Init (Val : T) return Instance with Post => Value (Init'Result) = Val; -- Can be used to initialize an atomic instance: -- -- A : Atomic.Unsigned_8.Instance := Atomic.Unsigned_8.Init (0); function Value (This : Instance) return T with Ghost; -- Ghost function to get the value of an instance without needing it -- aliased. This function can be used in contracts for instance. -- This doesn't use the atomic built-ins. function Load (This : aliased Instance; Order : Mem_Order := Seq_Cst) return T with Pre => Order in Relaxed | Consume | Acquire | Seq_Cst, Post => Load'Result = Value (This); procedure Store (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Pre => Order in Relaxed | Release | Seq_Cst, Post => Value (This) = Val; procedure Exchange (This : aliased in out Instance; Val : T; Old : out T; Order : Mem_Order := Seq_Cst) with Pre => Order in Relaxed | Acquire | Release | Acq_Rel | Seq_Cst, Post => Old = Value (This)'Old and then Value (This) = Val; procedure Compare_Exchange (This : aliased in out Instance; Expected : T; Desired : T; Weak : Boolean; Success : out Boolean; Success_Order : Mem_Order := Seq_Cst; Failure_Order : Mem_Order := Seq_Cst) with Pre => Failure_Order in Relaxed | Consume | Acquire | Seq_Cst and then not Stronger (Failure_Order, Success_Order), Post => Success = (Value (This)'Old = Expected) and then (if Success then Value (This) = Desired); procedure Add (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Post => Value (This) = Value (This)'Old + Val; procedure Sub (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Post => Value (This) = Value (This)'Old - Val; procedure Op_And (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Post => Value (This) = (Value (This)'Old and Val); procedure Op_XOR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Post => Value (This) = (Value (This)'Old xor Val); procedure Op_OR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Post => Value (This) = (Value (This)'Old or Val); procedure NAND (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) with Post => Value (This) = not (Value (This)'Old and Val); procedure Add_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = (Value (This)'Old + Val) and then Value (This) = Result; procedure Sub_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = (Value (This)'Old - Val) and then Value (This) = Result; procedure And_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = (Value (This)'Old and Val) and then Value (This) = Result; procedure XOR_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = (Value (This)'Old xor Val) and then Value (This) = Result; procedure OR_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = (Value (This)'Old or Val) and then Value (This) = Result; procedure NAND_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = not (Value (This)'Old and Val) and then Value (This) = Result; procedure Fetch_Add (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = Value (This)'Old and Value (This) = (Value (This)'Old + Val); procedure Fetch_Sub (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = Value (This)'Old and Value (This) = (Value (This)'Old - Val); procedure Fetch_And (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = Value (This)'Old and Value (This) = (Value (This)'Old and Val); procedure Fetch_XOR (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = Value (This)'Old and Value (This) = (Value (This)'Old xor Val); procedure Fetch_OR (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = Value (This)'Old and Value (This) = (Value (This)'Old or Val); procedure Fetch_NAND (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) with Post => Result = Value (This)'Old and Value (This) = not (Value (This)'Old and Val); -- NOT SPARK compatible -- function Exchange (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => Exchange'Result = Value (This)'Old and then Value (This) = Val; function Compare_Exchange (This : aliased in out Instance; Expected : T; Desired : T; Weak : Boolean; Success_Order : Mem_Order := Seq_Cst; Failure_Order : Mem_Order := Seq_Cst) return Boolean with SPARK_Mode => Off, Post => Compare_Exchange'Result = (Value (This)'Old = Expected) and then (if Compare_Exchange'Result then Value (This) = Desired); function Add_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => Add_Fetch'Result = (Value (This)'Old + Val) and then Value (This) = Add_Fetch'Result; function Sub_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => Sub_Fetch'Result = (Value (This)'Old - Val) and then Value (This) = Sub_Fetch'Result; function And_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => And_Fetch'Result = (Value (This)'Old and Val) and then Value (This) = And_Fetch'Result; function XOR_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => XOR_Fetch'Result = (Value (This)'Old xor Val) and then Value (This) = XOR_Fetch'Result; function OR_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => OR_Fetch'Result = (Value (This)'Old or Val) and then Value (This) = OR_Fetch'Result; function NAND_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off, Post => NAND_Fetch'Result = not (Value (This)'Old and Val) and then Value (This) = NAND_Fetch'Result; function Fetch_Add (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off; function Fetch_Sub (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off; function Fetch_And (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off; function Fetch_XOR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off; function Fetch_OR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off; function Fetch_NAND (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T with SPARK_Mode => Off; private type Instance is new T; ---------- -- Init -- ---------- function Init (Val : T) return Instance is (Instance (Val)); ----------- -- Value -- ----------- function Value (This : Instance) return T is (T (This)); pragma Inline (Init); pragma Inline (Load); pragma Inline (Store); pragma Inline (Exchange); pragma Inline (Compare_Exchange); pragma Inline (Add); pragma Inline (Sub); pragma Inline (Add_Fetch); pragma Inline (Sub_Fetch); pragma Inline (Fetch_Add); pragma Inline (Fetch_Sub); pragma Inline (Op_And); pragma Inline (Op_XOR); pragma Inline (Op_OR); pragma Inline (NAND); pragma Inline (And_Fetch); pragma Inline (XOR_Fetch); pragma Inline (OR_Fetch); pragma Inline (NAND_Fetch); pragma Inline (Fetch_And); pragma Inline (Fetch_XOR); pragma Inline (Fetch_OR); pragma Inline (Fetch_NAND); end Atomic.Generic32;
reznikmm/matreshka
Ada
3,734
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_Shadow_Opacity_Attributes is pragma Preelaborate; type ODF_Draw_Shadow_Opacity_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Shadow_Opacity_Attribute_Access is access all ODF_Draw_Shadow_Opacity_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Shadow_Opacity_Attributes;
damaki/libkeccak
Ada
4,463
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 Interfaces; use Interfaces; with Keccak.Types; -- @summary -- Implementation of the Ascon permutation. package Ascon with SPARK_Mode => On is State_Size_Bits : constant := 320; -- The Ascon state size, in bits. type State is private; type Round_Count is range 1 .. 12; procedure Init (S : out State) with Global => null, Depends => (S => null); -- Initialise the Ascon state. generic Num_Rounds : Round_Count; procedure Permute (S : in out State) with Global => null, Depends => (S =>+ null); -- Applies the Ascon permutation to the state. -- -- The number of rounds is a tunable security parameter. procedure XOR_Bits_Into_State (S : in out State; Data : in Keccak.Types.Byte_Array; Bit_Len : in Natural) with Global => null, Depends => (S =>+ (Data, Bit_Len)), Pre => (Bit_Len <= State_Size_Bits and then (Bit_Len + 7) / 8 <= Data'Length); -- XOR an arbitrary number of bits into the Ascon state. -- -- The data size (in bits) cannot exceed the Ascon size (320 bits). procedure Extract_Bytes (S : in State; Data : out Keccak.Types.Byte_Array) with Global => null, Depends => (Data =>+ S), Pre => Data'Length <= (State_Size_Bits / 8); pragma Annotate (GNATprove, False_Positive, """Data"" might not be initialized", "GNATprove issues a false positive due to the use of loops to initialize Data"); -- Copy bytes from the Ascon state. -- -- The number of bytes to copy cannot exceed the Ascon state size (40 bytes) procedure Extract_Bits (A : in State; Data : out Keccak.Types.Byte_Array; Bit_Len : in Natural) with Global => null, Depends => (Data =>+ (A, Bit_Len)), Pre => (Bit_Len <= State_Size_Bits and then Data'Length = (Bit_Len + 7) / 8); -- Copy bits from the Ascon state. -- -- The number of bits to copy cannot exceed the Ascon state size (320 bits) private type Round_Number is range 0 .. 11; type X_Coord is range 0 .. 4; type State is array (X_Coord) of Unsigned_64 with Size => 320; procedure Add_Constant (S : in out State; Round : in Round_Number) with Inline, Global => null, Depends => (S =>+ Round); procedure Substitution (S : in out State) with Inline, Global => null, Depends => (S =>+ null); procedure Linear_Diffusion (S : in out State) with Inline, Global => null, Depends => (S =>+ null); end Ascon;
reznikmm/matreshka
Ada
28,932
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Add_Structural_Feature_Value_Actions is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Add_Structural_Feature_Value_Action (AMF.UML.Add_Structural_Feature_Value_Actions.UML_Add_Structural_Feature_Value_Action_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Add_Structural_Feature_Value_Action (AMF.UML.Add_Structural_Feature_Value_Actions.UML_Add_Structural_Feature_Value_Action_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Add_Structural_Feature_Value_Action (Visitor, AMF.UML.Add_Structural_Feature_Value_Actions.UML_Add_Structural_Feature_Value_Action_Access (Self), Control); end if; end Visit_Element; ------------------- -- Get_Insert_At -- ------------------- overriding function Get_Insert_At (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Input_Pins.UML_Input_Pin_Access is begin return AMF.UML.Input_Pins.UML_Input_Pin_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Insert_At (Self.Element))); end Get_Insert_At; ------------------- -- Set_Insert_At -- ------------------- overriding procedure Set_Insert_At (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Insert_At (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Insert_At; ------------------------ -- Get_Is_Replace_All -- ------------------------ overriding function Get_Is_Replace_All (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Replace_All (Self.Element); end Get_Is_Replace_All; ------------------------ -- Set_Is_Replace_All -- ------------------------ overriding procedure Set_Is_Replace_All (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Replace_All (Self.Element, To); end Set_Is_Replace_All; ---------------- -- Get_Result -- ---------------- overriding function Get_Result (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Output_Pins.UML_Output_Pin_Access is begin return AMF.UML.Output_Pins.UML_Output_Pin_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Result (Self.Element))); end Get_Result; ---------------- -- Set_Result -- ---------------- overriding procedure Set_Result (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Result (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Result; --------------- -- Get_Value -- --------------- overriding function Get_Value (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Input_Pins.UML_Input_Pin_Access is begin return AMF.UML.Input_Pins.UML_Input_Pin_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Value (Self.Element))); end Get_Value; --------------- -- Set_Value -- --------------- overriding procedure Set_Value (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Value (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Value; ---------------- -- Get_Object -- ---------------- overriding function Get_Object (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Input_Pins.UML_Input_Pin_Access is begin return AMF.UML.Input_Pins.UML_Input_Pin_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Object (Self.Element))); end Get_Object; ---------------- -- Set_Object -- ---------------- overriding procedure Set_Object (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Object (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Object; ---------------------------- -- Get_Structural_Feature -- ---------------------------- overriding function Get_Structural_Feature (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Structural_Features.UML_Structural_Feature_Access is begin return AMF.UML.Structural_Features.UML_Structural_Feature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Structural_Feature (Self.Element))); end Get_Structural_Feature; ---------------------------- -- Set_Structural_Feature -- ---------------------------- overriding procedure Set_Structural_Feature (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Structural_Features.UML_Structural_Feature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Structural_Feature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Structural_Feature; ----------------- -- Get_Context -- ----------------- overriding function Get_Context (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin return AMF.UML.Classifiers.UML_Classifier_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Context (Self.Element))); end Get_Context; --------------- -- Get_Input -- --------------- overriding function Get_Input (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Input (Self.Element))); end Get_Input; ------------------------------ -- Get_Is_Locally_Reentrant -- ------------------------------ overriding function Get_Is_Locally_Reentrant (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant (Self.Element); end Get_Is_Locally_Reentrant; ------------------------------ -- Set_Is_Locally_Reentrant -- ------------------------------ overriding procedure Set_Is_Locally_Reentrant (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant (Self.Element, To); end Set_Is_Locally_Reentrant; ----------------------------- -- Get_Local_Postcondition -- ----------------------------- overriding function Get_Local_Postcondition (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition (Self.Element))); end Get_Local_Postcondition; ---------------------------- -- Get_Local_Precondition -- ---------------------------- overriding function Get_Local_Precondition (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition (Self.Element))); end Get_Local_Precondition; ---------------- -- Get_Output -- ---------------- overriding function Get_Output (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Output (Self.Element))); end Get_Output; ----------------- -- Get_Handler -- ----------------- overriding function Get_Handler (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is begin return AMF.UML.Exception_Handlers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler (Self.Element))); end Get_Handler; ------------------ -- Get_Activity -- ------------------ overriding function Get_Activity (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Activities.UML_Activity_Access is begin return AMF.UML.Activities.UML_Activity_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity (Self.Element))); end Get_Activity; ------------------ -- Set_Activity -- ------------------ overriding procedure Set_Activity (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Activities.UML_Activity_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Activity; ------------------ -- Get_In_Group -- ------------------ overriding function Get_In_Group (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is begin return AMF.UML.Activity_Groups.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group (Self.Element))); end Get_In_Group; --------------------------------- -- Get_In_Interruptible_Region -- --------------------------------- overriding function Get_In_Interruptible_Region (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is begin return AMF.UML.Interruptible_Activity_Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region (Self.Element))); end Get_In_Interruptible_Region; ---------------------- -- Get_In_Partition -- ---------------------- overriding function Get_In_Partition (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is begin return AMF.UML.Activity_Partitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition (Self.Element))); end Get_In_Partition; ---------------------------- -- Get_In_Structured_Node -- ---------------------------- overriding function Get_In_Structured_Node (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is begin return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node (Self.Element))); end Get_In_Structured_Node; ---------------------------- -- Set_In_Structured_Node -- ---------------------------- overriding procedure Set_In_Structured_Node (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_In_Structured_Node; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------ -- Get_Redefined_Node -- ------------------------ overriding function Get_Redefined_Node (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node (Self.Element))); end Get_Redefined_Node; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Add_Structural_Feature_Value_Action_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ------------- -- Context -- ------------- overriding function Context (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Add_Structural_Feature_Value_Action_Proxy.Context"; return Context (Self); end Context; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Add_Structural_Feature_Value_Action_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Add_Structural_Feature_Value_Action_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Add_Structural_Feature_Value_Action_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Add_Structural_Feature_Value_Action_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Add_Structural_Feature_Value_Action_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Add_Structural_Feature_Value_Action_Proxy.Namespace"; return Namespace (Self); end Namespace; end AMF.Internals.UML_Add_Structural_Feature_Value_Actions;
charlie5/cBound
Ada
1,486
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_query_objectuiv_arb_cookie_t is -- Item -- type Item is record sequence : aliased Interfaces.C.unsigned; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_glx_get_query_objectuiv_arb_cookie_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_query_objectuiv_arb_cookie_t.Item, Element_Array => xcb.xcb_glx_get_query_objectuiv_arb_cookie_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_glx_get_query_objectuiv_arb_cookie_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_query_objectuiv_arb_cookie_t.Pointer, Element_Array => xcb.xcb_glx_get_query_objectuiv_arb_cookie_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_query_objectuiv_arb_cookie_t;
AdaCore/gpr
Ada
27,946
adb
------------------------------------------------------------------------------ -- -- -- GPR2 PROJECT MANAGER -- -- -- -- Copyright (C) 2019-2023, AdaCore -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- -- License for more details. You should have received a copy of the GNU -- -- General Public License distributed with GNAT; see file COPYING. If not, -- -- see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------ with Ada.Directories; with Ada.Exceptions; with Ada.Strings.Unbounded; with Ada.Text_IO; with GNAT.OS_Lib; with GNATCOLL.Traces; with GNATCOLL.Tribooleans; with GNATCOLL.Utils; with GPR2.Compilation.Registry; with GPR2.Containers; with GPR2.Log; with GPR2.Message; with GPR2.Options; with GPR2.Path_Name; with GPR2.Project.Attribute; with GPR2.Project.Configuration; with GPR2.Project.Registry.Attribute; with GPR2.Project.Source.Artifact; pragma Warnings (Off, "unit ""GPR2.Project.Source.Set"" is not referenced"); -- This pragma need to workaround GNAT bug U622-047 when unit is necessary, -- but when set, issues warning that it is not referenced. -- with GPR2.Project.Source.Set; -- Without this import -- gprclean-main.adb:386:20: error: cannot call function that returns limited -- view of type "Object" defined at gpr2-project-source-set.ads:32 -- gprclean-main.adb:386:20: error: there must be a regular with_clause for -- package "Set" in the current unit, or in some unit in its context pragma Warnings (On); with GPR2.Project.Tree; with GPR2.Project.View; with GPR2.Source_Reference; with GPR2.Unit; with GPRtools.Command_Line; with GPRtools.Options; with GPRtools.Util; with GPRclean.Options; procedure GPRclean.Main is use Ada; use Ada.Exceptions; use Ada.Strings.Unbounded; use GNATCOLL.Tribooleans; use GPR2; use GPRtools; use GPR2.Path_Name; use all type Unit.Library_Unit_Type; package PRA renames GPR2.Project.Registry.Attribute; procedure Clean (View : Project.View.Object); -- Clean given View Project_Tree : Project.Tree.Object; Options : GPRclean.Options.Object; Parser : GPRtools.Options.Command_Line_Parser; procedure Delete_File (Name : Path_Name.Full_Name; Opts : GPRclean.Options.Object); -- Remove file if exists. -- Opts parameter need because the command line options is used inside of -- this routine and could be different for different projects because of -- Switches attribute in project package Clean. ----------- -- Clean -- ----------- procedure Clean (View : Project.View.Object) is use GNATCOLL.Utils; Obj_Dir : constant Path_Name.Object := View.Object_Directory; Tree : constant access Project.Tree.Object := View.Tree; Lib_Dir : constant GPR2.Path_Name.Object := (if View.Is_Library then View.Library_Directory else GPR2.Path_Name.Undefined); Lib_Ali_Dir : constant GPR2.Path_Name.Object := (if Lib_Dir.Is_Defined and then View.Library_Ali_Directory /= Lib_Dir then View.Library_Ali_Directory else GPR2.Path_Name.Undefined); Lib_Src_Dir : constant GPR2.Path_Name.Object := (if Lib_Dir.Is_Defined and then View.Library_Src_Directory /= Lib_Dir and then View.Library_Src_Directory /= Lib_Ali_Dir then View.Library_Src_Directory else GPR2.Path_Name.Undefined); pragma Warnings (Off); function "&" (Left, Right : Name_Type) return Name_Type renames GPR2."&"; -- ??? work around a strange visibility issue pragma Warnings (On); procedure Binder_Artifacts (Name : GPR2.Simple_Name; Language : Language_Id := No_Language); -- Add binder artefacts for the name procedure Delete_File (Name : Path_Name.Full_Name); -- Delete file with specific for this project options function Partial_Path (View : Project.View.Object; Library_Name : GPR2.Simple_Name; Number : Natural) return Path_Name.Object; -- return partially linked object function Linker_Options (View : Project.View.Object; Library_Name : GPR2.Simple_Name) return Path_Name.Object; -- return linker options path function In_Library_Directories (File : Path_Name.Object) return Boolean; -- return true if view is a library and File is in library_dir, -- library_ali_dir or library_src_dir directories ---------------------- -- Binder_Artifacts -- ---------------------- procedure Binder_Artifacts (Name : GPR2.Simple_Name; Language : Language_Id := No_Language) is begin for F of View.Binder_Artifacts (Name, Language) loop Delete_File (F.Value); end loop; end Binder_Artifacts; ----------------- -- Delete_File -- ----------------- procedure Delete_File (Name : Path_Name.Full_Name) is begin Main.Delete_File (Name, Options); end Delete_File; ---------------------------- -- In_Library_Directories -- ---------------------------- function In_Library_Directories (File : Path_Name.Object) return Boolean is begin if Lib_Dir.Is_Defined then declare Parent : constant Path_Name.Object := Create_Directory (Filename_Type (Dir_Name (File))); begin return Parent = Lib_Dir or else Parent = Lib_Ali_Dir or else Parent = Lib_Src_Dir; end; else return False; end if; end In_Library_Directories; Has_Mains : constant Boolean := View.Has_Mains; -------------------- -- Linker_Options -- -------------------- function Linker_Options (View : Project.View.Object; Library_Name : GPR2.Simple_Name) return Path_Name.Object is begin return View.Object_Directory.Compose (Library_Name & ".linker_options"); end Linker_Options; ------------------ -- Partial_Path -- ------------------ function Partial_Path (View : Project.View.Object; Library_Name : GPR2.Simple_Name; Number : Natural) return Path_Name.Object is begin return View.Object_Directory.Compose (GPRtools.Util.Partial_Name (Library_Name, Number, View.Tree.Object_Suffix)); end Partial_Path; Mains_In_View : GPR2.Containers.Filename_Set; -- mains in cmd line found in this view begin if Options.Verbose then Text_IO.Put_Line ("Cleaning project: """ & String (View.Name) & '"'); end if; if View.Object_Directory.Is_Defined and then View.Object_Directory.Is_Directory then if not View.Is_Library then if View.Has_Imports then for Import of View.Imports (True) loop if Import.Is_Library and then Import.Is_Library_Standalone then declare Link_Opt : constant Path_Name.Object := Linker_Options (View, Import.Library_Name); Partial : constant Path_Name.Object := Partial_Path (View, Import.Library_Name, 0); begin if Link_Opt.Exists then Delete_File (Link_Opt.Value); end if; if Partial.Exists then Delete_File (Partial.Value); end if; end; end if; end loop; end if; else -- For a library project, clean the partially link objects, if -- there are some. declare use GPR2.Project; Partial_Number : Natural := 0; begin loop declare Partial : constant Path_Name.Object := Partial_Path (View, View.Library_Name, Partial_Number); begin if Partial.Exists then Delete_File (Partial.Value); Partial_Number := Partial_Number + 1; else exit; end if; end; end loop; -- For a static SAL, clean the .linker_options file which -- exists if the latest build was done in "keep temp files" -- mode. if View.Library_Standalone /= No and then View.Is_Static_Library then declare Link_Opt : constant Path_Name.Object := Linker_Options (View, View.Library_Name); begin if Link_Opt.Exists then Delete_File (Link_Opt.Value); end if; end; end if; end; end if; end if; -- Handle mains without spec/body extension declare Removed_Mains : GPR2.Containers.Filename_Set; begin -- Add found sources to Found_Mains for M of Options.Mains loop declare Main : constant GPR2.Path_Name.Object := View.Source_Path (Name => M, Allow_Spec_File => True, Allow_Unit_Name => False); begin if Main.Is_Defined then declare Position : GPR2.Containers.Filename_Type_Set.Cursor; Inserted : Boolean; begin Mains_In_View.Insert (New_Item => Filename_Type (Main.Simple_Name), Position => Position, Inserted => Inserted); if Inserted then Removed_Mains.Insert (M); end if; end; end if; end; end loop; --- Remove found mains from Mains & Mains_In_Cmd for Arg of Removed_Mains loop Options.Mains.Delete (Arg); end loop; end; for S of View.Sources loop declare Cleanup : Boolean := True; -- To disable cleanup if main files list exists and the main file -- is not from list. In_Mains : Boolean := False; Is_Main : constant Boolean := Has_Mains and then S.Is_Main; C_Main : Containers.Filename_Type_Set.Cursor := Mains_In_View.Find (S.Path_Name.Simple_Name); begin -- Remove source simple name from Options.Mains as all Mains found -- is handled at Tree level not View level. if Containers.Filename_Type_Set.Has_Element (C_Main) then In_Mains := True; Mains_In_View.Delete (C_Main); end if; if Is_Main or else In_Mains then if Is_Main and then Options.Arg_Mains and then not In_Mains then Cleanup := False; elsif S.Language = Ada_Language and then not S.Has_Single_Unit then for CU of S.Units loop if CU.Kind in Unit.Body_Kind then Binder_Artifacts (S.Path_Name.Base_Filename & Filename_Type ('~' & Image (Positive (CU.Index), 1)), Language => S.Language); end if; end loop; elsif not View.Is_Library then Binder_Artifacts (S.Path_Name.Base_Filename, Language => S.Language); end if; end if; if Cleanup then for F of S.Artifacts.List_To_Clean loop -- As S.Artifacts contains also files generated in library -- directories, check if delete file is allowed if not Options.Remain_Useful or else not In_Library_Directories (F) then Delete_File (F.Value); end if; end loop; if not Options.Remain_Useful and then Options.Arg_Mains and then In_Mains then -- When we took main procedure filename from Main project -- attributes, the executable file name included into -- View.Mains below. This case is when main procedure -- filename defined in command line and we have to remove -- the executable file separately. for U of S.Units loop Delete_File (View.Executable (S.Path_Name.Simple_Name, U.Index).Value); end loop; end if; end if; end; end loop; if not Options.Remain_Useful and then View.Has_Mains and then not Options.Arg_Mains then for M of View.Executables loop Delete_File (M.Value); end loop; end if; for A of View.Artifacts loop Delete_File (A.Value); end loop; if Has_Mains or else Options.Arg_Mains then declare Main_Lib : constant Value_Type := Obj_Dir.Compose ("lib" & Filename_Type (To_Lower (View.Name))).Value; begin Delete_File (Main_Lib & String (Tree.Archive_Suffix)); Delete_File (Main_Lib & ".deps"); end; end if; if View.Is_Library and then not Options.Remain_Useful then -- All library generated files should be deleted if View.Is_Aggregated_In_Library then for Lib of View.Aggregate_Libraries loop Binder_Artifacts (Lib.Library_Name); end loop; else Delete_File (View.Library_Filename.Value); -- Delete if any library version & library major version if not View.Is_Static_Library and then View.Has_Library_Version then if View.Library_Version_Filename /= View.Library_Major_Version_Filename then -- When library version attribute is provided, to keep all -- links seen as regular file, link target should be deleted -- after the link. Library binary files should be deleted -- starting with Library_Filename and ending with -- Library_Version_Filename if View.Library_Major_Version_Filename /= View.Library_Filename then Delete_File (View.Library_Major_Version_Filename.Value); end if; if View.Library_Version_Filename /= View.Library_Major_Version_Filename then Delete_File (View.Library_Version_Filename.Value); end if; end if; end if; Binder_Artifacts (View.Library_Name); end if; end if; if Options.Src_Subdirs /= Null_Unbounded_String and then View.Kind in K_Standard | K_Library | K_Aggregate_Library then declare use Ada.Directories; Search : Search_Type; File : Directory_Entry_Type; begin Start_Search (Search, View.Source_Subdirectory.Value, "", Filter => (Ordinary_File => True, others => False)); while More_Entries (Search) loop Get_Next_Entry (Search, File); Delete_File (Ada.Directories.Full_Name (File)); end loop; end; end if; -- Delete source files found in library source directory if View.Is_Library and then View.Library_Src_Directory.Is_Defined and then not Options.Remain_Useful then declare Lib_Src_Dir : constant GPR2.Path_Name.Object := View.Library_Src_Directory; begin for Source of View.Sources loop declare F : constant GPR2.Path_Name.Object := Lib_Src_Dir.Compose (Source.Path_Name.Simple_Name); begin if F.Exists then Delete_File (F.Value); end if; end; end loop; end; end if; -- Removes empty directories if Options.Remove_Empty_Dirs then declare use Ada.Directories; procedure Delete_Dir (Dir : Value_Not_Empty); -- Delete directory if a directory procedure Delete_If_Not_Project (Dir : Path_Name.Object); -- Delete the directory if it is not the directory where the -- project is resided. ---------------- -- Delete_Dir -- ---------------- procedure Delete_Dir (Dir : Value_Not_Empty) is begin if Kind (Dir) = Directory then Delete_Directory (Dir); end if; exception when Use_Error => declare Search : Search_Type; begin if Options.Warnings then Start_Search (Search, Dir, ""); Text_IO.Put_Line ("warning: Directory """ & Dir & """ could not be removed" & (if More_Entries (Search) then " because it is not empty" else "") & '.'); end if; end; end Delete_Dir; --------------------------- -- Delete_If_Not_Project -- --------------------------- procedure Delete_If_Not_Project (Dir : Path_Name.Object) is begin if Dir.Value /= View.Dir_Name.Value and then Dir.Exists then declare Dir_Name : constant String := Dir.Value; DS : Character renames GNAT.OS_Lib.Directory_Separator; begin Delete_Dir (Dir_Name); if Options.Subdirs /= Null_Unbounded_String and then String (Dir.Simple_Name) = Options.Subdirs then -- If subdirs is defined try to remove the parent one pragma Assert (Dir_Name (Dir_Name'Last - Length (Options.Subdirs) - Boolean'Pos (Dir_Name (Dir_Name'Last) = DS)) = DS, "invalid parent directory " & Dir_Name); Delete_If_Not_Project (Dir.Containing_Directory); end if; end; end if; end Delete_If_Not_Project; begin if View.Kind in K_Standard | K_Library | K_Aggregate_Library then if Options.Src_Subdirs /= Null_Unbounded_String then Delete_If_Not_Project (View.Source_Subdirectory); end if; Delete_If_Not_Project (Obj_Dir); if View.Executable_Directory /= Obj_Dir then Delete_If_Not_Project (View.Executable_Directory); end if; end if; if View.Is_Library then Delete_If_Not_Project (View.Library_Directory); if View.Library_Directory /= View.Library_Ali_Directory then Delete_If_Not_Project (View.Library_Ali_Directory); end if; if View.Library_Directory /= View.Library_Src_Directory and then View.Library_Ali_Directory /= View.Library_Src_Directory then Delete_If_Not_Project (View.Library_Src_Directory); end if; end if; end; end if; end Clean; ----------------- -- Delete_File -- ----------------- procedure Delete_File (Name : Path_Name.Full_Name; Opts : GPRclean.Options.Object) is use GNAT.OS_Lib; Success : Boolean := False; begin if Is_Regular_File (Name) then if Opts.Dry_Run then Text_IO.Put_Line (Name); else if GNAT.OS_Lib.Is_Owner_Writable_File (Name) then Delete_File (Name, Success); elsif Opts.Force_Deletions then GNAT.OS_Lib.Set_Writable (Name); Delete_File (Name, Success); end if; if Success then if Opts.Verbosity > Regular then Text_IO.Put_Line ('"' & Name & """ has been deleted"); end if; elsif Opts.Verbosity > Quiet and then Opts.Warnings then Text_IO.Put_Line ("Warning: """ & Name & """ could not be deleted"); end if; end if; end if; end Delete_File; begin GNATCOLL.Traces.Parse_Config_File; GPRtools.Util.Set_Program_Name ("gprclean"); GPRclean.Options.Setup (Parser); Options.Tree := Project_Tree.Reference; GPRclean.Options.Parse_Command_Line (Parser, Options); if not Options.Load_Project (Absent_Dir_Error => Project.Tree.No_Error, Handle_Information => Options.Verbose, Handle_Lint => Options.Verbose) then GPRtools.Util.Fail_Program ('"' & (if Options.Project_Is_Defined then String (Options.Filename.Simple_Name) else Options.Filename.Value) & """ processing failed"); end if; -- Check gprclean's Switch attribute from loaded project declare Attr : constant GPR2.Project.Attribute.Object := Project_Tree.Root_Project.Attribute (PRA.Clean.Switches); begin if Attr.Is_Defined then Options := (GPRtools.Options.Empty_Options with others => <>); GPRclean.Options.Parse_Attribute_Switches (Parser, Options, Attr.Values); -- re-parse the command line to allow it to overwrite project -- defined Switches attribute. GPRclean.Options.Parse_Command_Line (Parser, Options); -- Note that we never need to reload the tree, as we ensured that -- no switch modifying the configuration of the project or the -- way we load the project tree is allowed in the Switches -- attribute. end if; exception when E : GPR2.Options.Usage_Error => GPRtools.Util.Finish_Program (GPRtools.Util.E_Fatal, Exception_Message (E)); end; if Project_Tree.Has_Configuration and then Project_Tree.Configuration.Log_Messages.Has_Element (Warning => True, Information => False, Error => False) then Project_Tree.Log_Messages.Append (GPR2.Message.Create (GPR2.Message.Warning, "Cleaning may be incomplete, as there were problems during" & " auto-configuration", Source_Reference.Create (Project_Tree.Root_Project.Path_Name.Value, 0, 0))); end if; if Project_Tree.Root_Project.Is_Library and then Options.Arg_Mains then Project_Tree.Log_Messages.Append (GPR2.Message.Create (GPR2.Message.Error, "main cannot be a source of a library project: """ & String (Options.Mains.First_Element) & '"', Source_Reference.Create (Project_Tree.Root_Project.Path_Name.Value, 0, 0))); Util.Output_Messages (Options); GPRtools.Util.Fail_Program ("problems with main sources"); end if; Project_Tree.Update_Sources; -- Iterate on all view, and clean them for V in Project_Tree.Iterate (Kind => (Project.I_Recursive => Options.All_Projects, Project.I_Imported => Options.All_Projects, Project.I_Aggregated => Options.All_Projects or else Project_Tree.Root_Project.Kind /= K_Aggregate_Library, Project.I_Extended => Options.All_Projects, Project.I_Runtime => False, Project.I_Configuration => False, others => True), Status => (Project.S_Externally_Built => False), Filter => (Project.F_Abstract | Project.F_Aggregate => False, others => True)) loop Clean (Project.Tree.Element (V)); if Options.Distributed_Mode then GPR2.Compilation.Registry.Clean_Up_Remote_Slaves (Project.Tree.Element (V), Options); end if; end loop; if Options.Arg_Mains and then not Options.Mains.Is_Empty then GPRtools.Util.Fail_Program ('"' & String (Options.Mains.First_Element) & """ was not found in the sources of any project"); end if; if Options.Remove_Config then Delete_File (Options.Config_Project.Value, Options); end if; Util.Output_Messages (Options); exception when E : GPR2.Options.Usage_Error => Text_IO.Put_Line (Text_IO.Standard_Error, "gprclean: " & Exception_Message (E)); GPRtools.Command_Line.Try_Help; GPRtools.Util.Exit_Program (GPRtools.Util.E_Fatal); when Project_Error | Processing_Error => GPRtools.Util.Project_Processing_Failed (Options); when E : others => GPRtools.Util.Fail_Program ("Fatal error: " & Exception_Information (E)); end GPRclean.Main;
reznikmm/matreshka
Ada
4,647
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Draw.Extrusion_Color_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Extrusion_Color_Attribute_Node is begin return Self : Draw_Extrusion_Color_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Extrusion_Color_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Extrusion_Color_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Extrusion_Color_Attribute, Draw_Extrusion_Color_Attribute_Node'Tag); end Matreshka.ODF_Draw.Extrusion_Color_Attributes;
zhmu/ananas
Ada
221
adb
-- { dg-do run } -- { dg-options "-O2" } with Opt96_Pkg; use Opt96_Pkg; procedure Opt96 is R : Rec; D : Data; begin D.Foo.Bar := (0.02, 0.01); if R.F (D) /= 30 then raise Program_Error; end if; end;
MinimSecure/unum-sdk
Ada
791
ads
-- Copyright (C) 2011-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is function Ident (I : Integer) return Integer; end Pck;
reznikmm/matreshka
Ada
3,690
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Asis; with Engines.Contexts; with League.Strings; package Properties.Declarations.Defining_Expanded_Name is function Code (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Text_Property) return League.Strings.Universal_String; end Properties.Declarations.Defining_Expanded_Name;
persan/gprTools
Ada
2,102
adb
with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.Strings; with Ada.Directories; use Ada.Directories; with Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; procedure GPR_Tools.Pkg2gpr.Main is OutputFolder : aliased GNAT.Strings.String_Access := new String'(Ada.Directories.Current_Directory); Version : constant String := $VERSION; Command_Name : constant String := Ada.Directories.Base_Name (Ada.Command_Line.Command_Name); procedure Show (S : String) is D : Descr; begin D.Read_Pkg (S); D.Write_GPR (Ada.Directories.Compose (OutputFolder.all, D.Get_GPR)); end Show; procedure Print_Help is use ASCII; begin Put_Line (Command_Name & " " & Version & LF & "Syntax:" & LF & " " & Command_Name & " [OPtions] pkg-FILEs" & LF & "Options:" & LF & " -OFolder Define output folder." & LF & " --version Printversion and exit." & LF & " -h -? --help Print this text."); end Print_Help; begin loop case GNAT.Command_Line.Getopt ("O: ? h -help") is when ASCII.NUL => exit; when '?' | 'h' => Print_Help; return; when '-' => if Full_Switch = "-version" then Put_Line (Version); return; elsif Full_Switch = "-help" then Print_Help; return; end if; when 'O' => OutputFolder := new String'(GNAT.Command_Line.Parameter); when others => raise Program_Error; -- cannot occur end case; end loop; if not Exists (OutputFolder.all) then Create_Path (OutputFolder.all); end if; loop declare S : constant String := Get_Argument (Do_Expansion => True); begin exit when S'Length = 0; Show (S); end; end loop; exception when Invalid_Switch => Put_Line ("Invalid Switch " & Full_Switch); when Invalid_Parameter => Put_Line ("No parameter for " & Full_Switch); end GPR_Tools.Pkg2gpr.Main;
AdaCore/training_material
Ada
486
adb
package body Tasks is --$ begin cut task body Select_Requeue_Quit is begin accept Receive_Message (V : String) do requeue Receive_Message; end Receive_Message; delay 2.0; end Select_Requeue_Quit; --$ end cut task body Call_Or_Terminate is begin --$ begin cut select Select_Requeue_Quit.Receive_Message ("Hello"); or delay 0.1; end select; --$ end cut end Call_Or_Terminate; end Tasks;
charlie5/lace
Ada
3,960
adb
with GID.Buffering; use GID.Buffering; package body GID.Decoding_BMP is procedure Load (image: in out Image_descriptor) is b01, b, br, bg, bb: U8:= 0; x, x_max, y: Natural; -- procedure Pixel_with_palette is pragma Inline(Pixel_with_palette); begin case Primary_color_range'Modulus is when 256 => Put_Pixel( Primary_color_range(image.palette(Integer(b)).red), Primary_color_range(image.palette(Integer(b)).green), Primary_color_range(image.palette(Integer(b)).blue), 255 ); when 65_536 => Put_Pixel( 16#101# * Primary_color_range(image.palette(Integer(b)).red), 16#101# * Primary_color_range(image.palette(Integer(b)).green), 16#101# * Primary_color_range(image.palette(Integer(b)).blue), 65_535 -- 16#101# because max intensity FF goes to FFFF ); when others => raise invalid_primary_color_range; end case; end Pixel_with_palette; -- pair: Boolean; bit: Natural range 0..7; -- line_bits: constant Float:= Float(image.width * image.bits_per_pixel); padded_line_size: constant Positive:= 4 * Integer(Float'Ceiling(line_bits / 32.0)); unpadded_line_size: constant Positive:= Integer(Float'Ceiling(line_bits / 8.0)); -- (in bytes) begin Attach_Stream(image.buffer, image.stream); y:= 0; while y <= image.height-1 loop x:= 0; x_max:= image.width-1; case image.bits_per_pixel is when 1 => -- B/W bit:= 0; Set_X_Y(x,y); while x <= x_max loop if bit=0 then Get_Byte(image.buffer, b01); end if; b:= (b01 and 16#80#) / 16#80#; Pixel_with_palette; b01:= b01 * 2; -- cannot overflow. if bit=7 then bit:= 0; else bit:= bit + 1; end if; x:= x + 1; end loop; when 4 => -- 16 colour image pair:= True; Set_X_Y(x,y); while x <= x_max loop if pair then Get_Byte(image.buffer, b01); b:= (b01 and 16#F0#) / 16#10#; else b:= (b01 and 16#0F#); end if; pair:= not pair; Pixel_with_palette; x:= x + 1; end loop; when 8 => -- 256 colour image Set_X_Y(x,y); while x <= x_max loop Get_Byte(image.buffer, b); Pixel_with_palette; x:= x + 1; end loop; when 24 => -- RGB, 256 colour per primary colour Set_X_Y(x,y); while x <= x_max loop Get_Byte(image.buffer, bb); Get_Byte(image.buffer, bg); Get_Byte(image.buffer, br); case Primary_color_range'Modulus is when 256 => Put_Pixel( Primary_color_range(br), Primary_color_range(bg), Primary_color_range(bb), 255 ); when 65_536 => Put_Pixel( 256 * Primary_color_range(br), 256 * Primary_color_range(bg), 256 * Primary_color_range(bb), 65_535 ); when others => raise invalid_primary_color_range; end case; x:= x + 1; end loop; when others => null; end case; for i in unpadded_line_size + 1 .. padded_line_size loop Get_Byte(image.buffer, b); end loop; y:= y + 1; Feedback((y*100)/image.height); end loop; end Load; end GID.Decoding_BMP;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
2,655
adb
with STM32GD.Board; package body Blink is Next_Release : Time := Clock; Period_On : constant Time_Span := Milliseconds (200); Period_Off : constant Time_Span := Milliseconds (200); Period_Pause : constant Time_Span := Milliseconds (2500); task Blink_Task with Storage_Size => 768; protected body Blink_Parameters is procedure Start (LED : LED_Type ; M : Mode_Type ; C : Positive) is begin Mode (LED) := M; Blink_Count (LED) := C; Remaining_Toggles (LED) := C * 2; end Start; procedure Increase_Blink_Count (LED : LED_Type) is begin Blink_Count (LED) := Blink_Count (LED) + 1; end Increase_Blink_Count; procedure Decrease_Blink_Count (LED : LED_Type) is begin if Blink_Count (LED) > 2 then Blink_Count (LED) := Blink_Count (LED) - 1; end if; end Decrease_Blink_Count; function Get_Mode (LED : LED_Type) return Mode_Type is begin return Mode (LED); end Get_Mode; function Get_Blink_Count (LED : LED_Type) return Positive is begin return Blink_Count (LED); end Get_Blink_Count; procedure Toggle (LED : LED_Type; Toggled : out Boolean) is begin Toggled := False; if Mode (LED) /= Off then case LED is when Green => STM32GD.Board.LED2.Toggle; when Yellow => STM32GD.Board.LED_Yellow.Toggle; when Red => STM32GD.Board.LED.Toggle; end case; Remaining_Toggles (LED) := Remaining_Toggles (LED) - 1; if Remaining_Toggles (LED) = 0 then if Mode (LED) = Repeat then Remaining_Toggles (LED) := Blink_Count (LED) * 2; else Mode (LED) := Off; end if; else Toggled := True; end if; end if; end Toggle; end Blink_Parameters; task body Blink_Task is Skip : Time_Span; Pause : Time_Span := Period_Pause; Green_Toggled : Boolean; Red_Toggled : Boolean; Yellow_Toggled : Boolean; begin loop Blink_Parameters.Toggle (Green, Green_Toggled); Blink_Parameters.Toggle (Red, Red_Toggled); Blink_Parameters.Toggle (Yellow, Yellow_Toggled); if Green_Toggled or Red_Toggled or Yellow_Toggled then Skip := Period_On; else Skip := Pause; end if; Next_Release := Next_Release + Skip; delay until Next_Release; end loop; end Blink_Task; end Blink;
reznikmm/matreshka
Ada
4,623
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Draw.Handle_Polar_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Handle_Polar_Attribute_Node is begin return Self : Draw_Handle_Polar_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Handle_Polar_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Handle_Polar_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Handle_Polar_Attribute, Draw_Handle_Polar_Attribute_Node'Tag); end Matreshka.ODF_Draw.Handle_Polar_Attributes;
docandrew/troodon
Ada
10,322
ads
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with bits_types_h; package stdint_h is INT8_MIN : constant := (-128); -- /usr/include/stdint.h:116 INT16_MIN : constant := (-32767-1); -- /usr/include/stdint.h:117 INT32_MIN : constant := (-2147483647-1); -- /usr/include/stdint.h:118 -- unsupported macro: INT64_MIN (-__INT64_C(9223372036854775807)-1) INT8_MAX : constant := (127); -- /usr/include/stdint.h:121 INT16_MAX : constant := (32767); -- /usr/include/stdint.h:122 INT32_MAX : constant := (2147483647); -- /usr/include/stdint.h:123 -- unsupported macro: INT64_MAX (__INT64_C(9223372036854775807)) UINT8_MAX : constant := (255); -- /usr/include/stdint.h:127 UINT16_MAX : constant := (65535); -- /usr/include/stdint.h:128 UINT32_MAX : constant := (4294967295); -- /usr/include/stdint.h:129 -- unsupported macro: UINT64_MAX (__UINT64_C(18446744073709551615)) INT_LEAST8_MIN : constant := (-128); -- /usr/include/stdint.h:134 INT_LEAST16_MIN : constant := (-32767-1); -- /usr/include/stdint.h:135 INT_LEAST32_MIN : constant := (-2147483647-1); -- /usr/include/stdint.h:136 -- unsupported macro: INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) INT_LEAST8_MAX : constant := (127); -- /usr/include/stdint.h:139 INT_LEAST16_MAX : constant := (32767); -- /usr/include/stdint.h:140 INT_LEAST32_MAX : constant := (2147483647); -- /usr/include/stdint.h:141 -- unsupported macro: INT_LEAST64_MAX (__INT64_C(9223372036854775807)) UINT_LEAST8_MAX : constant := (255); -- /usr/include/stdint.h:145 UINT_LEAST16_MAX : constant := (65535); -- /usr/include/stdint.h:146 UINT_LEAST32_MAX : constant := (4294967295); -- /usr/include/stdint.h:147 -- unsupported macro: UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) INT_FAST8_MIN : constant := (-128); -- /usr/include/stdint.h:152 INT_FAST16_MIN : constant := (-9223372036854775807-1); -- /usr/include/stdint.h:154 INT_FAST32_MIN : constant := (-9223372036854775807-1); -- /usr/include/stdint.h:155 -- unsupported macro: INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) INT_FAST8_MAX : constant := (127); -- /usr/include/stdint.h:162 INT_FAST16_MAX : constant := (9223372036854775807); -- /usr/include/stdint.h:164 INT_FAST32_MAX : constant := (9223372036854775807); -- /usr/include/stdint.h:165 -- unsupported macro: INT_FAST64_MAX (__INT64_C(9223372036854775807)) UINT_FAST8_MAX : constant := (255); -- /usr/include/stdint.h:173 UINT_FAST16_MAX : constant := (18446744073709551615); -- /usr/include/stdint.h:175 UINT_FAST32_MAX : constant := (18446744073709551615); -- /usr/include/stdint.h:176 -- unsupported macro: UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) INTPTR_MIN : constant := (-9223372036854775807-1); -- /usr/include/stdint.h:186 INTPTR_MAX : constant := (9223372036854775807); -- /usr/include/stdint.h:187 UINTPTR_MAX : constant := (18446744073709551615); -- /usr/include/stdint.h:188 -- unsupported macro: INTMAX_MIN (-__INT64_C(9223372036854775807)-1) -- unsupported macro: INTMAX_MAX (__INT64_C(9223372036854775807)) -- unsupported macro: UINTMAX_MAX (__UINT64_C(18446744073709551615)) PTRDIFF_MIN : constant := (-9223372036854775807-1); -- /usr/include/stdint.h:209 PTRDIFF_MAX : constant := (9223372036854775807); -- /usr/include/stdint.h:210 SIG_ATOMIC_MIN : constant := (-2147483647-1); -- /usr/include/stdint.h:222 SIG_ATOMIC_MAX : constant := (2147483647); -- /usr/include/stdint.h:223 SIZE_MAX : constant := (18446744073709551615); -- /usr/include/stdint.h:227 -- unsupported macro: WCHAR_MIN __WCHAR_MIN -- unsupported macro: WCHAR_MAX __WCHAR_MAX WINT_MIN : constant := (0); -- /usr/include/stdint.h:244 WINT_MAX : constant := (4294967295); -- /usr/include/stdint.h:245 -- arg-macro: procedure INT8_C (c) -- c -- arg-macro: procedure INT16_C (c) -- c -- arg-macro: procedure INT32_C (c) -- c -- unsupported macro: INT64_C(c) c ## L -- arg-macro: procedure UINT8_C (c) -- c -- arg-macro: procedure UINT16_C (c) -- c -- unsupported macro: UINT32_C(c) c ## U -- unsupported macro: UINT64_C(c) c ## UL -- unsupported macro: INTMAX_C(c) c ## L -- unsupported macro: UINTMAX_C(c) c ## UL INT8_WIDTH : constant := 8; -- /usr/include/stdint.h:278 UINT8_WIDTH : constant := 8; -- /usr/include/stdint.h:279 INT16_WIDTH : constant := 16; -- /usr/include/stdint.h:280 UINT16_WIDTH : constant := 16; -- /usr/include/stdint.h:281 INT32_WIDTH : constant := 32; -- /usr/include/stdint.h:282 UINT32_WIDTH : constant := 32; -- /usr/include/stdint.h:283 INT64_WIDTH : constant := 64; -- /usr/include/stdint.h:284 UINT64_WIDTH : constant := 64; -- /usr/include/stdint.h:285 INT_LEAST8_WIDTH : constant := 8; -- /usr/include/stdint.h:287 UINT_LEAST8_WIDTH : constant := 8; -- /usr/include/stdint.h:288 INT_LEAST16_WIDTH : constant := 16; -- /usr/include/stdint.h:289 UINT_LEAST16_WIDTH : constant := 16; -- /usr/include/stdint.h:290 INT_LEAST32_WIDTH : constant := 32; -- /usr/include/stdint.h:291 UINT_LEAST32_WIDTH : constant := 32; -- /usr/include/stdint.h:292 INT_LEAST64_WIDTH : constant := 64; -- /usr/include/stdint.h:293 UINT_LEAST64_WIDTH : constant := 64; -- /usr/include/stdint.h:294 INT_FAST8_WIDTH : constant := 8; -- /usr/include/stdint.h:296 UINT_FAST8_WIDTH : constant := 8; -- /usr/include/stdint.h:297 -- unsupported macro: INT_FAST16_WIDTH __WORDSIZE -- unsupported macro: UINT_FAST16_WIDTH __WORDSIZE -- unsupported macro: INT_FAST32_WIDTH __WORDSIZE -- unsupported macro: UINT_FAST32_WIDTH __WORDSIZE INT_FAST64_WIDTH : constant := 64; -- /usr/include/stdint.h:302 UINT_FAST64_WIDTH : constant := 64; -- /usr/include/stdint.h:303 -- unsupported macro: INTPTR_WIDTH __WORDSIZE -- unsupported macro: UINTPTR_WIDTH __WORDSIZE INTMAX_WIDTH : constant := 64; -- /usr/include/stdint.h:308 UINTMAX_WIDTH : constant := 64; -- /usr/include/stdint.h:309 -- unsupported macro: PTRDIFF_WIDTH __WORDSIZE SIG_ATOMIC_WIDTH : constant := 32; -- /usr/include/stdint.h:312 -- unsupported macro: SIZE_WIDTH __WORDSIZE WCHAR_WIDTH : constant := 32; -- /usr/include/stdint.h:314 WINT_WIDTH : constant := 32; -- /usr/include/stdint.h:315 -- Copyright (C) 1997-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- * ISO C99: 7.18 Integer types <stdint.h> -- -- Exact integral types. -- Signed. -- Unsigned. -- Small types. -- Signed. subtype int_least8_t is bits_types_h.uu_int_least8_t; -- /usr/include/stdint.h:43 subtype int_least16_t is bits_types_h.uu_int_least16_t; -- /usr/include/stdint.h:44 subtype int_least32_t is bits_types_h.uu_int_least32_t; -- /usr/include/stdint.h:45 subtype int_least64_t is bits_types_h.uu_int_least64_t; -- /usr/include/stdint.h:46 -- Unsigned. subtype uint_least8_t is bits_types_h.uu_uint_least8_t; -- /usr/include/stdint.h:49 subtype uint_least16_t is bits_types_h.uu_uint_least16_t; -- /usr/include/stdint.h:50 subtype uint_least32_t is bits_types_h.uu_uint_least32_t; -- /usr/include/stdint.h:51 subtype uint_least64_t is bits_types_h.uu_uint_least64_t; -- /usr/include/stdint.h:52 -- Fast types. -- Signed. subtype int_fast8_t is signed_char; -- /usr/include/stdint.h:58 subtype int_fast16_t is long; -- /usr/include/stdint.h:60 subtype int_fast32_t is long; -- /usr/include/stdint.h:61 subtype int_fast64_t is long; -- /usr/include/stdint.h:62 -- Unsigned. subtype uint_fast8_t is unsigned_char; -- /usr/include/stdint.h:71 subtype uint_fast16_t is unsigned_long; -- /usr/include/stdint.h:73 subtype uint_fast32_t is unsigned_long; -- /usr/include/stdint.h:74 subtype uint_fast64_t is unsigned_long; -- /usr/include/stdint.h:75 -- Types for `void *' pointers. subtype intptr_t is long; -- /usr/include/stdint.h:87 subtype uintptr_t is unsigned_long; -- /usr/include/stdint.h:90 -- Largest integral types. subtype intmax_t is bits_types_h.uu_intmax_t; -- /usr/include/stdint.h:101 subtype uintmax_t is bits_types_h.uu_uintmax_t; -- /usr/include/stdint.h:102 -- Limits of integral types. -- Minimum of signed integral types. -- Maximum of signed integral types. -- Maximum of unsigned integral types. -- Minimum of signed integral types having a minimum size. -- Maximum of signed integral types having a minimum size. -- Maximum of unsigned integral types having a minimum size. -- Minimum of fast signed integral types having a minimum size. -- Maximum of fast signed integral types having a minimum size. -- Maximum of fast unsigned integral types having a minimum size. -- Values to test for integral types holding `void *' pointer. -- Minimum for largest signed integral type. -- Maximum for largest signed integral type. -- Maximum for largest unsigned integral type. -- Limits of other integer types. -- Limits of `ptrdiff_t' type. -- Limits of `sig_atomic_t'. -- Limit of `size_t' type. -- Limits of `wchar_t'. -- These constants might also be defined in <wchar.h>. -- Limits of `wint_t'. -- Signed. -- Unsigned. -- Maximal type. end stdint_h;
AdaCore/gpr
Ada
288
ads
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- package Gpr_Parser_Support with Pure is External_Name_Prefix : constant String := "gpr_parser_support__int__"; -- Prefix for explicit external names in Gpr_Parser_Support end Gpr_Parser_Support;
AdaCore/libadalang
Ada
572
adb
with System; use System; procedure Test is generic type T is private; package Pkg is function Foo return Boolean is (T'Scalar_Storage_Order = Low_Order_First); pragma Test_Statement_UID; type R is record C : T; end record; function Bar return Boolean is (R'Bit_Order = Low_Order_First); pragma Test_Statement_UID; function Baz return Boolean is (T'Scalar_Storage_Order = Standard'Default_Scalar_Storage_Order); pragma Test_Statement_UID; end Pkg; begin null; end Test;
reznikmm/matreshka
Ada
3,734
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Chart_Auto_Position_Attributes is pragma Preelaborate; type ODF_Chart_Auto_Position_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Chart_Auto_Position_Attribute_Access is access all ODF_Chart_Auto_Position_Attribute'Class with Storage_Size => 0; end ODF.DOM.Chart_Auto_Position_Attributes;
charlie5/cBound
Ada
1,645
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_pixel_mapusv_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; minor_opcode : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; context_tag : aliased xcb.xcb_glx_context_tag_t; map : aliased Interfaces.Unsigned_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapusv_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_pixel_mapusv_request_t.Item, Element_Array => xcb.xcb_glx_get_pixel_mapusv_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapusv_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_pixel_mapusv_request_t.Pointer, Element_Array => xcb.xcb_glx_get_pixel_mapusv_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_pixel_mapusv_request_t;
davidkristola/vole
Ada
30,192
adb
with Ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; with kv.avm.Log; use kv.avm.Log; with kv.avm.Symbol_Tables; with kv.avm.Instructions; with kv.avm.Registers; use kv.avm.Registers; package body kv.avm.Tree_Rewrite is ---------------------------------------------------------------------------- procedure Init (Self : in out Rewriter_Class) is begin null; end Init; ---------------------------------------------------------------------------- procedure Finalize (Self : in out Rewriter_Class) is begin null; end Finalize; ---------------------------------------------------------------------------- function Next_Temp(Self : access Rewriter_Class; Src_Line : Positive) return String is begin Self.Temp := Self.Temp + 1; declare Img : String := Natural'IMAGE(Self.Temp); Num : String := Positive'IMAGE(Src_Line); begin Img(1) := '#'; -- This replaces the leading space and creates a unique name that is not "legal" in Vole. Num(1) := '-'; return Img&"-line"&Num; end; end Next_Temp; ---------------------------------------------------------------------------- function Next_Block(Self : access Rewriter_Class) return String is begin Self.Block := Self.Block + 1; declare Img : String := Natural'IMAGE(Self.Block); begin Img(1) := ':'; -- This replaces the leading space and creates a unique name that is not "legal" in Vole. return Img; end; end Next_Block; ---------------------------------------------------------------------------- procedure Explore (Self : in out Rewriter_Class; Target : in Node_Base_Class'CLASS; Depth : in Natural) is Child : Node_Pointer; Next : Node_Pointer; PID : constant Positive := Target.Get_ID; PIDI : constant String := Positive'IMAGE(PID); begin for Association in Child_Association_Type loop Child := Target.Get_Association(Association); if Child /= null then Child.Set(My_Parent, Target.Get_Association(My_Self)); -- Link parents Child.Visit(Self'ACCESS, Depth+1); end if; end loop; Next := Target.Get_Association(My_Next); if Next /= null then Next.Set(My_Parent, Target.Get_Association(My_Parent)); -- Link parents Next.Visit(Self'ACCESS, Depth); end if; end Explore; ---------------------------------------------------------------------------- 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; begin Put_Line(" Symbol: " & Name & ", index " & Natural'IMAGE(Indx) & " of " & kv.avm.Registers.Data_Kind'IMAGE(Kind) & Default); end Print_Symbol; ---------------------------------------------------------------------------- procedure Add_To_Message_Symbol_Table (Target : in out Node_Base_Class'CLASS; Name : in String; Local : in Boolean) is My_Message : Node_Pointer; Table : access kv.avm.Symbol_Tables.Symbol_Table; Table_Flavor : constant array (Boolean) of String(1..6) := (false => "inputs", true => "locals"); Kind : kv.avm.Registers.Data_Kind := Target.Get_Kind; Kind_Node : Node_Pointer; begin My_Message := Message_Of(Target); Table := Message_Definition_Class(My_Message.all).Get_Symbol_Table(Local); if Kind = Unset then -- Try to figre it out Kind_Node := Target.Get_Association(My_Kind); if Kind_Node /= null then Kind := Kind_Node_Class(Kind_Node.all).Get_Kind; end if; end if; Table.Add(Name, Kind); --Put_Line("Just added '" & Name & "' to the message symbol table " & Table_Flavor(Local)); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Add_To_Message_Symbol_Table('" & Name & "', " & Boolean'IMAGE(Local) & "), line " & Positive'IMAGE(Target.Get_Line)); raise; end Add_To_Message_Symbol_Table; ---------------------------------------------------------------------------- function Actor_Symbol_Already_Defined (Target : in Node_Base_Class'CLASS; Name : in String; Attr : in Boolean) return Boolean is My_Actor : Node_Pointer; Table : access kv.avm.Symbol_Tables.Symbol_Table; begin My_Actor := Actor_Of(Target); Table := Actor_Definition_Class(My_Actor.all).Get_Symbol_Table(Attr); return Table.Has(Name); end Actor_Symbol_Already_Defined; ---------------------------------------------------------------------------- procedure Add_To_Actor_Symbol_Table (Target : in out Node_Base_Class'CLASS; Name : in String; Attr : in Boolean; Init : in String := ""; As_Kind : in kv.avm.Registers.Data_Kind := kv.avm.Registers.Unset) is My_Actor : Node_Pointer; Table : access kv.avm.Symbol_Tables.Symbol_Table; Table_Flavor : constant array (Boolean) of String(1..9) := (false => "constant ", true => "attribute"); Kind : kv.avm.Registers.Data_Kind := Target.Get_Kind; Kind_Node : Node_Pointer; begin if As_Kind /= Unset then Kind := As_Kind; end if; My_Actor := Actor_Of(Target); Table := Actor_Definition_Class(My_Actor.all).Get_Symbol_Table(Attr); if Kind = Unset then -- Try to figre it out Kind_Node := Target.Get_Association(My_Kind); if Kind_Node /= null then Kind := Kind_Node_Class(Kind_Node.all).Get_Kind; end if; end if; if not Table.Has(Name) then Table.Add(Name, Kind, Init); end if; --Put_Line("Just added '" & Name & "' to the actor symbol table " & Table_Flavor(Attr)); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Add_To_Actor_Symbol_Table('" & Name & "', " & Boolean'IMAGE(Attr) & ", '" & Init & "', " & kv.avm.Registers.Data_Kind'IMAGE(As_Kind) & "), line " & Positive'IMAGE(Target.Get_Line)); raise; end Add_To_Actor_Symbol_Table; ---------------------------------------------------------------------------- procedure Visit_Id (Self : in out Rewriter_Class; Target : in out Id_Node_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Id, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Actor_Definition (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Table : access kv.avm.Symbol_Tables.Symbol_Table; Actor_Node : Actor_Definition_Class; Super_Name_Node : Node_Pointer; Super_Node : Node_Pointer; Superclass : Actor_Definition_Pointer; Super_Symbols : kv.avm.Symbol_Tables.Symbol_Table_Access; Extend_Symbols : kv.avm.Symbol_Tables.Symbol_Table_Access; begin Explore(Self, Target, Depth); Actor_Node := Actor_Definition_Class(Target); Super_Name_Node := Actor_Node.Get_Super_Class; -- See if we are a subclass if Super_Name_Node /= null then Put_Line("Actor " & Actor_Node.Get_Name & " is a subclass of " & Super_Name_Node.Get_Name); -- Find the superclass name Super_Node := Find_Actor(Super_Name_Node.Get_Name); Superclass := Actor_Definition_Pointer(Super_Node); for Is_Const in Boolean loop Super_Symbols := kv.avm.Symbol_Tables.Symbol_Table_Access(Superclass.Get_Symbol_Table(Is_Const)); Extend_Symbols := kv.avm.Symbol_Tables.Symbol_Table_Access(Actor_Node.Get_Symbol_Table(Is_Const)); Extend_Symbols.Link_Superclass_Table(Super_Symbols); Extend_Symbols.Set_All_Indexes(Super_Symbols.Count); end loop; end if; Put_Line("Actor " & Actor_Node.Get_Name & " attributes:"); Table := Actor_Node.Get_Symbol_Table(VARIABLE_SYMBOLS); Table.For_Each(Print_Symbol'ACCESS); Put_Line("Actor " & Actor_Node.Get_Name & " constant:"); Table := Actor_Node.Get_Symbol_Table(CONSTANT_SYMBOLS); Table.For_Each(Print_Symbol'ACCESS); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Actor_Definition, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Attribute_Definition (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin --Put_Line("Just added attribute '" & Target.Get_Name & "' to the actor symbol table."); Add_To_Actor_Symbol_Table(Target, Target.Get_Name, Attr => True); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Attribute_Definition, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Message_Definition (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Table : access kv.avm.Symbol_Tables.Symbol_Table; begin Explore(Self, Target, Depth); Put_Line("Message " & Target.Get_Name & " inputs:"); Table := Message_Definition_Class(Target).Get_Symbol_Table(False); Table.For_Each(Print_Symbol'ACCESS); Put_Line("Message " & Target.Get_Name & " locals:"); Table := Message_Definition_Class(Target).Get_Symbol_Table(True); Table.For_Each(Print_Symbol'ACCESS); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Message_Definition, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Kind_Node (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Kind_Node, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Argument (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Association : constant Association_Type := Association_Of(Target); begin Add_To_Message_Symbol_Table(Target, Target.Get_Name, Local => (Association = My_Outputs)); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Argument, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- function Get_Argument_List(Node : Node_Pointer) return String is begin if Node = null then return ""; end if; return " " & Resolve_Register(Node.all) & Get_Argument_List(Node.Get_Association(My_Next)); end Get_Argument_List; ---------------------------------------------------------------------------- procedure Add_Folded_Arguments_Node (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS) is Arguments : Node_Pointer := Target.Get_Association(My_Arguments); Argument_Init : constant String := Get_Argument_List(Arguments); Fold : Node_Pointer; Temp_Tuple_Name : constant String := Self.Next_Temp(Target.Get_Line); Tuple_Map_Name : constant String := Self.Next_Temp(Target.Get_Line); begin Build_Fold(Fold, Target.Get_Line, Arguments); declare E : access Expression_Fold_Class := Expression_Fold_Class(Fold.all)'ACCESS; begin E.Set_Temp_Name(Temp_Tuple_Name); E.Set_Tuple_Map_Name(Tuple_Map_Name); E.Set_Tuple_Map_Init(Argument_Init); end; Add_To_Message_Symbol_Table(Target, Temp_Tuple_Name, Local => True); Add_To_Actor_Symbol_Table(Target, Tuple_Map_Name, Attr => False, Init => "[" & Argument_Init & "]", As_Kind => kv.avm.Registers.Tuple_Map); Fold.Set(My_Parent, Target.Get_Association(My_Self)); if Arguments /= null then Arguments.Set(My_Parent, Fold); end if; Target.Set(My_Arguments, Fold); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Add_Folded_Arguments_Node, line " & Positive'IMAGE(Target.Get_Line)); raise; end Add_Folded_Arguments_Node; ---------------------------------------------------------------------------- procedure Visit_Constructor_Send_Node (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is My_Actor : Node_Pointer; Table : access kv.avm.Symbol_Tables.Symbol_Table; begin Explore(Self, Target, Depth); My_Actor := Actor_Of(Target); Table := Actor_Definition_Class(My_Actor.all).Get_Symbol_Table(False); declare Name : constant String := Target.Get_Association(My_Destination).Get_Name; begin Add_To_Actor_Symbol_Table(Target, Name, False, '"' & Name & '"'); Table.Set_Kind(Name, Actor_Definition); end; Add_Folded_Arguments_Node(Self, Target); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Constructor_Send_Node, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Expression_List (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_List_Class := Expression_List_Class(Target)'ACCESS; Name : constant String := Self.Next_Temp(Target.Get_Line); begin E.Set_Temp_Name(Name); E.Set_Kind(Tuple); Add_To_Message_Symbol_Table(Target, Name, Local => True); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Expression_List, line " & Positive'IMAGE(Target.Get_Line)); raise; end; type Operator_Processing_Type is (Int_Float_Bool_To_Same, Bool_To_Same, Bool_To_Bool, Int_Float_Bool_To_Bool, Inf_Float_Bool_Actor_To_Bool, Float_To_Same, Int_To_Same); Operator_Processing : constant array (kv.avm.Instructions.Operation_Type) of Operator_Processing_Type := (kv.avm.Instructions.Add => Int_Float_Bool_To_Same, kv.avm.Instructions.Sub => Int_Float_Bool_To_Same, kv.avm.Instructions.Mul => Int_Float_Bool_To_Same, kv.avm.Instructions.Div => Int_Float_Bool_To_Same, kv.avm.Instructions.Modulo => Int_Float_Bool_To_Same, kv.avm.Instructions.Exp => Float_To_Same, kv.avm.Instructions.Negate => Bool_To_Bool, kv.avm.Instructions.Op_Pos => Int_Float_Bool_To_Same, kv.avm.Instructions.Op_Neg => Int_Float_Bool_To_Same, kv.avm.Instructions.Eq => Inf_Float_Bool_Actor_To_Bool, kv.avm.Instructions.Neq => Inf_Float_Bool_Actor_To_Bool, kv.avm.Instructions.L_t => Int_Float_Bool_To_Bool, kv.avm.Instructions.Lte => Int_Float_Bool_To_Bool, kv.avm.Instructions.G_t => Int_Float_Bool_To_Bool, kv.avm.Instructions.Gte => Int_Float_Bool_To_Bool, kv.avm.Instructions.Shift_Left => Int_To_Same, kv.avm.Instructions.Shift_Right => Int_To_Same, kv.avm.Instructions.B_And => Bool_To_Bool, kv.avm.Instructions.B_Or => Bool_To_Bool, kv.avm.Instructions.B_Xor => Bool_To_Bool); ---------------------------------------------------------------------------- procedure Visit_Expression_Op (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_Op_Class := Expression_Op_Class(Target)'ACCESS; Name : constant String := Self.Next_Temp(Target.Get_Line); Operator : kv.avm.Instructions.Operation_Type; Resulting_Kind : kv.avm.Registers.Data_Kind; begin E.Set_Temp_Name(Name); Explore(Self, Target, Depth); Operator := E.Get_Op; case Operator_Processing(Operator) is when Bool_To_Bool | Int_Float_Bool_To_Bool | Inf_Float_Bool_Actor_To_Bool => Resulting_Kind := Bit_Or_Boolean; when others => Resulting_Kind := Target.Get_Association(My_Right).Get_Kind; end case; --Put_Line(">> Setting " & Name & "'s kind to " & kv.avm.Registers.Data_Kind'IMAGE(Resulting_Kind)); Target.Set_Kind(Resulting_Kind); Add_To_Message_Symbol_Table(Target, Name, Local => True); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Expression_Op, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Var (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_Var_Class := Expression_Var_Class(Target)'ACCESS; Table : access kv.avm.Symbol_Tables.Symbol_Table; Parent : Node_Pointer; begin -- Look up the variable and copy its kind. -- if E.Get_Is_Self then -- look up in the actor's symbol tables Parent := Actor_Of(Target); Table := Actor_Definition_Class(Parent.all).Get_Symbol_Table(True); if Table.Has(Target.Get_Name) then Target.Set_Kind(Table.Get_Kind(Target.Get_Name)); else Table := Actor_Definition_Class(Parent.all).Get_Symbol_Table(False); if Table.Has(Target.Get_Name) then Target.Set_Kind(Table.Get_Kind(Target.Get_Name)); else Put_Line("*** Visit_Expression_Var could not set kind for attribute " & Target.Get_Name); end if; end if; else -- look up in the message's symbol tables Parent := Message_Of(Target); Table := Message_Definition_Class(Parent.all).Get_Symbol_Table(True); if Table.Has(Target.Get_Name) then Target.Set_Kind(Table.Get_Kind(Target.Get_Name)); else Table := Message_Definition_Class(Parent.all).Get_Symbol_Table(False); if Table.Has(Target.Get_Name) then Target.Set_Kind(Table.Get_Kind(Target.Get_Name)); else Put_Line("*** Visit_Expression_Var could not set kind for local " & Target.Get_Name); end if; end if; end if; Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Expression_Var, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Literal (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_Literal_Class := Expression_Literal_Class(Target)'ACCESS; Name : constant String := Self.Next_Temp(Target.Get_Line); begin E.Set_Temp_Name(Name); Explore(Self, Target, Depth); Add_To_Actor_Symbol_Table(Target, Name, False, E.Get_Value); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Expression_Literal, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Send (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is E : access Expression_Call_Class := Expression_Call_Class(Target)'ACCESS; Name : constant String := Self.Next_Temp(Target.Get_Line); begin E.Set_Temp_Name(Name); E.Set_Kind(Tuple); Add_To_Message_Symbol_Table(Target, Name, Local => True); Explore(Self, Target, Depth); declare Name : constant String := Target.Get_Association(My_Name).Get_Name; begin if not Actor_Symbol_Already_Defined(Target, Name, False) then Add_To_Actor_Symbol_Table(Target, Name, False, '"' & Name & '"', Message_Definition); end if; end; Add_Folded_Arguments_Node(Self, Target); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Expression_Send, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Expression_Fold (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Expression_Fold, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_List (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_List, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Assign (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); --!@#$ check kind exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_Assign, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Var_Def (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Add_To_Message_Symbol_Table(Target, Target.Get_Name, Local => True); --!@#$ if there is an init, strip it off and make a set node Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_Var_Def, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Emit (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_Emit, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Return (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is Child : Node_Pointer; E : access Expression_Call_Class; S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin --!@#$ this is a place to insert a FOLD statement if the number of arguments being retunr > 1 S.Set_Block_Name(Self.Next_Block); -- Check if this is a tail call. Child := Target.Get_Association(MY_VALUE); if Child /= null and then Child.all in Expression_Call_Class'CLASS then E := Expression_Call_Class(Child.all)'ACCESS; E.Set_Tail(True); end if; Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_Return, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_If (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_If, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Assert (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_Assert, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_Send (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); declare Name : constant String := Target.Get_Association(My_Name).Get_Name; begin if not Actor_Symbol_Already_Defined(Target, Name, False) then Add_To_Actor_Symbol_Table(Target, Name, False, '"' & Name & '"', Message_Definition); end if; end; Add_Folded_Arguments_Node(Self, Target); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_Send, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Statement_While (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is S : access Statement_List_Class := Statement_List_Class(Target)'ACCESS; begin S.Set_Block_Name(Self.Next_Block); Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Statement_While, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Program (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Program, line " & Positive'IMAGE(Target.Get_Line)); raise; end; ---------------------------------------------------------------------------- procedure Visit_Unimp (Self : in out Rewriter_Class; Target : in out Node_Base_Class'CLASS; Depth : in Natural) is begin Explore(Self, Target, Depth); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Rewrite.Visit_Unimp, line " & Positive'IMAGE(Target.Get_Line)); raise; end; end kv.avm.Tree_Rewrite;
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.Draw_Dots2_Length_Attributes; package Matreshka.ODF_Draw.Dots2_Length_Attributes is type Draw_Dots2_Length_Attribute_Node is new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node and ODF.DOM.Draw_Dots2_Length_Attributes.ODF_Draw_Dots2_Length_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Dots2_Length_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Dots2_Length_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Draw.Dots2_Length_Attributes;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
14,385
ads
-- This spec has been automatically generated from STM32F072x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.GPIO is pragma Preelaborate; --------------- -- Registers -- --------------- -- MODER array element subtype MODER_Element is STM32_SVD.UInt2; -- MODER array type MODER_Field_Array is array (0 .. 15) of MODER_Element with Component_Size => 2, Size => 32; -- GPIO port mode register type MODER_Register (As_Array : Boolean := False) is record case As_Array is when False => -- MODER as a value Val : STM32_SVD.UInt32; when True => -- MODER as an array Arr : MODER_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MODER_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- OTYPER_OT array element subtype OTYPER_OT_Element is STM32_SVD.Bit; -- OTYPER_OT array type OTYPER_OT_Field_Array is array (0 .. 15) of OTYPER_OT_Element with Component_Size => 1, Size => 16; -- Type definition for OTYPER_OT type OTYPER_OT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- OT as a value Val : STM32_SVD.UInt16; when True => -- OT as an array Arr : OTYPER_OT_Field_Array; end case; end record with Unchecked_Union, Size => 16; for OTYPER_OT_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port output type register type OTYPER_Register is record -- Port x configuration bits (y = 0..15) OT : OTYPER_OT_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OTYPER_Register use record OT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- OSPEEDR array element subtype OSPEEDR_Element is STM32_SVD.UInt2; -- OSPEEDR array type OSPEEDR_Field_Array is array (0 .. 15) of OSPEEDR_Element with Component_Size => 2, Size => 32; -- GPIO port output speed register type OSPEEDR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- OSPEEDR as a value Val : STM32_SVD.UInt32; when True => -- OSPEEDR as an array Arr : OSPEEDR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for OSPEEDR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- PUPDR array element subtype PUPDR_Element is STM32_SVD.UInt2; -- PUPDR array type PUPDR_Field_Array is array (0 .. 15) of PUPDR_Element with Component_Size => 2, Size => 32; -- GPIO port pull-up/pull-down register type PUPDR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- PUPDR as a value Val : STM32_SVD.UInt32; when True => -- PUPDR as an array Arr : PUPDR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for PUPDR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- IDR array element subtype IDR_Element is STM32_SVD.Bit; -- IDR array type IDR_Field_Array is array (0 .. 15) of IDR_Element with Component_Size => 1, Size => 16; -- Type definition for IDR type IDR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- IDR as a value Val : STM32_SVD.UInt16; when True => -- IDR as an array Arr : IDR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for IDR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port input data register type IDR_Register is record -- Read-only. Port input data (y = 0..15) IDR : IDR_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IDR_Register use record IDR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- ODR array element subtype ODR_Element is STM32_SVD.Bit; -- ODR array type ODR_Field_Array is array (0 .. 15) of ODR_Element with Component_Size => 1, Size => 16; -- Type definition for ODR type ODR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- ODR as a value Val : STM32_SVD.UInt16; when True => -- ODR as an array Arr : ODR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for ODR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port output data register type ODR_Register is record -- Port output data (y = 0..15) ODR : ODR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ODR_Register use record ODR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- BSRR_BS array element subtype BSRR_BS_Element is STM32_SVD.Bit; -- BSRR_BS array type BSRR_BS_Field_Array is array (0 .. 15) of BSRR_BS_Element with Component_Size => 1, Size => 16; -- Type definition for BSRR_BS type BSRR_BS_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BS as a value Val : STM32_SVD.UInt16; when True => -- BS as an array Arr : BSRR_BS_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BSRR_BS_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- BSRR_BR array element subtype BSRR_BR_Element is STM32_SVD.Bit; -- BSRR_BR array type BSRR_BR_Field_Array is array (0 .. 15) of BSRR_BR_Element with Component_Size => 1, Size => 16; -- Type definition for BSRR_BR type BSRR_BR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BR as a value Val : STM32_SVD.UInt16; when True => -- BR as an array Arr : BSRR_BR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BSRR_BR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port bit set/reset register type BSRR_Register is record -- Write-only. Port x set bit y (y= 0..15) BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#); -- Write-only. Port x set bit y (y= 0..15) BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BSRR_Register use record BS at 0 range 0 .. 15; BR at 0 range 16 .. 31; end record; -- LCKR_LCK array element subtype LCKR_LCK_Element is STM32_SVD.Bit; -- LCKR_LCK array type LCKR_LCK_Field_Array is array (0 .. 15) of LCKR_LCK_Element with Component_Size => 1, Size => 16; -- Type definition for LCKR_LCK type LCKR_LCK_Field (As_Array : Boolean := False) is record case As_Array is when False => -- LCK as a value Val : STM32_SVD.UInt16; when True => -- LCK as an array Arr : LCKR_LCK_Field_Array; end case; end record with Unchecked_Union, Size => 16; for LCKR_LCK_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; subtype LCKR_LCKK_Field is STM32_SVD.Bit; -- GPIO port configuration lock register type LCKR_Register is record -- Port x lock bit y (y= 0..15) LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#); -- Port x lock bit y (y= 0..15) LCKK : LCKR_LCKK_Field := 16#0#; -- unspecified Reserved_17_31 : STM32_SVD.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for LCKR_Register use record LCK at 0 range 0 .. 15; LCKK at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- AFRL array element subtype AFRL_Element is STM32_SVD.UInt4; -- AFRL array type AFRL_Field_Array is array (0 .. 7) of AFRL_Element with Component_Size => 4, Size => 32; -- GPIO alternate function low register type AFRL_Register (As_Array : Boolean := False) is record case As_Array is when False => -- AFRL as a value Val : STM32_SVD.UInt32; when True => -- AFRL as an array Arr : AFRL_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for AFRL_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- AFRH array element subtype AFRH_Element is STM32_SVD.UInt4; -- AFRH array type AFRH_Field_Array is array (8 .. 15) of AFRH_Element with Component_Size => 4, Size => 32; -- GPIO alternate function high register type AFRH_Register (As_Array : Boolean := False) is record case As_Array is when False => -- AFRH as a value Val : STM32_SVD.UInt32; when True => -- AFRH as an array Arr : AFRH_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for AFRH_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- BRR_BR array element subtype BRR_BR_Element is STM32_SVD.Bit; -- BRR_BR array type BRR_BR_Field_Array is array (0 .. 15) of BRR_BR_Element with Component_Size => 1, Size => 16; -- Type definition for BRR_BR type BRR_BR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BR as a value Val : STM32_SVD.UInt16; when True => -- BR as an array Arr : BRR_BR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BRR_BR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- Port bit reset register type BRR_Register is record -- Write-only. Port x Reset bit y BR : BRR_BR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BRR_Register use record BR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- General-purpose I/Os type GPIO_Peripheral is record -- GPIO port mode register MODER : aliased MODER_Register; -- GPIO port output type register OTYPER : aliased OTYPER_Register; -- GPIO port output speed register OSPEEDR : aliased OSPEEDR_Register; -- GPIO port pull-up/pull-down register PUPDR : aliased PUPDR_Register; -- GPIO port input data register IDR : aliased IDR_Register; -- GPIO port output data register ODR : aliased ODR_Register; -- GPIO port bit set/reset register BSRR : aliased BSRR_Register; -- GPIO port configuration lock register LCKR : aliased LCKR_Register; -- GPIO alternate function low register AFRL : aliased AFRL_Register; -- GPIO alternate function high register AFRH : aliased AFRH_Register; -- Port bit reset register BRR : aliased BRR_Register; end record with Volatile; for GPIO_Peripheral use record MODER at 16#0# range 0 .. 31; OTYPER at 16#4# range 0 .. 31; OSPEEDR at 16#8# range 0 .. 31; PUPDR at 16#C# range 0 .. 31; IDR at 16#10# range 0 .. 31; ODR at 16#14# range 0 .. 31; BSRR at 16#18# range 0 .. 31; LCKR at 16#1C# range 0 .. 31; AFRL at 16#20# range 0 .. 31; AFRH at 16#24# range 0 .. 31; BRR at 16#28# range 0 .. 31; end record; -- General-purpose I/Os GPIOA_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000000#); -- General-purpose I/Os GPIOB_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000400#); -- General-purpose I/Os GPIOC_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000800#); -- General-purpose I/Os GPIOD_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000C00#); -- General-purpose I/Os GPIOE_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48001000#); -- General-purpose I/Os GPIOF_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48001400#); end STM32_SVD.GPIO;
ZinebZaad/ENSEEIHT
Ada
671
adb
with Ada.Text_IO; use Ada.Text_IO; -- Permuter deux caractères lus au clavier procedure Permuter_Caracteres is C1, C2: Character; -- Entier lu au clavier dont on veut connaître le signe Temp: Character; -- Charactere utilisé pour la permutation begin -- Demander les deux caractères C1 et C2 Get (C1); Skip_Line; Get (C2); Skip_Line; -- Afficher C1 Put_Line ("C1 = '" & C1 & "'"); -- Afficher C2 Put_Line ("C2 = '" & C2 & "'"); -- Permuter C1 et C2 Temp := C1; C1 := C2; C2 := Temp; -- Afficher C1 Put_Line ("C1 = '" & C1 & "'"); -- Afficher C2 Put_Line ("C2 = '" & C2 & "'"); end Permuter_Caracteres;
charlie5/cBound
Ada
1,359
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with xcb.xcb_render_pointfix_t; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_render_linefix_t is -- Item -- type Item is record p1 : aliased xcb.xcb_render_pointfix_t.Item; p2 : aliased xcb.xcb_render_pointfix_t.Item; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_linefix_t.Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_linefix_t.Item, Element_Array => xcb.xcb_render_linefix_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_linefix_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_linefix_t.Pointer, Element_Array => xcb.xcb_render_linefix_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_render_linefix_t;
AdaCore/libadalang
Ada
145
adb
procedure Test_Decl_Expr is A : Integer := (declare B : Integer := 12; begin B); pragma Test_Statement; begin null; end Test_Decl_Expr;