repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
mgrojo/bingada
Ada
928
ads
--***************************************************************************** --* --* PROJECT: BingAda --* --* FILE: q_csv-q_read_file.ads --* --* AUTHOR: Javier Fuica Fernandez --* --***************************************************************************** with Ada.Containers.Vectors; with Q_Bingo; package Q_Csv.Q_Read_File is C_Max_Card_Name : constant := 5; subtype T_Name is String (1 .. C_Max_Card_Name); C_Numbers_In_A_Card : constant := 15; type T_Numbers is array (1 .. C_Numbers_In_A_Card) of Q_Bingo.T_Number; type T_Card is record R_Name : T_Name; R_Numbers : T_Numbers; end record; package Q_Bingo_Cards is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => T_Card); procedure P_Read_Bingo_Cards (V_File_Name : String; V_Cards : out Q_Bingo_Cards.Vector); end Q_Csv.Q_Read_File;
alvaromb/Compilemon
Ada
14,049
ads
-- UNIT: generic package spec of VSTRINGS -- -- FILES: vstring_spec.a in publiclib -- related file is vstring_body.a in publiclib -- -- PURPOSE: An implementation of the abstract data type "variable-length -- string." -- -- DESCRIPTION: This package provides a private type VSTRING. VSTRING objects -- are "strings" that have a length between zero and LAST, where -- LAST is the generic parameter supplied in the package -- instantiation. -- -- In addition to the type VSTRING, a subtype and two constants -- are declared. The subtype STRINDEX is an index to a VSTRING, -- The STRINDEX constant FIRST is an index to the first character -- of the string, and the VSTRING constant NUL is a VSTRING of -- length zero. NUL is the default initial value of a VSTRING. -- -- The following sets of functions, procedures, and operators -- are provided as operations on the type VSTRING: -- -- ATTRIBUTE FUNCTIONS: LEN, MAX, STR, CHAR -- The attribute functions return the characteristics of -- a VSTRING. -- -- COMPARISON OPERATORS: "=", "/=", "<", ">", "<=", ">=" -- The comparison operators are the same as for the predefined -- type STRING. -- -- INPUT/OUTPUT PROCEDURES: GET, GET_LINE, PUT, PUT_LINE -- -- The input/output procedures are similar to those for the -- predefined type STRING, with the following exceptions: -- -- - GET has an optional parameter LENGTH, which indicates -- the number of characters to get (default is LAST). -- -- - GET_LINE does not have a parameter to return the length -- of the string (the LEN function should be used instead). -- -- EXTRACTION FUNCTIONS: SLICE, SUBSTR, DELETE -- The SLICE function returns the slice of a VSTRING between -- two indices (equivalent to STR(X)(A .. B)). -- -- SUBSTR returns a substring of a VSTRING taken from a given -- index and extending a given length. -- -- The DELETE function returns the VSTRING which results from -- removing the slice between two indices. -- -- EDITING FUNCTIONS: INSERT, APPEND, REPLACE -- The editing functions return the VSTRING which results from -- inserting, appending, or replacing at a given index with a -- VSTRING, STRING, or CHARACTER. The index must be in the -- current range of the VSTRING; i.e., zero cannot be used. -- -- CONCATENATION OPERATOR: "&" -- The concatenation operator is the same as for the type -- STRING. It should be used instead of APPEND when the -- APPEND would always be after the last character. -- -- POSITION FUNCTIONS: INDEX, RINDEX -- The position functions return an index to the Nth occurrence -- of a VSTRING, STRING, or CHARACTER from the front or back -- of a VSTRING. Zero is returned if the search is not -- successful. -- -- CONVERSION FUNCTIONS AND OPERATOR: VSTR, CONVERT, "+" -- VSTR converts a STRING or a CHARACTER to a VSTRING. -- -- CONVERT is a generic function which can be instantiated to -- convert from any given variable-length string to another, -- provided the FROM type has a function equivelent to STR -- defined for it, and that the TO type has a function equiv- -- elent to VSTR defined for it. This provides a means for -- converting between VSTRINGs declared in separate instant- -- iations of VSTRINGS. When instantiating CONVERT for -- VSTRINGs, the STR and VSTR functions are implicitly defined, -- provided that they have been made visible (by a use clause). -- -- Note: CONVERT is NOT implicitly associated with the type -- VSTRING declared in this package (since it would not be a -- derivable function (see RM 3.4(11))). -- -- Caution: CONVERT cannot be instantiated directly with the -- names VSTR and STR, since the name of the subprogram being -- declared would hide the generic parameters with the same -- names (see RM 8.3(16)). CONVERT can be instantiated with -- the operator "+", and any instantiation of CONVERT can -- subsequently be renamed VSTR or STR. -- -- Example: Given two VSTRINGS instantiations X and Y: -- function "+" is new X.CONVERT(X.VSTRING, Y.VSTRING); -- function "+" is new X.CONVERT(Y.VSTRING, X.VSTRING); -- -- (Y.CONVERT could have been used in place of X.CONVERT) -- -- function VSTR(A : X.VSTRING) return Y.VSTRING renames "+"; -- function VSTR(A : Y.VSTRING) return X.VSTRING renames "+"; -- -- "+" is equivelent to VSTR. It is supplied as a short-hand -- notation for the function. The "+" operator cannot immed- -- iately follow the "&" operator; use ... & (+ ...) instead. pragma PAGE; -- DISCUSSION: -- -- This package implements the type "variable-length string" (vstring) -- using generics. The alternative approaches are to use a discriminant -- record in which the discriminant controls the length of a STRING inside -- the record, or a record containing an access type which points to a -- string, which can be deallocated and reallocated when necessary. -- -- Advantages of this package: -- * The other approaches force the vstring to be a limited private -- type. Thus, their vstrings cannot appear on the left side of -- the assignment operator; ie., their vstrings cannot be given -- initial values or values by direct assignment. This package -- uses a private type; therefore, these things can be done. -- -- * The other approach stores the vstring in a string whose length -- is determined dynamically. This package uses a fixed length -- string. This difference might be reflected in faster and more -- consistent execution times (this has NOT been verified). -- -- Disadvantages of this package: -- * Different instantiations must be used to declare vstrings with -- different maximum lengths (this may be desirable, since -- CONSTRAINT_ERROR will be raised if the maximum is exceeded). -- -- * A second declaration is required to give the type declared by -- the instantiation a name other than "VSTRING." -- -- * The storage required for a vstring is determined by the generic -- parameter LAST and not the actual length of its contents. Thus, -- each object is allocated the maximum amount of storage, regardless -- of its actual size. -- -- MISCELLANEOUS: -- Constraint checking is done explicitly in the code; thus, it cannot -- be suppressed. On the other hand, constraint checking is not lost -- if pragma suppress is supplied to the compilation (-S option) -- (The robustness of the explicit constraint checking has NOT been -- determined). -- -- Compiling with the optimizer (-O option) may significantly reduce -- the size (and possibly execution time) of the resulting executable. -- -- Compiling an instantiation of VSTRINGS is roughly equivelent to -- recompiling VSTRINGS. Since this takes a significant amount of time, -- and the instantiation does not depend on any other library units, -- it is STRONGLY recommended that the instantiation be compiled -- separately, and thus done only ONCE. -- -- USAGE: with VSTRINGS; -- package package_name is new VSTRINGS(maximum_length); -- .......................................................................... -- pragma PAGE; with text_io; use text_io; generic LAST : NATURAL; package vstrings is subtype STRINDEX is NATURAL; FIRST : constant STRINDEX := STRINDEX'FIRST + 1; type VSTRING is private; NUL : constant VSTRING; -- Attributes of a VSTRING function LEN(FROM : VSTRING) return STRINDEX; function MAX(FROM : VSTRING) return STRINDEX; function STR(FROM : VSTRING) return STRING; function CHAR(FROM: VSTRING; POSITION : STRINDEX := FIRST) return CHARACTER; -- Comparisons function "<" (LEFT: VSTRING; RIGHT: VSTRING) return BOOLEAN; function ">" (LEFT: VSTRING; RIGHT: VSTRING) return BOOLEAN; function "<=" (LEFT: VSTRING; RIGHT: VSTRING) return BOOLEAN; function ">=" (LEFT: VSTRING; RIGHT: VSTRING) return BOOLEAN; -- "=" and "/=" are predefined -- Input/Output procedure PUT(FILE : in FILE_TYPE; ITEM : in VSTRING); procedure PUT(ITEM : in VSTRING); procedure PUT_LINE(FILE : in FILE_TYPE; ITEM : in VSTRING); procedure PUT_LINE(ITEM : in VSTRING); procedure GET(FILE : in FILE_TYPE; ITEM : out VSTRING; LENGTH : in STRINDEX := LAST); procedure GET(ITEM : out VSTRING; LENGTH : in STRINDEX := LAST); procedure GET_LINE(FILE : in FILE_TYPE; ITEM : in out VSTRING); procedure GET_LINE(ITEM : in out VSTRING); -- Extraction function SLICE(FROM: VSTRING; FRONT, BACK : STRINDEX) return VSTRING; function SUBSTR(FROM: VSTRING; START, LENGTH: STRINDEX) return VSTRING; function DELETE(FROM: VSTRING; FRONT, BACK : STRINDEX) return VSTRING; -- Editing function INSERT(TARGET: VSTRING; ITEM: VSTRING; POSITION: STRINDEX := FIRST) return VSTRING; function INSERT(TARGET: VSTRING; ITEM: STRING; POSITION: STRINDEX := FIRST) return VSTRING; function INSERT(TARGET: VSTRING; ITEM: CHARACTER; POSITION: STRINDEX := FIRST) return VSTRING; function APPEND(TARGET: VSTRING; ITEM: VSTRING; POSITION: STRINDEX) return VSTRING; function APPEND(TARGET: VSTRING; ITEM: STRING; POSITION: STRINDEX) return VSTRING; function APPEND(TARGET: VSTRING; ITEM: CHARACTER; POSITION: STRINDEX) return VSTRING; function APPEND(TARGET: VSTRING; ITEM: VSTRING) return VSTRING; function APPEND(TARGET: VSTRING; ITEM: STRING) return VSTRING; function APPEND(TARGET: VSTRING; ITEM: CHARACTER) return VSTRING; function REPLACE(TARGET: VSTRING; ITEM: VSTRING; POSITION: STRINDEX := FIRST) return VSTRING; function REPLACE(TARGET: VSTRING; ITEM: STRING; POSITION: STRINDEX := FIRST) return VSTRING; function REPLACE(TARGET: VSTRING; ITEM: CHARACTER; POSITION: STRINDEX := FIRST) return VSTRING; -- Concatenation function "&" (LEFT: VSTRING; RIGHT : VSTRING) return VSTRING; function "&" (LEFT: VSTRING; RIGHT : STRING) return VSTRING; function "&" (LEFT: VSTRING; RIGHT : CHARACTER) return VSTRING; function "&" (LEFT: STRING; RIGHT : VSTRING) return VSTRING; function "&" (LEFT: CHARACTER; RIGHT : VSTRING) return VSTRING; -- Determine the position of a substring function INDEX(WHOLE: VSTRING; PART: VSTRING; OCCURRENCE : NATURAL := 1) return STRINDEX; function INDEX(WHOLE : VSTRING; PART : STRING; OCCURRENCE : NATURAL := 1) return STRINDEX; function INDEX(WHOLE : VSTRING; PART : CHARACTER; OCCURRENCE : NATURAL := 1) return STRINDEX; function RINDEX(WHOLE: VSTRING; PART: VSTRING; OCCURRENCE : NATURAL := 1) return STRINDEX; function RINDEX(WHOLE : VSTRING; PART : STRING; OCCURRENCE : NATURAL := 1) return STRINDEX; function RINDEX(WHOLE : VSTRING; PART : CHARACTER; OCCURRENCE : NATURAL := 1) return STRINDEX; -- Conversion from other associated types function VSTR(FROM : STRING) return VSTRING; function VSTR(FROM : CHARACTER) return VSTRING; function "+" (FROM : STRING) return VSTRING; function "+" (FROM : CHARACTER) return VSTRING; generic type FROM is private; type TO is private; with function STR(X : FROM) return STRING is <>; with function VSTR(Y : STRING) return TO is <>; function CONVERT(X : FROM) return TO; pragma PAGE; private type VSTRING is record LEN : STRINDEX := STRINDEX'FIRST; VALUE : STRING(FIRST .. LAST) := (others => ASCII.NUL); end record; NUL : constant VSTRING := (STRINDEX'FIRST, (others => ASCII.NUL)); end vstrings; -- -- .......................................................................... -- -- -- DISTRIBUTION AND COPYRIGHT: -- -- This software is released to the Public Domain (note: -- software released to the Public Domain is not subject -- to copyright protection). -- Restrictions on use or distribution: NONE -- -- DISCLAIMER: -- -- This software and its documentation are provided "AS IS" and -- without any expressed or implied warranties whatsoever. -- No warranties as to performance, merchantability, or fitness -- for a particular purpose exist. -- -- Because of the diversity of conditions and hardware under -- which this software may be used, no warranty of fitness for -- a particular purpose is offered. The user is advised to -- test the software thoroughly before relying on it. The user -- must assume the entire risk and liability of using this -- software. -- -- In no event shall any person or organization of people be -- held responsible for any direct, indirect, consequential -- or inconsequential damages or lost profits.
reznikmm/gela
Ada
1,404
ads
with Gela.Compilations; with Gela.Elements.Package_Instantiations; with Gela.Semantic_Types; package Gela.Instantiation is pragma Preelaborate; -- Each instantination declaration has property Expanded with -- deep copy of corresponding generic declaration. -- -- Defining_Name property of each identifier in this copy is fixed to refer -- to copied defining name. Each defining_name in the copy has property -- named Corresponding_Generic_Element. It refers to corresponding -- defining name in the template. -- -- Each formal declaration of this copy has property Corresponding_View. -- It refers to corresponding expression of Generic_Actual_Part. -- Type manager takes this property into account when resolves types in -- Generic_Actual_Part and in other places outside of instance. procedure Expand (Comp : Gela.Compilations.Compilation_Access; Node : not null Gela.Elements.Package_Instantiations. Package_Instantiation_Access; Expanded : out Gela.Elements.Element_Access); procedure Environment (Comp : Gela.Compilations.Compilation_Access; Node : not null Gela.Elements.Package_Instantiations. Package_Instantiation_Access; Env_In : Gela.Semantic_Types.Env_Index; Env_Out : out Gela.Semantic_Types.Env_Index); end Gela.Instantiation;
reznikmm/matreshka
Ada
4,787
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Number_Currency_Style_Elements; package Matreshka.ODF_Number.Currency_Style_Elements is type Number_Currency_Style_Element_Node is new Matreshka.ODF_Number.Abstract_Number_Element_Node and ODF.DOM.Number_Currency_Style_Elements.ODF_Number_Currency_Style with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Number_Currency_Style_Element_Node; overriding function Get_Local_Name (Self : not null access constant Number_Currency_Style_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Number_Currency_Style_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Number_Currency_Style_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Number_Currency_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); end Matreshka.ODF_Number.Currency_Style_Elements;
zhmu/ananas
Ada
127
adb
package body Opt48_Pkg2 is function F return Rec is begin return (12, "Hello world!"); end F; end Opt48_Pkg2;
reznikmm/matreshka
Ada
4,813
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package Matreshka.ODF_Elements.Style.Table_Column_Properties is type Style_Table_Column_Properties_Node is new Matreshka.ODF_Elements.Style.Style_Node_Base with null record; type Style_Table_Column_Properties_Access is access all Style_Table_Column_Properties_Node'Class; overriding procedure Enter_Element (Self : not null access Style_Table_Column_Properties_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding function Get_Local_Name (Self : not null access constant Style_Table_Column_Properties_Node) return League.Strings.Universal_String; overriding procedure Leave_Element (Self : not null access Style_Table_Column_Properties_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access Style_Table_Column_Properties_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); -- Dispatch call to corresponding subprogram of iterator interface. end Matreshka.ODF_Elements.Style.Table_Column_Properties;
reznikmm/jwt
Ada
11,131
adb
-- Copyright (c) 2006-2020 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body JWS.Integers is type Double is mod 2 ** (2 * Digit_Size); subtype Double_Digit is Double range 0 .. 2 ** Digit_Size - 1; procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; --------- -- Add -- --------- procedure Add (A : in out Number; B : Number) is Result : Number renames A; Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) + Carry; Result (J) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; end Add; --------- -- Add -- --------- procedure Add (A, B : Number; Result : out Number; C : Digit) is Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) * Mult + Carry; Result (J + 1) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; Result (1) := Digit (Carry); end Add; ---------------- -- BER_Decode -- ---------------- procedure BER_Decode (Raw : Ada.Streams.Stream_Element_Array; Value : out Number) is use type Ada.Streams.Stream_Element_Offset; function N (X : Ada.Streams.Stream_Element_Offset) return Digit; ------- -- N -- ------- function N (X : Ada.Streams.Stream_Element_Offset) return Digit is begin if X in Raw'Range then return Digit (Raw (X)); else return 0; end if; end N; X : Ada.Streams.Stream_Element_Offset := Raw'Last; begin for J in reverse Value'Range loop Value (J) := 256 * (256 * (256 * N (X - 3) + N (X - 2)) + N (X - 1)) + N (X); X := X - 4; end loop; end BER_Decode; ---------------- -- BER_Encode -- ---------------- procedure BER_Encode (Value : Number; Raw : out Ada.Streams.Stream_Element_Array) is X : Ada.Streams.Stream_Element_Offset := Raw'Last; V : Digit; begin for J in reverse Value'Range loop V := Value (J); for K in 1 .. 4 loop Raw (X) := Ada.Streams.Stream_Element'Mod (V); V := V / 256; X := Ada.Streams.Stream_Element_Offset'Pred (X); end loop; end loop; end BER_Encode; ---------------- -- BER_Length -- ---------------- function BER_Length (Raw : Ada.Streams.Stream_Element_Array) return Positive is use type Ada.Streams.Stream_Element; Result : constant Natural := Raw'Length / 4; begin if Result = 0 then return 1; elsif Raw'Length = (Result - 1) * 4 + 1 and then Raw (Raw'First) = 0 then -- Last extra byte contains zero return Result - 1; else return Result; end if; end BER_Length; ------------ -- Devide -- ------------ procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) is function Get_Digit (Left, Right : Number) return Digit with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; function Get_Digit (Left, Right : Number) return Digit is QHAT : Double_Digit; RHAT : Double_Digit; Temp : Double; begin if Left (1) = Right (1) then Temp := Double_Digit (Left (2)) + Double_Digit (Right (1)); if Temp >= Digit'Modulus then return Digit'Last; end if; RHAT := Temp; QHAT := Digit'Modulus - 1; elsif Left (1) < Right (1) then declare L12 : constant Double := Digit'Modulus * Double_Digit (Left (1)) + Double_Digit (Left (2)); begin QHAT := L12 / Double_Digit (Right (1)); -- < Digit'Modulus RHAT := L12 mod Double_Digit (Right (1)); end; else raise Program_Error; end if; while QHAT * Double_Digit (Right (2)) > RHAT * Digit'Modulus + Double_Digit (Left (3)) loop QHAT := QHAT - 1; Temp := RHAT + Double_Digit (Right (1)); exit when Temp >= Digit'Modulus; RHAT := Temp; end loop; return Digit (QHAT); end Get_Digit; Ok : Boolean; begin Result := Get_Digit (Left, Right); Subtract (A => Left, B => Right, C => Result, Ok => Ok); if not Ok then Result := Result - 1; Add (A => Left, B => 0 & Right); end if; end Devide; ----------------- -- Fast_Devide -- ----------------- procedure Fast_Devide (A : Number; B : Digit; Result : out Number; Rest : out Digit) is Div : constant Double_Digit := Double_Digit (B); Carry : Double_Digit := 0; Temp : Double; begin for J in A'Range loop Temp := Carry * Digit'Modulus + Double_Digit (A (J)); Result (J) := Digit (Temp / Div); Carry := Temp mod Div; end loop; Rest := Digit (Carry); end Fast_Devide; -------------- -- Multiply -- -------------- procedure Multiply (A, B : Number; Result : out Number) is Mult : constant Number (Result'Range) := B & (A'Range => 0); Temp : Digit; begin Result (B'Range) := (B'Range => 0); for J in 1 .. A'Length loop Temp := A (A'Length - J + 1); Add (Result (1 .. B'Length + J - 1), Mult (1 .. B'Length + J - 1), Result (1 .. B'Length + J), Temp); end loop; end Multiply; -------------------------- -- Normalize_For_Devide -- -------------------------- procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) with Pre => A_Copy'Length >= A'Length + 1; procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) is begin Mult := Digit (Digit'Modulus / (Double_Digit (B (1)) + 1)); if Mult = 1 then A_Copy := (1 .. A_Copy'Length - A'Length => 0) & A; else declare Zero : constant Number (1 .. A_Copy'Length - 1) := (others => 0); begin Add (A => Zero, B => (1 .. Zero'Length - A'Length => 0) & A, Result => A_Copy, C => Mult); end; declare Temp : Number (1 .. B'Length + 1); begin Add (A => (B'Range => 0), B => B, Result => Temp, C => Mult); pragma Assert (Temp (1) = 0); B (1 .. B'Last) := Temp (2 .. Temp'Last); end; end if; end Normalize_For_Devide; procedure Power (Value : Number; Exponent : Number; Module : Number; Result : out Number) is Mult : Number (Module'Range); Mask : Digit := 1; J : Natural := Exponent'Last; begin if Value'Length < Module'Length or else (Value'Length = Module'Length and then Value <= Module) then Mult := (1 .. Module'Length - Value'Length => 0) & Value; else Remainder (Value, Module, Mult); end if; Result := (1 .. Result'Last - 1 => 0) & 1; while J > 0 loop if (Exponent (J) and Mask) /= 0 then declare Temp : Number (1 .. Result'Length + Mult'Length); begin Multiply (Result, Mult, Temp); Remainder (Temp, Module, Result); end; end if; declare Temp : Number (1 .. 2 * Mult'Length); begin Multiply (Mult, Mult, Temp); Remainder (Temp, Module, Mult); end; if Mask = 2 ** (Digit_Size - 1) then J := J - 1; Mask := 1; else Mask := Mask * 2; end if; end loop; end Power; --------------- -- Remainder -- --------------- procedure Remainder (A, B : Number; Result : out Number) is begin if A (B'Last + 1 .. A'Last) = (B'Last + 1 .. A'Last => 0) and then A (B'Range) < B then Result := A (B'Range); elsif B'Length = 1 then declare Ignore : Number (A'Range); begin Fast_Devide (A, B (1), Ignore, Result (1)); end; else declare Length : constant Positive := Positive'Max (B'Length + 2, A'Length + 1); A_Copy : Number (1 .. Length); B_Copy : Number := B; Temp : Number (1 .. 1 + B'Length); Mult : Digit; Ignore : Digit; begin Normalize_For_Devide (A, B_Copy, A_Copy, Mult); Temp (1 .. 1 + B'Length) := A_Copy (1 .. 1 + B'Length); for Index in 1 .. A_Copy'Length - B'Length loop Temp (Temp'Last) := A_Copy (Index + B'Length); Devide (Left => Temp, Right => B_Copy, Result => Ignore); pragma Assert (Temp (1) = 0); Temp (1 .. B'Length) := Temp (2 .. Temp'Last); end loop; if Mult = 1 then Result := Temp (1 .. Result'Length); else Fast_Devide (A => Temp (1 .. Result'Length), B => Mult, Result => Result, Rest => Ignore); end if; end; end if; end Remainder; -------------- -- Subtract -- -------------- procedure Subtract (A : in out Number; B : Number; C : Digit := 1; Ok : out Boolean) is Result : Number renames A; Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Digit := 0; begin for J in reverse 1 .. B'Length loop Temp := Double (A (J + 1)) - Double (B (J)) * Mult - Double_Digit (Carry); Result (J + 1) := Digit'Mod (Temp); Carry := -Digit (Temp / Digit'Modulus); end loop; Ok := A (1) >= Carry; Result (1) := A (1) - Carry; end Subtract; end JWS.Integers;
reznikmm/matreshka
Ada
3,392
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package FastCGI is pragma Pure; end FastCGI;
wooky/aoc
Ada
985
ads
with Ada.Containers.Indefinite_Holders; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; package AOC is pragma Preelaborate; type Solution is record S1 : chars_ptr; S2 : chars_ptr; end record with Convention => C; function New_Solution (S1, S2 : String) return Solution; type Rectangle is array(Positive range <>, Positive range <>) of Character; type Aoc_File is private; function New_File (Input : chars_ptr) return Aoc_File; function End_Of_File (File : Aoc_File) return Boolean; function Get_Line (File : Aoc_File) return String; procedure Reset (File : Aoc_File); function Read_Rectangle (File : Aoc_File) return Rectangle; private package String_Holder is new Ada.Containers.Indefinite_Holders (String); type Aoc_File_Record is record Input: String_Holder.Holder; Pos : Positive := 1; Eof : Boolean := False; end record; type Aoc_File is access Aoc_File_Record; end AOC;
reznikmm/matreshka
Ada
3,594
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.DG.Polygons.Hash is new AMF.Elements.Generic_Hash (DG_Polygon, DG_Polygon_Access);
zhmu/ananas
Ada
11,620
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the LynxOS version of this package -- Make a careful study of all signals available under the OS, to see which -- need to be reserved, kept always unmasked, or kept always unmasked. Be on -- the lookout for special signals that may be used by the thread library. -- Since this is a multi target file, the signal <-> exception mapping -- is simple minded. If you need a more precise and target specific -- signal handling, create a new s-intman.adb that will fit your needs. -- This file assumes that: -- SIGFPE, SIGILL, SIGSEGV and SIGBUS exist. They are mapped as follows: -- SIGPFE => Constraint_Error -- SIGILL => Program_Error -- SIGSEGV => Storage_Error -- SIGBUS => Storage_Error -- SIGINT exists and will be kept unmasked unless the pragma -- Unreserve_All_Interrupts is specified anywhere in the application. -- System.OS_Interface contains the following: -- SIGADAABORT: the signal that will be used to abort tasks. -- Unmasked: the OS specific set of signals that should be unmasked in -- all the threads. SIGADAABORT is unmasked by -- default -- Reserved: the OS specific set of signals that are reserved. with System.Task_Primitives; package body System.Interrupt_Management is use Interfaces.C; use System.OS_Interface; type Interrupt_List is array (Interrupt_ID range <>) of Interrupt_ID; Exception_Interrupts : constant Interrupt_List := (SIGFPE, SIGILL, SIGSEGV, SIGBUS); Unreserve_All_Interrupts : constant Interfaces.C.int; pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts"); ----------------------- -- Local Subprograms -- ----------------------- function State (Int : Interrupt_ID) return Character; pragma Import (C, State, "__gnat_get_interrupt_state"); -- Get interrupt state. Defined in init.c The input argument is the -- interrupt number, and the result is one of the following: User : constant Character := 'u'; Runtime : constant Character := 'r'; Default : constant Character := 's'; -- 'n' this interrupt not set by any Interrupt_State pragma -- 'u' Interrupt_State pragma set state to User -- 'r' Interrupt_State pragma set state to Runtime -- 's' Interrupt_State pragma set state to System (use "default" -- system handler) procedure Notify_Exception (signo : Signal; siginfo : System.Address; ucontext : System.Address); -- This function identifies the Ada exception to be raised using the -- information when the system received a synchronous signal. Since this -- function is machine and OS dependent, different code has to be provided -- for different target. ---------------------- -- Notify_Exception -- ---------------------- Signal_Mask : aliased sigset_t; -- The set of signals handled by Notify_Exception procedure Notify_Exception (signo : Signal; siginfo : System.Address; ucontext : System.Address) is pragma Unreferenced (siginfo); Result : Interfaces.C.int; begin -- With the __builtin_longjmp, the signal mask is not restored, so we -- need to restore it explicitly. Result := pthread_sigmask (SIG_UNBLOCK, Signal_Mask'Access, null); pragma Assert (Result = 0); -- Perform the necessary context adjustments prior to a raise -- from a signal handler. Adjust_Context_For_Raise (signo, ucontext); -- Check that treatment of exception propagation here is consistent with -- treatment of the abort signal in System.Task_Primitives.Operations. case signo is when SIGFPE => raise Constraint_Error; when SIGILL => raise Program_Error; when SIGSEGV => raise Storage_Error; when SIGBUS => raise Storage_Error; when others => null; end case; end Notify_Exception; ---------------- -- Initialize -- ---------------- Initialized : Boolean := False; procedure Initialize is act : aliased struct_sigaction; old_act : aliased struct_sigaction; Result : System.OS_Interface.int; Use_Alternate_Stack : constant Boolean := System.Task_Primitives.Alternate_Stack_Size /= 0; -- Whether to use an alternate signal stack for stack overflows begin if Initialized then return; end if; Initialized := True; -- Need to call pthread_init very early because it is doing signal -- initializations. pthread_init; Abort_Task_Interrupt := SIGADAABORT; act.sa_handler := Notify_Exception'Address; -- Setting SA_SIGINFO asks the kernel to pass more than just the signal -- number argument to the handler when it is called. The set of extra -- parameters includes a pointer to the interrupted context, which the -- ZCX propagation scheme needs. -- Most man pages for sigaction mention that sa_sigaction should be set -- instead of sa_handler when SA_SIGINFO is on. In practice, the two -- fields are actually union'ed and located at the same offset. -- On some targets, we set sa_flags to SA_NODEFER so that during the -- handler execution we do not change the Signal_Mask to be masked for -- the Signal. -- This is a temporary fix to the problem that the Signal_Mask is not -- restored after the exception (longjmp) from the handler. The right -- fix should be made in sigsetjmp so that we save the Signal_Set and -- restore it after a longjmp. -- Since SA_NODEFER is obsolete, instead we reset explicitly the mask -- in the exception handler. Result := sigemptyset (Signal_Mask'Access); pragma Assert (Result = 0); -- Add signals that map to Ada exceptions to the mask for J in Exception_Interrupts'Range loop if State (Exception_Interrupts (J)) /= Default then Result := sigaddset (Signal_Mask'Access, Signal (Exception_Interrupts (J))); pragma Assert (Result = 0); end if; end loop; act.sa_mask := Signal_Mask; pragma Assert (Keep_Unmasked = (Interrupt_ID'Range => False)); pragma Assert (Reserve = (Interrupt_ID'Range => False)); -- Process state of exception signals for J in Exception_Interrupts'Range loop if State (Exception_Interrupts (J)) /= User then Keep_Unmasked (Exception_Interrupts (J)) := True; Reserve (Exception_Interrupts (J)) := True; if State (Exception_Interrupts (J)) /= Default then -- This file is identical to s-intman-posix.adb, except that we -- don't set the SA_SIGINFO flag in act.sa_flags, because -- LynxOS does not support that. If SA_SIGINFO is set, then -- sigaction fails, returning -1. act.sa_flags := 0; if Use_Alternate_Stack and then Exception_Interrupts (J) = SIGSEGV then act.sa_flags := act.sa_flags + SA_ONSTACK; end if; Result := sigaction (Signal (Exception_Interrupts (J)), act'Unchecked_Access, old_act'Unchecked_Access); pragma Assert (Result = 0); end if; end if; end loop; if State (Abort_Task_Interrupt) /= User then Keep_Unmasked (Abort_Task_Interrupt) := True; Reserve (Abort_Task_Interrupt) := True; end if; -- Set SIGINT to unmasked state as long as it is not in "User" state. -- Check for Unreserve_All_Interrupts last. if State (SIGINT) /= User then Keep_Unmasked (SIGINT) := True; Reserve (SIGINT) := True; end if; -- Check all signals for state that requires keeping them unmasked and -- reserved. for J in Interrupt_ID'Range loop if State (J) = Default or else State (J) = Runtime then Keep_Unmasked (J) := True; Reserve (J) := True; end if; end loop; -- Add the set of signals that must always be unmasked for this target for J in Unmasked'Range loop Keep_Unmasked (Interrupt_ID (Unmasked (J))) := True; Reserve (Interrupt_ID (Unmasked (J))) := True; end loop; -- Add target-specific reserved signals for J in Reserved'Range loop Reserve (Interrupt_ID (Reserved (J))) := True; end loop; -- Process pragma Unreserve_All_Interrupts. This overrides any settings -- due to pragma Interrupt_State: if Unreserve_All_Interrupts /= 0 then Keep_Unmasked (SIGINT) := False; Reserve (SIGINT) := False; end if; -- We do not really have Signal 0. We just use this value to identify -- non-existent signals (see s-intnam.ads). Therefore, Signal should not -- be used in all signal related operations hence mark it as reserved. Reserve (0) := True; end Initialize; end System.Interrupt_Management;
vpodzime/ada-util
Ada
4,399
adb
----------------------------------------------------------------------- -- serialize-io-csv-tests -- Unit tests for CSV parser -- Copyright (C) 2011, 2016 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Streams.Stream_IO; with Util.Test_Caller; with Util.Streams.Files; with Util.Serialize.Mappers.Tests; with Util.Serialize.IO.JSON.Tests; package body Util.Serialize.IO.CSV.Tests is package Caller is new Util.Test_Caller (Test, "Serialize.IO.CSV"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Serialize.IO.CSV.Parse (parse Ok)", Test_Parser'Access); Caller.Add_Test (Suite, "Test Util.Serialize.IO.CSV.Write", Test_Output'Access); end Add_Tests; -- ------------------------------ -- Check various (basic) JSON valid strings (no mapper). -- ------------------------------ procedure Test_Parser (T : in out Test) is use Util.Serialize.Mappers.Tests; procedure Check_Parse (Content : in String; Expect : in Integer); Mapping : aliased Util.Serialize.Mappers.Tests.Map_Test_Mapper.Mapper; Vector_Mapper : aliased Util.Serialize.Mappers.Tests.Map_Test_Vector_Mapper.Mapper; procedure Check_Parse (Content : in String; Expect : in Integer) is P : Parser; Value : aliased Map_Test_Vector.Vector; Mapper : Util.Serialize.Mappers.Processing; begin Mapper.Add_Mapping ("", Vector_Mapper'Unchecked_Access); Map_Test_Vector_Mapper.Set_Context (Mapper, Value'Unchecked_Access); P.Parse_String (Content, Mapper); T.Assert (not P.Has_Error, "Parse error for: " & Content); Util.Tests.Assert_Equals (T, 1, Integer (Value.Length), "Invalid result length"); Util.Tests.Assert_Equals (T, Expect, Integer (Value.Element (1).Value), "Invalid value"); end Check_Parse; HDR : constant String := "name,status,value,bool" & ASCII.CR & ASCII.LF; begin Mapping.Add_Mapping ("name", FIELD_NAME); Mapping.Add_Mapping ("value", FIELD_VALUE); Mapping.Add_Mapping ("status", FIELD_BOOL); Mapping.Add_Mapping ("bool", FIELD_BOOL); Vector_Mapper.Set_Mapping (Mapping'Unchecked_Access); Check_Parse (HDR & "joe,false,23,true", 23); Check_Parse (HDR & "billy,false,""12"",true", 12); Check_Parse (HDR & """John Potter"",false,""1234"",true", 1234); Check_Parse (HDR & """John" & ASCII.CR & "Potter"",False,""3234"",True", 3234); Check_Parse (HDR & """John" & ASCII.LF & "Potter"",False,""3234"",True", 3234); end Test_Parser; -- ------------------------------ -- Test the CSV output stream generation. -- ------------------------------ procedure Test_Output (T : in out Test) is File : aliased Util.Streams.Files.File_Stream; Stream : Util.Serialize.IO.CSV.Output_Stream; Expect : constant String := Util.Tests.Get_Path ("regtests/expect/test-stream.csv"); Path : constant String := Util.Tests.Get_Test_Path ("regtests/result/test-stream.csv"); begin File.Create (Mode => Ada.Streams.Stream_IO.Out_File, Name => Path); Stream.Initialize (Output => File'Unchecked_Access, Input => null, Size => 10000); Util.Serialize.IO.JSON.Tests.Write_Stream (Stream); Stream.Close; Util.Tests.Assert_Equal_Files (T => T, Expect => Expect, Test => Path, Message => "CSV output serialization"); end Test_Output; end Util.Serialize.IO.CSV.Tests;
AdaCore/gpr
Ada
187
adb
with API; with U1; with U2; with U3; package body Pck is procedure Call is begin API.A_Call; U2.Increment; U1.A := U1.A + U2.B; U3; end Call; end Pck;
sungyeon/drake
Ada
1,248
adb
with System.Storage_Elements; with System.Debug; -- assertions with C.sys.syscall; with C.unistd; package body System.Stack is pragma Suppress (All_Checks); use type Storage_Elements.Storage_Offset; use type C.signed_int; procedure Get ( Thread : C.pthread.pthread_t := C.pthread.pthread_self; Top, Bottom : out Address) is begin Bottom := Address (C.pthread.pthread_get_stackaddr_np (Thread)); Top := Bottom - Storage_Elements.Storage_Offset ( C.pthread.pthread_get_stacksize_np (Thread)); end Get; procedure Fake_Return_From_Signal_Handler is UC_RESET_ALT_STACK : constant := 16#80000000#; -- ??? R : C.signed_int; begin -- emulate normal return R := C.unistd.syscall ( C.sys.syscall.SYS_sigreturn, C.void_ptr (Null_Address), UC_RESET_ALT_STACK); pragma Check (Debug, Check => not (R < 0) or else Debug.Runtime_Error ( "syscall (SYS_sigreturn, ...) failed")); end Fake_Return_From_Signal_Handler; function Fault_Address (Info : C.signal.siginfo_t) return Address is begin return Address (Info.si_addr); end Fault_Address; end System.Stack;
optikos/oasis
Ada
1,490
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Declarations; with Program.Elements.Defining_Identifiers; with Program.Lexical_Elements; package Program.Elements.Choice_Parameter_Specifications is pragma Pure (Program.Elements.Choice_Parameter_Specifications); type Choice_Parameter_Specification is limited interface and Program.Elements.Declarations.Declaration; type Choice_Parameter_Specification_Access is access all Choice_Parameter_Specification'Class with Storage_Size => 0; not overriding function Name (Self : Choice_Parameter_Specification) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access is abstract; type Choice_Parameter_Specification_Text is limited interface; type Choice_Parameter_Specification_Text_Access is access all Choice_Parameter_Specification_Text'Class with Storage_Size => 0; not overriding function To_Choice_Parameter_Specification_Text (Self : aliased in out Choice_Parameter_Specification) return Choice_Parameter_Specification_Text_Access is abstract; not overriding function Colon_Token (Self : Choice_Parameter_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Choice_Parameter_Specifications;
zhmu/ananas
Ada
157
ads
package Array28_Pkg is subtype Outer_Type is String (1 .. 8); subtype Inner_Type is String (1 .. 5); function F return Inner_Type; end Array28_Pkg;
AdaCore/gpr
Ada
66
adb
with ABC.Plop; with API; procedure Tst is begin null; end Tst;
reznikmm/matreshka
Ada
5,051
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. ------------------------------------------------------------------------------ -- StartObjectBehaviorAction is an action that starts the execution either of -- a directly instantiated behavior or of the classifier behavior of an -- object. Argument values may be supplied for the input parameters of the -- behavior. If the behavior is invoked synchronously, then output values may -- be obtained for output parameters. ------------------------------------------------------------------------------ with AMF.UML.Call_Actions; limited with AMF.UML.Input_Pins; package AMF.UML.Start_Object_Behavior_Actions is pragma Preelaborate; type UML_Start_Object_Behavior_Action is limited interface and AMF.UML.Call_Actions.UML_Call_Action; type UML_Start_Object_Behavior_Action_Access is access all UML_Start_Object_Behavior_Action'Class; for UML_Start_Object_Behavior_Action_Access'Storage_Size use 0; not overriding function Get_Object (Self : not null access constant UML_Start_Object_Behavior_Action) return AMF.UML.Input_Pins.UML_Input_Pin_Access is abstract; -- Getter of StartObjectBehaviorAction::object. -- -- Holds the object which is either a behavior to be started or has a -- classifier behavior to be started. not overriding procedure Set_Object (Self : not null access UML_Start_Object_Behavior_Action; To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is abstract; -- Setter of StartObjectBehaviorAction::object. -- -- Holds the object which is either a behavior to be started or has a -- classifier behavior to be started. end AMF.UML.Start_Object_Behavior_Actions;
onox/orka
Ada
2,885
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.SIMD.SSE.Singles.Swizzle is pragma Pure; function Shuffle (Left, Right : m128; Mask : Integer_32) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_shufps"; -- Shuffle the 32-bit floats in Left and Right using the given Mask. The first -- and second floats (lower half) are retrieved from Left, the third and fourth -- floats (upper half) from Right. -- -- The compiler needs access to the Mask at compile-time, thus construct it -- as follows: -- -- Mask_a_b_c_d : constant Unsigned_32 := a or b * 4 or c * 16 or d * 64; -- -- a and b select the floats to use from Left, c and d from Right. function Unpack_High (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_unpckhps"; -- Unpack and interleave the 32-bit floats from the upper halves of -- Left and Right as follows: Left (3), Right (3), Left (4), Right (4) function Unpack_Low (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_unpcklps"; -- Unpack and interleave the 32-bit floats from the lower halves of -- Left and Right as follows: Left (1), Right (1), Left (2), Right (2) function Move_LH (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_movlhps"; -- Move the two lower floats from Right to the two upper floats of Left: -- Left (1), Left (2), Right (1), Right (2) function Move_HL (Left, Right : m128) return m128 with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_movhlps"; -- Move the two upper floats from Right to the two lower floats of Left: -- Right (3), Right (4), Left (3), Left (4) function Duplicate_LH (Elements : m128) return m128 is (Move_LH (Elements, Elements)) with Inline; function Duplicate_HL (Elements : m128) return m128 is (Move_HL (Elements, Elements)) with Inline; procedure Transpose (Matrix : in out m128_Array) with Inline_Always; function Transpose (Matrix : m128_Array) return m128_Array with Inline_Always; end Orka.SIMD.SSE.Singles.Swizzle;
AdaCore/ada-traits-containers
Ada
3,797
adb
-- -- Copyright (C) 2015-2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- pragma Ada_2012; package body Conts.Lists.Storage.Bounded with SPARK_Mode => Off is package body Impl is -------------- -- Allocate -- -------------- procedure Allocate (Self : in out Container'Class; Element : Stored_Type; N : out Node_Access) is begin if Self.Free > 0 then N := Node_Access (Self.Free); Self.Free := Integer (Self.Nodes (Count_Type (N)).Next); else N := Node_Access (abs Self.Free + 1); Self.Free := Self.Free - 1; end if; if Count_Type (N) <= Self.Nodes'Last then Self.Nodes (Count_Type (N)) := (Element => Element, Previous => Null_Node_Access, Next => Null_Node_Access); else N := Null_Node_Access; end if; end Allocate; ----------------- -- Get_Element -- ----------------- function Get_Element (Self : Container'Class; N : Node_Access) return Stored_Type is begin return Self.Nodes (Count_Type (N)).Element; end Get_Element; -------------- -- Get_Next -- -------------- function Get_Next (Self : Container'Class; N : Node_Access) return Node_Access is begin return Self.Nodes (Count_Type (N)).Next; end Get_Next; ------------------ -- Get_Previous -- ------------------ function Get_Previous (Self : Container'Class; N : Node_Access) return Node_Access is begin return Self.Nodes (Count_Type (N)).Previous; end Get_Previous; ------------------ -- Set_Previous -- ------------------ procedure Set_Previous (Self : in out Container'Class; N, Prev : Node_Access) is begin Self.Nodes (Count_Type (N)).Previous := Prev; end Set_Previous; -------------- -- Set_Next -- -------------- procedure Set_Next (Self : in out Container'Class; N, Next : Node_Access) is begin Self.Nodes (Count_Type (N)).Next := Next; end Set_Next; ----------------- -- Set_Element -- ----------------- procedure Set_Element (Self : in out Impl.Container'Class; N : Node_Access; E : Stored_Type) is begin Self.Nodes (Count_Type (N)).Element := E; end Set_Element; ------------ -- Assign -- ------------ procedure Assign (Nodes : in out Container'Class; Source : Container'Class; New_Head : out Node_Access; Old_Head : Node_Access; New_Tail : out Node_Access; Old_Tail : Node_Access) is N : Node_Access; begin -- Indices will remain the same New_Head := Old_Head; New_Tail := Old_Tail; Nodes.Free := Source.Free; -- We need to copy each of the elements. if not Elements.Copyable then N := Old_Head; while N /= Null_Node_Access loop declare Value : Node renames Source.Nodes (Count_Type (N)); begin Nodes.Nodes (Count_Type (N)) := (Element => Elements.Copy (Value.Element), Next => Value.Next, Previous => Value.Previous); N := Value.Next; end; end loop; else Nodes.Nodes := Source.Nodes; end if; end Assign; end Impl; end Conts.Lists.Storage.Bounded;
smola/language-dataset
Ada
8,244
adb
-------------------------------------------------------------------------------- -- FILE : cubedos-file_server-messages.adb -- SUBJECT: Body of a package that implements the main part of the file server. -- AUTHOR : (C) Copyright 2017 by Vermont Technical College -- -------------------------------------------------------------------------------- pragma SPARK_Mode(Off); -- For debugging... with Ada.Exceptions; with Ada.Text_IO; with Ada.Sequential_IO; with CubedOS.File_Server.API; with CubedOS.Lib; use Ada.Text_IO; package body CubedOS.File_Server.Messages is use Message_Manager; use type API.File_Handle_Type; use type API.Mode_Type; package Octet_IO is new Ada.Sequential_IO(Element_Type => CubedOS.Lib.Octet); type File_Record is record -- This record may hold additional components in the future. Underlying : Octet_IO.File_Type; end record; Files : array(API.Valid_File_Handle_Type) of File_Record; procedure Process_Open_Request(Incoming_Message : in Message_Record) with Pre => API.Is_Open_Request(Incoming_Message) is -- A linear search should be fine. This produces the lowest available handle. function Find_Free_Handle return API.File_Handle_Type is begin for I in API.Valid_File_Handle_Type loop if not Octet_IO.Is_Open(Files(I).Underlying) then return I; end if; end loop; return API.Invalid_Handle; end Find_Free_Handle; Mode : API.Mode_Type; Status : Message_Status_Type; Name : String(1 .. 256); -- Somewhat arbitrary restriction on file name size. Name_Size : Natural; Underlying_Mode : Octet_IO.File_Mode; Handle : constant API.File_Handle_Type := Find_Free_Handle; begin API.Open_Request_Decode(Incoming_Message, Mode, Name, Name_Size, Status); -- Don't even bother if there are no available handles. if Handle = API.Invalid_Handle then Message_Manager.Route_Message (API.Open_Reply_Encode (Receiver_Domain => Incoming_Message.Sender_Domain, Receiver => Incoming_Message.Sender, Request_ID => Incoming_Message.Request_ID, Handle => API.Invalid_Handle)); return; end if; if Status = Malformed then Message_Manager.Route_Message (API.Open_Reply_Encode (Receiver_Domain=> Incoming_Message.Sender_Domain, Receiver => Incoming_Message.Sender, Request_ID => Incoming_Message.Request_ID, Handle => API.Invalid_Handle)); else case Mode is when API.Read => Underlying_Mode := Octet_IO.In_File; Octet_IO.Open(Files(Handle).Underlying, Underlying_Mode, Name(1 .. Name_Size)); when API.Write => Underlying_Mode := Octet_IO.Out_File; Octet_IO.Create(Files(Handle).Underlying, Underlying_Mode, Name(1 .. Name_Size)); end case; Message_Manager.Route_Message (API.Open_Reply_Encode (Receiver_Domain => Incoming_Message.Sender_Domain, Receiver => Incoming_Message.Sender, Request_ID => Incoming_Message.Request_ID, Handle => Handle)); end if; exception when others => -- Open failed. Send back an invalid handle. Message_Manager.Route_Message (API.Open_Reply_Encode (Receiver_Domain => Incoming_Message.Sender_Domain, Receiver => Incoming_Message.Sender, Request_ID => Incoming_Message.Request_ID, Handle => API.Invalid_Handle)); end Process_Open_Request; procedure Process_Read_Request(Incoming_Message : in Message_Record) with Pre => API.Is_Read_Request(Incoming_Message) is Handle : API.File_Handle_Type; Amount : API.Read_Size_Type; Status : Message_Status_Type; Size : API.Read_Result_Size_Type; Data : CubedOS.Lib.Octet_Array(0 .. API.Read_Size_Type'Last - 1); begin -- If the read request doesn't decode properly we just don't send a reply at all? API.Read_Request_Decode(Incoming_Message, Handle, Amount, Status); if Status = Success then if Octet_IO.Is_Open(Files(Handle).Underlying) then Size := 0; begin while Size < Amount loop Octet_IO.Read(Files(Handle).Underlying, Data(Size)); Size := Size + 1; end loop; exception when Octet_IO.End_Error => null; end; -- Send what we have (could be zero octets!). Message_Manager.Route_Message (API.Read_Reply_Encode (Receiver_Domain => Incoming_Message.Sender_Domain, Receiver => Incoming_Message.Sender, Request_ID => Incoming_Message.Request_ID, Handle => Handle, Amount => Size, Data => Data)); end if; end if; end Process_Read_Request; procedure Process_Write_Request(Incoming_Message : in Message_Record) with Pre => API.Is_Write_Request(Incoming_Message) is Handle : API.File_Handle_Type; Amount : API.Read_Size_Type; Status : Message_Status_Type; Size : API.Read_Result_Size_Type; Data : CubedOS.Lib.Octet_Array(0 .. API.Read_Size_Type'Last - 1); begin -- If the read request doesn't decode properly we just don't send a reply at all? API.Write_Request_Decode(Incoming_Message, Handle, Amount, Data, Status); if Status = Success then if Octet_IO.Is_Open(Files(Handle).Underlying) then Size := 0; begin -- Loop thorugh data to write each character while Size < Amount loop Octet_IO.Write(Files(Handle).Underlying, Data(Size)); Size := Size + 1; end loop; exception when Octet_IO.End_Error => null; end; Message_Manager.Route_Message (API.Write_Reply_Encode (Receiver_Domain => Incoming_Message.Sender_Domain, Receiver => Incoming_Message.Sender, Request_ID => Incoming_Message.Request_ID, Handle => Handle, Amount => Size)); end if; end if; end Process_Write_Request; procedure Process_Close_Request(Incoming_Message : in Message_Record) with Pre => API.Is_Close_Request(Incoming_Message) is Handle : API.Valid_File_Handle_Type; Status : Message_Status_Type; begin API.Close_Request_Decode(Incoming_Message, Handle, Status); if Status = Success then if Octet_IO.Is_Open(Files(Handle).Underlying) then Octet_IO.Close(Files(Handle).Underlying); end if; end if; end Process_Close_Request; -- TODO -- procedure Process(Incoming_Message : in Message_Record) is begin if API.Is_Open_Request(Incoming_Message) then Process_Open_Request(Incoming_Message); elsif API.Is_Read_Request(Incoming_Message) then Process_Read_Request(Incoming_Message); elsif API.Is_Write_Request(Incoming_Message) then Process_Write_Request(Incoming_Message); elsif API.Is_Close_Request(Incoming_Message) then Process_Close_Request(Incoming_Message); else -- TODO: What should be done about malformed/unrecognized messages? null; end if; exception when Ex : others => Ada.Text_IO.Put_Line("Unhandled exception in File_Server message processor..."); Ada.Text_IO.Put_Line(Ada.Exceptions.Exception_Information(Ex)); end Process; task body Message_Loop is Incoming_Message : Message_Manager.Message_Record; begin loop Message_Manager.Fetch_Message(ID, Incoming_Message); Process(Incoming_Message); end loop; end Message_Loop; end CubedOS.File_Server.Messages;
zhmu/ananas
Ada
3,442
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . C O N C A T _ 5 -- -- -- -- B o d y -- -- -- -- Copyright (C) 2008-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Concat_4; package body System.Concat_5 is pragma Suppress (All_Checks); ------------------ -- Str_Concat_5 -- ------------------ procedure Str_Concat_5 (R : out String; S1, S2, S3, S4, S5 : String) is F, L : Natural; begin F := R'First; L := F + S1'Length - 1; R (F .. L) := S1; F := L + 1; L := F + S2'Length - 1; R (F .. L) := S2; F := L + 1; L := F + S3'Length - 1; R (F .. L) := S3; F := L + 1; L := F + S4'Length - 1; R (F .. L) := S4; F := L + 1; L := R'Last; R (F .. L) := S5; end Str_Concat_5; ------------------------- -- Str_Concat_Bounds_5 -- ------------------------- procedure Str_Concat_Bounds_5 (Lo, Hi : out Natural; S1, S2, S3, S4, S5 : String) is begin System.Concat_4.Str_Concat_Bounds_4 (Lo, Hi, S2, S3, S4, S5); if S1 /= "" then Hi := S1'Last + Hi - Lo + 1; Lo := S1'First; end if; end Str_Concat_Bounds_5; end System.Concat_5;
rohitsaraf17/NYU-ProgrammingLanguages
Ada
1,186
adb
with text_io; with MatrixMult; procedure AssignmentMain is use text_io; package int_io is new integer_io(integer); use int_io; use MatrixMult; A,B,C : Matrix; task Reader1 is entry Read1; end Reader1; task Reader2 is entry Read2; end Reader2; task Printer is entry Print; end Printer; task body Reader1 is begin accept Read1 do -- put("Enter the values for Matrix A:"); -- New_Line; for I in 1..SIZE loop for J in 1..SIZE loop get(A(I,J)); end loop; end loop; end Read1; end Reader1; task body Reader2 is begin accept Read2 do -- put("Enter the values for Matrix B:"); -- New_Line; for I in 1..SIZE loop for J in 1..SIZE loop get(B(I,J)); end loop; end loop; end Read2; end Reader2; task body Printer is begin accept Print; for I in 1..SIZE loop for J in 1..SIZE loop put(C(I,J)); put(" "); end loop; New_Line; end loop; end Printer; begin Reader1.Read1; Reader2.Read2; MatMult(A,B,C); Printer.Print; end AssignmentMain;
stcarrez/ada-servlet
Ada
9,111
adb
----------------------------------------------------------------------- -- security-openid-servlets - Servlets for OpenID 2.0 Authentication -- Copyright (C) 2010, 2011, 2012, 2013, 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. ----------------------------------------------------------------------- with Servlet.Sessions; with Util.Beans.Objects; with Util.Beans.Objects.Records; with Util.Log.Loggers; package body Servlet.Security.Servlets is -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Security.Servlets"); -- Make a package to store the Association in the session. package Association_Bean is new Util.Beans.Objects.Records (Auth.Association); subtype Association_Access is Association_Bean.Element_Type_Access; -- ------------------------------ -- Called by the servlet container to indicate to a servlet that the servlet -- is being placed into service. -- ------------------------------ overriding procedure Initialize (Server : in out Openid_Servlet; Context : in Servlet.Core.Servlet_Registry'Class) is begin null; end Initialize; -- Name of the session attribute which holds information about the active authentication. OPENID_ASSOC_ATTRIBUTE : constant String := "openid-assoc"; procedure Initialize (Server : in Openid_Servlet; Provider : in String; Manager : in out Auth.Manager) is begin Manager.Initialize (Params => Server, Name => Provider); end Initialize; -- Get a configuration parameter from the servlet context for the security Auth provider. overriding function Get_Parameter (Server : in Openid_Servlet; Name : in String) return String is Ctx : constant Servlet.Core.Servlet_Registry_Access := Server.Get_Servlet_Context; begin return Ctx.Get_Init_Parameter (Name); end Get_Parameter; function Get_Provider_URL (Server : in Request_Auth_Servlet; Request : in Servlet.Requests.Request'Class) return String is pragma Unreferenced (Server); URI : constant String := Request.Get_Path_Info; begin if URI'Length = 0 then return ""; end if; Log.Info ("OpenID authentication with {0}", URI); return URI (URI'First + 1 .. URI'Last); end Get_Provider_URL; -- ------------------------------ -- Proceed to the OpenID authentication with an OpenID provider. -- Find the OpenID provider URL and starts the discovery, association phases -- during which a private key is obtained from the OpenID provider. -- After OpenID discovery and association, the user will be redirected to -- the OpenID provider. -- ------------------------------ overriding procedure Do_Get (Server : in Request_Auth_Servlet; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class) is Ctx : constant Servlet.Core.Servlet_Registry_Access := Server.Get_Servlet_Context; Name : constant String := Server.Get_Provider_URL (Request); URL : constant String := Ctx.Get_Init_Parameter ("auth.url." & Name); begin Log.Info ("Request OpenId authentication to {0} - {1}", Name, URL); if Name'Length = 0 or else URL'Length = 0 then Response.Set_Status (Servlet.Responses.SC_NOT_FOUND); return; end if; declare Mgr : Auth.Manager; OP : Auth.End_Point; Bean : constant Util.Beans.Objects.Object := Association_Bean.Create; Assoc : constant Association_Access := Association_Bean.To_Element_Access (Bean); begin Server.Initialize (Name, Mgr); -- Yadis discovery (get the XRDS file). This step does nothing for OAuth. Mgr.Discover (URL, OP); -- Associate to the OpenID provider and get an end-point with a key. Mgr.Associate (OP, Assoc.all); -- Save the association in the HTTP session and -- redirect the user to the OpenID provider. declare Auth_URL : constant String := Mgr.Get_Authentication_URL (OP, Assoc.all); Session : Servlet.Sessions.Session := Request.Get_Session (Create => True); begin Log.Info ("Redirect to auth URL: {0}", Auth_URL); Response.Send_Redirect (Location => Auth_URL); Session.Set_Attribute (Name => OPENID_ASSOC_ATTRIBUTE, Value => Bean); end; end; end Do_Get; -- ------------------------------ -- Verify the authentication result that was returned by the OpenID provider. -- If the authentication succeeded and the signature was correct, sets a -- user principals on the session. -- ------------------------------ overriding procedure Do_Get (Server : in Verify_Auth_Servlet; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class) is use type Auth.Auth_Result; type Auth_Params is new Auth.Parameters with null record; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String is pragma Unreferenced (Params); begin return Request.Get_Parameter (Name); end Get_Parameter; Session : Servlet.Sessions.Session := Request.Get_Session (Create => False); Bean : Util.Beans.Objects.Object; Mgr : Auth.Manager; Assoc : Association_Access; Credential : Auth.Authentication; Params : Auth_Params; Ctx : constant Servlet.Core.Servlet_Registry_Access := Server.Get_Servlet_Context; begin Log.Info ("Verify openid authentication"); if not Session.Is_Valid then Log.Warn ("Session has expired during OpenID authentication process"); Response.Set_Status (Servlet.Responses.SC_FORBIDDEN); return; end if; Bean := Session.Get_Attribute (OPENID_ASSOC_ATTRIBUTE); -- Cleanup the session and drop the association end point. Session.Remove_Attribute (OPENID_ASSOC_ATTRIBUTE); if Util.Beans.Objects.Is_Null (Bean) then Log.Warn ("Verify openid request without active session"); Response.Set_Status (Servlet.Responses.SC_FORBIDDEN); return; end if; Assoc := Association_Bean.To_Element_Access (Bean); Server.Initialize (Auth.Get_Provider (Assoc.all), Mgr); -- Verify that what we receive through the callback matches the association key. Mgr.Verify (Assoc.all, Params, Credential); if Auth.Get_Status (Credential) /= Auth.AUTHENTICATED then Log.Info ("Authentication has failed"); Response.Set_Status (Servlet.Responses.SC_FORBIDDEN); return; end if; Log.Info ("Authentication succeeded for {0}", Auth.Get_Email (Credential)); -- Get a user principal and set it on the session. declare User : Servlet.Principals.Principal_Access; URL : constant String := Ctx.Get_Init_Parameter ("openid.success_url"); begin Verify_Auth_Servlet'Class (Server).Create_Principal (Credential, User); Session.Set_Principal (User); Log.Info ("Redirect user to success URL: {0}", URL); Response.Send_Redirect (Location => URL); end; end Do_Get; -- ------------------------------ -- Create a principal object that correspond to the authenticated user identified -- by the <b>Credential</b> information. The principal will be attached to the session -- and will be destroyed when the session is closed. -- ------------------------------ procedure Create_Principal (Server : in Verify_Auth_Servlet; Credential : in Auth.Authentication; Result : out Servlet.Principals.Principal_Access) is pragma Unreferenced (Server); P : constant Auth.Principal_Access := Auth.Create_Principal (Credential); begin Result := P.all'Access; end Create_Principal; end Servlet.Security.Servlets;
reznikmm/matreshka
Ada
16,324
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_Literal_Integers is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Literal_Integer_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_Literal_Integer (AMF.UML.Literal_Integers.UML_Literal_Integer_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Literal_Integer_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_Literal_Integer (AMF.UML.Literal_Integers.UML_Literal_Integer_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Literal_Integer_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_Literal_Integer (Visitor, AMF.UML.Literal_Integers.UML_Literal_Integer_Access (Self), Control); end if; end Visit_Element; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Literal_Integer_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_Literal_Integer_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; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Literal_Integer_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_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Literal_Integer_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Literal_Integer_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Literal_Integer_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; -------------- -- Get_Type -- -------------- overriding function Get_Type (Self : not null access constant UML_Literal_Integer_Proxy) return AMF.UML.Types.UML_Type_Access is begin return AMF.UML.Types.UML_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type (Self.Element))); end Get_Type; --------------- -- Get_Value -- --------------- overriding function Get_Value (Self : not null access constant UML_Literal_Integer_Proxy) return Integer is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Value (Self.Element); end Get_Value; ------------------- -- Integer_Value -- ------------------- overriding function Integer_Value (Self : not null access constant UML_Literal_Integer_Proxy) return Integer is -- 7.3.27 LiteralInteger (from Kernel) -- -- [2] The query integerValue() gives the value. -- -- LiteralInteger::integerValue() : [Integer]; -- integerValue = value begin return UML_Literal_Integer_Proxy'Class (Self.all).Get_Value; end Integer_Value; ------------------- -- Integer_Value -- ------------------- overriding function Integer_Value (Self : not null access constant UML_Literal_Integer_Proxy) return AMF.Optional_Integer is -- 7.3.27 LiteralInteger (from Kernel) -- -- [2] The query integerValue() gives the value. -- -- LiteralInteger::integerValue() : [Integer]; -- integerValue = value begin return (False, UML_Literal_Integer_Proxy'Class (Self.all).Get_Value); end Integer_Value; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Literal_Integer_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; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Literal_Integer_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Literal_Integer_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; -------------- -- Set_Type -- -------------- overriding procedure Set_Type (Self : not null access UML_Literal_Integer_Proxy; To : AMF.UML.Types.UML_Type_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Type (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Type; --------------- -- Set_Value -- --------------- overriding procedure Set_Value (Self : not null access UML_Literal_Integer_Proxy; To : Integer) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Value (Self.Element, To); end Set_Value; ------------------- -- Is_Computable -- ------------------- overriding function Is_Computable (Self : not null access constant UML_Literal_Integer_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Computable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Computable"; return Is_Computable (Self); end Is_Computable; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Literal_Integer_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Literal_Integer_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_Literal_Integer_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_Literal_Integer_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_Literal_Integer_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_Literal_Integer_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_Literal_Integer_Proxy.Namespace"; return Namespace (Self); end Namespace; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant UML_Literal_Integer_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; end AMF.Internals.UML_Literal_Integers;
onox/orka
Ada
5,444
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Numerics; with Orka.Behaviors; with Orka.Transforms.Singles.Matrices; with Orka.Transforms.Doubles.Vectors; private with Orka.Transforms.Doubles.Matrices; private with Orka.Types; package Orka.Cameras is pragma Preelaborate; package Transforms renames Orka.Transforms.Singles.Matrices; subtype Vector4 is Orka.Transforms.Doubles.Vectors.Vector4; subtype Angle is Float_64 range -Ada.Numerics.Pi .. Ada.Numerics.Pi; subtype Distance is Float_64 range 0.0 .. Float_64'Last; Default_Scale : Vector4 := (0.002, 0.002, 1.0, 0.0); ----------------------------------------------------------------------------- type Camera_Lens is record Width, Height : Positive; FOV : Float_32; end record; function Projection_Matrix (Object : Camera_Lens) return Transforms.Matrix4; function Create_Lens (Width, Height : Positive; FOV : Float_32) return Camera_Lens; ----------------------------------------------------------------------------- type Camera is abstract tagged private; type Camera_Ptr is not null access all Camera'Class; procedure Update (Object : in out Camera; Delta_Time : Duration) is abstract; procedure Set_Input_Scale (Object : in out Camera; X, Y, Z : Float_64); procedure Set_Up_Direction (Object : in out Camera; Direction : Vector4); function Lens (Object : Camera) return Camera_Lens; procedure Set_Lens (Object : in out Camera; Lens : Camera_Lens); function View_Matrix (Object : Camera) return Transforms.Matrix4 is abstract; function View_Matrix_Inverse (Object : Camera) return Transforms.Matrix4 is abstract; -- Return the inverse of the view matrix function View_Position (Object : Camera) return Vector4 is abstract; -- Return the position of the camera in world space function Projection_Matrix (Object : Camera) return Transforms.Matrix4; function Create_Camera (Lens : Camera_Lens) return Camera is abstract; type Observing_Camera is interface; procedure Look_At (Object : in out Observing_Camera; Target : Behaviors.Behavior_Ptr) is abstract; -- Orient the camera such that it looks at the given target function Target_Position (Object : Observing_Camera) return Vector4 is abstract; -- Return the position of the target the camera looks at ----------------------------------------------------------------------------- -- First person camera's -- ----------------------------------------------------------------------------- type First_Person_Camera is abstract new Camera with private; procedure Set_Position (Object : in out First_Person_Camera; Position : Vector4); overriding function View_Position (Object : First_Person_Camera) return Vector4; ----------------------------------------------------------------------------- -- Third person camera's -- ----------------------------------------------------------------------------- type Third_Person_Camera is abstract new Camera and Observing_Camera with private; overriding procedure Look_At (Object : in out Third_Person_Camera; Target : Behaviors.Behavior_Ptr); overriding function Target_Position (Object : Third_Person_Camera) return Vector4; private type Camera is abstract tagged record Lens : Camera_Lens; Scale : Vector4 := Default_Scale; Up : Vector4 := (0.0, 1.0, 0.0, 0.0); end record; type First_Person_Camera is abstract new Camera with record Position : Vector4 := (0.0, 0.0, 0.0, 1.0); end record; type Third_Person_Camera is abstract new Camera and Observing_Camera with record Target : Behaviors.Behavior_Ptr := Behaviors.Null_Behavior; end record; function Clamp_Distance is new Orka.Types.Clamp (Float_64, Distance); function Normalize_Angle is new Orka.Types.Normalize_Periodic (Float_64, Angle); subtype Matrix4 is Orka.Transforms.Doubles.Matrices.Matrix4; Y_Axis : constant Vector4 := (0.0, 1.0, 0.0, 0.0); function Look_At (Target, Camera, Up_World : Vector4) return Matrix4; function Rotate_To_Up (Object : Camera'Class) return Matrix4; type Update_Mode is (Relative, Absolute); protected type Change_Updater is procedure Add (Value : Vector4); procedure Set (Value : Vector4); procedure Get (Value : in out Vector4; Mode : out Update_Mode); private Change : Vector4 := (0.0, 0.0, 0.0, 0.0); Is_Set : Boolean := False; Update : Update_Mode := Absolute; end Change_Updater; type Change_Updater_Ptr is not null access Change_Updater; end Orka.Cameras;
ekoeppen/MSP430_Generic_Ada_Drivers
Ada
4,510
ads
-- This spec has been automatically generated from out.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- Comparator A package MSP430_SVD.COMPARATOR_A is pragma Preelaborate; --------------- -- Registers -- --------------- -- Comp. A Internal Reference Select 0 type CACTL1_CAREF_Field is (-- Comp. A Int. Ref. Select 0 : Off Caref_0, -- Comp. A Int. Ref. Select 1 : 0.25*Vcc Caref_1, -- Comp. A Int. Ref. Select 2 : 0.5*Vcc Caref_2, -- Comp. A Int. Ref. Select 3 : Vt Caref_3) with Size => 2; for CACTL1_CAREF_Field use (Caref_0 => 0, Caref_1 => 1, Caref_2 => 2, Caref_3 => 3); -- Comparator A Control 1 type CACTL1_Register is record -- Comp. A Interrupt Flag CAIFG : MSP430_SVD.Bit := 16#0#; -- Comp. A Interrupt Enable CAIE : MSP430_SVD.Bit := 16#0#; -- Comp. A Int. Edge Select: 0:rising / 1:falling CAIES : MSP430_SVD.Bit := 16#0#; -- Comp. A enable CAON : MSP430_SVD.Bit := 16#0#; -- Comp. A Internal Reference Select 0 CAREF : CACTL1_CAREF_Field := MSP430_SVD.COMPARATOR_A.Caref_0; -- Comp. A Internal Reference Enable CARSEL : MSP430_SVD.Bit := 16#0#; -- Comp. A Exchange Inputs CAEX : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for CACTL1_Register use record CAIFG at 0 range 0 .. 0; CAIE at 0 range 1 .. 1; CAIES at 0 range 2 .. 2; CAON at 0 range 3 .. 3; CAREF at 0 range 4 .. 5; CARSEL at 0 range 6 .. 6; CAEX at 0 range 7 .. 7; end record; -- CACTL2_P2CA array type CACTL2_P2CA_Field_Array is array (0 .. 4) of MSP430_SVD.Bit with Component_Size => 1, Size => 5; -- Type definition for CACTL2_P2CA type CACTL2_P2CA_Field (As_Array : Boolean := False) is record case As_Array is when False => -- P2CA as a value Val : MSP430_SVD.UInt5; when True => -- P2CA as an array Arr : CACTL2_P2CA_Field_Array; end case; end record with Unchecked_Union, Size => 5; for CACTL2_P2CA_Field use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- Comparator A Control 2 type CACTL2_Register is record -- Comp. A Output CAOUT : MSP430_SVD.Bit := 16#0#; -- Comp. A Enable Output Filter CAF : MSP430_SVD.Bit := 16#0#; -- Comp. A +Terminal Multiplexer P2CA : CACTL2_P2CA_Field := (As_Array => False, Val => 16#0#); -- Comp. A Short + and - Terminals CASHORT : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for CACTL2_Register use record CAOUT at 0 range 0 .. 0; CAF at 0 range 1 .. 1; P2CA at 0 range 2 .. 6; CASHORT at 0 range 7 .. 7; end record; -- CAPD array type CAPD_Field_Array is array (0 .. 7) of MSP430_SVD.Bit with Component_Size => 1, Size => 8; -- Comparator A Port Disable type CAPD_Register (As_Array : Boolean := False) is record case As_Array is when False => -- CAPD as a value Val : MSP430_SVD.Byte; when True => -- CAPD as an array Arr : CAPD_Field_Array; end case; end record with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for CAPD_Register use record Val at 0 range 0 .. 7; Arr at 0 range 0 .. 7; end record; ----------------- -- Peripherals -- ----------------- -- Comparator A type COMPARATOR_A_Peripheral is record -- Comparator A Control 1 CACTL1 : aliased CACTL1_Register; -- Comparator A Control 2 CACTL2 : aliased CACTL2_Register; -- Comparator A Port Disable CAPD : aliased CAPD_Register; end record with Volatile; for COMPARATOR_A_Peripheral use record CACTL1 at 16#1# range 0 .. 7; CACTL2 at 16#2# range 0 .. 7; CAPD at 16#3# range 0 .. 7; end record; -- Comparator A COMPARATOR_A_Periph : aliased COMPARATOR_A_Peripheral with Import, Address => COMPARATOR_A_Base; end MSP430_SVD.COMPARATOR_A;
zhmu/ananas
Ada
2,892
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . I M G _ E N U M _ 1 6 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2021-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. -- -- -- ------------------------------------------------------------------------------ -- Instantiation of System.Image_N for enumeration types whose names table -- has a length that fits in a 16-bit but not a 8-bit integer. with Interfaces; with System.Image_N; package System.Img_Enum_16 is pragma Pure; package Impl is new Image_N (Interfaces.Integer_16); procedure Image_Enumeration_16 (Pos : Natural; S : in out String; P : out Natural; Names : String; Indexes : System.Address) renames Impl.Image_Enumeration; end System.Img_Enum_16;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
516
ads
with STM32_SVD.GPIO; with STM32GD.EXTI; with STM32GD.GPIO.Pin; generic with package Pin is new STM32GD.GPIO.Pin (<>); package STM32GD.GPIO.IRQ is pragma Preelaborate; procedure Connect_External_Interrupt; function Interrupt_Line_Number return STM32GD.EXTI.External_Line_Number; procedure Configure_Trigger (Trigger : STM32GD.EXTI.External_Triggers); procedure Wait_For_Trigger; procedure Clear_Trigger; function Triggered return Boolean; procedure Cancel_Wait; end STM32GD.GPIO.IRQ;
charlie5/aIDE
Ada
94
adb
package body aIDE.Palette is procedure dummy is begin null; end dummy; end aIDE.Palette;
ekoeppen/MSP430_Generic_Ada_Drivers
Ada
1,369
ads
-- This spec has been automatically generated from msp430g2553.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- TLV Calibration Data package MSP430_SVD.TLV_CALIBRATION_DATA is pragma Preelaborate; --------------- -- Registers -- --------------- ----------------- -- Peripherals -- ----------------- -- TLV Calibration Data type TLV_CALIBRATION_DATA_Peripheral is record -- TLV CHECK SUM TLV_CHECKSUM : aliased MSP430_SVD.UInt16; -- TLV ADC10_1 TAG TLV_ADC10_1_TAG : aliased MSP430_SVD.Byte; -- TLV ADC10_1 LEN TLV_ADC10_1_LEN : aliased MSP430_SVD.Byte; -- TLV TAG_DCO30 TAG TLV_DCO_30_TAG : aliased MSP430_SVD.Byte; -- TLV TAG_DCO30 LEN TLV_DCO_30_LEN : aliased MSP430_SVD.Byte; end record with Volatile; for TLV_CALIBRATION_DATA_Peripheral use record TLV_CHECKSUM at 16#0# range 0 .. 15; TLV_ADC10_1_TAG at 16#1A# range 0 .. 7; TLV_ADC10_1_LEN at 16#1B# range 0 .. 7; TLV_DCO_30_TAG at 16#36# range 0 .. 7; TLV_DCO_30_LEN at 16#37# range 0 .. 7; end record; -- TLV Calibration Data TLV_CALIBRATION_DATA_Periph : aliased TLV_CALIBRATION_DATA_Peripheral with Import, Address => TLV_CALIBRATION_DATA_Base; end MSP430_SVD.TLV_CALIBRATION_DATA;
usainzg/EHU
Ada
1,575
adb
with Ada.Text_Io; use Ada.Text_Io; procedure Ver_Dar_La_Vuelta is -- salida: 6 strings(SE) -- post: corresponden a cada uno de los casos de pruebas dise�ados. -- pre: { True } function Dar_La_Vuelta ( S : String) return String is -- EJERCICIO 2- ESPECIFICA E IMPLEMENTA recursivamente el subprograma -- Dar_La_Vuelta que devuelve el string inverso de S. BEGIN -- Completar if S'Size <= 1 then return S; end if; return Dar_La_Vuelta(S(S'First + 1 .. S'Last)) & S(S'First); end Dar_La_Vuelta ; -- post: { } begin Put_Line("-------------------------------------"); Put("La palabra vacia dada la vuelta es la vacia: "); Put(Dar_La_Vuelta("")); New_Line; New_Line; New_Line; Put_Line("-------------------------------------"); Put("La palabra de 1 caracter 'a' dada la vuelta es la 'a': "); Put(Dar_La_Vuelta("a")); New_Line; New_Line; New_Line; Put_Line("-------------------------------------"); Put_Line("Palabras de varios caracteres"); Put("-- casaca dada la vuelta es acasac: "); Put(Dar_La_Vuelta("casaca")); New_Line; Put("-- baobab dada la vuelta es baboab: "); Put(Dar_La_Vuelta("baobab")); New_Line; Put("-- alejela dada la vuelta es alejela: "); Put (Dar_La_Vuelta("alejela")); New_Line; Put("-- reconocer dada la vuelta es reconocer: "); Put(Dar_La_Vuelta("reconocer")); New_Line; Put_Line("-------------------------------------"); end Ver_Dar_La_Vuelta;
tum-ei-rcs/StratoX
Ada
4,813
ads
-- Institution: Technische Universität München -- Department: Real-Time Computer Systems (RCS) -- Project: StratoX -- Authors: Martin Becker ([email protected]) with Interfaces; use Interfaces; with HIL; -- @summary -- read/write from/to a non-volatile location. Every "variable" -- has one byte. When the compilation date/time changed, all -- variables are reset to their respective defaults. Otherwise -- NVRAM keeps values across reboot/loss of power. package NVRAM with SPARK_Mode, Abstract_State => Memory_State is procedure Init; -- initialize this module and possibly underlying hardware procedure Self_Check (Status : out Boolean); -- check whether initialization was successful -- List of all variables stored in NVRAM. Add new ones when needed. type Variable_Name is (VAR_MISSIONSTATE, VAR_BOOTCOUNTER, VAR_EXCEPTION_LINE_L, VAR_EXCEPTION_LINE_H, VAR_START_TIME_A, VAR_START_TIME_B, VAR_START_TIME_C, VAR_START_TIME_D, VAR_HOME_HEIGHT_L, VAR_HOME_HEIGHT_H, VAR_GPS_TARGET_LONG_A, VAR_GPS_TARGET_LONG_B, VAR_GPS_TARGET_LONG_C, VAR_GPS_TARGET_LONG_D, VAR_GPS_TARGET_LAT_A, VAR_GPS_TARGET_LAT_B, VAR_GPS_TARGET_LAT_C, VAR_GPS_TARGET_LAT_D, VAR_GPS_TARGET_ALT_A, VAR_GPS_TARGET_ALT_B, VAR_GPS_TARGET_ALT_C, VAR_GPS_TARGET_ALT_D, VAR_GPS_LAST_LONG_A, VAR_GPS_LAST_LONG_B, VAR_GPS_LAST_LONG_C, VAR_GPS_LAST_LONG_D, VAR_GPS_LAST_LAT_A, VAR_GPS_LAST_LAT_B, VAR_GPS_LAST_LAT_C, VAR_GPS_LAST_LAT_D, VAR_GPS_LAST_ALT_A, VAR_GPS_LAST_ALT_B, VAR_GPS_LAST_ALT_C, VAR_GPS_LAST_ALT_D, VAR_GYRO_BIAS_X, VAR_GYRO_BIAS_Y, VAR_GYRO_BIAS_Z ); -- Default values for all variables (obligatory) type Defaults_Table is array (Variable_Name'Range) of HIL.Byte; Variable_Defaults : constant Defaults_Table := (VAR_MISSIONSTATE => 0, VAR_BOOTCOUNTER => 0, VAR_EXCEPTION_LINE_L => 0, VAR_EXCEPTION_LINE_H => 0, VAR_START_TIME_A => 0, VAR_START_TIME_B => 0, VAR_START_TIME_C => 0, VAR_START_TIME_D => 0, VAR_HOME_HEIGHT_L => 0, VAR_HOME_HEIGHT_H => 0, VAR_GPS_TARGET_LONG_A => 0, VAR_GPS_TARGET_LONG_B => 0, VAR_GPS_TARGET_LONG_C => 0, VAR_GPS_TARGET_LONG_D => 0, VAR_GPS_TARGET_LAT_A => 0, VAR_GPS_TARGET_LAT_B => 0, VAR_GPS_TARGET_LAT_C => 0, VAR_GPS_TARGET_LAT_D => 0, VAR_GPS_TARGET_ALT_A => 0, VAR_GPS_TARGET_ALT_B => 0, VAR_GPS_TARGET_ALT_C => 0, VAR_GPS_TARGET_ALT_D => 0, VAR_GPS_LAST_LONG_A => 0, VAR_GPS_LAST_LONG_B => 0, VAR_GPS_LAST_LONG_C => 0, VAR_GPS_LAST_LONG_D => 0, VAR_GPS_LAST_LAT_A => 0, VAR_GPS_LAST_LAT_B => 0, VAR_GPS_LAST_LAT_C => 0, VAR_GPS_LAST_LAT_D => 0, VAR_GPS_LAST_ALT_A => 0, VAR_GPS_LAST_ALT_B => 0, VAR_GPS_LAST_ALT_C => 0, VAR_GPS_LAST_ALT_D => 0, VAR_GYRO_BIAS_X => 20, -- Bias in deci degree VAR_GYRO_BIAS_Y => 26, VAR_GYRO_BIAS_Z => 128-3+128 -- most evil hack ever ); procedure Load (variable : in Variable_Name; data : out HIL.Byte); -- read variable with given name from NVRAM and return value procedure Load (variable : in Variable_Name; data : out Float) with Pre => Variable_Name'Pos (variable) < Variable_Name'Pos (Variable_Name'Last) - 3; -- same, but with Float convenience conversion. Point to first variable of the quadrupel. procedure Store (variable : in Variable_Name; data : in HIL.Byte); -- write variable with given name to NVRAM. procedure Store (variable : in Variable_Name; data : in Float) with Pre => Variable_Name'Pos (variable) < Variable_Name'Pos (Variable_Name'Last) - 3; -- same, but with Float convenience conversion. Point to first variable of the quadrupel. procedure Reset; -- explicit reset of NVRAM to defaults; same effect as re-compiling. end NVRAM;
gerph/PrivateEye
Ada
13,181
adb
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- $Id: test.adb,v 1.1.1.1 2005-10-29 18:01:49 dpt Exp $ -- The program has a few aims. -- 1. Test ZLib.Ada95 thick binding functionality. -- 2. Show the example of use main functionality of the ZLib.Ada95 binding. -- 3. Build this program automatically compile all ZLib.Ada95 packages under -- GNAT Ada95 compiler. with ZLib.Streams; with Ada.Streams.Stream_IO; with Ada.Numerics.Discrete_Random; with Ada.Text_IO; with Ada.Calendar; procedure Test is use Ada.Streams; use Stream_IO; ------------------------------------ -- Test configuration parameters -- ------------------------------------ File_Size : Count := 100_000; Continuous : constant Boolean := False; Header : constant ZLib.Header_Type := ZLib.Default; -- ZLib.None; -- ZLib.Auto; -- ZLib.GZip; -- Do not use Header other then Default in ZLib versions 1.1.4 -- and older. Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy; Init_Random : constant := 10; -- End -- In_File_Name : constant String := "testzlib.in"; -- Name of the input file Z_File_Name : constant String := "testzlib.zlb"; -- Name of the compressed file. Out_File_Name : constant String := "testzlib.out"; -- Name of the decompressed file. File_In : File_Type; File_Out : File_Type; File_Back : File_Type; File_Z : ZLib.Streams.Stream_Type; Filter : ZLib.Filter_Type; Time_Stamp : Ada.Calendar.Time; procedure Generate_File; -- Generate file of spetsified size with some random data. -- The random data is repeatable, for the good compression. procedure Compare_Streams (Left, Right : in out Root_Stream_Type'Class); -- The procedure compearing data in 2 streams. -- It is for compare data before and after compression/decompression. procedure Compare_Files (Left, Right : String); -- Compare files. Based on the Compare_Streams. procedure Copy_Streams (Source, Target : in out Root_Stream_Type'Class; Buffer_Size : in Stream_Element_Offset := 1024); -- Copying data from one stream to another. It is for test stream -- interface of the library. procedure Data_In (Item : out Stream_Element_Array; Last : out Stream_Element_Offset); -- this procedure is for generic instantiation of -- ZLib.Generic_Translate. -- reading data from the File_In. procedure Data_Out (Item : in Stream_Element_Array); -- this procedure is for generic instantiation of -- ZLib.Generic_Translate. -- writing data to the File_Out. procedure Stamp; -- Store the timestamp to the local variable. procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count); -- Print the time statistic with the message. procedure Translate is new ZLib.Generic_Translate (Data_In => Data_In, Data_Out => Data_Out); -- This procedure is moving data from File_In to File_Out -- with compression or decompression, depend on initialization of -- Filter parameter. ------------------- -- Compare_Files -- ------------------- procedure Compare_Files (Left, Right : String) is Left_File, Right_File : File_Type; begin Open (Left_File, In_File, Left); Open (Right_File, In_File, Right); Compare_Streams (Stream (Left_File).all, Stream (Right_File).all); Close (Left_File); Close (Right_File); end Compare_Files; --------------------- -- Compare_Streams -- --------------------- procedure Compare_Streams (Left, Right : in out Ada.Streams.Root_Stream_Type'Class) is Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#); Left_Last, Right_Last : Stream_Element_Offset; begin loop Read (Left, Left_Buffer, Left_Last); Read (Right, Right_Buffer, Right_Last); if Left_Last /= Right_Last then Ada.Text_IO.Put_Line ("Compare error :" & Stream_Element_Offset'Image (Left_Last) & " /= " & Stream_Element_Offset'Image (Right_Last)); raise Constraint_Error; elsif Left_Buffer (0 .. Left_Last) /= Right_Buffer (0 .. Right_Last) then Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal."); raise Constraint_Error; end if; exit when Left_Last < Left_Buffer'Last; end loop; end Compare_Streams; ------------------ -- Copy_Streams -- ------------------ procedure Copy_Streams (Source, Target : in out Ada.Streams.Root_Stream_Type'Class; Buffer_Size : in Stream_Element_Offset := 1024) is Buffer : Stream_Element_Array (1 .. Buffer_Size); Last : Stream_Element_Offset; begin loop Read (Source, Buffer, Last); Write (Target, Buffer (1 .. Last)); exit when Last < Buffer'Last; end loop; end Copy_Streams; ------------- -- Data_In -- ------------- procedure Data_In (Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Read (File_In, Item, Last); end Data_In; -------------- -- Data_Out -- -------------- procedure Data_Out (Item : in Stream_Element_Array) is begin Write (File_Out, Item); end Data_Out; ------------------- -- Generate_File -- ------------------- procedure Generate_File is subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; package Random_Elements is new Ada.Numerics.Discrete_Random (Visible_Symbols); Gen : Random_Elements.Generator; Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10; Buffer_Count : constant Count := File_Size / Buffer'Length; -- Number of same buffers in the packet. Density : constant Count := 30; -- from 0 to Buffer'Length - 2; procedure Fill_Buffer (J, D : in Count); -- Change the part of the buffer. ----------------- -- Fill_Buffer -- ----------------- procedure Fill_Buffer (J, D : in Count) is begin for K in 0 .. D loop Buffer (Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1)) := Random_Elements.Random (Gen); end loop; end Fill_Buffer; begin Random_Elements.Reset (Gen, Init_Random); Create (File_In, Out_File, In_File_Name); Fill_Buffer (1, Buffer'Length - 2); for J in 1 .. Buffer_Count loop Write (File_In, Buffer); Fill_Buffer (J, Density); end loop; -- fill remain size. Write (File_In, Buffer (1 .. Stream_Element_Offset (File_Size - Buffer'Length * Buffer_Count))); Flush (File_In); Close (File_In); end Generate_File; --------------------- -- Print_Statistic -- --------------------- procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is use Ada.Calendar; use Ada.Text_IO; package Count_IO is new Integer_IO (ZLib.Count); Curr_Dur : Duration := Clock - Time_Stamp; begin Put (Msg); Set_Col (20); Ada.Text_IO.Put ("size ="); Count_IO.Put (Data_Size, Width => Stream_IO.Count'Image (File_Size)'Length); Put_Line (" duration =" & Duration'Image (Curr_Dur)); end Print_Statistic; ----------- -- Stamp -- ----------- procedure Stamp is begin Time_Stamp := Ada.Calendar.Clock; end Stamp; begin Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version); loop Generate_File; for Level in ZLib.Compression_Level'Range loop Ada.Text_IO.Put_Line ("Level =" & ZLib.Compression_Level'Image (Level)); -- Test generic interface. Open (File_In, In_File, In_File_Name); Create (File_Out, Out_File, Z_File_Name); Stamp; -- Deflate using generic instantiation. ZLib.Deflate_Init (Filter => Filter, Level => Level, Strategy => Strategy, Header => Header); Translate (Filter); Print_Statistic ("Generic compress", ZLib.Total_Out (Filter)); ZLib.Close (Filter); Close (File_In); Close (File_Out); Open (File_In, In_File, Z_File_Name); Create (File_Out, Out_File, Out_File_Name); Stamp; -- Inflate using generic instantiation. ZLib.Inflate_Init (Filter, Header => Header); Translate (Filter); Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter)); ZLib.Close (Filter); Close (File_In); Close (File_Out); Compare_Files (In_File_Name, Out_File_Name); -- Test stream interface. -- Compress to the back stream. Open (File_In, In_File, In_File_Name); Create (File_Back, Out_File, Z_File_Name); Stamp; ZLib.Streams.Create (Stream => File_Z, Mode => ZLib.Streams.Out_Stream, Back => ZLib.Streams.Stream_Access (Stream (File_Back)), Back_Compressed => True, Level => Level, Strategy => Strategy, Header => Header); Copy_Streams (Source => Stream (File_In).all, Target => File_Z); -- Flushing internal buffers to the back stream. ZLib.Streams.Flush (File_Z, ZLib.Finish); Print_Statistic ("Write compress", ZLib.Streams.Write_Total_Out (File_Z)); ZLib.Streams.Close (File_Z); Close (File_In); Close (File_Back); -- Compare reading from original file and from -- decompression stream. Open (File_In, In_File, In_File_Name); Open (File_Back, In_File, Z_File_Name); ZLib.Streams.Create (Stream => File_Z, Mode => ZLib.Streams.In_Stream, Back => ZLib.Streams.Stream_Access (Stream (File_Back)), Back_Compressed => True, Header => Header); Stamp; Compare_Streams (Stream (File_In).all, File_Z); Print_Statistic ("Read decompress", ZLib.Streams.Read_Total_Out (File_Z)); ZLib.Streams.Close (File_Z); Close (File_In); Close (File_Back); -- Compress by reading from compression stream. Open (File_Back, In_File, In_File_Name); Create (File_Out, Out_File, Z_File_Name); ZLib.Streams.Create (Stream => File_Z, Mode => ZLib.Streams.In_Stream, Back => ZLib.Streams.Stream_Access (Stream (File_Back)), Back_Compressed => False, Level => Level, Strategy => Strategy, Header => Header); Stamp; Copy_Streams (Source => File_Z, Target => Stream (File_Out).all); Print_Statistic ("Read compress", ZLib.Streams.Read_Total_Out (File_Z)); ZLib.Streams.Close (File_Z); Close (File_Out); Close (File_Back); -- Decompress to decompression stream. Open (File_In, In_File, Z_File_Name); Create (File_Back, Out_File, Out_File_Name); ZLib.Streams.Create (Stream => File_Z, Mode => ZLib.Streams.Out_Stream, Back => ZLib.Streams.Stream_Access (Stream (File_Back)), Back_Compressed => False, Header => Header); Stamp; Copy_Streams (Source => Stream (File_In).all, Target => File_Z); Print_Statistic ("Write decompress", ZLib.Streams.Write_Total_Out (File_Z)); ZLib.Streams.Close (File_Z); Close (File_In); Close (File_Back); Compare_Files (In_File_Name, Out_File_Name); end loop; Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok."); exit when not Continuous; File_Size := File_Size + 1; end loop; end Test;
zhmu/ananas
Ada
2,826
ads
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.STRINGS.BOUNDED.HASH_CASE_INSENSITIVE -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-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/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with Ada.Containers; generic with package Bounded is new Ada.Strings.Bounded.Generic_Bounded_Length (<>); function Ada.Strings.Bounded.Hash_Case_Insensitive (Key : Bounded.Bounded_String) return Containers.Hash_Type; pragma Preelaborate (Ada.Strings.Bounded.Hash_Case_Insensitive);
godunko/adagl
Ada
6,048
adb
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Examples Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2018, 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. -- -- -- ------------------------------------------------------------------------------ with League.Characters.Latin; with League.Strings; package body Pyramid.Programs is use type League.Strings.Universal_String; Text_V : League.Strings.Universal_String := League.Strings.To_Universal_String ("#version 130") & League.Characters.Latin.Line_Feed & "in vec3 vp;" & "in vec2 tc;" & "out vec2 TexCoord0;" & "void main() {" & " gl_Position = vec4(vp, 1.0);" & " TexCoord0 = tc;" & "}"; Text_F : League.Strings.Universal_String := League.Strings.To_Universal_String ("#version 130") & League.Characters.Latin.Line_Feed & "in vec2 TexCoord0;" & "out vec4 frag_colour;" & "uniform sampler2D gSampler;" & "void main() {" & " frag_colour = texture2D(gSampler, TexCoord0.xy) +vec4(0.0, 0.0, 0.2, 0.2);" & "}"; GS : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("gSampler"); VP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("vp"); TC : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("tc"); ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Pyramid_Program'Class) is begin Self.Add_Shader_From_Source_Code (OpenGL.Vertex, Text_V); Self.Add_Shader_From_Source_Code (OpenGL.Fragment, Text_F); end Initialize; ---------- -- Link -- ---------- overriding function Link (Self : in out Pyramid_Program) return Boolean is begin if not OpenGL.Programs.OpenGL_Program (Self).Link then return False; end if; Self.GS := Self.Uniform_Location (GS); Self.VP := Self.Attribute_Location (VP); Self.TC := Self.Attribute_Location (TC); return True; end Link; ---------------------- -- Set_Texture_Unit -- ---------------------- procedure Set_Texture_Unit (Self : in out Pyramid_Program'Class; Unit : OpenGL.Texture_Unit) is begin Self.Set_Uniform_Value (Self.GS, Unit); end Set_Texture_Unit; ---------------------------- -- Set_Vertex_Data_Buffer -- ---------------------------- procedure Set_Vertex_Data_Buffer (Self : in out Pyramid_Program'Class; Buffer : Vertex_Data_Buffers.OpenGL_Buffer'Class) is Dummy : Vertex_Data; begin Self.Enable_Attribute_Array (Self.VP); Self.Enable_Attribute_Array (Self.TC); Self.Set_Attribute_Buffer (Location => Self.VP, Data_Type => OpenGL.GL_FLOAT, Tuple_Size => Dummy.VP'Length, Offset => Dummy.VP'Position, Stride => Vertex_Data_Buffers.Stride); Self.Set_Attribute_Buffer (Location => Self.TC, Data_Type => OpenGL.GL_FLOAT, Tuple_Size => Dummy.TC'Length, Offset => Dummy.TC'Position, Stride => Vertex_Data_Buffers.Stride); end Set_Vertex_Data_Buffer; end Pyramid.Programs;
joakim-strandberg/wayland_ada_binding
Ada
1,559
adb
package body C_Binding.Linux.Text_IO is New_Line : constant String := (1 => Character'Val (10)); procedure Put_Line (Text : String) is SSize : SSize_Type; pragma Unreferenced (SSize); begin SSize := C_Write (File_Descriptor => STDOUT_FILENO, Buffer => Text, Count => Text'Length); SSize := C_Write (File_Descriptor => STDOUT_FILENO, Buffer => New_Line, Count => 1); end Put_Line; procedure Put (Text : String) is SSize : SSize_Type; pragma Unreferenced (SSize); begin SSize := C_Write (File_Descriptor => STDOUT_FILENO, Buffer => Text, Count => Text'Length); end Put; function Get_Line return String is SSize : SSize_Type; B : Ada.Streams.Stream_Element_Array (1..200); begin SSize := C_Read (File_Descriptor => STDIN_FILENO, Buffer => B, Count => Size_Type (200)); if SSize > 1 then declare S : String (1..Integer (SSize)); begin for I in Integer range 1..Integer (SSize) loop S (I) := Character'Val (B (Ada.Streams.Stream_Element_Offset (I))); end loop; return S (1..Integer (SSize - 1)); end; else return ""; end if; end Get_Line; end C_Binding.Linux.Text_IO;
persan/AUnit-addons
Ada
239
ads
with AUnit.Test_Cases; package Tc2 is type Test_Case is new AUnit.Test_Cases.Test_Case with null record; function Name (Test : Test_Case) return AUnit.Message_String; procedure Register_Tests (Test : in out Test_Case); end Tc2;
reznikmm/matreshka
Ada
4,712
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Use_Last_Column_Styles_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Use_Last_Column_Styles_Attribute_Node is begin return Self : Table_Use_Last_Column_Styles_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Use_Last_Column_Styles_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Use_Last_Column_Styles_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Use_Last_Column_Styles_Attribute, Table_Use_Last_Column_Styles_Attribute_Node'Tag); end Matreshka.ODF_Table.Use_Last_Column_Styles_Attributes;
reznikmm/matreshka
Ada
27,502
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.CMOF_Metamodel.Properties is procedure Initialize; private procedure Initialize_1; procedure Initialize_2; procedure Initialize_3; procedure Initialize_4; procedure Initialize_5; procedure Initialize_6; procedure Initialize_7; procedure Initialize_8; procedure Initialize_9; procedure Initialize_10; procedure Initialize_11; procedure Initialize_12; procedure Initialize_13; procedure Initialize_14; procedure Initialize_15; procedure Initialize_16; procedure Initialize_17; procedure Initialize_18; procedure Initialize_19; procedure Initialize_20; procedure Initialize_21; procedure Initialize_22; procedure Initialize_23; procedure Initialize_24; procedure Initialize_25; procedure Initialize_26; procedure Initialize_27; procedure Initialize_28; procedure Initialize_29; procedure Initialize_30; procedure Initialize_31; procedure Initialize_32; procedure Initialize_33; procedure Initialize_34; procedure Initialize_35; procedure Initialize_36; procedure Initialize_37; procedure Initialize_38; procedure Initialize_39; procedure Initialize_40; procedure Initialize_41; procedure Initialize_42; procedure Initialize_43; procedure Initialize_44; procedure Initialize_45; procedure Initialize_46; procedure Initialize_47; procedure Initialize_48; procedure Initialize_49; procedure Initialize_50; procedure Initialize_51; procedure Initialize_52; procedure Initialize_53; procedure Initialize_54; procedure Initialize_55; procedure Initialize_56; procedure Initialize_57; procedure Initialize_58; procedure Initialize_59; procedure Initialize_60; procedure Initialize_61; procedure Initialize_62; procedure Initialize_63; procedure Initialize_64; procedure Initialize_65; procedure Initialize_66; procedure Initialize_67; procedure Initialize_68; procedure Initialize_69; procedure Initialize_70; procedure Initialize_71; procedure Initialize_72; procedure Initialize_73; procedure Initialize_74; procedure Initialize_75; procedure Initialize_76; procedure Initialize_77; procedure Initialize_78; procedure Initialize_79; procedure Initialize_80; procedure Initialize_81; procedure Initialize_82; procedure Initialize_83; procedure Initialize_84; procedure Initialize_85; procedure Initialize_86; procedure Initialize_87; procedure Initialize_88; procedure Initialize_89; procedure Initialize_90; procedure Initialize_91; procedure Initialize_92; procedure Initialize_93; procedure Initialize_94; procedure Initialize_95; procedure Initialize_96; procedure Initialize_97; procedure Initialize_98; procedure Initialize_99; procedure Initialize_100; procedure Initialize_101; procedure Initialize_102; procedure Initialize_103; procedure Initialize_104; procedure Initialize_105; procedure Initialize_106; procedure Initialize_107; procedure Initialize_108; procedure Initialize_109; procedure Initialize_110; procedure Initialize_111; procedure Initialize_112; procedure Initialize_113; procedure Initialize_114; procedure Initialize_115; procedure Initialize_116; procedure Initialize_117; procedure Initialize_118; procedure Initialize_119; procedure Initialize_120; procedure Initialize_121; procedure Initialize_122; procedure Initialize_123; procedure Initialize_124; procedure Initialize_125; procedure Initialize_126; procedure Initialize_127; procedure Initialize_128; procedure Initialize_129; procedure Initialize_130; procedure Initialize_131; procedure Initialize_132; procedure Initialize_133; procedure Initialize_134; procedure Initialize_135; procedure Initialize_136; procedure Initialize_137; procedure Initialize_138; procedure Initialize_139; procedure Initialize_140; procedure Initialize_141; procedure Initialize_142; procedure Initialize_143; procedure Initialize_144; procedure Initialize_145; procedure Initialize_146; procedure Initialize_147; procedure Initialize_148; procedure Initialize_149; procedure Initialize_150; procedure Initialize_151; procedure Initialize_152; procedure Initialize_153; procedure Initialize_154; procedure Initialize_155; procedure Initialize_156; procedure Initialize_157; procedure Initialize_158; procedure Initialize_159; procedure Initialize_160; procedure Initialize_161; procedure Initialize_162; procedure Initialize_163; procedure Initialize_164; procedure Initialize_165; procedure Initialize_166; procedure Initialize_167; procedure Initialize_168; procedure Initialize_169; procedure Initialize_170; procedure Initialize_171; procedure Initialize_172; procedure Initialize_173; procedure Initialize_174; procedure Initialize_175; procedure Initialize_176; procedure Initialize_177; procedure Initialize_178; procedure Initialize_179; procedure Initialize_180; procedure Initialize_181; procedure Initialize_182; procedure Initialize_183; procedure Initialize_184; procedure Initialize_185; procedure Initialize_186; procedure Initialize_187; procedure Initialize_188; procedure Initialize_189; procedure Initialize_190; procedure Initialize_191; procedure Initialize_192; procedure Initialize_193; procedure Initialize_194; procedure Initialize_195; procedure Initialize_196; procedure Initialize_197; procedure Initialize_198; procedure Initialize_199; procedure Initialize_200; procedure Initialize_201; procedure Initialize_202; procedure Initialize_203; procedure Initialize_204; procedure Initialize_205; procedure Initialize_206; procedure Initialize_207; procedure Initialize_208; procedure Initialize_209; procedure Initialize_210; procedure Initialize_211; procedure Initialize_212; procedure Initialize_213; procedure Initialize_214; procedure Initialize_215; procedure Initialize_216; procedure Initialize_217; procedure Initialize_218; procedure Initialize_219; procedure Initialize_220; procedure Initialize_221; procedure Initialize_222; procedure Initialize_223; procedure Initialize_224; procedure Initialize_225; procedure Initialize_226; procedure Initialize_227; procedure Initialize_228; procedure Initialize_229; procedure Initialize_230; procedure Initialize_231; procedure Initialize_232; procedure Initialize_233; procedure Initialize_234; procedure Initialize_235; procedure Initialize_236; procedure Initialize_237; procedure Initialize_238; procedure Initialize_239; procedure Initialize_240; procedure Initialize_241; procedure Initialize_242; procedure Initialize_243; procedure Initialize_244; procedure Initialize_245; procedure Initialize_246; procedure Initialize_247; procedure Initialize_248; procedure Initialize_249; procedure Initialize_250; procedure Initialize_251; procedure Initialize_252; procedure Initialize_253; procedure Initialize_254; procedure Initialize_255; procedure Initialize_256; procedure Initialize_257; procedure Initialize_258; procedure Initialize_259; procedure Initialize_260; procedure Initialize_261; procedure Initialize_262; procedure Initialize_263; procedure Initialize_264; procedure Initialize_265; procedure Initialize_266; procedure Initialize_267; procedure Initialize_268; procedure Initialize_269; procedure Initialize_270; procedure Initialize_271; procedure Initialize_272; procedure Initialize_273; procedure Initialize_274; procedure Initialize_275; procedure Initialize_276; procedure Initialize_277; procedure Initialize_278; procedure Initialize_279; procedure Initialize_280; procedure Initialize_281; procedure Initialize_282; procedure Initialize_283; procedure Initialize_284; procedure Initialize_285; procedure Initialize_286; procedure Initialize_287; procedure Initialize_288; procedure Initialize_289; procedure Initialize_290; procedure Initialize_291; procedure Initialize_292; procedure Initialize_293; procedure Initialize_294; procedure Initialize_295; procedure Initialize_296; procedure Initialize_297; procedure Initialize_298; procedure Initialize_299; procedure Initialize_300; procedure Initialize_301; procedure Initialize_302; procedure Initialize_303; procedure Initialize_304; procedure Initialize_305; procedure Initialize_306; procedure Initialize_307; procedure Initialize_308; procedure Initialize_309; procedure Initialize_310; procedure Initialize_311; procedure Initialize_312; procedure Initialize_313; procedure Initialize_314; procedure Initialize_315; procedure Initialize_316; procedure Initialize_317; procedure Initialize_318; procedure Initialize_319; procedure Initialize_320; procedure Initialize_321; procedure Initialize_322; procedure Initialize_323; procedure Initialize_324; procedure Initialize_325; procedure Initialize_326; procedure Initialize_327; procedure Initialize_328; procedure Initialize_329; procedure Initialize_330; procedure Initialize_331; procedure Initialize_332; procedure Initialize_333; procedure Initialize_334; procedure Initialize_335; procedure Initialize_336; procedure Initialize_337; procedure Initialize_338; procedure Initialize_339; procedure Initialize_340; procedure Initialize_341; procedure Initialize_342; procedure Initialize_343; procedure Initialize_344; procedure Initialize_345; procedure Initialize_346; procedure Initialize_347; procedure Initialize_348; procedure Initialize_349; procedure Initialize_350; procedure Initialize_351; procedure Initialize_352; procedure Initialize_353; procedure Initialize_354; procedure Initialize_355; procedure Initialize_356; procedure Initialize_357; procedure Initialize_358; procedure Initialize_359; procedure Initialize_360; procedure Initialize_361; procedure Initialize_362; procedure Initialize_363; procedure Initialize_364; procedure Initialize_365; procedure Initialize_366; procedure Initialize_367; procedure Initialize_368; procedure Initialize_369; procedure Initialize_370; procedure Initialize_371; procedure Initialize_372; procedure Initialize_373; procedure Initialize_374; procedure Initialize_375; procedure Initialize_376; procedure Initialize_377; procedure Initialize_378; procedure Initialize_379; procedure Initialize_380; procedure Initialize_381; procedure Initialize_382; procedure Initialize_383; procedure Initialize_384; procedure Initialize_385; procedure Initialize_386; procedure Initialize_387; procedure Initialize_388; procedure Initialize_389; procedure Initialize_390; procedure Initialize_391; procedure Initialize_392; procedure Initialize_393; procedure Initialize_394; procedure Initialize_395; procedure Initialize_396; procedure Initialize_397; procedure Initialize_398; procedure Initialize_399; procedure Initialize_400; procedure Initialize_401; procedure Initialize_402; procedure Initialize_403; procedure Initialize_404; procedure Initialize_405; procedure Initialize_406; procedure Initialize_407; procedure Initialize_408; procedure Initialize_409; procedure Initialize_410; procedure Initialize_411; procedure Initialize_412; procedure Initialize_413; procedure Initialize_414; procedure Initialize_415; procedure Initialize_416; procedure Initialize_417; procedure Initialize_418; procedure Initialize_419; procedure Initialize_420; procedure Initialize_421; procedure Initialize_422; procedure Initialize_423; procedure Initialize_424; procedure Initialize_425; procedure Initialize_426; procedure Initialize_427; procedure Initialize_428; procedure Initialize_429; procedure Initialize_430; procedure Initialize_431; procedure Initialize_432; procedure Initialize_433; procedure Initialize_434; procedure Initialize_435; procedure Initialize_436; procedure Initialize_437; procedure Initialize_438; procedure Initialize_439; procedure Initialize_440; procedure Initialize_441; procedure Initialize_442; procedure Initialize_443; procedure Initialize_444; procedure Initialize_445; procedure Initialize_446; procedure Initialize_447; procedure Initialize_448; procedure Initialize_449; procedure Initialize_450; procedure Initialize_451; procedure Initialize_452; procedure Initialize_453; procedure Initialize_454; procedure Initialize_455; procedure Initialize_456; procedure Initialize_457; procedure Initialize_458; procedure Initialize_459; procedure Initialize_460; procedure Initialize_461; procedure Initialize_462; procedure Initialize_463; procedure Initialize_464; procedure Initialize_465; procedure Initialize_466; procedure Initialize_467; procedure Initialize_468; procedure Initialize_469; procedure Initialize_470; procedure Initialize_471; procedure Initialize_472; procedure Initialize_473; procedure Initialize_474; procedure Initialize_475; procedure Initialize_476; procedure Initialize_477; procedure Initialize_478; procedure Initialize_479; procedure Initialize_480; procedure Initialize_481; procedure Initialize_482; procedure Initialize_483; procedure Initialize_484; procedure Initialize_485; procedure Initialize_486; procedure Initialize_487; procedure Initialize_488; procedure Initialize_489; procedure Initialize_490; procedure Initialize_491; procedure Initialize_492; procedure Initialize_493; procedure Initialize_494; procedure Initialize_495; procedure Initialize_496; procedure Initialize_497; procedure Initialize_498; procedure Initialize_499; procedure Initialize_500; procedure Initialize_501; procedure Initialize_502; procedure Initialize_503; procedure Initialize_504; procedure Initialize_505; procedure Initialize_506; procedure Initialize_507; procedure Initialize_508; procedure Initialize_509; procedure Initialize_510; procedure Initialize_511; procedure Initialize_512; procedure Initialize_513; procedure Initialize_514; procedure Initialize_515; procedure Initialize_516; procedure Initialize_517; procedure Initialize_518; procedure Initialize_519; procedure Initialize_520; procedure Initialize_521; procedure Initialize_522; procedure Initialize_523; procedure Initialize_524; procedure Initialize_525; procedure Initialize_526; procedure Initialize_527; procedure Initialize_528; procedure Initialize_529; procedure Initialize_530; procedure Initialize_531; procedure Initialize_532; procedure Initialize_533; procedure Initialize_534; procedure Initialize_535; procedure Initialize_536; procedure Initialize_537; procedure Initialize_538; procedure Initialize_539; procedure Initialize_540; procedure Initialize_541; procedure Initialize_542; procedure Initialize_543; procedure Initialize_544; procedure Initialize_545; procedure Initialize_546; procedure Initialize_547; procedure Initialize_548; procedure Initialize_549; procedure Initialize_550; procedure Initialize_551; procedure Initialize_552; procedure Initialize_553; procedure Initialize_554; procedure Initialize_555; procedure Initialize_556; procedure Initialize_557; procedure Initialize_558; procedure Initialize_559; procedure Initialize_560; procedure Initialize_561; procedure Initialize_562; procedure Initialize_563; procedure Initialize_564; procedure Initialize_565; procedure Initialize_566; procedure Initialize_567; procedure Initialize_568; procedure Initialize_569; procedure Initialize_570; procedure Initialize_571; procedure Initialize_572; procedure Initialize_573; procedure Initialize_574; procedure Initialize_575; procedure Initialize_576; procedure Initialize_577; procedure Initialize_578; procedure Initialize_579; procedure Initialize_580; procedure Initialize_581; procedure Initialize_582; procedure Initialize_583; procedure Initialize_584; procedure Initialize_585; procedure Initialize_586; procedure Initialize_587; procedure Initialize_588; procedure Initialize_589; procedure Initialize_590; procedure Initialize_591; procedure Initialize_592; procedure Initialize_593; procedure Initialize_594; procedure Initialize_595; procedure Initialize_596; procedure Initialize_597; procedure Initialize_598; procedure Initialize_599; procedure Initialize_600; procedure Initialize_601; procedure Initialize_602; procedure Initialize_603; procedure Initialize_604; procedure Initialize_605; procedure Initialize_606; procedure Initialize_607; procedure Initialize_608; procedure Initialize_609; procedure Initialize_610; procedure Initialize_611; procedure Initialize_612; procedure Initialize_613; procedure Initialize_614; procedure Initialize_615; procedure Initialize_616; procedure Initialize_617; procedure Initialize_618; procedure Initialize_619; procedure Initialize_620; procedure Initialize_621; procedure Initialize_622; procedure Initialize_623; procedure Initialize_624; procedure Initialize_625; procedure Initialize_626; procedure Initialize_627; procedure Initialize_628; procedure Initialize_629; procedure Initialize_630; procedure Initialize_631; procedure Initialize_632; procedure Initialize_633; procedure Initialize_634; procedure Initialize_635; procedure Initialize_636; procedure Initialize_637; procedure Initialize_638; procedure Initialize_639; procedure Initialize_640; procedure Initialize_641; procedure Initialize_642; procedure Initialize_643; procedure Initialize_644; procedure Initialize_645; procedure Initialize_646; procedure Initialize_647; procedure Initialize_648; procedure Initialize_649; procedure Initialize_650; procedure Initialize_651; procedure Initialize_652; procedure Initialize_653; procedure Initialize_654; procedure Initialize_655; procedure Initialize_656; procedure Initialize_657; procedure Initialize_658; procedure Initialize_659; procedure Initialize_660; procedure Initialize_661; procedure Initialize_662; procedure Initialize_663; procedure Initialize_664; procedure Initialize_665; procedure Initialize_666; procedure Initialize_667; procedure Initialize_668; procedure Initialize_669; procedure Initialize_670; procedure Initialize_671; procedure Initialize_672; procedure Initialize_673; procedure Initialize_674; procedure Initialize_675; procedure Initialize_676; procedure Initialize_677; procedure Initialize_678; procedure Initialize_679; procedure Initialize_680; procedure Initialize_681; procedure Initialize_682; procedure Initialize_683; procedure Initialize_684; procedure Initialize_685; procedure Initialize_686; procedure Initialize_687; procedure Initialize_688; procedure Initialize_689; procedure Initialize_690; procedure Initialize_691; procedure Initialize_692; procedure Initialize_693; procedure Initialize_694; procedure Initialize_695; procedure Initialize_696; procedure Initialize_697; procedure Initialize_698; procedure Initialize_699; procedure Initialize_700; procedure Initialize_701; procedure Initialize_702; procedure Initialize_703; procedure Initialize_704; procedure Initialize_705; procedure Initialize_706; procedure Initialize_707; procedure Initialize_708; procedure Initialize_709; procedure Initialize_710; procedure Initialize_711; procedure Initialize_712; procedure Initialize_713; procedure Initialize_714; procedure Initialize_715; procedure Initialize_716; procedure Initialize_717; procedure Initialize_718; procedure Initialize_719; procedure Initialize_720; procedure Initialize_721; procedure Initialize_722; procedure Initialize_723; procedure Initialize_724; procedure Initialize_725; procedure Initialize_726; procedure Initialize_727; procedure Initialize_728; procedure Initialize_729; procedure Initialize_730; procedure Initialize_731; procedure Initialize_732; procedure Initialize_733; procedure Initialize_734; procedure Initialize_735; procedure Initialize_736; procedure Initialize_737; procedure Initialize_738; procedure Initialize_739; procedure Initialize_740; procedure Initialize_741; procedure Initialize_742; procedure Initialize_743; procedure Initialize_744; procedure Initialize_745; procedure Initialize_746; procedure Initialize_747; procedure Initialize_748; procedure Initialize_749; procedure Initialize_750; procedure Initialize_751; procedure Initialize_752; procedure Initialize_753; procedure Initialize_754; procedure Initialize_755; procedure Initialize_756; procedure Initialize_757; procedure Initialize_758; procedure Initialize_759; procedure Initialize_760; procedure Initialize_761; procedure Initialize_762; procedure Initialize_763; procedure Initialize_764; procedure Initialize_765; procedure Initialize_766; procedure Initialize_767; procedure Initialize_768; procedure Initialize_769; procedure Initialize_770; procedure Initialize_771; procedure Initialize_772; procedure Initialize_773; procedure Initialize_774; procedure Initialize_775; procedure Initialize_776; procedure Initialize_777; procedure Initialize_778; procedure Initialize_779; procedure Initialize_780; procedure Initialize_781; procedure Initialize_782; procedure Initialize_783; procedure Initialize_784; procedure Initialize_785; procedure Initialize_786; procedure Initialize_787; procedure Initialize_788; procedure Initialize_789; procedure Initialize_790; procedure Initialize_791; procedure Initialize_792; procedure Initialize_793; procedure Initialize_794; procedure Initialize_795; procedure Initialize_796; procedure Initialize_797; procedure Initialize_798; procedure Initialize_799; procedure Initialize_800; end AMF.Internals.Tables.CMOF_Metamodel.Properties;
xuedong/programming-language-learning
Ada
96
adb
with Ada.Text_IO; procedure Hello is begin Ada.Text_IO.Put_Line("Hello World!"); end Hello;
persan/AdaYaml
Ada
818
adb
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Yaml.Lexer.Buffering_Test; with Yaml.Lexer.Tokenization_Test; with Yaml.Parser.Event_Test; package body Yaml.Loading_Tests.Suite is Result : aliased AUnit.Test_Suites.Test_Suite; Buffering_TC : aliased Lexer.Buffering_Test.TC; Tokenization_TC : aliased Lexer.Tokenization_Test.TC; Event_TC : aliased Parser.Event_Test.TC; function Suite return AUnit.Test_Suites.Access_Test_Suite is begin AUnit.Test_Suites.Add_Test (Result'Access, Buffering_TC'Access); AUnit.Test_Suites.Add_Test (Result'Access, Tokenization_TC'Access); AUnit.Test_Suites.Add_Test (Result'Access, Event_TC'Access); return Result'Access; end Suite; end Yaml.Loading_Tests.Suite;
AdaCore/libadalang
Ada
205
adb
procedure Qual is type Code is (Fix, Cla, Dec, Tnz, Sub); begin for J in Code'(Fix) .. Code'(Sub) loop null; end loop; --% [x.p_is_constant for x in node.findall(lal.QualExpr)] end Qual;
AdaCore/gpr
Ada
3,737
ads
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- -- Handles log messages with GPR2.Source_Reference; package GPR2.Message is type Level_Value is (Information, Warning, Error, Lint); type Status_Type is (Read, Unread); -- Read/Unread status for the messages. This is used for example by the Log -- to be able to retrieve only the new unread messages. type Object is tagged private; function Create (Level : Level_Value; Message : String; Sloc : Source_Reference.Object'Class; Indent : Natural := 0) return Object with Pre => Sloc.Is_Defined, Post => Create'Result.Status = Unread; -- Constructor for a log message. -- Raw parameter mean that message should be displayed as is, without -- source reference. Undefined : constant Object; -- This constant is equal to any object declared without an explicit -- initializer. function Is_Defined (Self : Object) return Boolean; -- Returns true if Self is defined function Level (Self : Object) return Level_Value with Inline, Pre => Self.Is_Defined; -- Returns the message level associated with the message function Status (Self : Object) return Status_Type with Inline, Pre => Self.Is_Defined; -- Returns the status for the message function Message (Self : Object) return String with Inline, Pre => Self.Is_Defined; -- Returns the message itself function Sloc (Self : Object) return Source_Reference.Object with Inline, Pre => Self.Is_Defined; -- Returns the actual source reference associated with this message type Level_Format is (None, Short, Long); -- None : no output of level information in message -- Short : short output of level, I, W, E -- Long : long output of level (info, warning, error) type Level_Output is array (Level_Value) of Level_Format; -- Control all level output function Format (Self : Object; Full_Path_Name : Boolean := False; Levels : Level_Output := (Long, Long, Long, Long)) return String with Pre => Self.Is_Defined; -- Returns the message with a standard message as expected by compiler -- tools: <filename>:<line>:<col>: <message> -- <filename> format controlled by Full_Path_Name parameter. Default False -- is for simple file name, True is for full path name format. procedure Output (Self : Object; Full_Path_Name : Boolean := False; Levels : Level_Output := (Long, Long, Long, Long)) with Pre => Self.Is_Defined; -- Outputs the message to console as expected by compiler -- tools: <filename>:<line>:<col>: <message> -- <filename> format controlled by Full_Path_Name parameter. Default False -- is for simple file name, True is for full path name format. -- Errors and Warnings messages are printed to standard error output, -- informational messages are printed to standard output. procedure Set_Status (Self : in out Object; Status : Status_Type) with Pre => Self.Is_Defined, Post => Self.Status = Status; -- Sets message as Read or Unread as specified by Status private type Object is tagged record Level : Level_Value := Warning; Status : Status_Type := Read; Message : Unbounded_String := To_Unbounded_String ((1 => ASCII.NUL)); Sloc : Source_Reference.Object; Indent : Natural := 0; end record with Dynamic_Predicate => Message /= Null_Unbounded_String; Undefined : constant Object := (others => <>); function Is_Defined (Self : Object) return Boolean is (Self /= Undefined); end GPR2.Message;
RREE/ada-util
Ada
3,019
adb
----------------------------------------------------------------------- -- encrypt -- Encrypt file using Util.Streams.AES -- Copyright (C) 2019, 2021 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Command_Line; with Ada.Streams.Stream_IO; with Util.Streams.Files; with Util.Streams.AES; with Util.Encoders.AES; with Util.Encoders.KDF.PBKDF2_HMAC_SHA256; procedure Encrypt is use Util.Encoders.KDF; procedure Crypt_File (Source : in String; Destination : in String; Password : in String); procedure Crypt_File (Source : in String; Destination : in String; Password : in String) is In_Stream : aliased Util.Streams.Files.File_Stream; Out_Stream : aliased Util.Streams.Files.File_Stream; Cipher : aliased Util.Streams.AES.Encoding_Stream; Password_Key : constant Util.Encoders.Secret_Key := Util.Encoders.Create (Password); Salt : constant Util.Encoders.Secret_Key := Util.Encoders.Create ("fake-salt"); Key : Util.Encoders.Secret_Key (Length => Util.Encoders.AES.AES_256_Length); begin -- Generate a derived key from the password. PBKDF2_HMAC_SHA256 (Password => Password_Key, Salt => Salt, Counter => 20000, Result => Key); -- Setup file -> input and cipher -> output file streams. In_Stream.Open (Ada.Streams.Stream_IO.In_File, Source); Out_Stream.Create (Mode => Ada.Streams.Stream_IO.Out_File, Name => Destination); Cipher.Produces (Output => Out_Stream'Access, Size => 32768); Cipher.Set_Key (Secret => Key, Mode => Util.Encoders.AES.ECB); -- Copy input to output through the cipher. Util.Streams.Copy (From => In_Stream, Into => Cipher); end Crypt_File; begin if Ada.Command_Line.Argument_Count /= 3 then Ada.Text_IO.Put_Line ("Usage: encrypt source password destination"); return; end if; Crypt_File (Source => Ada.Command_Line.Argument (1), Destination => Ada.Command_Line.Argument (3), Password => Ada.Command_Line.Argument (2)); end Encrypt;
stcarrez/ada-util
Ada
3,429
ads
----------------------------------------------------------------------- -- util-http-clients-mockups -- HTTP Clients mockups -- Copyright (C) 2011, 2012, 2017, 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. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; package Util.Http.Clients.Mockups is -- Register the Http manager. procedure Register; -- Set the path of the file that contains the response for the next -- <b>Do_Get</b> and <b>Do_Post</b> calls. procedure Set_File (Path : in String); private type File_Http_Manager is new Http_Manager with record File : Ada.Strings.Unbounded.Unbounded_String; end record; type File_Http_Manager_Access is access all File_Http_Manager'Class; overriding procedure Create (Manager : in File_Http_Manager; Http : in out Client'Class); overriding procedure Do_Get (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); overriding procedure Do_Head (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); overriding procedure Do_Post (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class); overriding procedure Do_Put (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class); overriding procedure Do_Patch (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class); overriding procedure Do_Delete (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); overriding procedure Do_Options (Manager : in File_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); -- Set the timeout for the connection. overriding procedure Set_Timeout (Manager : in File_Http_Manager; Http : in Client'Class; Timeout : in Duration); end Util.Http.Clients.Mockups;
ohenley/awt
Ada
6,398
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Streams; with Ada.Unchecked_Conversion; with Wayland.Protocols.Client; with AWT.OS; with AWT.Registry; package body AWT.Clipboard is package WP renames Wayland.Protocols; function "+" (Value : String) return SU.Unbounded_String renames SU.To_Unbounded_String; function "+" (Value : SU.Unbounded_String) return String renames SU.To_String; Global : AWT.Registry.Compositor renames AWT.Registry.Global; Content : SU.Unbounded_String; task Clipboard is entry Send (FD : Wayland.File_Descriptor; Value : SU.Unbounded_String); entry Receive (FD : Wayland.File_Descriptor; CB : not null Receive_Callback); end Clipboard; task body Clipboard is Process_FD : Wayland.File_Descriptor; Process_Value : SU.Unbounded_String; Process_CB : Receive_Callback; begin loop select accept Send (FD : Wayland.File_Descriptor; Value : SU.Unbounded_String) do Process_FD := FD; Process_Value := Value; end Send; declare File : AWT.OS.File (Process_FD); begin File.Write (+Process_Value); File.Close; end; Process_Value := SU.Null_Unbounded_String; or accept Receive (FD : Wayland.File_Descriptor; CB : not null Receive_Callback) do Process_FD := FD; Process_CB := CB; end Receive; declare File : AWT.OS.File (Process_FD); Received_Content : SU.Unbounded_String; begin loop begin declare Result : constant Ada.Streams.Stream_Element_Array := File.Read; subtype Byte_Array is Ada.Streams.Stream_Element_Array (Result'Range); subtype Bytes_String is String (1 .. Result'Length); function Convert is new Ada.Unchecked_Conversion (Source => Byte_Array, Target => Bytes_String); begin exit when Result'Length = 0; SU.Append (Received_Content, Convert (Result)); end; exception when Constraint_Error => File.Close; raise; end; end loop; File.Close; Process_CB (Received_Content); end; or terminate; end select; end loop; end Clipboard; procedure Data_Source_Send (Data_Source : in out WP.Client.Data_Source'Class; Mime_Type : String; FD : Wayland.File_Descriptor) is begin if Mime_Type = AWT.Registry.UTF_8_Mime_Type then Clipboard.Send (FD, Content); -- Do not clear Content here so that we can send the content -- again if requested else declare File : AWT.OS.File (FD); begin File.Close; end; end if; end Data_Source_Send; procedure Data_Source_Cancelled (Data_Source : in out WP.Client.Data_Source'Class) is begin Data_Source.Destroy; Content := +""; end Data_Source_Cancelled; package Data_Source_Events is new WP.Client.Data_Source_Events (Send => Data_Source_Send, Cancelled => Data_Source_Cancelled); procedure Set (Value : String) is begin if Global.Data_Source.Has_Proxy then Global.Data_Source.Destroy; end if; Global.Data_Device_Manager.Create_Data_Source (Global.Data_Source); if not Global.Data_Source.Has_Proxy then raise Internal_Error with "Wayland: Failed to get data source"; end if; Content := +Value; Data_Source_Events.Subscribe (Global.Data_Source); Global.Data_Source.Offer (AWT.Registry.UTF_8_Mime_Type); Global.Seat.Data_Device.Set_Selection (Global.Data_Source, Global.Seat.Keyboard_Enter_Serial); end Set; procedure Get (Callback : not null Receive_Callback) is File_Descriptors : AWT.OS.Pipe; begin if not Global.Seat.Clipboard_Mime_Type_Valid or not Global.Seat.Data_Offer.Has_Proxy then Callback (+""); return; end if; AWT.OS.Create_Pipe (File_Descriptors); Global.Seat.Data_Offer.Receive (AWT.Registry.UTF_8_Mime_Type, File_Descriptors.Write); declare File : AWT.OS.File (File_Descriptors.Write); begin File.Close; end; Global.Display.Roundtrip; Clipboard.Receive (File_Descriptors.Read, Callback); end Get; protected type Receive_Future is procedure Set (Value : SU.Unbounded_String); entry Get (Value : out SU.Unbounded_String); private Content : SU.Unbounded_String; Done : Boolean := False; end Receive_Future; protected body Receive_Future is procedure Set (Value : SU.Unbounded_String) is begin Content := Value; Done := True; end Set; entry Get (Value : out SU.Unbounded_String) when Done is begin Value := Content; Done := False; Content := SU.Null_Unbounded_String; end Get; end Receive_Future; Future : Receive_Future; function Get return String is begin Get (Future.Set'Access); declare Value : SU.Unbounded_String; begin Future.Get (Value); -- The used Data_Offer will be destroyed when a new one comes -- in in AWT.Registry return +Value; end; end Get; end AWT.Clipboard;
michalkonecny/polypaver
Ada
1,563
adb
package body Riemann is function erfRiemann(x : Float; n : Integer) return Float is stepSize : Float; stepStart : Float; valueStart : Float; result : Float; step : Integer; begin stepSize := PolyPaver.Floats.Divide(x,Float(n)); result := 0.0; step := 0; while step < n loop -- for step = 0..(n-1) loop stepStart := -- step * stepSize; PolyPaver.Floats.Multiply(stepSize, Float(step)); --# assert --# PolyPaver.Interval.Contained_In( --# result --# , --# PolyPaver.Exact.Integral(0.0,stepStart,PolyPaver.Exact.Exp(-PolyPaver.Exact.Integration_Variable**2)) --# + --# PolyPaver.Interval.Hull( --# - 0.1*Float(step+1) --# , --# (1.0-PolyPaver.Exact.Exp(-(x * Float(step)/Float(n))**2))*x/Float(n) --# + 0.1*Float(step+1) --# ) --# ) --# and PolyPaver.Floats.Is_Range(result,-10, 100.0) --# and PolyPaver.Integers.Is_Range(n, 1, 100) and PolyPaver.Integers.Is_Range(step, 0, n-1) --# and stepStart = PolyPaver.Floats.Multiply(stepSize, Float(step)) --# and stepSize = PolyPaver.Floats.Divide(x,Float(n)); valueStart := -- valueStart := exp(-(stepStart * stepStart)); PolyPaver.Floats.Exp(-PolyPaver.Floats.Multiply(stepStart,stepStart)); result := -- result + stepSize * valueStart; PolyPaver.Floats.Add(result,PolyPaver.Floats.Multiply(stepSize,valueStart)); step := step + 1; end loop; return result; end erfRiemann; end Riemann;
zhmu/ananas
Ada
3,806
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . V A L _ U N S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains routines for scanning modular Unsigned -- values for use in Text_IO.Modular_IO, and the Value attribute. -- Preconditions in this unit are meant for analysis only, not for run-time -- checking, so that the expected exceptions are raised. This is enforced by -- setting the corresponding assertion policy to Ignore. Postconditions and -- contract cases should not be executed at runtime as well, in order not to -- slow down the execution of these functions. pragma Assertion_Policy (Pre => Ignore, Post => Ignore, Contract_Cases => Ignore, Ghost => Ignore, Subprogram_Variant => Ignore); with System.Unsigned_Types; with System.Value_U; package System.Val_Uns with SPARK_Mode is pragma Preelaborate; subtype Unsigned is Unsigned_Types.Unsigned; package Impl is new Value_U (Unsigned); procedure Scan_Raw_Unsigned (Str : String; Ptr : not null access Integer; Max : Integer; Res : out Unsigned) renames Impl.Scan_Raw_Unsigned; procedure Scan_Unsigned (Str : String; Ptr : not null access Integer; Max : Integer; Res : out Unsigned) renames Impl.Scan_Unsigned; function Value_Unsigned (Str : String) return Unsigned renames Impl.Value_Unsigned; end System.Val_Uns;
reznikmm/matreshka
Ada
4,033
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_Extrusion_Skew_Attributes; package Matreshka.ODF_Draw.Extrusion_Skew_Attributes is type Draw_Extrusion_Skew_Attribute_Node is new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node and ODF.DOM.Draw_Extrusion_Skew_Attributes.ODF_Draw_Extrusion_Skew_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Extrusion_Skew_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Extrusion_Skew_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Draw.Extrusion_Skew_Attributes;
gerr135/ada_composition
Ada
2,156
ads
-- -- This is a "fixed" implementation, as a straight (discriminated) array, no memory management. -- -- Copyright (C) 2019 George Shapovalov <[email protected]> -- -- 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. -- generic type Element_Type is new Element_Interface with private; package Lists.fixed is type List(Last : Index_Base) is new List_Interface with private; -- Last - last index of array, e.g. 1..2 - last:=2; 4..9 - last:=9; -- first index is Index_Type'First overriding function List_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type; overriding function List_Constant_Reference (Container : aliased in List; Index : Index_Type) return Constant_Reference_Type; overriding function List_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type; overriding function List_Reference (Container : aliased in out List; Index : Index_Type) return Reference_Type; overriding function Iterate (Container : in List) return Iterator_Interface'Class; private type Element_Array is array (Index_Type range <>) of aliased Element_Type; type List(Last : Index_Base) is new List_Interface with record data : Element_Array(Index_Type'First .. Last); end record; function Has_Element (L : List; Position : Index_Base) return Boolean; -- here we also need to implement Reversible_Iterator interface type Iterator is new Iterator_Interface with record Container : List_Access; Index : Index_Type'Base; end record; overriding function First (Object : Iterator) return Cursor; overriding function Last (Object : Iterator) return Cursor; overriding function Next (Object : Iterator; Position : Cursor) return Cursor; overriding function Previous (Object : Iterator; Position : Cursor) return Cursor; end Lists.fixed;
DrenfongWong/tkm-rpc
Ada
2,182
adb
with Tkmrpc.Servers.Ike; with Tkmrpc.Results; with Tkmrpc.Request.Ike.Isa_Create_Child.Convert; with Tkmrpc.Response.Ike.Isa_Create_Child.Convert; package body Tkmrpc.Operation_Handlers.Ike.Isa_Create_Child is ------------------------------------------------------------------------- procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is Specific_Req : Request.Ike.Isa_Create_Child.Request_Type; Specific_Res : Response.Ike.Isa_Create_Child.Response_Type; begin Specific_Res := Response.Ike.Isa_Create_Child.Null_Response; Specific_Req := Request.Ike.Isa_Create_Child.Convert.From_Request (S => Req); if Specific_Req.Data.Isa_Id'Valid and Specific_Req.Data.Parent_Isa_Id'Valid and Specific_Req.Data.Ia_Id'Valid and Specific_Req.Data.Dh_Id'Valid and Specific_Req.Data.Nc_Loc_Id'Valid and Specific_Req.Data.Nonce_Rem.Size'Valid and Specific_Req.Data.Initiator'Valid and Specific_Req.Data.Spi_Loc'Valid and Specific_Req.Data.Spi_Rem'Valid then Servers.Ike.Isa_Create_Child (Result => Specific_Res.Header.Result, Isa_Id => Specific_Req.Data.Isa_Id, Parent_Isa_Id => Specific_Req.Data.Parent_Isa_Id, Ia_Id => Specific_Req.Data.Ia_Id, Dh_Id => Specific_Req.Data.Dh_Id, Nc_Loc_Id => Specific_Req.Data.Nc_Loc_Id, Nonce_Rem => Specific_Req.Data.Nonce_Rem, Initiator => Specific_Req.Data.Initiator, Spi_Loc => Specific_Req.Data.Spi_Loc, Spi_Rem => Specific_Req.Data.Spi_Rem, Sk_Ai => Specific_Res.Data.Sk_Ai, Sk_Ar => Specific_Res.Data.Sk_Ar, Sk_Ei => Specific_Res.Data.Sk_Ei, Sk_Er => Specific_Res.Data.Sk_Er); Res := Response.Ike.Isa_Create_Child.Convert.To_Response (S => Specific_Res); else Res.Header.Result := Results.Invalid_Parameter; end if; end Handle; end Tkmrpc.Operation_Handlers.Ike.Isa_Create_Child;
reznikmm/increment
Ada
1,283
ads
-- Copyright (c) 2015-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Incr.Lexers.Batch_Lexers.Generic_Lexers; with Matreshka.Internals.Unicode; package Tests.Lexers is package Tables is use Incr.Lexers.Batch_Lexers; function To_Class (Value : Matreshka.Internals.Unicode.Code_Point) return Character_Class; pragma Inline (To_Class); function Switch (S : State; Class : Character_Class) return State; pragma Inline (Switch); function Rule (S : State) return Rule_Index; pragma Inline (Rule); First_Final : constant State := 1; Last_Looping : constant State := 2; Error_State : constant State := 5; subtype Looping_State is State range 0 .. Last_Looping; subtype Final_State is State range First_Final .. Error_State - 1; end Tables; package Test_Lexers is new Incr.Lexers.Batch_Lexers.Generic_Lexers (To_Class => Tables.To_Class, Switch => Tables.Switch, Rule => Tables.Rule, First_Final => Tables.First_Final, Last_Looping => Tables.Last_Looping, Error_State => Tables.Error_State); end Tests.Lexers;
jhumphry/PRNG_Zoo
Ada
3,676
adb
-- -- PRNG Zoo -- Copyright (c) 2014 - 2015, James Humphry -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. with PRNG_Zoo; use PRNG_Zoo; with PRNG_Zoo.Stats; with PRNG_Zoo.Tests; with Ada.Numerics.Long_Elementary_Functions; use Ada.Numerics.Long_Elementary_Functions; with Ada.Text_IO; with Ada.Long_Float_Text_IO; with Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Long_Float_Text_IO, Ada.Integer_Text_IO; procedure test_stats is procedure test_chi2_cdf(X : Long_Float; df : Positive; expect : Long_Float) is begin Put("Chi2 CDF for X = "); Put(X, Fore => 1, Aft => 8, Exp => 0); Put(" df = "); Put(df); New_Line; Put("Result = "); Put(Stats.Chi2_CDF(X, df), Fore => 1, Aft => 8, Exp => 0); Put(" expected = "); Put(expect, Fore => 1, Aft => 8, Exp => 0); New_Line(1); end test_chi2_cdf; B : Tests.Binned(4); begin Put_Line("Testing Gamma_Half"); for I in 1..10 loop Put("Z = "); Put(I); Put(" Gamma(Z/2) = "); Put(Stats.Gamma_HalfN(I), Fore => 1, Aft => 8, Exp => 0); New_Line; Put("Z = "); Put(I); Put(" Log(Gamma(Z/2)) = "); Put(Stats.Log_Gamma_HalfN(I), Fore => 1, Aft => 8, Exp => 0); Put(" Exp(Log(Gamma(Z/2)) = "); Put(Exp(Stats.Log_Gamma_HalfN(I)), Fore => 1, Aft => 8, Exp => 0); New_Line; end loop; New_Line; Put("Z = 511 Log(Gamma(Z/2)) = "); Put(Stats.Log_Gamma_HalfN(511)); New_Line(2); Put_Line("Testing Chi2 at epsilon = 1.0E-6"); test_chi2_cdf(9.210340371976180, 2, 0.99); test_chi2_cdf(7.814727903251176, 3, 0.95); test_chi2_cdf(0.554298076728276, 5, 0.01); test_chi2_cdf(70.0, 50, 0.96762589022646417); test_chi2_cdf(61.920, 100, 0.00100068); test_chi2_cdf(311.560343126936004, 256, 0.99); test_chi2_cdf(190.867048914205071, 255, 0.001); test_chi2_cdf(517.0, 511, 0.58230319349007631); New_Line(2); Put("Z-Score(-2.0) :"); Put(Stats.Z_Score(-2.0), Fore => 1, Aft => 8, Exp => 0); New_Line; Put("Z-Score(-1.0) :"); Put(Stats.Z_Score(-1.0), Fore => 1, Aft => 8, Exp => 0); New_Line; Put("Z-Score(0.0) :"); Put(Stats.Z_Score(0.0), Fore => 1, Aft => 8, Exp => 0); New_Line; Put("Z-Score(1.0) :"); Put(Stats.Z_Score(1.0), Fore => 1, Aft => 8, Exp => 0); New_Line; Put("Z-Score(2.0) :"); Put(Stats.Z_Score(2.0), Fore => 1, Aft => 8, Exp => 0); New_Line; New_Line(2); Put("Erf(-0.3) :"); Put(Stats.erf(-0.3), Fore => 1, Aft => 8, Exp => 0); New_Line; Put("Erfi(Erf(-0.3)) :"); Put(Stats.erfi(Stats.erf(-0.3)), Fore => 1, Aft => 8, Exp => 0); New_Line; New_Line(2); Stats.Make_Normal_Bins(B); for I in 1..B.N loop Put((if I=1 then -99.0 else B.Bin_Boundary(I-1)), Fore => 1, Aft => 8, Exp => 0); Put(" to "); Put((if I=B.N then +99.0 else B.Bin_Boundary(I)), Fore => 1, Aft => 8, Exp => 0); Put(" contains: "); Put(B.Bin_Expected(I), Fore => 1, Aft => 8, Exp => 0); New_Line; end loop; New_Line(2); end test_stats;
reznikmm/matreshka
Ada
4,785
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Style_Ruby_Properties_Elements; package Matreshka.ODF_Style.Ruby_Properties_Elements is type Style_Ruby_Properties_Element_Node is new Matreshka.ODF_Style.Abstract_Style_Element_Node and ODF.DOM.Style_Ruby_Properties_Elements.ODF_Style_Ruby_Properties with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Style_Ruby_Properties_Element_Node; overriding function Get_Local_Name (Self : not null access constant Style_Ruby_Properties_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Style_Ruby_Properties_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Style_Ruby_Properties_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Style_Ruby_Properties_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Style.Ruby_Properties_Elements;
reznikmm/matreshka
Ada
14,480
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Command_Line; with Ada.Directories; with Ada.Integer_Wide_Text_IO; with Ada.Strings.Wide_Unbounded.Wide_Text_IO; with Ada.Wide_Text_IO; with Scanner_Extractor; with Scanner_Utilities; with Wide_Put_File_Header; package body Scanner_Generator is use Ada.Integer_Wide_Text_IO; use Ada.Strings.Wide_Unbounded; use Ada.Strings.Wide_Unbounded.Wide_Text_IO; use Ada.Wide_Text_IO; use Scanner_Extractor; use Scanner_Utilities; function Scanner_Template_File_Name return String; function Scanner_File_Name return String; function Scanner_Tables_File_Name return String; function Hex_4_Image (Item : Natural) return Wide_String; ----------------------- -- Scanner_File_Name -- ----------------------- function Scanner_File_Name return String is Template : constant String := Ada.Directories.Simple_Name (Scanner_Template_File_Name); begin return Template (Template'First .. Template'Last - 3); end Scanner_File_Name; ------------------------------ -- Scanner_Tables_File_Name -- ------------------------------ function Scanner_Tables_File_Name return String is begin return Ada.Directories.Base_Name (Scanner_File_Name) & "-tables.ads"; end Scanner_Tables_File_Name; -------------------------------- -- Scanner_Template_File_Name -- -------------------------------- function Scanner_Template_File_Name return String is begin return Ada.Command_Line.Argument (3); end Scanner_Template_File_Name; ----------------- -- Hex_4_Image -- ----------------- function Hex_4_Image (Item : Natural) return Wide_String is Hex : constant array (Natural range 0 .. 15) of Wide_Character := "0123456789ABCDEF"; Aux : Wide_String (1 .. 4); begin Aux (1) := Hex (Item / 2 ** 12); Aux (2) := Hex ((Item / 2 ** 8) mod 16); Aux (3) := Hex ((Item / 2 ** 4) mod 16); Aux (4) := Hex (Item mod 16); return Aux; end Hex_4_Image; --------------------------- -- Generate_Scanner_Code -- --------------------------- procedure Generate_Scanner_Code is Input : File_Type; Output : File_Type; Buffer : Wide_String (1 .. 1024); Last : Natural; begin Open (Input, In_File, Scanner_Template_File_Name, "wcem=8"); Create (Output, Out_File, Scanner_File_Name, "wcem=8"); while not End_Of_File (Input) loop Get_Line (Input, Buffer, Last); if Buffer (1 .. Last) = "%%" then for J in 1 .. Natural (Choices.Length) loop declare Element : constant Choice_Information := Choices.Element (J); begin if not Element.Is_Empty then New_Line (Output); Put (Output, " when "); Put (Output, Element.Choice, 0); Put_Line (Output, " =>"); for J in 1 .. Natural (Element.Text.Length) loop if Length (Element.Text.Element (J)) /= 0 then Put (Output, " "); Put_Line (Output, Element.Text.Element (J)); else New_Line (Output); end if; end loop; end if; end; end loop; else Put_Line (Output, Buffer (1 .. Last)); end if; end loop; Close (Output); Close (Input); end Generate_Scanner_Code; ----------------------------- -- Generate_Scanner_Tables -- ----------------------------- procedure Generate_Scanner_Tables is Output : File_Type; Maximum : Positive := 1; procedure Generate_Array (Name : Wide_String; Values : Integer_Vectors.Vector); procedure Generate_Plane (Number : Natural; Values : Integer_Vectors.Vector); -------------------- -- Generate_Array -- -------------------- procedure Generate_Array (Name : Wide_String; Values : Integer_Vectors.Vector) is begin New_Line (Output); case Mode is when Regexp => Put (Output, " "); Put (Output, Name); Put (Output, " : constant array (0 .. "); Put (Output, Integer (Values.Length) - 1, 0); Put_Line (Output, ") of Integer :="); when XML => Put (Output, " "); Put (Output, Name); Put_Line (Output, " : constant"); Put (Output, " array (Interfaces.Unsigned_32 range 0 .. "); Put (Output, Integer (Values.Length) - 1, 0); Put_Line (Output, ")"); Put_Line (Output, " of Interfaces.Unsigned_32 :="); end case; for J in 0 .. Natural (Values.Length) - 1 loop if J = 0 then Put (Output, " ("); elsif J mod 8 = 0 then Put_Line (Output, ","); Put (Output, " "); else Put (Output, ","); end if; Put (Output, Values.Element (J), 5); end loop; Put_Line (Output, ");"); end Generate_Array; -------------------- -- Generate_Plane -- -------------------- procedure Generate_Plane (Number : Natural; Values : Integer_Vectors.Vector) is begin New_Line (Output); Put (Output, " YY_EC_"); Put (Output, Hex_4_Image (Number)); Put_Line (Output, " : aliased constant YY_Secondary_Array :="); for J in 0 .. Natural (Values.Length) - 1 loop if J = 0 then Put (Output, " ("); elsif J mod 8 = 0 then Put_Line (Output, ","); Put (Output, " "); else Put (Output, ","); end if; Put (Output, Values.Element (J), 5); end loop; Put_Line (Output, ");"); end Generate_Plane; begin Create (Output, Out_File, Scanner_Tables_File_Name, "wcem=8"); case Mode is when Regexp => Wide_Put_File_Header (Output, "Localization, Internationalization, Globalization for Ada", 2010, 2013); when XML => Wide_Put_File_Header (Output, "XML Processor", 2010, 2012); end case; Put_Line (Output, "pragma Style_Checks (""-t"");"); Put_Line (Output, "-- GNAT: Disable check for token separation rules, because format o" & "f the"); Put_Line (Output, "-- tables is not compatible with them."); Put_Line (Output, "with Matreshka.Internals.Unicode;"); New_Line (Output); Put (Output, "private package "); case Mode is when Regexp => Put (Output, "Matreshka.Internals.Regexps.Compiler"); when XML => Put (Output, "XML.SAX.Simple_Readers"); end case; Put_Line (Output, ".Scanner.Tables is"); if Mode = Regexp then New_Line (Output); Put_Line (Output, " pragma Preelaborate;"); end if; New_Line (Output); Put_Line (Output, " subtype YY_Secondary_Index is"); Put_Line (Output, " Matreshka.Internals.Unicode.Code_Point range 0 .. 16#FF#;"); Put_Line (Output, " subtype YY_Primary_Index is"); Put_Line (Output, " Matreshka.Internals.Unicode.Code_Point range 0 .. 16#10FF#;"); Put_Line (Output, " type YY_Secondary_Array is"); Put (Output, " array (YY_Secondary_Index) of "); case Mode is when Regexp => Put (Output, "Integer"); when XML => Put (Output, "Interfaces.Unsigned_32"); end case; Put_Line (Output, ";"); Put_Line (Output, " type YY_Secondary_Array_Access is"); Put_Line (Output, " not null access constant YY_Secondary_Array;"); New_Line (Output); Put (Output, " YY_End_Of_Buffer : constant := "); Put (Output, YY_End_Of_Buffer, 0); Put_Line (Output, ";"); if YY_Jam_State /= -1 then Put (Output, " YY_Jam_State : constant := "); Put (Output, YY_Jam_State, 0); Put_Line (Output, ";"); end if; if YY_Jam_Base /= -1 then Put (Output, " YY_Jam_Base : constant := "); Put (Output, YY_Jam_Base, 0); Put_Line (Output, ";"); end if; Put (Output, " YY_First_Template : constant := "); Put (Output, YY_First_Template, 0); Put_Line (Output, ";"); for J in 1 .. Natural (State_Constants.Length) loop Maximum := Natural'Max (Length (State_Constants.Element (J).Name), Maximum); end loop; New_Line (Output); for J in 1 .. Natural (State_Constants.Length) loop Put (Output, " "); Put (Output, State_Constants.Element (J).Name); Set_Col (Output, Ada.Wide_Text_IO.Count (Maximum + 4)); Put (Output, " : constant := "); Put (Output, State_Constants.Element (J).Value, 0); Put_Line (Output, ";"); end loop; -- Generate arrays Generate_Array ("YY_Accept", YY_Accept); Generate_Array ("YY_Meta", YY_Meta); Generate_Array ("YY_Base", YY_Base); Generate_Array ("YY_Def", YY_Def); Generate_Array ("YY_Nxt", YY_Nxt); Generate_Array ("YY_Chk", YY_Chk); -- Generate planes for J in 1 .. Natural (YY_EC_Planes.Length) loop Generate_Plane (YY_EC_Planes.Element (J).Number, YY_EC_Planes.Element (J).Values); end loop; New_Line (Output); Put_Line (Output, " YY_EC_Base : constant"); Put_Line (Output, " array (YY_Primary_Index) of YY_Secondary_Array_Access :="); Put (Output, " ("); for J in 1 .. Natural (YY_EC_Base.Length) loop Put (Output, "16#"); Put (Output, Hex_4_Image (YY_EC_Base.Element (J).Number)); Put (Output, "# => YY_EC_"); Put (Output, Hex_4_Image (YY_EC_Base.Element (J).Reference)); Put (Output, "'Access,"); if J mod 2 = 0 then New_Line (Output); Put (Output, " "); else Put (Output, " "); end if; end loop; Put (Output, "others => YY_EC_"); Put (Output, Hex_4_Image (YY_EC_Base_Others)); Put_Line (Output, "'Access);"); New_Line (Output); Put (Output, "end "); case Mode is when Regexp => Put (Output, "Matreshka.Internals.Regexps.Compiler"); when XML => Put (Output, "XML.SAX.Simple_Readers"); end case; Put_Line (Output, ".Scanner.Tables;"); Close (Output); end Generate_Scanner_Tables; end Scanner_Generator;
LaplaceKorea/coinapi-sdk
Ada
20,432
ads
-- OEML _ REST API -- This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> -- -- The version of the OpenAPI document: v1 -- Contact: [email protected] -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.2.1. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package .Models is pragma Style_Checks ("-mr"); type RejectReason_Type is record end record; package RejectReason_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RejectReason_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RejectReason_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RejectReason_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RejectReason_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RejectReason_Type_Vectors.Vector); -- ------------------------------ -- MessageReject object. -- ------------------------------ type MessageReject_Type is record P_Type : Swagger.Nullable_UString; Reject_Reason : .Models.RejectReason_Type; Exchange_Id : Swagger.Nullable_UString; Message : Swagger.Nullable_UString; Rejected_Message : Swagger.Nullable_UString; end record; package MessageReject_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => MessageReject_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in MessageReject_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in MessageReject_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out MessageReject_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out MessageReject_Type_Vectors.Vector); -- ------------------------------ -- JSON validation error. -- ------------------------------ type ValidationError_Type is record P_Type : Swagger.Nullable_UString; Title : Swagger.Nullable_UString; Status : Swagger.Number; Trace_Id : Swagger.Nullable_UString; Errors : Swagger.Nullable_UString; end record; package ValidationError_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ValidationError_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type_Vectors.Vector); type OrdType_Type is record end record; package OrdType_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrdType_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type_Vectors.Vector); type OrdStatus_Type is record end record; package OrdStatus_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrdStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type_Vectors.Vector); type OrderCancelAllRequest_Type is record Exchange_Id : Swagger.UString; end record; package OrderCancelAllRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderCancelAllRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type_Vectors.Vector); type OrderCancelSingleRequest_Type is record Exchange_Id : Swagger.UString; Exchange_Order_Id : Swagger.Nullable_UString; Client_Order_Id : Swagger.Nullable_UString; end record; package OrderCancelSingleRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderCancelSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type_Vectors.Vector); type OrdSide_Type is record end record; package OrdSide_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrdSide_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type_Vectors.Vector); type TimeInForce_Type is record end record; package TimeInForce_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => TimeInForce_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type_Vectors.Vector); type OrderNewSingleRequest_Type is record Exchange_Id : Swagger.UString; Client_Order_Id : Swagger.UString; Symbol_Id_Exchange : Swagger.Nullable_UString; Symbol_Id_Coinapi : Swagger.Nullable_UString; Amount_Order : Swagger.Number; Price : Swagger.Number; Side : .Models.OrdSide_Type; Order_Type : .Models.OrdType_Type; Time_In_Force : .Models.TimeInForce_Type; Expire_Time : Swagger.Nullable_Date; Exec_Inst : Swagger.UString_Vectors.Vector; end record; package OrderNewSingleRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderNewSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type_Vectors.Vector); -- ------------------------------ -- Relay fill information on working orders. -- ------------------------------ type Fills_Type is record Time : Swagger.Nullable_Date; Price : Swagger.Number; Amount : Swagger.Number; end record; package Fills_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Fills_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Fills_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Fills_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Fills_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Fills_Type_Vectors.Vector); type OrderExecutionReport_Type is record Exchange_Id : Swagger.UString; Client_Order_Id : Swagger.UString; Symbol_Id_Exchange : Swagger.Nullable_UString; Symbol_Id_Coinapi : Swagger.Nullable_UString; Amount_Order : Swagger.Number; Price : Swagger.Number; Side : .Models.OrdSide_Type; Order_Type : .Models.OrdType_Type; Time_In_Force : .Models.TimeInForce_Type; Expire_Time : Swagger.Nullable_Date; Exec_Inst : Swagger.UString_Vectors.Vector; Client_Order_Id_Format_Exchange : Swagger.UString; Exchange_Order_Id : Swagger.Nullable_UString; Amount_Open : Swagger.Number; Amount_Filled : Swagger.Number; Avg_Px : Swagger.Number; Status : .Models.OrdStatus_Type; Status_History : Swagger.UString_Vectors.Vector_Vectors.Vector; Error_Message : Swagger.Nullable_UString; Fills : .Models.Fills_Type_Vectors.Vector; end record; package OrderExecutionReport_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderExecutionReport_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type_Vectors.Vector); type OrderExecutionReportAllOf_Type is record Client_Order_Id_Format_Exchange : Swagger.UString; Exchange_Order_Id : Swagger.Nullable_UString; Amount_Open : Swagger.Number; Amount_Filled : Swagger.Number; Avg_Px : Swagger.Number; Status : .Models.OrdStatus_Type; Status_History : Swagger.UString_Vectors.Vector_Vectors.Vector; Error_Message : Swagger.Nullable_UString; Fills : .Models.Fills_Type_Vectors.Vector; end record; package OrderExecutionReportAllOf_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => OrderExecutionReportAllOf_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type_Vectors.Vector); type BalanceData_Type is record Asset_Id_Exchange : Swagger.Nullable_UString; Asset_Id_Coinapi : Swagger.Nullable_UString; Balance : float; Available : float; Locked : float; Last_Updated_By : Swagger.Nullable_UString; Rate_Usd : float; Traded : float; end record; package BalanceData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => BalanceData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type_Vectors.Vector); type Balance_Type is record Exchange_Id : Swagger.Nullable_UString; Data : .Models.BalanceData_Type_Vectors.Vector; end record; package Balance_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Balance_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type_Vectors.Vector); type Position_Type is record Exchange_Id : Swagger.Nullable_UString; Data : .Models.PositionData_Type_Vectors.Vector; end record; package Position_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Position_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type_Vectors.Vector); type PositionData_Type is record Symbol_Id_Exchange : Swagger.Nullable_UString; Symbol_Id_Coinapi : Swagger.Nullable_UString; Avg_Entry_Price : Swagger.Number; Quantity : Swagger.Number; Side : .Models.OrdSide_Type; Unrealized_Pnl : Swagger.Number; Leverage : Swagger.Number; Cross_Margin : Swagger.Nullable_Boolean; Liquidation_Price : Swagger.Number; Raw_Data : Swagger.Object; end record; package PositionData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PositionData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type_Vectors.Vector); end .Models;
smola/language-dataset
Ada
621
ads
-- -- \brief Tests for JWX.JSON -- \author Alexander Senier -- \date 2018-05-12 -- -- Copyright (C) 2018 Componolit GmbH -- -- This file is part of JWX, which is distributed under the terms of the -- GNU Affero General Public License version 3. -- with AUnit; use AUnit; with AUnit.Test_Cases; use AUnit.Test_Cases; package JWX_JSON_Tests is type Test_Case is new Test_Cases.Test_Case with null record; procedure Register_Tests (T: in out Test_Case); -- Register routines to be run function Name (T : Test_Case) return Message_String; -- Provide name identifying the test case end JWX_JSON_Tests;
reznikmm/matreshka
Ada
3,575
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This is a root package of hierarhy for Single Instruction Multiply Data -- support on different platforms. Each platform declare its own set of child -- packages. package Matreshka.SIMD is pragma Pure; end Matreshka.SIMD;
MinimSecure/unum-sdk
Ada
942
adb
-- Copyright 2007-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. procedure Hello is procedure First is begin null; end First; procedure Second is begin First; end Second; procedure Third is begin Second; end Third; begin Third; end Hello;
AdaCore/gpr
Ada
1,930
adb
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Strings.Fixed; with Ada.Text_IO; with GPR2.Unit; with GPR2.Context; with GPR2.Path_Name; with GPR2.Project.Source.Set; with GPR2.Project.View; with GPR2.Project.Tree; with GPR2.Source_Info.Parser.Ada_Language; procedure Main is use Ada; use GPR2; use GPR2.Project; procedure Check (Project_Name : Filename_Type); -- Do check the given project's sources procedure Output_Filename (Filename : Path_Name.Full_Name); -- Remove the leading tmp directory ----------- -- Check -- ----------- procedure Check (Project_Name : Filename_Type) is Prj : Project.Tree.Object; Ctx : Context.Object; View : Project.View.Object; begin Project.Tree.Load (Prj, Create (Project_Name), Ctx); View := Prj.Root_Project; Text_IO.Put_Line ("Project: " & String (View.Name)); for Source of View.Sources loop declare U : constant Optional_Name_Type := Source.Unit_Name; begin Output_Filename (Source.Path_Name.Value); Text_IO.Set_Col (16); Text_IO.Put (" language: " & Image (Source.Language)); Text_IO.Set_Col (33); Text_IO.Put (" Kind: " & GPR2.Unit.Library_Unit_Type'Image (Source.Kind)); if U /= "" then Text_IO.Put (" unit: " & String (U)); end if; Text_IO.New_Line; end; end loop; end Check; --------------------- -- Output_Filename -- --------------------- procedure Output_Filename (Filename : Path_Name.Full_Name) is I : constant Positive := Strings.Fixed.Index (Filename, "source-excluded"); begin Text_IO.Put (" > " & Filename (I + 15 .. Filename'Last)); end Output_Filename; begin Check ("demo.gpr"); end Main;
reznikmm/matreshka
Ada
5,354
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.Expressions.Selected_Components is function Call_Convention (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Convention_Property) return Engines.Convention_Kind; function Code (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; function Intrinsic_Name (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Text_Property) return League.Strings.Universal_String; function Initialize (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; function Method_Name (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; function Is_Dispatching (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Boolean_Property) return Boolean; function Bounds (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String renames Intrinsic_Name; function Typed_Array_Item_Type (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; function Size (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; function Alignment (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Integer_Property) return Integer; end Properties.Expressions.Selected_Components;
gitter-badger/libAnne
Ada
3,351
ads
with System; use System; package Bindings.cwchar is --@description Provides bindings to C's cwchar.h --@see http://www.cplusplus.com/reference/cwchar/ --@version 1.0.0 function fgetwc(stream : Address) return Long_Integer with Import, Convention => C; --@description Returns the wide character currently pointed by the internal position indicator of the specified stream. The internal position indicator is then advanced to the next wide character. --@remarks Because wide characters are represented by multibyte characters in external files, the function may involve reading several bytes from the file, which are interpreted as a single character as if mbrtowc was called with the stream's internal mbstate_t object. If the sequence of bytes read cannot be interpreted as a valid multibyte character (or there were too few bytes available to compose a wide character), the function returns WEOF and sets EILSEQ as the value of errno. If the stream is at the end-of-file when called, the function returns WEOF and sets the end-of-file indicator for the stream (feof). If a read error occurs, the function returns WEOF and sets the error indicator for the stream (ferror). --@param stream Pointer to a FILE object that identifies an input stream. The stream shall not have an orientation yet, or be wide-oriented (the first i/o operation on a stream determines whether it is byte- or wide- oriented). --@return On success, the character read is returned (promoted to a value of type wint_t). The return type is wint_t to accommodate for the special value WEOF, which indicates failure: If the sequence of bytes read cannot be interpreted as a valid wide character, the function returns WEOF and sets errno to EILSEQ. If the position indicator was at the end-of-file, the function returns WEOF and sets the eof indicator (feof) of stream. If a reading error happens, the function also returns WEOF, but sets its error indicator (ferror) instead. function fputwc(wc : Long_Integer; stream : Address) return Long_Integer with Import, Convention => C; --@description Writes the wide character wc to the stream and advances the position indica --@remarks Because wide characters are represented by multibyte characters in external files, the function may involve writing several bytes to the file, as if wcrtomb was called to translate wc with the stream's internal mbstate_t object. If the wide character cannot be represented using the multibyte encoding, the function returns WEOF and sets EILSEQ as the value of errno. If a writing error occurs, the function returns WEOF and sets the error indicator for the stream (ferror). --@param wc The wide character to write. --@param stream Pointer to a FILE object that identifies an output stream. The stream shall not have an orientation yet, or be wide-oriented (the first i/o operation on a stream determines whether it is byte- or wide- oriented). --@return On success, the character written is returned (wc promoted to a value of type wint_t). The return type is wint_t to accommodate for the special value WEOF, which indicates failure: If the wide character could not be interpreted as a valid multibyte character, the function returns WEOF and sets errno to EILSEQ. If a writing error occurs, the function also returns WEOF and the error indicator (ferror) is set. end Bindings.cwchar;
reznikmm/matreshka
Ada
3,993
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Text_Condition_Attributes; package Matreshka.ODF_Text.Condition_Attributes is type Text_Condition_Attribute_Node is new Matreshka.ODF_Text.Abstract_Text_Attribute_Node and ODF.DOM.Text_Condition_Attributes.ODF_Text_Condition_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Condition_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Text_Condition_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Text.Condition_Attributes;
stcarrez/ada-mail
Ada
5,571
adb
----------------------------------------------------------------------- -- mail-headers -- Operations on mail headers -- Copyright (C) 2020 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Equal_Case_Insensitive; with Ada.Characters.Handling; with Unicode.Encodings; with Util.Strings.Builders; with Util.Encoders.Quoted_Printable; package body Mail.Headers is use Ada.Characters.Handling; function Decode_Quoted (Content : in String; Charset : in String) return String; function Decode_Base64 (Content : in String; Charset : in String) return String; function Decode_Quoted (Content : in String; Charset : in String) return String is Result : constant String := Util.Encoders.Quoted_Printable.Q_Decode (Content); Encoding : Unicode.Encodings.Unicode_Encoding; begin if Ada.Strings.Equal_Case_Insensitive (Charset, "UTF-8") then return Result; end if; begin if Charset = "646" then Encoding := Unicode.Encodings.Get_By_Name ("iso-8859-1"); else Encoding := Unicode.Encodings.Get_By_Name (Charset); end if; exception when others => Encoding := Unicode.Encodings.Get_By_Name ("iso-8859-1"); end; return Unicode.Encodings.Convert (Result, Encoding); end Decode_Quoted; function Decode_Base64 (Content : in String; Charset : in String) return String is Decoder : constant Util.Encoders.Decoder := Util.Encoders.Create ("base64"); Result : constant String := Decoder.Decode (Content); Encoding : Unicode.Encodings.Unicode_Encoding; begin if Ada.Strings.Equal_Case_Insensitive (Charset, "UTF-8") then return Result; end if; begin -- 646 is an old charset, its successor is iso-8859-1. if Charset = "646" then Encoding := Unicode.Encodings.Get_By_Name ("iso-8859-1"); else Encoding := Unicode.Encodings.Get_By_Name (Charset); end if; exception when others => Encoding := Unicode.Encodings.Get_By_Name ("iso-8859-1"); end; return Unicode.Encodings.Convert (Result, Encoding); end Decode_Base64; -- ------------------------------ -- Decode the mail header value and normalize to an UTF-8 string (RFC2047). -- ------------------------------ function Decode (Content : in String) return String is use Util.Strings.Builders; C : Character; Pos : Natural := Content'First; Pos2 : Natural; Pos3 : Natural; Result : Util.Strings.Builders.Builder (Content'Length + 10); begin while Pos <= Content'Last loop C := Content (Pos); if C /= '=' then Append (Result, C); elsif Pos = Content'Last then Append (Result, C); elsif Content (Pos + 1) = '?' then Pos2 := Util.Strings.Index (Content, '?', Pos + 2); if Pos2 > 0 and Pos2 + 3 < Content'Last then Pos3 := Util.Strings.Index (Content, '?', Pos2 + 3); if Pos3 > 0 and then Pos3 + 1 <= Content'Last and then Content (Pos3 + 1) = '=' then C := Content (Pos2 + 1); case C is when 'q' | 'Q' => Append (Result, Decode_Quoted (Content (Pos2 + 3 .. Pos3 - 1), Content (Pos + 2 .. Pos2 - 1))); when 'b' | 'B' => Append (Result, Decode_Base64 (Content (Pos2 + 3 .. Pos3 - 1), Content (Pos + 2 .. Pos2 - 1))); when others => null; end case; -- Skip ?= Pos := Pos3 + 1; if Pos < Content'Last and then Is_Space (Content (Pos + 1)) then Pos2 := Pos + 2; while Pos2 <= Content'Last and then Is_Space (Content (Pos2)) loop Pos2 := Pos2 + 1; end loop; -- Skip spaces between consecutive encoded words. if Pos2 + 1 <= Content'Last and then Content (Pos2) = '=' and then Content (Pos2 + 1) = '?' then Pos := Pos2 - 1; end if; end if; else Append (Result, '='); end if; else Append (Result, '='); end if; else Append (Result, '='); end if; Pos := Pos + 1; end loop; return To_Array (Result); end Decode; end Mail.Headers;
Fabien-Chouteau/Ada_Drivers_Library
Ada
17,032
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with System; with NRF51_SVD.POWER; with NRF51_SVD.CLOCK; with NRF51_SVD.GPIOTE; with NRF51_SVD.RADIO; with NRF51_SVD.TIMER; with NRF51_SVD.RTC; with NRF51_SVD.WDT; with NRF51_SVD.RNG; with NRF51_SVD.TEMP; with NRF51_SVD.ECB; with NRF51_SVD.CCM; with NRF51_SVD.AAR; with NRF51_SVD.SPI; with NRF51_SVD.TWI; with NRF51_SVD.UART; with NRF51_SVD.QDEC; with NRF51_SVD.ADC; with HAL; use HAL; package nRF51.Events is function Triggered (Evt : Event_Type) return Boolean; procedure Enable_Interrupt (Evt : Event_Type); procedure Disable_Interrupt (Evt : Event_Type); procedure Clear (Evt : Event_Type); -- Software event clear function Get_Address (Evt : Event_Type) return System.Address; function Get_Address (Evt : Event_Type) return UInt32; -- Power management events Power_POFWARN : constant Event_Type; -- Clock events Clock_HFCLKSTARTED : constant Event_Type; Clock_LFCLKSTARTED : constant Event_Type; Clock_DONE : constant Event_Type; Clock_CTTO : constant Event_Type; -- GPIOTE events GPIOTE_IN_0 : constant Event_Type; GPIOTE_IN_1 : constant Event_Type; GPIOTE_IN_2 : constant Event_Type; GPIOTE_IN_3 : constant Event_Type; GPIOTE_PORT : constant Event_Type; -- Radio events Radio_READY : constant Event_Type; Radio_ADDRESS : constant Event_Type; Radio_PAYLOAD : constant Event_Type; Radio_END : constant Event_Type; Radio_DISABLED : constant Event_Type; Radio_DEVMATCH : constant Event_Type; Radio_DEVMISS : constant Event_Type; Radio_RSSIEND : constant Event_Type; Radio_BCMATCH : constant Event_Type; -- Timer 0 events Timer_0_COMPARE_0 : constant Event_Type; Timer_0_COMPARE_1 : constant Event_Type; Timer_0_COMPARE_2 : constant Event_Type; Timer_0_COMPARE_3 : constant Event_Type; -- Timer 1 events Timer_1_COMPARE_0 : constant Event_Type; Timer_1_COMPARE_1 : constant Event_Type; Timer_1_COMPARE_2 : constant Event_Type; Timer_1_COMPARE_3 : constant Event_Type; -- Timer 2 events Timer_2_COMPARE_0 : constant Event_Type; Timer_2_COMPARE_1 : constant Event_Type; Timer_2_COMPARE_2 : constant Event_Type; Timer_2_COMPARE_3 : constant Event_Type; -- RTC 0 events RTC_0_TICK : constant Event_Type; RTC_0_OVERFLW : constant Event_Type; RTC_0_COMPARE_0 : constant Event_Type; RTC_0_COMPARE_1 : constant Event_Type; RTC_0_COMPARE_2 : constant Event_Type; RTC_0_COMPARE_3 : constant Event_Type; -- RTC 1 events RTC_1_TICK : constant Event_Type; RTC_1_OVERFLW : constant Event_Type; RTC_1_COMPARE_0 : constant Event_Type; RTC_1_COMPARE_1 : constant Event_Type; RTC_1_COMPARE_2 : constant Event_Type; RTC_1_COMPARE_3 : constant Event_Type; -- Watchdog task Watchdog_TIMEOUT : constant Event_Type; -- Random Number Genrator events RNG_VALRDY : constant Event_Type; -- Temperature events Temperature_DATARDY : constant Event_Type; -- AES Electronic Codebook mode encryption (ECB) events ECB_END : constant Event_Type; ECB_ERROR : constant Event_Type; -- AES CCM mode encryption (CCM) events CCM_KSGEN_END : constant Event_Type; CCM_CRYPT_END : constant Event_Type; CCM_ERROR : constant Event_Type; -- Accelerated Address Resolver (AAR) events AAR_END : constant Event_Type; AAR_RESOLVED : constant Event_Type; AAR_NOTRESOLVED : constant Event_Type; -- Serial Peripheral Interface (SPI) 0 events SPI_0_READY : constant Event_Type; -- Serial Peripheral Interface (SPI) 1 events SPI_1_READY : constant Event_Type; -- Two Wire Interface (TWI) 0 events TWI_0_STOPPED : constant Event_Type; TWI_0_RXDRDY : constant Event_Type; TWI_0_TXDENT : constant Event_Type; TWI_0_ERRO : constant Event_Type; TWI_0_BB : constant Event_Type; TWI_0_SUSPENDED : constant Event_Type; -- Two Wire Interface (TWI) 1 events TWI_1_STOPPED : constant Event_Type; TWI_1_RXDRDY : constant Event_Type; TWI_1_TXDENT : constant Event_Type; TWI_1_ERRO : constant Event_Type; TWI_1_BB : constant Event_Type; TWI_1_SUSPENDED : constant Event_Type; -- Universal Asynchronous Receiver/Transmitter (UART) Events UART_RXDRDY : constant Event_Type; UART_TXDRDY : constant Event_Type; UART_ERROR : constant Event_Type; -- Quadrature Decoder (QDEC) QDEC_SAMPLERDY : constant Event_Type; QDEC_REPORTRDY : constant Event_Type; QDEC_ACCOF : constant Event_Type; -- Analof to Digital Converter (ADC) ADC_END : constant Event_Type; private -- Power management events Power_POFWARN : constant Event_Type := Event_Type (NRF51_SVD.POWER.POWER_Periph.EVENTS_POFWARN'Address); -- Clock events Clock_HFCLKSTARTED : constant Event_Type := Event_Type (NRF51_SVD.CLOCK.CLOCK_Periph.EVENTS_HFCLKSTARTED'Address); Clock_LFCLKSTARTED : constant Event_Type := Event_Type (NRF51_SVD.CLOCK.CLOCK_Periph.EVENTS_LFCLKSTARTED'Address); Clock_DONE : constant Event_Type := Event_Type (NRF51_SVD.CLOCK.CLOCK_Periph.EVENTS_DONE'Address); Clock_CTTO : constant Event_Type := Event_Type (NRF51_SVD.CLOCK.CLOCK_Periph.EVENTS_CTTO'Address); -- GPIOTE events GPIOTE_IN_0 : constant Event_Type := Event_Type (NRF51_SVD.GPIOTE.GPIOTE_Periph.EVENTS_IN (0)'Address); GPIOTE_IN_1 : constant Event_Type := Event_Type (NRF51_SVD.GPIOTE.GPIOTE_Periph.EVENTS_IN (1)'Address); GPIOTE_IN_2 : constant Event_Type := Event_Type (NRF51_SVD.GPIOTE.GPIOTE_Periph.EVENTS_IN (2)'Address); GPIOTE_IN_3 : constant Event_Type := Event_Type (NRF51_SVD.GPIOTE.GPIOTE_Periph.EVENTS_IN (3)'Address); GPIOTE_PORT : constant Event_Type := Event_Type (NRF51_SVD.GPIOTE.GPIOTE_Periph.EVENTS_PORT'Address); -- Radio events Radio_READY : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_READY'Address); Radio_ADDRESS : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_ADDRESS'Address); Radio_PAYLOAD : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_PAYLOAD'Address); Radio_END : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_END'Address); Radio_DISABLED : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_DISABLED'Address); Radio_DEVMATCH : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_DEVMATCH'Address); Radio_DEVMISS : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_DEVMISS'Address); Radio_RSSIEND : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_RSSIEND'Address); Radio_BCMATCH : constant Event_Type := Event_Type (NRF51_SVD.RADIO.RADIO_Periph.EVENTS_BCMATCH'Address); -- Timer 0 events Timer_0_COMPARE_0 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER0_Periph.EVENTS_COMPARE (0)'Address); Timer_0_COMPARE_1 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER0_Periph.EVENTS_COMPARE (1)'Address); Timer_0_COMPARE_2 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER0_Periph.EVENTS_COMPARE (2)'Address); Timer_0_COMPARE_3 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER0_Periph.EVENTS_COMPARE (3)'Address); -- Timer 1 events Timer_1_COMPARE_0 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER1_Periph.EVENTS_COMPARE (0)'Address); Timer_1_COMPARE_1 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER1_Periph.EVENTS_COMPARE (1)'Address); Timer_1_COMPARE_2 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER1_Periph.EVENTS_COMPARE (2)'Address); Timer_1_COMPARE_3 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER1_Periph.EVENTS_COMPARE (3)'Address); -- Timer 2 events Timer_2_COMPARE_0 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER2_Periph.EVENTS_COMPARE (0)'Address); Timer_2_COMPARE_1 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER2_Periph.EVENTS_COMPARE (1)'Address); Timer_2_COMPARE_2 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER2_Periph.EVENTS_COMPARE (2)'Address); Timer_2_COMPARE_3 : constant Event_Type := Event_Type (NRF51_SVD.TIMER.TIMER2_Periph.EVENTS_COMPARE (3)'Address); -- RTC 0 events RTC_0_TICK : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC0_Periph.EVENTS_TICK'Address); RTC_0_OVERFLW : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC0_Periph.EVENTS_OVRFLW'Address); RTC_0_COMPARE_0 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC0_Periph.EVENTS_COMPARE (0)'Address); RTC_0_COMPARE_1 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC0_Periph.EVENTS_COMPARE (1)'Address); RTC_0_COMPARE_2 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC0_Periph.EVENTS_COMPARE (2)'Address); RTC_0_COMPARE_3 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC0_Periph.EVENTS_COMPARE (3)'Address); -- RTC 1 events RTC_1_TICK : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC1_Periph.EVENTS_TICK'Address); RTC_1_OVERFLW : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC1_Periph.EVENTS_OVRFLW'Address); RTC_1_COMPARE_0 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC1_Periph.EVENTS_COMPARE (0)'Address); RTC_1_COMPARE_1 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC1_Periph.EVENTS_COMPARE (1)'Address); RTC_1_COMPARE_2 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC1_Periph.EVENTS_COMPARE (2)'Address); RTC_1_COMPARE_3 : constant Event_Type := Event_Type (NRF51_SVD.RTC.RTC1_Periph.EVENTS_COMPARE (3)'Address); -- Watchdog task Watchdog_TIMEOUT : constant Event_Type := Event_Type (NRF51_SVD.WDT.WDT_Periph.EVENTS_TIMEOUT'Address); -- Random Number Genrator events RNG_VALRDY : constant Event_Type := Event_Type (NRF51_SVD.RNG.RNG_Periph.EVENTS_VALRDY'Address); -- Temperature events Temperature_DATARDY : constant Event_Type := Event_Type (NRF51_SVD.TEMP.TEMP_Periph.EVENTS_DATARDY'Address); -- AES Electronic Codebook mode encryption (ECB) events ECB_END : constant Event_Type := Event_Type (NRF51_SVD.ECB.ECB_Periph.EVENTS_ENDECB'Address); ECB_ERROR : constant Event_Type := Event_Type (NRF51_SVD.ECB.ECB_Periph.EVENTS_ERRORECB'Address); -- AES CCM mode encryption (CCM) events CCM_KSGEN_END : constant Event_Type := Event_Type (NRF51_SVD.CCM.CCM_Periph.EVENTS_ENDKSGEN'Address); CCM_CRYPT_END : constant Event_Type := Event_Type (NRF51_SVD.CCM.CCM_Periph.EVENTS_ENDCRYPT'Address); CCM_ERROR : constant Event_Type := Event_Type (NRF51_SVD.CCM.CCM_Periph.EVENTS_ERROR'Address); -- Accelerated Address Resolver (AAR) events AAR_END : constant Event_Type := Event_Type (NRF51_SVD.AAR.AAR_Periph.EVENTS_END'Address); AAR_RESOLVED : constant Event_Type := Event_Type (NRF51_SVD.AAR.AAR_Periph.EVENTS_RESOLVED'Address); AAR_NOTRESOLVED : constant Event_Type := Event_Type (NRF51_SVD.AAR.AAR_Periph.EVENTS_NOTRESOLVED'Address); -- Serial Peripheral Interface (SPI) events SPI_0_READY : constant Event_Type := Event_Type (NRF51_SVD.SPI.SPI0_Periph.EVENTS_READY'Address); -- Serial Peripheral Interface (SPI) events SPI_1_READY : constant Event_Type := Event_Type (NRF51_SVD.SPI.SPI1_Periph.EVENTS_READY'Address); -- Two Wire Interface (TWI) 0 events TWI_0_STOPPED : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI0_Periph.EVENTS_STOPPED'Address); TWI_0_RXDRDY : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI0_Periph.EVENTS_RXDREADY'Address); TWI_0_TXDENT : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI0_Periph.EVENTS_TXDSENT'Address); TWI_0_ERRO : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI0_Periph.EVENTS_ERROR'Address); TWI_0_BB : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI0_Periph.EVENTS_BB'Address); TWI_0_SUSPENDED : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI0_Periph.EVENTS_SUSPENDED'Address); -- Two Wire Interface (TWI) 1 events TWI_1_STOPPED : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI1_Periph.EVENTS_STOPPED'Address); TWI_1_RXDRDY : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI1_Periph.EVENTS_RXDREADY'Address); TWI_1_TXDENT : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI1_Periph.EVENTS_TXDSENT'Address); TWI_1_ERRO : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI1_Periph.EVENTS_ERROR'Address); TWI_1_BB : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI1_Periph.EVENTS_BB'Address); TWI_1_SUSPENDED : constant Event_Type := Event_Type (NRF51_SVD.TWI.TWI1_Periph.EVENTS_SUSPENDED'Address); -- Universal Asynchronous Receiver/Transmitter (UART) Events UART_RXDRDY : constant Event_Type := Event_Type (NRF51_SVD.UART.UART0_Periph.EVENTS_RXDRDY'Address); UART_TXDRDY : constant Event_Type := Event_Type (NRF51_SVD.UART.UART0_Periph.EVENTS_TXDRDY'Address); UART_ERROR : constant Event_Type := Event_Type (NRF51_SVD.UART.UART0_Periph.EVENTS_ERROR'Address); -- Quadrature Decoder (QDEC) QDEC_SAMPLERDY : constant Event_Type := Event_Type (NRF51_SVD.QDEC.QDEC_Periph.EVENTS_SAMPLERDY'Address); QDEC_REPORTRDY : constant Event_Type := Event_Type (NRF51_SVD.QDEC.QDEC_Periph.EVENTS_REPORTRDY'Address); QDEC_ACCOF : constant Event_Type := Event_Type (NRF51_SVD.QDEC.QDEC_Periph.EVENTS_ACCOF'Address); -- Analof to Digital Converter (ADC) ADC_END : constant Event_Type := Event_Type (NRF51_SVD.ADC.ADC_Periph.EVENTS_END'Address); end nRF51.Events;
charlie5/aIDE
Ada
564
ads
with -- AdaM.Source, AdaM.Entity, gtk.Widget; package aIDE.Editor is type Item is abstract tagged private; type View is access all Item'Class; -- function to_Editor (Target : in AdaM.Source.Entity_view) return Editor.view; function to_Editor (Target : in AdaM.Entity.view) return Editor.view; function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; procedure freshen (Self : in out Item) is null; private type Item is abstract tagged record null; end record; end aIDE.Editor;
zhmu/ananas
Ada
6,757
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ W I D E _ C H A R A C T E R T S . U N I C O D E -- -- -- -- B o d y -- -- -- -- Copyright (C) 2005-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body Ada.Wide_Wide_Characters.Unicode is package G renames System.UTF_32; ------------------ -- Get_Category -- ------------------ function Get_Category (U : Wide_Wide_Character) return Category is begin return Category (G.Get_Category (Wide_Wide_Character'Pos (U))); end Get_Category; -------------- -- Is_Basic -- -------------- function Is_Basic (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Basic (Wide_Wide_Character'Pos (U)); end Is_Basic; -------------- -- Is_Digit -- -------------- function Is_Digit (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Digit (Wide_Wide_Character'Pos (U)); end Is_Digit; function Is_Digit (C : Category) return Boolean is begin return G.Is_UTF_32_Digit (G.Category (C)); end Is_Digit; --------------- -- Is_Letter -- --------------- function Is_Letter (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Letter (Wide_Wide_Character'Pos (U)); end Is_Letter; function Is_Letter (C : Category) return Boolean is begin return G.Is_UTF_32_Letter (G.Category (C)); end Is_Letter; ------------------------ -- Is_Line_Terminator -- ------------------------ function Is_Line_Terminator (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Line_Terminator (Wide_Wide_Character'Pos (U)); end Is_Line_Terminator; ------------- -- Is_Mark -- ------------- function Is_Mark (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Mark (Wide_Wide_Character'Pos (U)); end Is_Mark; function Is_Mark (C : Category) return Boolean is begin return G.Is_UTF_32_Mark (G.Category (C)); end Is_Mark; -------------------- -- Is_Non_Graphic -- -------------------- function Is_Non_Graphic (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Non_Graphic (Wide_Wide_Character'Pos (U)); end Is_Non_Graphic; function Is_Non_Graphic (C : Category) return Boolean is begin return G.Is_UTF_32_Non_Graphic (G.Category (C)); end Is_Non_Graphic; ------------- -- Is_NFKC -- ------------- function Is_NFKC (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_NFKC (Wide_Wide_Character'Pos (U)); end Is_NFKC; -------------- -- Is_Other -- -------------- function Is_Other (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Other (Wide_Wide_Character'Pos (U)); end Is_Other; function Is_Other (C : Category) return Boolean is begin return G.Is_UTF_32_Other (G.Category (C)); end Is_Other; -------------------- -- Is_Punctuation -- -------------------- function Is_Punctuation (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Punctuation (Wide_Wide_Character'Pos (U)); end Is_Punctuation; function Is_Punctuation (C : Category) return Boolean is begin return G.Is_UTF_32_Punctuation (G.Category (C)); end Is_Punctuation; -------------- -- Is_Space -- -------------- function Is_Space (U : Wide_Wide_Character) return Boolean is begin return G.Is_UTF_32_Space (Wide_Wide_Character'Pos (U)); end Is_Space; function Is_Space (C : Category) return Boolean is begin return G.Is_UTF_32_Space (G.Category (C)); end Is_Space; -------------- -- To_Basic -- -------------- function To_Basic (U : Wide_Wide_Character) return Wide_Wide_Character is begin return Wide_Wide_Character'Val (G.UTF_32_To_Basic (Wide_Wide_Character'Pos (U))); end To_Basic; ------------------- -- To_Lower_Case -- ------------------- function To_Lower_Case (U : Wide_Wide_Character) return Wide_Wide_Character is begin return Wide_Wide_Character'Val (G.UTF_32_To_Lower_Case (Wide_Wide_Character'Pos (U))); end To_Lower_Case; ------------------- -- To_Upper_Case -- ------------------- function To_Upper_Case (U : Wide_Wide_Character) return Wide_Wide_Character is begin return Wide_Wide_Character'Val (G.UTF_32_To_Upper_Case (Wide_Wide_Character'Pos (U))); end To_Upper_Case; end Ada.Wide_Wide_Characters.Unicode;
zhmu/ananas
Ada
115
ads
generic package Inline18_Gen1.Inner_G is type T is new Inline18_Gen1.T; Val : T; end Inline18_Gen1.Inner_G;
AdaCore/gpr
Ada
233
ads
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- with Ada.Containers.Vectors; package GPR2.View_Ids.Vector is new Ada.Containers.Vectors (Positive, GPR2.View_Ids.View_Id);
AdaCore/ada-traits-containers
Ada
820
ads
-- -- Copyright (C) 2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- with GNATCOLL.Asserts; use GNATCOLL.Asserts; with Conts; use Conts; package Asserts is type Testsuite_Reporter is new Error_Reporter with null record; overriding procedure On_Assertion_Failed (Self : Testsuite_Reporter; Msg : String; Details : String; Location : String; Entity : String); Reporter : Testsuite_Reporter; package Testsuite_Asserts is new GNATCOLL.Asserts.Asserts (Reporter, Enabled => True); use Testsuite_Asserts; package Integers is new Compare (Integer, Integer'Image); package Booleans is new Compare (Boolean, Boolean'Image); package Counts is new Compare (Count_Type, Count_Type'Image); end Asserts;
tum-ei-rcs/StratoX
Ada
2,696
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . M A C H I N E _ R E S E T -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011, 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. -- -- -- -- -- -- -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Abruptly stop the program. -- On bareboard platform, this returns to the monitor or reset the board. -- In the context of an OS, this terminates the process. package System.Machine_Reset with SPARK_Mode => On is procedure Stop; pragma No_Return (Stop); -- Abruptly stop the program end System.Machine_Reset;
oresat/oresat-c3-rf
Ada
15,736
adb
M:configmaster T:Fconfigmaster$axradio_status_receive[({0}S:S$phy$0$0({10}STaxradio_status_receive_phy:S),Z,0,0)({10}S:S$mac$0$0({12}STaxradio_status_receive_mac:S),Z,0,0)({22}S:S$pktdata$0$0({2}DX,SC:U),Z,0,0)({24}S:S$pktlen$0$0({2}SI:U),Z,0,0)] T:Fconfigmaster$axradio_address[({0}S:S$addr$0$0({5}DA5d,SC:U),Z,0,0)] T:Fconfigmaster$axradio_address_mask[({0}S:S$addr$0$0({5}DA5d,SC:U),Z,0,0)({5}S:S$mask$0$0({5}DA5d,SC:U),Z,0,0)] T:Fconfigmaster$__00000000[({0}S:S$rx$0$0({26}STaxradio_status_receive:S),Z,0,0)({0}S:S$cs$0$0({3}STaxradio_status_channelstate:S),Z,0,0)] T:Fconfigmaster$axradio_status_channelstate[({0}S:S$rssi$0$0({2}SI:S),Z,0,0)({2}S:S$busy$0$0({1}SC:U),Z,0,0)] T:Fconfigmaster$axradio_status_receive_mac[({0}S:S$remoteaddr$0$0({5}DA5d,SC:U),Z,0,0)({5}S:S$localaddr$0$0({5}DA5d,SC:U),Z,0,0)({10}S:S$raw$0$0({2}DX,SC:U),Z,0,0)] T:Fconfigmaster$axradio_status_receive_phy[({0}S:S$rssi$0$0({2}SI:S),Z,0,0)({2}S:S$offset$0$0({4}SL:S),Z,0,0)({6}S:S$timeoffset$0$0({2}SI:S),Z,0,0)({8}S:S$period$0$0({2}SI:S),Z,0,0)] T:Fconfigmaster$axradio_status[({0}S:S$status$0$0({1}SC:U),Z,0,0)({1}S:S$error$0$0({1}SC:U),Z,0,0)({2}S:S$time$0$0({4}SL:U),Z,0,0)({6}S:S$u$0$0({26}ST__00000000:S),Z,0,0)] S:G$random_seed$0$0({2}SI:U),E,0,0 S:G$ADCCH0VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH0VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH0VAL$0$0({2}SI:U),F,0,0 S:G$ADCCH1VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH1VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH1VAL$0$0({2}SI:U),F,0,0 S:G$ADCCH2VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH2VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH2VAL$0$0({2}SI:U),F,0,0 S:G$ADCCH3VAL0$0$0({1}SC:U),F,0,0 S:G$ADCCH3VAL1$0$0({1}SC:U),F,0,0 S:G$ADCCH3VAL$0$0({2}SI:U),F,0,0 S:G$ADCTUNE0$0$0({1}SC:U),F,0,0 S:G$ADCTUNE1$0$0({1}SC:U),F,0,0 S:G$ADCTUNE2$0$0({1}SC:U),F,0,0 S:G$DMA0ADDR0$0$0({1}SC:U),F,0,0 S:G$DMA0ADDR1$0$0({1}SC:U),F,0,0 S:G$DMA0ADDR$0$0({2}SI:U),F,0,0 S:G$DMA0CONFIG$0$0({1}SC:U),F,0,0 S:G$DMA1ADDR0$0$0({1}SC:U),F,0,0 S:G$DMA1ADDR1$0$0({1}SC:U),F,0,0 S:G$DMA1ADDR$0$0({2}SI:U),F,0,0 S:G$DMA1CONFIG$0$0({1}SC:U),F,0,0 S:G$FRCOSCCONFIG$0$0({1}SC:U),F,0,0 S:G$FRCOSCCTRL$0$0({1}SC:U),F,0,0 S:G$FRCOSCFREQ0$0$0({1}SC:U),F,0,0 S:G$FRCOSCFREQ1$0$0({1}SC:U),F,0,0 S:G$FRCOSCFREQ$0$0({2}SI:U),F,0,0 S:G$FRCOSCKFILT0$0$0({1}SC:U),F,0,0 S:G$FRCOSCKFILT1$0$0({1}SC:U),F,0,0 S:G$FRCOSCKFILT$0$0({2}SI:U),F,0,0 S:G$FRCOSCPER0$0$0({1}SC:U),F,0,0 S:G$FRCOSCPER1$0$0({1}SC:U),F,0,0 S:G$FRCOSCPER$0$0({2}SI:U),F,0,0 S:G$FRCOSCREF0$0$0({1}SC:U),F,0,0 S:G$FRCOSCREF1$0$0({1}SC:U),F,0,0 S:G$FRCOSCREF$0$0({2}SI:U),F,0,0 S:G$ANALOGA$0$0({1}SC:U),F,0,0 S:G$GPIOENABLE$0$0({1}SC:U),F,0,0 S:G$EXTIRQ$0$0({1}SC:U),F,0,0 S:G$INTCHGA$0$0({1}SC:U),F,0,0 S:G$INTCHGB$0$0({1}SC:U),F,0,0 S:G$INTCHGC$0$0({1}SC:U),F,0,0 S:G$PALTA$0$0({1}SC:U),F,0,0 S:G$PALTB$0$0({1}SC:U),F,0,0 S:G$PALTC$0$0({1}SC:U),F,0,0 S:G$PALTRADIO$0$0({1}SC:U),F,0,0 S:G$PINCHGA$0$0({1}SC:U),F,0,0 S:G$PINCHGB$0$0({1}SC:U),F,0,0 S:G$PINCHGC$0$0({1}SC:U),F,0,0 S:G$PINSEL$0$0({1}SC:U),F,0,0 S:G$LPOSCCONFIG$0$0({1}SC:U),F,0,0 S:G$LPOSCFREQ0$0$0({1}SC:U),F,0,0 S:G$LPOSCFREQ1$0$0({1}SC:U),F,0,0 S:G$LPOSCFREQ$0$0({2}SI:U),F,0,0 S:G$LPOSCKFILT0$0$0({1}SC:U),F,0,0 S:G$LPOSCKFILT1$0$0({1}SC:U),F,0,0 S:G$LPOSCKFILT$0$0({2}SI:U),F,0,0 S:G$LPOSCPER0$0$0({1}SC:U),F,0,0 S:G$LPOSCPER1$0$0({1}SC:U),F,0,0 S:G$LPOSCPER$0$0({2}SI:U),F,0,0 S:G$LPOSCREF0$0$0({1}SC:U),F,0,0 S:G$LPOSCREF1$0$0({1}SC:U),F,0,0 S:G$LPOSCREF$0$0({2}SI:U),F,0,0 S:G$LPXOSCGM$0$0({1}SC:U),F,0,0 S:G$MISCCTRL$0$0({1}SC:U),F,0,0 S:G$OSCCALIB$0$0({1}SC:U),F,0,0 S:G$OSCFORCERUN$0$0({1}SC:U),F,0,0 S:G$OSCREADY$0$0({1}SC:U),F,0,0 S:G$OSCRUN$0$0({1}SC:U),F,0,0 S:G$RADIOFDATAADDR0$0$0({1}SC:U),F,0,0 S:G$RADIOFDATAADDR1$0$0({1}SC:U),F,0,0 S:G$RADIOFDATAADDR$0$0({2}SI:U),F,0,0 S:G$RADIOFSTATADDR0$0$0({1}SC:U),F,0,0 S:G$RADIOFSTATADDR1$0$0({1}SC:U),F,0,0 S:G$RADIOFSTATADDR$0$0({2}SI:U),F,0,0 S:G$RADIOMUX$0$0({1}SC:U),F,0,0 S:G$SCRATCH0$0$0({1}SC:U),F,0,0 S:G$SCRATCH1$0$0({1}SC:U),F,0,0 S:G$SCRATCH2$0$0({1}SC:U),F,0,0 S:G$SCRATCH3$0$0({1}SC:U),F,0,0 S:G$SILICONREV$0$0({1}SC:U),F,0,0 S:G$XTALAMPL$0$0({1}SC:U),F,0,0 S:G$XTALOSC$0$0({1}SC:U),F,0,0 S:G$XTALREADY$0$0({1}SC:U),F,0,0 S:G$ACC$0$0({1}SC:U),I,0,0 S:G$B$0$0({1}SC:U),I,0,0 S:G$DPH$0$0({1}SC:U),I,0,0 S:G$DPH1$0$0({1}SC:U),I,0,0 S:G$DPL$0$0({1}SC:U),I,0,0 S:G$DPL1$0$0({1}SC:U),I,0,0 S:G$DPTR0$0$0({2}SI:U),I,0,0 S:G$DPTR1$0$0({2}SI:U),I,0,0 S:G$DPS$0$0({1}SC:U),I,0,0 S:G$E2IE$0$0({1}SC:U),I,0,0 S:G$E2IP$0$0({1}SC:U),I,0,0 S:G$EIE$0$0({1}SC:U),I,0,0 S:G$EIP$0$0({1}SC:U),I,0,0 S:G$IE$0$0({1}SC:U),I,0,0 S:G$IP$0$0({1}SC:U),I,0,0 S:G$PCON$0$0({1}SC:U),I,0,0 S:G$PSW$0$0({1}SC:U),I,0,0 S:G$SP$0$0({1}SC:U),I,0,0 S:G$XPAGE$0$0({1}SC:U),I,0,0 S:G$_XPAGE$0$0({1}SC:U),I,0,0 S:G$ADCCH0CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCH1CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCH2CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCH3CONFIG$0$0({1}SC:U),I,0,0 S:G$ADCCLKSRC$0$0({1}SC:U),I,0,0 S:G$ADCCONV$0$0({1}SC:U),I,0,0 S:G$ANALOGCOMP$0$0({1}SC:U),I,0,0 S:G$CLKCON$0$0({1}SC:U),I,0,0 S:G$CLKSTAT$0$0({1}SC:U),I,0,0 S:G$CODECONFIG$0$0({1}SC:U),I,0,0 S:G$DBGLNKBUF$0$0({1}SC:U),I,0,0 S:G$DBGLNKSTAT$0$0({1}SC:U),I,0,0 S:G$DIRA$0$0({1}SC:U),I,0,0 S:G$DIRB$0$0({1}SC:U),I,0,0 S:G$DIRC$0$0({1}SC:U),I,0,0 S:G$DIRR$0$0({1}SC:U),I,0,0 S:G$PINA$0$0({1}SC:U),I,0,0 S:G$PINB$0$0({1}SC:U),I,0,0 S:G$PINC$0$0({1}SC:U),I,0,0 S:G$PINR$0$0({1}SC:U),I,0,0 S:G$PORTA$0$0({1}SC:U),I,0,0 S:G$PORTB$0$0({1}SC:U),I,0,0 S:G$PORTC$0$0({1}SC:U),I,0,0 S:G$PORTR$0$0({1}SC:U),I,0,0 S:G$IC0CAPT0$0$0({1}SC:U),I,0,0 S:G$IC0CAPT1$0$0({1}SC:U),I,0,0 S:G$IC0CAPT$0$0({2}SI:U),I,0,0 S:G$IC0MODE$0$0({1}SC:U),I,0,0 S:G$IC0STATUS$0$0({1}SC:U),I,0,0 S:G$IC1CAPT0$0$0({1}SC:U),I,0,0 S:G$IC1CAPT1$0$0({1}SC:U),I,0,0 S:G$IC1CAPT$0$0({2}SI:U),I,0,0 S:G$IC1MODE$0$0({1}SC:U),I,0,0 S:G$IC1STATUS$0$0({1}SC:U),I,0,0 S:G$NVADDR0$0$0({1}SC:U),I,0,0 S:G$NVADDR1$0$0({1}SC:U),I,0,0 S:G$NVADDR$0$0({2}SI:U),I,0,0 S:G$NVDATA0$0$0({1}SC:U),I,0,0 S:G$NVDATA1$0$0({1}SC:U),I,0,0 S:G$NVDATA$0$0({2}SI:U),I,0,0 S:G$NVKEY$0$0({1}SC:U),I,0,0 S:G$NVSTATUS$0$0({1}SC:U),I,0,0 S:G$OC0COMP0$0$0({1}SC:U),I,0,0 S:G$OC0COMP1$0$0({1}SC:U),I,0,0 S:G$OC0COMP$0$0({2}SI:U),I,0,0 S:G$OC0MODE$0$0({1}SC:U),I,0,0 S:G$OC0PIN$0$0({1}SC:U),I,0,0 S:G$OC0STATUS$0$0({1}SC:U),I,0,0 S:G$OC1COMP0$0$0({1}SC:U),I,0,0 S:G$OC1COMP1$0$0({1}SC:U),I,0,0 S:G$OC1COMP$0$0({2}SI:U),I,0,0 S:G$OC1MODE$0$0({1}SC:U),I,0,0 S:G$OC1PIN$0$0({1}SC:U),I,0,0 S:G$OC1STATUS$0$0({1}SC:U),I,0,0 S:G$RADIOACC$0$0({1}SC:U),I,0,0 S:G$RADIOADDR0$0$0({1}SC:U),I,0,0 S:G$RADIOADDR1$0$0({1}SC:U),I,0,0 S:G$RADIOADDR$0$0({2}SI:U),I,0,0 S:G$RADIODATA0$0$0({1}SC:U),I,0,0 S:G$RADIODATA1$0$0({1}SC:U),I,0,0 S:G$RADIODATA2$0$0({1}SC:U),I,0,0 S:G$RADIODATA3$0$0({1}SC:U),I,0,0 S:G$RADIODATA$0$0({4}SL:U),I,0,0 S:G$RADIOSTAT0$0$0({1}SC:U),I,0,0 S:G$RADIOSTAT1$0$0({1}SC:U),I,0,0 S:G$RADIOSTAT$0$0({2}SI:U),I,0,0 S:G$SPCLKSRC$0$0({1}SC:U),I,0,0 S:G$SPMODE$0$0({1}SC:U),I,0,0 S:G$SPSHREG$0$0({1}SC:U),I,0,0 S:G$SPSTATUS$0$0({1}SC:U),I,0,0 S:G$T0CLKSRC$0$0({1}SC:U),I,0,0 S:G$T0CNT0$0$0({1}SC:U),I,0,0 S:G$T0CNT1$0$0({1}SC:U),I,0,0 S:G$T0CNT$0$0({2}SI:U),I,0,0 S:G$T0MODE$0$0({1}SC:U),I,0,0 S:G$T0PERIOD0$0$0({1}SC:U),I,0,0 S:G$T0PERIOD1$0$0({1}SC:U),I,0,0 S:G$T0PERIOD$0$0({2}SI:U),I,0,0 S:G$T0STATUS$0$0({1}SC:U),I,0,0 S:G$T1CLKSRC$0$0({1}SC:U),I,0,0 S:G$T1CNT0$0$0({1}SC:U),I,0,0 S:G$T1CNT1$0$0({1}SC:U),I,0,0 S:G$T1CNT$0$0({2}SI:U),I,0,0 S:G$T1MODE$0$0({1}SC:U),I,0,0 S:G$T1PERIOD0$0$0({1}SC:U),I,0,0 S:G$T1PERIOD1$0$0({1}SC:U),I,0,0 S:G$T1PERIOD$0$0({2}SI:U),I,0,0 S:G$T1STATUS$0$0({1}SC:U),I,0,0 S:G$T2CLKSRC$0$0({1}SC:U),I,0,0 S:G$T2CNT0$0$0({1}SC:U),I,0,0 S:G$T2CNT1$0$0({1}SC:U),I,0,0 S:G$T2CNT$0$0({2}SI:U),I,0,0 S:G$T2MODE$0$0({1}SC:U),I,0,0 S:G$T2PERIOD0$0$0({1}SC:U),I,0,0 S:G$T2PERIOD1$0$0({1}SC:U),I,0,0 S:G$T2PERIOD$0$0({2}SI:U),I,0,0 S:G$T2STATUS$0$0({1}SC:U),I,0,0 S:G$U0CTRL$0$0({1}SC:U),I,0,0 S:G$U0MODE$0$0({1}SC:U),I,0,0 S:G$U0SHREG$0$0({1}SC:U),I,0,0 S:G$U0STATUS$0$0({1}SC:U),I,0,0 S:G$U1CTRL$0$0({1}SC:U),I,0,0 S:G$U1MODE$0$0({1}SC:U),I,0,0 S:G$U1SHREG$0$0({1}SC:U),I,0,0 S:G$U1STATUS$0$0({1}SC:U),I,0,0 S:G$WDTCFG$0$0({1}SC:U),I,0,0 S:G$WDTRESET$0$0({1}SC:U),I,0,0 S:G$WTCFGA$0$0({1}SC:U),I,0,0 S:G$WTCFGB$0$0({1}SC:U),I,0,0 S:G$WTCNTA0$0$0({1}SC:U),I,0,0 S:G$WTCNTA1$0$0({1}SC:U),I,0,0 S:G$WTCNTA$0$0({2}SI:U),I,0,0 S:G$WTCNTB0$0$0({1}SC:U),I,0,0 S:G$WTCNTB1$0$0({1}SC:U),I,0,0 S:G$WTCNTB$0$0({2}SI:U),I,0,0 S:G$WTCNTR1$0$0({1}SC:U),I,0,0 S:G$WTEVTA0$0$0({1}SC:U),I,0,0 S:G$WTEVTA1$0$0({1}SC:U),I,0,0 S:G$WTEVTA$0$0({2}SI:U),I,0,0 S:G$WTEVTB0$0$0({1}SC:U),I,0,0 S:G$WTEVTB1$0$0({1}SC:U),I,0,0 S:G$WTEVTB$0$0({2}SI:U),I,0,0 S:G$WTEVTC0$0$0({1}SC:U),I,0,0 S:G$WTEVTC1$0$0({1}SC:U),I,0,0 S:G$WTEVTC$0$0({2}SI:U),I,0,0 S:G$WTEVTD0$0$0({1}SC:U),I,0,0 S:G$WTEVTD1$0$0({1}SC:U),I,0,0 S:G$WTEVTD$0$0({2}SI:U),I,0,0 S:G$WTIRQEN$0$0({1}SC:U),I,0,0 S:G$WTSTAT$0$0({1}SC:U),I,0,0 S:G$ACC_0$0$0({1}SX:U),J,0,0 S:G$ACC_1$0$0({1}SX:U),J,0,0 S:G$ACC_2$0$0({1}SX:U),J,0,0 S:G$ACC_3$0$0({1}SX:U),J,0,0 S:G$ACC_4$0$0({1}SX:U),J,0,0 S:G$ACC_5$0$0({1}SX:U),J,0,0 S:G$ACC_6$0$0({1}SX:U),J,0,0 S:G$ACC_7$0$0({1}SX:U),J,0,0 S:G$B_0$0$0({1}SX:U),J,0,0 S:G$B_1$0$0({1}SX:U),J,0,0 S:G$B_2$0$0({1}SX:U),J,0,0 S:G$B_3$0$0({1}SX:U),J,0,0 S:G$B_4$0$0({1}SX:U),J,0,0 S:G$B_5$0$0({1}SX:U),J,0,0 S:G$B_6$0$0({1}SX:U),J,0,0 S:G$B_7$0$0({1}SX:U),J,0,0 S:G$E2IE_0$0$0({1}SX:U),J,0,0 S:G$E2IE_1$0$0({1}SX:U),J,0,0 S:G$E2IE_2$0$0({1}SX:U),J,0,0 S:G$E2IE_3$0$0({1}SX:U),J,0,0 S:G$E2IE_4$0$0({1}SX:U),J,0,0 S:G$E2IE_5$0$0({1}SX:U),J,0,0 S:G$E2IE_6$0$0({1}SX:U),J,0,0 S:G$E2IE_7$0$0({1}SX:U),J,0,0 S:G$E2IP_0$0$0({1}SX:U),J,0,0 S:G$E2IP_1$0$0({1}SX:U),J,0,0 S:G$E2IP_2$0$0({1}SX:U),J,0,0 S:G$E2IP_3$0$0({1}SX:U),J,0,0 S:G$E2IP_4$0$0({1}SX:U),J,0,0 S:G$E2IP_5$0$0({1}SX:U),J,0,0 S:G$E2IP_6$0$0({1}SX:U),J,0,0 S:G$E2IP_7$0$0({1}SX:U),J,0,0 S:G$EIE_0$0$0({1}SX:U),J,0,0 S:G$EIE_1$0$0({1}SX:U),J,0,0 S:G$EIE_2$0$0({1}SX:U),J,0,0 S:G$EIE_3$0$0({1}SX:U),J,0,0 S:G$EIE_4$0$0({1}SX:U),J,0,0 S:G$EIE_5$0$0({1}SX:U),J,0,0 S:G$EIE_6$0$0({1}SX:U),J,0,0 S:G$EIE_7$0$0({1}SX:U),J,0,0 S:G$EIP_0$0$0({1}SX:U),J,0,0 S:G$EIP_1$0$0({1}SX:U),J,0,0 S:G$EIP_2$0$0({1}SX:U),J,0,0 S:G$EIP_3$0$0({1}SX:U),J,0,0 S:G$EIP_4$0$0({1}SX:U),J,0,0 S:G$EIP_5$0$0({1}SX:U),J,0,0 S:G$EIP_6$0$0({1}SX:U),J,0,0 S:G$EIP_7$0$0({1}SX:U),J,0,0 S:G$IE_0$0$0({1}SX:U),J,0,0 S:G$IE_1$0$0({1}SX:U),J,0,0 S:G$IE_2$0$0({1}SX:U),J,0,0 S:G$IE_3$0$0({1}SX:U),J,0,0 S:G$IE_4$0$0({1}SX:U),J,0,0 S:G$IE_5$0$0({1}SX:U),J,0,0 S:G$IE_6$0$0({1}SX:U),J,0,0 S:G$IE_7$0$0({1}SX:U),J,0,0 S:G$EA$0$0({1}SX:U),J,0,0 S:G$IP_0$0$0({1}SX:U),J,0,0 S:G$IP_1$0$0({1}SX:U),J,0,0 S:G$IP_2$0$0({1}SX:U),J,0,0 S:G$IP_3$0$0({1}SX:U),J,0,0 S:G$IP_4$0$0({1}SX:U),J,0,0 S:G$IP_5$0$0({1}SX:U),J,0,0 S:G$IP_6$0$0({1}SX:U),J,0,0 S:G$IP_7$0$0({1}SX:U),J,0,0 S:G$P$0$0({1}SX:U),J,0,0 S:G$F1$0$0({1}SX:U),J,0,0 S:G$OV$0$0({1}SX:U),J,0,0 S:G$RS0$0$0({1}SX:U),J,0,0 S:G$RS1$0$0({1}SX:U),J,0,0 S:G$F0$0$0({1}SX:U),J,0,0 S:G$AC$0$0({1}SX:U),J,0,0 S:G$CY$0$0({1}SX:U),J,0,0 S:G$PINA_0$0$0({1}SX:U),J,0,0 S:G$PINA_1$0$0({1}SX:U),J,0,0 S:G$PINA_2$0$0({1}SX:U),J,0,0 S:G$PINA_3$0$0({1}SX:U),J,0,0 S:G$PINA_4$0$0({1}SX:U),J,0,0 S:G$PINA_5$0$0({1}SX:U),J,0,0 S:G$PINA_6$0$0({1}SX:U),J,0,0 S:G$PINA_7$0$0({1}SX:U),J,0,0 S:G$PINB_0$0$0({1}SX:U),J,0,0 S:G$PINB_1$0$0({1}SX:U),J,0,0 S:G$PINB_2$0$0({1}SX:U),J,0,0 S:G$PINB_3$0$0({1}SX:U),J,0,0 S:G$PINB_4$0$0({1}SX:U),J,0,0 S:G$PINB_5$0$0({1}SX:U),J,0,0 S:G$PINB_6$0$0({1}SX:U),J,0,0 S:G$PINB_7$0$0({1}SX:U),J,0,0 S:G$PINC_0$0$0({1}SX:U),J,0,0 S:G$PINC_1$0$0({1}SX:U),J,0,0 S:G$PINC_2$0$0({1}SX:U),J,0,0 S:G$PINC_3$0$0({1}SX:U),J,0,0 S:G$PINC_4$0$0({1}SX:U),J,0,0 S:G$PINC_5$0$0({1}SX:U),J,0,0 S:G$PINC_6$0$0({1}SX:U),J,0,0 S:G$PINC_7$0$0({1}SX:U),J,0,0 S:G$PORTA_0$0$0({1}SX:U),J,0,0 S:G$PORTA_1$0$0({1}SX:U),J,0,0 S:G$PORTA_2$0$0({1}SX:U),J,0,0 S:G$PORTA_3$0$0({1}SX:U),J,0,0 S:G$PORTA_4$0$0({1}SX:U),J,0,0 S:G$PORTA_5$0$0({1}SX:U),J,0,0 S:G$PORTA_6$0$0({1}SX:U),J,0,0 S:G$PORTA_7$0$0({1}SX:U),J,0,0 S:G$PORTB_0$0$0({1}SX:U),J,0,0 S:G$PORTB_1$0$0({1}SX:U),J,0,0 S:G$PORTB_2$0$0({1}SX:U),J,0,0 S:G$PORTB_3$0$0({1}SX:U),J,0,0 S:G$PORTB_4$0$0({1}SX:U),J,0,0 S:G$PORTB_5$0$0({1}SX:U),J,0,0 S:G$PORTB_6$0$0({1}SX:U),J,0,0 S:G$PORTB_7$0$0({1}SX:U),J,0,0 S:G$PORTC_0$0$0({1}SX:U),J,0,0 S:G$PORTC_1$0$0({1}SX:U),J,0,0 S:G$PORTC_2$0$0({1}SX:U),J,0,0 S:G$PORTC_3$0$0({1}SX:U),J,0,0 S:G$PORTC_4$0$0({1}SX:U),J,0,0 S:G$PORTC_5$0$0({1}SX:U),J,0,0 S:G$PORTC_6$0$0({1}SX:U),J,0,0 S:G$PORTC_7$0$0({1}SX:U),J,0,0 S:G$delay$0$0({2}DF,SV:S),C,0,0 S:G$random$0$0({2}DF,SI:U),C,0,0 S:G$signextend12$0$0({2}DF,SL:S),C,0,0 S:G$signextend16$0$0({2}DF,SL:S),C,0,0 S:G$signextend20$0$0({2}DF,SL:S),C,0,0 S:G$signextend24$0$0({2}DF,SL:S),C,0,0 S:G$hweight8$0$0({2}DF,SC:U),C,0,0 S:G$hweight16$0$0({2}DF,SC:U),C,0,0 S:G$hweight32$0$0({2}DF,SC:U),C,0,0 S:G$signedlimit16$0$0({2}DF,SI:S),C,0,0 S:G$checksignedlimit16$0$0({2}DF,SC:U),C,0,0 S:G$signedlimit32$0$0({2}DF,SL:S),C,0,0 S:G$checksignedlimit32$0$0({2}DF,SC:U),C,0,0 S:G$gray_encode8$0$0({2}DF,SC:U),C,0,0 S:G$gray_decode8$0$0({2}DF,SC:U),C,0,0 S:G$rev8$0$0({2}DF,SC:U),C,0,0 S:G$fmemset$0$0({2}DF,SV:S),C,0,0 S:G$fmemcpy$0$0({2}DF,SV:S),C,0,0 S:G$get_startcause$0$0({2}DF,SC:U),C,0,0 S:G$wtimer_standby$0$0({2}DF,SV:S),C,0,0 S:G$enter_standby$0$0({2}DF,SV:S),C,0,0 S:G$enter_deepsleep$0$0({2}DF,SV:S),C,0,0 S:G$enter_sleep$0$0({2}DF,SV:S),C,0,0 S:G$enter_sleep_cont$0$0({2}DF,SV:S),C,0,0 S:G$reset_cpu$0$0({2}DF,SV:S),C,0,0 S:G$turn_off_xosc$0$0({2}DF,SV:S),C,0,0 S:G$turn_off_lpxosc$0$0({2}DF,SV:S),C,0,0 S:G$enter_critical$0$0({2}DF,SC:U),C,0,0 S:G$exit_critical$0$0({2}DF,SV:S),C,0,0 S:G$reenter_critical$0$0({2}DF,SV:S),C,0,0 S:G$__enable_irq$0$0({2}DF,SV:S),C,0,0 S:G$__disable_irq$0$0({2}DF,SV:S),C,0,0 S:G$axradio_init$0$0({2}DF,SC:U),C,0,0 S:G$axradio_cansleep$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_mode$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_mode$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_channel$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_channel$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_pllrange$0$0({2}DF,SI:U),C,0,0 S:G$axradio_get_pllvcoi$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_local_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_get_local_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_set_default_remote_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_get_default_remote_address$0$0({2}DF,SV:S),C,0,0 S:G$axradio_transmit$0$0({2}DF,SC:U),C,0,0 S:G$axradio_set_freqoffset$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_freqoffset$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_freq_tohz$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_freq_fromhz$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_timeinterval_totimer0$0$0({2}DF,SL:S),C,0,0 S:G$axradio_conv_time_totimer0$0$0({2}DF,SL:U),C,0,0 S:G$axradio_statuschange$0$0({2}DF,SV:S),C,0,0 S:G$axradio_agc_freeze$0$0({2}DF,SC:U),C,0,0 S:G$axradio_agc_thaw$0$0({2}DF,SC:U),C,0,0 S:G$axradio_calibrate_lposc$0$0({2}DF,SV:S),C,0,0 S:G$axradio_check_fourfsk_modulation$0$0({2}DF,SC:U),C,0,0 S:G$axradio_get_transmitter_pa_type$0$0({2}DF,SC:U),C,0,0 S:G$axradio_setup_pincfg1$0$0({2}DF,SV:S),C,0,0 S:G$axradio_setup_pincfg2$0$0({2}DF,SV:S),C,0,0 S:G$axradio_commsleepexit$0$0({2}DF,SV:S),C,0,0 S:G$axradio_dbgpkt_enableIRQ$0$0({2}DF,SV:S),C,0,0 S:G$axradio_isr$0$0({2}DF,SV:S),C,0,0 S:G$axradio_framing_maclen$0$0({1}SC:U),D,0,0 S:G$axradio_framing_addrlen$0$0({1}SC:U),D,0,0 S:G$remoteaddr$0$0({5}STaxradio_address:S),D,0,0 S:G$localaddr$0$0({10}STaxradio_address_mask:S),D,0,0 S:G$framing_insert_counter$0$0({1}SC:U),D,0,0 S:G$framing_counter_pos$0$0({1}SC:U),D,0,0 S:G$demo_packet$0$0({18}DA18d,SC:U),D,0,0 S:G$lpxosc_settlingtime$0$0({2}SI:U),D,0,0
LaplaceKorea/coinapi-sdk
Ada
2,791
ads
-- OEML _ REST API -- This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> -- -- The version of the OpenAPI document: v1 -- Contact: [email protected] -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.2.1. -- https://openapi-generator.tech -- Do not edit the class manually. with .Models; with Swagger.Clients; package .Clients is pragma Style_Checks ("-mr"); type Client_Type is new Swagger.Clients.Client_Type with null record; -- Get balances -- Get current currency balance from all or single exchange. procedure V_1Balances_Get (Client : in out Client_Type; Exchange_Id : in Swagger.Nullable_UString; Result : out .Models.Balance_Type_Vectors.Vector); -- Cancel all orders request -- This request cancels all open orders on single specified exchange. procedure V_1Orders_Cancel_All_Post (Client : in out Client_Type; Order_Cancel_All_Request_Type : in .Models.OrderCancelAllRequest_Type; Result : out .Models.MessageReject_Type); -- Cancel order request -- Request cancel for an existing order. The order can be canceled using the `client_order_id` or `exchange_order_id`. procedure V_1Orders_Cancel_Post (Client : in out Client_Type; Order_Cancel_Single_Request_Type : in .Models.OrderCancelSingleRequest_Type; Result : out .Models.OrderExecutionReport_Type); -- Get open orders -- Get last execution reports for open orders across all or single exchange. procedure V_1Orders_Get (Client : in out Client_Type; Exchange_Id : in Swagger.Nullable_UString; Result : out .Models.OrderExecutionReport_Type_Vectors.Vector); -- Send new order -- This request creating new order for the specific exchange. procedure V_1Orders_Post (Client : in out Client_Type; Order_New_Single_Request_Type : in .Models.OrderNewSingleRequest_Type; Result : out .Models.OrderExecutionReport_Type); -- Get order execution report -- Get the last order execution report for the specified order. The requested order does not need to be active or opened. procedure V_1Orders_Status_Client_Order_Id_Get (Client : in out Client_Type; Client_Order_Id : in Swagger.UString; Result : out .Models.OrderExecutionReport_Type); -- Get open positions -- Get current open positions across all or single exchange. procedure V_1Positions_Get (Client : in out Client_Type; Exchange_Id : in Swagger.Nullable_UString; Result : out .Models.Position_Type_Vectors.Vector); end .Clients;
albertklee/SPARKZumo
Ada
9,565
adb
pragma SPARK_Mode; with Interfaces.C; use Interfaces.C; package body Line_Finder is Noise_Threshold : constant := Timeout / 10; Line_Threshold : constant := Timeout / 2; procedure LineFinder (ReadMode : Sensor_Read_Mode) is Line_State : LineState; State_Thresh : Boolean; begin ReadLine (WhiteLine => True, ReadMode => ReadMode, State => Line_State); case BotState.Decision is when Simple => Fast_Speed := Default_Fast_Speed; Slow_Speed := Default_Slow_Speed; SimpleDecisionMatrix (State => Line_State); when Complex => Geo_Filter.FilterState (State => Line_State, Thresh => State_Thresh); if State_Thresh then Fast_Speed := Default_Fast_Speed; Slow_Speed := Default_Slow_Speed; else Fast_Speed := Default_Slow_Speed; Slow_Speed := Default_Slowest_Speed; end if; DecisionMatrix (State => Line_State); end case; end LineFinder; procedure ReadLine (WhiteLine : Boolean; ReadMode : Sensor_Read_Mode; State : out LineState) is begin Zumo_QTR.ReadCalibrated (Sensor_Values => BotState.Sensor_Values, ReadMode => ReadMode); BotState.LineDetect := 0; for I in BotState.Sensor_Values'Range loop if WhiteLine then BotState.Sensor_Values (I) := Sensor_Value'Last - BotState.Sensor_Values (I); end if; -- keep track of whether we see the line at all if BotState.Sensor_Values (I) > Line_Threshold then BotState.LineDetect := BotState.LineDetect + 2 ** (I - BotState.Sensor_Values'First); end if; end loop; State := LineStateLookup (Integer (BotState.LineDetect)); end ReadLine; procedure CalculateBotPosition (Pos : out Robot_Position) is Avg : long := 0; Sum : long := 0; begin for I in BotState.Sensor_Values'Range loop if BotState.Sensor_Values (I) > Noise_Threshold then Avg := Avg + long (BotState.Sensor_Values (I)) * (long (I - 1) * long (Sensor_Value'Last)); Sum := Sum + long (BotState.Sensor_Values (I)); end if; end loop; if Sum /= 0 then BotState.SensorValueHistory := Integer (Avg / Sum); if BotState.SensorValueHistory > Robot_Position'Last * 2 then BotState.SensorValueHistory := Robot_Position'Last * 2; end if; Pos := Natural (BotState.SensorValueHistory) - Robot_Position'Last; if Pos < 0 then BotState.OrientationHistory := Left; elsif Pos > 0 then BotState.OrientationHistory := Right; else BotState.OrientationHistory := Center; end if; else Pos := Robot_Position'First; end if; end CalculateBotPosition; procedure SimpleDecisionMatrix (State : LineState) is LeftSpeed : Motor_Speed; RightSpeed : Motor_Speed; LS_Saturate : Integer; RS_Saturate : Integer; Pos : Robot_Position; begin case State is when Lost => case BotState.OrientationHistory is when Left | Center => LS_Saturate := (-1) * Fast_Speed + BotState.OfflineCounter; RightSpeed := Fast_Speed; if LS_Saturate > Motor_Speed'Last then LeftSpeed := Motor_Speed'Last; elsif LS_Saturate < Motor_Speed'First then LeftSpeed := Motor_Speed'First; else LeftSpeed := LS_Saturate; end if; when Right => LeftSpeed := Fast_Speed; RS_Saturate := (-1) * Fast_Speed + BotState.OfflineCounter; if RS_Saturate > Motor_Speed'Last then RightSpeed := Motor_Speed'Last; elsif RS_Saturate < Motor_Speed'First then RightSpeed := Motor_Speed'First; else RightSpeed := RS_Saturate; end if; end case; if BotState.OfflineCounter = OfflineCounterType'Last then BotState.OfflineCounter := OfflineCounterType'First; else BotState.OfflineCounter := BotState.OfflineCounter + 1; end if; Zumo_LED.Yellow_Led (On => False); when others => BotState.LostCounter := 0; BotState.Decision := Complex; BotState.OfflineCounter := 0; Zumo_LED.Yellow_Led (On => True); CalculateBotPosition (Pos => Pos); Error_Correct (Error => Pos, Current_Speed => Fast_Speed, LeftSpeed => LeftSpeed, RightSpeed => RightSpeed); end case; Zumo_Motors.SetSpeed (LeftVelocity => LeftSpeed, RightVelocity => RightSpeed); -- Serial_Print (Msg => LineStateStr (State)); BotState.LineHistory := State; end SimpleDecisionMatrix; procedure DecisionMatrix (State : LineState) is LeftSpeed : Motor_Speed; RightSpeed : Motor_Speed; Pos : Robot_Position; begin case State is when BranchLeft => BotState.LostCounter := 0; Zumo_LED.Yellow_Led (On => False); Zumo_Motors.SetSpeed (LeftVelocity => 0, RightVelocity => Slow_Speed); when BranchRight => BotState.LostCounter := 0; Zumo_LED.Yellow_Led (On => False); Zumo_Motors.SetSpeed (LeftVelocity => Slow_Speed, RightVelocity => 0); when Perp | Fork => BotState.LostCounter := 0; case BotState.OrientationHistory is when Left | Center => LeftSpeed := 0; RightSpeed := Slow_Speed; when Right => LeftSpeed := Slow_Speed; RightSpeed := 0; end case; Zumo_LED.Yellow_Led (On => False); Zumo_Motors.SetSpeed (LeftVelocity => LeftSpeed, RightVelocity => RightSpeed); when Lost => case BotState.OrientationHistory is when Left | Center => LeftSpeed := (-1) * Fast_Speed; RightSpeed := Fast_Speed; when Right => LeftSpeed := Fast_Speed; RightSpeed := (-1) * Fast_Speed; end case; Zumo_LED.Yellow_Led (On => False); Zumo_Motors.SetSpeed (LeftVelocity => LeftSpeed, RightVelocity => RightSpeed); if BotState.LostCounter > Lost_Threshold then BotState.Decision := Simple; else BotState.LostCounter := BotState.LostCounter + 1; end if; when Online => BotState.LostCounter := 0; Zumo_LED.Yellow_Led (On => True); CalculateBotPosition (Pos => Pos); Error_Correct (Error => Pos, Current_Speed => Fast_Speed, LeftSpeed => LeftSpeed, RightSpeed => RightSpeed); Zumo_Motors.SetSpeed (LeftVelocity => LeftSpeed, RightVelocity => RightSpeed); when Unknown => null; end case; BotState.LineHistory := State; end DecisionMatrix; procedure Error_Correct (Error : Robot_Position; Current_Speed : Motor_Speed; LeftSpeed : out Motor_Speed; RightSpeed : out Motor_Speed) is Inv_Prop : constant := 8; Deriv : constant := 2; SpeedDifference : Integer; Saturate_Speed : Integer; begin SpeedDifference := Error / Inv_Prop + Deriv * (Error - BotState.ErrorHistory); BotState.ErrorHistory := Error; if SpeedDifference > Motor_Speed'Last then SpeedDifference := Current_Speed; elsif SpeedDifference < Motor_Speed'First then SpeedDifference := Current_Speed; end if; if SpeedDifference < 0 then Saturate_Speed := Current_Speed + Motor_Speed (SpeedDifference); if Saturate_Speed > Motor_Speed'Last then LeftSpeed := Motor_Speed'Last; elsif Saturate_Speed < Motor_Speed'First then LeftSpeed := Motor_Speed'First; else LeftSpeed := Saturate_Speed; end if; RightSpeed := Current_Speed; else LeftSpeed := Current_Speed; Saturate_Speed := Current_Speed - Motor_Speed (SpeedDifference); if Saturate_Speed > Motor_Speed'Last then RightSpeed := Motor_Speed'Last; elsif Saturate_Speed < Motor_Speed'First then RightSpeed := Motor_Speed'First; else RightSpeed := Saturate_Speed; end if; end if; end Error_Correct; end Line_Finder;
stcarrez/ada-servlet
Ada
2,386
adb
----------------------------------------------------------------------- -- servlet-rest -- REST Support -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Servlet.Rest.Definition is -- ------------------------------ -- Register the list of APIs that have been created by instantiating the <tt>Definition</tt> -- package. The REST servlet identified by <tt>Name</tt> is searched in the servlet registry -- and used as the servlet for processing the API requests. -- ------------------------------ procedure Register (Registry : in out Servlet.Core.Servlet_Registry; Name : in String; ELContext : in EL.Contexts.ELContext'Class) is begin Servlet.Rest.Register (Registry => Registry, Name => Name, URI => URI, ELContext => ELContext, List => Entries); end Register; overriding procedure Dispatch (Handler : in Descriptor; Req : in out Servlet.Rest.Request'Class; Reply : in out Servlet.Rest.Response'Class; Stream : in out Servlet.Rest.Output_Stream'Class) is Object : Object_Type; begin Handler.Handler (Object, Req, Reply, Stream); end Dispatch; package body Definition is P : aliased String := Pattern; begin Instance.Method := Method; Instance.Permission := Permission; Instance.Handler := Handler; Instance.Pattern := P'Access; Servlet.Rest.Register (Entries, Instance'Access); end Definition; end Servlet.Rest.Definition;
Fabien-Chouteau/coffee-clock
Ada
11,490
ads
-- This file was generated by bmp2ada with Giza.Image; with Giza.Image.DMA2D; use Giza.Image.DMA2D; package alarm_80x80 is pragma Style_Checks (Off); CLUT : aliased constant L4_CLUT_T := ( (R => 0, G => 1, B => 0), (R => 253, G => 255, B => 252), others => (0, 0, 0)); Data : aliased constant L4_Data_T := ( 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 0, 0, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 17, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 16, 17, 1, 0, 16, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 1, 0, 16, 17, 1, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 0, 0, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 0, 0, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 17, 1, 0, 16, 17, 17, 17, 17, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 17, 17, 17, 17, 1, 0, 16, 17, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 16, 17, 1, 0, 17, 17, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 17, 17, 17, 0, 16, 17, 1, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 1, 0, 16, 17, 17, 17, 1, 0, 16, 17, 1, 0, 0, 0, 0, 16, 17, 1, 0, 16, 17, 17, 17, 1, 0, 16, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 1, 0, 16, 17, 1, 0, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 0, 16, 17, 1, 0, 16, 17, 17, 17, 17, 17, 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 1, 16, 17, 17, 0, 0, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 17, 17, 1, 0, 17, 17, 1, 16, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 1, 16, 17, 17, 0, 16, 17, 17, 17, 17, 1, 16, 17, 17, 0, 16, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 1, 0, 17, 17, 1, 16, 17, 17, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 17, 17, 0, 17, 17, 1, 0, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 17, 0, 17, 17, 1, 0, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 0, 16, 17, 17, 0, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 1, 16, 17, 17, 1, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 0, 16, 17, 17, 1, 16, 17, 17, 1, 16, 17, 17, 0, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 0, 0, 17, 17, 1, 16, 17, 17, 1, 16, 17, 17, 0, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 0, 17, 17, 1, 16, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 0, 16, 17, 17, 0, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 0, 17, 17, 1, 0, 17, 17, 0, 16, 17, 1, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 0, 16, 17, 1, 0, 17, 17, 0, 16, 17, 1, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 0, 16, 17, 1, 0, 17, 1, 0, 17, 17, 1, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 0, 16, 17, 17, 0, 16, 1, 0, 17, 17, 1, 0, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 0, 16, 17, 17, 0, 16, 1, 0, 17, 17, 1, 0, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 0, 16, 17, 17, 0, 16, 1, 0, 17, 17, 0, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 0, 17, 17, 0, 16, 1, 0, 17, 17, 0, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 0, 17, 17, 0, 16, 0, 0, 17, 17, 0, 16, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 1, 0, 17, 17, 0, 0, 0, 16, 17, 17, 0, 16, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 1, 0, 17, 17, 1, 0, 0, 16, 17, 1, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 0, 16, 17, 1, 0, 0, 17, 17, 1, 0, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 0, 16, 17, 17, 0, 17, 17, 17, 1, 16, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 1, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 17, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 0, 0, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17); Image : constant Giza.Image.Ref := new Giza.Image.DMA2D.Instance' (Mode => L4, W => 80, H => 71, Length => 2840, L4_CLUT => CLUT'Access, L4_Data => Data'Access); pragma Style_Checks (On); end alarm_80x80;
reznikmm/matreshka
Ada
48,023
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_Extensions is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Extension_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_Extension (AMF.UML.Extensions.UML_Extension_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Extension_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_Extension (AMF.UML.Extensions.UML_Extension_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Extension_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_Extension (Visitor, AMF.UML.Extensions.UML_Extension_Access (Self), Control); end if; end Visit_Element; --------------------- -- Get_Is_Required -- --------------------- overriding function Get_Is_Required (Self : not null access constant UML_Extension_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Required (Self.Element); end Get_Is_Required; ------------------- -- Get_Metaclass -- ------------------- overriding function Get_Metaclass (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Classes.UML_Class_Access is begin return AMF.UML.Classes.UML_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Metaclass (Self.Element))); end Get_Metaclass; ------------------- -- Get_Owned_End -- ------------------- overriding function Get_Owned_End (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Extension_Ends.UML_Extension_End_Access is Aux : constant AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property := Self.Get_Owned_End; begin if Aux.Is_Empty then return null; else return AMF.UML.Extension_Ends.UML_Extension_End_Access (Aux.Element (1)); end if; end Get_Owned_End; ------------------- -- Set_Owned_End -- ------------------- overriding procedure Set_Owned_End (Self : not null access UML_Extension_Proxy; To : AMF.UML.Extension_Ends.UML_Extension_End_Access) is begin raise Program_Error; end Set_Owned_End; ------------------ -- Get_End_Type -- ------------------ overriding function Get_End_Type (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is begin return AMF.UML.Types.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_End_Type (Self.Element))); end Get_End_Type; -------------------- -- Get_Is_Derived -- -------------------- overriding function Get_Is_Derived (Self : not null access constant UML_Extension_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Derived (Self.Element); end Get_Is_Derived; -------------------- -- Set_Is_Derived -- -------------------- overriding procedure Set_Is_Derived (Self : not null access UML_Extension_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Derived (Self.Element, To); end Set_Is_Derived; -------------------- -- Get_Member_End -- -------------------- overriding function Get_Member_End (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member_End (Self.Element))); end Get_Member_End; ----------------------------- -- Get_Navigable_Owned_End -- ----------------------------- overriding function Get_Navigable_Owned_End (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Navigable_Owned_End (Self.Element))); end Get_Navigable_Owned_End; ------------------- -- Get_Owned_End -- ------------------- overriding function Get_Owned_End (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_End (Self.Element))); end Get_Owned_End; ------------------------- -- Get_Related_Element -- ------------------------- overriding function Get_Related_Element (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin return AMF.UML.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element (Self.Element))); end Get_Related_Element; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Attribute (Self.Element))); end Get_Attribute; --------------------------- -- Get_Collaboration_Use -- --------------------------- overriding function Get_Collaboration_Use (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is begin return AMF.UML.Collaboration_Uses.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Collaboration_Use (Self.Element))); end Get_Collaboration_Use; ----------------- -- Get_Feature -- ----------------- overriding function Get_Feature (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin return AMF.UML.Features.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Feature (Self.Element))); end Get_Feature; ----------------- -- Get_General -- ----------------- overriding function Get_General (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_General (Self.Element))); end Get_General; ------------------------ -- Get_Generalization -- ------------------------ overriding function Get_Generalization (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is begin return AMF.UML.Generalizations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization (Self.Element))); end Get_Generalization; -------------------------- -- Get_Inherited_Member -- -------------------------- overriding function Get_Inherited_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Inherited_Member (Self.Element))); end Get_Inherited_Member; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant UML_Extension_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; --------------------------------- -- Get_Is_Final_Specialization -- --------------------------------- overriding function Get_Is_Final_Specialization (Self : not null access constant UML_Extension_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Final_Specialization (Self.Element); end Get_Is_Final_Specialization; --------------------------------- -- Set_Is_Final_Specialization -- --------------------------------- overriding procedure Set_Is_Final_Specialization (Self : not null access UML_Extension_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Final_Specialization (Self.Element, To); end Set_Is_Final_Specialization; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is begin return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Extension_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; ------------------------ -- Get_Owned_Use_Case -- ------------------------ overriding function Get_Owned_Use_Case (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Use_Case (Self.Element))); end Get_Owned_Use_Case; -------------------------- -- Get_Powertype_Extent -- -------------------------- overriding function Get_Powertype_Extent (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is begin return AMF.UML.Generalization_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype_Extent (Self.Element))); end Get_Powertype_Extent; ------------------------------ -- Get_Redefined_Classifier -- ------------------------------ overriding function Get_Redefined_Classifier (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Classifier (Self.Element))); end Get_Redefined_Classifier; ------------------------ -- Get_Representation -- ------------------------ overriding function Get_Representation (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is begin return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Representation (Self.Element))); end Get_Representation; ------------------------ -- Set_Representation -- ------------------------ overriding procedure Set_Representation (Self : not null access UML_Extension_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Representation (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Representation; ---------------------- -- Get_Substitution -- ---------------------- overriding function Get_Substitution (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is begin return AMF.UML.Substitutions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Substitution (Self.Element))); end Get_Substitution; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is begin return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Extension_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------ -- Get_Use_Case -- ------------------ overriding function Get_Use_Case (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case (Self.Element))); end Get_Use_Case; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Extension_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_Extension_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_Extension_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_Extension_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_Extension_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Packages.UML_Package_Access is begin return AMF.UML.Packages.UML_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package (Self.Element))); end Get_Package; ----------------- -- Set_Package -- ----------------- overriding procedure Set_Package (Self : not null access UML_Extension_Proxy; To : AMF.UML.Packages.UML_Package_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Package (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Package; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Extension_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Extension_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is begin return AMF.UML.Template_Signatures.UML_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Extension_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; -------------------------- -- Get_Template_Binding -- -------------------------- overriding function Get_Template_Binding (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is begin return AMF.UML.Template_Bindings.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding (Self.Element))); end Get_Template_Binding; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Extension_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_Extension_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_Extension_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_Extension_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; ----------------- -- Is_Required -- ----------------- overriding function Is_Required (Self : not null access constant UML_Extension_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Required unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Is_Required"; return Is_Required (Self); end Is_Required; --------------- -- Metaclass -- --------------- overriding function Metaclass (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Classes.UML_Class_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Metaclass unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Metaclass"; return Metaclass (Self); end Metaclass; ------------------- -- Metaclass_End -- ------------------- overriding function Metaclass_End (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Properties.UML_Property_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Metaclass_End unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Metaclass_End"; return Metaclass_End (Self); end Metaclass_End; -------------- -- End_Type -- -------------- overriding function End_Type (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "End_Type unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.End_Type"; return End_Type (Self); end End_Type; ------------------ -- All_Features -- ------------------ overriding function All_Features (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.All_Features"; return All_Features (Self); end All_Features; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Extension_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------- -- General -- ------------- overriding function General (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "General unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.General"; return General (Self); end General; ----------------------- -- Has_Visibility_Of -- ----------------------- overriding function Has_Visibility_Of (Self : not null access constant UML_Extension_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Has_Visibility_Of"; return Has_Visibility_Of (Self, N); end Has_Visibility_Of; ------------- -- Inherit -- ------------- overriding function Inherit (Self : not null access constant UML_Extension_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Inherit"; return Inherit (Self, Inhs); end Inherit; ------------------------- -- Inheritable_Members -- ------------------------- overriding function Inheritable_Members (Self : not null access constant UML_Extension_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Inheritable_Members"; return Inheritable_Members (Self, C); end Inheritable_Members; ---------------------- -- Inherited_Member -- ---------------------- overriding function Inherited_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Inherited_Member"; return Inherited_Member (Self); end Inherited_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant UML_Extension_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ------------------------- -- May_Specialize_Type -- ------------------------- overriding function May_Specialize_Type (Self : not null access constant UML_Extension_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.May_Specialize_Type"; return May_Specialize_Type (Self, C); end May_Specialize_Type; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Extension_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant UML_Extension_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant UML_Extension_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Extension_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Extension_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_Extension_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_Extension_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_Extension_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_Extension_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_Extension_Proxy.Namespace"; return Namespace (Self); end Namespace; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Extension_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Extension_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant UML_Extension_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; ---------------------------- -- Parameterable_Elements -- ---------------------------- overriding function Parameterable_Elements (Self : not null access constant UML_Extension_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented"); raise Program_Error with "Unimplemented procedure UML_Extension_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Extension_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_Extension_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_Extension_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_Extension_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; end AMF.Internals.UML_Extensions;
msrLi/portingSources
Ada
914
adb
-- Copyright 2013-2014 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is Thread: Integer; begin Thread := 0; for I in 1 .. 100 loop Thread := Thread + I; -- STOP_HERE end loop; Put(Integer'Image(Thread)); end Foo;
reznikmm/matreshka
Ada
4,049
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.Meta_Ole_Object_Count_Attributes; package Matreshka.ODF_Meta.Ole_Object_Count_Attributes is type Meta_Ole_Object_Count_Attribute_Node is new Matreshka.ODF_Meta.Abstract_Meta_Attribute_Node and ODF.DOM.Meta_Ole_Object_Count_Attributes.ODF_Meta_Ole_Object_Count_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Meta_Ole_Object_Count_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Meta_Ole_Object_Count_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Meta.Ole_Object_Count_Attributes;
tobiasphilipp/sid-checker
Ada
1,268
adb
------------------------------------------------------------------------------ -- -- -- A verified resolution checker written in SPARK 2014 based on functional -- -- data structures. -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2021, Tobias Philipp -- -- -- ------------------------------------------------------------------------------ with AUnit.Run; with AUnit.Reporter.Text; with AUnit.Test_Suites; use AUnit.Test_Suites; with Sid_Tests; procedure Test is function Suite return AUnit.Test_Suites.Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (new Sid_Tests.Sid_Test); return Ret; end Suite; procedure Run is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Run (Reporter); end Test;
zhmu/ananas
Ada
1,429
adb
-- { dg-do compile } -- { dg-options "-fdump-tree-gimple" } with Atomic6_Pkg; use Atomic6_Pkg; procedure Atomic6_8 is Ptr : Int_Ptr := new Int; Temp : Integer; begin Ptr.all := Counter1; Counter1 := Ptr.all; Ptr.all := Int(Timer1); Timer1 := Integer(Ptr.all); Temp := Integer(Ptr.all); Ptr.all := Int(Temp); end; -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter1" 1 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer1" 1 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*ptr" 3 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter1" 1 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer1" 1 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*ptr" 3 "gimple"} }
persan/AdaYaml
Ada
1,846
ads
with Ada.Finalization; with Lexer.Source; package Lexer.Base is pragma Preelaborate; Default_Initial_Buffer_Size : constant := 8192; type Buffer_Type is access all String; type Private_Values is limited private; type Instance is limited new Ada.Finalization.Limited_Controlled with record Cur_Line : Positive := 1; -- index of the line at the current position Line_Start : Positive := 1; -- the buffer index where the current line started Prev_Lines_Chars : Natural := 0; -- number of characters in all previous lines, -- used for calculating index. Pos : Positive := 1; -- position of the next character to be read from the buffer Buffer : Buffer_Type; -- input buffer. filled from the source. Internal : Private_Values; end record; procedure Init (Object : in out Instance; Input : Source.Pointer; Initial_Buffer_Size : Positive := Default_Initial_Buffer_Size); procedure Init (Object : in out Instance; Input : String); subtype Rune is Wide_Wide_Character; function Next (Object : in out Instance) return Character with Inline; procedure Handle_CR (L : in out Instance); procedure Handle_LF (L : in out Instance); End_Of_Input : constant Character := Character'Val (4); Line_Feed : constant Character := Character'Val (10); Carriage_Return : constant Character := Character'Val (13); private type Private_Values is limited record Input : Source.Pointer; -- input provider Sentinel : Positive; -- the position at which, when reached, the buffer must be refilled end record; overriding procedure Finalize (Object : in out Instance); procedure Refill_Buffer (L : in out Instance); end Lexer.Base;
sharkdp/bat
Ada
9,018
adb
with Chests.Ring_Buffers; with USB.Device.HID.Keyboard; package body Click is ---------------- -- DEBOUNCE -- ---------------- -- Ideally, in a separate package. -- should be [], but not fixed yet in GCC 11. Current_Status : Key_Matrix := [others => [others => False]]; New_Status : Key_Matrix := [others => [others => False]]; Since : Natural := 0; -- Nb_Bounce : Natural := 5; function Update (NewS : Key_Matrix) return Boolean is begin -- The new state is the same as the current stable state => Do nothing. if Current_Status = NewS then Since := 0; return False; end if; if New_Status /= NewS then -- The new state differs from the previous -- new state (bouncing) => reset New_Status := NewS; Since := 1; else -- The new state hasn't changed since last -- update => towards stabilization. Since := Since + 1; end if; if Since > Nb_Bounce then declare Tmp : constant Key_Matrix := Current_Status; begin -- New state has been stable enough. -- Latch it and notifies caller. Current_Status := New_Status; New_Status := Tmp; Since := 0; end; return True; else -- Not there yet return False; end if; end Update; procedure Get_Matrix; -- Could use := []; but GNAT 12 has a bug (fixed in upcoming 13) Read_Status : Key_Matrix := [others => [others => False]]; function Get_Events return Events is Num_Evt : Natural := 0; New_S : Key_Matrix renames Read_Status; begin Get_Matrix; if Update (New_S) then for I in Current_Status'Range (1) loop for J in Current_Status'Range (2) loop if (not New_Status (I, J) and then Current_Status (I, J)) or else (New_Status (I, J) and then not Current_Status (I, J)) then Num_Evt := Num_Evt + 1; end if; end loop; end loop; declare Evts : Events (Natural range 1 .. Num_Evt); Cursor : Natural range 1 .. Num_Evt + 1 := 1; begin for I in Current_Status'Range (1) loop for J in Current_Status'Range (2) loop if not New_Status (I, J) and then Current_Status (I, J) then -- Pressing I, J Evts (Cursor) := [ Evt => Press, Col => I, Row => J ]; Cursor := Cursor + 1; elsif New_Status (I, J) and then not Current_Status (I, J) then -- Release I, J Evts (Cursor) := [ Evt => Release, Col => I, Row => J ]; Cursor := Cursor + 1; end if; end loop; end loop; return Evts; end; end if; return []; end Get_Events; procedure Get_Matrix is -- return Key_Matrix is begin for Row in Keys.Rows'Range loop Keys.Rows (Row).Clear; for Col in Keys.Cols'Range loop Read_Status (Col, Row) := not Keys.Cols (Col).Set; end loop; Keys.Rows (Row).Set; end loop; end Get_Matrix; -- End of DEBOUNCE -------------- -- Layout -- -------------- package Events_Ring_Buffers is new Chests.Ring_Buffers (Element_Type => Event, Capacity => 16); Queued_Events : Events_Ring_Buffers.Ring_Buffer; type Statet is (Normal_Key, Layer_Mod, None); type State is record Typ : Statet; Code : Key_Code_T; Layer_Value : Natural; -- Col : ColR; -- Row : RowR; end record; type State_Array is array (ColR, RowR) of State; States : State_Array := [others => [others => (Typ => None, Code => No, Layer_Value => 0)]]; function Kw (Code : Key_Code_T) return Action is begin return (T => Key, C => Code, L => 0); end Kw; function Lw (V : Natural) return Action is begin return (T => Layer, C => No, L => V); end Lw; -- FIXME: hardcoded max number of events subtype Events_Range is Natural range 0 .. 60; type Array_Of_Reg_Events is array (Events_Range) of Event; Stamp : Natural := 0; procedure Register_Events (L : Layout; Es : Events) is begin Stamp := Stamp + 1; Log ("Reg events: " & Stamp'Image); Log (Es'Length'Image); for E of Es loop declare begin if Events_Ring_Buffers.Is_Full (Queued_Events) then raise Program_Error; end if; Events_Ring_Buffers.Append (Queued_Events, E); end; -- Log ("Reg'ed events:" & Events_Mark'Image); Log ("Reg'ed events:" & Events_Ring_Buffers.Length (Queued_Events)'Image); end loop; end Register_Events; procedure Release (Col: Colr; Row: Rowr) is begin if States (Col, Row).Typ = None then raise Program_Error; end if; States (Col, Row) := (Typ => None, Code => No, Layer_Value => 0); end Release; function Get_Current_Layer return Natural is L : Natural := 0; begin for S of States loop if S.Typ = Layer_Mod then L := L + S.Layer_Value; end if; end loop; return L; end Get_Current_Layer; -- Tick the event. -- Returns TRUE if it needs to stay in the queued events -- FALSE if the event has been consumed. function Tick (L: Layout; E : in out Event) return Boolean is Current_Layer : Natural := Get_Current_Layer; A : Action renames L (Current_Layer, E.Row, E.Col); begin case E.Evt is when Press => case A.T is when Key => States (E.Col, E.Row) := (Typ => Normal_Key, Code => A.C, Layer_Value => 0); when Layer => States (E.Col, E.Row) := (Typ => Layer_Mod, Layer_Value => A.L, Code => No); when others => raise Program_Error; end case; when Release => Release (E.Col, E.Row); end case; return False; end Tick; Last_Was_Empty_Log : Boolean := False; procedure Tick (L : Layout) is begin for I in 1 .. Events_Ring_Buffers.Length(Queued_Events) loop declare E : Event := Events_Ring_Buffers.Last_Element (Queued_Events); begin Events_Ring_Buffers.Delete_Last (Queued_Events); if Tick (L, E) then Events_Ring_Buffers.Prepend (Queued_Events, E); end if; end; end loop; if not Last_Was_Empty_Log or else Events_Ring_Buffers.Length(Queued_Events) /= 0 then Log ("End Tick layout, events: " & Events_Ring_Buffers.Length(Queued_Events)'Image); Last_Was_Empty_Log := Events_Ring_Buffers.Length(Queued_Events) = 0; end if; end Tick; function Get_Key_Codes return Key_Codes_T is Codes : Key_Codes_T (0 .. 10); Wm: Natural := 0; begin for S of States loop if S.Typ = Normal_Key and then (S.Code < LCtrl or else S.Code > RGui) then Codes (Wm) := S.Code; Wm := Wm + 1; end if; end loop; if Wm = 0 then return []; else return Codes (0 .. Wm - 1); end if; end Get_Key_Codes; function Get_Modifiers return Key_Modifiers is use USB.Device.HID.Keyboard; KM : Key_Modifiers (1..8); I : Natural := 0; begin for S of States loop if S.Typ = Normal_Key then I := I + 1; case S.Code is when LCtrl => KM(I) := Ctrl_Left; when RCtrl => KM(I) := Ctrl_Right; when LShift => KM(I) := Shift_Left; when RShift => KM(I) := Shift_Right; when LAlt => KM(I) := Alt_Left; when RAlt => KM(I) := Alt_Right; when LGui => KM(I) := Meta_Left; when RGui => KM(I) := Meta_Right; when others => I := I - 1; end case; end if; end loop; return KM (1..I); end Get_Modifiers; procedure Init is begin Events_Ring_Buffers.Clear (Queued_Events); end Init; end Click;
ohenley/ada-util
Ada
10,950
adb
----------------------------------------------------------------------- -- util-processes-tests - Test for processes -- Copyright (C) 2011, 2012, 2016 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; with Util.Test_Caller; with Util.Files; with Util.Streams.Pipes; with Util.Streams.Buffered; with Util.Streams.Texts; with Util.Systems.Os; package body Util.Processes.Tests is use Util.Log; -- The logger Log : constant Loggers.Logger := Loggers.Create ("Util.Processes.Tests"); package Caller is new Util.Test_Caller (Test, "Processes"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Processes.Is_Running", Test_No_Process'Access); Caller.Add_Test (Suite, "Test Util.Processes.Spawn/Wait/Get_Exit_Status", Test_Spawn'Access); Caller.Add_Test (Suite, "Test Util.Processes.Spawn(READ pipe)", Test_Output_Pipe'Access); Caller.Add_Test (Suite, "Test Util.Processes.Spawn(WRITE pipe)", Test_Input_Pipe'Access); Caller.Add_Test (Suite, "Test Util.Processes.Spawn/Shell(WRITE pipe)", Test_Shell_Splitting_Pipe'Access); pragma Warnings (Off); if Util.Systems.Os.Directory_Separator /= '\' then Caller.Add_Test (Suite, "Test Util.Processes.Spawn(OUTPUT redirect)", Test_Output_Redirect'Access); end if; pragma Warnings (On); Caller.Add_Test (Suite, "Test Util.Streams.Pipes.Open/Read/Close (Multi spawn)", Test_Multi_Spawn'Access); end Add_Tests; -- ------------------------------ -- Tests when the process is not launched -- ------------------------------ procedure Test_No_Process (T : in out Test) is P : Process; begin T.Assert (not P.Is_Running, "Process should not be running"); T.Assert (P.Get_Pid < 0, "Invalid process id"); end Test_No_Process; -- ------------------------------ -- Test executing a process -- ------------------------------ procedure Test_Spawn (T : in out Test) is P : Process; begin -- Launch the test process => exit code 2 P.Spawn ("bin/util_test_process"); T.Assert (P.Is_Running, "Process is running"); P.Wait; T.Assert (not P.Is_Running, "Process has stopped"); T.Assert (P.Get_Pid > 0, "Invalid process id"); Util.Tests.Assert_Equals (T, 2, P.Get_Exit_Status, "Invalid exit status"); -- Launch the test process => exit code 0 P.Spawn ("bin/util_test_process 0 write b c d e f"); T.Assert (P.Is_Running, "Process is running"); P.Wait; T.Assert (not P.Is_Running, "Process has stopped"); T.Assert (P.Get_Pid > 0, "Invalid process id"); Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Invalid exit status"); end Test_Spawn; -- ------------------------------ -- Test output pipe redirection: read the process standard output -- ------------------------------ procedure Test_Output_Pipe (T : in out Test) is P : aliased Util.Streams.Pipes.Pipe_Stream; begin P.Open ("bin/util_test_process 0 write b c d e f test_marker"); declare Buffer : Util.Streams.Buffered.Input_Buffer_Stream; Content : Ada.Strings.Unbounded.Unbounded_String; begin Buffer.Initialize (P'Unchecked_Access, 19); Buffer.Read (Content); P.Close; Util.Tests.Assert_Matches (T, "b\s+c\s+d\s+e\s+f\s+test_marker\s+", Content, "Invalid content"); end; T.Assert (not P.Is_Running, "Process has stopped"); Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Invalid exit status"); end Test_Output_Pipe; -- ------------------------------ -- Test shell splitting. -- ------------------------------ procedure Test_Shell_Splitting_Pipe (T : in out Test) is P : aliased Util.Streams.Pipes.Pipe_Stream; begin P.Open ("bin/util_test_process 0 write 'b c d e f' test_marker"); declare Buffer : Util.Streams.Buffered.Input_Buffer_Stream; Content : Ada.Strings.Unbounded.Unbounded_String; begin Buffer.Initialize (P'Unchecked_Access, 19); Buffer.Read (Content); P.Close; Util.Tests.Assert_Matches (T, "b c d e f\s+test_marker\s+", Content, "Invalid content"); end; T.Assert (not P.Is_Running, "Process has stopped"); Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Invalid exit status"); end Test_Shell_Splitting_Pipe; -- ------------------------------ -- Test input pipe redirection: write the process standard input -- At the same time, read the process standard output. -- ------------------------------ procedure Test_Input_Pipe (T : in out Test) is P : aliased Util.Streams.Pipes.Pipe_Stream; begin P.Open ("bin/util_test_process 0 read -", READ_WRITE); declare Buffer : Util.Streams.Buffered.Input_Buffer_Stream; Content : Ada.Strings.Unbounded.Unbounded_String; Print : Util.Streams.Texts.Print_Stream; begin -- Write on the process input stream. Print.Initialize (P'Unchecked_Access); Print.Write ("Write test on the input pipe"); Print.Close; -- Read the output. Buffer.Initialize (P'Unchecked_Access, 19); Buffer.Read (Content); -- Wait for the process to finish. P.Close; Util.Tests.Assert_Matches (T, "Write test on the input pipe-\s", Content, "Invalid content"); end; T.Assert (not P.Is_Running, "Process has stopped"); Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Invalid exit status"); end Test_Input_Pipe; -- ------------------------------ -- Test launching several processes through pipes in several threads. -- ------------------------------ procedure Test_Multi_Spawn (T : in out Test) is Task_Count : constant Natural := 8; Count_By_Task : constant Natural := 10; type State_Array is array (1 .. Task_Count) of Boolean; States : State_Array; begin declare task type Worker is entry Start (Count : in Natural); entry Result (Status : out Boolean); end Worker; task body Worker is Cnt : Natural; State : Boolean := True; begin accept Start (Count : in Natural) do Cnt := Count; end Start; declare type Pipe_Array is array (1 .. Cnt) of aliased Util.Streams.Pipes.Pipe_Stream; Pipes : Pipe_Array; begin -- Launch the processes. -- They will print their arguments on stdout, one by one on each line. -- The expected exit status is the first argument. for I in 1 .. Cnt loop Pipes (I).Open ("bin/util_test_process 0 write b c d e f test_marker"); end loop; -- Read their output for I in 1 .. Cnt loop declare Buffer : Util.Streams.Buffered.Input_Buffer_Stream; Content : Ada.Strings.Unbounded.Unbounded_String; begin Buffer.Initialize (Pipes (I)'Unchecked_Access, 19); Buffer.Read (Content); Pipes (I).Close; -- Check status and output. State := State and Pipes (I).Get_Exit_Status = 0; State := State and Ada.Strings.Unbounded.Index (Content, "test_marker") > 0; end; end loop; exception when E : others => Log.Error ("Exception raised", E); State := False; end; accept Result (Status : out Boolean) do Status := State; end Result; end Worker; type Worker_Array is array (1 .. Task_Count) of Worker; Tasks : Worker_Array; begin for I in Tasks'Range loop Tasks (I).Start (Count_By_Task); end loop; -- Get the results (do not raise any assertion here because we have to call -- 'Result' to ensure the thread terminates. for I in Tasks'Range loop Tasks (I).Result (States (I)); end loop; -- Leaving the Worker task scope means we are waiting for our tasks to finish. end; for I in States'Range loop T.Assert (States (I), "Task " & Natural'Image (I) & " failed"); end loop; end Test_Multi_Spawn; -- ------------------------------ -- Test output file redirection. -- ------------------------------ procedure Test_Output_Redirect (T : in out Test) is P : Process; Path : constant String := Util.Tests.Get_Test_Path ("proc-output.txt"); Content : Ada.Strings.Unbounded.Unbounded_String; begin Util.Processes.Set_Output_Stream (P, Path); Util.Processes.Spawn (P, "bin/util_test_process 0 write b c d e f test_marker"); Util.Processes.Wait (P); T.Assert (not P.Is_Running, "Process has stopped"); Util.Tests.Assert_Equals (T, 0, P.Get_Exit_Status, "Process failed"); Util.Files.Read_File (Path, Content); Util.Tests.Assert_Matches (T, ".*test_marker", Content, "Invalid content"); Util.Processes.Set_Output_Stream (P, Path, True); Util.Processes.Spawn (P, "bin/util_test_process 0 write appended_text"); Util.Processes.Wait (P); Content := Ada.Strings.Unbounded.Null_Unbounded_String; Util.Files.Read_File (Path, Content); Util.Tests.Assert_Matches (T, ".*appended_text", Content, "Invalid content"); Util.Tests.Assert_Matches (T, ".*test_marker.*", Content, "Invalid content"); end Test_Output_Redirect; end Util.Processes.Tests;
AdaCore/libadalang
Ada
269
adb
procedure Test is protected type A is I : Float := 0.1; end A; type A is synchronized interface; overriding function Bar is null; I : access Float := A.I'Access; B : Boolean := (for some I in 1 .. 10 => I mod 2 = 0); begin null; end Test;
stcarrez/ada-util
Ada
9,424
adb
----------------------------------------------------------------------- -- util-properties-json -- read json files into properties -- Copyright (C) 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.Serialize.IO.JSON; with Util.Stacks; with Util.Log; with Util.Beans.Objects; package body Util.Properties.JSON is type Natural_Access is access all Natural; package Length_Stack is new Util.Stacks (Element_Type => Natural, Element_Type_Access => Natural_Access); type Parser is abstract limited new Util.Serialize.IO.Reader with record Base_Name : Ada.Strings.Unbounded.Unbounded_String; Lengths : Length_Stack.Stack; Separator : Ada.Strings.Unbounded.Unbounded_String; Separator_Length : Natural; end record; -- Start a new object associated with the given name. This is called when -- the '{' is reached. The reader must be updated so that the next -- <b>Set_Member</b> procedure will associate the name/value pair on the -- new object. overriding procedure Start_Object (Handler : in out Parser; Name : in String; Logger : in out Util.Log.Logging'Class); -- Finish an object associated with the given name. The reader must be -- updated to be associated with the previous object. overriding procedure Finish_Object (Handler : in out Parser; Name : in String; Logger : in out Util.Log.Logging'Class); overriding procedure Start_Array (Handler : in out Parser; Name : in String; Logger : in out Util.Log.Logging'Class); overriding procedure Finish_Array (Handler : in out Parser; Name : in String; Count : in Natural; Logger : in out Util.Log.Logging'Class); -- ----------------------- -- Start a new object associated with the given name. This is called when -- the '{' is reached. The reader must be updated so that the next -- <b>Set_Member</b> procedure will associate the name/value pair on the -- new object. -- ----------------------- overriding procedure Start_Object (Handler : in out Parser; Name : in String; Logger : in out Util.Log.Logging'Class) is pragma Unreferenced (Logger); begin if Name'Length > 0 then Ada.Strings.Unbounded.Append (Handler.Base_Name, Name); Ada.Strings.Unbounded.Append (Handler.Base_Name, Handler.Separator); Length_Stack.Push (Handler.Lengths); Length_Stack.Current (Handler.Lengths).all := Name'Length + Handler.Separator_Length; end if; end Start_Object; -- ----------------------- -- Finish an object associated with the given name. The reader must be -- updated to be associated with the previous object. -- ----------------------- overriding procedure Finish_Object (Handler : in out Parser; Name : in String; Logger : in out Util.Log.Logging'Class) is pragma Unreferenced (Logger); Len : constant Natural := Ada.Strings.Unbounded.Length (Handler.Base_Name); begin if Name'Length > 0 then Ada.Strings.Unbounded.Delete (Handler.Base_Name, Len - Name'Length - Handler.Separator_Length + 1, Len); end if; end Finish_Object; overriding procedure Start_Array (Handler : in out Parser; Name : in String; Logger : in out Util.Log.Logging'Class) is begin Handler.Start_Object (Name, Logger); -- Util.Serialize.IO.JSON.Parser (Handler).Start_Array (Name); end Start_Array; overriding procedure Finish_Array (Handler : in out Parser; Name : in String; Count : in Natural; Logger : in out Util.Log.Logging'Class) is begin Parser'Class (Handler).Set_Member ("length", Util.Beans.Objects.To_Object (Count), Logger); Handler.Finish_Object (Name, Logger); -- Util.Serialize.IO.JSON.Parser (Handler).Finish_Array (Name, Count); end Finish_Array; -- ----------------------- -- Parse the JSON content and put the flattened content in the property manager. -- ----------------------- procedure Parse_JSON (Manager : in out Util.Properties.Manager'Class; Content : in String; Flatten_Separator : in String := ".") is type Local_Parser is new Parser with record Manager : access Util.Properties.Manager'Class; end record; -- Set the name/value pair on the current object. For each active mapping, -- find whether a rule matches our name and execute it. overriding procedure Set_Member (Handler : in out Local_Parser; Name : in String; Value : in Util.Beans.Objects.Object; Logger : in out Util.Log.Logging'Class; Attribute : in Boolean := False); -- ----------------------- -- Set the name/value pair on the current object. For each active mapping, -- find whether a rule matches our name and execute it. -- ----------------------- overriding procedure Set_Member (Handler : in out Local_Parser; Name : in String; Value : in Util.Beans.Objects.Object; Logger : in out Util.Log.Logging'Class; Attribute : in Boolean := False) is pragma Unreferenced (Logger, Attribute); begin Handler.Manager.Set (Ada.Strings.Unbounded.To_String (Handler.Base_Name) & Name, Util.Beans.Objects.To_String (Value)); end Set_Member; P : Local_Parser; R : Util.Serialize.IO.JSON.Parser; begin P.Separator := Ada.Strings.Unbounded.To_Unbounded_String (Flatten_Separator); P.Separator_Length := Flatten_Separator'Length; P.Manager := Manager'Access; R.Parse_String (Content, P); if R.Has_Error then raise Util.Serialize.IO.Parse_Error; end if; end Parse_JSON; -- ----------------------- -- Read the JSON file into the property manager. -- The JSON content is flatten into Flatten the JSON content and add the properties. -- ----------------------- procedure Read_JSON (Manager : in out Util.Properties.Manager'Class; Path : in String; Flatten_Separator : in String := ".") is type Local_Parser is new Parser with record Manager : access Util.Properties.Manager'Class; end record; -- Set the name/value pair on the current object. For each active mapping, -- find whether a rule matches our name and execute it. overriding procedure Set_Member (Handler : in out Local_Parser; Name : in String; Value : in Util.Beans.Objects.Object; Logger : in out Util.Log.Logging'Class; Attribute : in Boolean := False); -- ----------------------- -- Set the name/value pair on the current object. For each active mapping, -- find whether a rule matches our name and execute it. -- ----------------------- overriding procedure Set_Member (Handler : in out Local_Parser; Name : in String; Value : in Util.Beans.Objects.Object; Logger : in out Util.Log.Logging'Class; Attribute : in Boolean := False) is pragma Unreferenced (Logger, Attribute); begin Handler.Manager.Set (Ada.Strings.Unbounded.To_String (Handler.Base_Name) & Name, Util.Beans.Objects.To_String (Value)); end Set_Member; P : Local_Parser; R : Util.Serialize.IO.JSON.Parser; begin P.Manager := Manager'Access; P.Separator := Ada.Strings.Unbounded.To_Unbounded_String (Flatten_Separator); P.Separator_Length := Flatten_Separator'Length; R.Parse (Path, P); if R.Has_Error then raise Util.Serialize.IO.Parse_Error; end if; end Read_JSON; end Util.Properties.JSON;
zhmu/ananas
Ada
1,276
adb
-- { dg-do run } -- { dg-options "-gnatws" } with System; with Ada.Unchecked_Conversion; procedure SSO15 is type Arr is array (1 .. Integer'Size) of Boolean; pragma Pack (Arr); for Arr'Scalar_Storage_Order use System.High_Order_First; function To_Float is new Ada.Unchecked_Conversion (Arr, Float); function To_Int is new Ada.Unchecked_Conversion (Arr, Integer); type R_Float is record F : Float; end record; for R_Float'Bit_Order use System.High_Order_First; for R_Float'Scalar_Storage_Order use System.High_Order_First; type R_Int is record I : Integer; end record; for R_Int'Bit_Order use System.High_Order_First; for R_Int'Scalar_Storage_Order use System.High_Order_First; A : Arr := (1 .. 2 => True, others => False); F1 : Float; F2 : R_Float; for F2'Address use A'Address; pragma Import (Ada, F2); I1 : Integer; I2 : R_Int; for I2'Address use A'Address; pragma Import (Ada, I2); begin -- Check that converting to FP yields a big-endian value. F1 := To_Float (A); if F2.F /= F1 then raise Program_Error; end if; -- Check that converting to integer yields a big-endian value. I1 := To_Int (A); if I2.I /= I1 then raise Program_Error; end if; end;
reznikmm/matreshka
Ada
5,097
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.DG.Radial_Gradients.Collections is pragma Preelaborate; package DG_Radial_Gradient_Collections is new AMF.Generic_Collections (DG_Radial_Gradient, DG_Radial_Gradient_Access); type Set_Of_DG_Radial_Gradient is new DG_Radial_Gradient_Collections.Set with null record; Empty_Set_Of_DG_Radial_Gradient : constant Set_Of_DG_Radial_Gradient; type Ordered_Set_Of_DG_Radial_Gradient is new DG_Radial_Gradient_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_DG_Radial_Gradient : constant Ordered_Set_Of_DG_Radial_Gradient; type Bag_Of_DG_Radial_Gradient is new DG_Radial_Gradient_Collections.Bag with null record; Empty_Bag_Of_DG_Radial_Gradient : constant Bag_Of_DG_Radial_Gradient; type Sequence_Of_DG_Radial_Gradient is new DG_Radial_Gradient_Collections.Sequence with null record; Empty_Sequence_Of_DG_Radial_Gradient : constant Sequence_Of_DG_Radial_Gradient; private Empty_Set_Of_DG_Radial_Gradient : constant Set_Of_DG_Radial_Gradient := (DG_Radial_Gradient_Collections.Set with null record); Empty_Ordered_Set_Of_DG_Radial_Gradient : constant Ordered_Set_Of_DG_Radial_Gradient := (DG_Radial_Gradient_Collections.Ordered_Set with null record); Empty_Bag_Of_DG_Radial_Gradient : constant Bag_Of_DG_Radial_Gradient := (DG_Radial_Gradient_Collections.Bag with null record); Empty_Sequence_Of_DG_Radial_Gradient : constant Sequence_Of_DG_Radial_Gradient := (DG_Radial_Gradient_Collections.Sequence with null record); end AMF.DG.Radial_Gradients.Collections;
zhmu/ananas
Ada
360
ads
with Loop_Optimization10_Pkg; use Loop_Optimization10_Pkg; package Loop_Optimization10 is type Dual_Axis_Type is (One, Two); type Array_Real_Type is array (Dual_Axis_Type) of Float; type Array_Limit_Type is array (Dual_Axis_Type) of Limit_Type; function F (Low, High : in Array_Real_Type) return Array_Limit_Type; end Loop_Optimization10;
reznikmm/matreshka
Ada
5,137
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- Rectangle is a graphical element that defines a rectangular shape with -- given bounds. A rectangle may be given rounded corners by setting its -- corner radius. ------------------------------------------------------------------------------ limited with AMF.DC; with AMF.DG.Graphical_Elements; package AMF.DG.Rectangles is pragma Preelaborate; type DG_Rectangle is limited interface and AMF.DG.Graphical_Elements.DG_Graphical_Element; type DG_Rectangle_Access is access all DG_Rectangle'Class; for DG_Rectangle_Access'Storage_Size use 0; not overriding function Get_Bounds (Self : not null access constant DG_Rectangle) return AMF.DC.DC_Bounds is abstract; -- Getter of Rectangle::bounds. -- -- the bounds of the rectangle in the x-y coordinate system. not overriding procedure Set_Bounds (Self : not null access DG_Rectangle; To : AMF.DC.DC_Bounds) is abstract; -- Setter of Rectangle::bounds. -- -- the bounds of the rectangle in the x-y coordinate system. not overriding function Get_Corner_Radius (Self : not null access constant DG_Rectangle) return AMF.Real is abstract; -- Getter of Rectangle::cornerRadius. -- -- a radius for the rectangle's rounded corners. When the radius is 0, the -- rectangle is drawn with sharp corners. not overriding procedure Set_Corner_Radius (Self : not null access DG_Rectangle; To : AMF.Real) is abstract; -- Setter of Rectangle::cornerRadius. -- -- a radius for the rectangle's rounded corners. When the radius is 0, the -- rectangle is drawn with sharp corners. end AMF.DG.Rectangles;
github-co/aichallenge
Ada
382
adb
-- Ants Ada Implementation -- by philxyz -- October 22nd-23rd 2011 -- England, United Kingdom -- mybot.adb - Program Entry Point -- Include (at least) the Ants Starter Pack. with Ants; -- Program entry point. procedure MyBot is begin -- The Ants package communicates with the game for you. -- all you have to do is implement Strategy.Move_Ants Ants.Game_Loop; end MyBot;
reznikmm/matreshka
Ada
4,840
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Table_Data_Pilot_Sort_Info_Elements; package Matreshka.ODF_Table.Data_Pilot_Sort_Info_Elements is type Table_Data_Pilot_Sort_Info_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Data_Pilot_Sort_Info_Elements.ODF_Table_Data_Pilot_Sort_Info with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Data_Pilot_Sort_Info_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Data_Pilot_Sort_Info_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Data_Pilot_Sort_Info_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Table_Data_Pilot_Sort_Info_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Table_Data_Pilot_Sort_Info_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Table.Data_Pilot_Sort_Info_Elements;
AdaCore/Ada_Drivers_Library
Ada
4,618
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Streams; with Ada.Streams.Stream_IO; with File_IO; use File_IO; with GNAT.MD5; use GNAT.MD5; package body Compare_Files is package Hash renames GNAT.MD5; ------------------ -- Compute_Hash -- ------------------ function Compute_Hash (FD : in out File_IO.File_Descriptor) return String is Context : aliased GNAT.MD5.Context := GNAT.MD5.Initial_Context; Buffer : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Offset; Size : File_Size; Status : Status_Code; pragma Unreferenced (Status); use type Ada.Streams.Stream_Element_Offset; begin loop Size := Buffer'Length; Size := Read (FD, Addr => Buffer'Address, Length => Size); Last := Ada.Streams.Stream_Element_Offset (Size); Hash.Update (Context, Buffer (1 .. Last)); exit when Last < Buffer'Last; end loop; return Hash.Digest (Context); end Compute_Hash; ------------------- -- Binnary_Equal -- ------------------- function Binnary_Equal (A_Path, B_Path : String) return Boolean is function Compute_Hash (Path : String) return Message_Digest; function Compute_Hash (Path : String) return Message_Digest is Context : aliased GNAT.MD5.Context := GNAT.MD5.Initial_Context; File : Ada.Streams.Stream_IO.File_Type; Buffer : Ada.Streams.Stream_Element_Array (1 .. 4096); Last : Ada.Streams.Stream_Element_Offset; use type Ada.Streams.Stream_Element_Offset; begin Ada.Streams.Stream_IO.Open (File, Mode => Ada.Streams.Stream_IO.In_File, Name => Path); loop Ada.Streams.Stream_IO.Read (File, Item => Buffer, Last => Last); Hash.Update (Context, Buffer (1 .. Last)); exit when Last < Buffer'Last; end loop; Ada.Streams.Stream_IO.Close (File); return Hash.Digest (Context); end Compute_Hash; begin return Compute_Hash (A_Path) = Compute_Hash (B_Path); end Binnary_Equal; end Compare_Files;
MR-D05/lovelace-api
Ada
3,140
ads
with Ada.Streams; with Black.HTTP, Black.MIME_Types, Black.Parameter, Black.Parameter.Vectors; private with Ada.Strings.Unbounded; private with Black.Optional_HTTP_Method, Black.Optional_Natural, Black.Optional_String, Black.Parsing; package Black.Request is No_Content_Length : exception; type Instance is tagged private; subtype Class is Instance'Class; function Content (Request : in Instance) return String; function Method (Request : in Instance) return HTTP.Methods; function Host (Request : in Instance) return String; function Resource (Request : in Instance) return String; function Parameters (Request : in Instance) return Parameter.Vectors.Vector; function Has_Parameter (Request : in Instance; Key : in String) return Boolean; function Parameter (Request : in Instance; Key : in String; Default : in String) return String; function Parameter (Request : in Instance; Key : in String) return String; function Has_Origin (Request : in Instance) return Boolean; function Origin (Request : in Instance) return String; function Want_Websocket (Request : in Instance) return Boolean; function Websocket_Key (Request : in Instance) return String; procedure Generate_HTTP (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in Instance); function Parse_HTTP (Stream : not null access Ada.Streams.Root_Stream_Type'Class) return Instance; function Compose (Method : in HTTP.Methods; Host : in String; Resource : in String) return Instance; function Compose (Method : in HTTP.Methods; Host : in String; Resource : in String; Content : in String; Content_Type : in String := MIME_Types.Text.Plain) return Instance; function Websocket (Host : in String; Resource : in String; Key : in String) return Instance; private procedure Parse_Method_And_Resource (Request : in out Instance; Line : in Ada.Strings.Unbounded.Unbounded_String); procedure Parse (Request : in out Instance; Line : in Black.Parsing.Header_Line); for Instance'Output use Generate_HTTP; for Instance'Input use Parse_HTTP; type Instance is tagged record Method : Optional_HTTP_Method.Instance; Host : Optional_String.Instance; Resource : Optional_String.Instance; Parameters : Black.Parameter.Vectors.Vector; Websocket : Boolean := False; Websocket_Key : Optional_String.Instance; Origin : Optional_String.Instance; Content : Optional_String.Instance; Content_Type : Optional_String.Instance; Content_Length : Optional_Natural.Instance; end record; end Black.Request;
jhumphry/auto_counters
Ada
3,744
ads
-- flyweights-refcounted_ptrs.ads -- A package of reference-counting generalised references which point to -- resources inside a Flyweight -- Copyright (c) 2016-2023, 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); with Ada.Containers; with Ada.Finalization; with Flyweights_Hashtables_Spec; generic type Element(<>) is limited private; type Element_Access is access Element; with package Flyweight_Hashtables is new Flyweights_Hashtables_Spec(Element_Access => Element_Access, others => <>); package Flyweights.Refcounted_Ptrs is type E_Ref(E : access Element) is null record with Implicit_Dereference => E; type Refcounted_Element_Ptr is new Ada.Finalization.Controlled with private; function P (P : Refcounted_Element_Ptr) return E_Ref with Inline; function Get (P : Refcounted_Element_Ptr) return Element_Access with Inline; function Insert_Ptr (F : aliased in out Flyweight_Hashtables.Flyweight; E : in out Element_Access) return Refcounted_Element_Ptr with Inline; type Refcounted_Element_Ref (E : not null access Element) is new Ada.Finalization.Controlled with private with Implicit_Dereference => E; function Get (P : Refcounted_Element_Ref) return Element_Access with Inline; function Insert_Ref (F : aliased in out Flyweight_Hashtables.Flyweight; E : in out Element_Access) return Refcounted_Element_Ref with Inline; function Make_Ptr (R : Refcounted_Element_Ref'Class) return Refcounted_Element_Ptr with Inline; function Make_Ref (P : Refcounted_Element_Ptr'Class) return Refcounted_Element_Ref with Inline, Pre => (Get(P) /= null or else (raise Flyweights_Error with "Cannot make a " & "Refcounted_Element_Ref from a null Refcounted_Element_Ptr")); private type Flyweight_Ptr is access all Flyweight_Hashtables.Flyweight; type Refcounted_Element_Ptr is new Ada.Finalization.Controlled with record E : Element_Access := null; Containing_Flyweight : Flyweight_Ptr := null; Containing_Bucket : Ada.Containers.Hash_Type; end record; overriding procedure Adjust (Object : in out Refcounted_Element_Ptr); overriding procedure Finalize (Object : in out Refcounted_Element_Ptr); type Refcounted_Element_Ref (E : access Element) is new Ada.Finalization.Controlled with record Containing_Flyweight : Flyweight_Ptr := null; Containing_Bucket : Ada.Containers.Hash_Type; Underlying_Element : Element_Access := null; end record; overriding procedure Initialize (Object : in out Refcounted_Element_Ref); overriding procedure Adjust (Object : in out Refcounted_Element_Ref); overriding procedure Finalize (Object : in out Refcounted_Element_Ref); end Flyweights.Refcounted_Ptrs;
AdaCore/gpr
Ada
9,565
ads
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Unchecked_Conversion; with Gpr_Parser_Support.File_Readers; use Gpr_Parser_Support.File_Readers; with Gpr_Parser_Support.Generic_API.Introspection; use Gpr_Parser_Support.Generic_API.Introspection; with Gpr_Parser_Support.Internal.Analysis; use Gpr_Parser_Support.Internal.Analysis; with Gpr_Parser_Support.Internal.Introspection; use Gpr_Parser_Support.Internal.Introspection; with Gpr_Parser_Support.Slocs; use Gpr_Parser_Support.Slocs; with Gpr_Parser_Support.Types; use Gpr_Parser_Support.Types; -- This package provides common implementation details for Langkit-generated -- libraries. Even though it is not private (to allow Langkit-generated -- libraries to use it), it is not meant to be used beyond this. As such, this -- API is considered unsafe and unstable. package Gpr_Parser_Support.Internal.Descriptor is type Language_Descriptor; type Language_Descriptor_Access is access constant Language_Descriptor; -- Unique identifier for Langkit-generated libraries and dispatch table for -- all generic operations. -- Access types for the implementation of generic operations. Most -- operations are direct implementation for the API defined in -- Gpr_Parser_Support.Generic_API.* packages. Ref-counting operations are -- trivial to use, but all expect non-null arguments. All operations expect -- safe arguments (no stale reference) and non-null ones. type Create_Context_Type is access function (Charset : String := ""; File_Reader : File_Reader_Reference := No_File_Reader_Reference; With_Trivia : Boolean := True; Tab_Stop : Natural := 0) return Internal_Context; type Context_Inc_Ref_Type is access procedure (Context : Internal_Context); type Context_Dec_Ref_Type is access procedure (Context : in out Internal_Context); type Context_Version_Type is access function (Context : Internal_Context) return Version_Number; type Context_Has_Unit_Type is access function (Context : Internal_Context; Unit_Filename : String) return Boolean; type Context_Get_From_File_Type is access function (Context : Internal_Context; Filename, Charset : String; Reparse : Boolean; Rule : Grammar_Rule_Index) return Internal_Unit; type Unit_Context_Type is access function (Unit : Internal_Unit) return Internal_Context; type Unit_Version_Type is access function (Unit : Internal_Unit) return Version_Number; type Unit_Filename_Type is access function (Unit : Internal_Unit) return String; type Unit_Root_Type is access function (Unit : Internal_Unit) return Analysis.Internal_Node; type Unit_Token_Getter_Type is access function (Unit : Internal_Unit) return Analysis.Internal_Token; type Unit_Get_Line_Type is access function (Unit : Internal_Unit; Line_Number : Positive) return Text_Type; type Node_Metadata_Inc_Ref_Type is access procedure (Metadata : Internal_Node_Metadata); type Node_Metadata_Dec_Ref_Type is access procedure (Metadata : in out Internal_Node_Metadata); type Node_Metadata_Compare_Type is access function (L, R : Analysis.Internal_Node_Metadata) return Boolean; type Node_Unit_Type is access function (Node : Analysis.Internal_Node) return Internal_Unit; type Node_Kind_Type is access function (Node : Analysis.Internal_Node) return Type_Index; type Node_Parent_Type is access function (Node : Analysis.Internal_Entity) return Analysis.Internal_Entity; type Node_Parents_Type is access function (Node : Analysis.Internal_Entity; With_Self : Boolean) return Analysis.Internal_Entity_Array; type Node_Children_Count_Type is access function (Node : Analysis.Internal_Node) return Natural; type Node_Get_Child_Type is access procedure (Node : Analysis.Internal_Node; Index : Positive; Index_In_Bounds : out Boolean; Result : out Analysis.Internal_Node); type Node_Fetch_Sibling_Type is access function (Node : Analysis.Internal_Node; Offset : Integer) return Analysis.Internal_Node; type Node_Is_Ghost_Type is access function (Node : Analysis.Internal_Node) return Boolean; type Node_Token_Getter_Type is access function (Node : Analysis.Internal_Node) return Analysis.Internal_Token; type Node_Text_Type is access function (Node : Analysis.Internal_Node) return Text_Type; type Node_Sloc_Range_Type is access function (Node : Analysis.Internal_Node) return Source_Location_Range; type Node_Last_Attempted_Child_Type is access function (Node : Analysis.Internal_Node) return Integer; type Entity_Image_Type is access function (Entity : Internal_Entity) return String; type Token_Is_Equivalent_Type is access function (Left, Right : Internal_Token; Left_SN, Right_SN : Token_Safety_Net) return Boolean; type Create_Enum_Type is access function (Enum_Type : Type_Index; Value_Index : Enum_Value_Index) return Internal_Value_Access; type Create_Array_Type is access function (Array_Type : Type_Index; Values : Internal_Value_Array) return Internal_Value_Access; type Create_Struct_Type is access function (Struct_Type : Type_Index; Values : Internal_Value_Array) return Internal_Value_Access; type Eval_Node_Member_Type is access function (Node : Internal_Acc_Node; Member : Struct_Member_Index; Arguments : Internal_Value_Array) return Internal_Value_Access; type Language_Descriptor is limited record Language_Name : Text_Access; -- Name of the language that is analyzed (in camel-with-underscores -- casing). -- Descriptors for grammar rules. The table also defines the range of -- supported rules for this language. Default_Grammar_Rule : Grammar_Rule_Index; Grammar_Rules : Grammar_Rule_Descriptor_Array_Access; -- Descriptors for token kinds. The table for names also defines the -- range of supported kinds for this language. Token_Kind_Names : Token_Kind_Name_Array_Access; -- Descriptors for introspection capabilities Types : Type_Descriptor_Array_Access; Enum_Types : Enum_Type_Descriptor_Array_Access; Array_Types : Array_Type_Descriptor_Array_Access; Iterator_Types : Iterator_Type_Descriptor_Array_Access; Struct_Types : Struct_Type_Descriptor_Array_Access; Builtin_Types : Builtin_Types_Access; First_Node : Type_Index; -- Index of the first node descriptor in ``Struct_Types``. In -- ``Struct_Types``, descriptors from 1 to ``First_Node - 1`` are struct -- types (not nodes), and descriptors from ``First_Node`` to -- ``Struct_Types'Last`` are nodes. Struct_Members : Struct_Member_Descriptor_Array_Access; -- Descriptors for struct members: fields and properties. In -- ``Struct_Members``, descriptors from 1 to ``First_Property - 1`` are -- fields, and descriptors from ``First_Property`` to -- ``Struct_Members'Last`` are properties. First_Property : Struct_Member_Index; -- Index of the first property descriptor in ``Struct_Members`` -- Implementation for generic operations Create_Context : Create_Context_Type; Context_Inc_Ref : Context_Inc_Ref_Type; Context_Dec_Ref : Context_Dec_Ref_Type; Context_Version : Context_Version_Type; Context_Get_From_File : Context_Get_From_File_Type; Context_Has_Unit : Context_Has_Unit_Type; Unit_Context : Unit_Context_Type; Unit_Version : Unit_Version_Type; Unit_Filename : Unit_Filename_Type; Unit_Root : Unit_Root_Type; Unit_First_Token : Unit_Token_Getter_Type; Unit_Last_Token : Unit_Token_Getter_Type; Unit_Get_Line : Unit_Get_Line_Type; Node_Metadata_Inc_Ref : Node_Metadata_Inc_Ref_Type; Node_Metadata_Dec_Ref : Node_Metadata_Dec_Ref_Type; Node_Metadata_Compare : Node_Metadata_Compare_Type; Null_Metadata : Internal_Node_Metadata; Node_Unit : Node_Unit_Type; Node_Kind : Node_Kind_Type; Node_Parent : Node_Parent_Type; Node_Parents : Node_Parents_Type; Node_Children_Count : Node_Children_Count_Type; Node_Get_Child : Node_Get_Child_Type; Node_Fetch_Sibling : Node_Fetch_Sibling_Type; Node_Is_Ghost : Node_Is_Ghost_Type; Node_Token_Start : Node_Token_Getter_Type; Node_Token_End : Node_Token_Getter_Type; Node_Text : Node_Text_Type; Node_Sloc_Range : Node_Sloc_Range_Type; Node_Last_Attempted_Child : Node_Last_Attempted_Child_Type; Entity_Image : Entity_Image_Type; Token_Is_Equivalent : Token_Is_Equivalent_Type; -- Operations to build/inspect generic data types Create_Enum : Create_Enum_Type; Create_Array : Create_Array_Type; Create_Struct : Create_Struct_Type; Eval_Node_Member : Eval_Node_Member_Type; end record; function "+" is new Ada.Unchecked_Conversion (Any_Language_Id, Language_Descriptor_Access); end Gpr_Parser_Support.Internal.Descriptor;
AdaCore/gpr
Ada
112,175
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.Characters.Handling; with Ada.Containers.Indefinite_Ordered_Sets; with Ada.Containers.Vectors; with Ada.Directories; with Ada.Strings.Equal_Case_Insensitive; with Ada.Strings.Fixed; with Ada.Strings.Less_Case_Insensitive; with Ada.Strings.Unbounded; with Ada.Text_IO; with GNAT.MD5; with GNAT.OS_Lib; with GNAT.String_Split; with GNATCOLL.OS.Constants; with GPR2.Unit.List; with GPR2.Containers; with GPR2.Path_Name; with GPR2.Project.Attribute; with GPR2.Project.Attribute_Index; with GPR2.Project.Registry.Attribute; with GPR2.Project.Registry.Pack; with GPR2.Project.Source.Artifact; with GPR2.Project.Source.Set; pragma Warnings (Off, "* is not referenced"); -- GPR2.Project.Source.Dependencies return a Part_Set but only has limited -- visibility on it. So in order to be able to manipulate the returned object -- we need to have full vilibility so need to add this with clause. -- However we never reference the package explicitly, so the compiler will -- complain that the using is not referenced. -- So let's just kill the warning. with GPR2.Project.Source.Part_Set; pragma Warnings (On, "* is not referenced"); with GPR2.Project.Typ; with GPR2.Project.Variable; with GPR2.Project.View.Set; with GPR2.Version; with GPR2.Source_Reference; with GPR2.Source_Reference.Value; with GPRtools; with GPRtools.Util; package body GPRinstall.Install is use Ada; use Ada.Strings.Unbounded; use Ada.Text_IO; use GNAT; use GPR2; use all type Unit.Library_Unit_Type; use type GNATCOLL.OS.OS_Type; package String_Vector renames GPR2.Containers.Value_Type_List; subtype Message_Digest is GNAT.MD5.Message_Digest; Is_Windows_Host : constant Boolean := GNATCOLL.OS.Constants.OS = GNATCOLL.OS.Windows with Warnings => Off; Content : String_Vector.Vector; -- The content of the project, this is used when creating the project -- and is needed to ease the project section merging when installing -- multiple builds. Initial_Buffer_Size : constant := 100; -- Arbitrary value for the initial size of the buffer below Buffer : GNAT.OS_Lib.String_Access := new String (1 .. Initial_Buffer_Size); Buffer_Last : Natural := 0; Agg_Manifest : Text_IO.File_Type; -- Manifest file for main aggregate project Line_Manifest : Text_IO.Count := 0; Line_Agg_Manifest : Text_IO.Count := 0; -- Keep lines when opening the manifest files. This is used by the rollback -- routine when an error occurs while copying the files. Installed : GPR2.Project.View.Set.Object; -- Record already installed project function Other_Part_Need_Body (Source : GPR2.Project.Source.Object; Index : Unit_Index) return Boolean is (Source.Has_Other_Part (Index) and then Source.Other_Part (Index).Source.Is_Implementation_Required (Source.Other_Part (Index).Index)); -- Returns True if Source has other part and this part need body procedure Double_Buffer; -- Double the size of the Buffer procedure Write_Eol; -- Append the content of the Buffer as a line to Content and empty the -- Buffer. procedure Write_Str (S : String); -- Append S to the buffer. Double the buffer if needed procedure Process (Tree : GPR2.Project.Tree.Object; Project : GPR2.Project.View.Object; Options : GPRinstall.Options.Object); -- Install the give project view ------------------- -- Double_Buffer -- ------------------- procedure Double_Buffer is New_Buffer : constant GNAT.OS_Lib.String_Access := new String (1 .. Buffer'Last * 2); begin New_Buffer (1 .. Buffer_Last) := Buffer (1 .. Buffer_Last); OS_Lib.Free (Buffer); Buffer := New_Buffer; end Double_Buffer; ------------- -- Process -- ------------- procedure Process (Tree : GPR2.Project.Tree.Object; Project : GPR2.Project.View.Object; Options : GPRinstall.Options.Object) is use GPRtools; use GPRtools.Util; use type GPR2.Path_Name.Object; use type GPR2.Project.View.Object; package A renames GPR2.Project.Registry.Attribute; package P renames GPR2.Project.Registry.Pack; subtype Param is GPRinstall.Options.Param; Target_Name : constant String := String (Options.Target); Objcopy_Exec : constant String := (if Target_Name = "all" then "objcopy" else Target_Name & "-objcopy"); -- Name of objcopy executable, possible a cross one Strip_Exec : constant String := (if Target_Name = "all" then "strip" else Target_Name & "-strip"); -- Name of strip executable, possible a cross one Objcopy : constant String := Locate_Exec_On_Path (Objcopy_Exec); Strip : constant String := Locate_Exec_On_Path (Strip_Exec); Windows_Target : constant Boolean := Tree.Is_Windows_Target; -- Local values for the given project, these are initially set with the -- default values. It is updated using the Install package found in the -- project if any. Active : Boolean := True; -- Whether installation is active or not (Install package's attribute) Side_Debug : Boolean := Options.Side_Debug; -- Whether to extract debug symbols from executables and shared -- libraries. Default to global value. Prefix_Dir : Param := Options.Global_Prefix_Dir; Exec_Subdir : Param := Options.Global_Exec_Subdir; Lib_Subdir : Param := Options.Global_Lib_Subdir; ALI_Subdir : Param := Options.Global_ALI_Subdir; Link_Lib_Subdir : Param := Options.Global_Link_Lib_Subdir; Sources_Subdir : Param := Options.Global_Sources_Subdir; Project_Subdir : Param := Options.Global_Project_Subdir; Install_Mode : Param := Options.Global_Install_Mode; Install_Name : Param := Options.Global_Install_Name; Install_Project : Boolean := not Options.No_GPR_Install; type Items is (Source, Object, Dependency, Library, Executable); Copy : array (Items) of Boolean := (others => False); -- What should be copied from a project, this depends on the actual -- project kind and the mode (usage, dev) set for the install. Man : Text_IO.File_Type; -- File where manifest for this project is kept -- Keeping track of artifacts to install type Artifacts_Data is record Destination, Filename : Unbounded_String; Required : Boolean; end record; package Artifacts_Set is new Ada.Containers.Vectors (Positive, Artifacts_Data); Artifacts : Artifacts_Set.Vector; Excluded_Naming : GPR2.Containers.Name_Set; -- This set contains names of Ada unit to exclude from the generated -- package Naming. This is needed to avoid renaming for bodies which -- are not installed when the minimum installation (-m) is used. In -- this case there is two points to do: -- -- 1. the installed .ali must use the spec naming -- -- 2. the naming convention for the body must be excluded from the -- generated project. procedure Copy_File (From, To : Path_Name.Object; File : Filename_Optional := No_Filename; From_Ver : Path_Name.Object := Path_Name.Undefined; Sym_Link : Boolean := False; Executable : Boolean := False; Extract_Debug : Boolean := False) with Pre => (if From.Is_Directory then not To.Is_Directory or else File /= No_Filename else To.Is_Directory or else File = No_Filename); -- Copy file From into To. If From and To are directories the full path -- name is using the File which must not be empty in this case. -- If Sym_Link is set a symbolic link is created. -- If Executable is set, the destination file exec attribute is set. -- When Extract_Debug is set to True the debug information for the -- executable is written in a side file. function Dir_Name (Suffix : Boolean := True) return Filename_Type; -- Returns the name of directory where project files are to be -- installed. This name is the name of the project. If Suffix is -- True then the build name is also returned. function Sources_Dir (Build_Name : Boolean := True) return Path_Name.Object; -- Returns the full pathname to the sources destination directory function Prefix_For_Dir (Name : String) return Path_Name.Object is (Path_Name.Create_Directory (Filename_Type (Name), (if OS_Lib.Is_Absolute_Path (Name) then No_Filename else Filename_Optional (-Prefix_Dir.V)))); -- Returns directory as Path_Name.Object prefixed with Prefix_Dir.V.all -- if not absote. function Exec_Dir return Path_Name.Object; -- Returns the full pathname to the executable destination directory function Lib_Dir (Build_Name : Boolean := True) return Path_Name.Object; -- Returns the full pathname to the library destination directory function ALI_Dir (Build_Name : Boolean := True) return Path_Name.Object; -- Returns the full pathname to the library destination directory function Link_Lib_Dir return Path_Name.Object; -- Returns the full pathname to the lib symlib directory function Project_Dir return Path_Name.Object; -- Returns the full pathname to the project destination directory procedure Check_Install_Package; -- Check Project's install package and overwrite the default values of -- the corresponding variables above. procedure Copy_Files; -- Do the file copies for the project's sources, objects, library, -- executables. procedure Create_Project (Project : GPR2.Project.View.Object); -- Create install project for the given project procedure Add_To_Manifest (Pathname : Path_Name.Object; Aggregate_Only : Boolean := False) with Pre => Options.Install_Manifest; -- Add filename to manifest function Has_Sources (Project : GPR2.Project.View.Object) return Boolean with Inline; -- Returns True if the project contains sources function Is_Install_Active (Project : GPR2.Project.View.Object) return Boolean; -- Returns True if the Project is active, that is there is no attribute -- Active set to False in the Install package. procedure Open_Check_Manifest (File : out Text_IO.File_Type; Current_Line : out Text_IO.Count); -- Check that manifest file can be used procedure Rollback_Manifests; -- Rollback manifest files (for current project or/and aggregate one) function For_Dev return Boolean is (-Install_Mode.V = "dev"); function Build_Subdir (Subdir : Param; Build_Name : Boolean := True) return Path_Name.Object; -- Return a path-name for a subdir --------------------- -- Add_To_Manifest -- --------------------- procedure Add_To_Manifest (Pathname : Path_Name.Object; Aggregate_Only : Boolean := False) is begin if not Aggregate_Only and then not Is_Open (Man) then Open_Check_Manifest (Man, Line_Manifest); end if; -- Append entry into manifest declare function N (Str : String) return String is (OS_Lib.Normalize_Pathname (Str, Case_Sensitive => False)); MD5 : constant String := String (Pathname.Content_MD5); begin if not Aggregate_Only and then Is_Open (Man) then declare Man_Path : constant Path_Name.Object := Path_Name.Create_File (Filename_Type (N (Name (Man))), Path_Name.No_Resolution); begin Put_Line (Man, MD5 & ' ' & String (Pathname.Relative_Path (From => Man_Path).Name)); end; end if; if Is_Open (Agg_Manifest) then declare Agg_Man_Path : constant Path_Name.Object := Path_Name.Create_File (Filename_Type (N (Name (Agg_Manifest))), Path_Name.No_Resolution); begin Put_Line (Agg_Manifest, MD5 & ' ' & String (Pathname.Relative_Path (From => Agg_Man_Path).Name)); end; end if; end; end Add_To_Manifest; ------------- -- ALI_Dir -- ------------- function ALI_Dir (Build_Name : Boolean := True) return Path_Name.Object is begin return Build_Subdir (ALI_Subdir, Build_Name); end ALI_Dir; ------------------ -- Build_Subdir -- ------------------ function Build_Subdir (Subdir : Param; Build_Name : Boolean := True) return Path_Name.Object is Install_Name_Dir : constant Filename_Type := (if Install_Name.Default then "." else Filename_Type (-Install_Name.V)); begin if OS_Lib.Is_Absolute_Path (-Subdir.V) then return Path_Name.Create_Directory (Install_Name_Dir, Filename_Optional (-Subdir.V)); elsif not Subdir.Default or else not Build_Name then return Path_Name.Create_Directory (Install_Name_Dir, Filename_Type (Path_Name.Create_Directory (Filename_Type (-Subdir.V), Filename_Optional (-Prefix_Dir.V)).Value)); else return Path_Name.Create_Directory (Dir_Name, Filename_Type (Path_Name.Create_Directory (Install_Name_Dir, Filename_Type (Path_Name.Create_Directory (Filename_Type (-Subdir.V), Filename_Optional (-Prefix_Dir.V)).Value)) .Value)); end if; end Build_Subdir; --------------------------- -- Check_Install_Package -- --------------------------- procedure Check_Install_Package is procedure Replace (P : in out Param; Val : String; Is_Dir : Boolean := True; Normalize : Boolean := False) with Inline; -- Set Var with Value, free previous pointer ------------- -- Replace -- ------------- procedure Replace (P : in out Param; Val : String; Is_Dir : Boolean := True; Normalize : Boolean := False) is begin if Val /= "" then P := (To_Unbounded_String ((if Is_Dir then (if Normalize then OS_Lib.Normalize_Pathname (Val) else Val) else Val)), Default => False); end if; end Replace; begin if Project.Has_Package (P.Install) then declare use Characters.Handling; begin for V of Project.Attributes (Pack => P.Install) loop if V.Name.Id = A.Install.Prefix then -- If Install.Prefix is a relative path, it is made -- relative to the global prefix. if OS_Lib.Is_Absolute_Path (V.Value.Text) then if Options.Global_Prefix_Dir.Default then Replace (Prefix_Dir, V.Value.Text, Normalize => True); end if; else Replace (Prefix_Dir, -Options.Global_Prefix_Dir.V & "/" & V.Value.Text, Normalize => True); end if; elsif V.Name.Id = A.Install.Exec_Subdir and then Options.Global_Exec_Subdir.Default then Replace (Exec_Subdir, V.Value.Text); elsif V.Name.Id = A.Install.Lib_Subdir and then Options.Global_Lib_Subdir.Default then Replace (Lib_Subdir, V.Value.Text); elsif V.Name.Id = A.Install.ALI_Subdir and then Options.Global_ALI_Subdir.Default then Replace (ALI_Subdir, V.Value.Text); elsif V.Name.Id = A.Install.Link_Lib_Subdir and then Options.Global_Link_Lib_Subdir.Default then Replace (Link_Lib_Subdir, V.Value.Text); elsif V.Name.Id = A.Install.Sources_Subdir and then Options.Global_Sources_Subdir.Default then Replace (Sources_Subdir, V.Value.Text); elsif V.Name.Id = A.Install.Project_Subdir and then Options.Global_Project_Subdir.Default then Replace (Project_Subdir, V.Value.Text); elsif V.Name.Id = A.Install.Mode and then Options.Global_Install_Mode.Default then Replace (Install_Mode, V.Value.Text); elsif V.Name.Id = A.Install.Install_Name and then Options.Global_Install_Name.Default then Replace (Install_Name, V.Value.Text, Is_Dir => False); elsif V.Name.Id = A.Install.Active then declare Val : constant String := To_Lower (V.Value.Text); begin if Val = "false" then Active := False; else Active := True; end if; end; elsif V.Name.Id = A.Install.Side_Debug then declare Val : constant String := To_Lower (V.Value.Text); begin if Val = "true" then Side_Debug := True; else Side_Debug := False; end if; end; elsif V.Name.Id = A.Install.Install_Project then declare Val : constant String := To_Lower (V.Value.Text); begin if Val = "false" then Install_Project := False; else Install_Project := True; end if; end; elsif V.Name.Id in A.Install.Artifacts | A.Install.Required_Artifacts then declare Destination : constant Unbounded_String := (if V.Index.Text = "" then To_Unbounded_String (".") else To_Unbounded_String (V.Index.Text)); begin for S of V.Values loop Artifacts.Append (Artifacts_Data' (Destination, To_Unbounded_String (S.Text), Required => (if V.Name.Id = A.Install.Artifacts then False else True))); end loop; end; end if; end loop; end; end if; -- Now check if Lib_Subdir is set and not ALI_Subdir as in this case -- we want ALI_Subdir to be equal to Lib_Subdir. if not Lib_Subdir.Default and then ALI_Subdir.Default then ALI_Subdir := Lib_Subdir; end if; end Check_Install_Package; --------------- -- Copy_File -- --------------- procedure Copy_File (From, To : Path_Name.Object; File : Filename_Optional := No_Filename; From_Ver : Path_Name.Object := Path_Name.Undefined; Sym_Link : Boolean := False; Executable : Boolean := False; Extract_Debug : Boolean := False) is Src_Path : constant Path_Name.Object := (if From.Is_Directory then From.Compose (if File = No_Filename then To.Simple_Name else File) else From); F : constant String := String (Src_Path.Value); Dest_Path : constant Path_Name.Object := (if To.Is_Directory then To.Compose (if File = No_Filename then From.Simple_Name else File) else To); T : constant String := String (Dest_Path.Dir_Name); Dest_Filename : aliased String := Dest_Path.Value; begin pragma Warnings (Off, "*can never be executed*"); if Sym_Link and then Is_Windows_Host then raise GPRinstall_Error with "internal error: cannot use symbolic links on Windows"; end if; pragma Warnings (On, "*can never be executed*"); if not Sym_Link and then Directories.Exists (Dest_Filename) and then not Options.Force_Installations and then Src_Path.Content_MD5 /= Dest_Path.Content_MD5 then raise GPRinstall_Error with "file " & String (File) & " exists, use -f to overwrite"; end if; if Options.Dry_Run or else Options.Verbose then if Sym_Link then Put ("ln -s "); else Put ("cp "); end if; Put (F); Put (" "); Put (Dest_Filename); New_Line; end if; if not Options.Dry_Run then -- If file exists and is read-only, first remove it if not Sym_Link and then Directories.Exists (Dest_Filename) then if not OS_Lib.Is_Writable_File (Dest_Filename) then OS_Lib.Set_Writable (Dest_Filename); end if; declare Success : Boolean; begin OS_Lib.Delete_File (Dest_Filename, Success); if not Success then raise GPRinstall_Error with "cannot overwrite " & Dest_Filename & " check permissions"; end if; end; end if; if not Sym_Link and then not Src_Path.Exists then raise GPRinstall_Error with "file " & F & " does not exist, build may not be complete"; end if; if (not Sym_Link and then not Directories.Exists (T)) or else (Sym_Link and then not Src_Path.Exists) then if Options.Create_Dest_Dir then begin if Sym_Link then Directories.Create_Path (Src_Path.Dir_Name); else Directories.Create_Path (T); end if; exception when Text_IO.Use_Error => -- Cannot create path, permission issue raise GPRinstall_Error with "cannot create destination directory " & (if Sym_Link then Src_Path.Dir_Name else T) & " check permissions"; end; else raise GPRinstall_Error with "target directory " & T & " does not exist, use -p to create"; end if; end if; -- Do copy if Sym_Link then Src_Path.Create_Sym_Link (To => Dest_Path); -- Add file to manifest if Options.Install_Manifest then Add_To_Manifest (Src_Path); end if; if From_Ver.Is_Defined then From_Ver.Create_Sym_Link (To => Dest_Path); if Options.Install_Manifest then Add_To_Manifest (From_Ver); end if; end if; else begin Ada.Directories.Copy_File (Source_Name => F, Target_Name => Dest_Filename, Form => "preserve=timestamps"); exception when Text_IO.Use_Error => raise GPRinstall_Error with "cannot overwrite file " & Dest_Filename & " check permissions."; end; if Executable then declare use OS_Lib; begin OS_Lib.Set_Executable (Dest_Filename, Mode => S_Owner + S_Group + S_Others); end; -- Furthermore, if we have an executable and we ask for -- separate debug symbols we do it now. -- The commands to run are: -- $ objcopy --only-keep-debug <exec> <exec>.debug -- $ strip <exec> -- $ objcopy --add-gnu-debuglink=<exec>.debug <exec> if Extract_Debug then if Objcopy = "" then Put_Line (Objcopy_Exec & " not found, " & "cannot create side debug file for " & Dest_Filename); elsif Strip = "" then Put_Line (Strip_Exec & " not found, " & "cannot create side debug file for " & Dest_Filename); else declare Keep_Debug : aliased String := "--only-keep-debug"; Dest_Debug : aliased String := Dest_Filename & ".debug"; Link_Debug : aliased String := "--add-gnu-debuglink=" & Dest_Debug; Success : Boolean; Args : OS_Lib.Argument_List (1 .. 3); begin -- 1. copy the debug symbols: Args (1) := Keep_Debug'Unchecked_Access; Args (2) := Dest_Filename'Unchecked_Access; Args (3) := Dest_Debug'Unchecked_Access; OS_Lib.Spawn (Objcopy, Args, Success); if Success then -- Record the debug file in the manifest if Options.Install_Manifest then Add_To_Manifest (Path_Name.Create_File (Filename_Type (Dest_Debug))); end if; -- 2. strip original executable Args (1) := Dest_Filename'Unchecked_Access; OS_Lib.Spawn (Strip, Args (1 .. 1), Success); if Success then -- 2. link debug symbols file with original -- file. Args (1) := Link_Debug'Unchecked_Access; Args (2) := Dest_Filename'Unchecked_Access; OS_Lib.Spawn (Objcopy, Args (1 .. 2), Success); if not Success then Put_Line (Objcopy_Exec & " error, " & "cannot link debug symbol file with" & " original executable " & Dest_Filename); end if; else Put_Line (Strip_Exec & " error, " & "cannot remove debug symbols from " & Dest_Filename); end if; else Put_Line (Objcopy_Exec & " error, " & "cannot create side debug file for " & Dest_Filename); end if; end; end if; end if; end if; -- Add file to manifest if Options.Install_Manifest then Add_To_Manifest (Dest_Path); end if; end if; end if; end Copy_File; ---------------- -- Copy_Files -- ---------------- procedure Copy_Files is procedure Copy_Project_Sources (Project : GPR2.Project.View.Object); -- Copy sources from the given project function Copy_Source (Source : GPR2.Project.Source.Object) return Boolean; -- Copy Source and returns either artefactes need to be copied too procedure Copy_Artifacts (Pathname : Path_Name.Object; Destination : Path_Name.Object; Required : Boolean); -- Copy items from the artifacts attribute Source_Copied : GPR2.Project.Source.Set.Object; -------------------- -- Copy_Artifacts -- -------------------- procedure Copy_Artifacts (Pathname : Path_Name.Object; Destination : Path_Name.Object; Required : Boolean) is use Ada.Directories; procedure Copy_Entry (E : Directory_Entry_Type); -- Copy file pointed by E Something_Copied : Boolean := False; -- Keep track if something has been copied or not. If an artifact -- is coming from Required_Artifacts we must ensure that there is -- actually something copied if we have a directory or wildcards. ---------------- -- Copy_Entry -- ---------------- procedure Copy_Entry (E : Directory_Entry_Type) is Fullname : constant String := Full_Name (E); Dest_Dir : constant Path_Name.Object := Path_Name.Create_Directory (Filename_Type (Destination.Value), Filename_Optional (-Prefix_Dir.V)); begin if Kind (E) = Directory and then Directories.Simple_Name (E) /= "." and then Directories.Simple_Name (E) /= ".." then Copy_Artifacts (Path_Name.Create_File ("*", Filename_Optional (Fullname)), Path_Name.Compose (Dest_Dir, Filename_Type (Directories.Simple_Name (E)), Directory => True), Required); elsif Kind (E) = Ordinary_File then Copy_File (From => Path_Name.Create_File (Filename_Type (Fullname)), To => Destination, Executable => OS_Lib.Is_Executable_File (Fullname)); if Required then Something_Copied := True; end if; end if; end Copy_Entry; begin Ada.Directories.Search (Directory => Pathname.Dir_Name, Pattern => String (Pathname.Simple_Name), Process => Copy_Entry'Access); if Required and not Something_Copied then Rollback_Manifests; raise GPRinstall_Error with "error: file does not exist '" & Pathname.Value & '''; end if; exception when Text_IO.Name_Error => if Required then Rollback_Manifests; raise GPRinstall_Error with "error: file does not exist '" & Pathname.Value & '''; elsif Options.Warnings then Put_Line ("warning: file does not exist '" & Pathname.Value & '''); end if; end Copy_Artifacts; -------------------------- -- Copy_Project_Sources -- -------------------------- procedure Copy_Project_Sources (Project : GPR2.Project.View.Object) is function Is_Ada (Source : GPR2.Project.Source.Object) return Boolean is (Source.Language = Ada_Language); -- Returns True if Source is an Ada source procedure Install_Project_Source (Source : GPR2.Project.Source.Object; Is_Interface_Closure : Boolean := False); -- Install the project source and possibly the corresponding -- artifacts. procedure Copy_Interface_Closure (Source : GPR2.Project.Source.Object; Index : GPR2.Unit_Index) with Pre => Source.Has_Units; -- Copy all sources and artifacts part of the close of Source ---------------------------- -- Copy_Interface_Closure -- ---------------------------- procedure Copy_Interface_Closure (Source : GPR2.Project.Source.Object; Index : GPR2.Unit_Index) is begin -- Note that we only install the interface from the same view -- to avoid installing the runtime file for example. for D of Source.Dependencies (Index, Closure => True, Sorted => False) loop if not Source_Copied.Contains (D.Source) and then (D.Source.Kind (D.Index) in Unit.Spec_Kind or else Other_Part_Need_Body (D.Source, D.Index)) and then Source.View = D.Source.View then Install_Project_Source (D.Source, Is_Interface_Closure => True); end if; end loop; end Copy_Interface_Closure; ---------------------------- -- Install_Project_Source -- ---------------------------- procedure Install_Project_Source (Source : GPR2.Project.Source.Object; Is_Interface_Closure : Boolean := False) is Atf : GPR2.Project.Source.Artifact.Object; CUs : GPR2.Unit.List.Object; Done : Boolean := True; Has_Atf : Boolean := False; -- Has artefacts to install function Is_Interface return Boolean; -- Returns True if Source is an interface (spec or body) procedure Copy_ALI_Other_Part (From : GPR2.Path_Name.Object; To : GPR2.Path_Name.Object; Source : GPR2.Project.Source.Object) with Pre => Source.Has_Other_Part; -- Copy ALI for other part of source if the naming exception -- brings different base names for the spec and body. ------------------------- -- Copy_ALI_Other_Part -- ------------------------- procedure Copy_ALI_Other_Part (From : GPR2.Path_Name.Object; To : GPR2.Path_Name.Object; Source : GPR2.Project.Source.Object) is S_BN : constant String := String (Source.Path_Name.Base_Name); O_Src : constant GPR2.Project.Source.Object := Source.Other_Part.Source; O_BN : constant String := String (O_Src.Path_Name.Base_Name); D_Sfx : constant String := String (Source.View.Tree.Dependency_Suffix (Source.Language)); begin if S_BN /= O_BN then Copy_File (From => From, To => To, File => Filename_Optional (O_BN & D_Sfx)); end if; end Copy_ALI_Other_Part; ------------------ -- Is_Interface -- ------------------ function Is_Interface return Boolean is begin return Source.Is_Interface or else (Source.Has_Other_Part and then Source.Other_Part.Source.Is_Interface); end Is_Interface; begin -- Skip sources that are removed/excluded and sources not -- part of the interface for standalone libraries. Atf := Source.Artifacts; if not Project.Is_Library or else not Project.Is_Library_Standalone or else Is_Interface_Closure or else Is_Interface then if Source.Has_Units then CUs := Source.Units; end if; if Options.All_Sources or else Source.Kind in Unit.Spec_Kind or else Other_Part_Need_Body (Source, No_Index) or else Source.Is_Generic (No_Index) or else (Source.Kind = S_Separate and then Source.Separate_From (No_Index).Source.Is_Generic (No_Index)) then Done := Copy_Source (Source); -- If this source is an interface of the project we -- need to also install the full-closure for this source. if Source.Is_Interface and then Source.Has_Units and then not Is_Interface_Closure then if Source.Has_Units then for CU of CUs loop Copy_Interface_Closure (Source, CU.Index); end loop; else Copy_Interface_Closure (Source, No_Index); end if; end if; elsif Source.Has_Naming_Exception then -- When a naming exception is present for a body which -- is not installed we must exclude the Naming from the -- generated project. for CU of CUs loop Excluded_Naming.Include (CU.Name); end loop; end if; -- Objects / Deps Check_For_Artefacts : for CU of CUs loop if CU.Kind not in S_Spec | S_Separate then Has_Atf := True; exit Check_For_Artefacts; end if; end loop Check_For_Artefacts; if Done and then not Options.Sources_Only and then Has_Atf then if Copy (Object) then for CU of CUs loop if CU.Kind not in S_Spec | S_Separate and then Atf.Has_Object_Code (CU.Index) then Copy_File (From => Atf.Object_Code (CU.Index), To => Lib_Dir); end if; end loop; end if; -- Install Ada .ali files (name the .ali -- against the spec file in case of minimal -- installation). if Copy (Dependency) then declare use GPR2.Project.Source.Artifact; Proj : GPR2.Project.View.Object; Satf : GPR2.Project.Source.Artifact.Object; begin if Options.All_Sources or else not Source.Has_Naming_Exception or else not Source.Has_Single_Unit or else not Source.Has_Other_Part then Satf := Atf; else Satf := Source.Other_Part.Source.Artifacts (Force_Spec => True); end if; if Project.Qualifier = K_Aggregate_Library then Proj := Project; else Proj := Source.View; end if; if Is_Ada (Source) then for CU of Source.Units loop if Source.Kind (CU.Index) not in S_Spec | S_Separate and then Atf.Has_Dependency (CU.Index) then Copy_File (From => Atf.Dependency (CU.Index), To => (if Proj.Kind = K_Library then ALI_Dir else Lib_Dir), File => Satf.Dependency.Simple_Name); -- The <body>.ali has been copied, we now -- also want to create a file based on -- <body>.ali for <spec>.ali if needed. if Source.Has_Other_Part then Copy_ALI_Other_Part (From => Atf.Dependency (CU.Index), To => (if Proj.Kind = K_Library then ALI_Dir else Lib_Dir), Source => Source); end if; end if; end loop; end if; if Atf.Has_Callgraph and then Atf.Callgraph.Exists then Copy_File (From => Atf.Callgraph, To => (if Proj.Kind = K_Library then ALI_Dir else Lib_Dir), File => Satf.Callgraph.Simple_Name); end if; if Atf.Has_Coverage and then Atf.Coverage.Exists then Copy_File (From => Atf.Coverage, To => (if Proj.Kind = K_Library then ALI_Dir else Lib_Dir), File => Satf.Coverage.Simple_Name); end if; end; end if; end if; end if; end Install_Project_Source; begin for Source of Project.Sources loop Install_Project_Source (Source); end loop; end Copy_Project_Sources; ----------------- -- Copy_Source -- ----------------- function Copy_Source (Source : GPR2.Project.Source.Object) return Boolean is Position : GPR2.Project.Source.Set.Cursor; Inserted : Boolean := False; begin Source_Copied.Insert (Source, Position, Inserted); if not Inserted or else not Is_Install_Active (Source.View) then return False; elsif not Copy (Process.Source) then return Inserted; end if; declare Art : constant GPR2.Project.Source.Artifact.Object := Source.Artifacts; begin Copy_File (From => (if Art.Preprocessed_Source.Exists then Art.Preprocessed_Source else Source.Path_Name), To => Sources_Dir, File => Source.Path_Name.Simple_Name); end; return True; end Copy_Source; begin if Has_Sources (Project) then -- Install the project and the extended projects if any Copy_Project_Sources (Project); end if; -- Copy library if Copy (Library) and then not Options.Sources_Only then if not Project.Is_Static_Library and then Project.Has_Library_Version and then Project.Library_Name /= Project.Library_Version_Filename.Name then if Windows_Target then -- No support for version, do a simple copy Copy_File (From => Project.Library_Directory, To => Lib_Dir, File => Project.Library_Filename.Name, Executable => True, Extract_Debug => Side_Debug); elsif Is_Windows_Host then -- On windows host, Library_Filename is generated, Copy_File (From => Project.Library_Filename, To => Lib_Dir, Executable => True, Extract_Debug => Side_Debug); else Copy_File (From => Project.Library_Version_Filename, To => Lib_Dir, Executable => True, Extract_Debug => Side_Debug); Copy_File (From => Path_Name.Compose (Lib_Dir, Project.Library_Filename.Name), To => Lib_Dir, File => Project.Library_Version_Filename.Simple_Name, From_Ver => Path_Name.Compose (Lib_Dir, Project.Library_Major_Version_Filename.Name), Sym_Link => True); end if; else Copy_File (From => Project.Library_Directory, To => Lib_Dir, File => Project.Library_Filename.Name, Executable => not Project.Is_Static_Library, Extract_Debug => Side_Debug and then not Project.Is_Static_Library); end if; -- On Windows copy the shared libraries into the bin directory -- for it to be found in the PATH when running executable. On non -- Windows platforms add a symlink into the lib directory. if not Project.Is_Static_Library and then not Options.No_Lib_Link then if Windows_Target then if Lib_Dir /= Exec_Dir then Copy_File (From => Lib_Dir, To => Exec_Dir, File => Project.Library_Filename.Name, Executable => True, Extract_Debug => False); end if; elsif Link_Lib_Dir /= Lib_Dir then if Is_Windows_Host then Copy_File (From => Lib_Dir, To => Link_Lib_Dir, File => Project.Library_Filename.Name, Sym_Link => False); else Copy_File (From => Link_Lib_Dir, To => Lib_Dir, File => Project.Library_Filename.Name, Sym_Link => True); end if; -- Copy also the versioned library if any if not Is_Windows_Host and then Project.Has_Library_Version and then Project.Library_Filename.Name /= Project.Library_Version_Filename.Name then Copy_File (From => Link_Lib_Dir, To => Lib_Dir, File => Project.Library_Version_Filename.Name, From_Ver => Path_Name.Compose (Link_Lib_Dir, Project.Library_Major_Version_Filename.Name), Sym_Link => True); end if; end if; end if; end if; -- Copy executable(s) if Copy (Executable) and then not Options.Sources_Only then for Main of Project.Executables loop Copy_File (From => Main, To => Exec_Dir, Executable => True, Extract_Debug => Side_Debug); end loop; end if; -- Copy artifacts for E of Artifacts loop declare Destination : constant Filename_Type := Filename_Type (To_String (E.Destination)); Filename : constant Filename_Type := Filename_Type (To_String (E.Filename)); begin Copy_Artifacts (Path_Name.Compose (Project.Dir_Name, Filename), Path_Name.Create_Directory (Destination, Filename_Optional (-Prefix_Dir.V)), E.Required); end; end loop; end Copy_Files; -------------------- -- Create_Project -- -------------------- procedure Create_Project (Project : GPR2.Project.View.Object) is use type Ada.Containers.Count_Type; package Lang_Set is new Ada.Containers.Indefinite_Ordered_Sets (String, Strings.Less_Case_Insensitive, Strings.Equal_Case_Insensitive); Filename : constant String := Project_Dir.Dir_Name & String (Project.Path_Name.Base_Name) & ".gpr"; GPRinstall_Tag : constant String := "This project has been generated by GPRINSTALL"; Line : Unbounded_String; Languages : Lang_Set.Set; function "+" (Item : String) return Unbounded_String renames To_Unbounded_String; function "-" (Item : Unbounded_String) return String renames To_String; procedure Create_Packages; -- Create packages that are needed, currently Naming and part of -- Linker is generated for the installed project. procedure Create_Variables; -- Create global variables procedure Read_Project; -- Read project and set Content accordingly procedure With_External_Imports (Project : GPR2.Project.View.Object); -- Add all imports of externally built projects into install project -- imports. procedure Write_Project; -- Write content into project procedure Add_Empty_Line with Inline; function Naming_Case_Alternative (Project : GPR2.Project.View.Object) return String_Vector.Vector; -- Returns the naming case alternative for this project configuration function Linker_Case_Alternative (Proj : GPR2.Project.View.Object) return String_Vector.Vector; -- Returns the linker case alternative for this project configuration function Data_Attributes return String_Vector.Vector; -- Returns the attributes for the sources, objects and library function Get_Languages return Lang_Set.Set; -- Returns the list of languages function Get_Build_Line (Vars, Default : String) return String; -- Returns the build line for Var1 and possibly Var2 if not empty -- string. Default is the default build name. -------------------- -- Add_Empty_Line -- -------------------- procedure Add_Empty_Line is begin if Content.Element (Content.Last_Index) /= "" then Content.Append (""); end if; end Add_Empty_Line; --------------------- -- Create_Packages -- --------------------- procedure Create_Packages is procedure Create_Naming (Project : GPR2.Project.View.Object); -- Create the naming package procedure Create_Linker (Project : GPR2.Project.View.Object); -- Create the linker package if needed ------------------- -- Create_Linker -- ------------------- procedure Create_Linker (Project : GPR2.Project.View.Object) is begin Content.Append (" package Linker is"); Content.Append (" case BUILD is"); -- Attribute Linker_Options only if set Content.Append_Vector (Linker_Case_Alternative (Project)); Content.Append (" end case;"); Content.Append (" end Linker;"); Add_Empty_Line; end Create_Linker; ------------------- -- Create_Naming -- ------------------- procedure Create_Naming (Project : GPR2.Project.View.Object) is Found : Boolean := False; begin Content.Append (" package Naming is"); for A of Project.Attributes (Pack => P.Naming, With_Defaults => False, With_Config => False) loop if not A.Has_Index then Content.Append (" " & A.Image); Found := True; end if; end loop; if Found then Content.Append (""); end if; Content.Append (" case BUILD is"); Content.Append_Vector (Naming_Case_Alternative (Project)); Content.Append (" end case;"); Content.Append (" end Naming;"); Add_Empty_Line; end Create_Naming; begin Create_Naming (Project); Create_Linker (Project); end Create_Packages; ---------------------- -- Create_Variables -- ---------------------- procedure Create_Variables is Max_Len : Natural := 0; -- List of output types to avoid duplicate T : GPR2.Containers.Name_Set; procedure Create_Type (Typ : GPR2.Project.Typ.Object); -- Output type definition if not already created ----------------- -- Create_Type -- ----------------- procedure Create_Type (Typ : GPR2.Project.Typ.Object) is T_Name : constant Name_Type := Typ.Name.Text; begin if not T.Contains (T_Name) then Write_Str (" " & Typ.Image); Write_Eol; T.Insert (T_Name); end if; end Create_Type; Var_Has_Type : Boolean := False; begin -- Output types if any if Project.Has_Types then for Typ of Project.Types loop Create_Type (Typ); end loop; end if; if Project.Has_Variables then for Var of Project.Variables loop -- Compute variable max length Max_Len := Natural'Max (Max_Len, Var.Name.Text'Length); -- Output types used in variable if any if Var.Has_Type then Create_Type (Var.Typ); Var_Has_Type := True; end if; end loop; if Var_Has_Type then Write_Eol; end if; -- Finally output variables for Var of Project.Variables loop Write_Str (" " & Var.Image (Name_Len => Max_Len)); Write_Eol; end loop; end if; end Create_Variables; --------------------- -- Data_Attributes -- --------------------- function Data_Attributes return String_Vector.Vector is procedure Gen_Dir_Name (P : Param; Line : in out Unbounded_String); -- Generate dir name ------------------ -- Gen_Dir_Name -- ------------------ procedure Gen_Dir_Name (P : Param; Line : in out Unbounded_String) is begin if P.Default then -- This is the default value, add Dir_Name Line := Line & String (Dir_Name (Suffix => False)); -- Furthermore, if the build name is "default" do not output if -Options.Build_Name /= "default" then Line := Line & "." & (-Options.Build_Name); end if; end if; end Gen_Dir_Name; V : String_Vector.Vector; Line : Unbounded_String; Attr : GPR2.Project.Attribute.Object; Standalone : GPR2.Project.Standalone_Library_Kind; use type GPR2.Project.Standalone_Library_Kind; begin V.Append (" when """ & (-Options.Build_Name) & """ =>"); -- Project sources Line := +" for Source_Dirs use ("""; if Has_Sources (Project) then Line := Line & String (Sources_Dir (Build_Name => False).Relative_Path (From => Project_Dir).Name); Gen_Dir_Name (Sources_Subdir, Line); end if; Line := Line & """);"; V.Append (-Line); -- Project objects and/or library if Project.Is_Library then Line := +" for Library_Dir use """; else Line := +" for Object_Dir use """; end if; Line := Line & String (Lib_Dir (Build_Name => False).Relative_Path (From => Project_Dir).Name); Gen_Dir_Name (Lib_Subdir, Line); Line := Line & """;"; V.Append (-Line); if Project.Is_Library then -- If ALI are in a different location, set the corresponding -- attribute. if Lib_Dir /= ALI_Dir then Line := +" for Library_ALI_Dir use """; Line := Line & String (ALI_Dir (Build_Name => False).Relative_Path (From => Project_Dir).Name); Gen_Dir_Name (ALI_Subdir, Line); Line := Line & """;"; V.Append (-Line); end if; V.Append (" for Library_Kind use """ & String (Project.Library_Kind) & """;"); Standalone := Project.Library_Standalone; if Standalone /= GPR2.Project.No then if not Project.Is_Static_Library then V.Append (" for Library_Standalone use """ & Characters.Handling.To_Lower (Standalone'Image) & """;"); end if; -- And then generates the interfaces declare First : Boolean := True; begin if Project.Check_Attribute (A.Library_Interface, Result => Attr) then Line := +" for Library_Interface use ("; for V of Attr.Values loop if not First then Append (Line, ", "); end if; Append (Line, Quote (V.Text)); First := False; end loop; elsif Project.Check_Attribute (A.Interfaces, Result => Attr) then Line := +" for Interfaces use ("; for V of Attr.Values loop if not First then Append (Line, ", "); end if; Append (Line, Quote (V.Text)); First := False; end loop; else Line := +" for library_Interfaces use ("; for Source of Project.Sources (Interface_Only => True) loop if Source.Has_Units then for CU of Source.Units loop if CU.Kind in S_Spec | S_Spec_Only | S_Body_Only then if not First then Append (Line, ", "); end if; Append (Line, Quote (String (CU.Name))); First := False; end if; end loop; end if; end loop; end if; end; Append (Line, ");"); V.Append (-Line); end if; end if; return V; end Data_Attributes; -------------------- -- Get_Build_Line -- -------------------- function Get_Build_Line (Vars, Default : String) return String is use Strings.Fixed; Variables : String_Split.Slice_Set; Line : Unbounded_String; begin Line := +" BUILD : BUILD_KIND := "; if not Options.No_Build_Var then String_Split.Create (Variables, Vars, ","); if Vars = "" then -- No variable specified, use default value Line := Line & "external("""; Line := Line & Characters.Handling.To_Upper (String (Dir_Name (Suffix => False))); Line := Line & "_BUILD"", "; else for K in 1 .. String_Split.Slice_Count (Variables) loop Line := Line & "external("""; Line := Line & String_Split.Slice (Variables, K) & """, "; end loop; end if; end if; Line := Line & '"' & Default & '"'; if not Options.No_Build_Var then Line := Line & (+(Natural (String_Split.Slice_Count (Variables)) * ')')); end if; Line := Line & ';'; return -Line; end Get_Build_Line; ------------------- -- Get_Languages -- ------------------- function Get_Languages return Lang_Set.Set is Langs : Lang_Set.Set; procedure For_Project (Project : GPR2.Project.View.Object); -- Add languages for the given project ----------------- -- For_Project -- ----------------- procedure For_Project (Project : GPR2.Project.View.Object) is use GPR2.Project; package A renames GPR2.Project.Registry.Attribute; package P renames GPR2.Project.Registry.Pack; Attr : GPR2.Project.Attribute.Object; begin if Project.Has_Languages then for Lang of Project.Languages loop if Project.Tree.Has_Configuration then declare C : constant GPR2.Project.View.Object := Project.Tree.Configuration.Corresponding_View; begin -- Compiler driver defined in configuration if (C.Has_Package (P.Compiler) and then C.Check_Attribute (A.Compiler.Driver, Attribute_Index.Create (Lang.Text), Result => Attr) and then Attr.Value.Text /= "") -- Or defined in the project itself or else (Project.Has_Package (P.Compiler) and then Project.Check_Attribute (A.Compiler.Driver, Attribute_Index.Create (Lang.Text), Result => Attr)) then Langs.Include (Lang.Text); end if; end; end if; end loop; end if; end For_Project; begin -- First adds language for the main project For_Project (Project); -- If we are dealing with an aggregate library, adds the languages -- from all aggregated projects. if Project.Qualifier = K_Aggregate_Library then for Agg of Project.Aggregated loop For_Project (Agg); end loop; end if; return Langs; end Get_Languages; ----------------------------- -- Linker_Case_Alternative -- ----------------------------- function Linker_Case_Alternative (Proj : GPR2.Project.View.Object) return String_Vector.Vector is procedure Linker_For (View : GPR2.Project.View.Object); -- Handle the linker options for this package procedure Append (Attribute : GPR2.Project.Attribute.Object); -- Add values if any procedure Opts_Append (Opt : String); -- Add Opt into Opts only if not added before procedure Append_Imported_External_Libraries (Project : GPR2.Project.View.Object); -- Add the externally built libraries without sources (referencing -- system libraries for example). Seen : GPR2.Containers.Value_Set; -- Records the attribute generated to avoid duplicate when -- handling aggregated projects. R : String_Vector.Vector; Opts : String_Vector.Vector; ------------ -- Append -- ------------ procedure Append (Attribute : GPR2.Project.Attribute.Object) is begin for V of Attribute.Values loop if V.Text /= "" then Opts_Append (V.Text); end if; end loop; end Append; ---------------------------------------- -- Append_Imported_External_Libraries -- ---------------------------------------- procedure Append_Imported_External_Libraries (Project : GPR2.Project.View.Object) is begin if Project.Has_Imports then for L of Project.Imports (Recursive => True) loop if L.Kind = K_Library and then L.Is_Externally_Built and then not L.Has_Sources then Opts_Append ("-L" & L.Library_Directory.Value); Opts_Append ("-l" & String (L.Library_Name)); end if; end loop; end if; end Append_Imported_External_Libraries; ---------------- -- Linker_For -- ---------------- procedure Linker_For (View : GPR2.Project.View.Object) is begin if View.Has_Attribute (A.Linker.Linker_Options) then Append (View.Attribute (A.Linker.Linker_Options)); end if; end Linker_For; ----------------- -- Opts_Append -- ----------------- procedure Opts_Append (Opt : String) is Position : GPR2.Containers.Value_Type_Set.Cursor; Inserted : Boolean; begin Seen.Insert (Opt, Position, Inserted); if Inserted then Opts.Append (Opt); end if; end Opts_Append; begin R.Append (" when """ & (-Options.Build_Name) & """ =>"); Linker_For (Project); if Proj.Qualifier = K_Aggregate_Library then for Aggregated of Proj.Aggregated loop Linker_For (Aggregated); Append_Imported_External_Libraries (Aggregated); end loop; end if; Append_Imported_External_Libraries (Project); -- Append Library_Options to Opts list if Proj.Is_Library then declare Library_Options : constant GPR2.Project.Attribute.Object := Proj.Attribute (A.Library_Options); begin if Library_Options.Is_Defined then for Value of Library_Options.Values loop Opts_Append (Value.Text); end loop; end if; end; end if; if Opts.Length = 0 then -- No linker alternative found, add null statement R.Append (" null;"); else declare O_List : Unbounded_String; begin for O of Opts loop if O_List /= Null_Unbounded_String then Append (O_List, ", "); end if; Append (O_List, '"' & O & '"'); end loop; R.Append (" for Linker_Options use (" & To_String (O_List) & ");"); end; end if; return R; end Linker_Case_Alternative; ----------------------------- -- Naming_Case_Alternative -- ----------------------------- function Naming_Case_Alternative (Project : GPR2.Project.View.Object) return String_Vector.Vector is procedure Naming_For (View : GPR2.Project.View.Object); -- Handle the naming scheme for this view Seen : GPR2.Containers.Name_Set; -- Records the attribute generated to avoid duplicate when -- handling aggregated projects. V : String_Vector.Vector; -- Contains the final result returned function Is_Language_Active (Lang : String) return Boolean is (Languages.Contains ((Characters.Handling.To_Lower (Lang)))); -- Returns True if Lang is active in the installed project ---------------- -- Naming_For -- ---------------- procedure Naming_For (View : GPR2.Project.View.Object) is Found : Boolean := False; begin if View.Has_Package (P.Naming, With_Defaults => False, With_Config => False) then -- Check all associative attributes for Att of View.Attributes (Pack => P.Naming, With_Defaults => False, With_Config => False) loop if Att.Has_Index then if (Att.Name.Id /= A.Naming.Body_N or else not Excluded_Naming.Contains (Name_Type (Att.Index.Text))) and then ((Att.Name.Id not in A.Naming.Spec_Suffix | A.Naming.Body_Suffix | A.Naming.Separate_Suffix) or else Is_Language_Active (Att.Index.Text)) then declare Decl : constant String := Att.Image; Pos : GPR2.Containers.Name_Type_Set.Cursor; OK : Boolean; begin Seen.Insert (Name_Type (Decl), Pos, OK); if OK then V.Append (" " & Decl); Found := True; end if; end; end if; end if; end loop; end if; if not Found then V.Append (" null;"); end if; end Naming_For; begin V.Append (" when """ & (-Options.Build_Name) & """ =>"); Naming_For (Project); if Project.Qualifier = K_Aggregate_Library then for Agg of Project.Aggregated loop Naming_For (Agg); end loop; end if; return V; end Naming_Case_Alternative; ------------------ -- Read_Project -- ------------------ procedure Read_Project is Max_Buffer : constant := 1_024; File : File_Type; Buffer : String (1 .. Max_Buffer); Last : Natural; begin Open (File, In_File, Filename); while not End_Of_File (File) loop declare L : Unbounded_String; begin loop Get_Line (File, Buffer, Last); Append (L, Buffer (1 .. Last)); exit when Last < Max_Buffer or else End_Of_Line (File); end loop; Content.Append (To_String (L)); end; end loop; Close (File); end Read_Project; --------------------------- -- With_External_Imports -- --------------------------- procedure With_External_Imports (Project : GPR2.Project.View.Object) is begin for L of Project.Imports (Recursive => True) loop if L.Has_Sources and then L.Is_Externally_Built then Content.Append ("with """ & String (L.Path_Name.Base_Name) & """;"); end if; end loop; end With_External_Imports; ------------------- -- Write_Project -- ------------------- procedure Write_Project is F : File_Access := Standard_Output; File : aliased File_Type; begin if not Options.Dry_Run then if not Project_Dir.Exists then Directories.Create_Path (Project_Dir.Value); end if; Create (File, Out_File, Filename); F := File'Unchecked_Access; end if; for Line of Content loop Put_Line (F.all, Line); end loop; if not Options.Dry_Run then Close (File); end if; end Write_Project; type Section_Kind is (Top, Naming, Linker); Project_Exists : constant Boolean := Directories.Exists (Filename); Current_Section : Section_Kind := Top; Pos : String_Vector.Cursor; Generated : Boolean := False; begin -- Set-up all languages used by the project tree Languages := Get_Languages; -- Check if the tool set has been found and we have at least one -- language defined. if Languages.Length = 0 then raise GPRinstall_Error with "cannot find toolchain for the project " & String (Project.Name) & ", no language found, aborting"; end if; if Options.Dry_Run or else Options.Verbose then New_Line; Put ("Project "); Put (Filename); if Options.Dry_Run then Put_Line (" would be installed"); else Put_Line (" installed"); end if; New_Line; end if; -- If project exists, read it and check the generated status if Project_Exists then Read_Project; -- First check that this project has been generated by gprbuild, -- if not exit with an error as we cannot modify a project created -- manually and we do not want to overwrite it. Pos := Content.First; Check_Generated_Status : while String_Vector.Has_Element (Pos) loop if Strings.Fixed.Index (String_Vector.Element (Pos), GPRinstall_Tag) /= 0 then Generated := True; exit Check_Generated_Status; end if; String_Vector.Next (Pos); end loop Check_Generated_Status; if not Generated and then not Options.Force_Installations then raise GPRinstall_Error with "non gprinstall project file " & Filename & " exists, use -f to overwrite"; end if; end if; if Project_Exists and then Generated then if not Has_Sources (Project) then -- Nothing else to do in this case return; end if; if Options.Verbose then Put_Line ("project file exists, merging new build"); end if; -- Do merging for new build, we need to add an entry into the -- BUILD_KIND type and a corresponding case entry in the naming -- and Linker package. The variables need also to be updated. Parse_Content : while String_Vector.Has_Element (Pos) loop declare use Ada.Strings; procedure Insert_Move_After (Pos : in out String_Vector.Cursor; V : String_Vector.Vector); -- Insert V into Content before Pos and return Post to be -- the item after the last inserted. ----------------------- -- Insert_Move_After -- ----------------------- procedure Insert_Move_After (Pos : in out String_Vector.Cursor; V : String_Vector.Vector) is C : constant Ada.Containers.Count_Type := V.Length; P : constant String_Vector.Extended_Index := String_Vector.To_Index (Pos); begin String_Vector.Next (Pos); Content.Insert_Vector (Pos, V); Pos := Content.To_Cursor (P + String_Vector.Extended_Index (C)); end Insert_Move_After; BN : constant String := -Options.Build_Name; Line : constant String := String_Vector.Element (Pos); P, L : Natural; begin if Fixed.Index (Line, "type BUILD_KIND is (") /= 0 then -- This is the "type BUILD_KIND" line, add new build name -- First check if the current build name already exists if Fixed.Index (Line, """" & BN & """") = 0 then -- Get end of line P := Strings.Fixed.Index (Line, ");"); if P = 0 then raise GPRinstall_Error with "cannot parse the BUILD_KIND line"; else Content.Replace_Element (Pos, Line (Line'First .. P - 1) & ", """ & BN & """);"); end if; end if; elsif Fixed.Index (Line, ":= external(") /= 0 then -- This is the BUILD line, get build vars declare Default : Unbounded_String; begin -- Get default value L := Fixed.Index (Line, """", Going => Strings.Backward); P := Fixed.Index (Line (Line'First .. L - 1), """", Going => Strings.Backward); Default := +Line (P + 1 .. L - 1); Content.Replace_Element (Pos, Get_Build_Line (-Options.Build_Vars, -Default)); end; elsif Fixed.Index (Line, "package Naming is") /= 0 then Current_Section := Naming; elsif Fixed.Index (Line, "package Linker is") /= 0 then Current_Section := Linker; elsif Fixed.Index (Line, "case BUILD is") /= 0 then -- Add new case section for the new build name case Current_Section is when Naming => Insert_Move_After (Pos, Naming_Case_Alternative (Project)); when Linker => Insert_Move_After (Pos, Linker_Case_Alternative (Project)); when Top => -- For the Sources/Lib attributes Insert_Move_After (Pos, Data_Attributes); end case; elsif Fixed.Index (Line, "when """ & BN & """ =>") /= 0 then -- Found a when with the current build name, this is a -- previous install overwritten by this one. Remove this -- section. Note that this removes sections from all -- packages Naming and Linker, and from project level -- case alternative. Count_And_Delete : declare function End_When (L : String) return Boolean; -- Return True if L is the end of a when alternative -------------- -- End_When -- -------------- function End_When (L : String) return Boolean is P : constant Natural := Strings.Fixed.Index_Non_Blank (L); Len : constant Natural := L'Last; begin return P > 0 and then ((P + 4 <= Len and then L (P .. P + 4) = "when ") or else (P + 8 <= Len and then L (P .. P + 8) = "end case;")); end End_When; I : constant String_Vector.Extended_Index := String_Vector.To_Index (Pos); P : String_Vector.Extended_Index := String_Vector.To_Index (Pos); N : Ada.Containers.Count_Type := 0; begin -- The number of line to delete are from Pos to the -- first line starting with a "when". loop N := N + 1; P := P + 1; exit when End_When (Content.Element (P)); end loop; Content.Delete (Pos, N); -- Then reset Pos to I (previous Pos index) Pos := Content.To_Cursor (I); end Count_And_Delete; else Check_Vars : declare Assign : constant Natural := Fixed.Index (Line, " := "); begin -- Check if line is a variable definition, and if so -- update the value. if Assign > 0 then for V of Project.Variables loop declare Name : constant String := String (V.Name.Text); begin if Fixed.Index (Line, ' ' & Name & ' ') in 1 .. Assign - 1 then Content.Replace_Element (Pos, " " & V.Image); end if; end; end loop; end if; end Check_Vars; end if; end; String_Vector.Next (Pos); end loop Parse_Content; else -- Project does not exist, or it exists, was not generated by -- gprinstall and -f used. In this case it will be overwritten by -- a generated project. Content.Clear; -- Tag project as generated by gprbuild Content.Append ("-- " & GPRinstall_Tag & ' ' & Version.Long_Value); Add_Empty_Line; if Project.Qualifier = K_Aggregate_Library then for V of Project.Aggregated loop With_External_Imports (V); end loop; Add_Empty_Line; elsif Project.Has_Imports then -- Handle with clauses, generate a with clauses only for -- project bringing some visibility to sources. No need -- for doing this for aggregate projects. for L of Project.Imports loop if L.Has_Sources and then Is_Install_Active (L) then Content.Append ("with """ & String (L.Path_Name.Base_Name) & """;"); end if; end loop; With_External_Imports (Project); -- Also add with for all limited with projects for L of Project.Limited_Imports loop if Is_Install_Active (L) then Content.Append ("with """ & String (L.Path_Name.Base_Name) & """;"); end if; end loop; Add_Empty_Line; end if; -- Project name if Project.Is_Library then Line := +"library "; else if Has_Sources (Project) then Line := +"standard "; else Line := +"abstract "; end if; end if; Line := Line & "project "; Line := Line & String (Project.Name); Line := Line & " is"; Content.Append (-Line); if Has_Sources (Project) or else Project.Is_Library then -- BUILD variable Content.Append (" type BUILD_KIND is (""" & (-Options.Build_Name) & """);"); Line := +Get_Build_Line (Vars => -Options.Build_Vars, Default => -Options.Build_Name); Content.Append (-Line); -- Add languages, for an aggregate library we want all unique -- languages from all aggregated libraries. if Has_Sources (Project) then Add_Empty_Line; declare Lang : Unbounded_String; First : Boolean := True; begin for L of Languages loop if not First then Append (Lang, ", "); end if; Append (Lang, '"' & L & '"'); First := False; end loop; Content.Append (" for Languages use (" & To_String (Lang) & ");"); end; end if; -- Build_Suffix used to avoid .default as suffix Add_Empty_Line; Content.Append (" case BUILD is"); Content.Append_Vector (Data_Attributes); Content.Append (" end case;"); Add_Empty_Line; -- Library Name if Project.Is_Library then Content.Append (" for Library_Name use """ & String (Project.Library_Name) & """;"); -- Issue the Library_Version only if needed if not Project.Is_Static_Library and then Project.Has_Library_Version and then Project.Library_Filename.Name /= Project.Library_Version_Filename.Name then Content.Append (" for Library_Version use """ & String (Project.Library_Version_Filename.Name) & """;"); end if; end if; -- Packages if Has_Sources (Project) then Add_Empty_Line; Create_Packages; end if; -- Set as not installable Add_Empty_Line; Content.Append (" package Install is"); Content.Append (" for Active use ""False"";"); Content.Append (" end Install;"); -- Externally Built if not Options.Sources_Only then Add_Empty_Line; Content.Append (" for Externally_Built use ""True"";"); end if; else -- This is an abstract project Content.Append (" for Source_Dirs use ();"); end if; -- Variables Add_Empty_Line; Create_Variables; -- Close project Content.Append ("end " & String (Project.Name) & ";"); end if; -- Write new project if needed Write_Project; if not Options.Dry_Run and then Options.Install_Manifest then -- Add project file to manifest Add_To_Manifest (Path_Name.Create_File (Filename_Type (Filename))); end if; end Create_Project; -------------- -- Dir_Name -- -------------- function Dir_Name (Suffix : Boolean := True) return Filename_Type is function Get_Suffix return Filename_Optional; -- Returns a suffix if needed ---------------- -- Get_Suffix -- ---------------- function Get_Suffix return Filename_Optional is begin -- .default is always omitted from the directory name if Suffix and then -Options.Build_Name /= "default" then return Filename_Type ('.' & (-Options.Build_Name)); else return No_Filename; end if; end Get_Suffix; begin return Project.Path_Name.Base_Filename & Get_Suffix; end Dir_Name; -------------- -- Exec_Dir -- -------------- function Exec_Dir return Path_Name.Object is (Prefix_For_Dir (-Exec_Subdir.V)); ----------------- -- Has_Sources -- ----------------- function Has_Sources (Project : GPR2.Project.View.Object) return Boolean is begin return Project.Has_Sources or else Project.Qualifier = K_Aggregate_Library; end Has_Sources; ----------------------- -- Is_Install_Active -- ----------------------- function Is_Install_Active (Project : GPR2.Project.View.Object) return Boolean is begin if Project.Has_Package (P.Install) then for V of Project.Attributes (Pack => P.Install) loop if V.Name.Id = A.Install.Active then return Characters.Handling.To_Lower (V.Value.Text) /= "false"; end if; end loop; end if; -- If not defined, the default is active return True; end Is_Install_Active; ------------- -- Lib_Dir -- ------------- function Lib_Dir (Build_Name : Boolean := True) return Path_Name.Object is begin return Build_Subdir (Lib_Subdir, Build_Name); end Lib_Dir; ------------------ -- Link_Lib_Dir -- ------------------ function Link_Lib_Dir return Path_Name.Object is (Prefix_For_Dir (-Link_Lib_Subdir.V)); ------------------------- -- Open_Check_Manifest -- ------------------------- procedure Open_Check_Manifest (File : out Text_IO.File_Type; Current_Line : out Text_IO.Count) is Dir : constant Path_Name.Object := Path_Name.Compose (Project_Dir, "manifests"); M_File : constant Path_Name.Object := Path_Name.Create_File (Filename_Type (-Install_Name.V), Filename_Optional (Dir.Value)); Name : constant String := String (M_File.Value); Prj_Sig : constant String := Project.Path_Name.Content_MD5; Buf : String (1 .. 128); Last : Natural; begin -- Check whether the manifest does not exist in this case if Directories.Exists (Name) then -- If this manifest is the same of the current aggregate -- one, do not try to reopen it. if not Is_Open (Agg_Manifest) or else OS_Lib.Normalize_Pathname (Text_IO.Name (Agg_Manifest), Case_Sensitive => False) /= OS_Lib.Normalize_Pathname (Name, Case_Sensitive => False) then Open (File, In_File, Name); if not End_Of_File (File) then Get_Line (File, Buf, Last); if Last >= Message_Digest'Length and then (Buf (1 .. 2) /= Sig_Line or else Buf (3 .. Message_Digest'Last + 2) /= Prj_Sig) and then Install_Name.Default and then Install_Project then Put_Line ("Project file " & String (Project.Path_Name.Simple_Name) & " is different from the one currently installed."); Put_Line ("Either:"); Put_Line (" - uninstall first using --uninstall option"); Put_Line (" - install under another name, use --install-name"); Put_Line (" - force installation under the same name, " & "use --install-name=" & (-Install_Name.V)); raise GPRinstall_Error_No_Message; end if; end if; Reset (File, Append_File); Current_Line := Line (File); end if; else Directories.Create_Path (Dir.Value); Create (File, Out_File, Name); Current_Line := 1; Put_Line (File, Sig_Line & Prj_Sig); end if; exception when Text_IO.Use_Error => raise GPRinstall_Error with "cannot open or create the manifest file " & (-Project_Subdir.V) & (-Install_Name.V) & ", check permissions on this location"; end Open_Check_Manifest; ----------------- -- Project_Dir -- ----------------- function Project_Dir return Path_Name.Object is (Prefix_For_Dir (-Project_Subdir.V)); ------------------------ -- Rollback_Manifests -- ------------------------ procedure Rollback_Manifests is Content : String_Vector.Vector; procedure Rollback_Manifest (File : in out Text_IO.File_Type; Line : Text_IO.Count); ----------------------- -- Rollback_Manifest -- ----------------------- procedure Rollback_Manifest (File : in out Text_IO.File_Type; Line : Text_IO.Count) is use type Ada.Containers.Count_Type; Dir : constant String := Directories.Containing_Directory (Name (File)) & DS; Buffer : String (1 .. 4_096); Last : Natural; begin -- Set manifest file in Read mode Reset (File, Text_IO.In_File); while not End_Of_File (File) loop Get_Line (File, Buffer, Last); if Text_IO.Line (File) = 2 or else Text_IO.Line (File) < Line then -- Record file to be kept in manifest Content.Append (Buffer (1 .. Last)); else -- Delete file declare Filename : constant String := Dir & Buffer (GNAT.MD5.Message_Digest'Length + 2 .. Last); Unused : Boolean; begin OS_Lib.Delete_File (Filename, Unused); Delete_Empty_Directory (-Prefix_Dir.V, Directories.Containing_Directory (Filename)); end; end if; end loop; -- There is nothing left in the manifest file (only the signature -- line), remove it, otherwise we create the new manifest file -- containing only the previous content. if Content.Length = 1 then declare Manifest_Filename : constant String := Name (File); begin Delete (File); -- Delete manifest directories if empty Delete_Empty_Directory (-Prefix_Dir.V, Directories.Containing_Directory (Manifest_Filename)); end; else -- Set manifest file back to Write mode Reset (File, Text_IO.Out_File); for C of Content loop Text_IO.Put_Line (File, C); end loop; Close (File); end if; end Rollback_Manifest; begin if Is_Open (Man) then Rollback_Manifest (Man, Line_Manifest); end if; if Is_Open (Agg_Manifest) then Rollback_Manifest (Agg_Manifest, Line_Agg_Manifest); end if; end Rollback_Manifests; ----------------- -- Sources_Dir -- ----------------- function Sources_Dir (Build_Name : Boolean := True) return Path_Name.Object is begin return Build_Subdir (Sources_Subdir, Build_Name); end Sources_Dir; Is_Project_To_Install : Boolean; -- Whether the project is to be installed begin -- Empty Content Content.Delete_First (Count => Ada.Containers.Count_Type'Last); -- First look for the Install package and set up the local values -- accordingly. Check_Install_Package; -- The default install name is the name of the project without -- extension. if Install_Name.Default then Install_Name.V := To_Unbounded_String (String (Project.Path_Name.Base_Name)); end if; -- Skip non-active project, note that externally built project must be -- installed. Is_Project_To_Install := Active and then (Project.Has_Sources or else Project.Has_Attribute (A.Main) or else Project.Is_Externally_Built); -- If we have an aggregate project we just install separately all -- aggregated projects. if Project.Qualifier = K_Aggregate then -- If this is the main project and is an aggregate project, create -- the corresponding manifest. if Project = Tree.Root_Project and then Tree.Root_Project.Qualifier = K_Aggregate and then Options.Install_Manifest then Open_Check_Manifest (Agg_Manifest, Line_Agg_Manifest); end if; for Agg of Project.Aggregated (Recursive => False) loop Process (Tree, Agg, Options); end loop; -- Nothing more to do for an aggregate project return; end if; if not Installed.Contains (Project) then Installed.Insert (Project); if Options.Verbosity > Quiet then if Is_Project_To_Install then Put ("Install"); elsif Options.Verbose then Put ("Skip"); end if; if Is_Project_To_Install or else Options.Verbose then Put (" project " & String (Project.Name)); if -Options.Build_Name /= "default" then Put (" - " & (-Options.Build_Name)); end if; end if; if not Is_Project_To_Install and then Options.Verbose then Put (" (not active)"); end if; if Is_Project_To_Install or else Options.Verbose then New_Line; end if; end if; -- If this is not an active project, just return now if not Is_Project_To_Install then return; end if; -- What should be copied ? Copy := (Source => For_Dev, Object => For_Dev and then not Project.Has_Mains and then Project.Qualifier /= K_Library and then Project.Qualifier /= K_Aggregate_Library and then Project.Kind /= K_Library, Dependency => For_Dev and then not Project.Has_Mains, Library => Project.Is_Library and then (not Project.Is_Static_Library or else For_Dev), Executable => Project.Has_Mains); if Copy = (Items => False) then Put_Line ("Nothing to be copied in mode " & (if For_Dev then "developer" else "usage") & " for this project"); end if; -- Copy all files from the project Copy_Files; -- A project file is only needed in developer mode if For_Dev and then Install_Project then Create_Project (Project); end if; -- Add manifest into the main aggregate project manifest if Is_Open (Man) then if Is_Open (Agg_Manifest) then declare Man_Dir : constant Path_Name.Object := Path_Name.Create_Directory ("manifests", Filename_Type (Project_Dir.Value)); Filename : constant Path_Name.Object := Path_Name.Create_File (Filename_Type (Directories.Simple_Name (Name (Man))), Filename_Type (Man_Dir.Value)); begin Close (Man); Add_To_Manifest (Filename, Aggregate_Only => True); end; else Close (Man); end if; end if; -- Handle all projects recursively if needed if Options.Recursive and then Project.Has_Imports then for P of Project.Imports loop Process (Tree, P, Options); end loop; -- Also install all limited with projects for P of Project.Limited_Imports loop Process (Tree, P, Options); end loop; end if; end if; end Process; procedure Process (Tree : GPR2.Project.Tree.Object; Options : GPRinstall.Options.Object) is begin Process (Tree, Tree.Root_Project, Options); end Process; --------------- -- Write_Eol -- --------------- procedure Write_Eol is begin Content.Append (New_Item => (Buffer (1 .. Buffer_Last))); Buffer_Last := 0; end Write_Eol; --------------- -- Write_Str -- --------------- procedure Write_Str (S : String) is begin while Buffer_Last + S'Length > Buffer'Last loop Double_Buffer; end loop; Buffer (Buffer_Last + 1 .. Buffer_Last + S'Length) := S; Buffer_Last := Buffer_Last + S'Length; end Write_Str; end GPRinstall.Install;
sparre/Command-Line-Parser-Generator
Ada
275
adb
with Ada.Text_IO; package body Good_Optional_Help is procedure Run (Help : in Boolean := False) is begin if Help then Ada.Text_IO.Put_Line ("<help>"); else Ada.Text_IO.Put_Line ("<run>"); end if; end Run; end Good_Optional_Help;
onox/orka
Ada
910
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2020 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with AUnit.Test_Suites; package Test_SIMD_FMA_Singles_Arithmetic is Test_Suite : aliased AUnit.Test_Suites.Test_Suite; function Suite return AUnit.Test_Suites.Access_Test_Suite is (Test_Suite'Access); end Test_SIMD_FMA_Singles_Arithmetic;