repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
hergin/ada2fuml | Ada | 228 | ads | with Globals_Example1;
with Md_Example4;
package Md_Example5 is
type T is new Md_Example4.T with record
Child_Attribute : Globals_Example1.Itype;
end record;
procedure Display_It (The_T : T);
end Md_Example5;
|
AdaCore/Ada_Drivers_Library | Ada | 3,212 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package MicroBit.Buttons is
type Button_State is (Pressed, Released);
type Button_Id is (Button_A, Button_B);
function State (Button : Button_Id) return Button_State;
-- Indicate the current state of the requested button
type Button_Callback is access procedure (Button : Button_Id;
State : Button_State);
function Subscribe (Callback : not null Button_Callback) return Boolean;
-- Add Callback to the list of subscribers. Return False if Callback cannot
-- be added.
--
-- Callback will be executed each time a button state changes.
function Unsubscribe (Callback : not null Button_Callback) return Boolean;
-- Remove Callback from the list of subscribers. Return False if Callback
-- is not in the list of sucbscribers.
end MicroBit.Buttons;
|
reznikmm/matreshka | Ada | 4,972 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Internals.Utp_Elements;
with AMF.UML.Messages;
with AMF.Utp.Time_Out_Messages;
with AMF.Visitors;
package AMF.Internals.Utp_Time_Out_Messages is
type Utp_Time_Out_Message_Proxy is
limited new AMF.Internals.Utp_Elements.Utp_Element_Proxy
and AMF.Utp.Time_Out_Messages.Utp_Time_Out_Message with null record;
overriding function Get_Base_Message
(Self : not null access constant Utp_Time_Out_Message_Proxy)
return AMF.UML.Messages.UML_Message_Access;
-- Getter of TimeOutMessage::base_Message.
--
overriding procedure Set_Base_Message
(Self : not null access Utp_Time_Out_Message_Proxy;
To : AMF.UML.Messages.UML_Message_Access);
-- Setter of TimeOutMessage::base_Message.
--
overriding procedure Enter_Element
(Self : not null access constant Utp_Time_Out_Message_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant Utp_Time_Out_Message_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant Utp_Time_Out_Message_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.Utp_Time_Out_Messages;
|
reznikmm/matreshka | Ada | 6,921 | 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.Dependencies_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Dependencies_Element_Node is
begin
return Self : Table_Dependencies_Element_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Table_Dependencies_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Table_Dependencies
(ODF.DOM.Table_Dependencies_Elements.ODF_Table_Dependencies_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Dependencies_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Dependencies_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Dependencies_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Table_Dependencies
(ODF.DOM.Table_Dependencies_Elements.ODF_Table_Dependencies_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Table_Dependencies_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Table_Dependencies
(Visitor,
ODF.DOM.Table_Dependencies_Elements.ODF_Table_Dependencies_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Dependencies_Element,
Table_Dependencies_Element_Node'Tag);
end Matreshka.ODF_Table.Dependencies_Elements;
|
persan/protobuf-ada | Ada | 47 | ads | package jspb.exttest is
end jspb.exttest; |
shintakezou/adaplayground | Ada | 816 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Fibonacci; use Fibonacci;
procedure Fibotest is
C : Fibo_Cur;
-- T : Fibo_Forward;
-- R : Fibo_Reversible;
F : Fibo_List;
begin
-- C := First (T);
-- while Has_Element (C) loop
-- Put_Line (Natural'Image (Element (C)));
-- C := Next (T, C);
-- end loop;
-- C := Last (R);
-- while Has_Element (C) loop
-- Put_Line (Natural'Image (Element (C)));
-- C := Previous (R, C);
-- end loop;
-- for I in F.Iterate loop
-- Put_Line (Natural'Image (Element (I)));
-- end loop;
for I of F loop
Put_Line (I); -- not a Put_Line from Text_IO, though.
end loop;
-- missing parts...
-- for I of reverse F loop
-- Put_Line (I);
-- end loop;
end Fibotest;
|
reznikmm/matreshka | Ada | 3,906 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.Internals.Strings.Handlers.Generic_X86_SSE2;
with Matreshka.Internals.Strings.Handlers.X86_Utilities;
package Matreshka.Internals.Strings.Handlers.X86.SSE2_POPCNT is
new Matreshka.Internals.Strings.Handlers.Generic_X86_SSE2
(Matreshka.Internals.Strings.Handlers.X86.X86_String_Handler,
Matreshka.Internals.Strings.Handlers.X86_Utilities.Update_Index_Forward_POPCNT,
Matreshka.Internals.Strings.Handlers.X86_Utilities.Update_Index_Backward_POPCNT);
pragma Preelaborate (Matreshka.Internals.Strings.Handlers.X86.SSE2_POPCNT);
|
charlie5/cBound | Ada | 1,652 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_render_change_picture_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
picture : aliased xcb.xcb_render_picture_t;
value_mask : aliased Interfaces.Unsigned_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_render_change_picture_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_change_picture_request_t.Item,
Element_Array => xcb.xcb_render_change_picture_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_render_change_picture_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_change_picture_request_t.Pointer,
Element_Array => xcb.xcb_render_change_picture_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_render_change_picture_request_t;
|
reznikmm/matreshka | Ada | 4,122 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
with Matreshka.DOM_Attributes;
with Matreshka.DOM_Nodes;
package Matreshka.ODF_XLink is
type Abstract_XLink_Attribute_Node is
abstract new Matreshka.DOM_Attributes.Abstract_Attribute_L2_Node with
record
Prefix : League.Strings.Universal_String;
end record;
overriding function Get_Namespace_URI
(Self : not null access constant Abstract_XLink_Attribute_Node)
return League.Strings.Universal_String;
package Constructors is
procedure Initialize
(Self : not null access Abstract_XLink_Attribute_Node'Class;
Document : not null Matreshka.DOM_Nodes.Document_Access;
Prefix : League.Strings.Universal_String)
with Inline => True;
end Constructors;
end Matreshka.ODF_XLink;
|
tum-ei-rcs/StratoX | Ada | 1,445 | adb | with MyStrings; use MyStrings;
package body Buildinfo with SPARK_Mode is
function Short_Datetime return String is
l_date : constant String := Compilation_ISO_Date;
b_time : constant String := Strip_Non_Alphanum (Compilation_Time);
b_date : constant String := Strip_Non_Alphanum (l_date (l_date'First + 2 .. l_date'Last));
shortstring : String (1 .. 11);
begin
-- XXX array concatenation: L-value is should be a constrained array, see AARM-4.5.3-6f
if b_date'Length > 5 and then b_time'Length > 3 then
shortstring (1 .. 6) := b_date (b_date'First .. b_date'First + 5);
pragma Annotate (GNATProve, False_Positive, """shortstring"" might not be initialized", "that is done right here");
shortstring (7) := '_';
shortstring (8 .. 11) := b_time (b_time'First .. b_time'First + 3);
else
declare
tmp : String (1 .. 9);
begin
tmp (tmp'First .. tmp'First - 1 + b_date'Length) := b_date;
pragma Annotate (GNATProve, False_Positive, """tmp"" might not be initialized", "that is done right here");
tmp (tmp'First + b_date'Length) := '_';
tmp (tmp'First + b_date'Length + 1 .. tmp'First + b_date'Length + b_time'Length) := b_time;
StrCpySpace (instring => tmp, outstring => shortstring);
end;
end if;
return shortstring;
end Short_Datetime;
end Buildinfo;
|
stcarrez/ada-servlet | Ada | 2,044 | ads | -----------------------------------------------------------------------
-- servlet-parts-mockup -- Mockup servlet parts (ie, local files)
-- 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.
-----------------------------------------------------------------------
private with Ada.Strings.Unbounded;
package Servlet.Parts.Mockup is
type Part is new Servlet.Parts.Part with private;
type Part_Array is array (Positive range <>) of Part;
-- Get the size of the mime part.
overriding
function Get_Size (Data : in Part) return Natural;
-- Get the content name submitted in the mime part.
overriding
function Get_Name (Data : in Part) return String;
-- Get the path of the local file which contains the part.
overriding
function Get_Local_Filename (Data : in Part) return String;
-- Get the content type of the part.
overriding
function Get_Content_Type (Data : in Part) return String;
-- Create the part content by using a local file path.
procedure Create (Into : out Part;
Name : in String;
Path : in String;
Content_Type : in String);
private
use Ada.Strings.Unbounded;
type Part is new Servlet.Parts.Part with record
Name : Unbounded_String;
Path : Unbounded_String;
Content_Type : Unbounded_String;
end record;
end Servlet.Parts.Mockup;
|
AdaCore/libadalang | Ada | 346 | adb | procedure Test is
type W_Char is access procedure (C : Character);
type W_Eol is access procedure;
procedure Print_Char (C : Character);
procedure Print_Eol;
A : W_Char := Print_Char'Unrestricted_Access;
pragma Test_Statement;
B : W_Eol := Print_Eol'Unrestricted_Access;
pragma Test_Statement;
begin
null;
end Test;
|
sungyeon/drake | Ada | 5,106 | ads | pragma License (Unrestricted);
-- implementation unit specialized for Windows
with Ada.IO_Exceptions;
with Ada.Streams;
with C.windef;
with C.winnls;
package System.Native_Environment_Encoding is
-- Platform-depended text encoding.
pragma Preelaborate;
use type Ada.Streams.Stream_Element_Offset;
-- max length of one multi-byte character
Max_Substitute_Length : constant := 6; -- UTF-8
-- encoding identifier
type Encoding_Id is new C.windef.UINT;
function Get_Image (Encoding : Encoding_Id) return String;
function Get_Default_Substitute (Encoding : Encoding_Id)
return Ada.Streams.Stream_Element_Array;
function Get_Min_Size_In_Stream_Elements (Encoding : Encoding_Id)
return Ada.Streams.Stream_Element_Offset;
UTF_8 : constant Encoding_Id := C.winnls.CP_UTF8;
UTF_16 : constant Encoding_Id := 16#ffff_ff10#; -- dummy value
UTF_32 : constant Encoding_Id := 16#ffff_ff20#; -- dummy value
function Get_Current_Encoding return Encoding_Id;
Invalid_Encoding_Id : constant := 16#ffff_ffff#; -- dummy value
-- subsidiary types to converter
type Subsequence_Status_Type is (
Finished,
Success,
Overflow, -- the output buffer is not large enough
Illegal_Sequence, -- a input character could not be mapped to the output
Truncated); -- the input buffer is broken off at a multi-byte character
pragma Discard_Names (Subsequence_Status_Type);
type Continuing_Status_Type is
new Subsequence_Status_Type range
Success ..
Subsequence_Status_Type'Last;
type Finishing_Status_Type is
new Subsequence_Status_Type range
Finished ..
Overflow;
type Status_Type is
new Subsequence_Status_Type range
Finished ..
Illegal_Sequence;
type Substituting_Status_Type is
new Status_Type range
Finished ..
Overflow;
subtype True_Only is Boolean range True .. True;
-- converter
type Converter is record
From : Encoding_Id := Invalid_Encoding_Id;
To : Encoding_Id;
Substitute_Length : Ada.Streams.Stream_Element_Offset;
Substitute : aliased Ada.Streams.Stream_Element_Array (
1 ..
Max_Substitute_Length + 1); -- zero terminated
end record;
pragma Suppress_Initialization (Converter);
Disable_Controlled : constant Boolean := True;
procedure Open (Object : out Converter; From, To : Encoding_Id);
procedure Close (Object : in out Converter) is null;
pragma Inline (Close); -- [gcc-7] can not skip calling null procedure
function Is_Open (Object : Converter) return Boolean;
pragma Inline (Is_Open);
function Min_Size_In_From_Stream_Elements_No_Check (Object : Converter)
return Ada.Streams.Stream_Element_Offset;
function Substitute_No_Check (Object : Converter)
return Ada.Streams.Stream_Element_Array;
procedure Set_Substitute_No_Check (
Object : in out Converter;
Substitute : Ada.Streams.Stream_Element_Array);
-- convert subsequence
procedure Convert_No_Check (
Object : Converter;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Finish : Boolean;
Status : out Subsequence_Status_Type);
procedure Convert_No_Check (
Object : Converter;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Status : out Continuing_Status_Type);
procedure Convert_No_Check (
Object : Converter;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Finish : True_Only;
Status : out Finishing_Status_Type);
-- convert all character sequence
-- procedure Convert_No_Check (
-- Object : Converter;
-- Item : Ada.Streams.Stream_Element_Array;
-- Last : out Ada.Streams.Stream_Element_Offset;
-- Out_Item : out Ada.Streams.Stream_Element_Array;
-- Out_Last : out Ada.Streams.Stream_Element_Offset;
-- Finish : True_Only;
-- Status : out Status_Type);
-- convert all character sequence with substitute
procedure Convert_No_Check (
Object : Converter;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Finish : True_Only;
Status : out Substituting_Status_Type);
procedure Put_Substitute (
Object : Converter;
Out_Item : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Is_Overflow : out Boolean);
-- exceptions
Name_Error : exception
renames Ada.IO_Exceptions.Name_Error;
Use_Error : exception
renames Ada.IO_Exceptions.Use_Error;
end System.Native_Environment_Encoding;
|
Vovanium/Encodings | Ada | 1,427 | ads | generic
type Character_Type is (<>);
type String_Type is array(Positive range <>) of Character_Type;
Max_Length: Positive;
package Encodings.Utility.Generic_Sequence_Buffers is
function Remaining_Length(
Data: String_Type;
Last: Natural
) return Natural is (
if Last >= Data'Last then 0 else Data'Last - Last
) with
Pre => Last >= Data'First - 1,
Post => Remaining_Length'Result in 0 .. Data'Length;
type Sequence_Buffer is record
Data: String_Type(1 .. Max_Length);
First: Positive := 1; -- first position of buffered sequence
Last: Natural := 0; -- last position of buffered sequence
end record;
function Is_Empty(
Buffer: in Sequence_Buffer
) return Boolean is (
Buffer.Last < Buffer.First
);
function Length(
Buffer: in Sequence_Buffer
) return Natural is (
if Is_Empty(Buffer) then 0 else Buffer.Last - Buffer.First + 1
) with
Post => Length'Result in 0 .. Max_Length;
procedure Write_Buffered(
Buffer: in out Sequence_Buffer;
Target: in out String_Type;
Target_Last: in out Natural
);
procedure Set_Buffer(
Buffer: in out Sequence_Buffer;
Source: in String_Type
) with
Pre => Is_Empty(Buffer),
Post => Length(Buffer) = Source'Length;
procedure Write(
Buffer: in out Sequence_Buffer;
Source: in String_Type;
Target: in out String_Type;
Target_Last: in out Natural
) with
Pre => Is_Empty(Buffer);
end Encodings.Utility.Generic_Sequence_Buffers; |
zhmu/ananas | Ada | 1,409 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . I O _ E X C E P T I O N S --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
package Ada.IO_Exceptions is
pragma Pure;
Status_Error : exception;
Mode_Error : exception;
Name_Error : exception;
Use_Error : exception;
Device_Error : exception;
End_Error : exception;
Data_Error : exception;
Layout_Error : exception;
end Ada.IO_Exceptions;
|
zrmyers/VulkanAda | Ada | 7,061 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenType;
with Vulkan.Math.GenBType;
use Vulkan.Math.GenBType;
--------------------------------------------------------------------------------
--< @group Vulkan Math GenType
--------------------------------------------------------------------------------
--< @summary
--< This package describes any length vector of Vkm_Uint type.
--<
--< @description
--< Provides an instantiation of the generic GenType package with a Base_Type of
--< Vkm_Uint. This is used to provide the GenUType subtype for the Vulkan Math
--< library.
--------------------------------------------------------------------------------
package Vulkan.Math.GenUType is
pragma Preelaborate;
pragma Pure;
--< @private
--< An instance of the generic GenType package, with Vkm_Uint as the Base_Type.
package GUT is new Vulkan.Math.GenType(
Base_Type => Vkm_Uint,
Default_Value => 0,
Image => Vkm_Uint'Image,
Unary_Minus => "-",
Multiply => "*");
--< A subtype of the instantiated Vkm_GenType that represents the GenUType
--< described in the GLSL specification.
subtype Vkm_GenUType is GUT.Vkm_GenType;
----------------------------------------------------------------------------
-- Generic Operations
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--< @summary
--< Apply function for parameters of Vkm_Uint and Vkm_Bool type to vectors.
--<
--< @description
--< Applies a supplied function component wise on two GenUType vectors and
--< a GenBType vector returning a GenUType vector.
--<
--< RVU := [Func(IVU1.x, IVU2.x, IVB1.x) ... Func(IVU1.w, IVU2.w, IVB1.w)]
--<
--< @param IVU1
--< The first input GenUType parameter.
--<
--< @param IVU2
--< The second input GenUType parameter.
--<
--< @param IVB1
--< The first input GenBType parameter.
--<
--< @return
--< The result GenUType vector, RVU.
----------------------------------------------------------------------------
generic
with function Func(ISF1, ISF2 : in Vkm_Uint;
ISB1 : in Vkm_Bool ) return Vkm_Uint;
function Apply_Func_IVU_IVU_IVB_RVU(IVU1, IVU2 : in Vkm_GenUType;
IVB1 : in Vkm_GenBType) return Vkm_GenUType;
----------------------------------------------------------------------------
--< @summary
--< Apply function for parameters of Vkm_Uint and Vkm_Bool type to vectors.
--<
--< @description
--< Applies a supplied function component wise on two GenUType vectors and
--< returns a GenBType vector.
--<
--< RVB := [Func(IVU1.x, IVU2.x) ... Func(IVU1.w, IVU2.w)]
--<
--< @param IVU1
--< The first input GenUType parameter.
--<
--< @param IVU2
--< The second input GenUType parameter.
--<
--< @return
--< The result GenBType vector, RVB.
----------------------------------------------------------------------------
generic
with function Func(ISU1, ISU2 : in Vkm_Uint) return Vkm_Bool;
function Apply_Func_IVU_IVU_RVB(IVU1, IVU2 : in Vkm_GenUType) return Vkm_GenBType;
----------------------------------------------------------------------------
--< @summary
--< Apply function for parameters of Vkm_Uint and Vkm_Int type to vectors.
--<
--< @description
--< Applies a supplied function component wise on an GenUType vector and
--< two Vkm_Int scalars, returning a Vkm_GenUType vector.
--<
--< RVU := [Func(IVU1.x, ISI1, ISI2) ... Func(IVU1.w, ISI1, ISI2)]
--<
--< @param IVU1
--< The input GenUType parameter.
--<
--< @param ISI1
--< The first input Vkm_Int parameter.
--<
--< @param ISI2
--< The second input Vkm_Int parameter.
--<
--< @return
--< The result GenBType vector, RVB.
----------------------------------------------------------------------------
generic
with function Func(ISU1 : in Vkm_Uint;
ISI1, ISI2 : in Vkm_Int) return Vkm_Uint;
function Apply_Func_IVU_ISI_ISI_RVU(
IVU1 : in Vkm_GenUType;
ISI1, ISI2 : in Vkm_Int ) return Vkm_GenUType;
----------------------------------------------------------------------------
--< @summary
--< Apply function for parameters of Vkm_Uint and Vkm_Int type to vectors.
--<
--< @description
--< Applies a supplied function component wise on two GenUType vectors and
--< two Vkm_Int scalars, returning a Vkm_GenUType vector.
--<
--< RVU := [Func(IVU1.x, IVU2.x , ISI1, ISI2) ... Func(IVU1.w, IVU2.w, ISI1, ISI2)]
--<
--< @param IVU1
--< The first input GenUType parameter.
--<
--< @param IVU2
--< The second input GenUType parameter.
--<
--< @param ISI1
--< The first input Vkm_Int parameter.
--<
--< @param ISI2
--< The second input Vkm_Int parameter.
--<
--< @return
--< The result GenBType vector, RVB.
----------------------------------------------------------------------------
generic
with function Func(ISU1, ISU2 : in Vkm_Uint;
ISI1, ISI2 : in Vkm_Int) return Vkm_Uint;
function Apply_Func_IVU_IVU_ISI_ISI_RVU(
IVU1, IVU2 : in Vkm_GenUType;
ISI1, ISI2 : in Vkm_Int ) return Vkm_GenUType;
end Vulkan.Math.GenUType;
|
stcarrez/stm32-ui | Ada | 7,487 | adb | -----------------------------------------------------------------------
-- ui-clocks -- Display a 12 hour clock
-- Copyright (C) 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Bitmapped_Drawing;
with Bitmap_Color_Conversion;
with BMP_Fonts;
with UI.Texts;
with Cosin_Table;
package body UI.Clocks is
use Bitmapped_Drawing;
CLOCK_THICKNESS : constant Natural := 5;
TICK_OFFSET : constant Natural := 10;
TICK_LENGTH : constant Natural := 5;
TEXT_OFFSET : constant Natural := TICK_OFFSET + TICK_LENGTH + 10;
CLOCK_TICK_OFFSET : constant Natural := TEXT_OFFSET + 5;
procedure Draw_Clock_Tick (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Center : in HAL.Bitmap.Point;
Width : in Natural;
Hour : in Natural;
Minute : in Natural;
Second : in Natural;
Hand : in Hand_Type) is
Pos : Natural := ((Hour mod 12) * 60) + Minute;
Quadrant : Natural := Pos / 180;
Radius : Natural := Width - CLOCK_TICK_OFFSET;
R_Sin : Natural;
R_Cos : Natural;
X, Y : Natural;
Thickness : Natural;
begin
case Hand is
when HOUR_HAND =>
Radius := Radius * 50 / 100;
Pos := ((Hour mod 12) * 60) + Minute;
Thickness := 5;
when MINUTE_HAND =>
Radius := Radius - 10;
Pos := Minute * 12 + (Second * 12) / 60;
Thickness := 2;
when SECOND_HAND =>
Radius := Radius;
Pos := Second * 12;
Thickness := 1;
end case;
Quadrant := Pos / 180;
Pos := Pos mod 180;
R_Sin := (Cosin_Table.Sin_Table (Pos) * Radius) / Cosin_Table.Factor;
R_Cos := (Cosin_Table.Cos_Table (Pos) * Radius) / Cosin_Table.Factor;
case Quadrant is
when 0 =>
X := Center.X + R_Sin;
Y := Center.Y - R_Cos;
when 1 =>
X := Center.X + R_Cos;
Y := Center.Y + R_Sin;
when 2 =>
X := Center.X - R_Sin;
Y := Center.Y + R_Cos;
when 3 =>
X := Center.X - R_Cos;
Y := Center.Y - R_Sin;
when others =>
return;
end case;
Buffer.Set_Source (UI.Texts.Foreground);
Buffer.Draw_Line (Start => (Center.X, Center.Y),
Stop => (X, Y),
Thickness => Thickness);
if Hand /= SECOND_HAND then
Buffer.Fill_Circle (Center => (X, Y), Radius => 1 + Thickness);
end if;
end Draw_Clock_Tick;
-- ------------------------------
-- Draw the 12 hour clock at the given center position and with the given width.
-- ------------------------------
procedure Draw_Clock (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Center : in HAL.Bitmap.Point;
Width : in Natural) is
FG : constant HAL.UInt32
:= Bitmap_Color_Conversion.Bitmap_Color_To_Word (Buffer.Color_Mode,
UI.Texts.Foreground);
BG : constant HAL.UInt32
:= Bitmap_Color_Conversion.Bitmap_Color_To_Word (Buffer.Color_Mode,
UI.Texts.Background);
procedure Draw_Tick (Cos_Alpha : in Float;
Sin_Alpha : in Float) is
PA, PB : HAL.Bitmap.Point;
begin
PA.X := Natural (Float (Width - TICK_OFFSET) * Cos_Alpha);
PA.Y := Natural (Float (Width - TICK_OFFSET) * Sin_Alpha);
PB.X := Natural (Float (Width - TICK_OFFSET - TICK_LENGTH) * Cos_Alpha);
PB.Y := Natural (Float (Width - TICK_OFFSET - TICK_LENGTH) * Sin_Alpha);
Buffer.Draw_Line (Start => (Center.X + PA.X, Center.Y + PA.Y),
Stop => (Center.X + PB.X, Center.Y + PB.Y));
Buffer.Draw_Line (Start => (Center.X - PA.X, Center.Y - PA.Y),
Stop => (Center.X - PB.X, Center.Y - PB.Y));
Buffer.Draw_Line (Start => (Center.X + PA.X, Center.Y - PA.Y),
Stop => (Center.X + PB.X, Center.Y - PB.Y));
Buffer.Draw_Line (Start => (Center.X - PA.X, Center.Y + PA.Y),
Stop => (Center.X - PB.X, Center.Y + PB.Y));
end Draw_Tick;
procedure Draw_Text (Cos_Alpha : in Float;
Sin_Alpha : in Float;
C1 : in Character;
C2 : in Character;
Offset_X : in Integer := 0;
Offset_Y : in Integer := 0) is
X, Y : Integer;
begin
Y := Integer (Float (Width - TEXT_OFFSET) * Sin_Alpha);
X := Integer (Float (Width - TEXT_OFFSET) * Cos_Alpha);
X := X + Offset_X;
Y := Y + Offset_Y;
Draw_Char (Buffer => Buffer,
Start => (Center.X + X, Center.Y + Y),
Char => C1,
Font => BMP_Fonts.Font8x8,
Foreground => FG,
Background => BG);
if C2 /= ' ' then
Draw_Char (Buffer => Buffer,
Start => (Center.X + X + 8, Center.Y + Y),
Char => C2,
Font => BMP_Fonts.Font8x8,
Foreground => FG,
Background => BG);
end if;
end Draw_Text;
begin
Buffer.Set_Source (UI.Texts.Foreground);
Buffer.Fill_Circle (Center => Center, Radius => Width);
Buffer.Set_Source (UI.Texts.Background);
Buffer.Fill_Circle (Center => Center, Radius => Width - CLOCK_THICKNESS);
Buffer.Set_Source (UI.Texts.Foreground);
-- Draw the clock ticks.
-- sin(30) = 0.5
-- cos(30) = 0.866025
Draw_Tick (0.0, 1.0);
Draw_Tick (1.0, 0.0);
Draw_Tick (0.866025, 0.5);
Draw_Tick (0.5, 0.866025);
-- Display the hours.
Draw_Text (0.5, -0.866025, '1', ' ', -4, -6);
Draw_Text (0.866025, -0.5, '2', ' ', 0, -6);
Draw_Text (1.0, 0.0, '3', ' ', 0, -4);
Draw_Text (0.866025, 0.5, '4', ' ', -2, -2);
Draw_Text (0.5, 0.866025, '5', ' ', -2, -2);
Draw_Text (0.0, 1.0, '6', ' ', -4, 0);
Draw_Text (-0.5, 0.866025, '7', ' ', -4, 0);
Draw_Text (-0.866025, 0.5, '8', ' ', -6, -2);
Draw_Text (-1.0, 0.0, '9', ' ', -8, -4);
Draw_Text (-0.5, -0.866025, '1', '1', -8, -4);
Draw_Text (-0.866025, -0.5, '1', '0', -8, -4);
Draw_Text (0.0, -1.0, '1', '2', -8, -8);
end Draw_Clock;
end UI.Clocks;
|
stcarrez/dynamo | Ada | 9,837 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E L I S T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides facilities for manipulating lists of nodes (see
-- package Atree for format and implementation of tree nodes). Separate list
-- elements are allocated to represent elements of these lists, so it is
-- possible for a given node to be on more than one element list at a time.
-- See also package Nlists, which provides another form that is threaded
-- through the nodes themselves (using the Link field), which is more time
-- and space efficient, but a node can be only one such list.
with Types; use Types;
with System;
package Elists is
-- An element list is represented by a header that is allocated in the
-- Elist header table. This header contains pointers to the first and
-- last elements in the list, or to No_Elmt if the list is empty.
-- The elements in the list each contain a pointer to the next element
-- and a pointer to the referenced node. Putting a node into an element
-- list causes no change at all to the node itself, so a node may be
-- included in multiple element lists, and the nodes thus included may
-- or may not be elements of node lists (see package Nlists).
procedure Initialize;
-- Initialize allocation of element list tables. Called at the start of
-- compiling each new main source file. Note that Initialize must not be
-- called if Tree_Read is used.
procedure Lock;
-- Lock tables used for element lists before calling backend
procedure Unlock;
-- Unlock list tables, in cases where the back end needs to modify them
procedure Tree_Read;
-- Initializes internal tables from current tree file using the relevant
-- Table.Tree_Read routines. Note that Initialize should not be called if
-- Tree_Read is used. Tree_Read includes all necessary initialization.
procedure Tree_Write;
-- Writes out internal tables to current tree file using the relevant
-- Table.Tree_Write routines.
function Last_Elist_Id return Elist_Id;
-- Returns Id of last allocated element list header
function Elists_Address return System.Address;
-- Return address of Elists table (used in Back_End for Gigi call)
function Num_Elists return Nat;
-- Number of currently allocated element lists
function Last_Elmt_Id return Elmt_Id;
-- Returns Id of last allocated list element
function Elmts_Address return System.Address;
-- Return address of Elmts table (used in Back_End for Gigi call)
function Node (Elmt : Elmt_Id) return Node_Or_Entity_Id;
pragma Inline (Node);
-- Returns the value of a given list element. Returns Empty if Elmt
-- is set to No_Elmt.
function New_Elmt_List return Elist_Id;
-- Creates a new empty element list. Typically this is used to initialize
-- a field in some other node which points to an element list where the
-- list is then subsequently filled in using Append calls.
function First_Elmt (List : Elist_Id) return Elmt_Id;
pragma Inline (First_Elmt);
-- Obtains the first element of the given element list or, if the list has
-- no items, then No_Elmt is returned.
function Last_Elmt (List : Elist_Id) return Elmt_Id;
pragma Inline (Last_Elmt);
-- Obtains the last element of the given element list or, if the list has
-- no items, then No_Elmt is returned.
function List_Length (List : Elist_Id) return Nat;
-- Returns number of elements in given List (zero if List = No_Elist)
function Next_Elmt (Elmt : Elmt_Id) return Elmt_Id;
pragma Inline (Next_Elmt);
-- This function returns the next element on an element list. The argument
-- must be a list element other than No_Elmt. Returns No_Elmt if the given
-- element is the last element of the list.
procedure Next_Elmt (Elmt : in out Elmt_Id);
pragma Inline (Next_Elmt);
-- Next_Elmt (Elmt) is equivalent to Elmt := Next_Elmt (Elmt)
function Is_Empty_Elmt_List (List : Elist_Id) return Boolean;
pragma Inline (Is_Empty_Elmt_List);
-- This function determines if a given tree id references an element list
-- that contains no items.
procedure Append_Elmt (N : Node_Or_Entity_Id; To : Elist_Id);
-- Appends N at the end of To, allocating a new element. N must be a
-- non-empty node or entity Id, and To must be an Elist (not No_Elist).
procedure Append_New_Elmt (N : Node_Or_Entity_Id; To : in out Elist_Id);
pragma Inline (Append_New_Elmt);
-- Like Append_Elmt if Elist_Id is not No_List, but if Elist_Id is No_List,
-- then first assigns it an empty element list and then does the append.
procedure Append_Unique_Elmt (N : Node_Or_Entity_Id; To : Elist_Id);
-- Like Append_Elmt, except that a check is made to see if To already
-- contains N and if so the call has no effect.
procedure Prepend_Elmt (N : Node_Or_Entity_Id; To : Elist_Id);
-- Appends N at the beginning of To, allocating a new element
procedure Insert_Elmt_After (N : Node_Or_Entity_Id; Elmt : Elmt_Id);
-- Add a new element (N) right after the pre-existing element Elmt
-- It is invalid to call this subprogram with Elmt = No_Elmt.
function New_Copy_Elist (List : Elist_Id) return Elist_Id;
-- Replicate the contents of a list. Internal list nodes are not shared and
-- order of elements is preserved.
procedure Replace_Elmt (Elmt : Elmt_Id; New_Node : Node_Or_Entity_Id);
pragma Inline (Replace_Elmt);
-- Causes the given element of the list to refer to New_Node, the node
-- which was previously referred to by Elmt is effectively removed from
-- the list and replaced by New_Node.
procedure Remove (List : Elist_Id; N : Node_Or_Entity_Id);
-- Remove a node or an entity from a list. If the list does not contain the
-- item in question, the routine has no effect.
procedure Remove_Elmt (List : Elist_Id; Elmt : Elmt_Id);
-- Removes Elmt from the given list. The node itself is not affected,
-- but the space used by the list element may be (but is not required
-- to be) freed for reuse in a subsequent Append_Elmt call.
procedure Remove_Last_Elmt (List : Elist_Id);
-- Removes the last element of the given list. The node itself is not
-- affected, but the space used by the list element may be (but is not
-- required to be) freed for reuse in a subsequent Append_Elmt call.
function Contains (List : Elist_Id; N : Node_Or_Entity_Id) return Boolean;
-- Perform a sequential search to determine whether the given list contains
-- a node or an entity.
function No (List : Elist_Id) return Boolean;
pragma Inline (No);
-- Tests given Id for equality with No_Elist. This allows notations like
-- "if No (Statements)" as opposed to "if Statements = No_Elist".
function Present (List : Elist_Id) return Boolean;
pragma Inline (Present);
-- Tests given Id for inequality with No_Elist. This allows notations like
-- "if Present (Statements)" as opposed to "if Statements /= No_Elist".
function No (Elmt : Elmt_Id) return Boolean;
pragma Inline (No);
-- Tests given Id for equality with No_Elmt. This allows notations like
-- "if No (Operation)" as opposed to "if Operation = No_Elmt".
function Present (Elmt : Elmt_Id) return Boolean;
pragma Inline (Present);
-- Tests given Id for inequality with No_Elmt. This allows notations like
-- "if Present (Operation)" as opposed to "if Operation /= No_Elmt".
end Elists;
|
AdaCore/gpr | Ada | 1,772 | ads | ------------------------------------------------------------------------------
-- --
-- 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/>. --
-- --
------------------------------------------------------------------------------
-- A container of slave object
with Ada.Containers.Doubly_Linked_Lists;
package GPR2.Compilation.Slave.List is
package List is new Ada.Containers.Doubly_Linked_Lists (Object);
type Object is new List.List with private;
Empty_Set : constant Object;
private
type Object is new List.List with null record;
Empty_Set : constant Object := (List.Empty_List with null record);
end GPR2.Compilation.Slave.List;
|
PThierry/ewok-kernel | Ada | 6,215 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks; use ewok.tasks;
with ewok.debug;
with ewok.devices;
with ewok.exported.interrupts;
use type ewok.exported.interrupts.t_interrupt_config_access;
with ewok.interrupts;
with ewok.layout;
with ewok.sched;
with soc.interrupts; use type soc.interrupts.t_interrupt;
with soc.nvic;
with m4.cpu;
with m4.cpu.instructions;
#if CONFIG_DBGLEVEL >= 7
with types.c; use types.c;
#end if;
package body ewok.softirq
with spark_mode => off
is
package TSK renames ewok.tasks;
procedure init
is
begin
p_isr_requests.init (isr_queue);
pragma DEBUG (debug.log (debug.INFO, "SOFTIRQ initialized"));
end init;
procedure push_isr
(task_id : in ewok.tasks_shared.t_task_id;
params : in t_isr_parameters)
is
req : constant t_isr_request := (task_id, WAITING, params);
ok : boolean;
begin
#if CONFIG_KERNEL_EXP_REENTRANCY
-- accessing the softirq input queue is not reentrant
m4.cpu.disable_irq;
#end if;
p_isr_requests.write (isr_queue, req, ok);
if not ok then
#if CONFIG_KERNEL_EXP_REENTRANCY
m4.cpu.enable_irq;
#end if;
debug.panic ("push_isr() failed.");
end if;
#if CONFIG_KERNEL_EXP_REENTRANCY
m4.cpu.enable_irq;
#end if;
ewok.tasks.set_state
(ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
end push_isr;
procedure isr_handler (req : in t_isr_request)
is
params : t_parameters;
config_a : ewok.exported.interrupts.t_interrupt_config_access;
begin
-- For further MPU mapping of the device, we need to know which device
-- triggered that interrupt.
-- Note
-- - EXTIs are not associated to any device because they can be
-- associated to several GPIO pins
-- - DMAs are not considered as devices because a single controller
-- can be used by several drivers. DMA streams are registered in a
-- specific table
TSK.tasks_list(req.caller_id).isr_ctx.device_id :=
ewok.interrupts.get_device_from_interrupt (req.params.interrupt);
-- Keep track of some hint about scheduling policy to apply after the end
-- of the ISR execution
-- Note - see above
config_a :=
ewok.devices.get_interrupt_config_from_interrupt (req.params.interrupt);
if config_a /= NULL then
TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := config_a.all.mode;
else
TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := ISR_STANDARD;
end if;
-- Zeroing the ISR stack if the ISR previously executed belongs to
-- another task
if previous_isr_owner /= req.caller_id then
declare
stack : byte_array(1 .. ewok.layout.STACK_SIZE_TASK_ISR)
with address => to_address (ewok.layout.STACK_BOTTOM_TASK_ISR);
begin
stack := (others => 0);
end;
previous_isr_owner := req.caller_id;
end if;
--
-- Note - isr_ctx.entry_point is a wrapper. The real ISR entry
-- point is defined in params(0)
--
-- User defined ISR handler
params(1) := req.params.handler;
-- IRQ
params(2) := unsigned_32'val
(soc.nvic.to_irq_number (req.params.interrupt));
-- Status and data returned by the 'posthook' treatement
-- (cf. ewok.posthook.exec)
params(3) := req.params.posthook_status;
params(4) := req.params.posthook_data;
create_stack
(ewok.layout.STACK_TOP_TASK_ISR,
TSK.tasks_list(req.caller_id).isr_ctx.entry_point, -- Wrapper
params,
TSK.tasks_list(req.caller_id).isr_ctx.frame_a);
ewok.tasks.set_mode (req.caller_id, TASK_MODE_ISRTHREAD);
ewok.tasks.set_state
(req.caller_id, TASK_MODE_ISRTHREAD, TASK_STATE_RUNNABLE);
end isr_handler;
procedure main_task
is
isr_req : t_isr_request;
ok : boolean;
begin
loop
--
-- User ISRs
--
loop
m4.cpu.disable_irq;
p_isr_requests.read (isr_queue, isr_req, ok);
if not ok then
exit;
end if;
if TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_LOCKED and
TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_SLEEPING_DEEP
then
isr_handler (isr_req);
isr_req.state := DONE;
ewok.sched.request_schedule;
m4.cpu.enable_irq;
m4.cpu.instructions.full_memory_barrier;
else
p_isr_requests.write (isr_queue, isr_req, ok);
if not ok then
debug.panic ("SOFTIRQ failed to add ISR request");
end if;
ewok.sched.request_schedule;
m4.cpu.enable_irq;
m4.cpu.instructions.full_memory_barrier;
end if;
end loop;
--
-- Set softirq task as IDLE if there is no more request to handle
--
if p_isr_requests.state (isr_queue) = p_isr_requests.EMPTY then
ewok.tasks.set_state
(ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_IDLE);
m4.cpu.instructions.full_memory_barrier;
ewok.sched.request_schedule;
end if;
m4.cpu.enable_irq;
end loop;
end main_task;
end ewok.softirq;
|
AdaCore/libadalang | Ada | 724 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Libadalang.Common; use Libadalang.Common;
with Libadalang.Helpers; use Libadalang.Helpers;
package body App is
procedure Process_Unit (Context : App_Job_Context; Unit : Analysis_Unit) is
pragma Unreferenced (Context);
function Visit (Node : Ada_Node'Class) return Visit_Status;
function Visit (Node : Ada_Node'Class) return Visit_Status is
begin
case Node.Kind is
when Ada_Goto_Stmt =>
Put_Line ("Found goto stmt: " & Node.Image);
return Over;
when others =>
return Into;
end case;
end Visit;
begin
Unit.Root.Traverse (Visit'Access);
end Process_Unit;
end App;
|
ytomino/yaml-ada | Ada | 13,247 | ads | with Ada.IO_Exceptions;
private with C.yaml;
private with Ada.Finalization;
package YAML is
pragma Preelaborate;
pragma Linker_Options ("-lyaml");
function Version return String;
type Version_Directive is record
Major : Natural;
Minor : Natural;
end record;
type Tag_Directive is record
Handle : not null access constant String;
Prefix : not null access constant String;
end record;
type Tag_Directive_Array is array (Positive range <>) of Tag_Directive;
type Encoding is (Any, UTF_8, UTF_16LE, UTF_16BE);
type Line_Break is (Any, CR, LN, CRLN);
subtype Indent_Width is Integer range 1 .. 10;
subtype Line_Width is Integer range -1 .. Integer'Last;
type Mark is record
Index : Natural;
Line : Natural;
Column : Natural;
end record;
type Scalar_Style is
(Any, Plain, Single_Quoted, Double_Quoted, Literal, Folded);
type Sequence_Style is (Any, Block, Flow);
type Mapping_Style is (Any, Block, Flow);
package Event_Types is
type Event_Type is (
No_Event, -- An empty event.
Stream_Start, -- A STREAM-START event.
Stream_End, -- A STREAM-END event.
Document_Start, -- A DOCUMENT-START event.
Document_End, -- A DOCUMENT-END event.
Alias, -- An ALIAS event.
Scalar, -- A SCALAR event.
Sequence_Start, -- A SEQUENCE-START event.
Sequence_End, -- A SEQUENCE-END event.
Mapping_Start, -- A MAPPING-START event.
Mapping_End); -- A MAPPING-END event.
private
for Event_Type use (
No_Event =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_NO_EVENT),
Stream_Start =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_STREAM_START_EVENT),
Stream_End =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_STREAM_END_EVENT),
Document_Start =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_DOCUMENT_START_EVENT),
Document_End =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_DOCUMENT_END_EVENT),
Alias =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_ALIAS_EVENT),
Scalar =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_SCALAR_EVENT),
Sequence_Start =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_SEQUENCE_START_EVENT),
Sequence_End =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_SEQUENCE_END_EVENT),
Mapping_Start =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_MAPPING_START_EVENT),
Mapping_End =>
C.yaml.yaml_event_type_t'Enum_Rep (C.yaml.YAML_MAPPING_END_EVENT));
end Event_Types;
type Event_Type is new Event_Types.Event_Type;
type Event (Event_Type : YAML.Event_Type := No_Event) is record
case Event_Type is
when Stream_Start =>
Encoding : YAML.Encoding;
when Document_Start | Document_End =>
Implicit_Indicator : Boolean;
case Event_Type is
when Document_Start =>
Version_Directive : access constant YAML.Version_Directive;
Tag_Directives : access constant YAML.Tag_Directive_Array;
when others =>
null;
end case;
when Alias | Scalar | Sequence_Start | Mapping_Start =>
Anchor : access constant String;
case Event_Type is
when Scalar | Sequence_Start | Mapping_Start =>
Tag : access constant String;
case Event_Type is
when Scalar =>
Value : not null access constant String;
Plain_Implicit_Tag : Boolean;
Quoted_Implicit_Tag : Boolean;
Scalar_Style : YAML.Scalar_Style;
when Sequence_Start | Mapping_Start =>
Implicit_Tag : Boolean;
case Event_Type is
when Sequence_Start =>
Sequence_Style : YAML.Sequence_Style;
when Mapping_Start =>
Mapping_Style : YAML.Mapping_Style;
when others =>
null;
end case;
when others =>
null;
end case;
when others =>
null;
end case;
when No_Event | Stream_End | Sequence_End | Mapping_End =>
null;
end case;
end record;
-- scalar
Binary_Tag : constant String := "tag:yaml.org,2002:binary";
Boolean_Tag : constant String := "tag:yaml.org,2002:bool";
Float_Tag : constant String := "tag:yaml.org,2002:float"; -- Floating-Point
Integer_Tag : constant String := "tag:yaml.org,2002:int";
Merge_Key_Tag : constant String := "tag:yaml.org,2002:merge";
Null_Tag : constant String := "tag:yaml.org,2002:null";
String_Tag : constant String := "tag:yaml.org,2002:str";
Time_Tag : constant String := "tag:yaml.org,2002:timestamp"; -- Timestamp
Value_Key_Tag : constant String := "tag:yaml.org,2002:value";
YAML_Encoding_Key_Tag : constant String := "tag:yaml.org,2002:yaml";
-- sequence
Ordered_Mapping_Tag : constant String := "tag:yaml.org,2002:omap";
Pairs_Tag : constant String := "tag:yaml.org,2002:pairs";
Sequence_Tag : constant String := "tag:yaml.org,2002:seq";
-- mapping
Mapping_Tag : constant String := "tag:yaml.org,2002:map"; -- Unordered Mapping
Set_Tag : constant String := "tag:yaml.org,2002:set";
-- parser
type Parsing_Entry_Type is limited private;
pragma Preelaborable_Initialization (Parsing_Entry_Type);
function Is_Assigned (Parsing_Entry : Parsing_Entry_Type) return Boolean;
pragma Inline (Is_Assigned);
type Event_Reference_Type (
Element : not null access constant Event) is null record
with Implicit_Dereference => Element;
type Mark_Reference_Type (
Element : not null access constant Mark) is null record
with Implicit_Dereference => Element;
function Value (Parsing_Entry : aliased Parsing_Entry_Type)
return Event_Reference_Type;
function Start_Mark (Parsing_Entry : aliased Parsing_Entry_Type)
return Mark_Reference_Type;
function End_Mark (Parsing_Entry : aliased Parsing_Entry_Type)
return Mark_Reference_Type;
pragma Inline (Value);
pragma Inline (Start_Mark);
pragma Inline (End_Mark);
type Parser (<>) is limited private;
function Create (
Input : not null access procedure (Item : out String; Last : out Natural))
return Parser;
procedure Set_Encoding (Object : in out Parser; Encoding : in YAML.Encoding);
procedure Get (
Object : in out Parser;
Process : not null access procedure (
Event : in YAML.Event;
Start_Mark, End_Mark : in Mark));
procedure Get (
Object : in out Parser;
Parsing_Entry : out Parsing_Entry_Type);
procedure Get_Document_Start (Object : in out Parser);
procedure Get_Document_End (Object : in out Parser);
procedure Finish (Object : in out Parser);
function Last_Error_Mark (Object : Parser) return Mark;
function Last_Error_Message (Object : Parser) return String;
-- emitter
type Emitter (<>) is limited private;
function Create (Output : not null access procedure (Item : in String))
return Emitter;
procedure Flush (Object : in out Emitter);
procedure Set_Encoding (
Object : in out Emitter;
Encoding : in YAML.Encoding);
procedure Set_Canonical (Object : in out Emitter; Canonical : in Boolean);
procedure Set_Indent (Object : in out Emitter; Indent : in Indent_Width);
procedure Set_Width (Object : in out Emitter; Width : in Line_Width);
procedure Set_Unicode (Object : in out Emitter; Unicode : in Boolean);
procedure Set_Break (Object : in out Emitter; Break : in Line_Break);
procedure Put (Object : in out Emitter; Event : in YAML.Event);
procedure Put_Document_Start (
Object : in out Emitter;
Implicit_Indicator : in Boolean := False;
Version_Directive : access constant YAML.Version_Directive := null;
Tag_Directives : access constant YAML.Tag_Directive_Array := null);
procedure Put_Document_End (
Object : in out Emitter;
Implicit_Indicator : in Boolean := True);
procedure Finish (Object : in out Emitter);
-- exceptions
Status_Error : exception
renames Ada.IO_Exceptions.Status_Error;
Use_Error : exception
renames Ada.IO_Exceptions.Use_Error;
Data_Error : exception
renames Ada.IO_Exceptions.Data_Error;
private
for Encoding use (
Any => C.yaml.yaml_encoding_t'Enum_Rep (C.yaml.YAML_ANY_ENCODING),
UTF_8 => C.yaml.yaml_encoding_t'Enum_Rep (C.yaml.YAML_UTF8_ENCODING),
UTF_16LE => C.yaml.yaml_encoding_t'Enum_Rep (C.yaml.YAML_UTF16LE_ENCODING),
UTF_16BE => C.yaml.yaml_encoding_t'Enum_Rep (C.yaml.YAML_UTF16BE_ENCODING));
for Line_Break use (
Any => C.yaml.yaml_break_t'Enum_Rep (C.yaml.YAML_ANY_BREAK),
CR => C.yaml.yaml_break_t'Enum_Rep (C.yaml.YAML_CR_BREAK),
LN => C.yaml.yaml_break_t'Enum_Rep (C.yaml.YAML_LN_BREAK),
CRLN => C.yaml.yaml_break_t'Enum_Rep (C.yaml.YAML_CRLN_BREAK));
for Scalar_Style use (
Any =>
C.yaml.yaml_scalar_style_t'Enum_Rep (C.yaml.YAML_ANY_SCALAR_STYLE),
Plain =>
C.yaml.yaml_scalar_style_t'Enum_Rep (C.yaml.YAML_PLAIN_SCALAR_STYLE),
Single_Quoted =>
C.yaml.yaml_scalar_style_t'Enum_Rep (C.yaml.YAML_SINGLE_QUOTED_SCALAR_STYLE),
Double_Quoted =>
C.yaml.yaml_scalar_style_t'Enum_Rep (C.yaml.YAML_DOUBLE_QUOTED_SCALAR_STYLE),
Literal =>
C.yaml.yaml_scalar_style_t'Enum_Rep (C.yaml.YAML_LITERAL_SCALAR_STYLE),
Folded =>
C.yaml.yaml_scalar_style_t'Enum_Rep (C.yaml.YAML_FOLDED_SCALAR_STYLE));
for Sequence_Style use (
Any =>
C.yaml.yaml_sequence_style_t'Enum_Rep (C.yaml.YAML_ANY_SEQUENCE_STYLE),
Block =>
C.yaml.yaml_sequence_style_t'Enum_Rep (C.yaml.YAML_BLOCK_SEQUENCE_STYLE),
Flow =>
C.yaml.yaml_sequence_style_t'Enum_Rep (C.yaml.YAML_FLOW_SEQUENCE_STYLE));
for Mapping_Style use (
Any =>
C.yaml.yaml_mapping_style_t'Enum_Rep (C.yaml.YAML_ANY_MAPPING_STYLE),
Block =>
C.yaml.yaml_mapping_style_t'Enum_Rep (C.yaml.YAML_BLOCK_MAPPING_STYLE),
Flow =>
C.yaml.yaml_mapping_style_t'Enum_Rep (C.yaml.YAML_FLOW_MAPPING_STYLE));
-- parser
type String_Constraint is record
First : Positive;
Last : Natural;
end record;
pragma Suppress_Initialization (String_Constraint);
type Uninitialized_Parsing_Data is limited record
Event : aliased YAML.Event;
Start_Mark, End_Mark : aliased Mark;
Version_Directive : aliased YAML.Version_Directive;
Anchor_Constraint : aliased String_Constraint;
Tag_Constraint : aliased String_Constraint;
Value_Constraint : aliased String_Constraint;
yaml_event : aliased C.yaml.yaml_event_t;
end record;
pragma Suppress_Initialization (Uninitialized_Parsing_Data);
type Parsed_Data_Type is limited record
-- uninitialized
U : aliased Uninitialized_Parsing_Data;
-- initialized
Delete : access procedure (Parsed_Data : in out Parsed_Data_Type) := null;
end record;
package Controlled_Parsing_Entries is
type Parsing_Entry_Type is limited private;
pragma Preelaborable_Initialization (Parsing_Entry_Type);
function Constant_Reference (Object : aliased YAML.Parsing_Entry_Type)
return not null access constant Parsed_Data_Type;
pragma Inline (Constant_Reference);
generic
type Result_Type (<>) is limited private;
with function Process (Raw : Parsed_Data_Type) return Result_Type;
function Query (Object : YAML.Parsing_Entry_Type) return Result_Type;
pragma Inline (Query);
generic
with procedure Process (Raw : in out Parsed_Data_Type);
procedure Update (Object : in out YAML.Parsing_Entry_Type);
pragma Inline (Update);
private
type Parsing_Entry_Type is limited new Ada.Finalization.Limited_Controlled
with record
Data : aliased Parsed_Data_Type;
end record;
overriding procedure Finalize (Object : in out Parsing_Entry_Type);
end Controlled_Parsing_Entries;
type Parsing_Entry_Type is new Controlled_Parsing_Entries.Parsing_Entry_Type;
package Controlled_Parsers is
type Parser is limited private;
generic
type Result_Type (<>) is limited private;
with function Process (Raw : not null access constant C.yaml.yaml_parser_t)
return Result_Type;
function Query (Object : YAML.Parser) return Result_Type;
pragma Inline (Query);
generic
with procedure Process (Raw : not null access C.yaml.yaml_parser_t);
procedure Update (Object : in out YAML.Parser);
pragma Inline (Update);
private
type Uninitialized_yaml_parser_t is record
X : aliased C.yaml.yaml_parser_t;
end record;
pragma Suppress_Initialization (Uninitialized_yaml_parser_t);
type Parser is limited new Ada.Finalization.Limited_Controlled
with record
Raw : aliased Uninitialized_yaml_parser_t;
end record;
overriding procedure Finalize (Object : in out Parser);
end Controlled_Parsers;
type Parser is new Controlled_Parsers.Parser;
-- emitter
package Controlled_Emitters is
type Emitter is limited private;
generic
with procedure Process (Raw : not null access C.yaml.yaml_emitter_t);
procedure Update (Object : in out YAML.Emitter);
pragma Inline (Update);
private
type Uninitialized_yaml_emitter_t is record
X : aliased C.yaml.yaml_emitter_t;
end record;
pragma Suppress_Initialization (Uninitialized_yaml_emitter_t);
type Emitter is limited new Ada.Finalization.Limited_Controlled
with record
Raw : aliased Uninitialized_yaml_emitter_t;
end record;
overriding procedure Finalize (Object : in out Emitter);
end Controlled_Emitters;
type Emitter is new Controlled_Emitters.Emitter;
-- exceptions
procedure Raise_Error (
Error : in C.yaml.yaml_error_type_t;
Problem : access constant C.char;
Mark : access constant C.yaml.yaml_mark_t);
pragma No_Return (Raise_Error);
end YAML;
|
AdaCore/gpr | Ada | 58 | ads | package Pck11 is
A : constant Integer := 1;
end Pck11;
|
zhmu/ananas | Ada | 414 | adb | -- { dg-do run }
-- { dg-options "-O0 -gnatVa" }
procedure Range_Check6 is
type Byte is range -2**7 .. 2**7-1;
for Byte'Size use 8;
subtype Hour is Byte range 0 .. 23;
type Rec is record
B : Byte;
end record;
procedure Encode (H : in out Hour) is
begin
null;
end;
R : Rec;
begin
R.B := 24;
Encode (R.B);
raise Program_Error;
exception
when Constraint_Error => null;
end;
|
PThierry/ewok-kernel | Ada | 1,311 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared;
package ewok.syscalls.ipc
with spark_mode => off
is
procedure svc_ipc_do_recv
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
blocking : in boolean;
mode : in ewok.tasks_shared.t_task_mode);
procedure svc_ipc_do_send
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
blocking : in boolean;
mode : in ewok.tasks_shared.t_task_mode);
end ewok.syscalls.ipc;
|
Rodeo-McCabe/orka | Ada | 748 | 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 is
pragma Pure;
type Index_Homogeneous is (X, Y, Z, W);
end Orka;
|
reznikmm/matreshka | Ada | 5,129 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- 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$
------------------------------------------------------------------------------
with Matreshka.Internals.Unicode;
package Matreshka.Internals.Regexps.Engine is
pragma Preelaborate;
type Instruction_Kinds is
(None,
Split,
I_Terminate,
Any_Code_Point,
Code_Point,
Code_Range,
I_Property,
Match,
Save,
I_Anchor);
type Instruction (Kind : Instruction_Kinds := None) is record
case Kind is
when None =>
null;
when Match =>
null;
when others =>
Next : Natural;
case Kind is
when None =>
null;
when I_Terminate =>
null;
when Match =>
null;
when Any_Code_Point =>
null;
when Split =>
Another : Natural;
when Code_Point =>
Code : Matreshka.Internals.Unicode.Code_Point;
when Code_Range =>
Negate : Boolean;
Low : Matreshka.Internals.Unicode.Code_Point;
High : Matreshka.Internals.Unicode.Code_Point;
when I_Property =>
Value : Property_Value;
Negative : Boolean;
when Save =>
Slot : Natural;
Start : Boolean;
when I_Anchor =>
Start_Of_Line : Boolean;
End_Of_Line : Boolean;
end case;
end case;
end record;
type Instruction_Array is array (Positive range <>) of Instruction;
type Program (Size : Natural) is record
Instructions : Instruction_Array (1 .. Size);
Captures : Natural;
end record;
end Matreshka.Internals.Regexps.Engine;
|
reznikmm/matreshka | Ada | 4,730 | 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.Chart_Mean_Value_Elements;
package Matreshka.ODF_Chart.Mean_Value_Elements is
type Chart_Mean_Value_Element_Node is
new Matreshka.ODF_Chart.Abstract_Chart_Element_Node
and ODF.DOM.Chart_Mean_Value_Elements.ODF_Chart_Mean_Value
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Chart_Mean_Value_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Chart_Mean_Value_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Chart_Mean_Value_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 Chart_Mean_Value_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 Chart_Mean_Value_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_Chart.Mean_Value_Elements;
|
ZinebZaad/ENSEEIHT | Ada | 2,230 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with SDA_Exceptions; use SDA_Exceptions;
package body LCA is
procedure Free is
new Ada.Unchecked_Deallocation (Object => T_Cellule, Name => T_LCA);
procedure Initialiser(Sda: out T_LCA) is
begin
Sda := null;
end Initialiser;
function Est_Vide (Sda : T_LCA) return Boolean is
begin
return Sda = null;
end Est_Vide;
function Cellule(Sda: in T_LCA; Cle: in T_Cle) return T_LCA is
begin
if Est_Vide(Sda) then
return null;
elsif Sda.all.Cle = Cle then
return Sda;
end if;
return Cellule(Sda.all.Suivant, Cle);
end Cellule;
function Taille (Sda : in T_LCA) return Integer is
begin
if Est_Vide(Sda) then
return 0;
end if;
return Taille(Sda.all.Suivant) + 1;
end Taille;
procedure Enregistrer (Sda : in out T_LCA ; Cle : in T_Cle ; Donnee : in T_Donnee) is
Temp: T_LCA;
begin
Temp := Cellule(Sda, Cle);
if Temp /= null then
Temp.all.Donnee := Donnee;
else
Temp := Sda;
Sda := new T_Cellule;
Sda.all.Cle := Cle;
Sda.all.Donnee := Donnee;
Sda.all.Suivant := Temp;
end if;
end Enregistrer;
function Cle_Presente (Sda : in T_LCA ; Cle : in T_Cle) return Boolean is
begin
return Cellule(Sda, Cle) /= null;
end Cle_Presente;
function La_Donnee (Sda : in T_LCA ; Cle : in T_Cle) return T_Donnee is
Temp: T_LCA;
begin
Temp := Cellule(Sda, Cle);
if Temp = null then
raise Cle_Absente_Exception;
end if;
return Temp.all.Donnee;
end La_Donnee;
procedure Supprimer (Sda : in out T_LCA ; Cle : in T_Cle) is
Temp: T_LCA;
begin
if Est_Vide(Sda) then
raise Cle_Absente_Exception;
elsif Sda.all.Cle = Cle then
Temp := Sda;
Sda := Sda.all.Suivant;
Free(Temp);
else
Supprimer(Sda.all.Suivant, Cle);
end if;
end Supprimer;
procedure Vider (Sda : in out T_LCA) is
begin
if not Est_Vide(Sda) then
Vider(Sda.all.Suivant);
Free(Sda);
end if;
end Vider;
procedure Pour_Chaque (Sda : in T_LCA) is
begin
if not Est_Vide(Sda) then
begin
Traiter(Sda.all.Cle, Sda.all.Donnee);
exception
when others => null;
end;
Pour_Chaque(Sda.all.Suivant);
end if;
end Pour_Chaque;
end LCA;
|
AdaCore/langkit | Ada | 1,647 | adb | with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with System;
with Langkit_Support.Diagnostics; use Langkit_Support.Diagnostics;
with Langkit_Support.Slocs; use Langkit_Support.Slocs;
with Langkit_Support.Symbols; use Langkit_Support.Symbols;
with Langkit_Support.Token_Data_Handlers;
use Langkit_Support.Token_Data_Handlers;
with Libfoolang.Common; use Libfoolang.Common;
with Libfoolang.Lexer; use Libfoolang.Lexer;
procedure Main is
Buffer : constant String :=
("# comment" & ASCII.LF
& "example" & ASCII.LF);
Symbols : Symbol_Table;
TDH : Token_Data_Handler;
Diagnostics : Diagnostics_Vectors.Vector;
Tok : Token_Or_Trivia_Index;
begin
Symbols := Create_Symbol_Table;
Initialize (TDH, Symbols, System.Null_Address);
Extract_Tokens
(Input => (Kind => Bytes_Buffer,
Charset => To_Unbounded_String ("ascii"),
Read_BOM => True,
Bytes => To_Unbounded_String (Buffer)),
With_Trivia => True,
TDH => TDH,
Diagnostics => Diagnostics);
Tok := First_Token_Or_Trivia (TDH);
while Tok /= No_Token_Or_Trivia_Index loop
declare
Token_Data : constant Stored_Token_Data := Data (Tok, TDH);
begin
Put_Line (Image (Sloc_Range (TDH, Token_Data))
& " " & Token_Kind'Image (To_Token_Kind (Token_Data.Kind))
& ": " & Image (TDH, Token_Data));
end;
Tok := Next (Tok, TDH);
end loop;
Free (TDH);
Destroy (Symbols);
Put_Line ("main.adb: Done.");
end Main;
|
AdaCore/libadalang | Ada | 87 | ads | package Pkg is
procedure Foo is null;
pragma Find_All_References (Any);
end Pkg;
|
optikos/oasis | Ada | 2,372 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Type_Definitions;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Interface_Types is
pragma Pure (Program.Elements.Interface_Types);
type Interface_Type is
limited interface and Program.Elements.Type_Definitions.Type_Definition;
type Interface_Type_Access is access all Interface_Type'Class
with Storage_Size => 0;
not overriding function Progenitors
(Self : Interface_Type)
return Program.Elements.Expressions.Expression_Vector_Access is abstract;
not overriding function Has_Limited (Self : Interface_Type) return Boolean
is abstract;
not overriding function Has_Task (Self : Interface_Type) return Boolean
is abstract;
not overriding function Has_Protected (Self : Interface_Type) return Boolean
is abstract;
not overriding function Has_Synchronized
(Self : Interface_Type)
return Boolean is abstract;
type Interface_Type_Text is limited interface;
type Interface_Type_Text_Access is access all Interface_Type_Text'Class
with Storage_Size => 0;
not overriding function To_Interface_Type_Text
(Self : aliased in out Interface_Type)
return Interface_Type_Text_Access is abstract;
not overriding function Limited_Token
(Self : Interface_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Task_Token
(Self : Interface_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Protected_Token
(Self : Interface_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Synchronized_Token
(Self : Interface_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Interface_Token
(Self : Interface_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function And_Token
(Self : Interface_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Interface_Types;
|
AdaCore/gpr | Ada | 1,743 | ads | with Toto;
with A.Titi;
with A.Titi.Tata;
generic
use A.Titi;
use Toto, A.Titi.Tata;
My_Var : Integer := 2;
type Element_Type is private;
-- The elements that are pooled
type Factory_Param is private;
with function Factory (Param : Factory_Param) return Element_Type;
-- Information needed to create new elements as needed. This is passed as
-- is to the Factory function.
type Resource_Set is (<>);
-- Represents a set of elements within the pool.
-- There can be multiple such sets in one pool. Each set is associated with
-- its own factory parameter, but all other elements are compatible between
-- the various sets (in particular, the resources are the same, so the rest
-- of the application doesn't need to know which set this resource is
-- from).
-- Most times, a pool will need only one such subset, which is created by
-- default. All subprograms below apply to this default set, unless
-- otherwise specified.
with procedure Free (Self : in out Element_Type) is null;
-- Called when the [Self] is finally removed from the pool
with procedure On_Release (Self : in out Element_Type) is null;
-- Called when Self is released into the pool.
-- The application has no more reference to that element, apart from the
-- one in the pool.
-- The result of Element.Element should not be freed yet, since it is
-- returned to the pool (instead, override the formal [Free] parameter).
-- But any other custom field from Element should be reset at that time.
with procedure Free_Param (Data : in out Factory_Param) is null;
-- Free Factory_Param.
-- Called when the pool itself is freed.
procedure My_Generic_Procedure; |
reznikmm/matreshka | Ada | 4,567 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Gamma_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Gamma_Attribute_Node is
begin
return Self : Draw_Gamma_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Gamma_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Gamma_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Gamma_Attribute,
Draw_Gamma_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Gamma_Attributes;
|
stcarrez/babel | Ada | 4,549 | adb | -----------------------------------------------------------------------
-- babel-base-users-tests - Unit tests for babel users
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
package body Babel.Base.Users.Tests is
use type Babel.Uid_Type;
use type Babel.Gid_Type;
use type Util.Strings.Name_Access;
package Caller is new Util.Test_Caller (Test, "Base.Users");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Babel.Base.Users.Find",
Test_Find'Access);
Caller.Add_Test (Suite, "Test Babel.Base.Users.Get_Name",
Test_Get_Name'Access);
Caller.Add_Test (Suite, "Test Babel.Base.Users.Get_Uid",
Test_Get_Uid'Access);
Caller.Add_Test (Suite, "Test Babel.Base.Users.Get_Group",
Test_Get_Group'Access);
end Add_Tests;
-- ------------------------------
-- Test the Find function resolving some existing user.
-- ------------------------------
procedure Test_Find (T : in out Test) is
Db : Babel.Base.Users.Database;
User : User_Type;
begin
User := Db.Find (0, 0);
T.Assert (User.Name /= null, "User uid=0 was not found");
T.Assert (User.Group /= null, "User gid=0 was not found");
Util.Tests.Assert_Equals (T, "root", User.Name.all, "Invalid root user name");
Util.Tests.Assert_Equals (T, "root", User.Group.all, "Invalid root group name");
User := Db.Find ("bin", "daemon");
T.Assert (User.Name /= null, "User bin was not found");
T.Assert (User.Group /= null, "Group daemon was not found");
Util.Tests.Assert_Equals (T, "bin", User.Name.all, "Invalid 'bin' user name");
Util.Tests.Assert_Equals (T, "daemon", User.Group.all, "Invalid 'daemon' group name");
T.Assert (User.Uid > 0, "Invalid 'bin' uid");
T.Assert (User.Gid > 0, "Invalid 'daemon' gid");
end Test_Find;
-- ------------------------------
-- Test the Get_Name operation.
-- ------------------------------
procedure Test_Get_Name (T : in out Test) is
Name : Name_Access;
Db : Database;
begin
Name := Db.Get_Name (0);
T.Assert (Name /= null, "Get_Name (0) returned null");
Util.Tests.Assert_Equals (T, "root", Name.all, "Invalid name returned for Get_Name (0)");
Name := Db.Get_Name (1);
T.Assert (Name /= null, "Get_Name (1) returned null");
Name := Db.Get_Name (55555);
T.Assert (Name = null, "Get_Name (55555) returned a non null name");
end Test_Get_Name;
-- ------------------------------
-- Test the Get_Uid operation.
-- ------------------------------
procedure Test_Get_Uid (T : in out Test) is
Db : Database;
Uid : Uid_Type;
begin
Uid := Db.Get_Uid ("root");
Util.Tests.Assert_Equals (T, 0, Natural (Uid), "Get_Uid (root) returned invalid uid");
Uid := Db.Get_Uid ("admin");
T.Assert (Uid /= 0, "Get_Uid (admin) returned invalid uid");
Uid := Db.Get_Uid ("Katniss");
T.Assert (Uid /= 0, "Get_Uid (Katniss) returned invalid uid");
end Test_Get_Uid;
-- ------------------------------
-- Test the Get_Group operation.
-- ------------------------------
procedure Test_Get_Group (T : in out Test) is
Name : Name_Access;
Db : Database;
begin
Name := Db.Get_Group (0);
T.Assert (Name /= null, "Get_Group (0) returned null");
Util.Tests.Assert_Equals (T, "root", Name.all, "Invalid name returned for Get_Group (0)");
Name := Db.Get_Group (1);
T.Assert (Name /= null, "Get_Group (1) returned null");
Name := Db.Get_Group (55555);
T.Assert (Name = null, "Get_Group (55555) returned a non null name");
end Test_Get_Group;
end Babel.Base.Users.Tests;
|
drm343/Space-War-3000 | Ada | 721 | ads | package ship is
type Ship_Type is Private;
type Ship_Data is Private;
type Ship_Modify is (build, colony, grid, max);
function is_Colony return Ship_Data;
function is_StarShip return Ship_Data;
function is_Station return Ship_Data;
function show_me_ship_type (ship: in Ship_Data) return String;
function show_me_ship_data (ship: in Ship_Data; modify: in Ship_Modify) return Integer;
procedure modify_ship_data (ship: in out Ship_Data; modify: in Ship_Modify; num: Integer);
Private
type Ship_Type is (Colony, StarShip, Station);
type Ship_Data is
record
name: Ship_Type;
build: Integer;
colony: Integer;
grid: Integer;
max: Integer;
end record;
end ship;
|
zhmu/ananas | Ada | 6,995 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- B I N D O . U N I T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2019-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- For full architecture, see unit Bindo.
-- The following unit contains facilities to collect all elaborable units in
-- the bind and inspect their properties.
with GNAT; use GNAT;
with GNAT.Sets; use GNAT.Sets;
package Bindo.Units is
---------------
-- Unit sets --
---------------
function Hash_Unit (U_Id : Unit_Id) return Bucket_Range_Type;
pragma Inline (Hash_Unit);
-- Obtain the hash value of key U_Id
package Unit_Sets is new Membership_Sets
(Element_Type => Unit_Id,
"=" => "=",
Hash => Hash_Unit);
procedure Collect_Elaborable_Units;
pragma Inline (Collect_Elaborable_Units);
-- Gather all units in the bind that require elaboration. The units are
-- accessible via iterator Elaborable_Units_Iterator.
function Corresponding_Body (U_Id : Unit_Id) return Unit_Id;
pragma Inline (Corresponding_Body);
-- Return the body of a spec unit U_Id
function Corresponding_Spec (U_Id : Unit_Id) return Unit_Id;
pragma Inline (Corresponding_Spec);
-- Return the spec of a body unit U_Id
function Corresponding_Unit (FNam : File_Name_Type) return Unit_Id;
pragma Inline (Corresponding_Unit);
-- Obtain the unit which corresponds to name FNam
function Corresponding_Unit (UNam : Unit_Name_Type) return Unit_Id;
pragma Inline (Corresponding_Unit);
-- Obtain the unit which corresponds to name FNam
function File_Name (U_Id : Unit_Id) return File_Name_Type;
pragma Inline (File_Name);
-- Obtain the file name of unit U_Id
type Unit_Processor_Ptr is access procedure (U_Id : Unit_Id);
procedure For_Each_Elaborable_Unit (Processor : Unit_Processor_Ptr);
pragma Inline (For_Each_Elaborable_Unit);
-- Invoke Processor on each elaborable unit in the bind
procedure For_Each_Unit (Processor : Unit_Processor_Ptr);
pragma Inline (For_Each_Unit);
-- Invoke Processor on each unit in the bind
function Has_No_Elaboration_Code (U_Id : Unit_Id) return Boolean;
pragma Inline (Has_No_Elaboration_Code);
-- Determine whether unit U_Id lacks elaboration code
function Hash_Invocation_Signature
(IS_Id : Invocation_Signature_Id) return Bucket_Range_Type;
pragma Inline (Hash_Invocation_Signature);
-- Obtain the hash value of key IS_Id
function Invocation_Graph_Encoding
(U_Id : Unit_Id) return Invocation_Graph_Encoding_Kind;
pragma Inline (Invocation_Graph_Encoding);
-- Obtain the encoding format used to capture invocation constructs and
-- relations in the ALI file of unit U_Id.
function Is_Dynamically_Elaborated (U_Id : Unit_Id) return Boolean;
pragma Inline (Is_Dynamically_Elaborated);
-- Determine whether unit U_Id was compiled using the dynamic elaboration
-- model.
function Is_Internal_Unit (U_Id : Unit_Id) return Boolean;
pragma Inline (Is_Internal_Unit);
-- Determine whether unit U_Id is internal
function Is_Predefined_Unit (U_Id : Unit_Id) return Boolean;
pragma Inline (Is_Predefined_Unit);
-- Determine whether unit U_Id is predefined
function Name (U_Id : Unit_Id) return Unit_Name_Type;
pragma Inline (Name);
-- Obtain the name of unit U_Id
function Needs_Elaboration (IS_Id : Invocation_Signature_Id) return Boolean;
pragma Inline (Needs_Elaboration);
-- Determine whether invocation signature IS_Id belongs to a construct that
-- appears in a unit which needs to be elaborated.
function Needs_Elaboration (U_Id : Unit_Id) return Boolean;
pragma Inline (Needs_Elaboration);
-- Determine whether unit U_Id needs to be elaborated
function Number_Of_Elaborable_Units return Natural;
pragma Inline (Number_Of_Elaborable_Units);
-- Obtain the number of units in the bind that need to be elaborated
function Number_Of_Units return Natural;
pragma Inline (Number_Of_Units);
-- Obtain the number of units in the bind
---------------
-- Iterators --
---------------
-- The following type represents an iterator over all units that need to be
-- elaborated.
type Elaborable_Units_Iterator is private;
function Has_Next (Iter : Elaborable_Units_Iterator) return Boolean;
pragma Inline (Has_Next);
-- Determine whether iterator Iter has more units to examine
function Iterate_Elaborable_Units return Elaborable_Units_Iterator;
pragma Inline (Iterate_Elaborable_Units);
-- Obtain an iterator over all units that need to be elaborated
procedure Next
(Iter : in out Elaborable_Units_Iterator;
U_Id : out Unit_Id);
pragma Inline (Next);
-- Return the current unit referenced by iterator Iter and advance to the
-- next available unit.
-----------------
-- Maintenance --
-----------------
procedure Finalize_Units;
pragma Inline (Finalize_Units);
-- Destroy the internal structures of this unit
procedure Initialize_Units;
pragma Inline (Initialize_Units);
-- Initialize the internal structures of this unit
private
type Elaborable_Units_Iterator is new Unit_Sets.Iterator;
end Bindo.Units;
|
reznikmm/webidl | Ada | 3,028 | ads | -- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Iterator_Interfaces;
with League.Strings;
package WebIDL.Types is
pragma Preelaborate;
type Type_Definition is limited interface;
function Assigned (Self : access Type_Definition'Class) return Boolean is
(Self /= null);
type Type_Access is access all Type_Definition'Class with Storage_Size => 0;
not overriding function Name (Self : Type_Definition)
return League.Strings.Universal_String is abstract;
not overriding function Is_Integer (Self : Type_Definition)
return Boolean is abstract;
not overriding function Is_Numeric (Self : Type_Definition)
return Boolean is abstract;
not overriding function Is_Primiteive (Self : Type_Definition)
return Boolean is abstract;
type Named_Type is limited interface and Type_Definition;
type Parameterized_Type is limited interface and Type_Definition;
not overriding function Parameter (Self : Parameterized_Type)
return not null Type_Access is abstract;
type Record_Type is limited interface and Type_Definition;
-- A record type is a parameterized type whose values are ordered maps with
-- keys that are instances of K and values that are instances of V. K must
-- be one of DOMString, USVString, or ByteString.
not overriding function Key_Type (Self : Record_Type)
return not null Type_Access is abstract;
not overriding function Value_Type (Self : Record_Type)
return not null Type_Access is abstract;
type Nullable is limited interface and Type_Definition;
-- A nullable type is an IDL type constructed from an existing type (called
-- the inner type), which just allows the additional value null to be a
-- member of its set of values. Nullable types are represented in IDL by
-- placing a U+003F QUESTION MARK ("?") character after an existing type.
not overriding function Inner_Type (Self : Nullable)
return not null WebIDL.Types.Type_Access is abstract;
type Cursor is record
Index : Positive;
Item : Type_Access;
end record;
function Has_Element (Self : Cursor) return Boolean is
(Self.Item.Assigned);
package Iterators is new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Type_Iterator_Access is access constant
Iterators.Forward_Iterator'Class
with Storage_Size => 0;
type Union is limited interface and Type_Definition;
-- A union type is a type whose set of values is the union of those in two
-- or more other types. Union types (matching UnionType) are written as a
-- series of types separated by the or keyword with a set of surrounding
-- parentheses. The types which comprise the union type are known as the
-- union’s member types.
not overriding function Members (Self : Union)
return not null WebIDL.Types.Type_Iterator_Access is abstract;
end WebIDL.Types;
|
silky/synth | Ada | 43,837 | adb | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with PortScan.Ops;
with Signals;
with Unix;
package body PortScan.Packages is
package OPS renames PortScan.Ops;
package SIG renames Signals;
---------------------------
-- wipe_out_repository --
---------------------------
procedure wipe_out_repository (repository : String)
is
pkg_search : AD.Search_Type;
dirent : AD.Directory_Entry_Type;
begin
AD.Start_Search (Search => pkg_search,
Directory => repository,
Filter => (AD.Ordinary_File => True, others => False),
Pattern => "*.txz");
while AD.More_Entries (Search => pkg_search) loop
AD.Get_Next_Entry (Search => pkg_search,
Directory_Entry => dirent);
declare
pkgname : String := repository & "/" & AD.Simple_Name (dirent);
begin
AD.Delete_File (pkgname);
end;
end loop;
end wipe_out_repository;
-----------------------------
-- remove_queue_packages --
-----------------------------
procedure remove_queue_packages (repository : String)
is
procedure remove_package (cursor : ranking_crate.Cursor);
procedure remove_package (cursor : ranking_crate.Cursor)
is
QR : constant queue_record := ranking_crate.Element (cursor);
fullpath : constant String := repository & "/" &
JT.USS (all_ports (QR.ap_index).package_name);
begin
if AD.Exists (fullpath) then
AD.Delete_File (fullpath);
end if;
end remove_package;
begin
rank_queue.Iterate (remove_package'Access);
end remove_queue_packages;
----------------------------
-- initial_package_scan --
----------------------------
procedure initial_package_scan (repository : String; id : port_id) is
begin
if id = port_match_failed then
return;
end if;
if not all_ports (id).scanned then
return;
end if;
declare
pkgname : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkgname;
msg_opt : constant String := pkgname & " failed option check.";
msg_abi : constant String := pkgname & " failed architecture (ABI) check.";
begin
if AD.Exists (fullpath) then
all_ports (id).pkg_present := True;
else
return;
end if;
if not passed_option_check (repository, id, True) then
obsolete_notice (msg_opt, True);
all_ports (id).deletion_due := True;
return;
end if;
if not passed_abi_check (repository, id, True) then
obsolete_notice (msg_abi, True);
all_ports (id).deletion_due := True;
return;
end if;
end;
all_ports (id).pkg_dep_query :=
result_of_dependency_query (repository, id);
end initial_package_scan;
---------------------------
-- remote_package_scan --
---------------------------
procedure remote_package_scan (id : port_id) is
begin
if passed_abi_check (repository => "", id => id,
skip_exist_check => True)
then
all_ports (id).remote_pkg := True;
else
return;
end if;
if not passed_option_check (repository => "", id => id,
skip_exist_check => True)
then
all_ports (id).remote_pkg := False;
return;
end if;
all_ports (id).pkg_dep_query :=
result_of_dependency_query (repository => "", id => id);
end remote_package_scan;
----------------------------
-- limited_sanity_check --
----------------------------
procedure limited_sanity_check (repository : String; dry_run : Boolean;
suppress_remote : Boolean)
is
procedure prune_packages (cursor : ranking_crate.Cursor);
procedure check_package (cursor : ranking_crate.Cursor);
procedure prune_queue (cursor : subqueue.Cursor);
procedure print (cursor : subqueue.Cursor);
procedure fetch (cursor : subqueue.Cursor);
procedure check (cursor : subqueue.Cursor);
already_built : subqueue.Vector;
fetch_list : subqueue.Vector;
fetch_fail : Boolean := False;
clean_pass : Boolean := False;
listlog : TIO.File_Type;
goodlog : Boolean;
using_screen : constant Boolean := Unix.screen_attached;
filename : constant String := "/tmp/synth_prefetch_list.txt";
package_list : JT.Text := JT.blank;
procedure check_package (cursor : ranking_crate.Cursor)
is
target : port_id := ranking_crate.Element (cursor).ap_index;
pkgname : String := JT.USS (all_ports (target).package_name);
available : constant Boolean := all_ports (target).remote_pkg or else
(all_ports (target).pkg_present and then
not all_ports (target).deletion_due);
begin
if not available then
return;
end if;
if passed_dependency_check
(query_result => all_ports (target).pkg_dep_query, id => target)
then
already_built.Append (New_Item => target);
if all_ports (target).remote_pkg then
fetch_list.Append (New_Item => target);
end if;
else
if all_ports (target).remote_pkg then
-- silently fail, remote packages are a bonus anyway
all_ports (target).remote_pkg := False;
else
obsolete_notice (pkgname & " failed dependency check.", True);
all_ports (target).deletion_due := True;
end if;
clean_pass := False;
end if;
end check_package;
procedure prune_queue (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
begin
OPS.cascade_successful_build (id);
end prune_queue;
procedure prune_packages (cursor : ranking_crate.Cursor)
is
target : port_id := ranking_crate.Element (cursor).ap_index;
delete_it : Boolean := all_ports (target).deletion_due;
pkgname : String := JT.USS (all_ports (target).package_name);
fullpath : constant String := repository & "/" & pkgname;
begin
if delete_it then
AD.Delete_File (fullpath);
end if;
exception
when others => null;
end prune_packages;
procedure print (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
line : constant String := JT.USS (all_ports (id).package_name) &
" (" & get_catport (all_ports (id)) & ")";
begin
TIO.Put_Line (" => " & line);
if goodlog then
TIO.Put_Line (listlog, line);
end if;
end print;
procedure fetch (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
begin
JT.SU.Append (package_list, " " & id2pkgname (id));
end fetch;
procedure check (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
name : constant String := JT.USS (all_ports (id).package_name);
loc : constant String := JT.USS (PM.configuration.dir_repository) &
"/" & name;
begin
if not AD.Exists (loc) then
TIO.Put_Line ("Download failed: " & name);
fetch_fail := True;
end if;
end check;
begin
if Unix.env_variable_defined ("WHYFAIL") then
activate_debugging_code;
end if;
establish_package_architecture;
original_queue_len := rank_queue.Length;
for m in scanners'Range loop
mq_progress (m) := 0;
end loop;
start_obsolete_package_logging;
parallel_package_scan (repository, False, using_screen);
if SIG.graceful_shutdown_requested then
TIO.Close (obsolete_pkg_log);
return;
end if;
while not clean_pass loop
clean_pass := True;
already_built.Clear;
rank_queue.Iterate (check_package'Access);
end loop;
if not suppress_remote and then PM.configuration.defer_prebuilt then
-- The defer_prebuilt options has been elected, so check all the
-- missing and to-be-pruned ports for suitable prebuilt packages
-- So we need to an incremental scan (skip valid, present packages)
for m in scanners'Range loop
mq_progress (m) := 0;
end loop;
parallel_package_scan (repository, True, using_screen);
if SIG.graceful_shutdown_requested then
TIO.Close (obsolete_pkg_log);
return;
end if;
clean_pass := False;
while not clean_pass loop
clean_pass := True;
already_built.Clear;
fetch_list.Clear;
rank_queue.Iterate (check_package'Access);
end loop;
end if;
TIO.Close (obsolete_pkg_log);
if SIG.graceful_shutdown_requested then
return;
end if;
if dry_run then
if not fetch_list.Is_Empty then
begin
TIO.Create (File => listlog, Mode => TIO.Out_File,
Name => filename);
goodlog := True;
exception
when others => goodlog := False;
end;
TIO.Put_Line ("These are the packages that would be fetched:");
fetch_list.Iterate (print'Access);
TIO.Put_Line ("Total packages that would be fetched:" &
fetch_list.Length'Img);
if goodlog then
TIO.Close (listlog);
TIO.Put_Line ("The complete build list can also be found at:"
& LAT.LF & filename);
end if;
else
if PM.configuration.defer_prebuilt then
TIO.Put_Line ("No packages qualify for prefetching from " &
"official package repository.");
end if;
end if;
else
rank_queue.Iterate (prune_packages'Access);
fetch_list.Iterate (fetch'Access);
if not JT.equivalent (package_list, JT.blank) then
declare
cmd : constant String := host_pkg8 & " fetch -r " &
JT.USS (external_repository) & " -U -y --output " &
JT.USS (PM.configuration.dir_packages) & JT.USS (package_list);
begin
if Unix.external_command (cmd) then
null;
end if;
end;
fetch_list.Iterate (check'Access);
end if;
end if;
if fetch_fail then
TIO.Put_Line ("At least one package failed to fetch, aborting build!");
rank_queue.Clear;
else
already_built.Iterate (prune_queue'Access);
end if;
end limited_sanity_check;
---------------------------
-- preclean_repository --
---------------------------
procedure preclean_repository (repository : String)
is
procedure insert (cursor : string_crate.Cursor);
using_screen : constant Boolean := Unix.screen_attached;
uniqid : PortScan.port_id := 0;
procedure insert (cursor : string_crate.Cursor)
is
key2 : JT.Text := string_crate.Element (cursor);
begin
if not portlist.Contains (key2) then
uniqid := uniqid + 1;
portlist.Insert (key2, uniqid);
end if;
end insert;
begin
if not scan_repository (repository) then
return;
end if;
parallel_preliminary_package_scan (repository, using_screen);
for ndx in scanners'Range loop
stored_origins (ndx).Iterate (insert'Access);
stored_origins (ndx).Clear;
end loop;
end preclean_repository;
-----------------------
-- scan_repository --
-----------------------
function scan_repository (repository : String) return Boolean
is
pkg_search : AD.Search_Type;
dirent : AD.Directory_Entry_Type;
pkg_index : scanners := scanners'First;
result : Boolean := False;
begin
AD.Start_Search (Search => pkg_search,
Directory => repository,
Filter => (AD.Ordinary_File => True, others => False),
Pattern => "*.txz");
while AD.More_Entries (Search => pkg_search) loop
AD.Get_Next_Entry (Search => pkg_search,
Directory_Entry => dirent);
declare
pkgname : JT.Text := JT.SUS (AD.Simple_Name (dirent));
begin
stored_packages (pkg_index).Append (New_Item => pkgname);
if pkg_index = scanners (number_cores) then
pkg_index := scanners'First;
else
pkg_index := pkg_index + 1;
end if;
pkgscan_total := pkgscan_total + 1;
result := True;
end;
end loop;
return result;
end scan_repository;
-----------------------------
-- generic_system_command --
-----------------------------
function generic_system_command (command : String) return JT.Text
is
content : JT.Text;
status : Integer;
begin
content := Unix.piped_command (command, status);
if status /= 0 then
raise pkgng_execution with "pkg options query cmd: " & command &
" (return code =" & status'Img & ")";
end if;
return content;
end generic_system_command;
---------------------------
-- passed_option_check --
---------------------------
function passed_option_check (repository : String; id : port_id;
skip_exist_check : Boolean := False)
return Boolean
is
begin
if id = port_match_failed or else not all_ports (id).scanned then
return False;
end if;
declare
pkg_base : constant String := id2pkgname (id);
pkg_name : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkg_name;
command : constant String := host_pkg8 & " query -F " & fullpath &
" %Ok:%Ov";
remocmd : constant String := host_pkg8 & " rquery -r " &
JT.USS (external_repository) & " -U %Ok:%Ov " & pkg_base;
content : JT.Text;
topline : JT.Text;
colon : Natural;
required : Natural := Natural (all_ports (id).options.Length);
counter : Natural := 0;
begin
if not skip_exist_check and then not AD.Exists (Name => fullpath)
then
return False;
end if;
declare
begin
if repository = "" then
content := generic_system_command (remocmd);
else
content := generic_system_command (command);
end if;
exception
when pkgng_execution => return False;
end;
loop
JT.nextline (lineblock => content, firstline => topline);
exit when JT.IsBlank (topline);
colon := JT.SU.Index (Source => topline, Pattern => ":");
if colon < 2 then
raise unknown_format with JT.USS (topline);
end if;
declare
knob : String := JT.SU.Slice (Source => topline,
Low => colon + 1,
High => JT.SU.Length (topline));
namekey : JT.Text := JT.SUS (JT.SU.Slice (Source => topline,
Low => 1,
High => colon - 1));
knobval : Boolean;
begin
if knob = "on" then
knobval := True;
elsif knob = "off" then
knobval := False;
else
raise unknown_format
with "knob=" & knob & "(" & JT.USS (topline) & ")";
end if;
counter := counter + 1;
if counter > required then
-- package has more options than we are looking for
declare
msg : String := "options " & JT.USS (namekey) & LAT.LF &
pkg_name & " has more options than required " &
"(" & JT.int2str (required) & ")";
begin
obsolete_notice (msg, debug_opt_check);
end;
return False;
end if;
if all_ports (id).options.Contains (namekey) then
if knobval /= all_ports (id).options.Element (namekey) then
-- port option value doesn't match package option value
declare
msg_on : String := pkg_name & " " & JT.USS (namekey) &
" is ON but port says it must be OFF";
msg_off : String := pkg_name & " " & JT.USS (namekey) &
" is OFF but port says it must be ON";
begin
if knobval then
obsolete_notice (msg_on, debug_opt_check);
else
obsolete_notice (msg_off, debug_opt_check);
end if;
end;
return False;
end if;
else
-- Name of package option not found in port options
declare
msg : String := pkg_name & " option " & JT.USS (namekey) &
" is no longer present in the port";
begin
obsolete_notice (msg, debug_opt_check);
end;
return False;
end if;
end;
end loop;
if counter < required then
-- The ports tree has more options than the existing package
declare
msg : String := pkg_name & " has less options than required "
& "(" & JT.int2str (required) & ")";
begin
obsolete_notice (msg, debug_opt_check);
end;
return False;
end if;
-- If we get this far, the package options must match port options
return True;
end;
exception
when issue : others =>
obsolete_notice ("option check exception" & LAT.LF &
EX.Exception_Message (issue), debug_opt_check);
return False;
end passed_option_check;
----------------------------------
-- result_of_dependency_query --
----------------------------------
function result_of_dependency_query (repository : String; id : port_id)
return JT.Text
is
pkg_base : constant String := id2pkgname (id);
pkg_name : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkg_name;
command : constant String := host_pkg8 & " query -F " & fullpath &
" %do:%dn-%dv";
remocmd : constant String := host_pkg8 & " rquery -r " &
JT.USS (external_repository) & " -U %do:%dn-%dv " & pkg_base;
begin
if repository = "" then
return generic_system_command (remocmd);
else
return generic_system_command (command);
end if;
exception
when others => return JT.blank;
end result_of_dependency_query;
-------------------------------
-- passed_dependency_check --
-------------------------------
function passed_dependency_check (query_result : JT.Text; id : port_id)
return Boolean is
begin
declare
content : JT.Text := query_result;
topline : JT.Text;
colon : Natural;
min_deps : constant Natural := all_ports (id).min_librun;
max_deps : constant Natural := Natural (all_ports (id).librun.Length);
headport : constant String := get_catport (all_ports (id));
counter : Natural := 0;
begin
loop
JT.nextline (lineblock => content, firstline => topline);
exit when JT.IsBlank (topline);
colon := JT.SU.Index (Source => topline, Pattern => ":");
if colon < 2 then
raise unknown_format with JT.USS (topline);
end if;
declare
deppkg : String := JT.SU.Slice (Source => topline,
Low => colon + 1,
High => JT.SU.Length (topline))
& ".txz";
origin : JT.Text := JT.SUS (JT.SU.Slice (Source => topline,
Low => 1,
High => colon - 1));
target_id : port_index := ports_keys.Element (Key => origin);
target_pkg : JT.Text := all_ports (target_id).package_name;
available : constant Boolean :=
all_ports (target_id).remote_pkg or else
(all_ports (target_id).pkg_present and then
not all_ports (target_id).deletion_due);
begin
if target_id = port_match_failed then
-- package has a dependency that has been removed from
-- the ports tree
declare
msg : String := JT.USS (origin) &
" has been removed from the ports tree";
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
counter := counter + 1;
if counter > max_deps then
-- package has more dependencies than we are looking for
declare
msg : String := headport & " package has more " &
"dependencies than the port requires (" &
JT.int2str (max_deps) & ")" & LAT.LF &
"Query: " & JT.USS (query_result) & LAT.LF &
"Tripped on: " & JT.USS (target_pkg) & ":" &
JT.USS (origin);
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
if deppkg /= JT.USS (target_pkg)
then
-- The version that the package requires differs from the
-- version that the ports tree will now produce
declare
msg : String :=
"Current " & headport & " package depends on " &
deppkg & ", but this is a different version than " &
"requirement of " & JT.USS (target_pkg) & " (from " &
JT.USS (origin) & ")";
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
if not available then
-- Even if all the versions are matching, we still need
-- the package to be in repository.
declare
msg : String :=
headport & " package depends on " & JT.USS (target_pkg) &
" which doesn't exist or has been scheduled " &
"for deletion";
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
end;
end loop;
if counter < min_deps then
-- The ports tree requires more dependencies than the existing
-- package does
declare
msg : String :=
headport & " package has less dependencies than the port " &
"requires (" & JT.int2str (min_deps) & ")" & LAT.LF &
"Query: " & JT.USS (query_result);
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
-- If we get this far, the package dependencies match what the
-- port tree requires exactly. This package passed sanity check.
return True;
end;
exception
when issue : others =>
obsolete_notice ("Dependency check exception" & LAT.LF &
EX.Exception_Message (issue), debug_dep_check);
return False;
end passed_dependency_check;
------------------
-- id2pkgname --
------------------
function id2pkgname (id : port_id) return String
is
pkg_name : constant String := JT.USS (all_ports (id).package_name);
len : constant Natural := pkg_name'Length - 4;
begin
return pkg_name (1 .. len);
end id2pkgname;
------------------------
-- passed_abi_check --
------------------------
function passed_abi_check (repository : String; id : port_id;
skip_exist_check : Boolean := False)
return Boolean
is
pkg_base : constant String := id2pkgname (id);
pkg_name : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkg_name;
command : constant String := host_pkg8 & " query -F " & fullpath & " %q";
remocmd : constant String := host_pkg8 & " rquery -r " &
JT.USS (external_repository) & " -U %q " & pkg_base;
content : JT.Text;
topline : JT.Text;
begin
if not skip_exist_check and then not AD.Exists (Name => fullpath)
then
return False;
end if;
declare
begin
if repository = "" then
content := generic_system_command (remocmd);
else
content := generic_system_command (command);
end if;
exception
when pkgng_execution => return False;
end;
JT.nextline (lineblock => content, firstline => topline);
if JT.equivalent (topline, abi_formats.calculated_abi) then
return True;
end if;
if JT.equivalent (topline, abi_formats.calc_abi_noarch) then
return True;
end if;
if JT.equivalent (topline, abi_formats.calculated_alt_abi) then
return True;
end if;
if JT.equivalent (topline, abi_formats.calc_alt_abi_noarch) then
return True;
end if;
return False;
exception
when others => return False;
end passed_abi_check;
----------------------
-- queue_is_empty --
----------------------
function queue_is_empty return Boolean is
begin
return rank_queue.Is_Empty;
end queue_is_empty;
--------------------------------------
-- establish_package_architecture --
--------------------------------------
procedure establish_package_architecture is
begin
abi_formats := Replicant.Platform.determine_package_architecture;
end establish_package_architecture;
---------------------------
-- original_queue_size --
---------------------------
function original_queue_size return Natural is
begin
return Natural (original_queue_len);
end original_queue_size;
----------------------------------
-- passed_options_cache_check --
----------------------------------
function passed_options_cache_check (id : port_id) return Boolean
is
target_dname : String := JT.replace (get_catport (all_ports (id)),
reject => LAT.Solidus,
shiny => LAT.Low_Line);
target_path : constant String := JT.USS (PM.configuration.dir_options) &
LAT.Solidus & target_dname & LAT.Solidus & "options";
marker : constant String := "+=";
option_file : TIO.File_Type;
required : Natural := Natural (all_ports (id).options.Length);
counter : Natural := 0;
result : Boolean := False;
begin
if not AD.Exists (target_path) then
return True;
end if;
TIO.Open (File => option_file,
Mode => TIO.In_File,
Name => target_path);
while not TIO.End_Of_File (option_file) loop
declare
Line : String := TIO.Get_Line (option_file);
namekey : JT.Text;
valid : Boolean := False;
begin
-- If "marker" starts at 17, it's OPTIONS_FILES_SET
-- if "marker" starts at 19, it's OPTIONS_FILES_UNSET
-- if neither, we don't care.
if Line (17 .. 18) = marker then
namekey := JT.SUS (Line (19 .. Line'Last));
valid := True;
elsif Line (19 .. 20) = marker then
namekey := JT.SUS (Line (21 .. Line'Last));
valid := True;
end if;
if valid then
counter := counter + 1;
if counter > required then
-- The port used to have more options, abort!
goto clean_exit;
end if;
if not all_ports (id).options.Contains (namekey) then
-- cached option not found in port anymore, abort!
goto clean_exit;
end if;
end if;
end;
end loop;
if counter = required then
result := True;
end if;
<<clean_exit>>
TIO.Close (option_file);
return result;
end passed_options_cache_check;
------------------------------------
-- limited_cached_options_check --
------------------------------------
function limited_cached_options_check return Boolean
is
procedure check_port (cursor : ranking_crate.Cursor);
fail_count : Natural := 0;
first_fail : queue_record;
procedure check_port (cursor : ranking_crate.Cursor)
is
QR : constant queue_record := ranking_crate.Element (cursor);
id : port_index := QR.ap_index;
prelude : constant String := "Cached options obsolete: ";
begin
if not passed_options_cache_check (id) then
if fail_count = 0 then
first_fail := QR;
end if;
fail_count := fail_count + 1;
TIO.Put_Line (prelude & get_catport (all_ports (id)));
end if;
end check_port;
begin
rank_queue.Iterate (Process => check_port'Access);
if fail_count > 0 then
TIO.Put (LAT.LF & "A preliminary scan has revealed the cached " &
"options of");
if fail_count = 1 then
TIO.Put_Line (" one port are");
else
TIO.Put_Line (fail_count'Img & " ports are");
end if;
TIO.Put_Line ("obsolete. Please update or remove the saved " &
"options and try again.");
declare
portsdir : String := JT.USS (PM.configuration.dir_portsdir) &
LAT.Solidus;
catport : String := get_catport (all_ports (first_fail.ap_index));
begin
TIO.Put_Line (" e.g. make -C " & portsdir & catport & " config");
TIO.Put_Line (" e.g. make -C " & portsdir & catport & " rmconfig");
end;
end if;
return (fail_count = 0);
end limited_cached_options_check;
-----------------------------
-- parallel_package_scan --
-----------------------------
procedure parallel_package_scan (repository : String; remote_scan : Boolean;
show_progress : Boolean)
is
task type scan (lot : scanners);
finished : array (scanners) of Boolean := (others => False);
combined_wait : Boolean := True;
label_shown : Boolean := False;
aborted : Boolean := False;
task body scan
is
procedure populate (cursor : subqueue.Cursor);
procedure populate (cursor : subqueue.Cursor)
is
target_port : port_index := subqueue.Element (cursor);
important : constant Boolean := all_ports (target_port).scanned;
begin
if not aborted and then important then
if remote_scan and then
not all_ports (target_port).never_remote
then
if not all_ports (target_port).pkg_present or else
all_ports (target_port).deletion_due
then
remote_package_scan (target_port);
end if;
else
initial_package_scan (repository, target_port);
end if;
end if;
mq_progress (lot) := mq_progress (lot) + 1;
end populate;
begin
make_queue (lot).Iterate (populate'Access);
finished (lot) := True;
end scan;
scan_01 : scan (lot => 1);
scan_02 : scan (lot => 2);
scan_03 : scan (lot => 3);
scan_04 : scan (lot => 4);
scan_05 : scan (lot => 5);
scan_06 : scan (lot => 6);
scan_07 : scan (lot => 7);
scan_08 : scan (lot => 8);
scan_09 : scan (lot => 9);
scan_10 : scan (lot => 10);
scan_11 : scan (lot => 11);
scan_12 : scan (lot => 12);
scan_13 : scan (lot => 13);
scan_14 : scan (lot => 14);
scan_15 : scan (lot => 15);
scan_16 : scan (lot => 16);
scan_17 : scan (lot => 17);
scan_18 : scan (lot => 18);
scan_19 : scan (lot => 19);
scan_20 : scan (lot => 20);
scan_21 : scan (lot => 21);
scan_22 : scan (lot => 22);
scan_23 : scan (lot => 23);
scan_24 : scan (lot => 24);
scan_25 : scan (lot => 25);
scan_26 : scan (lot => 26);
scan_27 : scan (lot => 27);
scan_28 : scan (lot => 28);
scan_29 : scan (lot => 29);
scan_30 : scan (lot => 30);
scan_31 : scan (lot => 31);
scan_32 : scan (lot => 32);
begin
while combined_wait loop
delay 1.0;
combined_wait := False;
for j in scanners'Range loop
if not finished (j) then
combined_wait := True;
exit;
end if;
end loop;
if combined_wait then
if not label_shown then
label_shown := True;
TIO.Put_Line ("Scanning existing packages.");
end if;
if show_progress then
TIO.Put (scan_progress);
end if;
if SIG.graceful_shutdown_requested then
aborted := True;
end if;
end if;
end loop;
end parallel_package_scan;
-----------------------------------------
-- parallel_preliminary_package_scan --
-----------------------------------------
procedure parallel_preliminary_package_scan (repository : String;
show_progress : Boolean)
is
task type scan (lot : scanners);
finished : array (scanners) of Boolean := (others => False);
combined_wait : Boolean := True;
label_shown : Boolean := False;
aborted : Boolean := False;
task body scan
is
procedure check (csr : string_crate.Cursor);
procedure check (csr : string_crate.Cursor) is
begin
if aborted then
return;
end if;
declare
pkgname : constant String := JT.USS (string_crate.Element (csr));
pkgpath : constant String := repository & "/" & pkgname;
origin : constant String := query_origin (fullpath => pkgpath);
path1 : constant String :=
JT.USS (PM.configuration.dir_portsdir) & "/" & origin;
begin
if AD.Exists (path1) and then
current_package_name (origin, pkgname)
then
stored_origins (lot).Append (New_Item => JT.SUS (origin));
else
AD.Delete_File (pkgpath);
TIO.Put_Line ("Removed: " & pkgname);
end if;
exception
when others =>
TIO.Put_Line (" Failed to remove " & pkgname);
end;
pkgscan_progress (lot) := pkgscan_progress (lot) + 1;
end check;
begin
stored_packages (lot).Iterate (check'Access);
stored_packages (lot).Clear;
finished (lot) := True;
end scan;
scan_01 : scan (lot => 1);
scan_02 : scan (lot => 2);
scan_03 : scan (lot => 3);
scan_04 : scan (lot => 4);
scan_05 : scan (lot => 5);
scan_06 : scan (lot => 6);
scan_07 : scan (lot => 7);
scan_08 : scan (lot => 8);
scan_09 : scan (lot => 9);
scan_10 : scan (lot => 10);
scan_11 : scan (lot => 11);
scan_12 : scan (lot => 12);
scan_13 : scan (lot => 13);
scan_14 : scan (lot => 14);
scan_15 : scan (lot => 15);
scan_16 : scan (lot => 16);
scan_17 : scan (lot => 17);
scan_18 : scan (lot => 18);
scan_19 : scan (lot => 19);
scan_20 : scan (lot => 20);
scan_21 : scan (lot => 21);
scan_22 : scan (lot => 22);
scan_23 : scan (lot => 23);
scan_24 : scan (lot => 24);
scan_25 : scan (lot => 25);
scan_26 : scan (lot => 26);
scan_27 : scan (lot => 27);
scan_28 : scan (lot => 28);
scan_29 : scan (lot => 29);
scan_30 : scan (lot => 30);
scan_31 : scan (lot => 31);
scan_32 : scan (lot => 32);
begin
while combined_wait loop
delay 1.0;
if show_progress then
TIO.Put (package_scan_progress);
end if;
combined_wait := False;
for j in scanners'Range loop
if not finished (j) then
combined_wait := True;
exit;
end if;
end loop;
if combined_wait then
if not label_shown then
label_shown := True;
TIO.Put_Line ("Stand by, prescanning existing packages.");
end if;
if SIG.graceful_shutdown_requested then
aborted := True;
end if;
end if;
end loop;
end parallel_preliminary_package_scan;
-----------------------------------
-- located_external_repository --
-----------------------------------
function located_external_repository return Boolean
is
command : constant String := host_pkg8 & " -vv";
dump : JT.Text;
topline : JT.Text;
crlen1 : Natural;
crlen2 : Natural;
found : Boolean := False;
inspect : Boolean := False;
begin
declare
begin
dump := generic_system_command (command);
exception
when pkgng_execution => return False;
end;
crlen1 := JT.SU.Length (dump);
loop
JT.nextline (lineblock => dump, firstline => topline);
crlen2 := JT.SU.Length (dump);
exit when crlen1 = crlen2;
crlen1 := crlen2;
if inspect then
declare
line : constant String := JT.USS (topline);
len : constant Natural := line'Length;
begin
if len > 7 and then
line (1 .. 2) = " " and then
line (len - 3 .. len) = ": { " and then
line (3 .. len - 4) /= "Synth"
then
found := True;
external_repository := JT.SUS (line (3 .. len - 4));
exit;
end if;
end;
else
if JT.equivalent (topline, "Repositories:") then
inspect := True;
end if;
end if;
end loop;
return found;
end located_external_repository;
-------------------------------
-- top_external_repository --
-------------------------------
function top_external_repository return String is
begin
return JT.USS (external_repository);
end top_external_repository;
-------------------------------
-- activate_debugging_code --
-------------------------------
procedure activate_debugging_code is
begin
debug_opt_check := True;
debug_dep_check := True;
end activate_debugging_code;
--------------------
-- query_origin --
--------------------
function query_origin (fullpath : String) return String
is
command : constant String := host_pkg8 & " query -F " & fullpath & " %o";
content : JT.Text;
topline : JT.Text;
begin
content := generic_system_command (command);
JT.nextline (lineblock => content, firstline => topline);
return JT.USS (topline);
exception
when others => return "";
end query_origin;
----------------------------
-- current_package_name --
----------------------------
function current_package_name (origin, file_name : String) return Boolean
is
cpn : constant String := get_pkg_name (origin);
begin
return cpn = file_name;
end current_package_name;
-----------------------------
-- package_scan_progress --
-----------------------------
function package_scan_progress return String
is
type percent is delta 0.01 digits 5;
complete : port_index := 0;
pc : percent;
total : constant Float := Float (pkgscan_total);
begin
for k in scanners'Range loop
complete := complete + pkgscan_progress (k);
end loop;
pc := percent (100.0 * Float (complete) / total);
return " progress:" & pc'Img & "% " & LAT.CR;
end package_scan_progress;
--------------------------------------
-- start_obsolete_package_logging --
--------------------------------------
procedure start_obsolete_package_logging
is
logpath : constant String := JT.USS (PM.configuration.dir_logs)
& "/06_obsolete_packages.log";
begin
if AD.Exists (logpath) then
AD.Delete_File (logpath);
end if;
TIO.Create (File => obsolete_pkg_log,
Mode => TIO.Out_File,
Name => logpath);
obsolete_log_open := True;
exception
when others =>
obsolete_log_open := False;
end start_obsolete_package_logging;
-----------------------
-- obsolete_notice --
-----------------------
procedure obsolete_notice (message : String; write_to_screen : Boolean)
is
begin
if obsolete_log_open then
TIO.Put_Line (obsolete_pkg_log, message);
end if;
if write_to_screen then
TIO.Put_Line (message);
end if;
end obsolete_notice;
end PortScan.Packages;
|
RREE/ada-util | Ada | 1,747 | adb | -----------------------------------------------------------------------
-- cut -- Text Transformations
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Command_Line;
with Util.Strings;
with Util.Strings.Tokenizers;
procedure Cut is
procedure Print_Token (Token : in String;
Done : out Boolean) is
begin
Ada.Text_IO.Put_Line (Token);
Done := False;
end Print_Token;
Count : constant Natural := Ada.Command_Line.Argument_Count;
begin
if Count <= 1 then
Ada.Text_IO.Put_Line ("Usage: cut pattern ...");
Ada.Text_IO.Put_Line ("Example: cut : $PATH");
return;
end if;
declare
Pattern : constant String := Ada.Command_Line.Argument (1);
begin
for I in 2 .. Count loop
Util.Strings.Tokenizers.Iterate_Tokens (Content => Ada.Command_Line.Argument (I),
Pattern => Pattern,
Process => Print_Token'Access);
end loop;
end;
end Cut;
|
Fabien-Chouteau/lvgl-ada | Ada | 4,972 | ads | with Lv.Style;
package Lv.Objx.Roller is
subtype Instance is Obj_T;
type Style_T is (Style_Bg, Style_Sel);
-- Create a roller object
-- @param par pointer to an object, it will be the parent of the new roller
-- @param copy pointer to a roller object, if not NULL then the new object will be copied from it
-- @return pointer to the created roller
function Create (Parent : Obj_T; Copy : Instance) return Instance;
----------------------
-- Setter functions --
----------------------
-- Set the options on a roller
-- @param self pointer to roller object
-- @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
procedure Set_Options
(Self : Instance;
Options : C_String_Ptr);
-- Set the selected option
-- @param self pointer to a roller object
-- @param sel_opt id of the selected option (0 ... number of option - 1);
-- @param anim_en true: set with animation; false set immediately
procedure Set_Selected (Self : Instance; Set_Opt : Uint16_T; Anim_En : U_Bool);
-- Set a function to call when a new option is chosen
-- @param self pointer to a roller
-- @param action pointer to a callback function
procedure Set_Action (Self : Instance; Action : Action_Func_T);
-- Set the height to show the given number of rows (options)
-- @param self pointer to a roller object
-- @param row_cnt number of desired visible rows
procedure Set_Visible_Row_Count (Self : Instance; Arg2 : Uint8_T);
-- Enable or disable the horizontal fit to the content
-- @param self pointer to a roller
-- @param fit en true: enable auto fit; false: disable auto fit
procedure Set_Hor_Fit (Self : Instance; Fit_En : U_Bool);
-- Set the open/close animation time.
-- @param self pointer to a roller object
-- @param anim_time: open/close animation time [ms]
procedure Set_Anim_Time (Self : Instance; Anim_Time : Uint16_T);
-- Set a style of a roller
-- @param self pointer to a roller object
-- @param type which style should be set
-- @param style pointer to a style
procedure Set_Style
(Self : Instance;
Type_P : Style_T;
Style : Lv.Style.Style);
----------------------
-- Getter functions --
----------------------
-- Get the options of a roller
-- @param self pointer to roller object
-- @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
function Options
(Self : Instance) return C_String_Ptr;
-- Get the id of the selected option
-- @param self pointer to a roller object
-- @return id of the selected option (0 ... number of option - 1);
function Selected (Self : Instance) return Uint16_T;
-- Get the current selected option as a string
-- @param self pointer to roller object
-- @param buf pointer to an array to store the string
procedure Selected_Str
(Self : Instance;
Buf : C_String_Ptr);
-- Get the "option selected" callback function
-- @param self pointer to a roller
-- @return pointer to the call back function
function Action (Self : Instance) return Action_Func_T;
-- Get the open/close animation time.
-- @param self pointer to a roller
-- @return open/close animation time [ms]
function Anim_Time (Self : Instance) return Uint16_T;
-- Get the auto width set attribute
-- @param self pointer to a roller object
-- @return true: auto size enabled; false: manual width settings enabled
function Hor_Fit (Self : Instance) return U_Bool;
-- Get a style of a roller
-- @param self pointer to a roller object
-- @param type which style should be get
-- @return style pointer to a style
function Style
(Self : Instance;
Type_P : Style_T) return Lv.Style.Style;
-------------
-- Imports --
-------------
pragma Import (C, Create, "lv_roller_create");
pragma Import (C, Set_Options, "lv_roller_set_options_inline");
pragma Import (C, Set_Selected, "lv_roller_set_selected");
pragma Import (C, Set_Action, "lv_roller_set_action_inline");
pragma Import (C, Set_Visible_Row_Count, "lv_roller_set_visible_row_count");
pragma Import (C, Set_Hor_Fit, "lv_roller_set_hor_fit_inline");
pragma Import (C, Set_Anim_Time, "lv_roller_set_anim_time_inline");
pragma Import (C, Set_Style, "lv_roller_set_style");
pragma Import (C, Options, "lv_roller_get_options_inline");
pragma Import (C, Selected, "lv_roller_get_selected_inline");
pragma Import (C, Selected_Str, "lv_roller_get_selected_str_inline");
pragma Import (C, Action, "lv_roller_get_action_inline");
pragma Import (C, Anim_Time, "lv_roller_get_anim_time_inline");
pragma Import (C, Hor_Fit, "lv_roller_get_hor_fit");
pragma Import (C, Style, "lv_roller_get_style");
for Style_T'Size use 8;
for Style_T use (Style_Bg => 0,
Style_Sel => 1);
end Lv.Objx.Roller;
|
xiashuangxi/Algorithm_DataStructure_Notes | Ada | 348 | adb | procedure Linked_List is
type Node;
type Linked is access Node;
type Node is record
Value: Integer := 0;
Next: Linked;
end record;
procedure Delete_Node(Item: in out Linked) is
begin
Item.Value := Item.Next.Value;
Item.Next := Item.Next.Next;
end Delete_Node;
begin
end Linked_List; |
ohenley/ada-util | Ada | 12,594 | ads | -----------------------------------------------------------------------
-- util-serialize-io-xml -- XML Serialization Driver
-- Copyright (C) 2011, 2012, 2016, 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 Sax.Exceptions;
with Sax.Locators;
with Sax.Readers;
with Sax.Attributes;
with Unicode.CES;
with Input_Sources;
with Ada.Streams;
with Ada.Strings.Unbounded;
with Util.Streams.Buffered;
with Util.Streams.Texts;
package Util.Serialize.IO.XML is
Parse_Error : exception;
type Parser is new Serialize.IO.Parser with private;
-- Parse the stream using the JSON parser.
procedure Parse (Handler : in out Parser;
Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class;
Sink : in out Reader'Class);
-- Set the XHTML reader to ignore or not the white spaces.
-- When set to True, the ignorable white spaces will not be kept.
procedure Set_Ignore_White_Spaces (Reader : in out Parser;
Value : in Boolean);
-- Set the XHTML reader to ignore empty lines.
procedure Set_Ignore_Empty_Lines (Reader : in out Parser;
Value : in Boolean);
-- Get the current location (file and line) to report an error message.
function Get_Location (Handler : in Parser) return String;
type Xhtml_Reader is new Sax.Readers.Reader with private;
-- ------------------------------
-- XML Output Stream
-- ------------------------------
-- The <b>Output_Stream</b> provides methods for creating an XML output stream.
-- The stream object takes care of the XML escape rules.
type Output_Stream is limited new Util.Serialize.IO.Output_Stream with private;
-- Set the target output stream.
procedure Initialize (Stream : in out Output_Stream;
Output : in Util.Streams.Texts.Print_Stream_Access);
-- Flush the buffer (if any) to the sink.
overriding
procedure Flush (Stream : in out Output_Stream);
-- Close the sink.
overriding
procedure Close (Stream : in out Output_Stream);
-- Write the buffer array to the output stream.
overriding
procedure Write (Stream : in out Output_Stream;
Buffer : in Ada.Streams.Stream_Element_Array);
-- Write a raw character on the stream.
procedure Write (Stream : in out Output_Stream;
Char : in Character);
-- Write a wide character on the stream doing some conversion if necessary.
-- The default implementation translates the wide character to a UTF-8 sequence.
procedure Write_Wide (Stream : in out Output_Stream;
Item : in Wide_Wide_Character);
-- Write a raw string on the stream.
procedure Write (Stream : in out Output_Stream;
Item : in String);
-- Write a character on the response stream and escape that character as necessary.
procedure Write_Escape (Stream : in out Output_Stream'Class;
Char : in Wide_Wide_Character);
-- Write the value as a XML string. Special characters are escaped using the XML
-- escape rules.
procedure Write_String (Stream : in out Output_Stream;
Value : in String);
-- Write the value as a XML string. Special characters are escaped using the XML
-- escape rules.
procedure Write_Wide_String (Stream : in out Output_Stream;
Value : in Wide_Wide_String);
-- Write the value as a XML string. Special characters are escaped using the XML
-- escape rules.
procedure Write_String (Stream : in out Output_Stream;
Value : in Util.Beans.Objects.Object);
-- Start a new XML object.
procedure Start_Entity (Stream : in out Output_Stream;
Name : in String);
-- Terminates the current XML object.
procedure End_Entity (Stream : in out Output_Stream;
Name : in String);
-- Write the attribute name/value pair.
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Wide_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Integer);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean);
-- Write a XML name/value attribute.
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Write the attribute with a null value.
overriding
procedure Write_Null_Attribute (Stream : in out Output_Stream;
Name : in String);
-- Write the entity value.
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Wide_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Integer);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Ada.Calendar.Time);
overriding
procedure Write_Long_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Long_Long_Integer);
overriding
procedure Write_Enum_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String);
-- Write a XML name/value entity (see Write_Attribute).
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Write an entity with a null value.
overriding
procedure Write_Null_Entity (Stream : in out Output_Stream;
Name : in String);
-- Starts a XML array.
overriding
procedure Start_Array (Stream : in out Output_Stream;
Name : in String);
-- Terminates a XML array.
overriding
procedure End_Array (Stream : in out Output_Stream;
Name : in String);
-- Return the location where the exception was raised.
function Get_Location (Except : Sax.Exceptions.Sax_Parse_Exception'Class)
return String;
private
overriding
procedure Warning (Handler : in out Xhtml_Reader;
Except : in Sax.Exceptions.Sax_Parse_Exception'Class);
overriding
procedure Error (Handler : in out Xhtml_Reader;
Except : in Sax.Exceptions.Sax_Parse_Exception'Class);
overriding
procedure Fatal_Error (Handler : in out Xhtml_Reader;
Except : in Sax.Exceptions.Sax_Parse_Exception'Class);
overriding
procedure Set_Document_Locator (Handler : in out Xhtml_Reader;
Loc : in out Sax.Locators.Locator);
overriding
procedure Start_Document (Handler : in out Xhtml_Reader);
overriding
procedure End_Document (Handler : in out Xhtml_Reader);
overriding
procedure Start_Prefix_Mapping (Handler : in out Xhtml_Reader;
Prefix : in Unicode.CES.Byte_Sequence;
URI : in Unicode.CES.Byte_Sequence);
overriding
procedure End_Prefix_Mapping (Handler : in out Xhtml_Reader;
Prefix : in Unicode.CES.Byte_Sequence);
overriding
procedure Start_Element (Handler : in out Xhtml_Reader;
Namespace_URI : in Unicode.CES.Byte_Sequence := "";
Local_Name : in Unicode.CES.Byte_Sequence := "";
Qname : in Unicode.CES.Byte_Sequence := "";
Atts : in Sax.Attributes.Attributes'Class);
overriding
procedure End_Element (Handler : in out Xhtml_Reader;
Namespace_URI : in Unicode.CES.Byte_Sequence := "";
Local_Name : in Unicode.CES.Byte_Sequence := "";
Qname : in Unicode.CES.Byte_Sequence := "");
overriding
procedure Characters (Handler : in out Xhtml_Reader;
Ch : in Unicode.CES.Byte_Sequence);
overriding
procedure Ignorable_Whitespace (Handler : in out Xhtml_Reader;
Ch : in Unicode.CES.Byte_Sequence);
overriding
procedure Processing_Instruction (Handler : in out Xhtml_Reader;
Target : in Unicode.CES.Byte_Sequence;
Data : in Unicode.CES.Byte_Sequence);
overriding
procedure Skipped_Entity (Handler : in out Xhtml_Reader;
Name : in Unicode.CES.Byte_Sequence);
overriding
procedure Start_Cdata (Handler : in out Xhtml_Reader);
overriding
procedure End_Cdata (Handler : in out Xhtml_Reader);
overriding
function Resolve_Entity (Handler : Xhtml_Reader;
Public_Id : Unicode.CES.Byte_Sequence;
System_Id : Unicode.CES.Byte_Sequence)
return Input_Sources.Input_Source_Access;
overriding
procedure Start_DTD (Handler : in out Xhtml_Reader;
Name : Unicode.CES.Byte_Sequence;
Public_Id : Unicode.CES.Byte_Sequence := "";
System_Id : Unicode.CES.Byte_Sequence := "");
procedure Collect_Text (Handler : in out Xhtml_Reader;
Content : Unicode.CES.Byte_Sequence);
type Xhtml_Reader is new Sax.Readers.Reader with record
Stack_Pos : Natural := 0;
Handler : access Parser'Class;
Text : Ada.Strings.Unbounded.Unbounded_String;
-- Whether white spaces can be ignored.
Ignore_White_Spaces : Boolean := True;
-- Whether empty lines should be ignored (when white spaces are kept).
Ignore_Empty_Lines : Boolean := True;
Sink : access Reader'Class;
end record;
type Parser is new Util.Serialize.IO.Parser with record
-- The SAX locator to find the current file and line number.
Locator : Sax.Locators.Locator;
Has_Pending_Char : Boolean := False;
Pending_Char : Character;
-- Whether white spaces can be ignored.
Ignore_White_Spaces : Boolean := True;
-- Whether empty lines should be ignored (when white spaces are kept).
Ignore_Empty_Lines : Boolean := True;
end record;
type Output_Stream is limited new Util.Serialize.IO.Output_Stream with record
Close_Start : Boolean := False;
Stream : Util.Streams.Texts.Print_Stream_Access;
end record;
end Util.Serialize.IO.XML;
|
jrcarter/Ada_GUI | Ada | 8,361 | ads | -- Ada_GUI implementation based on Gnoga. Adapted 2022
-- Implementation hierarchy rooted at Ada_GUI.Gnoga in recognition
-- Clients should never with packages in the Ada_GUI.Gnoga hierarchy
-- Original Gnoga headers have been left on the implemetation packages for reference
--
------------------------------------------------------------------------------
-- --
-- GNOGA - The GNU Omnificent GUI for Ada --
-- --
-- G N O G A --
-- --
-- S p e c --
-- --
-- --
-- Copyright (C) 2014 David Botton --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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/>. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- For more information please go to http://www.gnoga.com --
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Containers.Indefinite_Vectors;
with Ada.Exceptions;
with Ada.Strings.Hash;
with Ada.Strings.Unbounded;
with Ada.Task_Identification;
package Ada_GUI.Gnoga is
Version : constant String := "1.0";
HTTP_Server_Name : constant String := "gnoga/" & Version;
function Escape_Quotes (S : String) return String;
-- Escape quotes for JavaScript.
function Unescape_Quotes (S : String) return String;
-- Unescape a string quoted for JavaScript
function Escape_Inner_Quotes (S : in String) return String;
-- Escape quotes for HTML attributes in Javascript.
Substitution_Character : constant Character := '?';
-- Character replacement if UTF-8 character is not existant in Latin-1
function URL_Encode (S : String; Encoding : String := "") return String;
function URL_Decode (S : String; Encoding : String := "") return String;
-- Encode and decode form URL
-- Supported encodings are ISO-8859-1 (default)
-- and UTF-8 (typically from Input_Encoding function)
function Left_Trim (S : String) return String;
function Right_Trim (S : String) return String;
-- Remove extra spaces and tabs
function Left_Trim_Slashes (S : String) return String;
function Right_Trim_Slashes (S : String) return String;
-- Remove extra spaces, tabs and '/'s
procedure String_Replace
(Source : in out Ada.Strings.Unbounded.Unbounded_String;
Pattern : in String;
Replacement : in String);
-- Replace all instances of Pattern with Replacement in Source
procedure Write_To_Console (Message : in String);
-- Output message to console
procedure Log_To_File (File_Name : in String;
Flush_Auto : in Boolean := False);
-- Redirect logging to File_Name instead of console with flushing if specified
procedure Log (Message : in String);
-- Output message to log
procedure Log (Occurrence : in Ada.Exceptions.Exception_Occurrence);
-- Output exception occurence to log
procedure Flush_Log;
-- Manual flush log file
procedure Activate_Exception_Handler (Id : Ada.Task_Identification.Task_Id);
-- Activate exception log for the designated task
-- From Types:
package Data_Arrays is
new Ada.Containers.Indefinite_Vectors (Positive, String);
subtype Data_Array_Type is Data_Arrays.Vector;
package Data_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (String,
String,
Ada.Strings.Hash,
Equivalent_Keys => "=");
subtype Data_Map_Type is Data_Maps.Map;
package Maps_of_Data_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (String,
Data_Maps.Map,
Ada.Strings.Hash,
Equivalent_Keys => "=",
"=" => Data_Maps."=");
subtype Map_of_Data_Maps_Type is Maps_of_Data_Maps.Map;
subtype Web_ID is Ada.Strings.Unbounded.Unbounded_String;
type ID_Enumeration is (No_ID, DOM_ID, Script, Gnoga_ID);
subtype Connection_ID is Integer;
No_Connection : constant Connection_ID := -1;
subtype Unique_ID is Integer;
No_Unique_ID : constant Unique_ID := -1;
type Connection_Data_Type is tagged limited null record;
type Connection_Data_Access is access all Connection_Data_Type;
type Pointer_to_Connection_Data_Class is
access all Connection_Data_Type'Class;
type Frational_Range_Type is delta 0.001 range 0.0 .. 1.0;
for Frational_Range_Type'Small use 0.001;
subtype Alpha_Type is Frational_Range_Type;
type Color_Type is range 0 .. 255;
type RGBA_Type is
record
Red : Color_Type := 0;
Green : Color_Type := 0;
Blue : Color_Type := 0;
Alpha : Alpha_Type := 1.0;
end record;
function To_String (RGBA : RGBA_Type) return String;
-- Returns an rgba(r,g,b,a) representation of RGBA
function To_Hex (RGBA : RGBA_Type) return String;
-- Returns a 0xRRGGBB representation of RGBA
function To_RGBA (Value : String) return RGBA_Type;
-- Will convert rgb(r,g,b) and rgba(r,g,b,a), or
-- Hex color (include Hex with Alpha) to RGBA_Type
type Pixel_Type is
record
Red : Color_Type := 0;
Green : Color_Type := 0;
Blue : Color_Type := 0;
Alpha : Color_Type := 0;
end record;
function To_RGBA (Value : in Pixel_Type) return RGBA_Type;
function To_Pixel (Value : in RGBA_Type) return Pixel_Type;
type Pixel_Data_Type is
array (Positive range <>, Positive range <>) of Pixel_Type;
type Pixel_Data_Access is access Pixel_Data_Type;
type Point_Type is
record
X, Y : Integer;
end record;
type Point_Array_Type is
array (Positive range <>) of Point_Type;
type Rectangle_Type is
record
X, Y, Width, Height : Integer;
end record;
type Size_Type is
record
Width, Height : Integer;
end record;
end Ada_GUI.Gnoga;
|
micahwelf/FLTK-Ada | Ada | 1,597 | adb |
with
Interfaces.C,
System;
use type
System.Address;
package body FLTK.Images.Pixmaps.GIF is
function new_fl_gif_image
(F : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_gif_image, "new_fl_gif_image");
pragma Inline (new_fl_gif_image);
procedure free_fl_gif_image
(P : in System.Address);
pragma Import (C, free_fl_gif_image, "free_fl_gif_image");
pragma Inline (free_fl_gif_image);
overriding procedure Finalize
(This : in out GIF_Image) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in GIF_Image'Class
then
free_fl_gif_image (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Pixmap (This));
end Finalize;
package body Forge is
function Create
(Filename : in String)
return GIF_Image is
begin
return This : GIF_Image do
This.Void_Ptr := new_fl_gif_image
(Interfaces.C.To_C (Filename));
case fl_image_fail (This.Void_Ptr) is
when 1 =>
raise No_Image_Error;
when 2 =>
raise File_Access_Error;
when 3 =>
raise Format_Error;
when others =>
null;
end case;
end return;
end Create;
end Forge;
end FLTK.Images.Pixmaps.GIF;
|
jorgediazjr/dials-dev20191018 | Ada | 289 | adb | -- Syntax Highlighting test file for Ada
-- Some Comments about this file
pragma Name (Parameter_List);
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, world!");
Ada.Text_IO.Put_Line("Unclosed string);
end Hello;
My_Number := 1;
_Ilegal_Identifier := 'a';
|
BrickBot/Bound-T-H8-300 | Ada | 2,778 | ads | -- Flow.Origins.For_Flow (decl)
--
-- Resolving dynamic control flow by means of value-origin analysis.
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- This software is provided by the copyright holders and contributors "as is" and
-- any express or implied warranties, including, but not limited to, the implied
-- warranties of merchantability and fitness for a particular purpose are
-- disclaimed. In no event shall the copyright owner or contributors be liable for
-- any direct, indirect, incidental, special, exemplary, or consequential damages
-- (including, but not limited to, procurement of substitute goods or services;
-- loss of use, data, or profits; or business interruption) however caused and
-- on any theory of liability, whether in contract, strict liability, or tort
-- (including negligence or otherwise) arising in any way out of the use of this
-- software, even if advised of the possibility of such damage.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.2 $
-- $Date: 2015/10/24 19:36:49 $
--
-- $Log: flow-origins-for_flow.ads,v $
-- Revision 1.2 2015/10/24 19:36:49 niklas
-- Moved to free licence.
--
-- Revision 1.1 2013/12/08 22:05:57 niklas
-- BT-CH-0259: Storing value-origin analysis results in execution bounds.
--
package Flow.Origins.For_Flow is
procedure Resolve_Boundable_Edges (Map : in Map_Ref);
--
-- Tries to resolve any unresolved boundable edges (dynamic jumps)
-- in the subprogram by translating the cell-value origins at
-- the source step of the edge into a transfer function that
-- shows which cells have values provided on entry to the
-- subprogram, for example return addresses for dynamic jumps
-- that actually return from the present subprogram.
--
-- We analyse only dynamic jumps and ignore dynamic calls.
end Flow.Origins.For_Flow;
|
gitter-badger/libAnne | Ada | 1,638 | ads | generic
type Value_Type is private;
package Containers.Stacks with Preelaborate is
--@description Provides a simple Stack, or FILO container
--@version 1.0.0
----------
-- Node --
----------
type Node is private;
type Node_Access is access all Node;
-----------
-- Stack --
-----------
type Stack is new Container with private;
--Represents a Stack, a FILO container
overriding function Is_Empty(Self : in Stack) return Boolean with Inline;
--Is the Stack currently empty?
procedure Push(Self : in out Stack; Value : in Value_Type);
--Push the value onto the stack
function Pop(Self : in out Stack) return Value_Type;
--Pop the value off the stack
function Peek(Self : in Stack) return Value_Type;
--Peek at the value on the stack
function Peek(Self : in Stack; Index : in Positive) return Value_Type with Pre => Index <= Self.Length;
--Peek at the value at the specified location on the stack
overriding procedure Clear(Self : in out Stack);
--Clear the stack of all values
overriding function Length(Self : in Stack) return Natural;
--Length of the stack, the amount of values in it
overriding function Size(Self : in Stack) return Natural;
--The total size of the stack's memory use
-----------
-- Array --
-----------
type Value_Array is array(Positive range <>) of Value_Type;
procedure Push(Self : in out Stack; Values : in Value_Array);
--Push the values onto the stack
private
type Node is record
Value : Value_Type;
Next : Node_Access;
end record;
type Stack is new Container with record
Length : Natural := 0;
Top : Node_Access;
end record;
end Containers.Stacks;
|
optikos/oasis | Ada | 3,682 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Modular_Types is
function Create
(Mod_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Modulus : not null Program.Elements.Expressions.Expression_Access)
return Modular_Type is
begin
return Result : Modular_Type :=
(Mod_Token => Mod_Token, Modulus => Modulus, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Modulus : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Modular_Type is
begin
return Result : Implicit_Modular_Type :=
(Modulus => Modulus, Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Modulus
(Self : Base_Modular_Type)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Modulus;
end Modulus;
overriding function Mod_Token
(Self : Modular_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Mod_Token;
end Mod_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Modular_Type)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Modular_Type)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Modular_Type)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : aliased in out Base_Modular_Type'Class) is
begin
Set_Enclosing_Element (Self.Modulus, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Modular_Type_Element
(Self : Base_Modular_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Modular_Type_Element;
overriding function Is_Type_Definition_Element
(Self : Base_Modular_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Type_Definition_Element;
overriding function Is_Definition_Element
(Self : Base_Modular_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition_Element;
overriding procedure Visit
(Self : not null access Base_Modular_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Modular_Type (Self);
end Visit;
overriding function To_Modular_Type_Text
(Self : aliased in out Modular_Type)
return Program.Elements.Modular_Types.Modular_Type_Text_Access is
begin
return Self'Unchecked_Access;
end To_Modular_Type_Text;
overriding function To_Modular_Type_Text
(Self : aliased in out Implicit_Modular_Type)
return Program.Elements.Modular_Types.Modular_Type_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Modular_Type_Text;
end Program.Nodes.Modular_Types;
|
jrcarter/Ada_GUI | Ada | 2,532 | ads | -- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Parsers.Multiline_Source.Text_IO Luebeck --
-- Interface Winter, 2004 --
-- --
-- Last revision : 09:24 09 Apr 2010 --
-- --
-- This library 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 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- This package provides an implementation of code sources based on
-- the standard text I/O package.
--
with Ada.Text_IO; use Ada.Text_IO;
package Parsers.Multiline_Source.Text_IO is
--
-- Source -- The source contained by a file
--
type Source (File : access File_Type) is
new Multiline_Source.Source with private;
--
-- Get_Line -- Overrides Parsers.Multiline_Source...
--
procedure Get_Line (Code : in out Source);
private
type Source (File : access File_Type) is
new Multiline_Source.Source with null record;
end Parsers.Multiline_Source.Text_IO;
|
apple-oss-distributions/old_ncurses | Ada | 3,485 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.IntField --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer <[email protected]> 1996
-- Version Control:
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Terminal_Interface.Curses.Forms.Field_Types.IntField is
pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.IntField);
type Integer_Field is new Field_Type with
record
Precision : Natural;
Lower_Limit : Integer;
Upper_Limit : Integer;
end record;
procedure Set_Field_Type (Fld : in Field;
Typ : in Integer_Field);
pragma Inline (Set_Field_Type);
end Terminal_Interface.Curses.Forms.Field_Types.IntField;
|
zhmu/ananas | Ada | 288 | ads | with Ada.Containers.Doubly_Linked_Lists;
package Prot9_Pkg2 is
type Prot_type is limited private;
private
package My_Lists is new Ada.Containers.Doubly_Linked_Lists (Integer);
protected type Prot_type is
private
L : My_Lists.List;
end Prot_type;
end Prot9_Pkg2;
|
AdaCore/gpr | Ada | 24,016 | adb | --
-- Copyright (C) 2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
with System;
with Ada.Characters.Conversions;
with Gpr_Parser_Support.File_Readers; use Gpr_Parser_Support.File_Readers;
with Gpr_Parser_Support.Diagnostics; use Gpr_Parser_Support.Diagnostics;
with Gpr_Parser.Lexer_State_Machine; use Gpr_Parser.Lexer_State_Machine;
with Gpr_Parser.Common; use Gpr_Parser.Common;
with Gpr_Parser_Support.Text; use Gpr_Parser_Support.Text;
with Gpr_Parser_Support.Slocs; use Gpr_Parser_Support.Slocs;
with Gpr_Parser_Support.Token_Data_Handlers;
use Gpr_Parser_Support.Token_Data_Handlers;
with Gpr_Parser.Public_Converters; use Gpr_Parser.Public_Converters;
with Gpr_Parser.Implementation; use Gpr_Parser.Implementation;
with Gpr_Parser.Analysis;
package body Gpr_Parser.Basic_Ada_Parser is
package GPS renames Gpr_Parser_Support;
--------------------------
-- Parse_Context_Clause --
--------------------------
procedure Parse_Context_Clauses
(Filename : String;
Context : Gpr_Parser.Analysis.Analysis_Context'Class;
Charset : String := "UTF-8";
Log_Error : access procedure (Message : String);
With_Clause_CB : access procedure (Unit_Name : String;
Is_Limited : Boolean) := null;
Unit_Name_CB : access procedure (Unit_Name : String;
Separate_From : String;
Lib_Item_Type : Library_Item_Type;
Generic_Unit : Boolean) := null;
No_Body_CB : access procedure := null)
is
Contents : Decoded_File_Contents;
Read_BOM : Boolean := Charset'Length = 0;
State : Lexer_State;
Internal_Ctx : Internal_Context := Unwrap_Context (Context);
Has_Error : Boolean := False;
subtype Specific_Identifier is Text_Type;
Procedure_Token : aliased Specific_Identifier := "procedure";
Function_Token : aliased Specific_Identifier := "function";
Generic_Token : aliased Specific_Identifier := "generic";
Separate_Token : aliased Specific_Identifier := "separate";
No_Body_Token : aliased Specific_Identifier := "no_body";
Body_Token : aliased Specific_Identifier := "body";
Access_Token : aliased Specific_Identifier := "access";
Protected_Token : aliased Specific_Identifier := "protected";
Task_Token : aliased Specific_Identifier := "task";
type Specific_Identifier_Access is access all Specific_Identifier;
type Specific_Identifier_Access_Array is
array (Positive range <>) of Specific_Identifier_Access;
type Token_Kind_Array is array (Positive range <>) of Token_Kind;
procedure Log_Error_Internal (Message : String);
function Skip_Until
(Kinds : Token_Kind_Array;
T : out Lexed_Token;
Identifiers : Specific_Identifier_Access_Array := (2 .. 1 => <>);
Expected : Boolean := True)
return Boolean;
-- Skip tokens until one of the specified token is encountered. Because
-- identifiers token regroup several specific tokens, like separate,
-- generic, etc, we may want to skip until specific identifiers. Last
-- token read is stored in T. Identifiers is the list of specific
-- identifier. It only has effect if one of the specified tokens kind in
-- Kinds is Gpr_Identifier. If Expected is True, then if the last token
-- read is an identifier, then it must match with one of the specified
-- identifiers. Otherwise, the last identifier token read must NOT match
-- with all the specified identifiers. If all tokens have been read
-- without finding one of the expected tokens, then False is returned.
function Parse_Library_Item_And_Subunit_Pre_Cond
return Boolean;
-- Pre condition function for Parse_Library_Item_And_Subunit. Ensure
-- that the current token is valid as a first library item or subunit
-- token.
procedure Parse_Library_Item_And_Subunit with
Pre => Parse_Library_Item_And_Subunit_Pre_Cond;
-- Parse the library item unit name, or the subunit and the parent unit
-- name. Call Unit_Name_CB if it is not null.
function Parse_Static_Name (T : in out Lexed_Token) return Natural with
Pre => Last_Token (State).Kind = Gpr_Identifier;
-- Return the last token text of the static name which begins at the
-- current identifier token.
procedure Parse_With_Clause with
Pre =>
Last_Token (State).Kind = Gpr_With
or else Last_Token (State).Kind = Gpr_Limited;
-- Parse "with" clause, and calls With_Clause_CB if the callback is
-- not null.
------------------------
-- Log_Error_Internal --
------------------------
procedure Log_Error_Internal (Message : String) is
begin
Has_Error := True;
if Log_Error /= null then
Log_Error (Message);
end if;
end Log_Error_Internal;
------------------------------------
-- Parse_Library_Item_And_Subunit --
------------------------------------
procedure Parse_Library_Item_And_Subunit is
T : Lexed_Token := Last_Token (State);
Separate_From_First : Natural := 0;
Separate_From_Last : Natural := 0;
Generic_Unit : Boolean := False;
Lib_Item_Type : Library_Item_Type;
procedure Skip_Generic with
Pre =>
T.Kind = Gpr_Identifier
and then To_Lower (Contents.Buffer (T.Text_First .. T.Text_Last)) =
Generic_Token;
-- Skip tokens related to the generic part of a unit
procedure Parse_Separate with
Pre =>
T.Kind = Gpr_Identifier
and then To_Lower (Contents.Buffer (T.Text_First .. T.Text_Last)) =
Separate_Token;
-- Set Separate_From_First and Separate_From_Last with indexes of the
-- separate argument.
function Parse_Unit_Pre_Cond
return Boolean;
-- Pre-condition function for Parse_Unit. Ensure that the current
-- token is either "package", "function" or "procedure".
procedure Parse_Unit with
Pre => Parse_Unit_Pre_Cond;
-- Parse the mandatory part of the library item which contains the
-- compilation unit name. Calls the library item callback if it is
-- not null.
procedure Parse_Separate is
begin
if not Skip_Until ((1 => Gpr_Par_Open), T) then
Log_Error_Internal
("no opening parenthesis after the 'separate' keyword");
return;
end if;
if not Skip_Until ((1 => Gpr_Identifier), T) then
Log_Error_Internal
("no identifier after the 'separate' keyword");
return;
end if;
Separate_From_First := T.Text_First;
Separate_From_Last := Parse_Static_Name (T);
if not Skip_Until
((Gpr_Identifier, Gpr_Package), T,
(Function_Token'Access, Procedure_Token'Access,
Task_Token'Access, Protected_Token'Access))
then
Log_Error_Internal
("missing the subunit kind (package / function / procedure)");
return;
end if;
end Parse_Separate;
----------------
-- Parse_Unit --
----------------
procedure Parse_Unit is
begin
-- At this step, current token is either "function", "procedure",
-- "package", "protected" or "task". Skip token until the next
-- identifier is different from body, as it contains the unit
-- name.
if not Skip_Until
((1 => Gpr_Identifier), T, (1 => Body_Token'Access),
Expected => False)
then
Log_Error_Internal
("missing the unit or subunit identifier");
return;
end if;
declare
Unit_First : Positive := T.Text_First;
Unit_Last : Positive := Parse_Static_Name (T);
begin
declare
use Gpr_Parser_Support.Text;
U_Name : String :=
Gpr_Parser_Support.Text.Encode
(Contents.Buffer (Unit_First .. Unit_Last),
Charset);
Sep_Name : constant String :=
(if Separate_From_First /= 0
then Encode (Contents.Buffer
(Separate_From_First .. Separate_From_Last),
Charset)
else "");
begin
Unit_Name_CB
(Unit_Name => U_Name,
Separate_From => Sep_Name,
Lib_Item_Type => Lib_Item_Type,
Generic_Unit => Generic_Unit);
end;
end;
end Parse_Unit;
-------------------------
-- Parse_Unit_Pre_Cond --
-------------------------
function Parse_Unit_Pre_Cond return Boolean is
T : Lexed_Token := Last_Token (State);
Valid_Token : Boolean := False;
begin
if T.Kind = Gpr_Package then
Valid_Token := True;
elsif T.Kind = Gpr_Identifier then
declare
Token_Text : Text_Type :=
To_Lower
(Contents.Buffer
(T.Text_First .. T.Text_Last));
begin
if Token_Text = Procedure_Token
or else Token_Text = Function_Token
then
Valid_Token := True;
end if;
end;
end if;
return Valid_Token;
end Parse_Unit_Pre_Cond;
------------------
-- Skip_Generic --
------------------
procedure Skip_Generic is
begin
-- With and access content should be skipped, but as it may
-- contain the "function", "procedure" or "package" keyword,
-- we can not skip these keywords.
loop
if not Skip_Until
((Gpr_Identifier, Gpr_With, Gpr_Package), T,
(Function_Token'Access, Procedure_Token'Access,
Access_Token'Access))
then
Log_Error_Internal
("failed to skip the generic formal parameters part");
exit;
end if;
if T.Kind = Gpr_Package then
-- "Package" not preceded by a with token is the start of
-- the mandatory library item part.
exit;
elsif T.Kind = Gpr_Identifier then
declare
T_Content : Text_Type :=
To_Lower
(Contents.Buffer (T.Text_First .. T.Text_Last));
begin
exit when T_Content = Function_Token
or else T_Content = Procedure_Token;
-- If we reach this part of the code, then the current
-- token shall be an access token.
if not Skip_Until ((1 => Gpr_Semicolon), T) then
Log_Error_Internal
("in formal generic parameters, missing ':' after " &
"variable declaration");
exit;
end if;
end;
elsif T.Kind = Gpr_With then
if not Skip_Until ((1 => Gpr_Semicolon), T) then
Log_Error_Internal
("missing ';' after a formal generic parameter " &
"declaration");
exit;
end if;
end if;
end loop;
end Skip_Generic;
begin
-- Optional generic part
if T.Kind = Gpr_Identifier
and then To_Lower (Contents.Buffer (T.Text_First .. T.Text_Last)) =
Generic_Token
then
Skip_Generic;
Generic_Unit := True;
-- Optional separate part
elsif T.Kind = Gpr_Identifier
and then To_Lower (Contents.Buffer (T.Text_First .. T.Text_Last)) =
Separate_Token
then
Parse_Separate;
end if;
-- Mandatory library item part begins with: - function / procedure -
-- package body - [private] package In subunit case, so if separate
-- is present, the tokens we can expect are: - procedure / function
-- - package body - task body - protected body.
if T.Kind = Gpr_Package then
Lib_Item_Type := Is_Package;
else
Lib_Item_Type := Is_Subprogram;
end if;
Parse_Unit;
end Parse_Library_Item_And_Subunit;
---------------------------------------------
-- Parse_Library_Item_And_Subunit_Pre_Cond --
---------------------------------------------
function Parse_Library_Item_And_Subunit_Pre_Cond
return Boolean
is
T : Lexed_Token := Last_Token (State);
Valid_Token : Boolean := False;
begin
if T.Kind = Gpr_Package then
Valid_Token := True;
elsif T.Kind = Gpr_Identifier then
declare
Token_Text : Text_Type :=
To_Lower (Contents.Buffer
(T.Text_First .. T.Text_Last));
begin
if Token_Text = Procedure_Token
or else Token_Text = Function_Token
or else Token_Text = Separate_Token
or else Token_Text = Generic_Token
then
Valid_Token := True;
end if;
end;
end if;
return Valid_Token;
end Parse_Library_Item_And_Subunit_Pre_Cond;
-----------------------
-- Parse_Static_Name --
-----------------------
function Parse_Static_Name (T : in out Lexed_Token) return Natural is
Static_Name_Expected_Token : Token_Kind := Gpr_Dot;
Last : Natural := T.Text_Last;
begin
while Has_Next (State) loop
Next_Token (State, T);
if T.Kind /= Static_Name_Expected_Token then
return Last;
else
Last := T.Text_Last;
if Static_Name_Expected_Token = Gpr_Dot then
Static_Name_Expected_Token := Gpr_Identifier;
else
Static_Name_Expected_Token := Gpr_Dot;
end if;
end if;
end loop;
return Last;
end Parse_Static_Name;
-----------------------
-- Parse_With_Clause --
-----------------------
procedure Parse_With_Clause
is
T : Lexed_Token := Last_Token (State);
Withed_Unit_First : Positive;
Withed_Unit_Last : Positive;
Lim : Boolean := False;
begin
if T.Kind = Gpr_Limited then
Lim := True;
if not Skip_Until ((1 => Gpr_With), T) then
Log_Error_Internal
("expecting a with token after 'limited'");
return;
end if;
end if;
-- "With" token location is returned as source location, even for
-- several units in the same with clause.
loop
if not Skip_Until ((1 => Gpr_Identifier), T) then
Log_Error_Internal
("with clause is missing a unit identifier");
return;
end if;
-- Current token shall be an identifier
Withed_Unit_First := T.Text_First;
Withed_Unit_Last := Parse_Static_Name (T);
if With_Clause_CB /= null then
declare
Name : String :=
Gpr_Parser_Support.Text.Encode
(Contents.Buffer (Withed_Unit_First .. Withed_Unit_Last),
Charset);
begin
With_Clause_CB (Name, Lim);
end;
end if;
if T.Kind /= Gpr_Semicolon and then T.Kind /= Gpr_Comma then
if not Skip_Until ((Gpr_Semicolon, Gpr_Comma), T) then
Log_Error_Internal
("missing ';' or ',' in a with clause");
return;
end if;
end if;
if T.Kind = Gpr_Semicolon then
-- No more unit within this "with" clause
exit;
end if;
end loop;
end Parse_With_Clause;
----------------
-- Skip_Until --
----------------
function Skip_Until
(Kinds : Token_Kind_Array;
T : out Lexed_Token;
Identifiers : Specific_Identifier_Access_Array := (2 .. 1 => <>);
Expected : Boolean := True)
return Boolean is
begin
while Has_Next (State) loop
Next_Token (State, T);
for I in Kinds'Range loop
if Kinds (I) = T.Kind then
-- In case of identifiers, two scenarios: - If a list of
-- identifiers has been specified,
-- then current identifier is checked.
-- - If the list of expected identifiers is empty,
-- then only check for the identifier token kind.
if T.Kind = Gpr_Identifier and then Identifiers'Length > 0
then
declare
Text : Text_Type :=
To_Lower
(Contents.Buffer (T.Text_First .. T.Text_Last));
begin
-- First case: we expect to find a specific identifier
if Expected then
for J in Identifiers'Range loop
if Text = Identifiers (J).all then
return True;
end if;
end loop;
else
-- Second case: We expect to find all identifier
-- except the identifiers specified.
declare
Found : Boolean := False;
begin
-- Check all the unwanted identifiers
for J in Identifiers'Range loop
if Text = Identifiers (J).all then
Found := True;
end if;
end loop;
-- Current token does not match with one of the
-- unwanted identifiers.
if not Found then
return True;
end if;
end;
end if;
end;
else
-- Current token is one of the expected tokens
return True;
end if;
end if;
end loop;
end loop;
-- Token was not found and Lexer is empty
return False;
end Skip_Until;
begin
-- Fill the Contents buffer with specified file content. If a file
-- reader is provided, it is used instead to read source file.
declare
use Ada.Characters.Conversions;
Diagnostics : GPS.Diagnostics.Diagnostics_Vectors.Vector;
begin
if Internal_Ctx.File_Reader /= null then
Read
(Internal_Ctx.File_Reader.all, Filename, Charset, Read_BOM,
Contents, Diagnostics);
else
Direct_Read (Filename, Charset, Read_BOM, Contents, Diagnostics);
end if;
if not Diagnostics.Is_Empty then
for D of Diagnostics loop
Log_Error_Internal (To_String (To_Text (D.Message)));
end loop;
return;
end if;
end;
-- Initialize the lexer
Initialize (State, Contents.Buffer, Contents.First, Contents.Last);
while Has_Next (State) and then not Has_Error loop
-- Parse 0, 1 or more withed clauses, and one library item or
-- subunit. The parser may detect compilation units for invalid
-- files, as tokens are skipped until a wanted token is found.
declare
T : Lexed_Token;
begin
if not Skip_Until
((Gpr_With, Gpr_Identifier, Gpr_Package, Gpr_Limited,
Gpr_Pragma),
T,
(Procedure_Token'Access, Function_Token'Access,
Separate_Token'Access, Generic_Token'Access))
then
Log_Error_Internal ("Unexpected preamble");
exit;
end if;
if T.Kind = Gpr_With or else T.Kind = Gpr_Limited then
Parse_With_Clause;
elsif T.Kind = Gpr_Identifier or else T.Kind = Gpr_Package then
Parse_Library_Item_And_Subunit;
-- We do not need to parse after the library item and subunit
-- parsing, because "with" clauses precede them. Moreover, as
-- we do not support multi-unit here, only one compilation unit
-- can exist per file.
exit;
elsif T.Kind = Gpr_Pragma then
-- Two cases:
-- - pragma No_Body: The source can only contain this pragma
-- and possibly comments. The parsing is ended.
-- - pragma XXX: No effect on parsing. Note that the parsing is
-- correct only if the file is valid. If the file has a "with
-- XXX; pragma No_Body", then the file will be categorized has
-- No_Body, despite it is an invalid file.
if not Skip_Until ((1 => Gpr_Identifier), T) then
Log_Error_Internal
("pragma should be followed by an identifier");
exit;
else
declare
Text : Text_Type :=
To_Lower
(Contents.Buffer
(T.Text_First .. T.Text_Last));
begin
if Text = No_Body_Token then
if No_Body_CB /= null then
No_Body_CB.all;
end if;
exit;
end if;
end;
end if;
end if;
end;
end loop;
Gpr_Parser_Support.Text.Free (Contents.Buffer);
end Parse_Context_Clauses;
end Gpr_Parser.Basic_Ada_Parser;
|
Tim-Tom/project-euler | Ada | 58 | ads | package Problem_03 is
procedure Solve;
end Problem_03;
|
leo-brewin/adm-bssn-numerical | Ada | 483 | ads | package BSSNBase.Time_Derivs is
procedure set_finite_diff_factors;
procedure set_time_derivatives_intr
(params : SlaveParams);
procedure set_time_derivatives_bndry_ns
(params : SlaveParams);
procedure set_time_derivatives_bndry_ew
(params : SlaveParams);
procedure set_time_derivatives_bndry_fb
(params : SlaveParams);
procedure set_time_derivatives
(point : GridPoint);
procedure set_time_derivatives;
end BSSNBase.Time_Derivs;
|
tum-ei-rcs/StratoX | Ada | 9,767 | adb | -- Institution: Technische Universitaet Muenchen
-- Department: Real-Time Computer Systems (RCS)
-- Project: StratoX
-- Authors: Martin Becker ([email protected])
with System;
with Interfaces;
with HAL; use HAL;
with HIL.SPI; use HIL.SPI;
package body FM25v0x with SPARK_Mode
-- with Refined_State => (State => Is_Init)
is
----------------------------------------
-- DEVICE IDENTIFIER
----------------------------------------
HIL_DEVICE : constant HIL.SPI.Device_ID_Type := HIL.SPI.FRAM;
MANUFACTURER : constant HAL.Byte_Array (1 .. 7) := (7 => 16#C2#, others => 16#7F#);
FAMILY : constant HAL.UInt3 := 1;
-- @summary compare density with expected
-- expected density depends on the generic parameter.
-- so far we only know two versions. if your's is
-- not included, you might try to add it here.
function Check_Density (density : HAL.UInt5) return Boolean is
begin
case MEMSIZE_BYTES is
when 2**14 => return density >= 1;
when 2**15 => return density >= 2; -- we allow bigger FRAMs w/o failing
when others => return False;
end case;
end Check_Density;
----------------------------------------
-- PROTOCOL (FIXME: move to separate package, but cannot make child because of genericity.
----------------------------------------
type Opcode_Type is mod 2**8;
-- Opcodes
OP_WREN : constant Opcode_Type := 2#0000_0110#; -- write enable
OP_WRDI : constant Opcode_Type := 2#0000_0100#; -- write disable
OP_RDSR : constant Opcode_Type := 2#0000_0101#; -- read status reg
OP_WRSR : constant Opcode_Type := 2#0000_0001#; -- write status reg
OP_READ : constant Opcode_Type := 2#0000_0011#; -- read mem
OP_FSTRD : constant Opcode_Type := 2#0000_1011#; -- fast read mem
OP_WRITE : constant Opcode_Type := 2#0000_0010#; -- write mem
OP_SLEEP : constant Opcode_Type := 2#1011_1001#; -- enter sleep
OP_RDID : constant Opcode_Type := 2#1001_1111#; -- read dev id
pragma Unreferenced (OP_WRDI, OP_WRSR, OP_FSTRD, OP_SLEEP);
type Soft_Lock_Field is
(
BP_LOCK_NONE,
BP_LOCK_UPPER_FOURTH, -- protects 6000h to 7FFF
BP_LOCK_UPPER_HALF,
BP_LOCK_ALL)
with Size => 2;
for Soft_Lock_Field use
(BP_LOCK_NONE => 0,
BP_LOCK_UPPER_FOURTH => 1,
BP_LOCK_UPPER_HALF => 2,
BP_LOCK_ALL => 3);
-- status register (record with union)
type Status_Register
(As_Bytearray : Boolean := False)
is record
case As_Bytearray is
when False =>
Reserved_0_0 : HAL.Bit := 0;
Write_Enabled : Boolean := False; -- write enable <=> soft lock disable
Soft_Lock : Soft_Lock_Field := BP_LOCK_NONE;
Reserved_4_6 : HAL.UInt3 := 0;
Enable_HW_Lock : Boolean := True; -- by default, activate hardware write protect pin
when True =>
Data_Array : HAL.Byte_Array (1 .. 1) := (others => 0);
end case;
end record
with Unchecked_Union, Size => 8,
Bit_Order => System.Low_Order_First;
for Status_Register use record
Reserved_0_0 at 0 range 0 .. 0;
Write_Enabled at 0 range 1 .. 1;
Soft_Lock at 0 range 2 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
Enable_HW_Lock at 0 range 7 .. 7;
Data_Array at 0 range 0 .. 7;
end record;
-- message with device information
type Msg_Device_ID
(As_Bytearray : Boolean := False)
is record
case As_Bytearray is
when False =>
Manufacturer_ID : HAL.Byte_Array (1 .. 7) := (others => 0);
Family : HAL.UInt3 := 0;
Density : HAL.UInt5 := 0;
Sub : HAL.UInt2 := 0;
Rev : HAL.UInt3 := 0;
Reserved_0_2 : HAL.UInt3 := 0;
when True =>
Data_Array : HAL.Byte_Array (1 .. 9) := (others => 0);
end case;
end record
with Unchecked_Union, Size => 72,
Bit_Order => System.Low_Order_First;
-- we get correct endianness, but bytes are switched
-- (bytes are big endian, bits little)
for Msg_Device_ID use record
Reserved_0_2 at 8 range 0 .. 2; -- LSB
Rev at 8 range 3 .. 5;
Sub at 8 range 6 .. 7;
Density at 7 range 0 .. 4;
Family at 7 range 5 .. 7;
Manufacturer_ID at 0 range 0 .. 55;
Data_Array at 0 range 0 .. 71;
end record;
----------------------------------------
-- IMPLEMENTATION
----------------------------------------
-- Unchecked Union is not modeled by GNATprove, yet. So we have to give some hints,
-- that this is all completely initializing the other record components.
procedure Read_Status_Register (Status : out Status_Register) is
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Reserved_0_0"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Reserved_4_6"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Enable_HW_Lock"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Write_Enabled"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Soft_Lock"" will be used", "part of Union");
cmd : constant HIL.SPI.Data_Type (1 .. 1) := (1 => Interfaces.Unsigned_8 (OP_RDSR));
response : HIL.SPI.Data_Type (1 .. Status.Data_Array'Length);
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Reserved_0_0"" will be used", "part of Union");
begin
HIL.SPI.transfer (Device => HIL_DEVICE, Data_TX => cmd, Data_RX => response);
for k in response'Range loop
Status.Data_Array (k) := response (k);
end loop;
pragma Annotate (GNATprove, False_Positive, "input value of ""Status.Data_Array"" might be used", "part of Union");
end Read_Status_Register;
pragma Unreferenced (Read_Status_Register);
procedure Write_Enable is
cmd : constant HIL.SPI.Data_Type (1 .. 1) := (1 => Interfaces.Unsigned_8 (OP_WREN));
begin
HIL.SPI.write (Device => HIL_DEVICE, data => cmd);
end Write_Enable;
procedure Init is
begin
if not Is_Init then
delay until FM25v0x_STARTUP_TIME_MS;
Is_Init := True;
-- nothing to do here
end if;
end Init;
-- Unchecked Union is not modeled by GNATprove, yet. So we have to give some hints,
-- that this is all completely initializing the other record components.
procedure Read_Device_ID (Dev_ID : out Msg_Device_ID) is
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Manufacturer_ID"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Family"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Density"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Sub"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Rev"" will be used", "part of Union");
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Reserved_0_2"" will be used", "part of Union");
cmd : constant HIL.SPI.Data_Type (1 .. 1) := (1 => Interfaces.Unsigned_8 (OP_RDID));
response : HIL.SPI.Data_Type ( 1 .. Dev_ID.Data_Array'Length );
begin
HIL.SPI.transfer (Device => HIL_DEVICE, Data_TX => cmd, Data_RX => response);
for k in response'Range loop
Dev_ID.Data_Array (k) := response (k);
end loop;
pragma Annotate (GNATprove, False_Positive, "input value of ""Dev_ID.Data_Array"" might be used", "part of Union");
end Read_Device_ID;
procedure Self_Check (Status : out Boolean) is
deviceid : Msg_Device_ID;
use type Interfaces.Unsigned_8;
-- sreg : Status_Register;
begin
Read_Device_ID (deviceid);
Status := True;
-- check expected identifiers
Status := Status and (MANUFACTURER = deviceid.Manufacturer_ID);
Status := Status and (FAMILY = deviceid.Family);
Status := Status and Check_Density (deviceid.Density);
-- after boot the decice is supposed to be locked
-- Read_Status_Register (Status => sreg);
-- Status := Status and not sreg.Write_Enabled;
end Self_Check;
procedure Read_Byte (addr : Address; byte : out HIL.Byte) is
cmd : HIL.SPI.Data_Type (1 .. 3);
rsp : HIL.SPI.Data_Type (1 .. 1);
begin
cmd (1) := Interfaces.Unsigned_8 (OP_READ);
pragma Annotate (GNATprove, False_Positive, """cmd"" might not be initialized", "done right here");
cmd (2) := HIL.Byte (addr / 2**8); -- high
cmd (3) := HIL.Byte (addr mod 2**8); -- low
HIL.SPI.transfer (Device => HIL_DEVICE, Data_TX => cmd, Data_RX => rsp);
byte := rsp (1);
end Read_Byte;
procedure Write_Byte (addr : Address; byte : HIL.Byte) is
cmd : HIL.SPI.Data_Type (1 .. 4);
begin
Write_Enable; -- this *really* is required every time.
-- the write_enable is cleared after each
-- transaction
cmd (1) := Interfaces.Unsigned_8 (OP_WRITE);
pragma Annotate (GNATprove, False_Positive, """cmd"" might not be initialized", "done right here");
cmd (2) := HIL.Byte (addr / 2**8); -- high
cmd (3) := HIL.Byte (addr mod 2**8); -- low
cmd (4) := byte;
HIL.SPI.write (Device => HIL_DEVICE, Data => cmd);
end Write_Byte;
end FM25v0x;
|
HackInvent/Ada_Drivers_Library | Ada | 46,375 | ads | -- This spec has been automatically generated from STM32H7x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.Flash is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype ACR_LATENCY_Field is STM32_SVD.UInt3;
subtype ACR_WRHIGHFREQ_Field is STM32_SVD.UInt2;
-- Access control register
type ACR_Register is record
-- Read latency
LATENCY : ACR_LATENCY_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Flash signal delay
WRHIGHFREQ : ACR_WRHIGHFREQ_Field := 16#0#;
-- unspecified
Reserved_6_31 : STM32_SVD.UInt26 := 16#18#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ACR_Register use record
LATENCY at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
WRHIGHFREQ at 0 range 4 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
subtype CR1_PSIZE1_Field is STM32_SVD.UInt2;
subtype CR1_SNB1_Field is STM32_SVD.UInt3;
-- FLASH control register for bank 1
type CR1_Register is record
-- Bank 1 configuration lock bit
LOCK1 : Boolean := False;
-- Bank 1 program enable bit
PG1 : Boolean := False;
-- Bank 1 sector erase request
SER1 : Boolean := False;
-- Bank 1 erase request
BER1 : Boolean := False;
-- Bank 1 program size
PSIZE1 : CR1_PSIZE1_Field := 16#0#;
-- Bank 1 write forcing control bit
FW1 : Boolean := False;
-- Bank 1 bank or sector erase start control bit
START1 : Boolean := False;
-- Bank 1 sector erase selection number
SNB1 : CR1_SNB1_Field := 16#0#;
-- unspecified
Reserved_11_14 : STM32_SVD.UInt4 := 16#0#;
-- Bank 1 CRC control bit
CRC_EN : Boolean := False;
-- Bank 1 end-of-program interrupt control bit
EOPIE1 : Boolean := False;
-- Bank 1 write protection error interrupt enable bit
WRPERRIE1 : Boolean := False;
-- Bank 1 programming sequence error interrupt enable bit
PGSERRIE1 : Boolean := False;
-- Bank 1 strobe error interrupt enable bit
STRBERRIE1 : Boolean := False;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Bank 1 inconsistency error interrupt enable bit
INCERRIE1 : Boolean := False;
-- Bank 1 write/erase error interrupt enable bit
OPERRIE1 : Boolean := False;
-- Bank 1 read protection error interrupt enable bit
RDPERRIE1 : Boolean := False;
-- Bank 1 secure error interrupt enable bit
RDSERRIE1 : Boolean := False;
-- Bank 1 ECC single correction error interrupt enable bit
SNECCERRIE1 : Boolean := False;
-- Bank 1 ECC double detection error interrupt enable bit
DBECCERRIE1 : Boolean := False;
-- Bank 1 end of CRC calculation interrupt enable bit
CRCENDIE1 : Boolean := False;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
LOCK1 at 0 range 0 .. 0;
PG1 at 0 range 1 .. 1;
SER1 at 0 range 2 .. 2;
BER1 at 0 range 3 .. 3;
PSIZE1 at 0 range 4 .. 5;
FW1 at 0 range 6 .. 6;
START1 at 0 range 7 .. 7;
SNB1 at 0 range 8 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
CRC_EN at 0 range 15 .. 15;
EOPIE1 at 0 range 16 .. 16;
WRPERRIE1 at 0 range 17 .. 17;
PGSERRIE1 at 0 range 18 .. 18;
STRBERRIE1 at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
INCERRIE1 at 0 range 21 .. 21;
OPERRIE1 at 0 range 22 .. 22;
RDPERRIE1 at 0 range 23 .. 23;
RDSERRIE1 at 0 range 24 .. 24;
SNECCERRIE1 at 0 range 25 .. 25;
DBECCERRIE1 at 0 range 26 .. 26;
CRCENDIE1 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- FLASH status register for bank 1
type SR1_Register is record
-- Bank 1 ongoing program flag
BSY1 : Boolean := False;
-- Bank 1 write buffer not empty flag
WBNE1 : Boolean := False;
-- Bank 1 wait queue flag
QW1 : Boolean := False;
-- Bank 1 CRC busy flag
CRC_BUSY1 : Boolean := False;
-- unspecified
Reserved_4_15 : STM32_SVD.UInt12 := 16#0#;
-- Bank 1 end-of-program flag
EOP1 : Boolean := False;
-- Bank 1 write protection error flag
WRPERR1 : Boolean := False;
-- Bank 1 programming sequence error flag
PGSERR1 : Boolean := False;
-- Bank 1 strobe error flag
STRBERR1 : Boolean := False;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Bank 1 inconsistency error flag
INCERR1 : Boolean := False;
-- Bank 1 write/erase error flag
OPERR1 : Boolean := False;
-- Bank 1 read protection error flag
RDPERR1 : Boolean := False;
-- Bank 1 secure error flag
RDSERR1 : Boolean := False;
-- Bank 1 single correction error flag
SNECCERR11 : Boolean := False;
-- Bank 1 ECC double detection error flag
DBECCERR1 : Boolean := False;
-- Bank 1 CRC-complete flag
CRCEND1 : Boolean := False;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SR1_Register use record
BSY1 at 0 range 0 .. 0;
WBNE1 at 0 range 1 .. 1;
QW1 at 0 range 2 .. 2;
CRC_BUSY1 at 0 range 3 .. 3;
Reserved_4_15 at 0 range 4 .. 15;
EOP1 at 0 range 16 .. 16;
WRPERR1 at 0 range 17 .. 17;
PGSERR1 at 0 range 18 .. 18;
STRBERR1 at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
INCERR1 at 0 range 21 .. 21;
OPERR1 at 0 range 22 .. 22;
RDPERR1 at 0 range 23 .. 23;
RDSERR1 at 0 range 24 .. 24;
SNECCERR11 at 0 range 25 .. 25;
DBECCERR1 at 0 range 26 .. 26;
CRCEND1 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- FLASH clear control register for bank 1
type CCR1_Register is record
-- unspecified
Reserved_0_15 : STM32_SVD.UInt16 := 16#0#;
-- Bank 1 EOP1 flag clear bit
CLR_EOP1 : Boolean := False;
-- Bank 1 WRPERR1 flag clear bit
CLR_WRPERR1 : Boolean := False;
-- Bank 1 PGSERR1 flag clear bi
CLR_PGSERR1 : Boolean := False;
-- Bank 1 STRBERR1 flag clear bit
CLR_STRBERR1 : Boolean := False;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Bank 1 INCERR1 flag clear bit
CLR_INCERR1 : Boolean := False;
-- Bank 1 OPERR1 flag clear bit
CLR_OPERR1 : Boolean := False;
-- Bank 1 RDPERR1 flag clear bit
CLR_RDPERR1 : Boolean := False;
-- Bank 1 RDSERR1 flag clear bit
CLR_RDSERR1 : Boolean := False;
-- Bank 1 SNECCERR1 flag clear bit
CLR_SNECCERR1 : Boolean := False;
-- Bank 1 DBECCERR1 flag clear bit
CLR_DBECCERR1 : Boolean := False;
-- Bank 1 CRCEND1 flag clear bit
CLR_CRCEND1 : Boolean := False;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CCR1_Register use record
Reserved_0_15 at 0 range 0 .. 15;
CLR_EOP1 at 0 range 16 .. 16;
CLR_WRPERR1 at 0 range 17 .. 17;
CLR_PGSERR1 at 0 range 18 .. 18;
CLR_STRBERR1 at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
CLR_INCERR1 at 0 range 21 .. 21;
CLR_OPERR1 at 0 range 22 .. 22;
CLR_RDPERR1 at 0 range 23 .. 23;
CLR_RDSERR1 at 0 range 24 .. 24;
CLR_SNECCERR1 at 0 range 25 .. 25;
CLR_DBECCERR1 at 0 range 26 .. 26;
CLR_CRCEND1 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- FLASH option control register
type OPTCR_Register is record
-- FLASH_OPTCR lock option configuration bit
OPTLOCK : Boolean := False;
-- Option byte start change option configuration bit
OPTSTART : Boolean := False;
-- unspecified
Reserved_2_3 : STM32_SVD.UInt2 := 16#0#;
-- Flash mass erase enable bit
MER : Boolean := False;
-- unspecified
Reserved_5_29 : STM32_SVD.UInt25 := 16#0#;
-- Option byte change error interrupt enable bit
OPTCHANGEERRIE : Boolean := False;
-- Bank swapping configuration bit
SWAP_BANK : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR_Register use record
OPTLOCK at 0 range 0 .. 0;
OPTSTART at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MER at 0 range 4 .. 4;
Reserved_5_29 at 0 range 5 .. 29;
OPTCHANGEERRIE at 0 range 30 .. 30;
SWAP_BANK at 0 range 31 .. 31;
end record;
subtype OPTSR_CUR_BOR_LEV_Field is STM32_SVD.UInt2;
subtype OPTSR_CUR_RDP_Field is STM32_SVD.Byte;
subtype OPTSR_CUR_ST_RAM_SIZE_Field is STM32_SVD.UInt2;
-- FLASH option status register
type OPTSR_CUR_Register is record
-- Option byte change ongoing flag
OPT_BUSY : Boolean := False;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Brownout level option status bit
BOR_LEV : OPTSR_CUR_BOR_LEV_Field := 16#0#;
-- IWDG1 control option status bit
IWDG1_HW : Boolean := False;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- D1 DStop entry reset option status bit
nRST_STOP_D1 : Boolean := False;
-- D1 DStandby entry reset option status bit
nRST_STBY_D1 : Boolean := False;
-- Readout protection level option status byte
RDP : OPTSR_CUR_RDP_Field := 16#0#;
-- unspecified
Reserved_16_16 : STM32_SVD.Bit := 16#0#;
-- IWDG Stop mode freeze option status bit
FZ_IWDG_STOP : Boolean := False;
-- IWDG Standby mode freeze option status bit
FZ_IWDG_SDBY : Boolean := False;
-- DTCM RAM size option status
ST_RAM_SIZE : OPTSR_CUR_ST_RAM_SIZE_Field := 16#0#;
-- Security enable option status bit
SECURITY : Boolean := False;
-- unspecified
Reserved_22_25 : STM32_SVD.UInt4 := 16#0#;
-- User option bit 1
RSS1 : Boolean := False;
-- unspecified
Reserved_27_27 : STM32_SVD.Bit := 16#0#;
-- Device personalization status bit
PERSO_OK : Boolean := False;
-- I/O high-speed at low-voltage status bit (PRODUCT_BELOW_25V)
IO_HSLV : Boolean := False;
-- Option byte change error flag
OPTCHANGEERR : Boolean := False;
-- Bank swapping option status bit
SWAP_BANK_OPT : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPTSR_CUR_Register use record
OPT_BUSY at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
BOR_LEV at 0 range 2 .. 3;
IWDG1_HW at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
nRST_STOP_D1 at 0 range 6 .. 6;
nRST_STBY_D1 at 0 range 7 .. 7;
RDP at 0 range 8 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
FZ_IWDG_STOP at 0 range 17 .. 17;
FZ_IWDG_SDBY at 0 range 18 .. 18;
ST_RAM_SIZE at 0 range 19 .. 20;
SECURITY at 0 range 21 .. 21;
Reserved_22_25 at 0 range 22 .. 25;
RSS1 at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
PERSO_OK at 0 range 28 .. 28;
IO_HSLV at 0 range 29 .. 29;
OPTCHANGEERR at 0 range 30 .. 30;
SWAP_BANK_OPT at 0 range 31 .. 31;
end record;
subtype OPTSR_PRG_BOR_LEV_Field is STM32_SVD.UInt2;
subtype OPTSR_PRG_RDP_Field is STM32_SVD.Byte;
subtype OPTSR_PRG_ST_RAM_SIZE_Field is STM32_SVD.UInt2;
-- OPTSR_PRG_RSS array
type OPTSR_PRG_RSS_Field_Array is array (1 .. 2) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for OPTSR_PRG_RSS
type OPTSR_PRG_RSS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- RSS as a value
Val : STM32_SVD.UInt2;
when True =>
-- RSS as an array
Arr : OPTSR_PRG_RSS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for OPTSR_PRG_RSS_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- FLASH option status register
type OPTSR_PRG_Register is record
-- unspecified
Reserved_0_1 : STM32_SVD.UInt2 := 16#0#;
-- BOR reset level option configuration bits
BOR_LEV : OPTSR_PRG_BOR_LEV_Field := 16#0#;
-- IWDG1 option configuration bit
IWDG1_HW : Boolean := False;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Option byte erase after D1 DStop option configuration bit
nRST_STOP_D1 : Boolean := False;
-- Option byte erase after D1 DStandby option configuration bit
nRST_STBY_D1 : Boolean := False;
-- Readout protection level option configuration byte
RDP : OPTSR_PRG_RDP_Field := 16#0#;
-- unspecified
Reserved_16_16 : STM32_SVD.Bit := 16#0#;
-- IWDG Stop mode freeze option configuration bit
FZ_IWDG_STOP : Boolean := False;
-- IWDG Standby mode freeze option configuration bit
FZ_IWDG_SDBY : Boolean := False;
-- DTCM size select option configuration bits
ST_RAM_SIZE : OPTSR_PRG_ST_RAM_SIZE_Field := 16#0#;
-- Security option configuration bit
SECURITY : Boolean := False;
-- unspecified
Reserved_22_25 : STM32_SVD.UInt4 := 16#0#;
-- User option configuration bit 1
RSS : OPTSR_PRG_RSS_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_28_28 : STM32_SVD.Bit := 16#0#;
-- I/O high-speed at low-voltage (PRODUCT_BELOW_25V)
IO_HSLV : Boolean := False;
-- unspecified
Reserved_30_30 : STM32_SVD.Bit := 16#0#;
-- Bank swapping option configuration bit
SWAP_BANK_OPT : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPTSR_PRG_Register use record
Reserved_0_1 at 0 range 0 .. 1;
BOR_LEV at 0 range 2 .. 3;
IWDG1_HW at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
nRST_STOP_D1 at 0 range 6 .. 6;
nRST_STBY_D1 at 0 range 7 .. 7;
RDP at 0 range 8 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
FZ_IWDG_STOP at 0 range 17 .. 17;
FZ_IWDG_SDBY at 0 range 18 .. 18;
ST_RAM_SIZE at 0 range 19 .. 20;
SECURITY at 0 range 21 .. 21;
Reserved_22_25 at 0 range 22 .. 25;
RSS at 0 range 26 .. 27;
Reserved_28_28 at 0 range 28 .. 28;
IO_HSLV at 0 range 29 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
SWAP_BANK_OPT at 0 range 31 .. 31;
end record;
-- FLASH option clear control register
type OPTCCR_Register is record
-- unspecified
Reserved_0_29 : STM32_SVD.UInt30 := 16#0#;
-- Write-only. OPTCHANGEERR reset bit
CLR_OPTCHANGEERR : Boolean := False;
-- unspecified
Reserved_31_31 : STM32_SVD.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCCR_Register use record
Reserved_0_29 at 0 range 0 .. 29;
CLR_OPTCHANGEERR at 0 range 30 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
subtype PRAR_CUR1_PROT_AREA_START1_Field is STM32_SVD.UInt12;
subtype PRAR_CUR1_PROT_AREA_END1_Field is STM32_SVD.UInt12;
-- FLASH protection address for bank 1
type PRAR_CUR1_Register is record
-- Read-only. Bank 1 lowest PCROP protected address
PROT_AREA_START1 : PRAR_CUR1_PROT_AREA_START1_Field;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4;
-- Read-only. Bank 1 highest PCROP protected address
PROT_AREA_END1 : PRAR_CUR1_PROT_AREA_END1_Field;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3;
-- Read-only. Bank 1 PCROP protected erase enable option status bit
DMEP1 : Boolean;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PRAR_CUR1_Register use record
PROT_AREA_START1 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
PROT_AREA_END1 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMEP1 at 0 range 31 .. 31;
end record;
subtype PRAR_PRG1_PROT_AREA_START1_Field is STM32_SVD.UInt12;
subtype PRAR_PRG1_PROT_AREA_END1_Field is STM32_SVD.UInt12;
-- FLASH protection address for bank 1
type PRAR_PRG1_Register is record
-- Bank 1 lowest PCROP protected address configuration
PROT_AREA_START1 : PRAR_PRG1_PROT_AREA_START1_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Bank 1 highest PCROP protected address configuration
PROT_AREA_END1 : PRAR_PRG1_PROT_AREA_END1_Field := 16#0#;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3 := 16#0#;
-- Bank 1 PCROP protected erase enable option configuration bit
DMEP1 : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PRAR_PRG1_Register use record
PROT_AREA_START1 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
PROT_AREA_END1 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMEP1 at 0 range 31 .. 31;
end record;
subtype PRAR_PRG2_PROT_AREA_START2_Field is STM32_SVD.UInt12;
subtype PRAR_PRG2_PROT_AREA_END2_Field is STM32_SVD.UInt12;
-- FLASH protection address for bank 2
type PRAR_PRG2_Register is record
-- Bank 2 lowest PCROP protected address configuration
PROT_AREA_START2 : PRAR_PRG2_PROT_AREA_START2_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Bank 2 highest PCROP protected address configuration
PROT_AREA_END2 : PRAR_PRG2_PROT_AREA_END2_Field := 16#0#;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3 := 16#0#;
-- Bank 2 PCROP protected erase enable option configuration bit
DMEP2 : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PRAR_PRG2_Register use record
PROT_AREA_START2 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
PROT_AREA_END2 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMEP2 at 0 range 31 .. 31;
end record;
subtype SCAR_CUR1_SEC_AREA_START1_Field is STM32_SVD.UInt12;
subtype SCAR_CUR1_SEC_AREA_END1_Field is STM32_SVD.UInt12;
-- FLASH secure address for bank 1
type SCAR_CUR1_Register is record
-- Bank 1 lowest secure protected address
SEC_AREA_START1 : SCAR_CUR1_SEC_AREA_START1_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Bank 1 highest secure protected address
SEC_AREA_END1 : SCAR_CUR1_SEC_AREA_END1_Field := 16#0#;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3 := 16#0#;
-- Bank 1 secure protected erase enable option status bit
DMES1 : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SCAR_CUR1_Register use record
SEC_AREA_START1 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
SEC_AREA_END1 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMES1 at 0 range 31 .. 31;
end record;
subtype SCAR_PRG1_SEC_AREA_START1_Field is STM32_SVD.UInt12;
subtype SCAR_PRG1_SEC_AREA_END1_Field is STM32_SVD.UInt12;
-- FLASH secure address for bank 1
type SCAR_PRG1_Register is record
-- Bank 1 lowest secure protected address configuration
SEC_AREA_START1 : SCAR_PRG1_SEC_AREA_START1_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Bank 1 highest secure protected address configuration
SEC_AREA_END1 : SCAR_PRG1_SEC_AREA_END1_Field := 16#0#;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3 := 16#0#;
-- Bank 1 secure protected erase enable option configuration bit
DMES1 : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SCAR_PRG1_Register use record
SEC_AREA_START1 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
SEC_AREA_END1 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMES1 at 0 range 31 .. 31;
end record;
subtype WPSN_CUR1R_WRPSn1_Field is STM32_SVD.Byte;
-- FLASH write sector protection for bank 1
type WPSN_CUR1R_Register is record
-- Read-only. Bank 1 sector write protection option status byte
WRPSn1 : WPSN_CUR1R_WRPSn1_Field;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for WPSN_CUR1R_Register use record
WRPSn1 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype WPSN_PRG1R_WRPSn1_Field is STM32_SVD.Byte;
-- FLASH write sector protection for bank 1
type WPSN_PRG1R_Register is record
-- Bank 1 sector write protection configuration byte
WRPSn1 : WPSN_PRG1R_WRPSn1_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for WPSN_PRG1R_Register use record
WRPSn1 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- BOOT_CURR_BOOT_ADD array element
subtype BOOT_CURR_BOOT_ADD_Element is STM32_SVD.UInt16;
-- BOOT_CURR_BOOT_ADD array
type BOOT_CURR_BOOT_ADD_Field_Array is array (0 .. 1)
of BOOT_CURR_BOOT_ADD_Element
with Component_Size => 16, Size => 32;
-- FLASH register with boot address
type BOOT_CURR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BOOT_ADD as a value
Val : STM32_SVD.UInt32;
when True =>
-- BOOT_ADD as an array
Arr : BOOT_CURR_BOOT_ADD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BOOT_CURR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- BOOT_PRGR_BOOT_ADD array element
subtype BOOT_PRGR_BOOT_ADD_Element is STM32_SVD.UInt16;
-- BOOT_PRGR_BOOT_ADD array
type BOOT_PRGR_BOOT_ADD_Field_Array is array (0 .. 1)
of BOOT_PRGR_BOOT_ADD_Element
with Component_Size => 16, Size => 32;
-- FLASH register with boot address
type BOOT_PRGR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BOOT_ADD as a value
Val : STM32_SVD.UInt32;
when True =>
-- BOOT_ADD as an array
Arr : BOOT_PRGR_BOOT_ADD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BOOT_PRGR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
subtype CRCCR_CRC_SECT_Field is STM32_SVD.UInt3;
subtype CRCCR_CRC_BURST_Field is STM32_SVD.UInt2;
-- FLASH CRC control register for bank 1
type CRCCR_Register is record
-- Bank 1 CRC sector number
CRC_SECT : CRCCR_CRC_SECT_Field := 16#0#;
-- unspecified
Reserved_3_6 : STM32_SVD.UInt4 := 16#0#;
-- Bank 1 CRC select bit
ALL_BANK : Boolean := False;
-- Bank 1 CRC sector mode select bit
CRC_BY_SECT : Boolean := False;
-- Bank 1 CRC sector select bit
ADD_SECT : Boolean := False;
-- Bank 1 CRC sector list clear bit
CLEAN_SECT : Boolean := False;
-- unspecified
Reserved_11_15 : STM32_SVD.UInt5 := 16#0#;
-- Bank 1 CRC start bit
START_CRC : Boolean := False;
-- Bank 1 CRC clear bit
CLEAN_CRC : Boolean := False;
-- unspecified
Reserved_18_19 : STM32_SVD.UInt2 := 16#0#;
-- Bank 1 CRC burst size
CRC_BURST : CRCCR_CRC_BURST_Field := 16#0#;
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CRCCR_Register use record
CRC_SECT at 0 range 0 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
ALL_BANK at 0 range 7 .. 7;
CRC_BY_SECT at 0 range 8 .. 8;
ADD_SECT at 0 range 9 .. 9;
CLEAN_SECT at 0 range 10 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
START_CRC at 0 range 16 .. 16;
CLEAN_CRC at 0 range 17 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
CRC_BURST at 0 range 20 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
subtype ECC_FA1R_FAIL_ECC_ADDR1_Field is STM32_SVD.UInt15;
-- FLASH ECC fail address for bank 1
type ECC_FA1R_Register is record
-- Read-only. Bank 1 ECC error address
FAIL_ECC_ADDR1 : ECC_FA1R_FAIL_ECC_ADDR1_Field;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ECC_FA1R_Register use record
FAIL_ECC_ADDR1 at 0 range 0 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype CR2_PSIZE2_Field is STM32_SVD.UInt2;
subtype CR2_SNB2_Field is STM32_SVD.UInt3;
-- FLASH control register for bank 2
type CR2_Register is record
-- Bank 2 configuration lock bit
LOCK2 : Boolean := False;
-- Bank 2 program enable bit
PG2 : Boolean := False;
-- Bank 2 sector erase request
SER2 : Boolean := False;
-- Bank 2 erase request
BER2 : Boolean := False;
-- Bank 2 program size
PSIZE2 : CR2_PSIZE2_Field := 16#0#;
-- Bank 2 write forcing control bit
FW2 : Boolean := False;
-- Bank 2 bank or sector erase start control bit
START2 : Boolean := False;
-- Bank 2 sector erase selection number
SNB2 : CR2_SNB2_Field := 16#0#;
-- unspecified
Reserved_11_14 : STM32_SVD.UInt4 := 16#0#;
-- Bank 2 CRC control bit
CRC_EN : Boolean := False;
-- Bank 2 end-of-program interrupt control bit
EOPIE2 : Boolean := False;
-- Bank 2 write protection error interrupt enable bit
WRPERRIE2 : Boolean := False;
-- Bank 2 programming sequence error interrupt enable bit
PGSERRIE2 : Boolean := False;
-- Bank 2 strobe error interrupt enable bit
STRBERRIE2 : Boolean := False;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Bank 2 inconsistency error interrupt enable bit
INCERRIE2 : Boolean := False;
-- Bank 2 write/erase error interrupt enable bit
OPERRIE2 : Boolean := False;
-- Bank 2 read protection error interrupt enable bit
RDPERRIE2 : Boolean := False;
-- Bank 2 secure error interrupt enable bit
RDSERRIE2 : Boolean := False;
-- Bank 2 ECC single correction error interrupt enable bit
SNECCERRIE2 : Boolean := False;
-- Bank 2 ECC double detection error interrupt enable bit
DBECCERRIE2 : Boolean := False;
-- Bank 2 end of CRC calculation interrupt enable bit
CRCENDIE2 : Boolean := False;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
LOCK2 at 0 range 0 .. 0;
PG2 at 0 range 1 .. 1;
SER2 at 0 range 2 .. 2;
BER2 at 0 range 3 .. 3;
PSIZE2 at 0 range 4 .. 5;
FW2 at 0 range 6 .. 6;
START2 at 0 range 7 .. 7;
SNB2 at 0 range 8 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
CRC_EN at 0 range 15 .. 15;
EOPIE2 at 0 range 16 .. 16;
WRPERRIE2 at 0 range 17 .. 17;
PGSERRIE2 at 0 range 18 .. 18;
STRBERRIE2 at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
INCERRIE2 at 0 range 21 .. 21;
OPERRIE2 at 0 range 22 .. 22;
RDPERRIE2 at 0 range 23 .. 23;
RDSERRIE2 at 0 range 24 .. 24;
SNECCERRIE2 at 0 range 25 .. 25;
DBECCERRIE2 at 0 range 26 .. 26;
CRCENDIE2 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- FLASH status register for bank 2
type SR2_Register is record
-- Bank 2 ongoing program flag
BSY2 : Boolean := False;
-- Bank 2 write buffer not empty flag
WBNE2 : Boolean := False;
-- Bank 2 wait queue flag
QW2 : Boolean := False;
-- Bank 2 CRC busy flag
CRC_BUSY2 : Boolean := False;
-- unspecified
Reserved_4_15 : STM32_SVD.UInt12 := 16#0#;
-- Bank 2 end-of-program flag
EOP2 : Boolean := False;
-- Bank 2 write protection error flag
WRPERR2 : Boolean := False;
-- Bank 2 programming sequence error flag
PGSERR2 : Boolean := False;
-- Bank 2 strobe error flag
STRBERR2 : Boolean := False;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Bank 2 inconsistency error flag
INCERR2 : Boolean := False;
-- Bank 2 write/erase error flag
OPERR2 : Boolean := False;
-- Bank 2 read protection error flag
RDPERR2 : Boolean := False;
-- Bank 2 secure error flag
RDSERR2 : Boolean := False;
-- Bank 2 single correction error flag
SNECCERR2 : Boolean := False;
-- Bank 2 ECC double detection error flag
DBECCERR2 : Boolean := False;
-- Bank 2 CRC-complete flag
CRCEND2 : Boolean := False;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SR2_Register use record
BSY2 at 0 range 0 .. 0;
WBNE2 at 0 range 1 .. 1;
QW2 at 0 range 2 .. 2;
CRC_BUSY2 at 0 range 3 .. 3;
Reserved_4_15 at 0 range 4 .. 15;
EOP2 at 0 range 16 .. 16;
WRPERR2 at 0 range 17 .. 17;
PGSERR2 at 0 range 18 .. 18;
STRBERR2 at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
INCERR2 at 0 range 21 .. 21;
OPERR2 at 0 range 22 .. 22;
RDPERR2 at 0 range 23 .. 23;
RDSERR2 at 0 range 24 .. 24;
SNECCERR2 at 0 range 25 .. 25;
DBECCERR2 at 0 range 26 .. 26;
CRCEND2 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- FLASH clear control register for bank 2
type CCR2_Register is record
-- unspecified
Reserved_0_15 : STM32_SVD.UInt16 := 16#0#;
-- Bank 1 EOP1 flag clear bit
CLR_EOP2 : Boolean := False;
-- Bank 2 WRPERR1 flag clear bit
CLR_WRPERR2 : Boolean := False;
-- Bank 2 PGSERR1 flag clear bi
CLR_PGSERR2 : Boolean := False;
-- Bank 2 STRBERR1 flag clear bit
CLR_STRBERR2 : Boolean := False;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Bank 2 INCERR1 flag clear bit
CLR_INCERR2 : Boolean := False;
-- Bank 2 OPERR1 flag clear bit
CLR_OPERR2 : Boolean := False;
-- Bank 2 RDPERR1 flag clear bit
CLR_RDPERR2 : Boolean := False;
-- Bank 1 RDSERR1 flag clear bit
CLR_RDSERR1 : Boolean := False;
-- Bank 2 SNECCERR1 flag clear bit
CLR_SNECCERR2 : Boolean := False;
-- Bank 1 DBECCERR1 flag clear bit
CLR_DBECCERR1 : Boolean := False;
-- Bank 2 CRCEND1 flag clear bit
CLR_CRCEND2 : Boolean := False;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CCR2_Register use record
Reserved_0_15 at 0 range 0 .. 15;
CLR_EOP2 at 0 range 16 .. 16;
CLR_WRPERR2 at 0 range 17 .. 17;
CLR_PGSERR2 at 0 range 18 .. 18;
CLR_STRBERR2 at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
CLR_INCERR2 at 0 range 21 .. 21;
CLR_OPERR2 at 0 range 22 .. 22;
CLR_RDPERR2 at 0 range 23 .. 23;
CLR_RDSERR1 at 0 range 24 .. 24;
CLR_SNECCERR2 at 0 range 25 .. 25;
CLR_DBECCERR1 at 0 range 26 .. 26;
CLR_CRCEND2 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype PRAR_CUR2_PROT_AREA_START2_Field is STM32_SVD.UInt12;
subtype PRAR_CUR2_PROT_AREA_END2_Field is STM32_SVD.UInt12;
-- FLASH protection address for bank 1
type PRAR_CUR2_Register is record
-- Read-only. Bank 2 lowest PCROP protected address
PROT_AREA_START2 : PRAR_CUR2_PROT_AREA_START2_Field;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4;
-- Read-only. Bank 2 highest PCROP protected address
PROT_AREA_END2 : PRAR_CUR2_PROT_AREA_END2_Field;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3;
-- Read-only. Bank 2 PCROP protected erase enable option status bit
DMEP2 : Boolean;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PRAR_CUR2_Register use record
PROT_AREA_START2 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
PROT_AREA_END2 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMEP2 at 0 range 31 .. 31;
end record;
subtype SCAR_CUR2_SEC_AREA_START2_Field is STM32_SVD.UInt12;
subtype SCAR_CUR2_SEC_AREA_END2_Field is STM32_SVD.UInt12;
-- FLASH secure address for bank 2
type SCAR_CUR2_Register is record
-- Bank 2 lowest secure protected address
SEC_AREA_START2 : SCAR_CUR2_SEC_AREA_START2_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Bank 2 highest secure protected address
SEC_AREA_END2 : SCAR_CUR2_SEC_AREA_END2_Field := 16#0#;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3 := 16#0#;
-- Bank 2 secure protected erase enable option status bit
DMES2 : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SCAR_CUR2_Register use record
SEC_AREA_START2 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
SEC_AREA_END2 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMES2 at 0 range 31 .. 31;
end record;
subtype SCAR_PRG2_SEC_AREA_START2_Field is STM32_SVD.UInt12;
subtype SCAR_PRG2_SEC_AREA_END2_Field is STM32_SVD.UInt12;
-- FLASH secure address for bank 2
type SCAR_PRG2_Register is record
-- Bank 2 lowest secure protected address configuration
SEC_AREA_START2 : SCAR_PRG2_SEC_AREA_START2_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Bank 2 highest secure protected address configuration
SEC_AREA_END2 : SCAR_PRG2_SEC_AREA_END2_Field := 16#0#;
-- unspecified
Reserved_28_30 : STM32_SVD.UInt3 := 16#0#;
-- Bank 2 secure protected erase enable option configuration bit
DMES2 : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SCAR_PRG2_Register use record
SEC_AREA_START2 at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
SEC_AREA_END2 at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
DMES2 at 0 range 31 .. 31;
end record;
subtype WPSN_CUR2R_WRPSn2_Field is STM32_SVD.Byte;
-- FLASH write sector protection for bank 2
type WPSN_CUR2R_Register is record
-- Read-only. Bank 2 sector write protection option status byte
WRPSn2 : WPSN_CUR2R_WRPSn2_Field;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for WPSN_CUR2R_Register use record
WRPSn2 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype WPSN_PRG2R_WRPSn2_Field is STM32_SVD.Byte;
-- FLASH write sector protection for bank 2
type WPSN_PRG2R_Register is record
-- Bank 2 sector write protection configuration byte
WRPSn2 : WPSN_PRG2R_WRPSn2_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for WPSN_PRG2R_Register use record
WRPSn2 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype ECC_FA2R_FAIL_ECC_ADDR2_Field is STM32_SVD.UInt15;
-- FLASH ECC fail address for bank 2
type ECC_FA2R_Register is record
-- Read-only. Bank 2 ECC error address
FAIL_ECC_ADDR2 : ECC_FA2R_FAIL_ECC_ADDR2_Field;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ECC_FA2R_Register use record
FAIL_ECC_ADDR2 at 0 range 0 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type Flash_Disc is
(Val_1,
Val_2);
-- Flash
type Flash_Peripheral
(Discriminent : Flash_Disc := Val_1)
is record
-- Access control register
ACR : aliased ACR_Register;
-- FLASH key register for bank 1
KEYR1 : aliased STM32_SVD.UInt32;
-- FLASH option key register
OPTKEYR : aliased STM32_SVD.UInt32;
-- FLASH control register for bank 1
CR1 : aliased CR1_Register;
-- FLASH status register for bank 1
SR1 : aliased SR1_Register;
-- FLASH clear control register for bank 1
CCR1 : aliased CCR1_Register;
-- FLASH option control register
OPTCR : aliased OPTCR_Register;
-- FLASH option status register
OPTSR_CUR : aliased OPTSR_CUR_Register;
-- FLASH option status register
OPTSR_PRG : aliased OPTSR_PRG_Register;
-- FLASH option clear control register
OPTCCR : aliased OPTCCR_Register;
-- FLASH protection address for bank 1
PRAR_CUR1 : aliased PRAR_CUR1_Register;
-- FLASH secure address for bank 1
SCAR_CUR1 : aliased SCAR_CUR1_Register;
-- FLASH secure address for bank 1
SCAR_PRG1 : aliased SCAR_PRG1_Register;
-- FLASH write sector protection for bank 1
WPSN_CUR1R : aliased WPSN_CUR1R_Register;
-- FLASH write sector protection for bank 1
WPSN_PRG1R : aliased WPSN_PRG1R_Register;
-- FLASH register with boot address
BOOT_CURR : aliased BOOT_CURR_Register;
-- FLASH register with boot address
BOOT_PRGR : aliased BOOT_PRGR_Register;
-- FLASH CRC control register for bank 1
CRCCR1 : aliased CRCCR_Register;
-- FLASH CRC start address register for bank 1
CRCSADD1R : aliased STM32_SVD.UInt32;
-- FLASH CRC end address register for bank 1
CRCEADD1R : aliased STM32_SVD.UInt32;
-- FLASH CRC data register
CRCDATAR : aliased STM32_SVD.UInt32;
-- FLASH ECC fail address for bank 1
ECC_FA1R : aliased ECC_FA1R_Register;
-- Access control register
ACR_1 : aliased ACR_Register;
-- FLASH key register for bank 2
KEYR2 : aliased STM32_SVD.UInt32;
-- FLASH option key register
OPTKEYR_1 : aliased STM32_SVD.UInt32;
-- FLASH control register for bank 2
CR2 : aliased CR2_Register;
-- FLASH status register for bank 2
SR2 : aliased SR2_Register;
-- FLASH clear control register for bank 2
CCR2 : aliased CCR2_Register;
-- FLASH option control register
OPTCR_1 : aliased OPTCR_Register;
-- FLASH option status register
OPTSR_CUR_1 : aliased OPTSR_CUR_Register;
-- FLASH option status register
OPTSR_PRG_1 : aliased OPTSR_PRG_Register;
-- FLASH option clear control register
OPTCCR_1 : aliased OPTCCR_Register;
-- FLASH protection address for bank 1
PRAR_CUR2 : aliased PRAR_CUR2_Register;
-- FLASH secure address for bank 2
SCAR_CUR2 : aliased SCAR_CUR2_Register;
-- FLASH secure address for bank 2
SCAR_PRG2 : aliased SCAR_PRG2_Register;
-- FLASH write sector protection for bank 2
WPSN_CUR2R : aliased WPSN_CUR2R_Register;
-- FLASH write sector protection for bank 2
WPSN_PRG2R : aliased WPSN_PRG2R_Register;
-- FLASH CRC control register for bank 1
CRCCR2 : aliased CRCCR_Register;
-- FLASH CRC start address register for bank 2
CRCSADD2R : aliased STM32_SVD.UInt32;
-- FLASH CRC end address register for bank 2
CRCEADD2R : aliased STM32_SVD.UInt32;
-- FLASH ECC fail address for bank 2
ECC_FA2R : aliased ECC_FA2R_Register;
case Discriminent is
when Val_1 =>
-- FLASH protection address for bank 1
PRAR_PRG1 : aliased PRAR_PRG1_Register;
when Val_2 =>
-- FLASH protection address for bank 2
PRAR_PRG2 : aliased PRAR_PRG2_Register;
end case;
end record
with Unchecked_Union, Volatile;
for Flash_Peripheral use record
ACR at 16#0# range 0 .. 31;
KEYR1 at 16#4# range 0 .. 31;
OPTKEYR at 16#8# range 0 .. 31;
CR1 at 16#C# range 0 .. 31;
SR1 at 16#10# range 0 .. 31;
CCR1 at 16#14# range 0 .. 31;
OPTCR at 16#18# range 0 .. 31;
OPTSR_CUR at 16#1C# range 0 .. 31;
OPTSR_PRG at 16#20# range 0 .. 31;
OPTCCR at 16#24# range 0 .. 31;
PRAR_CUR1 at 16#28# range 0 .. 31;
SCAR_CUR1 at 16#30# range 0 .. 31;
SCAR_PRG1 at 16#34# range 0 .. 31;
WPSN_CUR1R at 16#38# range 0 .. 31;
WPSN_PRG1R at 16#3C# range 0 .. 31;
BOOT_CURR at 16#40# range 0 .. 31;
BOOT_PRGR at 16#44# range 0 .. 31;
CRCCR1 at 16#50# range 0 .. 31;
CRCSADD1R at 16#54# range 0 .. 31;
CRCEADD1R at 16#58# range 0 .. 31;
CRCDATAR at 16#5C# range 0 .. 31;
ECC_FA1R at 16#60# range 0 .. 31;
ACR_1 at 16#100# range 0 .. 31;
KEYR2 at 16#104# range 0 .. 31;
OPTKEYR_1 at 16#108# range 0 .. 31;
CR2 at 16#10C# range 0 .. 31;
SR2 at 16#110# range 0 .. 31;
CCR2 at 16#114# range 0 .. 31;
OPTCR_1 at 16#118# range 0 .. 31;
OPTSR_CUR_1 at 16#11C# range 0 .. 31;
OPTSR_PRG_1 at 16#120# range 0 .. 31;
OPTCCR_1 at 16#124# range 0 .. 31;
PRAR_CUR2 at 16#128# range 0 .. 31;
SCAR_CUR2 at 16#130# range 0 .. 31;
SCAR_PRG2 at 16#134# range 0 .. 31;
WPSN_CUR2R at 16#138# range 0 .. 31;
WPSN_PRG2R at 16#13C# range 0 .. 31;
CRCCR2 at 16#150# range 0 .. 31;
CRCSADD2R at 16#154# range 0 .. 31;
CRCEADD2R at 16#158# range 0 .. 31;
ECC_FA2R at 16#160# range 0 .. 31;
PRAR_PRG1 at 16#2C# range 0 .. 31;
PRAR_PRG2 at 16#2C# range 0 .. 31;
end record;
-- Flash
Flash_Periph : aliased Flash_Peripheral
with Import, Address => Flash_Base;
end STM32_SVD.Flash;
|
reznikmm/matreshka | Ada | 4,728 | 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.Form_Image_Frame_Elements;
package Matreshka.ODF_Form.Image_Frame_Elements is
type Form_Image_Frame_Element_Node is
new Matreshka.ODF_Form.Abstract_Form_Element_Node
and ODF.DOM.Form_Image_Frame_Elements.ODF_Form_Image_Frame
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Form_Image_Frame_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Form_Image_Frame_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Form_Image_Frame_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 Form_Image_Frame_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 Form_Image_Frame_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_Form.Image_Frame_Elements;
|
onox/orka | Ada | 1,038 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.AVX.Integers.Logical is
pragma Pure;
function Test_All_Zero (Elements, Mask : m256i) return Boolean
with Inline_Always;
function Test_All_Ones (Elements, Mask : m256i) return Boolean
with Inline_Always;
function Test_Mix_Ones_Zeros (Elements, Mask : m256i) return Boolean
with Inline_Always;
end Orka.SIMD.AVX.Integers.Logical;
|
HackInvent/Ada_Drivers_Library | Ada | 9,997 | ads | -- This spec has been automatically generated from STM32H7x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.OPAMP is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype OPAMP1_CSR_VP_SEL_Field is STM32_SVD.UInt2;
subtype OPAMP1_CSR_VM_SEL_Field is STM32_SVD.UInt2;
subtype OPAMP1_CSR_CALSEL_Field is STM32_SVD.UInt2;
subtype OPAMP1_CSR_PGA_GAIN_Field is STM32_SVD.UInt4;
-- OPAMP1 control/status register
type OPAMP1_CSR_Register is record
-- Operational amplifier Enable
OPAEN : Boolean := False;
-- Force internal reference on VP (reserved for test
FORCE_VP : Boolean := False;
-- Operational amplifier PGA mode
VP_SEL : OPAMP1_CSR_VP_SEL_Field := 16#0#;
-- unspecified
Reserved_4_4 : STM32_SVD.Bit := 16#0#;
-- Inverting input selection
VM_SEL : OPAMP1_CSR_VM_SEL_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Operational amplifier high-speed mode
OPAHSM : Boolean := False;
-- unspecified
Reserved_9_10 : STM32_SVD.UInt2 := 16#0#;
-- Calibration mode enabled
CALON : Boolean := False;
-- Calibration selection
CALSEL : OPAMP1_CSR_CALSEL_Field := 16#0#;
-- allows to switch from AOP offset trimmed values to AOP offset
PGA_GAIN : OPAMP1_CSR_PGA_GAIN_Field := 16#0#;
-- User trimming enable
USERTRIM : Boolean := False;
-- unspecified
Reserved_19_28 : STM32_SVD.UInt10 := 16#0#;
-- OPAMP calibration reference voltage output control (reserved for
-- test)
TSTREF : Boolean := False;
-- Operational amplifier calibration output
CALOUT : Boolean := False;
-- unspecified
Reserved_31_31 : STM32_SVD.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPAMP1_CSR_Register use record
OPAEN at 0 range 0 .. 0;
FORCE_VP at 0 range 1 .. 1;
VP_SEL at 0 range 2 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
VM_SEL at 0 range 5 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
OPAHSM at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
CALON at 0 range 11 .. 11;
CALSEL at 0 range 12 .. 13;
PGA_GAIN at 0 range 14 .. 17;
USERTRIM at 0 range 18 .. 18;
Reserved_19_28 at 0 range 19 .. 28;
TSTREF at 0 range 29 .. 29;
CALOUT at 0 range 30 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
subtype OPAMP1_OTR_TRIMOFFSETN_Field is STM32_SVD.UInt5;
subtype OPAMP1_OTR_TRIMOFFSETP_Field is STM32_SVD.UInt5;
-- OPAMP1 offset trimming register in normal mode
type OPAMP1_OTR_Register is record
-- Trim for NMOS differential pairs
TRIMOFFSETN : OPAMP1_OTR_TRIMOFFSETN_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- Trim for PMOS differential pairs
TRIMOFFSETP : OPAMP1_OTR_TRIMOFFSETP_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPAMP1_OTR_Register use record
TRIMOFFSETN at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
TRIMOFFSETP at 0 range 8 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype OPAMP1_HSOTR_TRIMLPOFFSETN_Field is STM32_SVD.UInt5;
subtype OPAMP1_HSOTR_TRIMLPOFFSETP_Field is STM32_SVD.UInt5;
-- OPAMP1 offset trimming register in low-power mode
type OPAMP1_HSOTR_Register is record
-- Trim for NMOS differential pairs
TRIMLPOFFSETN : OPAMP1_HSOTR_TRIMLPOFFSETN_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- Trim for PMOS differential pairs
TRIMLPOFFSETP : OPAMP1_HSOTR_TRIMLPOFFSETP_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPAMP1_HSOTR_Register use record
TRIMLPOFFSETN at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
TRIMLPOFFSETP at 0 range 8 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype OPAMP2_CSR_VM_SEL_Field is STM32_SVD.UInt2;
subtype OPAMP2_CSR_CALSEL_Field is STM32_SVD.UInt2;
subtype OPAMP2_CSR_PGA_GAIN_Field is STM32_SVD.UInt4;
-- OPAMP2 control/status register
type OPAMP2_CSR_Register is record
-- Operational amplifier Enable
OPAEN : Boolean := False;
-- Force internal reference on VP (reserved for test)
FORCE_VP : Boolean := False;
-- unspecified
Reserved_2_4 : STM32_SVD.UInt3 := 16#0#;
-- Inverting input selection
VM_SEL : OPAMP2_CSR_VM_SEL_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Operational amplifier high-speed mode
OPAHSM : Boolean := False;
-- unspecified
Reserved_9_10 : STM32_SVD.UInt2 := 16#0#;
-- Calibration mode enabled
CALON : Boolean := False;
-- Calibration selection
CALSEL : OPAMP2_CSR_CALSEL_Field := 16#0#;
-- Operational amplifier Programmable amplifier gain value
PGA_GAIN : OPAMP2_CSR_PGA_GAIN_Field := 16#0#;
-- User trimming enable
USERTRIM : Boolean := False;
-- unspecified
Reserved_19_28 : STM32_SVD.UInt10 := 16#0#;
-- OPAMP calibration reference voltage output control (reserved for
-- test)
TSTREF : Boolean := False;
-- Operational amplifier calibration output
CALOUT : Boolean := False;
-- unspecified
Reserved_31_31 : STM32_SVD.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPAMP2_CSR_Register use record
OPAEN at 0 range 0 .. 0;
FORCE_VP at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 4;
VM_SEL at 0 range 5 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
OPAHSM at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
CALON at 0 range 11 .. 11;
CALSEL at 0 range 12 .. 13;
PGA_GAIN at 0 range 14 .. 17;
USERTRIM at 0 range 18 .. 18;
Reserved_19_28 at 0 range 19 .. 28;
TSTREF at 0 range 29 .. 29;
CALOUT at 0 range 30 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
subtype OPAMP2_OTR_TRIMOFFSETN_Field is STM32_SVD.UInt5;
subtype OPAMP2_OTR_TRIMOFFSETP_Field is STM32_SVD.UInt5;
-- OPAMP2 offset trimming register in normal mode
type OPAMP2_OTR_Register is record
-- Trim for NMOS differential pairs
TRIMOFFSETN : OPAMP2_OTR_TRIMOFFSETN_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- Trim for PMOS differential pairs
TRIMOFFSETP : OPAMP2_OTR_TRIMOFFSETP_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPAMP2_OTR_Register use record
TRIMOFFSETN at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
TRIMOFFSETP at 0 range 8 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype OPAMP2_HSOTR_TRIMLPOFFSETN_Field is STM32_SVD.UInt5;
subtype OPAMP2_HSOTR_TRIMLPOFFSETP_Field is STM32_SVD.UInt5;
-- OPAMP2 offset trimming register in low-power mode
type OPAMP2_HSOTR_Register is record
-- Trim for NMOS differential pairs
TRIMLPOFFSETN : OPAMP2_HSOTR_TRIMLPOFFSETN_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- Trim for PMOS differential pairs
TRIMLPOFFSETP : OPAMP2_HSOTR_TRIMLPOFFSETP_Field := 16#0#;
-- unspecified
Reserved_13_31 : STM32_SVD.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OPAMP2_HSOTR_Register use record
TRIMLPOFFSETN at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
TRIMLPOFFSETP at 0 range 8 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Operational amplifiers
type OPAMP_Peripheral is record
-- OPAMP1 control/status register
OPAMP1_CSR : aliased OPAMP1_CSR_Register;
-- OPAMP1 offset trimming register in normal mode
OPAMP1_OTR : aliased OPAMP1_OTR_Register;
-- OPAMP1 offset trimming register in low-power mode
OPAMP1_HSOTR : aliased OPAMP1_HSOTR_Register;
-- OPAMP2 control/status register
OPAMP2_CSR : aliased OPAMP2_CSR_Register;
-- OPAMP2 offset trimming register in normal mode
OPAMP2_OTR : aliased OPAMP2_OTR_Register;
-- OPAMP2 offset trimming register in low-power mode
OPAMP2_HSOTR : aliased OPAMP2_HSOTR_Register;
end record
with Volatile;
for OPAMP_Peripheral use record
OPAMP1_CSR at 16#0# range 0 .. 31;
OPAMP1_OTR at 16#4# range 0 .. 31;
OPAMP1_HSOTR at 16#8# range 0 .. 31;
OPAMP2_CSR at 16#10# range 0 .. 31;
OPAMP2_OTR at 16#14# range 0 .. 31;
OPAMP2_HSOTR at 16#18# range 0 .. 31;
end record;
-- Operational amplifiers
OPAMP_Periph : aliased OPAMP_Peripheral
with Import, Address => OPAMP_Base;
end STM32_SVD.OPAMP;
|
charlie5/cBound | Ada | 1,528 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_get_pointer_control_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_pointer_control_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_pointer_control_request_t.Item,
Element_Array => xcb.xcb_get_pointer_control_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_pointer_control_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_pointer_control_request_t.Pointer,
Element_Array => xcb.xcb_get_pointer_control_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_get_pointer_control_request_t;
|
reznikmm/webidl | Ada | 1,324 | ads | -- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Iterator_Interfaces;
with League.Strings;
with WebIDL.Types;
package WebIDL.Arguments is
pragma Preelaborate;
type Argument is limited interface;
function Assigned (Self : access Argument'Class) return Boolean is
(Self /= null);
type Argument_Access is access all Argument'Class
with Storage_Size => 0;
not overriding function Name (Self : Argument)
return League.Strings.Universal_String is abstract;
not overriding function Is_Optional (Self : Argument)
return Boolean is abstract;
not overriding function Has_Ellipsis (Self : Argument)
return Boolean is abstract;
not overriding function Get_Type (Self : Argument)
return not null WebIDL.Types.Type_Access is abstract;
type Cursor is record
Index : Positive;
Argument : Argument_Access;
end record;
function Has_Element (Self : Cursor) return Boolean is
(Self.Argument.Assigned);
package Iterators is new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Argument_Iterator_Access is access constant
Iterators.Forward_Iterator'Class
with Storage_Size => 0;
end WebIDL.Arguments;
|
1Crazymoney/LearnAda | Ada | 53 | ads | procedure swap(a: in out integer; b: in out integer); |
AdaCore/libadalang | Ada | 302 | adb | procedure Test is
type List is array (Character range <>) of Integer;
subtype List_A is List ('A' .. 'A');
pragma Test_Statement;
subtype List_E is List ('E' .. 'E');
pragma Test_Statement;
subtype List_AE is List ('A' .. 'E');
pragma Test_Statement;
begin
null;
end Test;
|
reznikmm/matreshka | Ada | 18,199 | adb | ------------------------------------------------------------------------------
-- --
-- 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;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.OCL_Attributes;
with AMF.UML.Comments.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Properties;
with AMF.UML.String_Expressions;
with AMF.UML.Types;
with AMF.Visitors.OCL_Iterators;
with AMF.Visitors.OCL_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.OCL_Tuple_Literal_Parts is
-------------------
-- Get_Attribute --
-------------------
overriding function Get_Attribute
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return AMF.UML.Properties.UML_Property_Access is
begin
return
AMF.UML.Properties.UML_Property_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Attribute
(Self.Element)));
end Get_Attribute;
-------------------
-- Set_Attribute --
-------------------
overriding procedure Set_Attribute
(Self : not null access OCL_Tuple_Literal_Part_Proxy;
To : AMF.UML.Properties.UML_Property_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Attribute
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Attribute;
--------------
-- Get_Type --
--------------
overriding function Get_Type
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_Attributes.Internal_Get_Type
(Self.Element)));
end Get_Type;
--------------
-- Set_Type --
--------------
overriding procedure Set_Type
(Self : not null access OCL_Tuple_Literal_Part_Proxy;
To : AMF.UML.Types.UML_Type_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Type
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Type;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
--------------
-- Get_Name --
--------------
overriding function Get_Name
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_Attributes.Internal_Get_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_Name;
--------------
-- Set_Name --
--------------
overriding procedure Set_Name
(Self : not null access OCL_Tuple_Literal_Part_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element, null);
else
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Name;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access OCL_Tuple_Literal_Part_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.OCL_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 OCL_Tuple_Literal_Part_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.OCL_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_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_Visibility --
--------------------
overriding function Get_Visibility
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return AMF.UML.Optional_UML_Visibility_Kind is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility
(Self.Element);
end Get_Visibility;
--------------------
-- Set_Visibility --
--------------------
overriding procedure Set_Visibility
(Self : not null access OCL_Tuple_Literal_Part_Proxy;
To : AMF.UML.Optional_UML_Visibility_Kind) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility
(Self.Element, To);
end Set_Visibility;
-----------------------
-- Get_Owned_Comment --
-----------------------
overriding function Get_Owned_Comment
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return AMF.UML.Comments.Collections.Set_Of_UML_Comment is
begin
return
AMF.UML.Comments.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment
(Self.Element)));
end Get_Owned_Comment;
-----------------------
-- Get_Owned_Element --
-----------------------
overriding function Get_Owned_Element
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_Attributes.Internal_Get_Owned_Element
(Self.Element)));
end Get_Owned_Element;
---------------
-- Get_Owner --
---------------
overriding function Get_Owner
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return AMF.UML.Elements.UML_Element_Access is
begin
return
AMF.UML.Elements.UML_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner
(Self.Element)));
end Get_Owner;
--------------------
-- All_Namespaces --
--------------------
overriding function All_Namespaces
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Tuple_Literal_Part_Proxy.All_Namespaces";
return All_Namespaces (Self);
end All_Namespaces;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant OCL_Tuple_Literal_Part_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 OCL_Tuple_Literal_Part_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 OCL_Tuple_Literal_Part_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 OCL_Tuple_Literal_Part_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant OCL_Tuple_Literal_Part_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 OCL_Tuple_Literal_Part_Proxy.Namespace";
return Namespace (Self);
end Namespace;
--------------------
-- Qualified_Name --
--------------------
overriding function Qualified_Name
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Tuple_Literal_Part_Proxy.Qualified_Name";
return Qualified_Name (Self);
end Qualified_Name;
---------------
-- Separator --
---------------
overriding function Separator
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Separator unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Tuple_Literal_Part_Proxy.Separator";
return Separator (Self);
end Separator;
------------------------
-- All_Owned_Elements --
------------------------
overriding function All_Owned_Elements
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Tuple_Literal_Part_Proxy.All_Owned_Elements";
return All_Owned_Elements (Self);
end All_Owned_Elements;
-------------------
-- Must_Be_Owned --
-------------------
overriding function Must_Be_Owned
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Tuple_Literal_Part_Proxy.Must_Be_Owned";
return Must_Be_Owned (Self);
end Must_Be_Owned;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Enter_Tuple_Literal_Part
(AMF.OCL.Tuple_Literal_Parts.OCL_Tuple_Literal_Part_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant OCL_Tuple_Literal_Part_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Leave_Tuple_Literal_Part
(AMF.OCL.Tuple_Literal_Parts.OCL_Tuple_Literal_Part_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant OCL_Tuple_Literal_Part_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.OCL_Iterators.OCL_Iterator'Class then
AMF.Visitors.OCL_Iterators.OCL_Iterator'Class
(Iterator).Visit_Tuple_Literal_Part
(Visitor,
AMF.OCL.Tuple_Literal_Parts.OCL_Tuple_Literal_Part_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.OCL_Tuple_Literal_Parts;
|
reznikmm/matreshka | Ada | 4,005 | 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.Db_Apply_Command_Attributes;
package Matreshka.ODF_Db.Apply_Command_Attributes is
type Db_Apply_Command_Attribute_Node is
new Matreshka.ODF_Db.Abstract_Db_Attribute_Node
and ODF.DOM.Db_Apply_Command_Attributes.ODF_Db_Apply_Command_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Apply_Command_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Db_Apply_Command_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Db.Apply_Command_Attributes;
|
AdaCore/ada-traits-containers | Ada | 944 | ads | pragma Ada_2012;
with Formal_Ordered_Sets_Impl;
generic
type Element_Type (<>) is private;
with function "<" (E1, E2 : Element_Type) return Boolean is <>;
with function "=" (E1, E2 : Element_Type) return Boolean is <>;
-- Comparison over elements. BEWARE: "=" and "<" should be compatible.
package Formal_Ordered_Sets with SPARK_Mode is
package Impl is new Formal_Ordered_Sets_Impl (Element_Type);
type Set is new Impl.Base_Set with null record with
Iterable => (First => First_Primitive,
Next => Next_Primitive,
Has_Element => Has_Element_Primitive,
Element => Element_Primitive);
-- Iteration over sets can be done over cursors or over elements.
function Model (Self : Set'Class) return Impl.M.Set is
(Impl.Model (Self))
with Ghost;
pragma Annotate (GNATprove, Iterable_For_Proof, "Model", Model);
end Formal_Ordered_Sets;
|
stcarrez/bbox-ada-api | Ada | 2,554 | ads | -----------------------------------------------------------------------
-- upnp-ssdp -- UPnP SSDP operations
-- Copyright (C) 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 Ada.Finalization;
with Util.Strings.Sets;
private with GNAT.Sockets;
package UPnP.SSDP is
type Scanner_Type is limited new Ada.Finalization.Limited_Controlled with private;
-- Find the IPv4 addresses of the network interfaces.
procedure Find_IPv4_Addresses (Scanner : in out Scanner_Type;
IPs : out Util.Strings.Sets.Set);
-- Initialize the SSDP scanner by opening the UDP socket.
procedure Initialize (Scanner : in out Scanner_Type);
-- Send the SSDP discovery UDP packet on the UPnP multicast group 239.255.255.250.
-- Set the "ST" header to the given target. The UDP packet is sent on each interface
-- whose IP address is defined in the set <tt>IPs</tt>.
procedure Send_Discovery (Scanner : in out Scanner_Type;
Target : in String;
IPs : in Util.Strings.Sets.Set);
-- Receive the UPnP SSDP discovery messages for the given target.
-- Call the <tt>Process</tt> procedure for each of them. The <tt>Desc</tt> parameter
-- represents the UPnP location header which gives the UPnP XML root descriptor.
-- Wait at most the given time.
procedure Discover (Scanner : in out Scanner_Type;
Target : in String;
Process : not null access procedure (Desc : in String);
Wait : in Duration);
-- Release the socket.
overriding
procedure Finalize (Scanner : in out Scanner_Type);
private
type Scanner_Type is limited new Ada.Finalization.Limited_Controlled with record
Socket : GNAT.Sockets.Socket_Type := GNAT.Sockets.No_Socket;
end record;
end UPnP.SSDP;
|
AdaCore/libadalang | Ada | 229 | adb | procedure Main is
procedure Foo (X : Integer);
package Pkg is
type T is tagged null record;
procedure Bar (Self : T; X : Integer);
end Pkg;
E : Pkg.T;
begin
Foo (X => 2);
E.Bar (X => 2);
end Main;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 14,628 | ads | -- This spec has been automatically generated from STM32F103.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.GPIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CRL_MODE0_Field is STM32_SVD.UInt2;
subtype CRL_CNF0_Field is STM32_SVD.UInt2;
subtype CRL_MODE1_Field is STM32_SVD.UInt2;
subtype CRL_CNF1_Field is STM32_SVD.UInt2;
subtype CRL_MODE2_Field is STM32_SVD.UInt2;
subtype CRL_CNF2_Field is STM32_SVD.UInt2;
subtype CRL_MODE3_Field is STM32_SVD.UInt2;
subtype CRL_CNF3_Field is STM32_SVD.UInt2;
subtype CRL_MODE4_Field is STM32_SVD.UInt2;
subtype CRL_CNF4_Field is STM32_SVD.UInt2;
subtype CRL_MODE5_Field is STM32_SVD.UInt2;
subtype CRL_CNF5_Field is STM32_SVD.UInt2;
subtype CRL_MODE6_Field is STM32_SVD.UInt2;
subtype CRL_CNF6_Field is STM32_SVD.UInt2;
subtype CRL_MODE7_Field is STM32_SVD.UInt2;
subtype CRL_CNF7_Field is STM32_SVD.UInt2;
-- Port configuration register low (GPIOn_CRL)
type CRL_Register is record
-- Port n.0 mode bits
MODE0 : CRL_MODE0_Field := 16#0#;
-- Port n.0 configuration bits
CNF0 : CRL_CNF0_Field := 16#1#;
-- Port n.1 mode bits
MODE1 : CRL_MODE1_Field := 16#0#;
-- Port n.1 configuration bits
CNF1 : CRL_CNF1_Field := 16#1#;
-- Port n.2 mode bits
MODE2 : CRL_MODE2_Field := 16#0#;
-- Port n.2 configuration bits
CNF2 : CRL_CNF2_Field := 16#1#;
-- Port n.3 mode bits
MODE3 : CRL_MODE3_Field := 16#0#;
-- Port n.3 configuration bits
CNF3 : CRL_CNF3_Field := 16#1#;
-- Port n.4 mode bits
MODE4 : CRL_MODE4_Field := 16#0#;
-- Port n.4 configuration bits
CNF4 : CRL_CNF4_Field := 16#1#;
-- Port n.5 mode bits
MODE5 : CRL_MODE5_Field := 16#0#;
-- Port n.5 configuration bits
CNF5 : CRL_CNF5_Field := 16#1#;
-- Port n.6 mode bits
MODE6 : CRL_MODE6_Field := 16#0#;
-- Port n.6 configuration bits
CNF6 : CRL_CNF6_Field := 16#1#;
-- Port n.7 mode bits
MODE7 : CRL_MODE7_Field := 16#0#;
-- Port n.7 configuration bits
CNF7 : CRL_CNF7_Field := 16#1#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CRL_Register use record
MODE0 at 0 range 0 .. 1;
CNF0 at 0 range 2 .. 3;
MODE1 at 0 range 4 .. 5;
CNF1 at 0 range 6 .. 7;
MODE2 at 0 range 8 .. 9;
CNF2 at 0 range 10 .. 11;
MODE3 at 0 range 12 .. 13;
CNF3 at 0 range 14 .. 15;
MODE4 at 0 range 16 .. 17;
CNF4 at 0 range 18 .. 19;
MODE5 at 0 range 20 .. 21;
CNF5 at 0 range 22 .. 23;
MODE6 at 0 range 24 .. 25;
CNF6 at 0 range 26 .. 27;
MODE7 at 0 range 28 .. 29;
CNF7 at 0 range 30 .. 31;
end record;
subtype CRH_MODE8_Field is STM32_SVD.UInt2;
subtype CRH_CNF8_Field is STM32_SVD.UInt2;
subtype CRH_MODE9_Field is STM32_SVD.UInt2;
subtype CRH_CNF9_Field is STM32_SVD.UInt2;
subtype CRH_MODE10_Field is STM32_SVD.UInt2;
subtype CRH_CNF10_Field is STM32_SVD.UInt2;
subtype CRH_MODE11_Field is STM32_SVD.UInt2;
subtype CRH_CNF11_Field is STM32_SVD.UInt2;
subtype CRH_MODE12_Field is STM32_SVD.UInt2;
subtype CRH_CNF12_Field is STM32_SVD.UInt2;
subtype CRH_MODE13_Field is STM32_SVD.UInt2;
subtype CRH_CNF13_Field is STM32_SVD.UInt2;
subtype CRH_MODE14_Field is STM32_SVD.UInt2;
subtype CRH_CNF14_Field is STM32_SVD.UInt2;
subtype CRH_MODE15_Field is STM32_SVD.UInt2;
subtype CRH_CNF15_Field is STM32_SVD.UInt2;
-- Port configuration register high (GPIOn_CRL)
type CRH_Register is record
-- Port n.8 mode bits
MODE8 : CRH_MODE8_Field := 16#0#;
-- Port n.8 configuration bits
CNF8 : CRH_CNF8_Field := 16#1#;
-- Port n.9 mode bits
MODE9 : CRH_MODE9_Field := 16#0#;
-- Port n.9 configuration bits
CNF9 : CRH_CNF9_Field := 16#1#;
-- Port n.10 mode bits
MODE10 : CRH_MODE10_Field := 16#0#;
-- Port n.10 configuration bits
CNF10 : CRH_CNF10_Field := 16#1#;
-- Port n.11 mode bits
MODE11 : CRH_MODE11_Field := 16#0#;
-- Port n.11 configuration bits
CNF11 : CRH_CNF11_Field := 16#1#;
-- Port n.12 mode bits
MODE12 : CRH_MODE12_Field := 16#0#;
-- Port n.12 configuration bits
CNF12 : CRH_CNF12_Field := 16#1#;
-- Port n.13 mode bits
MODE13 : CRH_MODE13_Field := 16#0#;
-- Port n.13 configuration bits
CNF13 : CRH_CNF13_Field := 16#1#;
-- Port n.14 mode bits
MODE14 : CRH_MODE14_Field := 16#0#;
-- Port n.14 configuration bits
CNF14 : CRH_CNF14_Field := 16#1#;
-- Port n.15 mode bits
MODE15 : CRH_MODE15_Field := 16#0#;
-- Port n.15 configuration bits
CNF15 : CRH_CNF15_Field := 16#1#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CRH_Register use record
MODE8 at 0 range 0 .. 1;
CNF8 at 0 range 2 .. 3;
MODE9 at 0 range 4 .. 5;
CNF9 at 0 range 6 .. 7;
MODE10 at 0 range 8 .. 9;
CNF10 at 0 range 10 .. 11;
MODE11 at 0 range 12 .. 13;
CNF11 at 0 range 14 .. 15;
MODE12 at 0 range 16 .. 17;
CNF12 at 0 range 18 .. 19;
MODE13 at 0 range 20 .. 21;
CNF13 at 0 range 22 .. 23;
MODE14 at 0 range 24 .. 25;
CNF14 at 0 range 26 .. 27;
MODE15 at 0 range 28 .. 29;
CNF15 at 0 range 30 .. 31;
end record;
-- IDR array element
subtype IDR_Element is STM32_SVD.Bit;
-- IDR array
type IDR_Field_Array is array (0 .. 15) of IDR_Element
with Component_Size => 1, Size => 16;
-- Type definition for IDR
type IDR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- IDR as a value
Val : STM32_SVD.UInt16;
when True =>
-- IDR as an array
Arr : IDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for IDR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port input data register (GPIOn_IDR)
type IDR_Register is record
-- Read-only. Port input data
IDR : IDR_Field;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
IDR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- ODR array element
subtype ODR_Element is STM32_SVD.Bit;
-- ODR array
type ODR_Field_Array is array (0 .. 15) of ODR_Element
with Component_Size => 1, Size => 16;
-- Type definition for ODR
type ODR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ODR as a value
Val : STM32_SVD.UInt16;
when True =>
-- ODR as an array
Arr : ODR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for ODR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port output data register (GPIOn_ODR)
type ODR_Register is record
-- Port output data
ODR : ODR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ODR_Register use record
ODR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- BSRR_BS array element
subtype BSRR_BS_Element is STM32_SVD.Bit;
-- BSRR_BS array
type BSRR_BS_Field_Array is array (0 .. 15) of BSRR_BS_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BS
type BSRR_BS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BS as a value
Val : STM32_SVD.UInt16;
when True =>
-- BS as an array
Arr : BSRR_BS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BS_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- BSRR_BR array element
subtype BSRR_BR_Element is STM32_SVD.Bit;
-- BSRR_BR array
type BSRR_BR_Field_Array is array (0 .. 15) of BSRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BR
type BSRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32_SVD.UInt16;
when True =>
-- BR as an array
Arr : BSRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port bit set/reset register (GPIOn_BSRR)
type BSRR_Register is record
-- Write-only. Set bit 0
BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#);
-- Write-only. Reset bit 0
BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BSRR_Register use record
BS at 0 range 0 .. 15;
BR at 0 range 16 .. 31;
end record;
-- BRR_BR array element
subtype BRR_BR_Element is STM32_SVD.Bit;
-- BRR_BR array
type BRR_BR_Field_Array is array (0 .. 15) of BRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BRR_BR
type BRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32_SVD.UInt16;
when True =>
-- BR as an array
Arr : BRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port bit reset register (GPIOn_BRR)
type BRR_Register is record
-- Write-only. Reset bit 0
BR : BRR_BR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
BR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- LCKR_LCK array element
subtype LCKR_LCK_Element is STM32_SVD.Bit;
-- LCKR_LCK array
type LCKR_LCK_Field_Array is array (0 .. 15) of LCKR_LCK_Element
with Component_Size => 1, Size => 16;
-- Type definition for LCKR_LCK
type LCKR_LCK_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- LCK as a value
Val : STM32_SVD.UInt16;
when True =>
-- LCK as an array
Arr : LCKR_LCK_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for LCKR_LCK_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
subtype LCKR_LCKK_Field is STM32_SVD.Bit;
-- Port configuration lock register
type LCKR_Register is record
-- Port A Lock bit 0
LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#);
-- Lock key
LCKK : LCKR_LCKK_Field := 16#0#;
-- unspecified
Reserved_17_31 : STM32_SVD.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LCKR_Register use record
LCK at 0 range 0 .. 15;
LCKK at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- General purpose I/O
type GPIO_Peripheral is record
-- Port configuration register low (GPIOn_CRL)
CRL : aliased CRL_Register;
-- Port configuration register high (GPIOn_CRL)
CRH : aliased CRH_Register;
-- Port input data register (GPIOn_IDR)
IDR : aliased IDR_Register;
-- Port output data register (GPIOn_ODR)
ODR : aliased ODR_Register;
-- Port bit set/reset register (GPIOn_BSRR)
BSRR : aliased BSRR_Register;
-- Port bit reset register (GPIOn_BRR)
BRR : aliased BRR_Register;
-- Port configuration lock register
LCKR : aliased LCKR_Register;
end record
with Volatile;
for GPIO_Peripheral use record
CRL at 16#0# range 0 .. 31;
CRH at 16#4# range 0 .. 31;
IDR at 16#8# range 0 .. 31;
ODR at 16#C# range 0 .. 31;
BSRR at 16#10# range 0 .. 31;
BRR at 16#14# range 0 .. 31;
LCKR at 16#18# range 0 .. 31;
end record;
-- General purpose I/O
GPIOA_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40010800#);
-- General purpose I/O
GPIOB_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40010C00#);
-- General purpose I/O
GPIOC_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40011000#);
-- General purpose I/O
GPIOD_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40011400#);
-- General purpose I/O
GPIOE_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40011800#);
-- General purpose I/O
GPIOF_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40011C00#);
-- General purpose I/O
GPIOG_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#40012000#);
function Port_Index (Port : GPIO_Peripheral) return Natural is
(if Port = GPIOA_Periph then 0
elsif Port = GPIOB_Periph then 1
elsif Port = GPIOC_Periph then 2
elsif Port = GPIOD_Periph then 3
elsif Port = GPIOE_Periph then 4
elsif Port = GPIOF_Periph then 5
else 6);
end STM32_SVD.GPIO;
|
io7m/coreland-lua-ada | Ada | 33,043 | adb | -- Lua API
with Ada.Text_IO;
with Ada.Exceptions;
with Ada.Characters.Latin_1;
package body Lua is
package IO renames Ada.Text_IO;
use type IC.size_t;
CR : constant Character := Ada.Characters.Latin_1.CR;
LF : constant Character := Ada.Characters.Latin_1.LF;
--
-- C functions.
--
package C_Bindings is
function luext_version return ICS.chars_ptr;
pragma Import (C, luext_version, "luext_version");
function luext_version_num return Integer_t;
pragma Import (C, luext_version_num, "luext_version_num");
function luext_release return ICS.chars_ptr;
pragma Import (C, luext_release, "luext_release");
function lual_newstate return State_t;
pragma Import (C, lual_newstate, "luaL_newstate");
procedure lua_close (State : State_t);
pragma Import (C, lua_close, "lua_close");
function lua_newthread (State : State_t) return State_t;
pragma Import (C, lua_newthread, "lua_newthread");
function lua_gettop (State : State_t) return Integer_t;
pragma Import (C, lua_gettop, "lua_gettop");
procedure lua_settop
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_settop, "lua_settop");
function lua_checkstack
(State : State_t;
Extra : Integer_t) return Integer_t;
pragma Import (C, lua_checkstack, "lua_checkstack");
procedure lua_pushvalue
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_pushvalue, "lua_pushvalue");
procedure lua_remove
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_remove, "lua_remove");
procedure lua_insert
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_insert, "lua_insert");
procedure lua_replace
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_replace, "lua_replace");
--
-- access functions
--
function lua_typename
(State : State_t;
Index : Integer_t) return ICS.chars_ptr;
pragma Import (C, lua_typename, "lua_typename");
function lua_type
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_type, "lua_type");
function lua_isnumber
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_isnumber, "lua_isnumber");
function lua_isstring
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_isstring, "lua_isstring");
function lua_iscfunction
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_iscfunction, "lua_iscfunction");
function lua_isuserdata
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_isuserdata, "lua_isuserdata");
function lua_equal
(State : State_t;
Index1 : Integer_t;
Index2 : Integer_t) return Integer_t;
pragma Import (C, lua_equal, "lua_equal");
function lua_rawequal
(State : State_t;
Index1 : Integer_t;
Index2 : Integer_t) return Integer_t;
pragma Import (C, lua_rawequal, "lua_rawequal");
function lua_lessthan
(State : State_t;
Index1 : Integer_t;
Index2 : Integer_t) return Integer_t;
pragma Import (C, lua_lessthan, "lua_lessthan");
function lua_toboolean
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_toboolean, "lua_toboolean");
function lua_tonumber
(State : State_t;
Index : Integer_t) return Number_t;
pragma Import (C, lua_tonumber, "lua_tonumber");
function lua_tointeger
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_tointeger, "lua_tointeger");
function lua_tothread
(State : State_t;
Index : Integer_t) return State_t;
pragma Import (C, lua_tothread, "lua_tothread");
function luext_tostring
(State : State_t;
Index : Integer_t) return ICS.chars_ptr;
pragma Import (C, luext_tostring, "luext_tostring");
function lua_objlen
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_objlen, "lua_objlen");
function lua_tocfunction
(State : State_t;
Index : Integer_t) return User_Function_t;
pragma Import (C, lua_tocfunction, "lua_tocfunction");
--
-- push functions
--
procedure lua_pushboolean
(State : State_t;
B : Integer_t);
pragma Import (C, lua_pushboolean, "lua_pushboolean");
procedure lua_pushnumber
(State : State_t;
N : Number_t);
pragma Import (C, lua_pushnumber, "lua_pushnumber");
procedure lua_pushinteger
(State : State_t;
I : Integer_t);
pragma Import (C, lua_pushinteger, "lua_pushinteger");
procedure lua_pushstring
(State : State_t;
Str : ICS.chars_ptr);
pragma Import (C, lua_pushstring, "lua_pushstring");
procedure lua_pushlstring
(State : State_t;
Address : System.Address;
Size : IC.size_t);
pragma Import (C, lua_pushlstring, "lua_pushlstring");
procedure lua_pushnil (State : State_t);
pragma Import (C, lua_pushnil, "lua_pushnil");
procedure lua_pushcclosure
(State : in State_t;
fn : in User_Function_t;
num : in Integer_t);
pragma Import (C, lua_pushcclosure, "lua_pushcclosure");
procedure lua_concat
(State : State_t;
num : Natural_t);
pragma Import (C, lua_concat, "lua_concat");
function lua_next
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_next, "lua_next");
--
-- metatable functions
--
function lua_getmetatable
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_getmetatable, "lua_getmetatable");
function lua_setmetatable
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_setmetatable, "lua_setmetatable");
--
-- environment functions
--
procedure lua_getfenv
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_getfenv, "lua_getfenv");
function lua_setfenv
(State : State_t;
Index : Integer_t) return Integer_t;
pragma Import (C, lua_setfenv, "lua_setfenv");
--
-- registered functions
--
procedure lua_call
(State : State_t;
Num_Arguments : Integer_t;
Num_Results : Integer_t);
pragma Import (C, lua_call, "lua_call");
function lua_pcall
(State : State_t;
Num_Arguments : Integer_t;
Num_Results : Integer_t;
Error_Func : Integer_t) return Integer_t;
pragma Import (C, lua_pcall, "lua_pcall");
--
-- table functions
--
procedure lua_createtable
(State : State_t;
num_arr : Integer_t;
num_rec : Integer_t);
pragma Import (C, lua_createtable, "lua_createtable");
procedure lua_settable
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_settable, "lua_settable");
procedure lua_gettable
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_gettable, "lua_gettable");
procedure lua_rawget
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_rawget, "lua_rawget");
procedure lua_rawset
(State : State_t;
Index : Integer_t);
pragma Import (C, lua_rawset, "lua_rawset");
procedure lua_rawgeti
(State : State_t;
Index : Integer_t;
Element : Integer_t);
pragma Import (C, lua_rawgeti, "lua_rawgeti");
procedure lua_rawseti
(State : State_t;
Index : Integer_t;
Element : Integer_t);
pragma Import (C, lua_rawseti, "lua_rawseti");
--
-- errors
--
function lua_atpanic
(State : State_t;
Func : User_Function_t) return User_Function_t;
procedure lua_atpanic
(State : State_t;
Func : User_Function_t);
pragma Import (C, Lua_Atpanic, "lua_atpanic");
procedure lua_error (State : State_t);
pragma Import (C, lua_error, "lua_error");
pragma No_Return (lua_error);
procedure lua_sethook
(State : State_t;
Func : Hook_t;
AMask : Integer_t;
Count : Integer_t);
pragma Import (C, lua_sethook, "lua_sethook");
function lua_gethookmask (State : State_t) return Integer_t;
pragma Import (C, lua_gethookmask, "lua_gethookmask");
function lua_gethookcount (State : State_t) return Integer_t;
pragma Import (C, lua_gethookcount, "lua_gethookcount");
--
-- set functions
--
procedure lua_setfield
(State : State_t;
Index : Integer_t;
Key : ICS.chars_ptr);
pragma Import (C, lua_setfield, "lua_setfield");
--
-- get functions
--
procedure lua_getfield
(State : State_t;
Index : Integer_t;
Key : ICS.chars_ptr);
pragma Import (C, lua_getfield, "lua_getfield");
--
-- coroutines
--
function lua_resume
(State : State_t;
Narg : Integer_t) return Integer_t;
pragma Import (C, lua_resume, "lua_resume");
type Buffer_Context_t is record
Buffer : ICS.chars_ptr;
Buffer_Size : IC.size_t;
end record;
type Buffer_Context_Access_t is access all Buffer_Context_t;
pragma Convention (C, Buffer_Context_t);
pragma Convention (C, Buffer_Context_Access_t);
type buffer_func_t is access function
(State : State_t;
Data : Buffer_Context_Access_t;
Size : access IC.size_t)
return ICS.chars_ptr;
pragma Convention (C, buffer_func_t);
function lua_load_buffer
(State : State_t;
Func : buffer_func_t;
Data : Buffer_Context_Access_t;
Name : ICS.chars_ptr)
return Integer_t;
pragma Import (C, lua_load_buffer, "lua_load");
function read_buffer
(State : State_t;
Data : Buffer_Context_Access_t;
Size : access IC.size_t)
return ICS.chars_ptr;
pragma Convention (C, read_buffer);
end C_Bindings;
package body C_Bindings is
function read_buffer
(State : State_t;
Data : Buffer_Context_Access_t;
Size : access IC.size_t)
return ICS.chars_ptr
is
pragma Assert (State /= State_Error);
Size_Alias : constant access IC.size_t := Size;
begin
if Data.all.Buffer_Size = 0 then
return ICS.Null_Ptr;
end if;
Size_Alias.all := Data.all.Buffer_Size;
Data.all.Buffer_Size := 0;
return Data.all.Buffer;
end read_buffer;
end C_Bindings;
--
-- load functions
--
function Load_Buffer
(State : State_t;
Buffer : ICS.chars_ptr;
Size : IC.size_t;
Name : String) return Error_t
is
C_Buffer : aliased IC.char_array := IC.To_C (Name);
context : aliased C_Bindings.Buffer_Context_t := (Buffer, Size);
begin
return Error_t'Val
(C_Bindings.lua_load_buffer
(State => State,
Func => C_Bindings.read_buffer'Access,
Data => context'Unchecked_Access,
Name => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access)));
end Load_Buffer;
function Load_Buffer
(State : State_t;
Buffer : String;
Size : Natural;
Name : String) return Error_t
is
C_Buffer : aliased IC.char_array := IC.To_C (Buffer);
begin
return Load_Buffer
(State => State,
Buffer => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access),
Size => IC.size_t (Size),
Name => Name);
end Load_Buffer;
function Load_Buffer
(State : State_t;
Buffer : UB_Strings.Unbounded_String;
Name : String) return Error_t is
begin
return Load_Buffer
(State => State,
Buffer => UB_Strings.To_String (Buffer),
Size => UB_Strings.Length (Buffer),
Name => Name);
end Load_Buffer;
function Load_File (State : State_t; File : String) return Error_t is
FD : Ada.Text_IO.File_Type;
Buffer : String (1 .. 4096);
Length : Natural;
UB_Buffer : UB_Strings.Unbounded_String;
begin
IO.Open (FD, IO.In_File, File);
while not IO.End_Of_File (FD) loop
IO.Get_Line (FD, Buffer, Length);
UB_Strings.Append (UB_Buffer, Buffer (1 .. Length) & LF);
end loop;
IO.Close (FD);
return Load_Buffer (State, UB_Buffer, File);
end Load_File;
function Load_String
(State : State_t;
Buffer : String) return Error_t is
begin
return Load_Buffer
(State => State,
Buffer => Buffer,
Size => Buffer'Last,
Name => "");
end Load_String;
--
-- execute functions
--
function Exec_File
(State : State_t;
File : String) return Error_t
is
Error_Code : Error_t;
begin
Error_Code := Load_File (State, File);
if Error_Code /= Lua_Error_None then
return Error_Code;
end if;
Error_Code := Error_t'Val (C_Bindings.lua_pcall (State, 0, -1, 0));
return Error_Code;
end Exec_File;
function Exec_String
(State : State_t;
Str : String) return Error_t
is
Error_Code : Error_t;
begin
Error_Code := Load_String (State, Str);
if Error_Code /= Lua_Error_None then
return Error_Code;
end if;
Error_Code := Error_t'Val (C_Bindings.lua_pcall (State, 0, -1, 0));
return Error_Code;
end Exec_String;
--
-- Main API
--
procedure Set_Hook
(State : State_t;
Func : Hook_t;
AMask : Mask_t;
Count : Integer) is
begin
C_Bindings.lua_sethook (State, Func, Integer_t (AMask), Integer_t (Count));
end Set_Hook;
function Get_Hook_Mask (State : State_t) return Mask_t is
begin
return Mask_t (C_Bindings.lua_gethookmask (State));
end Get_Hook_Mask;
function Get_Hook_Count (State : State_t) return Natural is
begin
return Natural (C_Bindings.lua_gethookcount (State));
end Get_Hook_Count;
procedure Error (State : State_t) is
begin
C_Bindings.lua_error (State);
end Error;
--
-- State manipulation
--
function Open return State_t is
begin
return C_Bindings.lual_newstate;
end Open;
procedure Close (State : State_t) is
begin
C_Bindings.lua_close (State);
end Close;
function New_Thread (State : State_t) return State_t is
begin
return C_Bindings.lua_newthread (State);
end New_Thread;
function At_Panic
(State : State_t;
Panic_Function : User_Function_t) return User_Function_t is
begin
return C_Bindings.lua_atpanic (State, Panic_Function);
end At_Panic;
procedure At_Panic
(State : State_t;
Panic_Function : User_Function_t) is
begin
C_Bindings.lua_atpanic (State, Panic_Function);
end At_Panic;
--
-- stack manipulation
--
function Get_Top (State : State_t) return Integer is
begin
return Integer (C_Bindings.lua_gettop (State));
end Get_Top;
procedure Set_Top
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_settop (State, Integer_t (Index));
end Set_Top;
procedure Push_Value
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_pushvalue (State, Integer_t (Index));
end Push_Value;
procedure Remove
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_remove (State, Integer_t (Index));
end Remove;
procedure Insert
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_insert (State, Integer_t (Index));
end Insert;
procedure Replace
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_replace (State, Integer_t (Index));
end Replace;
function Check_Stack
(State : State_t;
Size : Integer) return Boolean is
begin
return C_Bindings.lua_checkstack (State, Integer_t (Size)) /= 0;
end Check_Stack;
--
-- access functions (stack -> Ada)
--
function Is_Number
(State : State_t;
Index : Integer) return Boolean is
begin
return C_Bindings.lua_isnumber (State, Integer_t (Index)) /= 0;
end Is_Number;
function Is_String
(State : State_t;
Index : Integer) return Boolean is
begin
return C_Bindings.lua_isstring (State, Integer_t (Index)) /= 0;
end Is_String;
function Is_User_Function
(State : State_t;
Index : Integer) return Boolean is
begin
return C_Bindings.lua_iscfunction (State, Integer_t (Index)) /= 0;
end Is_User_Function;
function Is_Userdata
(State : State_t;
Index : Integer) return Boolean is
begin
return C_Bindings.lua_isuserdata (State, Integer_t (Index)) /= 0;
end Is_Userdata;
function Is_Nil
(State : State_t;
Index : Integer) return Boolean is
begin
return C_Bindings.lua_type (State, Integer_t (Index)) = 0;
end Is_Nil;
function Is_None_Or_Nil
(State : State_t;
Index : Integer) return Boolean is
begin
return Is_None (State, Index) or Is_Nil (State, Index);
end Is_None_Or_Nil;
function Is_Table
(State : State_t;
Index : Integer) return Boolean is
begin
return Type_Of (State, Index) = T_Table;
end Is_Table;
function Is_Boolean
(State : State_t;
Index : Integer) return Boolean is
begin
return Type_Of (State, Index) = T_Boolean;
end Is_Boolean;
function Is_Function
(State : State_t;
Index : Integer) return Boolean is
begin
return Type_Of (State, Index) = T_Function;
end Is_Function;
function Is_Thread
(State : State_t;
Index : Integer) return Boolean is
begin
return Type_Of (State, Index) = T_Thread;
end Is_Thread;
function Is_None
(State : State_t;
Index : Integer) return Boolean is
begin
return Type_Of (State, Index) = T_None;
end Is_None;
function Is_Light_Userdata
(State : State_t;
Index : Integer) return Boolean is
begin
return Type_Of (State, Index) = T_Light_Userdata;
end Is_Light_Userdata;
function Type_Of
(State : State_t;
Index : Integer) return Type_t
is
Type_Number : Integer_t;
begin
Type_Number := C_Bindings.lua_type (State, Integer_t (Index));
return Type_t'Val (Type_Number + 1);
end Type_Of;
function Type_Name
(State : State_t;
Index : Integer) return String
is
T : constant Integer_t := C_Bindings.lua_type (State, Integer_t (Index));
begin
return ICS.Value (C_Bindings.lua_typename (State, T));
end Type_Name;
function Type_Name (T : Lua.Type_t) return String is
begin
case T is
when T_None => return "none";
when T_Nil => return "nil";
when T_Boolean => return "boolean";
when T_Light_Userdata => return "light_userdata";
when T_Number => return "number";
when T_String => return "string";
when T_Table => return "table";
when T_Function => return "function";
when T_Userdata => return "userdata";
when T_Thread => return "thread";
end case;
end Type_Name;
function To_Number
(State : State_t;
Index : Integer) return Number_t is
begin
return C_Bindings.lua_tonumber (State, Integer_t (Index));
end To_Number;
function To_String
(State : State_t;
Index : Integer) return String
is
C_String : ICS.chars_ptr;
begin
C_String := C_Bindings.luext_tostring (State, Integer_t (Index));
if C_String /= ICS.Null_Ptr then
return ICS.Value (C_String);
else
return "";
end if;
end To_String;
function To_Unbounded_String
(State : State_t;
Index : Integer) return UB_Strings.Unbounded_String is
begin
return UB_Strings.To_Unbounded_String (To_String (State, Index));
end To_Unbounded_String;
function To_Boolean
(State : State_t;
Index : Integer) return Boolean is
begin
return C_Bindings.lua_toboolean (State, Integer_t (Index)) /= 0;
end To_Boolean;
function To_Integer
(State : State_t;
Index : Integer) return Integer_t is
begin
return C_Bindings.lua_tointeger (State, Integer_t (Index));
end To_Integer;
function To_Thread
(State : State_t;
Index : Integer) return State_t is
begin
return C_Bindings.lua_tothread (State, Integer_t (Index));
end To_Thread;
function To_C_Function
(State : State_t;
Index : Integer) return User_Function_t is
begin
return C_Bindings.lua_tocfunction (State, Integer_t (Index));
end To_C_Function;
function Is_Equal
(State : State_t;
Index1 : Integer;
Index2 : Integer) return Boolean is
begin
return C_Bindings.lua_equal (State, Integer_t (Index1), Integer_t (Index2)) /= 0;
end Is_Equal;
function Is_Raw_Equal
(State : State_t;
Index1 : Integer;
Index2 : Integer) return Boolean is
begin
return C_Bindings.lua_rawequal (State, Integer_t (Index1), Integer_t (Index2)) /= 0;
end Is_Raw_Equal;
function Is_Less_Than
(State : State_t;
Index1 : Integer;
Index2 : Integer) return Boolean is
begin
return C_Bindings.lua_lessthan (State, Integer_t (Index1), Integer_t (Index2)) /= 0;
end Is_Less_Than;
function Object_Length
(State : State_t;
Index : Integer) return Integer_t is
begin
return C_Bindings.lua_objlen (State, Integer_t (Index));
end Object_Length;
--
-- push functions (Ada -> stack)
--
procedure Push_Nil (State : State_t) is
begin
C_Bindings.lua_pushnil (State);
end Push_Nil;
procedure Push_Number
(State : State_t;
N : Number_t) is
begin
C_Bindings.lua_pushnumber (State, N);
end Push_Number;
procedure Push_Integer
(State : State_t;
I : Integer_t) is
begin
C_Bindings.lua_pushinteger (State, I);
end Push_Integer;
procedure Push_Boolean
(State : State_t;
B : Boolean) is
begin
if B then
C_Bindings.lua_pushboolean (State, 1);
else
C_Bindings.lua_pushboolean (State, 0);
end if;
end Push_Boolean;
procedure Push_String
(State : State_t;
Str : ICS.chars_ptr) is
begin
C_Bindings.lua_pushstring (State, Str);
end Push_String;
procedure Push_String
(State : State_t;
Str : String) is
begin
if Str'Length > 0 then
C_Bindings.lua_pushlstring (State => State, Address => Str (Str'First)'Address, Size => Str'Length);
else
C_Bindings.lua_pushlstring (State, System.Null_Address, 0);
end if;
end Push_String;
procedure Push_String
(State : State_t;
Str : UB_Strings.Unbounded_String)
is
C_Buffer : aliased IC.char_array := IC.To_C (UB_Strings.To_String (Str));
begin
C_Bindings.lua_pushstring (State => State, Str => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Push_String;
procedure Push_String
(State : State_t;
Address : System.Address;
Size : Positive) is
begin
C_Bindings.lua_pushlstring (State => State, Address => Address, Size => IC.size_t (Size));
end Push_String;
procedure Push_User_Closure
(State : State_t;
Func : User_Function_t;
Num_Params : Integer) is
begin
C_Bindings.lua_pushcclosure (State, Func, Integer_t (Num_Params));
end Push_User_Closure;
procedure Push_User_Function
(State : State_t;
Func : User_Function_t) is
begin
C_Bindings.lua_pushcclosure (State, Func, 0);
end Push_User_Function;
procedure Concat
(State : State_t;
N : Natural) is
begin
C_Bindings.lua_concat (State, Integer_t (N));
end Concat;
--
-- get functions (lua -> stack)
--
procedure Get_Table
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_gettable (State, Integer_t (Index));
end Get_Table;
function Get_Metatable
(State : State_t;
Index : Integer) return Error_t is
begin
return Error_t'Val (C_Bindings.lua_getmetatable (State, Integer_t (Index)));
end Get_Metatable;
procedure Raw_Get
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_rawget (State, Integer_t (Index));
end Raw_Get;
procedure Raw_Get_Index
(State : State_t;
Index : Integer;
Element : Integer) is
begin
C_Bindings.lua_rawgeti (State, Integer_t (Index), Integer_t (Element));
end Raw_Get_Index;
procedure Get_Field
(State : State_t;
Index : Integer;
Key : ICS.chars_ptr) is
begin
C_Bindings.lua_getfield (State, Integer_t (Index), Key);
end Get_Field;
procedure Get_Field
(State : State_t;
Index : Integer;
Key : String)
is
C_Buffer : aliased IC.char_array := IC.To_C (Key);
begin
C_Bindings.lua_getfield
(State => State,
Index => Integer_t (Index),
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Get_Field;
procedure Get_Field
(State : State_t;
Index : Integer;
Key : UB_Strings.Unbounded_String)
is
C_Buffer : aliased IC.char_array := IC.To_C (UB_Strings.To_String (Key));
begin
C_Bindings.lua_getfield
(State => State,
Index => Integer_t (Index),
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Get_Field;
procedure Get_Global
(State : State_t;
Key : ICS.chars_ptr) is
begin
C_Bindings.lua_getfield (State, Globals_Index, Key);
end Get_Global;
procedure Get_Global
(State : State_t;
Key : String)
is
C_Buffer : aliased IC.char_array := IC.To_C (Key);
begin
C_Bindings.lua_getfield
(State => State,
Index => Globals_Index,
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Get_Global;
procedure Get_Global
(State : State_t;
Key : UB_Strings.Unbounded_String)
is
C_Buffer : aliased IC.char_array := IC.To_C (UB_Strings.To_String (Key));
begin
C_Bindings.lua_getfield
(State => State,
Index => Globals_Index,
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Get_Global;
procedure Get_FEnv
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_getfenv (State, Integer_t (Index));
end Get_FEnv;
--
-- set functions (stack -> lua)
--
procedure Set_Table
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_settable (State, Integer_t (Index));
end Set_Table;
function Set_Metatable
(State : State_t;
Index : Integer) return Error_t is
begin
return Error_t'Val (C_Bindings.lua_setmetatable (State, Integer_t (Index)));
end Set_Metatable;
procedure Raw_Set
(State : State_t;
Index : Integer) is
begin
C_Bindings.lua_rawset (State, Integer_t (Index));
end Raw_Set;
procedure Create_Table
(State : State_t;
Array_Elements : in Natural;
Non_Array_Elements : in Natural) is
begin
C_Bindings.lua_createtable
(State => State,
num_arr => Integer_t (Array_Elements),
num_rec => Integer_t (Non_Array_Elements));
end Create_Table;
procedure New_Table (State : State_t) is
begin
C_Bindings.lua_createtable (State, 0, 0);
end New_Table;
procedure Raw_Set_Index
(State : State_t;
Index : Integer;
Element : Integer) is
begin
C_Bindings.lua_rawseti (State, Integer_t (Index), Integer_t (Element));
end Raw_Set_Index;
procedure Set_Field
(State : State_t;
Index : Integer;
Key : ICS.chars_ptr) is
begin
C_Bindings.lua_setfield
(State => State,
Index => Integer_t (Index),
Key => Key);
end Set_Field;
procedure Set_Field
(State : State_t;
Index : Integer;
Key : String)
is
C_Buffer : aliased IC.char_array := IC.To_C (Key);
begin
C_Bindings.lua_setfield
(State => State,
Index => Integer_t (Index),
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Set_Field;
procedure Set_Field
(State : State_t;
Index : Integer;
Key : UB_Strings.Unbounded_String)
is
C_Buffer : aliased IC.char_array := IC.To_C (UB_Strings.To_String (Key));
begin
C_Bindings.lua_setfield
(State => State,
Index => Integer_t (Index),
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Set_Field;
procedure Set_Global
(State : State_t;
Key : ICS.chars_ptr) is
begin
C_Bindings.lua_setfield (State, Globals_Index, Key);
end Set_Global;
procedure Set_Global
(State : State_t;
Key : String)
is
C_Buffer : aliased IC.char_array := IC.To_C (Key);
begin
C_Bindings.lua_setfield
(State => State,
Index => Globals_Index,
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Set_Global;
procedure Set_Global
(State : State_t;
Key : UB_Strings.Unbounded_String)
is
C_Buffer : aliased IC.char_array := IC.To_C (UB_Strings.To_String (Key));
begin
C_Bindings.lua_setfield
(State => State,
Index => Globals_Index,
Key => ICS.To_Chars_Ptr (C_Buffer'Unchecked_Access));
end Set_Global;
function Set_FEnv (State : State_t; Index : Integer) return Error_t is
begin
return Error_t'Val (C_Bindings.lua_setfenv (State, Integer_t (Index)));
end Set_FEnv;
--
-- coroutines
--
function Ret_Error
(Error_Code : Error_t;
Message : String) return Error_Message_t
is
Complete_Message : constant String := Error_Messages (Error_Code).all & Message;
begin
return (Complete_Message'Length, Error_Code, Complete_Message);
end Ret_Error;
function Resume
(State : State_t;
Num_Arguments : Integer) return Error_Message_t
is
Error : Error_t;
NDX : constant Integer_t := C_Bindings.lua_gettop (State) - Integer_t (Num_Arguments);
begin
Push_String (State, "_traceback");
C_Bindings.lua_rawget (State, Globals_Index);
C_Bindings.lua_insert (State, NDX);
Error := Error_t'Val (C_Bindings.lua_resume (State, Integer_t (Num_Arguments)));
C_Bindings.lua_remove (State, NDX);
if Error /= Lua_Error_None then
return Ret_Error (Error, To_String (State, -1));
else
return No_Error;
end if;
exception
when err : others =>
return Ret_Error (Lua_Exception,
"exception while doing lua.traced_call:" & CR & LF & Ada.Exceptions.Exception_Information (err));
end Resume;
--
-- misc
--
procedure Register
(State : State_t;
Func_Name : String;
Func_Ptr : User_Function_t) is
begin
Push_String (State, Func_Name);
C_Bindings.lua_pushcclosure (State, Func_Ptr, 0);
C_Bindings.lua_settable (State, Globals_Index);
end Register;
procedure Call
(State : State_t;
Num_Arguments : Integer;
Num_Results : Integer) is
begin
C_Bindings.lua_call
(State => State,
Num_Arguments => Integer_t (Num_Arguments),
Num_Results => Integer_t (Num_Results));
end Call;
function PCall
(State : State_t;
Num_Arguments : Integer;
Num_Results : Integer;
Error_Func : Integer) return Error_t is
begin
return Error_t'Val
(C_Bindings.lua_pcall
(State => State,
Num_Arguments => Lua.Integer_t (Num_Arguments),
Num_Results => Lua.Integer_t (Num_Results),
Error_Func => Lua.Integer_t (Error_Func)));
end PCall;
procedure Pop
(State : State_t;
Count : Integer) is
begin
Set_Top (State, -(Count) - 1);
end Pop;
function Next
(State : State_t;
Index : Integer) return Integer is
begin
return Integer (C_Bindings.lua_next (State, Integer_t (Index)));
end Next;
function Reference (State : State_t) return Object_Ref_t is
begin
return Reference (State, Registry_Index);
end Reference;
procedure Unreference
(State : State_t;
Ref : Object_Ref_t) is
begin
Unreference (State, Registry_Index, Ref);
end Unreference;
procedure Dereference
(State : State_t;
Ref : Object_Ref_t) is
begin
Raw_Get_Index (State, Registry_Index, Integer (Ref));
end Dereference;
function Version return String is
begin
return ICS.Value (C_Bindings.luext_version);
end Version;
function Version return Integer is
begin
return Integer (C_Bindings.luext_version_num);
end Version;
function Release return String is
begin
return ICS.Value (C_Bindings.luext_release);
end Release;
--
-- Generic typed loading.
--
function Load_Typed
(State : State_t;
Reader : Chunk_Reader_t;
Data : access User_Data;
Chunk_Name : String) return Error_t
is
function lua_load_generic
(State : State_t;
Reader : Chunk_Reader_t;
Data : access User_Data;
Chunk_Name : ICS.chars_ptr) return IC.int;
pragma Import (C, lua_load_generic, "lua_load");
C_Chunk_Name : aliased IC.char_array := IC.To_C (Chunk_Name);
begin
return Error_t'Val (lua_load_generic
(State => State,
Reader => Reader,
Data => Data,
Chunk_Name => ICS.To_Chars_Ptr (C_Chunk_Name'Unchecked_Access)));
end Load_Typed;
end Lua;
|
zhmu/ananas | Ada | 4,915 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . Q U E U I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
with System.Tasking.Protected_Objects.Entries;
package System.Tasking.Queuing is
package POE renames System.Tasking.Protected_Objects.Entries;
procedure Broadcast_Program_Error
(Self_ID : Task_Id;
Object : POE.Protection_Entries_Access;
Pending_Call : Entry_Call_Link);
-- Raise Program_Error in all tasks calling the protected entries of Object
-- The exception will not be raised immediately for the calling task; it
-- will be deferred until it calls Check_Exception.
procedure Enqueue (E : in out Entry_Queue; Call : Entry_Call_Link);
-- Enqueue Call at the end of entry_queue E
procedure Dequeue (E : in out Entry_Queue; Call : Entry_Call_Link);
-- Dequeue Call from entry_queue E
function Head (E : Entry_Queue) return Entry_Call_Link;
pragma Inline (Head);
-- Return the head of entry_queue E
procedure Dequeue_Head
(E : in out Entry_Queue;
Call : out Entry_Call_Link);
-- Remove and return the head of entry_queue E
function Onqueue (Call : Entry_Call_Link) return Boolean;
pragma Inline (Onqueue);
-- Return True if Call is on any entry_queue at all
function Count_Waiting (E : Entry_Queue) return Natural;
-- Return number of calls on the waiting queue of E
procedure Select_Task_Entry_Call
(Acceptor : Task_Id;
Open_Accepts : Accept_List_Access;
Call : out Entry_Call_Link;
Selection : out Select_Index;
Open_Alternative : out Boolean);
-- Select an entry for rendezvous. On exit:
-- Call will contain a pointer to the entry call record selected;
-- Selection will contain the index of the alternative selected
-- Open_Alternative will be True if there were any open alternatives
procedure Select_Protected_Entry_Call
(Self_ID : Task_Id;
Object : POE.Protection_Entries_Access;
Call : out Entry_Call_Link);
-- Select an entry of a protected object
procedure Enqueue_Call (Entry_Call : Entry_Call_Link);
procedure Dequeue_Call (Entry_Call : Entry_Call_Link);
-- Enqueue (dequeue) the call to (from) whatever server they are
-- calling, whether a task or a protected object.
procedure Requeue_Call_With_New_Prio
(Entry_Call : Entry_Call_Link; Prio : System.Any_Priority);
-- Change Priority of the call and re insert to the queue when priority
-- queueing is in effect. When FIFO is enforced, this routine
-- should not have any effect.
end System.Tasking.Queuing;
|
sungyeon/drake | Ada | 11,448 | ads | pragma License (Unrestricted);
-- Ada 2005
with Ada.Iterator_Interfaces;
private with Ada.Containers.Binary_Trees;
private with Ada.Containers.Binary_Trees.Arne_Andersson;
private with Ada.Containers.Copy_On_Write;
private with Ada.Finalization;
private with Ada.Streams;
generic
type Element_Type is private;
with function "<" (Left, Right : Element_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Ordered_Sets is
pragma Preelaborate;
pragma Remote_Types;
function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
type Set is tagged private
with
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization (Set);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
-- modified
-- Empty_Set : constant Set;
function Empty_Set return Set;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
package Set_Iterator_Interfaces is
new Iterator_Interfaces (Cursor, Has_Element);
overriding function "=" (Left, Right : Set) return Boolean;
function Equivalent_Sets (Left, Right : Set) return Boolean;
function To_Set (New_Item : Element_Type) return Set;
-- extended
generic
type Index_Type is (<>);
type Element_Array is array (Index_Type range <>) of Element_Type;
function Generic_Array_To_Set (S : Element_Array) return Set;
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
procedure Clear (Container : in out Set);
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element (
Container : in out Set;
Position : Cursor;
New_Item : Element_Type);
procedure Query_Element (
Position : Cursor;
Process : not null access procedure (Element : Element_Type));
type Constant_Reference_Type (
Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
function Constant_Reference (Container : aliased Set; Position : Cursor)
return Constant_Reference_Type;
procedure Assign (Target : in out Set; Source : Set);
function Copy (Source : Set) return Set;
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert (
Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert (
Container : in out Set;
New_Item : Element_Type);
procedure Include (Container : in out Set; New_Item : Element_Type);
procedure Replace (Container : in out Set; New_Item : Element_Type);
procedure Exclude (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Position : in out Cursor);
-- modified
procedure Delete_First (Container : in out Set'Class); -- not primitive
-- modified
procedure Delete_Last (Container : in out Set'Class); -- not primitive
procedure Union (Target : in out Set; Source : Set);
function Union (Left, Right : Set) return Set;
function "or" (Left, Right : Set) return Set
renames Union;
procedure Intersection (Target : in out Set; Source : Set);
function Intersection (Left, Right : Set) return Set;
function "and" (Left, Right : Set) return Set
renames Intersection;
procedure Difference (Target : in out Set; Source : Set);
function Difference (Left, Right : Set) return Set;
function "-" (Left, Right : Set) return Set
renames Difference;
procedure Symmetric_Difference (Target : in out Set; Source : Set);
function Symmetric_Difference (Left, Right : Set) return Set;
function "xor" (Left, Right : Set) return Set
renames Symmetric_Difference;
function Overlap (Left, Right : Set) return Boolean;
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
function First (Container : Set) return Cursor;
-- modified
function First_Element (Container : Set'Class) -- not primitive
return Element_Type;
function Last (Container : Set) return Cursor;
-- modified
function Last_Element (Container : Set'Class) -- not primitive
return Element_Type;
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
function Previous (Position : Cursor) return Cursor;
procedure Previous (Position : in out Cursor);
function Find (Container : Set; Item : Element_Type) return Cursor;
function Floor (Container : Set; Item : Element_Type) return Cursor;
function Ceiling (Container : Set; Item : Element_Type) return Cursor;
function Contains (Container : Set; Item : Element_Type) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
function ">" (Left, Right : Cursor) return Boolean;
function "<" (Left : Cursor; Right : Element_Type) return Boolean;
function ">" (Left : Cursor; Right : Element_Type) return Boolean;
function "<" (Left : Element_Type; Right : Cursor) return Boolean;
function ">" (Left : Element_Type; Right : Cursor) return Boolean;
-- modified
procedure Iterate (
Container : Set'Class; -- not primitive
Process : not null access procedure (Position : Cursor));
-- modified
procedure Reverse_Iterate (
Container : Set'Class; -- not primitive
Process : not null access procedure (Position : Cursor));
-- modified
function Iterate (Container : Set'Class) -- not primitive
return Set_Iterator_Interfaces.Reversible_Iterator'Class;
-- extended
function Iterate (Container : Set'Class; First, Last : Cursor)
return Set_Iterator_Interfaces.Reversible_Iterator'Class;
generic
type Key_Type (<>) is private;
with function Key (Element : Element_Type) return Key_Type;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
package Generic_Keys is
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
function Key (Position : Cursor) return Key_Type;
function Element (Container : Set; Key : Key_Type) return Element_Type;
procedure Replace (
Container : in out Set;
Key : Key_Type;
New_Item : Element_Type);
procedure Exclude (Container : in out Set; Key : Key_Type);
procedure Delete (Container : in out Set; Key : Key_Type);
function Find (Container : Set; Key : Key_Type) return Cursor;
function Floor (Container : Set; Key : Key_Type) return Cursor;
function Ceiling (Container : Set; Key : Key_Type) return Cursor;
function Contains (Container : Set; Key : Key_Type) return Boolean;
procedure Update_Element_Preserving_Key (
Container : in out Set;
Position : Cursor;
Process : not null access procedure (
Element : in out Element_Type));
type Reference_Type (Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
function Reference_Preserving_Key (
Container : aliased in out Set;
Position : Cursor)
return Reference_Type;
function Constant_Reference (Container : aliased Set; Key : Key_Type)
return Constant_Reference_Type;
function Reference_Preserving_Key (
Container : aliased in out Set;
Key : Key_Type)
return Reference_Type;
private
type Reference_Type (
Element : not null access Element_Type) is null record;
-- dummy 'Read and 'Write
procedure Missing_Read (
Stream : access Streams.Root_Stream_Type'Class;
Item : out Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Write (
Stream : access Streams.Root_Stream_Type'Class;
Item : Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
for Reference_Type'Read use Missing_Read;
for Reference_Type'Write use Missing_Write;
end Generic_Keys;
-- diff (Equivalents)
--
--
--
--
--
private
package Base renames Binary_Trees.Arne_Andersson;
-- diff (Element_Access)
type Node is limited record
Super : aliased Base.Node;
Element : aliased Element_Type;
end record;
-- place Super at first whether Element_Type is controlled-type
for Node use record
Super at 0 range 0 .. Base.Node_Size - 1;
end record;
type Data is limited record
Super : aliased Copy_On_Write.Data;
Root : Binary_Trees.Node_Access := null;
Length : Count_Type := 0;
end record;
type Data_Access is access Data;
type Set is new Finalization.Controlled with record
Super : aliased Copy_On_Write.Container;
-- diff
end record;
overriding procedure Adjust (Object : in out Set);
overriding procedure Finalize (Object : in out Set)
renames Clear;
type Cursor is access Node;
type Constant_Reference_Type (
Element : not null access constant Element_Type) is null record;
type Set_Access is access constant Set;
for Set_Access'Storage_Size use 0;
type Set_Iterator is
new Set_Iterator_Interfaces.Reversible_Iterator with
record
First : Cursor;
Last : Cursor;
end record;
overriding function First (Object : Set_Iterator) return Cursor;
overriding function Next (Object : Set_Iterator; Position : Cursor)
return Cursor;
overriding function Last (Object : Set_Iterator) return Cursor;
overriding function Previous (Object : Set_Iterator; Position : Cursor)
return Cursor;
package Streaming is
procedure Read (
Stream : not null access Streams.Root_Stream_Type'Class;
Item : out Set);
procedure Write (
Stream : not null access Streams.Root_Stream_Type'Class;
Item : Set);
procedure Missing_Read (
Stream : access Streams.Root_Stream_Type'Class;
Item : out Cursor)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Write (
Stream : access Streams.Root_Stream_Type'Class;
Item : Cursor)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Read (
Stream : access Streams.Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Write (
Stream : access Streams.Root_Stream_Type'Class;
Item : Constant_Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
end Streaming;
for Set'Read use Streaming.Read;
for Set'Write use Streaming.Write;
for Cursor'Read use Streaming.Missing_Read;
for Cursor'Write use Streaming.Missing_Write;
for Constant_Reference_Type'Read use Streaming.Missing_Read;
for Constant_Reference_Type'Write use Streaming.Missing_Write;
No_Element : constant Cursor := null;
end Ada.Containers.Ordered_Sets;
|
AdaCore/Ada_Drivers_Library | Ada | 25,191 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-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 Bitmap_Color_Conversion; use Bitmap_Color_Conversion;
package body Soft_Drawing_Bitmap is
subtype Dispatch is Soft_Drawing_Bitmap_Buffer'Class;
----------------
-- Set_Source --
----------------
overriding
procedure Set_Source (Buffer : in out Soft_Drawing_Bitmap_Buffer;
ARGB : Bitmap_Color)
is
begin
Dispatch (Buffer).Set_Source
(Bitmap_Color_To_Word (Dispatch (Buffer).Color_Mode, ARGB));
end Set_Source;
------------
-- Source --
------------
overriding
function Source
(Buffer : Soft_Drawing_Bitmap_Buffer)
return Bitmap_Color
is
begin
return Word_To_Bitmap_Color (Dispatch (Buffer).Color_Mode,
Dispatch (Buffer).Source);
end Source;
---------------
-- Set_Pixel --
---------------
overriding
procedure Set_Pixel
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Color : Bitmap_Color)
is
begin
Dispatch (Buffer).Set_Source (Color);
Dispatch (Buffer).Set_Pixel (Pt);
end Set_Pixel;
---------------
-- Set_Pixel --
---------------
overriding
procedure Set_Pixel
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Native : UInt32)
is
begin
Dispatch (Buffer).Set_Source (Native);
Dispatch (Buffer).Set_Pixel (Pt);
end Set_Pixel;
overriding
function Pixel
(Buffer : Soft_Drawing_Bitmap_Buffer;
Pt : Point)
return Bitmap_Color
is (Word_To_Bitmap_Color (Dispatch (Buffer).Color_Mode,
Dispatch (Buffer).Pixel (Pt)));
---------------
-- Draw_Line --
---------------
overriding
procedure Draw_Line
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Start, Stop : Point;
Thickness : Natural := 1;
Fast : Boolean := True)
is
DX : constant Float := abs Float (Stop.X - Start.X);
DY : constant Float := abs Float (Stop.Y - Start.Y);
Err : Float;
X : Natural := Start.X;
Y : Natural := Start.Y;
Step_X : Integer := 1;
Step_Y : Integer := 1;
procedure Draw_Point (P : Point) with Inline;
----------------
-- Draw_Point --
----------------
procedure Draw_Point (P : Point) is
begin
if Thickness /= 1 then
if not Fast then
Dispatch (Buffer). Fill_Circle (Center => P,
Radius => Thickness / 2);
else
Dispatch (Buffer).Fill_Rect
(((P.X - (Thickness / 2), P.Y - (Thickness / 2)),
Thickness,
Thickness));
end if;
else
Dispatch (Buffer).Set_Pixel ((P.X, P.Y));
end if;
end Draw_Point;
begin
if Start.X > Stop.X then
Step_X := -1;
end if;
if Start.Y > Stop.Y then
Step_Y := -1;
end if;
if DX > DY then
Err := DX / 2.0;
while X /= Stop.X loop
Draw_Point ((X, Y));
Err := Err - DY;
if Err < 0.0 then
Y := Y + Step_Y;
Err := Err + DX;
end if;
X := X + Step_X;
end loop;
else
Err := DY / 2.0;
while Y /= Stop.Y loop
Draw_Point ((X, Y));
Err := Err - DX;
if Err < 0.0 then
X := X + Step_X;
Err := Err + DY;
end if;
Y := Y + Step_Y;
end loop;
end if;
Draw_Point ((X, Y));
end Draw_Line;
----------
-- Fill --
----------
overriding
procedure Fill
(Buffer : in out Soft_Drawing_Bitmap_Buffer)
is
begin
for Y in 0 .. Dispatch (Buffer).Height - 1 loop
for X in 0 .. Dispatch (Buffer).Width - 1 loop
Dispatch (Buffer).Set_Pixel ((X, Y));
end loop;
end loop;
end Fill;
---------------
-- Fill_Rect --
---------------
overriding
procedure Fill_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect)
is
begin
for Y0 in Area.Position.Y .. Area.Position.Y + Area.Height - 1 loop
for X0 in Area.Position.X .. Area.Position.X + Area.Width - 1 loop
Dispatch (Buffer).Set_Pixel ((X0, Y0));
end loop;
end loop;
end Fill_Rect;
---------------
-- Copy_Rect --
---------------
overriding
procedure Copy_Rect
(Src_Buffer : Bitmap_Buffer'Class;
Src_Pt : Point;
Dst_Buffer : in out Soft_Drawing_Bitmap_Buffer;
Dst_Pt : Point;
Bg_Buffer : Bitmap_Buffer'Class;
Bg_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean)
is
begin
raise Constraint_Error with "Not implemented yet.";
end Copy_Rect;
---------------
-- Copy_Rect --
---------------
overriding
procedure Copy_Rect
(Src_Buffer : Bitmap_Buffer'Class;
Src_Pt : Point;
Dst_Buffer : in out Soft_Drawing_Bitmap_Buffer;
Dst_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean)
is
pragma Unreferenced (Synchronous);
Pix : Bitmap_Color;
begin
if Src_Pt.X + Width > Src_Buffer.Width
or else
Src_Pt.Y + Height > Src_Buffer.Height
then
raise Constraint_Error with "invalid copy area for source bitmap";
end if;
if Dst_Pt.X + Width > Dispatch (Dst_Buffer).Width
or else
Dst_Pt.Y + Height > Dispatch (Dst_Buffer).Height
then
raise Constraint_Error with "invalid copy area for destination bitmap";
end if;
for X in 0 .. Width - 1 loop
for Y in 0 .. Height - 1 loop
Pix := Src_Buffer.Pixel (Src_Pt + (X, Y));
Dispatch (Dst_Buffer).Set_Source (Pix);
Dispatch (Dst_Buffer).Set_Pixel (Dst_Pt + (X, Y));
end loop;
end loop;
end Copy_Rect;
---------------------
-- Copy_Rect_Blend --
---------------------
overriding
procedure Copy_Rect_Blend
(Src_Buffer : Soft_Drawing_Bitmap_Buffer;
Src_Pt : Point;
Dst_Buffer : in out Bitmap_Buffer'Class;
Dst_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean)
is
begin
Copy_Rect
(Src_Buffer => Dispatch (Src_Buffer),
Src_Pt => Src_Pt,
Dst_Buffer => Dst_Buffer,
Dst_Pt => Dst_Pt,
Bg_Buffer => Dst_Buffer,
Bg_Pt => Dst_Pt,
Width => Width,
Height => Height,
Synchronous => Synchronous);
end Copy_Rect_Blend;
------------------------
-- Draw_Vertical_Line --
------------------------
overriding
procedure Draw_Vertical_Line
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Height : Integer)
is
begin
Fill_Rect (Dispatch (Buffer),
(Position => Pt,
Width => 1,
Height => Height));
end Draw_Vertical_Line;
--------------------------
-- Draw_Horizontal_Line --
--------------------------
overriding
procedure Draw_Horizontal_Line
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Width : Integer)
is
begin
Fill_Rect (Dispatch (Buffer),
(Position => Pt,
Width => Width,
Height => 1));
end Draw_Horizontal_Line;
---------------
-- Draw_Rect --
---------------
overriding
procedure Draw_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect;
Thickness : Natural := 1)
is
X0, Y0, X1, Y1 : Natural;
begin
X0 := Area.Position.X;
Y0 := Area.Position.Y;
X1 := Area.Position.X + Area.Width - 1;
Y1 := Area.Position.Y + Area.Height - 1;
Dispatch (Buffer).Fill_Rect
((Position => (X0 - Thickness / 2, Y0),
Width => Thickness,
Height => Area.Height + Thickness / 2));
Dispatch (Buffer).Fill_Rect
((Position => (X1 - Thickness / 2, Y0),
Width => Thickness,
Height => Area.Height + Thickness / 2));
Dispatch (Buffer).Fill_Rect
((Position => (X0, Y0 - Thickness / 2),
Width => Area.Width + Thickness / 2,
Height => Thickness));
Dispatch (Buffer).Fill_Rect
((Position => (X0, Y1 - Thickness / 2),
Width => Area. Width + Thickness / 2,
Height => Thickness));
end Draw_Rect;
-----------------------
-- Draw_Rounded_Rect --
-----------------------
overriding
procedure Draw_Rounded_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect;
Radius : Natural;
Thickness : Natural := 1)
is
F : Integer := 1 - Radius;
ddF_X : Integer := 0;
ddF_Y : Integer := (-2) * Radius;
X0 : Integer := 0;
Y0 : Integer := Radius;
Center_Top : constant Natural := Area.Position.Y + Radius;
Center_Bot : constant Natural := Area.Position.Y + Area.Height - 1 - Radius;
Center_Lft : constant Natural := Area.Position.X + Radius;
Center_Rgt : constant Natural := Area.Position.X + Area.Width - 1 - Radius;
procedure Draw_Point (X, Y : Natural) with Inline;
----------------
-- Draw_Point --
----------------
procedure Draw_Point (X, Y : Natural) is
begin
if Thickness /= 1 then
Dispatch (Buffer).Fill_Rect
((Position => (X - (Thickness / 2), Y - (Thickness / 2)),
Width => Thickness,
Height => Thickness));
else
Dispatch (Buffer).Set_Pixel ((X, Y));
end if;
end Draw_Point;
begin
if Radius = 0 then
Draw_Rect (Buffer, Area, Thickness);
return;
end if;
Dispatch (Buffer).Fill_Rect
((Position => (Area.Position.X - Thickness / 2, Area.Position.Y + Radius),
Width => Thickness,
Height => Area.Height - 2 * Radius));
Dispatch (Buffer).Fill_Rect
((Position => (Area.Position.X + Area.Width - Thickness / 2 - 1, Area.Position.Y + Radius),
Width => Thickness,
Height => Area.Height - 2 * Radius));
Dispatch (Buffer).Fill_Rect
((Position => (Area.Position.X + Radius, Area.Position.Y - Thickness / 2),
Width => Area.Width - 2 * Radius,
Height => Thickness));
Dispatch (Buffer).Fill_Rect
((Position => (Area.Position.X + Radius, Area.Position.Y + Area.Height - Thickness / 2 - 1),
Width => Area.Width - 2 * Radius,
Height => Thickness));
while X0 < Y0 loop
if F >= 0 then
Y0 := Y0 - 1;
ddF_Y := ddF_Y + 2;
F := F + ddF_Y;
end if;
X0 := X0 + 1;
ddF_X := ddF_X + 2;
F := F + ddF_X + 1;
Draw_Point (Center_Rgt + X0, Center_Bot + Y0);
Draw_Point (Center_Lft - X0, Center_Bot + Y0);
Draw_Point (Center_Rgt + X0, Center_Top - Y0);
Draw_Point (Center_Lft - X0, Center_Top - Y0);
Draw_Point (Center_Rgt + Y0, Center_Bot + X0);
Draw_Point (Center_Lft - Y0, Center_Bot + X0);
Draw_Point (Center_Rgt + Y0, Center_Top - X0);
Draw_Point (Center_Lft - Y0, Center_Top - X0);
end loop;
end Draw_Rounded_Rect;
-----------------------
-- Fill_Rounded_Rect --
-----------------------
overriding
procedure Fill_Rounded_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect;
Radius : Natural)
is
F : Integer := 1 - Radius;
ddF_X : Integer := 0;
ddF_Y : Integer := (-2) * Radius;
X0 : Integer := 0;
Y0 : Integer := Radius;
Center_Top : constant Natural := Area.Position.Y + Radius;
Center_Bot : constant Natural := Area.Position.Y + Area.Height - 1 - Radius;
Center_Lft : constant Natural := Area.Position.X + Radius;
begin
if Radius = 0 then
Dispatch (Buffer).Fill_Rect ((Position => (X0, Y0),
Width => Area.Width,
Height => Area.Height));
return;
end if;
Dispatch (Buffer).Fill_Rect
((Position => (Area.Position.X, Center_Top),
Width => Area.Width,
Height => Area.Height - 2 * Radius));
while X0 < Y0 loop
if F >= 0 then
Y0 := Y0 - 1;
ddF_Y := ddF_Y + 2;
F := F + ddF_Y;
end if;
X0 := X0 + 1;
ddF_X := ddF_X + 2;
F := F + ddF_X + 1;
Dispatch (Buffer).Draw_Horizontal_Line
((Center_Lft - X0, Center_Bot + Y0),
Area.Width - 2 * Radius + 2 * X0);
Dispatch (Buffer).Draw_Horizontal_Line
((Center_Lft - X0, Center_Top - Y0),
Area.Width - 2 * Radius + 2 * X0);
Dispatch (Buffer).Draw_Horizontal_Line
((Center_Lft - Y0, Center_Bot + X0),
Area.Width - 2 * Radius + 2 * Y0);
Dispatch (Buffer).Draw_Horizontal_Line
((Center_Lft - Y0, Center_Top - X0),
Area.Width - 2 * Radius + 2 * Y0);
end loop;
end Fill_Rounded_Rect;
-- http://rosettacode.org/wiki/Bitmap/Midpoint_circle_algorithm
-----------------
-- Draw_Circle --
-----------------
overriding
procedure Draw_Circle
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Center : Point;
Radius : Natural)
is
F : Integer := 1 - Radius;
ddF_X : Integer := 0;
ddF_Y : Integer := (-2) * Radius;
X : Integer := 0;
Y : Integer := Radius;
begin
Dispatch (Buffer).Set_Pixel ((Center.X, Center.Y + Radius));
Dispatch (Buffer).Set_Pixel ((Center.X, Center.Y - Radius));
Dispatch (Buffer).Set_Pixel ((Center.X + Radius, Center.Y));
Dispatch (Buffer).Set_Pixel ((Center.X - Radius, Center.Y));
while X < Y loop
if F >= 0 then
Y := Y - 1;
ddF_Y := ddF_Y + 2;
F := F + ddF_Y;
end if;
X := X + 1;
ddF_X := ddF_X + 2;
F := F + ddF_X + 1;
Dispatch (Buffer).Set_Pixel ((Center.X + X, Center.Y + Y));
Dispatch (Buffer).Set_Pixel ((Center.X - X, Center.Y + Y));
Dispatch (Buffer).Set_Pixel ((Center.X + X, Center.Y - Y));
Dispatch (Buffer).Set_Pixel ((Center.X - X, Center.Y - Y));
Dispatch (Buffer).Set_Pixel ((Center.X + Y, Center.Y + X));
Dispatch (Buffer).Set_Pixel ((Center.X - Y, Center.Y + X));
Dispatch (Buffer).Set_Pixel ((Center.X + Y, Center.Y - X));
Dispatch (Buffer).Set_Pixel ((Center.X - Y, Center.Y - X));
end loop;
end Draw_Circle;
-----------------
-- Fill_Circle --
-----------------
overriding
procedure Fill_Circle
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Center : Point;
Radius : Natural)
is
Buffer_Width : constant Natural := Dispatch (Buffer).Width;
Buffer_Height : constant Natural := Dispatch (Buffer).Height;
procedure Draw_Horizontal_Line (X, Y : Integer; Width : Natural);
------------------------
-- Draw_Vertical_Line --
------------------------
procedure Draw_Vertical_Line (X, Y : Integer; Height : Natural);
--------------------------
-- Draw_Horizontal_Line --
--------------------------
procedure Draw_Horizontal_Line (X, Y : Integer; Width : Natural)
is
X1, W1 : Natural;
begin
if Width = 0 then
return;
elsif Y < 0 or else Y >= Buffer_Height then
return;
elsif X + Width < 0 or else X >= Buffer_Width then
return;
end if;
if X < 0 then
X1 := 0;
W1 := Width + X;
else
X1 := X;
W1 := Width;
end if;
if X1 + W1 >= Buffer_Width then
W1 := Buffer_Width - X1 - 1;
end if;
if W1 = 0 then
return;
end if;
Dispatch (Buffer).Fill_Rect (((X1, Y), W1, 1));
end Draw_Horizontal_Line;
------------------------
-- Draw_Vertical_Line --
------------------------
procedure Draw_Vertical_Line (X, Y : Integer; Height : Natural)
is
Y1, H1 : Natural;
begin
if Height = 0 then
return;
elsif X < 0 or else X >= Buffer_Width then
return;
elsif Y + Height < 0 or else Y >= Buffer_Height then
return;
end if;
if Y < 0 then
Y1 := 0;
H1 := Height + Y;
else
Y1 := Y;
H1 := Height;
end if;
if Y1 + H1 >= Buffer_Height then
H1 := Buffer_Height - Y1 - 1;
end if;
if H1 = 0 then
return;
end if;
Dispatch (Buffer).Fill_Rect (((X, Y1), 1, H1));
end Draw_Vertical_Line;
F : Integer := 1 - Radius;
ddF_X : Integer := 1;
ddF_Y : Integer := -(2 * Radius);
X : Integer := 0;
Y : Integer := Radius;
begin
Draw_Vertical_Line
(Center.X,
Center.Y - Radius,
2 * Radius);
Draw_Horizontal_Line
(Center.X - Radius,
Center.Y,
2 * Radius);
while X < Y loop
if F >= 0 then
Y := Y - 1;
ddF_Y := ddF_Y + 2;
F := F + ddF_Y;
end if;
X := X + 1;
ddF_X := ddF_X + 2;
F := F + ddF_X;
Draw_Horizontal_Line (Center.X - X, Center.Y + Y, 2 * X);
Draw_Horizontal_Line (Center.X - X, Center.Y - Y, 2 * X);
Draw_Horizontal_Line (Center.X - Y, Center.Y + X, 2 * Y);
Draw_Horizontal_Line (Center.X - Y, Center.Y - X, 2 * Y);
end loop;
end Fill_Circle;
-------------------------
-- Cubic_Bezier_Points --
-------------------------
procedure Cubic_Bezier_Points
(P1, P2, P3, P4 : Point;
N : Positive;
Points : in out Point_Array)
is
begin
for I in Points'Range loop
declare
T : constant Float := Float (I) / Float (N);
A : constant Float := (1.0 - T)**3;
B : constant Float := 3.0 * T * (1.0 - T)**2;
C : constant Float := 3.0 * T**2 * (1.0 - T);
D : constant Float := T**3;
begin
Points (I).X := Natural (A * Float (P1.X) +
B * Float (P2.X) +
C * Float (P3.X) +
D * Float (P4.X));
Points (I).Y := Natural (A * Float (P1.Y) +
B * Float (P2.Y) +
C * Float (P3.Y) +
D * Float (P4.Y));
end;
end loop;
end Cubic_Bezier_Points;
---------------------------
-- Binomial_Coefficients --
---------------------------
procedure Binomial_Coefficients
(Outputs : in out Natural_Array)
is
N : constant Integer := Outputs'Length - 1;
F : constant Natural := Outputs'First;
L : constant Natural := Outputs'Last;
X : Natural;
begin
if N < 0 then
return;
end if;
Outputs (F) := 1;
Outputs (L) := 1;
for I in 0 .. (N / 2) - 1 loop
X := Outputs (F + I) * (N - I) / (I + 1);
Outputs (F + I + 1) := X;
Outputs (F + N - I - 1) := X;
end loop;
end Binomial_Coefficients;
-------------------
-- Bezier_Points --
-------------------
procedure Bezier_Points
(Input_Points : Point_Array;
N : Positive;
Points : in out Point_Array)
is
Degree : constant Integer := Input_Points'Last - Input_Points'First;
Binomial_Coeffs : Natural_Array (0 .. Degree);
Float_X, Float_Y, T, Total_Coeff : Float;
-----------
-- Power --
-----------
function Power (A : Float; B : Natural) return Float;
function Power (A : Float; B : Natural) return Float
is
Result : Float := 1.0;
Exp : Natural := B;
Base : Float := A;
begin
while Exp /= 0 loop
if Exp mod 2 = 1 then
Result := Result * Base;
end if;
Exp := Exp / 2;
exit when Exp = 0;
Base := Base * Base;
end loop;
return Result;
end Power;
begin
Binomial_Coefficients (Binomial_Coeffs);
for I in Points'Range loop
Float_X := 0.0;
Float_Y := 0.0;
T := Float (I) / Float (N);
for K in 0 .. Degree loop
Total_Coeff := (Float (Binomial_Coeffs (K)) * Power ((1.0 - T), (Degree - K)) * Power (T, K));
Float_X := Float_X + (Total_Coeff * Float (Input_Points (Input_Points'First + K).X));
Float_Y := Float_Y + (Total_Coeff * Float (Input_Points (Input_Points'First + K).Y));
end loop;
Points (I).X := Natural (Float_X);
Points (I).Y := Natural (Float_Y);
end loop;
end Bezier_Points;
------------------
-- Cubic_Bezier --
------------------
overriding
procedure Cubic_Bezier
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
P1, P2, P3, P4 : Point;
N : Positive := 20;
Thickness : Natural := 1)
is
Points : Point_Array (0 .. N);
begin
Cubic_Bezier_Points (P1, P2, P3, P4, N, Points);
for I in Points'First .. Points'Last - 1 loop
Dispatch (Buffer).Draw_Line (Points (I), Points (I + 1),
Thickness => Thickness);
end loop;
end Cubic_Bezier;
------------
-- Bezier --
------------
overriding
procedure Bezier
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Input_Points : Point_Array;
N : Positive := 20;
Thickness : Natural := 1)
is
Points : Point_Array (0 .. N);
begin
Bezier_Points (Input_Points, N, Points);
for I in Points'First .. Points'Last - 1 loop
Dispatch (Buffer).Draw_Line (Points (I), Points (I + 1),
Thickness => Thickness);
end loop;
end Bezier;
end Soft_Drawing_Bitmap;
|
leonhxx/pok | Ada | 673 | adb | -- POK header
--
-- The following file is a part of the POK project. Any modification should
-- be made according to the POK licence. You CANNOT use this file or a part
-- of a file for your own project.
--
-- For more information on the POK licence, please see our LICENCE FILE
--
-- Please follow the coding guidelines described in doc/CODING_GUIDELINES
--
-- Copyright (c) 2007-2021 POK team
package body Compute is
procedure Printf (String : in Interfaces.C.char_array);
pragma Import (C, Printf, "printf");
procedure Compute is
begin
Printf ("beep ");
end Compute;
end Compute;
|
JeremyGrosser/clock3 | Ada | 6,486 | ads | pragma Style_Checks (Off);
-- Copyright (c) 2018 Microchip Technology Inc.
--
-- SPDX-License-Identifier: Apache-2.0
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- This spec has been automatically generated from ATSAMD21G18A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAMD21_SVD.MTB is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype MTB_POSITION_POINTER_Field is HAL.UInt29;
-- MTB Position
type MTB_POSITION_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Pointer Value Wraps
WRAP : Boolean := False;
-- Trace Packet Location Pointer
POINTER : MTB_POSITION_POINTER_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MTB_POSITION_Register use record
Reserved_0_1 at 0 range 0 .. 1;
WRAP at 0 range 2 .. 2;
POINTER at 0 range 3 .. 31;
end record;
subtype MTB_MASTER_MASK_Field is HAL.UInt5;
-- MTB Master
type MTB_MASTER_Register is record
-- Maximum Value of the Trace Buffer in SRAM
MASK : MTB_MASTER_MASK_Field := 16#0#;
-- Trace Start Input Enable
TSTARTEN : Boolean := False;
-- Trace Stop Input Enable
TSTOPEN : Boolean := False;
-- Special Function Register Write Privilege
SFRWPRIV : Boolean := False;
-- SRAM Privilege
RAMPRIV : Boolean := False;
-- Halt Request
HALTREQ : Boolean := False;
-- unspecified
Reserved_10_30 : HAL.UInt21 := 16#0#;
-- Main Trace Enable
EN : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MTB_MASTER_Register use record
MASK at 0 range 0 .. 4;
TSTARTEN at 0 range 5 .. 5;
TSTOPEN at 0 range 6 .. 6;
SFRWPRIV at 0 range 7 .. 7;
RAMPRIV at 0 range 8 .. 8;
HALTREQ at 0 range 9 .. 9;
Reserved_10_30 at 0 range 10 .. 30;
EN at 0 range 31 .. 31;
end record;
subtype MTB_FLOW_WATERMARK_Field is HAL.UInt29;
-- MTB Flow
type MTB_FLOW_Register is record
-- Auto Stop Tracing
AUTOSTOP : Boolean := False;
-- Auto Halt Request
AUTOHALT : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Watermark value
WATERMARK : MTB_FLOW_WATERMARK_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MTB_FLOW_Register use record
AUTOSTOP at 0 range 0 .. 0;
AUTOHALT at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
WATERMARK at 0 range 3 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Cortex-M0+ Micro-Trace Buffer
type MTB_Peripheral is record
-- MTB Position
POSITION : aliased MTB_POSITION_Register;
-- MTB Master
MASTER : aliased MTB_MASTER_Register;
-- MTB Flow
FLOW : aliased MTB_FLOW_Register;
-- MTB Base
BASE : aliased HAL.UInt32;
-- MTB Integration Mode Control
ITCTRL : aliased HAL.UInt32;
-- MTB Claim Set
CLAIMSET : aliased HAL.UInt32;
-- MTB Claim Clear
CLAIMCLR : aliased HAL.UInt32;
-- MTB Lock Access
LOCKACCESS : aliased HAL.UInt32;
-- MTB Lock Status
LOCKSTATUS : aliased HAL.UInt32;
-- MTB Authentication Status
AUTHSTATUS : aliased HAL.UInt32;
-- MTB Device Architecture
DEVARCH : aliased HAL.UInt32;
-- MTB Device Configuration
DEVID : aliased HAL.UInt32;
-- MTB Device Type
DEVTYPE : aliased HAL.UInt32;
-- CoreSight
PID4 : aliased HAL.UInt32;
-- CoreSight
PID5 : aliased HAL.UInt32;
-- CoreSight
PID6 : aliased HAL.UInt32;
-- CoreSight
PID7 : aliased HAL.UInt32;
-- CoreSight
PID0 : aliased HAL.UInt32;
-- CoreSight
PID1 : aliased HAL.UInt32;
-- CoreSight
PID2 : aliased HAL.UInt32;
-- CoreSight
PID3 : aliased HAL.UInt32;
-- CoreSight
CID0 : aliased HAL.UInt32;
-- CoreSight
CID1 : aliased HAL.UInt32;
-- CoreSight
CID2 : aliased HAL.UInt32;
-- CoreSight
CID3 : aliased HAL.UInt32;
end record
with Volatile;
for MTB_Peripheral use record
POSITION at 16#0# range 0 .. 31;
MASTER at 16#4# range 0 .. 31;
FLOW at 16#8# range 0 .. 31;
BASE at 16#C# range 0 .. 31;
ITCTRL at 16#F00# range 0 .. 31;
CLAIMSET at 16#FA0# range 0 .. 31;
CLAIMCLR at 16#FA4# range 0 .. 31;
LOCKACCESS at 16#FB0# range 0 .. 31;
LOCKSTATUS at 16#FB4# range 0 .. 31;
AUTHSTATUS at 16#FB8# range 0 .. 31;
DEVARCH at 16#FBC# range 0 .. 31;
DEVID at 16#FC8# range 0 .. 31;
DEVTYPE at 16#FCC# range 0 .. 31;
PID4 at 16#FD0# range 0 .. 31;
PID5 at 16#FD4# range 0 .. 31;
PID6 at 16#FD8# range 0 .. 31;
PID7 at 16#FDC# range 0 .. 31;
PID0 at 16#FE0# range 0 .. 31;
PID1 at 16#FE4# range 0 .. 31;
PID2 at 16#FE8# range 0 .. 31;
PID3 at 16#FEC# range 0 .. 31;
CID0 at 16#FF0# range 0 .. 31;
CID1 at 16#FF4# range 0 .. 31;
CID2 at 16#FF8# range 0 .. 31;
CID3 at 16#FFC# range 0 .. 31;
end record;
-- Cortex-M0+ Micro-Trace Buffer
MTB_Periph : aliased MTB_Peripheral
with Import, Address => MTB_Base;
end SAMD21_SVD.MTB;
|
stcarrez/ada-awa | Ada | 4,466 | ads | -----------------------------------------------------------------------
-- awa-storages-stores-files -- File system store
-- Copyright (C) 2012, 2016, 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 ADO.Sessions;
with ASF.Applications.Main.Configs;
with AWA.Storages.Models;
-- === File System store ===
-- The `AWA.Storages.Stores.Files` store uses the file system to save a data content.
-- Files are stored in a directory tree whose path is created from the workspace identifier
-- and the storage identifier. The layout is such that files belonged to a given workspace
-- are stored in the same directory sub-tree.
--
-- The root directory of the file system store is configured through the
-- <b>storage_root</b> and <b>tmp_storage_root</b> configuration properties.
package AWA.Storages.Stores.Files is
-- Parameter that indicates the root directory for the file storage.
package Root_Directory_Parameter is
new ASF.Applications.Main.Configs.Parameter (Name => "storage_root",
Default => "storage");
-- Parameter that indicates the root directory for a temporary file storage.
package Tmp_Directory_Parameter is
new ASF.Applications.Main.Configs.Parameter (Name => "tmp_storage_root",
Default => "tmp");
-- ------------------------------
-- Storage Service
-- ------------------------------
type File_Store (Len : Natural) is new AWA.Storages.Stores.Store with private;
type File_Store_Access is access all File_Store'Class;
-- Create a file storage service and use the <tt>Root</tt> directory to store the files.
function Create_File_Store (Root : in String) return Store_Access;
-- Save the file represented by the `Path` variable into a store and associate that
-- content with the storage reference represented by `Into`.
overriding
procedure Save (Storage : in File_Store;
Session : in out ADO.Sessions.Master_Session;
Into : in out AWA.Storages.Models.Storage_Ref'Class;
Path : in String);
-- Load the storage item represented by `From` in a file that can be accessed locally.
overriding
procedure Load (Storage : in File_Store;
Session : in out ADO.Sessions.Session'Class;
From : in AWA.Storages.Models.Storage_Ref'Class;
Into : in out AWA.Storages.Storage_File);
-- Create a storage
overriding
procedure Create (Storage : in File_Store;
Session : in out ADO.Sessions.Master_Session;
From : in AWA.Storages.Models.Storage_Ref'Class;
Into : in out AWA.Storages.Storage_File);
-- Delete the content associate with the storage represented by `From`.
overriding
procedure Delete (Storage : in File_Store;
Session : in out ADO.Sessions.Master_Session;
From : in out AWA.Storages.Models.Storage_Ref'Class);
-- Build a path where the file store represented by <tt>Store</tt> is saved.
function Get_Path (Storage : in File_Store;
Store : in AWA.Storages.Models.Storage_Ref'Class) return String;
-- Build a path where the file store represented by <tt>Store</tt> is saved.
function Get_Path (Storage : in File_Store;
Workspace_Id : in ADO.Identifier;
File_Id : in ADO.Identifier) return String;
private
type File_Store (Len : Natural) is new AWA.Storages.Stores.Store with record
-- The root directory that contains the file system storage.
Root : String (1 .. Len);
end record;
end AWA.Storages.Stores.Files;
|
reznikmm/slimp | Ada | 1,023 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Slim.Messages.Server_setd is
type Setd_Message is new Message with private;
not overriding procedure Request_Player_Name (Self : in out Setd_Message);
private
subtype Byte is Ada.Streams.Stream_Element;
type Setd_Message is new Base_Message
(Max_8 => 1,
Max_16 => 0,
Max_32 => 0,
Max_64 => 0)
with null record;
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return Setd_Message;
overriding procedure Write
(Self : Setd_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector);
overriding procedure Visit
(Self : not null access Setd_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class);
end Slim.Messages.Server_setd;
|
MinimSecure/unum-sdk | Ada | 1,183 | adb | -- Copyright 2008-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/>.
with System;
procedure Lang_Switch is
pragma Linker_Options ("foo.o");
function C_Procedure (Msg : String) return Integer;
pragma Import(C, C_Procedure, "c_procedure");
procedure Ada_Procedure (Msg : String) is
C_Msg : String (1 .. 1024);
Tmp_Int : Integer;
begin
C_Msg (1 .. Msg'length + 1) := Msg & Ascii.Nul;
Tmp_Int := C_Procedure (Msg => C_Msg);
end Ada_Procedure;
begin
Ada_Procedure ("msg");
end Lang_Switch;
|
kjseefried/coreland-cgbc | Ada | 187 | ads | with CGBC.Bounded_Stacks;
package BS_Support is
package Natural_Stacks is new CGBC.Bounded_Stacks
(Element_Type => Natural);
Stack : Natural_Stacks.Stack (4);
end BS_Support;
|
reznikmm/matreshka | Ada | 38,815 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Classifiers;
with AMF.String_Collections;
with AMF.UML.Artifacts.Collections;
with AMF.UML.Classifier_Template_Parameters;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Collaboration_Uses.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Deployment_Specifications;
with AMF.UML.Deployments;
with AMF.UML.Element_Imports.Collections;
with AMF.UML.Features.Collections;
with AMF.UML.Generalization_Sets.Collections;
with AMF.UML.Generalizations.Collections;
with AMF.UML.Manifestations.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Operations.Collections;
with AMF.UML.Package_Imports.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements.Collections;
with AMF.UML.Properties.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.Redefinable_Template_Signatures;
with AMF.UML.String_Expressions;
with AMF.UML.Substitutions.Collections;
with AMF.UML.Template_Bindings.Collections;
with AMF.UML.Template_Parameters;
with AMF.UML.Template_Signatures;
with AMF.UML.Types;
with AMF.UML.Use_Cases.Collections;
with AMF.Visitors;
package AMF.Internals.UML_Deployment_Specifications is
type UML_Deployment_Specification_Proxy is
limited new AMF.Internals.UML_Classifiers.UML_Classifier_Proxy
and AMF.UML.Deployment_Specifications.UML_Deployment_Specification with null record;
overriding function Get_Deployment
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Deployments.UML_Deployment_Access;
-- Getter of DeploymentSpecification::deployment.
--
-- The deployment with which the DeploymentSpecification is associated.
overriding procedure Set_Deployment
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Deployments.UML_Deployment_Access);
-- Setter of DeploymentSpecification::deployment.
--
-- The deployment with which the DeploymentSpecification is associated.
overriding function Get_Deployment_Location
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.Optional_String;
-- Getter of DeploymentSpecification::deploymentLocation.
--
-- The location where an Artifact is deployed onto a Node. This is
-- typically a 'directory' or 'memory address'.
overriding procedure Set_Deployment_Location
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.Optional_String);
-- Setter of DeploymentSpecification::deploymentLocation.
--
-- The location where an Artifact is deployed onto a Node. This is
-- typically a 'directory' or 'memory address'.
overriding function Get_Execution_Location
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.Optional_String;
-- Getter of DeploymentSpecification::executionLocation.
--
-- The location where a component Artifact executes. This may be a local
-- or remote location.
overriding procedure Set_Execution_Location
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.Optional_String);
-- Setter of DeploymentSpecification::executionLocation.
--
-- The location where a component Artifact executes. This may be a local
-- or remote location.
overriding function Get_File_Name
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.Optional_String;
-- Getter of Artifact::fileName.
--
-- A concrete name that is used to refer to the Artifact in a physical
-- context. Example: file system name, universal resource locator.
overriding procedure Set_File_Name
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.Optional_String);
-- Setter of Artifact::fileName.
--
-- A concrete name that is used to refer to the Artifact in a physical
-- context. Example: file system name, universal resource locator.
overriding function Get_Manifestation
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Manifestations.Collections.Set_Of_UML_Manifestation;
-- Getter of Artifact::manifestation.
--
-- The set of model elements that are manifested in the Artifact. That is,
-- these model elements are utilized in the construction (or generation)
-- of the artifact.
overriding function Get_Nested_Artifact
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Artifacts.Collections.Set_Of_UML_Artifact;
-- Getter of Artifact::nestedArtifact.
--
-- The Artifacts that are defined (nested) within the Artifact. The
-- association is a specialization of the ownedMember association from
-- Namespace to NamedElement.
overriding function Get_Owned_Attribute
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property;
-- Getter of Artifact::ownedAttribute.
--
-- The attributes or association ends defined for the Artifact. The
-- association is a specialization of the ownedMember association.
overriding function Get_Owned_Operation
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation;
-- Getter of Artifact::ownedOperation.
--
-- The Operations defined for the Artifact. The association is a
-- specialization of the ownedMember association.
overriding function Get_Attribute
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property;
-- Getter of Classifier::attribute.
--
-- Refers to all of the Properties that are direct (i.e. not inherited or
-- imported) attributes of the classifier.
overriding function Get_Collaboration_Use
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use;
-- Getter of Classifier::collaborationUse.
--
-- References the collaboration uses owned by the classifier.
overriding function Get_Feature
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature;
-- Getter of Classifier::feature.
--
-- Specifies each feature defined in the classifier.
-- Note that there may be members of the Classifier that are of the type
-- Feature but are not included in this association, e.g. inherited
-- features.
overriding function Get_General
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of Classifier::general.
--
-- Specifies the general Classifiers for this Classifier.
-- References the general classifier in the Generalization relationship.
overriding function Get_Generalization
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization;
-- Getter of Classifier::generalization.
--
-- Specifies the Generalization relationships for this Classifier. These
-- Generalizations navigaten to more general classifiers in the
-- generalization hierarchy.
overriding function Get_Inherited_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Classifier::inheritedMember.
--
-- Specifies all elements inherited by this classifier from the general
-- classifiers.
overriding function Get_Is_Abstract
(Self : not null access constant UML_Deployment_Specification_Proxy)
return Boolean;
-- Getter of Classifier::isAbstract.
--
-- If true, the Classifier does not provide a complete declaration and can
-- typically not be instantiated. An abstract classifier is intended to be
-- used by other classifiers e.g. as the target of general
-- metarelationships or generalization relationships.
overriding function Get_Is_Final_Specialization
(Self : not null access constant UML_Deployment_Specification_Proxy)
return Boolean;
-- Getter of Classifier::isFinalSpecialization.
--
-- If true, the Classifier cannot be specialized by generalization. Note
-- that this property is preserved through package merge operations; that
-- is, the capability to specialize a Classifier (i.e.,
-- isFinalSpecialization =false) must be preserved in the resulting
-- Classifier of a package merge operation where a Classifier with
-- isFinalSpecialization =false is merged with a matching Classifier with
-- isFinalSpecialization =true: the resulting Classifier will have
-- isFinalSpecialization =false.
overriding procedure Set_Is_Final_Specialization
(Self : not null access UML_Deployment_Specification_Proxy;
To : Boolean);
-- Setter of Classifier::isFinalSpecialization.
--
-- If true, the Classifier cannot be specialized by generalization. Note
-- that this property is preserved through package merge operations; that
-- is, the capability to specialize a Classifier (i.e.,
-- isFinalSpecialization =false) must be preserved in the resulting
-- Classifier of a package merge operation where a Classifier with
-- isFinalSpecialization =false is merged with a matching Classifier with
-- isFinalSpecialization =true: the resulting Classifier will have
-- isFinalSpecialization =false.
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access;
-- Getter of Classifier::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access);
-- Setter of Classifier::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding function Get_Owned_Use_Case
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case;
-- Getter of Classifier::ownedUseCase.
--
-- References the use cases owned by this classifier.
overriding function Get_Powertype_Extent
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set;
-- Getter of Classifier::powertypeExtent.
--
-- Designates the GeneralizationSet of which the associated Classifier is
-- a power type.
overriding function Get_Redefined_Classifier
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of Classifier::redefinedClassifier.
--
-- References the Classifiers that are redefined by this Classifier.
overriding function Get_Representation
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access;
-- Getter of Classifier::representation.
--
-- References a collaboration use which indicates the collaboration that
-- represents this classifier.
overriding procedure Set_Representation
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access);
-- Setter of Classifier::representation.
--
-- References a collaboration use which indicates the collaboration that
-- represents this classifier.
overriding function Get_Substitution
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution;
-- Getter of Classifier::substitution.
--
-- References the substitutions that are owned by this Classifier.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access;
-- Getter of Classifier::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access);
-- Setter of Classifier::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Get_Use_Case
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case;
-- Getter of Classifier::useCase.
--
-- The set of use cases for which this Classifier is the subject.
overriding function Get_Element_Import
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
-- Getter of Namespace::elementImport.
--
-- References the ElementImports owned by the Namespace.
overriding function Get_Imported_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Getter of Namespace::importedMember.
--
-- References the PackageableElements that are members of this Namespace
-- as a result of either PackageImports or ElementImports.
overriding function Get_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::member.
--
-- A collection of NamedElements identifiable within the Namespace, either
-- by being owned or by being introduced by importing or inheritance.
overriding function Get_Owned_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::ownedMember.
--
-- A collection of NamedElements owned by the Namespace.
overriding function Get_Owned_Rule
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Namespace::ownedRule.
--
-- Specifies a set of Constraints owned by this Namespace.
overriding function Get_Package_Import
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
-- Getter of Namespace::packageImport.
--
-- References the PackageImports owned by the Namespace.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Package
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Packages.UML_Package_Access;
-- Getter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
overriding procedure Set_Package
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Packages.UML_Package_Access);
-- Setter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access;
-- Getter of TemplateableElement::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Deployment_Specification_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access);
-- Setter of TemplateableElement::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding function Get_Template_Binding
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding;
-- Getter of TemplateableElement::templateBinding.
--
-- The optional bindings from this element to templates.
overriding function Get_Is_Leaf
(Self : not null access constant UML_Deployment_Specification_Proxy)
return Boolean;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding procedure Set_Is_Leaf
(Self : not null access UML_Deployment_Specification_Proxy;
To : Boolean);
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding function Get_Redefined_Element
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
overriding function All_Features
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature;
-- Operation Classifier::allFeatures.
--
-- The query allFeatures() gives all of the features in the namespace of
-- the classifier. In general, through mechanisms such as inheritance,
-- this will be a larger set than feature.
overriding function Conforms_To
(Self : not null access constant UML_Deployment_Specification_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean;
-- Operation Classifier::conformsTo.
--
-- The query conformsTo() gives true for a classifier that defines a type
-- that conforms to another. This is used, for example, in the
-- specification of signature conformance for operations.
overriding function General
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Operation Classifier::general.
--
-- The general classifiers are the classifiers referenced by the
-- generalization relationships.
overriding function Has_Visibility_Of
(Self : not null access constant UML_Deployment_Specification_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean;
-- Operation Classifier::hasVisibilityOf.
--
-- The query hasVisibilityOf() determines whether a named element is
-- visible in the classifier. By default all are visible. It is only
-- called when the argument is something owned by a parent.
overriding function Inherit
(Self : not null access constant UML_Deployment_Specification_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inherit.
--
-- The query inherit() defines how to inherit a set of elements. Here the
-- operation is defined to inherit them all. It is intended to be
-- redefined in circumstances where inheritance is affected by
-- redefinition.
-- The inherit operation is overridden to exclude redefined properties.
overriding function Inheritable_Members
(Self : not null access constant UML_Deployment_Specification_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inheritableMembers.
--
-- The query inheritableMembers() gives all of the members of a classifier
-- that may be inherited in one of its descendants, subject to whatever
-- visibility restrictions apply.
overriding function Inherited_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inheritedMember.
--
-- The inheritedMember association is derived by inheriting the
-- inheritable members of the parents.
-- The inheritedMember association is derived by inheriting the
-- inheritable members of the parents.
overriding function Is_Template
(Self : not null access constant UML_Deployment_Specification_Proxy)
return Boolean;
-- Operation Classifier::isTemplate.
--
-- The query isTemplate() returns whether this templateable element is
-- actually a template.
overriding function May_Specialize_Type
(Self : not null access constant UML_Deployment_Specification_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean;
-- Operation Classifier::maySpecializeType.
--
-- The query maySpecializeType() determines whether this classifier may
-- have a generalization relationship to classifiers of the specified
-- type. By default a classifier may specialize classifiers of the same or
-- a more general type. It is intended to be redefined by classifiers that
-- have different specialization constraints.
overriding function Exclude_Collisions
(Self : not null access constant UML_Deployment_Specification_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::excludeCollisions.
--
-- The query excludeCollisions() excludes from a set of
-- PackageableElements any that would not be distinguishable from each
-- other in this namespace.
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Deployment_Specification_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
-- Operation Namespace::getNamesOfMember.
--
-- The query getNamesOfMember() takes importing into account. It gives
-- back the set of names that an element would have in an importing
-- namespace, either because it is owned, or if not owned then imported
-- individually, or if not individually then from a package.
-- The query getNamesOfMember() gives a set of all of the names that a
-- member would have in a Namespace. In general a member can have multiple
-- names in a Namespace if it is imported more than once with different
-- aliases. The query takes account of importing. It gives back the set of
-- names that an element would have in an importing namespace, either
-- because it is owned, or if not owned then imported individually, or if
-- not individually then from a package.
overriding function Import_Members
(Self : not null access constant UML_Deployment_Specification_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importMembers.
--
-- The query importMembers() defines which of a set of PackageableElements
-- are actually imported into the namespace. This excludes hidden ones,
-- i.e., those which have names that conflict with names of owned members,
-- and also excludes elements which would have the same name when imported.
overriding function Imported_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importedMember.
--
-- The importedMember property is derived from the ElementImports and the
-- PackageImports. References the PackageableElements that are members of
-- this Namespace as a result of either PackageImports or ElementImports.
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Deployment_Specification_Proxy)
return Boolean;
-- Operation Namespace::membersAreDistinguishable.
--
-- The Boolean query membersAreDistinguishable() determines whether all of
-- the namespace's members are distinguishable within it.
overriding function Owned_Member
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Namespace::ownedMember.
--
-- Missing derivation for Namespace::/ownedMember : NamedElement
overriding function All_Owning_Packages
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Deployment_Specification_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Conforms_To
(Self : not null access constant UML_Deployment_Specification_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean;
-- Operation Type::conformsTo.
--
-- The query conformsTo() gives true for a type that conforms to another.
-- By default, two types do not conform to each other. This query is
-- intended to be redefined for specific conformance situations.
overriding function Is_Compatible_With
(Self : not null access constant UML_Deployment_Specification_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ParameterableElement::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. Subclasses
-- should override this operation to specify different compatibility
-- constraints.
overriding function Is_Template_Parameter
(Self : not null access constant UML_Deployment_Specification_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding function Parameterable_Elements
(Self : not null access constant UML_Deployment_Specification_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element;
-- Operation TemplateableElement::parameterableElements.
--
-- The query parameterableElements() returns the set of elements that may
-- be used as the parametered elements for a template parameter of this
-- templateable element. By default, this set includes all the owned
-- elements. Subclasses may override this operation if they choose to
-- restrict the set of parameterable elements.
overriding function Is_Consistent_With
(Self : not null access constant UML_Deployment_Specification_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two RedefinableElements
-- in a context in which redefinition is possible, whether redefinition
-- would be logically consistent. By default, this is false; this
-- operation must be overridden for subclasses of RedefinableElement to
-- define the consistency conditions.
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Deployment_Specification_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
overriding procedure Enter_Element
(Self : not null access constant UML_Deployment_Specification_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Deployment_Specification_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Deployment_Specification_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Deployment_Specifications;
|
reznikmm/matreshka | Ada | 4,115 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Style_Background_Transparency_Attributes;
package Matreshka.ODF_Style.Background_Transparency_Attributes is
type Style_Background_Transparency_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Background_Transparency_Attributes.ODF_Style_Background_Transparency_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Background_Transparency_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Background_Transparency_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Background_Transparency_Attributes;
|
reznikmm/spawn | Ada | 11,716 | ads | --
-- Copyright (C) 2018-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
with System;
with Interfaces.C.Strings;
with Ada.Streams;
pragma Warnings (Off);
with System.Win32;
pragma Warnings (On);
package Spawn.Windows_API is
pragma Preelaborate;
subtype HANDLE is System.Win32.HANDLE;
subtype DWORD is System.Win32.DWORD;
subtype WORD is System.Win32.WORD;
subtype BOOL is System.Win32.BOOL;
subtype WCHAR is Interfaces.C.wchar_t;
subtype LPSTR is Interfaces.C.Strings.chars_ptr;
subtype LPBYTE is LPSTR;
type LPWSTR is access all WCHAR;
type UINT is new Interfaces.C.unsigned;
type LONG_PTR is mod 2 ** Standard'Address_Size;
type UINT_PTR is mod 2 ** Standard'Address_Size;
subtype LPARAM is LONG_PTR;
subtype WPARAM is UINT_PTR;
type HWND is new System.Win32.PVOID;
type STARTUPINFOW is record
cb : DWORD := 0;
lpReserved : LPWSTR;
lpDesktop : LPWSTR;
lpTitle : LPWSTR;
dwX : DWORD := 0;
dwY : DWORD := 0;
dwXSize : DWORD := 0;
dwYSize : DWORD := 0;
dwXCountChars : DWORD := 0;
dwYCountChars : DWORD := 0;
dwFillAttribute : DWORD := 0;
dwFlags : DWORD := 0;
wShowWindow : WORD := 0;
cbReserved2 : WORD := 0;
lpReserved2 : LPBYTE;
hStdInput : aliased HANDLE := 0;
hStdOutput : aliased HANDLE := 0;
hStdError : aliased HANDLE := 0;
end record
with Convention => C;
STARTF_USESTDHANDLES : constant DWORD := 16#00000100#;
-- The hStdInput, hStdOutput, and hStdError members contain additional
-- information.
--
-- If this flag is specified when calling one of the process creation
-- functions, the handles must be inheritable and the function's
-- bInheritHandles parameter must be set to TRUE.
type PROCESS_INFORMATION is record
hProcess : HANDLE;
hThread : HANDLE;
dwProcessId : DWORD := 0;
dwThreadId : DWORD;
end record
with Convention => C;
CREATE_NO_WINDOW : constant DWORD := 16#08000000#;
-- The process is a console application that is being run without a console
-- window. Therefore, the console handle for the application is not set.
CREATE_UNICODE_ENVIRONMENT : constant DWORD := 16#00000400#;
-- If this flag is set, the environment block pointed to by lpEnvironment
-- uses Unicode characters. Otherwise, the environment block uses ANSI
-- characters.
function CreateProcessW
(lpApplicationName : Interfaces.C.wchar_array;
lpCommandLine : in out Interfaces.C.wchar_array;
lpProcessAttributes : access System.Win32.SECURITY_ATTRIBUTES;
lpThreadAttributes : access System.Win32.SECURITY_ATTRIBUTES;
bInheritHandles : BOOL;
dwCreationFlags : DWORD;
lpEnvironment : Interfaces.C.wchar_array;
lpCurrentDirectory : Interfaces.C.wchar_array;
lpStartupInfo : access STARTUPINFOW;
lpProcessInformation : access PROCESS_INFORMATION)
return BOOL
with Import, Convention => Stdcall, External_Name => "CreateProcessW";
function TerminateProcess
(hProcess : HANDLE;
uExitCode : UINT) return BOOL
with Import, Convention => Stdcall, External_Name => "TerminateProcess";
type OVERLAPPED is record
Internal : System.Address := System.Null_Address;
InternalHigh : System.Address := System.Null_Address;
Offset : DWORD := 0;
OffsetHigh : DWORD := 0;
hEvent : HANDLE := 0;
end record;
generic
type CUSTOM_OVERLAPPED is limited private;
package Generic_Read_Write_Ex is
type Callback is access procedure
(dwErrorCode : DWORD;
dwNumberOfBytesTransfered : DWORD;
lpOverlapped : access CUSTOM_OVERLAPPED)
with Convention => Stdcall;
function ReadFileEx
(hFile : HANDLE;
lpBuffer : out Ada.Streams.Stream_Element_Array;
nNumberOfBytesToRead : DWORD;
lpOverlapped : access CUSTOM_OVERLAPPED;
lpCompletionRoutine : Callback)
return BOOL
with Import, Convention => Stdcall, External_Name => "ReadFileEx";
function WriteFileEx
(hFile : HANDLE;
lpBuffer : Ada.Streams.Stream_Element_Array;
nNumberOfBytesToWrite : DWORD;
lpOverlapped : access CUSTOM_OVERLAPPED;
lpCompletionRoutine : Callback)
return BOOL
with Import, Convention => Stdcall,
External_Name => "WriteFileEx";
end Generic_Read_Write_Ex;
function CancelIo (hFile : HANDLE) return BOOL
with Import, Convention => Stdcall, External_Name => "CancelIo";
function CreateNamedPipeA
(lpName : Interfaces.C.Strings.chars_ptr;
dwOpenMode : DWORD;
dwPipeMode : DWORD;
nMaxInstances : DWORD;
nOutBufferSize : DWORD;
nInBufferSize : DWORD;
nDefaultTimeOut : DWORD;
lpSecurityAttributes : access System.Win32.SECURITY_ATTRIBUTES)
return HANDLE
with Import, Convention => Stdcall,
External_Name => "CreateNamedPipeA";
PIPE_ACCESS_INBOUND : constant DWORD := 16#1#;
-- The flow of data in the pipe goes from client to server only. This mode
-- gives the server the equivalent of GENERIC_READ access to the pipe. The
-- client must specify GENERIC_WRITE access when connecting to the pipe.
PIPE_ACCESS_OUTBOUND : constant DWORD := 16#2#;
-- The flow of data in the pipe goes from server to client only. This mode
-- gives the server the equivalent of GENERIC_WRITE access to the pipe. The
-- client must specify GENERIC_READ access when connecting to the pipe.
FILE_FLAG_OVERLAPPED : constant DWORD := 16#40000000#;
PIPE_TYPE_BYTE : constant DWORD := 0;
PIPE_WAIT : constant DWORD := 0;
PIPE_REJECT_REMOTE_CLINETS : constant DWORD := 16#0000_0008#;
PIPE_UNLIMITED_INSTANCES : constant DWORD := 255;
Pipe_Name_Prefix : constant String := "\\.\pipe\";
function ConnectNamedPipe
(hNamedPipe : HANDLE;
lpOverlapped : access OVERLAPPED) return BOOL
with Import, Convention => Stdcall, External_Name => "ConnectNamedPipe";
function CreateFileA
(lpFileName : Interfaces.C.Strings.chars_ptr;
dwDesiredAccess : DWORD;
dwShareMode : DWORD;
lpSecurityAttributes : access System.Win32.SECURITY_ATTRIBUTES;
dwCreationDisposition : DWORD;
dwFlagsAndAttributes : DWORD;
hTemplateFile : HANDLE) return HANDLE
with Import, Convention => Stdcall, External_Name => "CreateFileA";
function CreateEventW
(lpSecurityAttributes : access System.Win32.SECURITY_ATTRIBUTES;
bManualReset : BOOL;
bInitialState : BOOL;
lpName : LPWSTR)
return HANDLE
with Import, Convention => Stdcall, External_Name => "CreateEventW";
function SetEvent (hEvent : HANDLE) return BOOL
with Import, Convention => Stdcall, External_Name => "SetEvent";
type HANDLE_Array is array (Positive range <>) of HANDLE;
function WaitForMultipleObjectsEx
(nCount : DWORD;
lpHandles : HANDLE_Array;
bWaitAll : BOOL;
dwMilliseconds : DWORD;
bAlertable : BOOL)
return DWORD
with Import, Convention => Stdcall,
External_Name => "WaitForMultipleObjectsEx";
MAXIMUM_WAIT_OBJECTS : constant := 64;
WAIT_IO_COMPLETION : constant DWORD := 16#C0#;
WAIT_TIMEOUT : constant DWORD := 16#102#;
function GetExitCodeProcess
(hProcess : HANDLE;
lpExitCode : access DWORD)
return BOOL
with Import, Convention => Stdcall,
External_Name => "GetExitCodeProcess";
subtype Environment_Block is
Interfaces.C.wchar_array (1 .. Interfaces.C.size_t'Last);
type Environment_Block_Access is access all Environment_Block;
function GetEnvironmentStringsW return Environment_Block_Access
with Import, Convention => Stdcall,
External_Name => "GetEnvironmentStringsW";
function FreeEnvironmentStringsW
(lpszEnvironmentBlock : Environment_Block_Access)
return BOOL
with Import, Convention => Stdcall,
External_Name => "FreeEnvironmentStringsW";
function Get_Handle
(fd : Interfaces.C.int)
return HANDLE
with Import, Convention => Stdcall,
External_Name => "_get_osfhandle";
ERROR_SUCCESS : constant DWORD := 0;
ERROR_PIPE_BUSY : constant DWORD := 231;
ERROR_PIPE_CONNECTED : constant DWORD := 535;
ERROR_OPERATION_ABORTED : constant DWORD := 995;
-- he I/O operation has been aborted because of either a thread exit or an
-- application request.
ERROR_IO_PENDING : constant DWORD := 997;
function SearchPath
(lpPath : LPWSTR;
lpFileName : LPWSTR;
lpExtension : LPWSTR;
nBufferLength : DWORD;
lpBuffer : LPWSTR;
lpFilePart : access LPWSTR)
return DWORD
with Import, Convention => Stdcall,
External_Name => "SearchPathW";
-- Searches for a specified file in a specified path
MAX_PATH : constant := 32767;
-- Max file name length. Legacy MAX_PATH was 256
function GetCurrentProcessId return DWORD
with Import, Convention => Stdcall,
External_Name => "GetCurrentProcessId";
type WNDENUMPROC is access function
(HWnd : Windows_API.HWND;
Param : LPARAM) return BOOL;
function EnumWindows
(lpEnumFunc : WNDENUMPROC;
lParam : Windows_API.LPARAM) return BOOL
with Import, Convention => Stdcall, External_Name => "EnumWindows";
function GetWindowThreadProcessId
(hWnd : Windows_API.HWND;
lpdwProcessId : access DWORD) return DWORD
with Import,
Convention => Stdcall,
External_Name => "GetWindowThreadProcessId";
WM_CLOSE : constant := 16#0010#;
function PostMessageW
(hWnd : Windows_API.HWND;
Msg : UINT;
wParam : Windows_API.WPARAM;
lParam : Windows_API.LPARAM) return BOOL
with Import, Convention => Stdcall, External_Name => "PostMessageW";
function PostThreadMessageW
(idThread : DWORD;
Msg : UINT;
wParam : Windows_API.WPARAM;
lParam : Windows_API.LPARAM) return BOOL
with Import, Convention => Stdcall, External_Name => "PostThreadMessageW";
function FormatMessageW
(dwFlags : DWORD;
lpSource : System.Address;
dwMessageId : DWORD;
dwLanguageId : DWORD;
lpBuffer : out LPWSTR;
nSize : DWORD;
Arguments : System.Address) return DWORD
with Import, Convention => Stdcall, External_Name => "FormatMessageW";
FORMAT_MESSAGE_ALLOCATE_BUFFER : constant DWORD := 16#100#;
FORMAT_MESSAGE_FROM_SYSTEM : constant DWORD := 16#10000#;
FORMAT_MESSAGE_IGNORE_INSERTS : constant DWORD := 16#200#;
function MAKELANGID (P : DWORD; S : DWORD) return DWORD;
LANG_NEUTRAL : constant := 16#0#;
SUBLANG_DEFAULT : constant := 16#1#;
function LocalFree (hMem : System.Address) return System.Address
with Import, Convention => Stdcall, External_Name => "LocalAlloc";
end Spawn.Windows_API;
|
Fabien-Chouteau/motherlode | Ada | 2,152 | adb | -- Motherlode
-- Copyright (c) 2020 Fabien Chouteau
with PyGamer; use PyGamer;
with HAL; use HAL;
with Sound;
with PyGamer.Controls;
with PyGamer.Time;
with Parameters;
with World; use World;
with Player;
with Cargo_Menu;
with Equipment_Menu;
with Render;
package body Motherload is
-----------------
-- Draw_Screen --
-----------------
procedure Draw_Screen (FB : in out HAL.UInt16_Array) is
begin
Render.Draw_World (FB);
end Draw_Screen;
---------
-- Run --
---------
procedure Run is
Period : constant Time.Time_Ms := Parameters.Frame_Period;
Next_Release : Time.Time_Ms;
begin
Next_Release := Time.Clock;
Sound.Stop_Music;
Generate_Ground;
Player.Spawn;
loop
Controls.Scan;
if Controls.Pressed (Controls.Up) then
Player.Move_Up;
elsif Controls.Pressed (Controls.Down) then
Player.Move_Down;
end if;
if Controls.Pressed (Controls.Left) then
Player.Move_Left;
elsif Controls.Pressed (Controls.Right) then
Player.Move_Right;
end if;
if Controls.Pressed (Controls.A) then
Player.Drill;
end if;
if Controls.Falling (Controls.Sel) then
Cargo_Menu.Run;
Next_Release := Time.Clock;
end if;
-- Fuel pump
if Player.Position.Y in 16 * 2 .. 16 * 3
and then
Player.Position.X in 16 * 25 .. 16 * 26
then
Equipment_Menu.Run;
Next_Release := Time.Clock;
Player.Move ((Parameters.Spawn_X, Parameters.Spawn_Y));
end if;
if Render.Flip then
Render.Refresh_Screen (Render.FB1'Access);
Draw_Screen (Render.FB2);
else
Render.Refresh_Screen (Render.FB2'Access);
Draw_Screen (Render.FB1);
end if;
Render.Flip := not Render.Flip;
Player.Update;
Sound.Tick;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Run;
end Motherload;
|
reznikmm/matreshka | Ada | 4,085 | 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.Db_Default_Cell_Style_Name_Attributes;
package Matreshka.ODF_Db.Default_Cell_Style_Name_Attributes is
type Db_Default_Cell_Style_Name_Attribute_Node is
new Matreshka.ODF_Db.Abstract_Db_Attribute_Node
and ODF.DOM.Db_Default_Cell_Style_Name_Attributes.ODF_Db_Default_Cell_Style_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Default_Cell_Style_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Db_Default_Cell_Style_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Db.Default_Cell_Style_Name_Attributes;
|
jwarwick/aoc_2020 | Ada | 130 | ads | with AUnit.Test_Suites; use AUnit.Test_Suites;
package AOC_Suite is
function Suite return Access_Test_Suite;
end AOC_Suite;
|
flyx/OpenGLAda | Ada | 5,831 | ads | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Interfaces.C.Pointers;
with GL.Vectors;
with GL.Matrices;
generic
type Element_Type is private;
type Index_Type is (<>);
with function "+" (Left, Right : Element_Type) return Element_Type is <>;
with function "-" (Left, Right : Element_Type) return Element_Type is <>;
with function "-" (Left : Element_Type) return Element_Type is <>;
with function "*" (Left, Right : Element_Type) return Element_Type is <>;
with function "/" (Left, Right : Element_Type) return Element_Type is <>;
Null_Value, One_Value : Element_Type;
package GL.Algebra is
pragma Preelaborate;
-----------------------------------------------------------------------------
-- Vector types --
-----------------------------------------------------------------------------
package Vectors2 is new Vectors (Index_Type => Index_2D,
Element_Type => Element_Type);
package Vectors3 is new Vectors (Index_Type => Index_3D,
Element_Type => Element_Type);
package Vectors4 is new Vectors (Index_Type => Index_Homogeneous,
Element_Type => Element_Type);
type Vector2 is new Vectors2.Vector;
type Vector3 is new Vectors3.Vector;
type Vector4 is new Vectors4.Vector;
-- Conversion functions between vectors. Default values are:
-- Z = 0, W = 1
function To_Vector2 (Vector : Vector3) return Vector2;
function To_Vector2 (Vector : Vector4) return Vector2;
function To_Vector3 (Vector : Vector2) return Vector3;
function To_Vector3 (Vector : Vector4) return Vector3;
function To_Vector4 (Vector : Vector2) return Vector4;
function To_Vector4 (Vector : Vector3) return Vector4;
pragma Inline (To_Vector2);
pragma Inline (To_Vector3);
pragma Inline (To_Vector4);
-----------------------------------------------------------------------------
-- Matrix types --
-----------------------------------------------------------------------------
package Matrices2 is new Matrices (Index_Type => Index_2D,
Element_Type => Element_Type,
Vector_Type => Vector2);
package Matrices3 is new Matrices (Index_Type => Index_3D,
Element_Type => Element_Type,
Vector_Type => Vector3);
package Matrices4 is new Matrices (Index_Type => Index_Homogeneous,
Element_Type => Element_Type,
Vector_Type => Vector4);
type Matrix2 is new Matrices2.Matrix;
type Matrix3 is new Matrices3.Matrix;
type Matrix4 is new Matrices4.Matrix;
Identity2 : constant Matrix2 := ((One_Value, Null_Value), (Null_Value, One_Value));
Identity3 : constant Matrix3 := ((One_Value, Null_Value, Null_Value),
(Null_Value, One_Value, Null_Value),
(Null_Value, Null_Value, One_Value));
Identity4 : constant Matrix4 := ((One_Value, Null_Value, Null_Value, Null_Value),
(Null_Value, One_Value, Null_Value, Null_Value),
(Null_Value, Null_Value, One_Value, Null_Value),
(Null_Value, Null_Value, Null_Value, One_Value));
-----------------------------------------------------------------------------
-- Array types --
-----------------------------------------------------------------------------
type Vector2_Array is array (Index_Type range <>) of aliased Vector2;
type Vector3_Array is array (Index_Type range <>) of aliased Vector3;
type Vector4_Array is array (Index_Type range <>) of aliased Vector4;
type Matrix2_Array is array (Index_Type range <>) of aliased Matrix2;
type Matrix3_Array is array (Index_Type range <>) of aliased Matrix3;
type Matrix4_Array is array (Index_Type range <>) of aliased Matrix4;
pragma Convention (C, Vector2_Array);
pragma Convention (C, Vector3_Array);
pragma Convention (C, Vector4_Array);
pragma Convention (C, Matrix2_Array);
pragma Convention (C, Matrix3_Array);
pragma Convention (C, Matrix4_Array);
-----------------------------------------------------------------------------
-- Pointer types --
-- note: These instances of the Pointers package do not have a usable --
-- default terminator. Only use the size-based subroutines. --
-----------------------------------------------------------------------------
package Vector2_Pointers is new Interfaces.C.Pointers
(Index_Type, Vector2, Vector2_Array, Vector2'(others => <>));
package Vector3_Pointers is new Interfaces.C.Pointers
(Index_Type, Vector3, Vector3_Array, Vector3'(others => <>));
package Vector4_Pointers is new Interfaces.C.Pointers
(Index_Type, Vector4, Vector4_Array, Vector4'(others => <>));
package Matrix2_Pointers is new Interfaces.C.Pointers
(Index_Type, Matrix2, Matrix2_Array, Matrix2'(others => (others => <>)));
package Matrix3_Pointers is new Interfaces.C.Pointers
(Index_Type, Matrix3, Matrix3_Array, Matrix3'(others => (others => <>)));
package Matrix4_Pointers is new Interfaces.C.Pointers
(Index_Type, Matrix4, Matrix4_Array, Matrix4'(others => (others => <>)));
function Cross_Product (Left, Right : Vector3) return Vector3;
end GL.Algebra;
|
reznikmm/matreshka | Ada | 4,059 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009 Vadim Godunko <[email protected]> --
-- --
-- Matreshka is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. Matreshka 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 distributed with Matreshka; see file COPYING. --
-- If not, write to the Free Software Foundation, 51 Franklin Street, --
-- Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with Matreshka.Internals.Host_Types;
package body Matreshka.Internals.Markable_Address_Utilities is
use Matreshka.Internals.Host_Types;
type Pointer is mod 2 ** Address_Size;
for Pointer'Size use Address_Size;
function Convert is
new Ada.Unchecked_Conversion (System.Address, Pointer);
function Convert is
new Ada.Unchecked_Conversion (Pointer, System.Address);
---------------
-- Is_Marked --
---------------
function Is_Marked (Value : System.Address) return Boolean is
begin
return (Convert (Value) and Address_Mark_Bit) /= 0;
end Is_Marked;
----------
-- Mark --
----------
procedure Mark (Value : in out System.Address) is
begin
Value := Convert (Convert (Value) or Address_Mark_Bit);
end Mark;
---------------
-- To_Marked --
---------------
function To_Marked (Value : System.Address) return System.Address is
begin
return Convert (Convert (Value) or Address_Mark_Bit);
end To_Marked;
-----------------
-- To_Unmarked --
-----------------
function To_Unmarked (Value : System.Address) return System.Address is
begin
return Convert (Convert (Value) and Address_Mark_Mask);
end To_Unmarked;
------------
-- Unmark --
------------
procedure Unmark (Value : in out System.Address) is
begin
Value := Convert (Convert (Value) and Address_Mark_Mask);
end Unmark;
end Matreshka.Internals.Markable_Address_Utilities;
|
reznikmm/matreshka | Ada | 9,462 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.Atomics.Counters;
with Matreshka.Internals.Strings;
with Matreshka.Internals.Unicode.Ucd;
with Matreshka.Internals.Utf16;
package Matreshka.Internals.Regexps is
pragma Preelaborate;
-------------
-- Pattern --
-------------
-- Abstract Syntax Tree
type General_Category_Flags is
array (Matreshka.Internals.Unicode.Ucd.General_Category) of Boolean;
pragma Pack (General_Category_Flags);
type Property_Kinds is (None, General_Category, Binary);
type Property_Value (Kind : Property_Kinds := None) is record
case Kind is
when None =>
null;
when General_Category =>
GC_Flags : General_Category_Flags;
when Binary =>
Property : Matreshka.Internals.Unicode.Ucd.Boolean_Properties;
end case;
end record;
type Node_List is record
Parent : Natural;
Head : Natural;
Tail : Natural;
end record;
type Node_List_Count is new Natural;
subtype Node_List_Index is Node_List_Count range 1 .. Node_List_Count'Last;
type Node_Kinds is
(N_None,
N_Subexpression,
N_Match_Any,
N_Match_Code,
N_Match_Property,
N_Member_Code,
N_Member_Range,
N_Member_Property,
N_Character_Class,
N_Multiplicity,
N_Alternation,
N_Anchor);
type Node (Kind : Node_Kinds := N_None) is record
case Kind is
when N_None =>
null;
when others =>
List : Node_List_Count;
Previous : Natural;
Next : Natural;
-- Doubly linked list of nodes.
case Kind is
when N_None =>
null;
when N_Subexpression =>
Subexpression : Node_List_Count;
Capture : Boolean;
Index : Natural;
when N_Match_Any =>
null;
when N_Match_Code | N_Member_Code =>
Code : Matreshka.Internals.Unicode.Code_Point;
-- Code point to match or code point as member of character
-- class.
when N_Match_Property | N_Member_Property =>
Value : Property_Value;
Negative : Boolean;
when N_Member_Range =>
Low : Matreshka.Internals.Unicode.Code_Point;
High : Matreshka.Internals.Unicode.Code_Point;
-- Range of code points as member of character class
when N_Character_Class =>
Negated : Boolean;
Members : Node_List_Count;
when N_Multiplicity =>
Item : Node_List_Count;
-- Link to expression
Greedy : Boolean;
Lower : Natural;
Upper : Natural;
when N_Alternation =>
Preferred : Node_List_Count;
Fallback : Node_List_Count;
when N_Anchor =>
Start_Of_Line : Boolean;
End_Of_Line : Boolean;
end case;
end case;
end record;
type AST_Array is array (Positive range <>) of Node;
type Node_List_Array is array (Node_List_Index range <>) of Node_List;
type Shared_Pattern (Size : Natural; List_Size : Node_List_Count) is limited
record
Counter : Matreshka.Atomics.Counters.Counter;
-- Atomic reference counter.
AST : AST_Array (1 .. Size);
List : Node_List_Array (1 .. List_Size);
Last : Natural := 0;
Last_List : Node_List_Count := 0;
Start : Node_List_Count := 0;
Captures : Natural := 0;
end record;
type Shared_Pattern_Access is access all Shared_Pattern;
Empty_Shared_Pattern : aliased Shared_Pattern (0, 0);
procedure Reference (Item : not null Shared_Pattern_Access);
procedure Dereference (Item : in out Shared_Pattern_Access);
-----------
-- Match --
-----------
type Shared_String_Array is
array (Natural range <>)
of aliased Matreshka.Internals.Strings.Shared_String_Access;
type Slice is record
First_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
First_Index : Positive;
Next_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
Next_Index : Positive;
end record;
-- Slice represent slice in the source Shared_String. Next points to the
-- first character after the slice.
type Slice_Array is array (Natural range <>) of Slice;
type Shared_Match (Groups : Natural) is limited record
Counter : Matreshka.Atomics.Counters.Counter;
-- Atomic reference counter.
Is_Matched : Boolean := False;
-- Flag is object contains match information or not.
Source : Matreshka.Internals.Strings.Shared_String_Access;
-- Reference to source string.
Number : Natural;
-- Number of actual subexpression captures.
Slices : Slice_Array (0 .. Groups);
-- Slices of captured data.
Captures : Shared_String_Array (0 .. Groups);
-- pragma Volatile (Captures);
-- Actual captured data.
end record;
-- Shared match is a results of the match of the string to pattern. When
-- shared object is constructed, only slices information is filled. Actual
-- captures is constructed lazy on request.
type Shared_Match_Access is access all Shared_Match;
Empty_Shared_Match : aliased Shared_Match :=
(Groups => 0,
Counter => <>,
Is_Matched => False,
Source => null,
Number => 0,
Slices => (others => (0, 1, 0, 1)),
Captures => (others => null));
procedure Reference (Item : not null Shared_Match_Access);
procedure Dereference (Item : in out Shared_Match_Access);
function Capture
(Item : not null Shared_Match_Access;
Number : Natural)
return not null Matreshka.Internals.Strings.Shared_String_Access;
end Matreshka.Internals.Regexps;
|
sebsgit/textproc | Ada | 436 | ads | with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package ShapeMatchingTests is
type TestCase is new AUnit.Test_Cases.Test_Case with null record;
procedure Register_Tests(T: in out TestCase);
function Name(T: TestCase) return Message_String;
procedure testBasicShapes(T : in out Test_Cases.Test_Case'Class);
procedure testComplexImage(T: in out Test_Cases.Test_Case'Class);
end ShapeMatchingTests;
|
PThierry/ewok-kernel | Ada | 3,140 | ads | with m4.mpu;
with types;
package soc.layout
with spark_mode => on
is
FLASH_BASE : constant system_address := 16#0800_0000#;
FLASH_SIZE : constant := 1 * MBYTE;
SRAM_BASE : constant system_address := 16#1000_0000#;
SRAM_SIZE : constant := 64 * KBYTE;
BOOT_ROM_BASE : constant system_address := 16#1FFF_0000#;
RAM_BASE : constant system_address := 16#2000_0000#; -- SRAM
RAM_SIZE : constant := 128 * KBYTE;
PERIPH_BASE : constant system_address := 16#4000_0000#;
MEMORY_BANK1_BASE : constant system_address := 16#6000_0000#;
MEMORY_BANK2_BASE : constant system_address := MEMORY_BANK1_BASE;
APB1PERIPH_BASE : constant system_address := PERIPH_BASE;
APB2PERIPH_BASE : constant system_address := PERIPH_BASE + 16#0001_0000#;
AHB1PERIPH_BASE : constant system_address := PERIPH_BASE + 16#0002_0000#;
AHB2PERIPH_BASE : constant system_address := PERIPH_BASE + 16#1000_0000#;
--
-- AHB1 peripherals
--
GPIOA_BASE : constant system_address := AHB1PERIPH_BASE + 16#0000#;
GPIOB_BASE : constant system_address := AHB1PERIPH_BASE + 16#0400#;
GPIOC_BASE : constant system_address := AHB1PERIPH_BASE + 16#0800#;
GPIOD_BASE : constant system_address := AHB1PERIPH_BASE + 16#0C00#;
GPIOE_BASE : constant system_address := AHB1PERIPH_BASE + 16#1000#;
GPIOF_BASE : constant system_address := AHB1PERIPH_BASE + 16#1400#;
GPIOG_BASE : constant system_address := AHB1PERIPH_BASE + 16#1800#;
GPIOH_BASE : constant system_address := AHB1PERIPH_BASE + 16#1C00#;
GPIOI_BASE : constant system_address := AHB1PERIPH_BASE + 16#2000#;
DMA1_BASE : constant system_address := AHB1PERIPH_BASE + 16#6000#;
DMA2_BASE : constant system_address := AHB1PERIPH_BASE + 16#6400#;
--
-- APB2 peripherals
--
SYSCFG_BASE : constant system_address := APB2PERIPH_BASE + 16#3800#;
--
-- Flash and firmware structure
--
--
-- Flip bank
FW1_SIZE : constant unsigned_32 := 576*1024;
FW1_KERN_BASE : constant unsigned_32 := 16#08020000#;
FW1_KERN_SIZE : constant unsigned_32 := 64*1024;
FW1_KERN_REGION_SIZE : constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_64KB;
FW1_USER_BASE : constant unsigned_32 := 16#08080000#;
FW1_USER_SIZE : constant unsigned_32 := 512*1024;
FW1_USER_REGION_SIZE : constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_512KB;
-- DFU 1
DFU1_SIZE : constant unsigned_32 := 320*1024;
DFU1_KERN_BASE : constant unsigned_32 := 16#08030000#;
DFU1_USER_BASE : constant unsigned_32 := 16#08040000#;
DFU1_KERN_SIZE : constant unsigned_32 := 64*1024;
DFU1_KERN_REGION_SIZE: constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_64KB;
DFU1_USER_SIZE : constant unsigned_32 := 256*1024;
DFU1_USER_REGION_SIZE: constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_256KB;
-- STM32F429 has 1MB flash that can be mapped at a time, which forbid
-- the usage of efficient dual banking.
-- This layout does not declare the complete dual bank
end soc.layout;
|
zhmu/ananas | Ada | 131 | adb | package body Lto22_Pkg2 is
function F return Rec is
Var_1 : Rec;
begin
return Var_1;
end;
end Lto22_Pkg2;
|
Fabien-Chouteau/lvgl-ada-simulator | Ada | 45 | adb | procedure Check is
begin
null;
end Check;
|
zhmu/ananas | Ada | 3,295 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S Y N C H R O N O U S _ B A R R I E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package Ada.Synchronous_Barriers with SPARK_Mode => Off is
pragma Preelaborate (Synchronous_Barriers);
subtype Barrier_Limit is Positive range 1 .. Positive'Last;
type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is
limited private;
procedure Wait_For_Release
(The_Barrier : in out Synchronous_Barrier;
Notified : out Boolean);
private
protected type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is
entry Wait (Notified : out Boolean);
private
Keep_Open : Boolean := False;
end Synchronous_Barrier;
end Ada.Synchronous_Barriers;
|
stcarrez/ada-awa | Ada | 12,941 | adb | -----------------------------------------------------------------------
-- awa-tests-helpers-users -- Unit tests for AWA users
-- Copyright (C) 2011 - 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Tests;
with Util.Log.Loggers;
with ASF.Principals;
with ASF.Tests;
with ASF.Responses.Mockup;
with AWA.Applications;
with AWA.Users.Modules;
with ADO.Sessions;
with ADO.SQL;
package body AWA.Tests.Helpers.Users is
use AWA.Users.Services;
use type AWA.Users.Principals.Principal_Access;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Tests.Helpers.Users");
MAX_USERS : constant Positive := 10;
Logged_Users : array (1 .. MAX_USERS) of AWA.Users.Principals.Principal_Access;
procedure Free is
new Ada.Unchecked_Deallocation (Object => AWA.Users.Principals.Principal'Class,
Name => AWA.Users.Principals.Principal_Access);
-- ------------------------------
-- Initialize the service context.
-- ------------------------------
overriding
procedure Initialize (Principal : in out Test_User) is
begin
-- Setup the service context.
Principal.Context.Set_Context (AWA.Tests.Get_Application, null);
if Principal.Manager = null then
Principal.Manager := AWA.Users.Modules.Get_User_Manager;
if Principal.Manager = null then
Log.Error ("There is no User_Manager in the application.");
end if;
end if;
end Initialize;
-- ------------------------------
-- Create a test user associated with the given email address.
-- Get an open session for that user. If the user already exists, no error is reported.
-- ------------------------------
procedure Create_User (Principal : in out Test_User;
Email : in String) is
DB : ADO.Sessions.Session;
Query : ADO.SQL.Query;
Found : Boolean;
Key : AWA.Users.Models.Access_Key_Ref;
begin
Initialize (Principal);
DB := Principal.Manager.Get_Session;
-- Find the user
Query.Set_Join ("inner join awa_email e on e.user_id = o.id");
Query.Set_Filter ("e.email = ?");
Query.Bind_Param (1, Email);
Principal.User.Find (DB, Query, Found);
if not Found then
Principal.User.Set_First_Name ("Joe");
Principal.User.Set_Last_Name ("Pot");
Principal.Email.Set_Email (Email);
Principal.Manager.Create_User (Principal.User, Principal.Email,
"admin", Key, True);
Find_Access_Key (Principal, Email, Key);
-- Run the verification and get the user and its session
Principal.Manager.Verify_User (Key.Get_Access_Key, "192.168.1.1",
Principal.Principal);
else
Principal.Manager.Authenticate (Email => Email,
Password => "admin",
IpAddr => "192.168.1.1",
Principal => Principal.Principal);
end if;
Principal.User := Principal.Principal.Get_User;
Principal.Session := Principal.Principal.Get_Session;
end Create_User;
-- ------------------------------
-- Create a test user for a new test and get an open session.
-- ------------------------------
procedure Create_User (Principal : in out Test_User) is
Key : AWA.Users.Models.Access_Key_Ref;
Email : constant String := "Joe-" & Util.Tests.Get_Uuid & "@gmail.com";
begin
Initialize (Principal);
Principal.User.Set_First_Name ("Joe");
Principal.User.Set_Last_Name ("Pot");
Principal.Email.Set_Email (Email);
Principal.Manager.Create_User (Principal.User, Principal.Email, "admin", Key, True);
Find_Access_Key (Principal, Email, Key);
-- Run the verification and get the user and its session
Principal.Manager.Verify_User (Key.Get_Access_Key, "192.168.1.1",
Principal.Principal);
Principal.User := Principal.Principal.Get_User;
Principal.Session := Principal.Principal.Get_Session;
end Create_User;
-- ------------------------------
-- Find the access key associated with a user (if any).
-- ------------------------------
procedure Find_Access_Key (Principal : in out Test_User;
Email : in String;
Key : in out AWA.Users.Models.Access_Key_Ref) is
DB : ADO.Sessions.Session;
Query : ADO.SQL.Query;
Found : Boolean;
Signup_Kind : constant Integer
:= AWA.Users.Models.Key_Type'Pos (AWA.Users.Models.SIGNUP_KEY);
Password_Kind : constant Integer
:= AWA.Users.Models.Key_Type'Pos (AWA.Users.Models.RESET_PASSWORD_KEY);
begin
Initialize (Principal);
DB := Principal.Manager.Get_Session;
-- Find the access key
Query.Set_Join ("inner join awa_email e on e.user_id = o.user_id");
Query.Set_Filter ("e.email = ? AND o.kind = ?");
Query.Bind_Param (1, Email);
Query.Bind_Param (2, Signup_Kind);
Key.Find (DB, Query, Found);
if not Found then
Query.Bind_Param (2, Password_Kind);
Key.Find (DB, Query, Found);
if not Found then
Log.Error ("Cannot find access key for email {0}", Email);
end if;
end if;
end Find_Access_Key;
-- ------------------------------
-- Login a user and create a session
-- ------------------------------
procedure Login (Principal : in out Test_User) is
begin
Initialize (Principal);
Principal.Manager.Authenticate (Email => Principal.Email.Get_Email,
Password => "admin",
IpAddr => "192.168.1.1",
Principal => Principal.Principal);
Principal.User := Principal.Principal.Get_User;
Principal.Session := Principal.Principal.Get_Session;
end Login;
-- ------------------------------
-- Logout the user and closes the current session.
-- ------------------------------
procedure Logout (Principal : in out Test_User) is
begin
Initialize (Principal);
Principal.Manager.Close_Session (Principal.Session.Get_Id, True);
end Logout;
-- ------------------------------
-- Simulate a user login in the given service context.
-- ------------------------------
procedure Login (Context : in out AWA.Services.Contexts.Service_Context'Class;
Sec_Context : in out Security.Contexts.Security_Context;
Email : in String) is
User : Test_User;
Principal : AWA.Users.Principals.Principal_Access;
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
begin
AWA.Tests.Set_Application_Context;
Create_User (User, Email);
Principal := AWA.Users.Principals.Create (User.User, User.Session);
Context.Set_Context (App, Principal);
Sec_Context.Set_Context (Manager => App.Get_Security_Manager,
Principal => Principal.all'Access);
-- Keep track of the Principal instance so that Tear_Down will release it.
-- Most tests will call Login but don't call Logout because there is no real purpose
-- for the test in doing that and it allows to keep the unit test simple. This creates
-- memory leak because the Principal instance is not freed.
for I in Logged_Users'Range loop
if Logged_Users (I) = null then
Logged_Users (I) := Principal;
exit;
end if;
end loop;
end Login;
-- ------------------------------
-- Simulate a user login on the request. Upon successful login, a session that is
-- authentified is associated with the request object.
-- ------------------------------
procedure Login (Email : in String;
Request : in out ASF.Requests.Mockup.Request'Class) is
User : Test_User;
Reply : ASF.Responses.Mockup.Response;
begin
Create_User (User, Email);
ASF.Tests.Do_Get (Request, Reply, "/auth/login.html", "login-user-1.html");
Request.Set_Parameter ("email", Email);
Request.Set_Parameter ("password", "admin");
Request.Set_Parameter ("login-button", "1");
ASF.Tests.Set_CSRF (Request, "login", "login-user-1.html");
ASF.Tests.Do_Post (Request, Reply, "/auth/login.html", "login-user-2.html");
end Login;
-- ------------------------------
-- Setup the context and security context to simulate an anonymous user.
-- ------------------------------
procedure Anonymous (Context : in out AWA.Services.Contexts.Service_Context'Class;
Sec_Context : in out Security.Contexts.Security_Context) is
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
begin
AWA.Tests.Set_Application_Context;
Context.Set_Context (App, null);
Sec_Context.Set_Context (Manager => App.Get_Security_Manager,
Principal => null);
end Anonymous;
-- ------------------------------
-- Simulate the recovery password process for the given user.
-- ------------------------------
procedure Recover_Password (Email : in String) is
use type ASF.Principals.Principal_Access;
Request : ASF.Requests.Mockup.Request;
Reply : ASF.Responses.Mockup.Response;
begin
ASF.Tests.Do_Get (Request, Reply, "/auth/lost-password.html", "lost-password-1.html");
Request.Set_Parameter ("email", Email);
Request.Set_Parameter ("lost-password-button", "1");
ASF.Tests.Set_CSRF (Request, "lost-password", "lost-password-1.html");
ASF.Tests.Do_Post (Request, Reply, "/auth/lost-password.html", "lost-password-2.html");
if Reply.Get_Status /= ASF.Responses.SC_MOVED_TEMPORARILY then
Log.Error ("Invalid redirect after lost password");
end if;
-- Now, get the access key and simulate a click on the reset password link.
declare
Principal : AWA.Tests.Helpers.Users.Test_User;
Key : AWA.Users.Models.Access_Key_Ref;
begin
AWA.Tests.Set_Application_Context;
AWA.Tests.Helpers.Users.Find_Access_Key (Principal, Email, Key);
if not Key.Is_Null then
Log.Error ("There is no access key associated with the user");
end if;
ASF.Tests.Do_Get (Request, Reply, "/auth/change-password.html", "reset-password-1.html");
-- Simulate user clicking on the reset password link.
-- This verifies the key, login the user and redirect him to the change-password page
Request.Set_Parameter ("key", Key.Get_Access_Key);
Request.Set_Parameter ("password", "admin");
Request.Set_Parameter ("reset-password", "1");
ASF.Tests.Set_CSRF (Request, "reset-password-form", "reset-password-1.html");
ASF.Tests.Do_Post (Request, Reply, "/auth/change-password.html", "reset-password-2.html");
if Reply.Get_Status /= ASF.Responses.SC_MOVED_TEMPORARILY then
Log.Error ("Invalid response");
end if;
-- Check that the user is logged and we have a user principal now.
if Request.Get_User_Principal = null then
Log.Error ("A user principal should be defined");
end if;
end;
end Recover_Password;
overriding
procedure Finalize (Principal : in out Test_User) is
begin
Free (Principal.Principal);
end Finalize;
-- ------------------------------
-- Cleanup and release the Principal that have been allocated from the Login session
-- but not released because the Logout is not called from the unit test.
-- ------------------------------
procedure Tear_Down is
begin
for I in Logged_Users'Range loop
if Logged_Users (I) /= null then
Free (Logged_Users (I));
end if;
end loop;
end Tear_Down;
end AWA.Tests.Helpers.Users;
|
reznikmm/matreshka | Ada | 5,109 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Internals.Utp_Elements;
with AMF.UML.Call_Operation_Actions;
with AMF.Utp.Validation_Actions;
with AMF.Visitors;
package AMF.Internals.Utp_Validation_Actions is
type Utp_Validation_Action_Proxy is
limited new AMF.Internals.Utp_Elements.Utp_Element_Proxy
and AMF.Utp.Validation_Actions.Utp_Validation_Action with null record;
overriding function Get_Base_Call_Operation_Action
(Self : not null access constant Utp_Validation_Action_Proxy)
return AMF.UML.Call_Operation_Actions.UML_Call_Operation_Action_Access;
-- Getter of ValidationAction::base_CallOperationAction.
--
overriding procedure Set_Base_Call_Operation_Action
(Self : not null access Utp_Validation_Action_Proxy;
To : AMF.UML.Call_Operation_Actions.UML_Call_Operation_Action_Access);
-- Setter of ValidationAction::base_CallOperationAction.
--
overriding procedure Enter_Element
(Self : not null access constant Utp_Validation_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant Utp_Validation_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant Utp_Validation_Action_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.Utp_Validation_Actions;
|
Gabriel-Degret/adalib | Ada | 1,339 | ads | -- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package Ada.Strings.UTF_Encoding.Wide_Wide_Strings is
pragma Pure (Wide_Wide_Strings);
-- Encoding / decoding between Wide_Wide_String and various encoding schemes
function Encode (Item : Wide_Wide_String;
Output_Scheme : Encoding_Scheme;
Output_BOM : Boolean := False) return UTF_String;
function Encode (Item : Wide_Wide_String;
Output_BOM : Boolean := False) return UTF_8_String;
function Encode (Item : Wide_Wide_String;
Output_BOM : Boolean := False)
return UTF_16_Wide_String;
function Decode (Item : UTF_String;
Input_Scheme : Encoding_Scheme) return Wide_Wide_String;
function Decode (Item : UTF_8_String) return Wide_Wide_String;
function Decode (Item : UTF_16_Wide_String) return Wide_Wide_String;
end Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
|
reznikmm/matreshka | Ada | 79,187 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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 body AMF.Internals.Tables.CMOF_Metamodel is
------------------
-- MM_CMOF_CMOF --
------------------
function MM_CMOF_CMOF return AMF.Internals.CMOF_Element is
begin
return Base + 189;
end MM_CMOF_CMOF;
---------------------
-- MC_CMOF_Boolean --
---------------------
function MC_CMOF_Boolean return AMF.Internals.CMOF_Element is
begin
return Base + 192;
end MC_CMOF_Boolean;
---------------------
-- MC_CMOF_Integer --
---------------------
function MC_CMOF_Integer return AMF.Internals.CMOF_Element is
begin
return Base + 190;
end MC_CMOF_Integer;
--------------------------------------
-- MC_CMOF_Parameter_Direction_Kind --
--------------------------------------
function MC_CMOF_Parameter_Direction_Kind return AMF.Internals.CMOF_Element is
begin
return Base + 737;
end MC_CMOF_Parameter_Direction_Kind;
--------------------
-- MC_CMOF_String --
--------------------
function MC_CMOF_String return AMF.Internals.CMOF_Element is
begin
return Base + 194;
end MC_CMOF_String;
-------------------------------
-- MC_CMOF_Unlimited_Natural --
-------------------------------
function MC_CMOF_Unlimited_Natural return AMF.Internals.CMOF_Element is
begin
return Base + 196;
end MC_CMOF_Unlimited_Natural;
-----------------------------
-- MC_CMOF_Visibility_Kind --
-----------------------------
function MC_CMOF_Visibility_Kind return AMF.Internals.CMOF_Element is
begin
return Base + 747;
end MC_CMOF_Visibility_Kind;
-------------------------
-- MC_CMOF_Association --
-------------------------
function MC_CMOF_Association return AMF.Internals.CMOF_Element is
begin
return Base + 1;
end MC_CMOF_Association;
--------------------------------
-- MC_CMOF_Behavioral_Feature --
--------------------------------
function MC_CMOF_Behavioral_Feature return AMF.Internals.CMOF_Element is
begin
return Base + 2;
end MC_CMOF_Behavioral_Feature;
-------------------
-- MC_CMOF_Class --
-------------------
function MC_CMOF_Class return AMF.Internals.CMOF_Element is
begin
return Base + 3;
end MC_CMOF_Class;
------------------------
-- MC_CMOF_Classifier --
------------------------
function MC_CMOF_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 4;
end MC_CMOF_Classifier;
---------------------
-- MC_CMOF_Comment --
---------------------
function MC_CMOF_Comment return AMF.Internals.CMOF_Element is
begin
return Base + 5;
end MC_CMOF_Comment;
------------------------
-- MC_CMOF_Constraint --
------------------------
function MC_CMOF_Constraint return AMF.Internals.CMOF_Element is
begin
return Base + 6;
end MC_CMOF_Constraint;
-----------------------
-- MC_CMOF_Data_Type --
-----------------------
function MC_CMOF_Data_Type return AMF.Internals.CMOF_Element is
begin
return Base + 7;
end MC_CMOF_Data_Type;
-----------------------------------
-- MC_CMOF_Directed_Relationship --
-----------------------------------
function MC_CMOF_Directed_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 8;
end MC_CMOF_Directed_Relationship;
---------------------
-- MC_CMOF_Element --
---------------------
function MC_CMOF_Element return AMF.Internals.CMOF_Element is
begin
return Base + 9;
end MC_CMOF_Element;
----------------------------
-- MC_CMOF_Element_Import --
----------------------------
function MC_CMOF_Element_Import return AMF.Internals.CMOF_Element is
begin
return Base + 10;
end MC_CMOF_Element_Import;
-------------------------
-- MC_CMOF_Enumeration --
-------------------------
function MC_CMOF_Enumeration return AMF.Internals.CMOF_Element is
begin
return Base + 11;
end MC_CMOF_Enumeration;
---------------------------------
-- MC_CMOF_Enumeration_Literal --
---------------------------------
function MC_CMOF_Enumeration_Literal return AMF.Internals.CMOF_Element is
begin
return Base + 12;
end MC_CMOF_Enumeration_Literal;
------------------------
-- MC_CMOF_Expression --
------------------------
function MC_CMOF_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 13;
end MC_CMOF_Expression;
---------------------
-- MC_CMOF_Feature --
---------------------
function MC_CMOF_Feature return AMF.Internals.CMOF_Element is
begin
return Base + 14;
end MC_CMOF_Feature;
----------------------------------
-- MC_CMOF_Multiplicity_Element --
----------------------------------
function MC_CMOF_Multiplicity_Element return AMF.Internals.CMOF_Element is
begin
return Base + 15;
end MC_CMOF_Multiplicity_Element;
---------------------------
-- MC_CMOF_Named_Element --
---------------------------
function MC_CMOF_Named_Element return AMF.Internals.CMOF_Element is
begin
return Base + 16;
end MC_CMOF_Named_Element;
-----------------------
-- MC_CMOF_Namespace --
-----------------------
function MC_CMOF_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 17;
end MC_CMOF_Namespace;
-------------------------------
-- MC_CMOF_Opaque_Expression --
-------------------------------
function MC_CMOF_Opaque_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 18;
end MC_CMOF_Opaque_Expression;
-----------------------
-- MC_CMOF_Operation --
-----------------------
function MC_CMOF_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 19;
end MC_CMOF_Operation;
---------------------
-- MC_CMOF_Package --
---------------------
function MC_CMOF_Package return AMF.Internals.CMOF_Element is
begin
return Base + 20;
end MC_CMOF_Package;
----------------------------
-- MC_CMOF_Package_Import --
----------------------------
function MC_CMOF_Package_Import return AMF.Internals.CMOF_Element is
begin
return Base + 21;
end MC_CMOF_Package_Import;
---------------------------
-- MC_CMOF_Package_Merge --
---------------------------
function MC_CMOF_Package_Merge return AMF.Internals.CMOF_Element is
begin
return Base + 22;
end MC_CMOF_Package_Merge;
---------------------------------
-- MC_CMOF_Packageable_Element --
---------------------------------
function MC_CMOF_Packageable_Element return AMF.Internals.CMOF_Element is
begin
return Base + 23;
end MC_CMOF_Packageable_Element;
-----------------------
-- MC_CMOF_Parameter --
-----------------------
function MC_CMOF_Parameter return AMF.Internals.CMOF_Element is
begin
return Base + 24;
end MC_CMOF_Parameter;
----------------------------
-- MC_CMOF_Primitive_Type --
----------------------------
function MC_CMOF_Primitive_Type return AMF.Internals.CMOF_Element is
begin
return Base + 25;
end MC_CMOF_Primitive_Type;
----------------------
-- MC_CMOF_Property --
----------------------
function MC_CMOF_Property return AMF.Internals.CMOF_Element is
begin
return Base + 26;
end MC_CMOF_Property;
---------------------------------
-- MC_CMOF_Redefinable_Element --
---------------------------------
function MC_CMOF_Redefinable_Element return AMF.Internals.CMOF_Element is
begin
return Base + 27;
end MC_CMOF_Redefinable_Element;
--------------------------
-- MC_CMOF_Relationship --
--------------------------
function MC_CMOF_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 28;
end MC_CMOF_Relationship;
--------------------------------
-- MC_CMOF_Structural_Feature --
--------------------------------
function MC_CMOF_Structural_Feature return AMF.Internals.CMOF_Element is
begin
return Base + 29;
end MC_CMOF_Structural_Feature;
-----------------
-- MC_CMOF_Tag --
-----------------
function MC_CMOF_Tag return AMF.Internals.CMOF_Element is
begin
return Base + 30;
end MC_CMOF_Tag;
------------------
-- MC_CMOF_Type --
------------------
function MC_CMOF_Type return AMF.Internals.CMOF_Element is
begin
return Base + 31;
end MC_CMOF_Type;
---------------------------
-- MC_CMOF_Typed_Element --
---------------------------
function MC_CMOF_Typed_Element return AMF.Internals.CMOF_Element is
begin
return Base + 32;
end MC_CMOF_Typed_Element;
---------------------------------
-- MC_CMOF_Value_Specification --
---------------------------------
function MC_CMOF_Value_Specification return AMF.Internals.CMOF_Element is
begin
return Base + 33;
end MC_CMOF_Value_Specification;
------------------------------------------------
-- MP_CMOF_Association_End_Type_A_Association --
------------------------------------------------
function MP_CMOF_Association_End_Type_A_Association return AMF.Internals.CMOF_Element is
begin
return Base + 34;
end MP_CMOF_Association_End_Type_A_Association;
------------------------------------
-- MP_CMOF_Association_Is_Derived --
------------------------------------
function MP_CMOF_Association_Is_Derived return AMF.Internals.CMOF_Element is
begin
return Base + 79;
end MP_CMOF_Association_Is_Derived;
---------------------------------------------------------
-- MP_CMOF_Association_Member_End_Property_Association --
---------------------------------------------------------
function MP_CMOF_Association_Member_End_Property_Association return AMF.Internals.CMOF_Element is
begin
return Base + 35;
end MP_CMOF_Association_Member_End_Property_Association;
-----------------------------------------------------------
-- MP_CMOF_Association_Navigable_Owned_End_A_Association --
-----------------------------------------------------------
function MP_CMOF_Association_Navigable_Owned_End_A_Association return AMF.Internals.CMOF_Element is
begin
return Base + 36;
end MP_CMOF_Association_Navigable_Owned_End_A_Association;
---------------------------------------------------------------
-- MP_CMOF_Association_Owned_End_Property_Owning_Association --
---------------------------------------------------------------
function MP_CMOF_Association_Owned_End_Property_Owning_Association return AMF.Internals.CMOF_Element is
begin
return Base + 37;
end MP_CMOF_Association_Owned_End_Property_Owning_Association;
---------------------------------------------------------------------
-- MP_CMOF_Behavioral_Feature_Owned_Parameter_A_Owner_Formal_Param --
---------------------------------------------------------------------
function MP_CMOF_Behavioral_Feature_Owned_Parameter_A_Owner_Formal_Param return AMF.Internals.CMOF_Element is
begin
return Base + 38;
end MP_CMOF_Behavioral_Feature_Owned_Parameter_A_Owner_Formal_Param;
----------------------------------------------------------------------
-- MP_CMOF_Behavioral_Feature_Raised_Exception_A_Behavioral_Feature --
----------------------------------------------------------------------
function MP_CMOF_Behavioral_Feature_Raised_Exception_A_Behavioral_Feature return AMF.Internals.CMOF_Element is
begin
return Base + 39;
end MP_CMOF_Behavioral_Feature_Raised_Exception_A_Behavioral_Feature;
-------------------------------
-- MP_CMOF_Class_Is_Abstract --
-------------------------------
function MP_CMOF_Class_Is_Abstract return AMF.Internals.CMOF_Element is
begin
return Base + 80;
end MP_CMOF_Class_Is_Abstract;
--------------------------------------------------
-- MP_CMOF_Class_Owned_Attribute_Property_Class --
--------------------------------------------------
function MP_CMOF_Class_Owned_Attribute_Property_Class return AMF.Internals.CMOF_Element is
begin
return Base + 40;
end MP_CMOF_Class_Owned_Attribute_Property_Class;
---------------------------------------------------
-- MP_CMOF_Class_Owned_Operation_Operation_Class --
---------------------------------------------------
function MP_CMOF_Class_Owned_Operation_Operation_Class return AMF.Internals.CMOF_Element is
begin
return Base + 41;
end MP_CMOF_Class_Owned_Operation_Operation_Class;
---------------------------------------
-- MP_CMOF_Class_Super_Class_A_Class --
---------------------------------------
function MP_CMOF_Class_Super_Class_A_Class return AMF.Internals.CMOF_Element is
begin
return Base + 42;
end MP_CMOF_Class_Super_Class_A_Class;
-----------------------------------------------
-- MP_CMOF_Classifier_Attribute_A_Classifier --
-----------------------------------------------
function MP_CMOF_Classifier_Attribute_A_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 43;
end MP_CMOF_Classifier_Attribute_A_Classifier;
-------------------------------------------------------------
-- MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier --
-------------------------------------------------------------
function MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 44;
end MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier;
---------------------------------------------
-- MP_CMOF_Classifier_General_A_Classifier --
---------------------------------------------
function MP_CMOF_Classifier_General_A_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 45;
end MP_CMOF_Classifier_General_A_Classifier;
------------------------------------------------------
-- MP_CMOF_Classifier_Inherited_Member_A_Classifier --
------------------------------------------------------
function MP_CMOF_Classifier_Inherited_Member_A_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 46;
end MP_CMOF_Classifier_Inherited_Member_A_Classifier;
------------------------------------------------
-- MP_CMOF_Classifier_Is_Final_Specialization --
------------------------------------------------
function MP_CMOF_Classifier_Is_Final_Specialization return AMF.Internals.CMOF_Element is
begin
return Base + 81;
end MP_CMOF_Classifier_Is_Final_Specialization;
-------------------------------------------------
-- MP_CMOF_Comment_Annotated_Element_A_Comment --
-------------------------------------------------
function MP_CMOF_Comment_Annotated_Element_A_Comment return AMF.Internals.CMOF_Element is
begin
return Base + 47;
end MP_CMOF_Comment_Annotated_Element_A_Comment;
--------------------------
-- MP_CMOF_Comment_Body --
--------------------------
function MP_CMOF_Comment_Body return AMF.Internals.CMOF_Element is
begin
return Base + 82;
end MP_CMOF_Comment_Body;
---------------------------------------------------------
-- MP_CMOF_Constraint_Constrained_Element_A_Constraint --
---------------------------------------------------------
function MP_CMOF_Constraint_Constrained_Element_A_Constraint return AMF.Internals.CMOF_Element is
begin
return Base + 48;
end MP_CMOF_Constraint_Constrained_Element_A_Constraint;
-----------------------------------------------------
-- MP_CMOF_Constraint_Context_Namespace_Owned_Rule --
-----------------------------------------------------
function MP_CMOF_Constraint_Context_Namespace_Owned_Rule return AMF.Internals.CMOF_Element is
begin
return Base + 83;
end MP_CMOF_Constraint_Context_Namespace_Owned_Rule;
----------------------------------------------------------
-- MP_CMOF_Constraint_Specification_A_Owning_Constraint --
----------------------------------------------------------
function MP_CMOF_Constraint_Specification_A_Owning_Constraint return AMF.Internals.CMOF_Element is
begin
return Base + 84;
end MP_CMOF_Constraint_Specification_A_Owning_Constraint;
---------------------------------------------------------
-- MP_CMOF_Data_Type_Owned_Attribute_Property_Datatype --
---------------------------------------------------------
function MP_CMOF_Data_Type_Owned_Attribute_Property_Datatype return AMF.Internals.CMOF_Element is
begin
return Base + 49;
end MP_CMOF_Data_Type_Owned_Attribute_Property_Datatype;
----------------------------------------------------------
-- MP_CMOF_Data_Type_Owned_Operation_Operation_Datatype --
----------------------------------------------------------
function MP_CMOF_Data_Type_Owned_Operation_Operation_Datatype return AMF.Internals.CMOF_Element is
begin
return Base + 50;
end MP_CMOF_Data_Type_Owned_Operation_Operation_Datatype;
------------------------------------------------------------------
-- MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship --
------------------------------------------------------------------
function MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 51;
end MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship;
------------------------------------------------------------------
-- MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship --
------------------------------------------------------------------
function MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 52;
end MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship;
----------------------------------------------------
-- MP_CMOF_Element_Owned_Comment_A_Owning_Element --
----------------------------------------------------
function MP_CMOF_Element_Owned_Comment_A_Owning_Element return AMF.Internals.CMOF_Element is
begin
return Base + 53;
end MP_CMOF_Element_Owned_Comment_A_Owning_Element;
-------------------------------------------------
-- MP_CMOF_Element_Owned_Element_Element_Owner --
-------------------------------------------------
function MP_CMOF_Element_Owned_Element_Element_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 54;
end MP_CMOF_Element_Owned_Element_Element_Owner;
-------------------------------------------------
-- MP_CMOF_Element_Owner_Element_Owned_Element --
-------------------------------------------------
function MP_CMOF_Element_Owner_Element_Owned_Element return AMF.Internals.CMOF_Element is
begin
return Base + 85;
end MP_CMOF_Element_Owner_Element_Owned_Element;
----------------------------------
-- MP_CMOF_Element_Import_Alias --
----------------------------------
function MP_CMOF_Element_Import_Alias return AMF.Internals.CMOF_Element is
begin
return Base + 86;
end MP_CMOF_Element_Import_Alias;
--------------------------------------------------------------
-- MP_CMOF_Element_Import_Imported_Element_A_Element_Import --
--------------------------------------------------------------
function MP_CMOF_Element_Import_Imported_Element_A_Element_Import return AMF.Internals.CMOF_Element is
begin
return Base + 87;
end MP_CMOF_Element_Import_Imported_Element_A_Element_Import;
-------------------------------------------------------------------------
-- MP_CMOF_Element_Import_Importing_Namespace_Namespace_Element_Import --
-------------------------------------------------------------------------
function MP_CMOF_Element_Import_Importing_Namespace_Namespace_Element_Import return AMF.Internals.CMOF_Element is
begin
return Base + 88;
end MP_CMOF_Element_Import_Importing_Namespace_Namespace_Element_Import;
---------------------------------------
-- MP_CMOF_Element_Import_Visibility --
---------------------------------------
function MP_CMOF_Element_Import_Visibility return AMF.Internals.CMOF_Element is
begin
return Base + 89;
end MP_CMOF_Element_Import_Visibility;
-----------------------------------------------------------------------
-- MP_CMOF_Enumeration_Owned_Literal_Enumeration_Literal_Enumeration --
-----------------------------------------------------------------------
function MP_CMOF_Enumeration_Owned_Literal_Enumeration_Literal_Enumeration return AMF.Internals.CMOF_Element is
begin
return Base + 55;
end MP_CMOF_Enumeration_Owned_Literal_Enumeration_Literal_Enumeration;
-----------------------------------------------------------------------
-- MP_CMOF_Enumeration_Literal_Enumeration_Enumeration_Owned_Literal --
-----------------------------------------------------------------------
function MP_CMOF_Enumeration_Literal_Enumeration_Enumeration_Owned_Literal return AMF.Internals.CMOF_Element is
begin
return Base + 90;
end MP_CMOF_Enumeration_Literal_Enumeration_Enumeration_Owned_Literal;
---------------------------------------------
-- MP_CMOF_Expression_Operand_A_Expression --
---------------------------------------------
function MP_CMOF_Expression_Operand_A_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 56;
end MP_CMOF_Expression_Operand_A_Expression;
-------------------------------------------------------------
-- MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature --
-------------------------------------------------------------
function MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature return AMF.Internals.CMOF_Element is
begin
return Base + 57;
end MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature;
---------------------------------------------
-- MP_CMOF_Multiplicity_Element_Is_Ordered --
---------------------------------------------
function MP_CMOF_Multiplicity_Element_Is_Ordered return AMF.Internals.CMOF_Element is
begin
return Base + 91;
end MP_CMOF_Multiplicity_Element_Is_Ordered;
--------------------------------------------
-- MP_CMOF_Multiplicity_Element_Is_Unique --
--------------------------------------------
function MP_CMOF_Multiplicity_Element_Is_Unique return AMF.Internals.CMOF_Element is
begin
return Base + 92;
end MP_CMOF_Multiplicity_Element_Is_Unique;
----------------------------------------
-- MP_CMOF_Multiplicity_Element_Lower --
----------------------------------------
function MP_CMOF_Multiplicity_Element_Lower return AMF.Internals.CMOF_Element is
begin
return Base + 93;
end MP_CMOF_Multiplicity_Element_Lower;
----------------------------------------
-- MP_CMOF_Multiplicity_Element_Upper --
----------------------------------------
function MP_CMOF_Multiplicity_Element_Upper return AMF.Internals.CMOF_Element is
begin
return Base + 94;
end MP_CMOF_Multiplicity_Element_Upper;
--------------------------------
-- MP_CMOF_Named_Element_Name --
--------------------------------
function MP_CMOF_Named_Element_Name return AMF.Internals.CMOF_Element is
begin
return Base + 95;
end MP_CMOF_Named_Element_Name;
------------------------------------------------------------
-- MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member --
------------------------------------------------------------
function MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member return AMF.Internals.CMOF_Element is
begin
return Base + 96;
end MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member;
------------------------------------------
-- MP_CMOF_Named_Element_Qualified_Name --
------------------------------------------
function MP_CMOF_Named_Element_Qualified_Name return AMF.Internals.CMOF_Element is
begin
return Base + 97;
end MP_CMOF_Named_Element_Qualified_Name;
--------------------------------------
-- MP_CMOF_Named_Element_Visibility --
--------------------------------------
function MP_CMOF_Named_Element_Visibility return AMF.Internals.CMOF_Element is
begin
return Base + 98;
end MP_CMOF_Named_Element_Visibility;
-------------------------------------------------------------------------
-- MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace --
-------------------------------------------------------------------------
function MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 58;
end MP_CMOF_Namespace_Element_Import_Element_Import_Importing_Namespace;
---------------------------------------------------
-- MP_CMOF_Namespace_Imported_Member_A_Namespace --
---------------------------------------------------
function MP_CMOF_Namespace_Imported_Member_A_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 59;
end MP_CMOF_Namespace_Imported_Member_A_Namespace;
------------------------------------------
-- MP_CMOF_Namespace_Member_A_Namespace --
------------------------------------------
function MP_CMOF_Namespace_Member_A_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 60;
end MP_CMOF_Namespace_Member_A_Namespace;
------------------------------------------------------------
-- MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace --
------------------------------------------------------------
function MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 61;
end MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace;
-----------------------------------------------------
-- MP_CMOF_Namespace_Owned_Rule_Constraint_Context --
-----------------------------------------------------
function MP_CMOF_Namespace_Owned_Rule_Constraint_Context return AMF.Internals.CMOF_Element is
begin
return Base + 62;
end MP_CMOF_Namespace_Owned_Rule_Constraint_Context;
-------------------------------------------------------------------------
-- MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace --
-------------------------------------------------------------------------
function MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 63;
end MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace;
------------------------------------
-- MP_CMOF_Opaque_Expression_Body --
------------------------------------
function MP_CMOF_Opaque_Expression_Body return AMF.Internals.CMOF_Element is
begin
return Base + 99;
end MP_CMOF_Opaque_Expression_Body;
----------------------------------------
-- MP_CMOF_Opaque_Expression_Language --
----------------------------------------
function MP_CMOF_Opaque_Expression_Language return AMF.Internals.CMOF_Element is
begin
return Base + 100;
end MP_CMOF_Opaque_Expression_Language;
-----------------------------------------------------
-- MP_CMOF_Operation_Body_Condition_A_Body_Context --
-----------------------------------------------------
function MP_CMOF_Operation_Body_Condition_A_Body_Context return AMF.Internals.CMOF_Element is
begin
return Base + 101;
end MP_CMOF_Operation_Body_Condition_A_Body_Context;
---------------------------------------------------
-- MP_CMOF_Operation_Class_Class_Owned_Operation --
---------------------------------------------------
function MP_CMOF_Operation_Class_Class_Owned_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 102;
end MP_CMOF_Operation_Class_Class_Owned_Operation;
----------------------------------------------------------
-- MP_CMOF_Operation_Datatype_Data_Type_Owned_Operation --
----------------------------------------------------------
function MP_CMOF_Operation_Datatype_Data_Type_Owned_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 103;
end MP_CMOF_Operation_Datatype_Data_Type_Owned_Operation;
----------------------------------
-- MP_CMOF_Operation_Is_Ordered --
----------------------------------
function MP_CMOF_Operation_Is_Ordered return AMF.Internals.CMOF_Element is
begin
return Base + 104;
end MP_CMOF_Operation_Is_Ordered;
--------------------------------
-- MP_CMOF_Operation_Is_Query --
--------------------------------
function MP_CMOF_Operation_Is_Query return AMF.Internals.CMOF_Element is
begin
return Base + 105;
end MP_CMOF_Operation_Is_Query;
---------------------------------
-- MP_CMOF_Operation_Is_Unique --
---------------------------------
function MP_CMOF_Operation_Is_Unique return AMF.Internals.CMOF_Element is
begin
return Base + 106;
end MP_CMOF_Operation_Is_Unique;
-----------------------------
-- MP_CMOF_Operation_Lower --
-----------------------------
function MP_CMOF_Operation_Lower return AMF.Internals.CMOF_Element is
begin
return Base + 107;
end MP_CMOF_Operation_Lower;
-----------------------------------------------------------
-- MP_CMOF_Operation_Owned_Parameter_Parameter_Operation --
-----------------------------------------------------------
function MP_CMOF_Operation_Owned_Parameter_Parameter_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 64;
end MP_CMOF_Operation_Owned_Parameter_Parameter_Operation;
----------------------------------------------------
-- MP_CMOF_Operation_Postcondition_A_Post_Context --
----------------------------------------------------
function MP_CMOF_Operation_Postcondition_A_Post_Context return AMF.Internals.CMOF_Element is
begin
return Base + 65;
end MP_CMOF_Operation_Postcondition_A_Post_Context;
--------------------------------------------------
-- MP_CMOF_Operation_Precondition_A_Pre_Context --
--------------------------------------------------
function MP_CMOF_Operation_Precondition_A_Pre_Context return AMF.Internals.CMOF_Element is
begin
return Base + 66;
end MP_CMOF_Operation_Precondition_A_Pre_Context;
----------------------------------------------------
-- MP_CMOF_Operation_Raised_Exception_A_Operation --
----------------------------------------------------
function MP_CMOF_Operation_Raised_Exception_A_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 67;
end MP_CMOF_Operation_Raised_Exception_A_Operation;
-------------------------------------------------------
-- MP_CMOF_Operation_Redefined_Operation_A_Operation --
-------------------------------------------------------
function MP_CMOF_Operation_Redefined_Operation_A_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 68;
end MP_CMOF_Operation_Redefined_Operation_A_Operation;
----------------------------------------
-- MP_CMOF_Operation_Type_A_Operation --
----------------------------------------
function MP_CMOF_Operation_Type_A_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 108;
end MP_CMOF_Operation_Type_A_Operation;
-----------------------------
-- MP_CMOF_Operation_Upper --
-----------------------------
function MP_CMOF_Operation_Upper return AMF.Internals.CMOF_Element is
begin
return Base + 109;
end MP_CMOF_Operation_Upper;
------------------------------------------------------------
-- MP_CMOF_Package_Nested_Package_Package_Nesting_Package --
------------------------------------------------------------
function MP_CMOF_Package_Nested_Package_Package_Nesting_Package return AMF.Internals.CMOF_Element is
begin
return Base + 69;
end MP_CMOF_Package_Nested_Package_Package_Nesting_Package;
------------------------------------------------------------
-- MP_CMOF_Package_Nesting_Package_Package_Nested_Package --
------------------------------------------------------------
function MP_CMOF_Package_Nesting_Package_Package_Nested_Package return AMF.Internals.CMOF_Element is
begin
return Base + 110;
end MP_CMOF_Package_Nesting_Package_Package_Nested_Package;
---------------------------------------------
-- MP_CMOF_Package_Owned_Type_Type_Package --
---------------------------------------------
function MP_CMOF_Package_Owned_Type_Type_Package return AMF.Internals.CMOF_Element is
begin
return Base + 70;
end MP_CMOF_Package_Owned_Type_Type_Package;
-------------------------------------------------------------------
-- MP_CMOF_Package_Package_Merge_Package_Merge_Receiving_Package --
-------------------------------------------------------------------
function MP_CMOF_Package_Package_Merge_Package_Merge_Receiving_Package return AMF.Internals.CMOF_Element is
begin
return Base + 71;
end MP_CMOF_Package_Package_Merge_Package_Merge_Receiving_Package;
-------------------------------------------------------
-- MP_CMOF_Package_Packaged_Element_A_Owning_Package --
-------------------------------------------------------
function MP_CMOF_Package_Packaged_Element_A_Owning_Package return AMF.Internals.CMOF_Element is
begin
return Base + 72;
end MP_CMOF_Package_Packaged_Element_A_Owning_Package;
-------------------------
-- MP_CMOF_Package_Uri --
-------------------------
function MP_CMOF_Package_Uri return AMF.Internals.CMOF_Element is
begin
return Base + 111;
end MP_CMOF_Package_Uri;
--------------------------------------------------------------
-- MP_CMOF_Package_Import_Imported_Package_A_Package_Import --
--------------------------------------------------------------
function MP_CMOF_Package_Import_Imported_Package_A_Package_Import return AMF.Internals.CMOF_Element is
begin
return Base + 112;
end MP_CMOF_Package_Import_Imported_Package_A_Package_Import;
-------------------------------------------------------------------------
-- MP_CMOF_Package_Import_Importing_Namespace_Namespace_Package_Import --
-------------------------------------------------------------------------
function MP_CMOF_Package_Import_Importing_Namespace_Namespace_Package_Import return AMF.Internals.CMOF_Element is
begin
return Base + 113;
end MP_CMOF_Package_Import_Importing_Namespace_Namespace_Package_Import;
---------------------------------------
-- MP_CMOF_Package_Import_Visibility --
---------------------------------------
function MP_CMOF_Package_Import_Visibility return AMF.Internals.CMOF_Element is
begin
return Base + 114;
end MP_CMOF_Package_Import_Visibility;
----------------------------------------------------------
-- MP_CMOF_Package_Merge_Merged_Package_A_Package_Merge --
----------------------------------------------------------
function MP_CMOF_Package_Merge_Merged_Package_A_Package_Merge return AMF.Internals.CMOF_Element is
begin
return Base + 115;
end MP_CMOF_Package_Merge_Merged_Package_A_Package_Merge;
-------------------------------------------------------------------
-- MP_CMOF_Package_Merge_Receiving_Package_Package_Package_Merge --
-------------------------------------------------------------------
function MP_CMOF_Package_Merge_Receiving_Package_Package_Package_Merge return AMF.Internals.CMOF_Element is
begin
return Base + 116;
end MP_CMOF_Package_Merge_Receiving_Package_Package_Package_Merge;
-------------------------------
-- MP_CMOF_Parameter_Default --
-------------------------------
function MP_CMOF_Parameter_Default return AMF.Internals.CMOF_Element is
begin
return Base + 117;
end MP_CMOF_Parameter_Default;
---------------------------------
-- MP_CMOF_Parameter_Direction --
---------------------------------
function MP_CMOF_Parameter_Direction return AMF.Internals.CMOF_Element is
begin
return Base + 118;
end MP_CMOF_Parameter_Direction;
-----------------------------------------------------------
-- MP_CMOF_Parameter_Operation_Operation_Owned_Parameter --
-----------------------------------------------------------
function MP_CMOF_Parameter_Operation_Operation_Owned_Parameter return AMF.Internals.CMOF_Element is
begin
return Base + 119;
end MP_CMOF_Parameter_Operation_Operation_Owned_Parameter;
---------------------------------------------------------
-- MP_CMOF_Property_Association_Association_Member_End --
---------------------------------------------------------
function MP_CMOF_Property_Association_Association_Member_End return AMF.Internals.CMOF_Element is
begin
return Base + 120;
end MP_CMOF_Property_Association_Association_Member_End;
--------------------------------------------------
-- MP_CMOF_Property_Class_Class_Owned_Attribute --
--------------------------------------------------
function MP_CMOF_Property_Class_Class_Owned_Attribute return AMF.Internals.CMOF_Element is
begin
return Base + 121;
end MP_CMOF_Property_Class_Class_Owned_Attribute;
---------------------------------------------------------
-- MP_CMOF_Property_Datatype_Data_Type_Owned_Attribute --
---------------------------------------------------------
function MP_CMOF_Property_Datatype_Data_Type_Owned_Attribute return AMF.Internals.CMOF_Element is
begin
return Base + 122;
end MP_CMOF_Property_Datatype_Data_Type_Owned_Attribute;
------------------------------
-- MP_CMOF_Property_Default --
------------------------------
function MP_CMOF_Property_Default return AMF.Internals.CMOF_Element is
begin
return Base + 123;
end MP_CMOF_Property_Default;
-----------------------------------
-- MP_CMOF_Property_Is_Composite --
-----------------------------------
function MP_CMOF_Property_Is_Composite return AMF.Internals.CMOF_Element is
begin
return Base + 124;
end MP_CMOF_Property_Is_Composite;
---------------------------------
-- MP_CMOF_Property_Is_Derived --
---------------------------------
function MP_CMOF_Property_Is_Derived return AMF.Internals.CMOF_Element is
begin
return Base + 125;
end MP_CMOF_Property_Is_Derived;
---------------------------------------
-- MP_CMOF_Property_Is_Derived_Union --
---------------------------------------
function MP_CMOF_Property_Is_Derived_Union return AMF.Internals.CMOF_Element is
begin
return Base + 126;
end MP_CMOF_Property_Is_Derived_Union;
-----------------------------------
-- MP_CMOF_Property_Is_Read_Only --
-----------------------------------
function MP_CMOF_Property_Is_Read_Only return AMF.Internals.CMOF_Element is
begin
return Base + 127;
end MP_CMOF_Property_Is_Read_Only;
------------------------------------------
-- MP_CMOF_Property_Opposite_A_Property --
------------------------------------------
function MP_CMOF_Property_Opposite_A_Property return AMF.Internals.CMOF_Element is
begin
return Base + 128;
end MP_CMOF_Property_Opposite_A_Property;
---------------------------------------------------------------
-- MP_CMOF_Property_Owning_Association_Association_Owned_End --
---------------------------------------------------------------
function MP_CMOF_Property_Owning_Association_Association_Owned_End return AMF.Internals.CMOF_Element is
begin
return Base + 129;
end MP_CMOF_Property_Owning_Association_Association_Owned_End;
----------------------------------------------------
-- MP_CMOF_Property_Redefined_Property_A_Property --
----------------------------------------------------
function MP_CMOF_Property_Redefined_Property_A_Property return AMF.Internals.CMOF_Element is
begin
return Base + 73;
end MP_CMOF_Property_Redefined_Property_A_Property;
----------------------------------------------------
-- MP_CMOF_Property_Subsetted_Property_A_Property --
----------------------------------------------------
function MP_CMOF_Property_Subsetted_Property_A_Property return AMF.Internals.CMOF_Element is
begin
return Base + 74;
end MP_CMOF_Property_Subsetted_Property_A_Property;
-----------------------------------------
-- MP_CMOF_Redefinable_Element_Is_Leaf --
-----------------------------------------
function MP_CMOF_Redefinable_Element_Is_Leaf return AMF.Internals.CMOF_Element is
begin
return Base + 130;
end MP_CMOF_Redefinable_Element_Is_Leaf;
-------------------------------------------------------------------------
-- MP_CMOF_Redefinable_Element_Redefined_Element_A_Redefinable_Element --
-------------------------------------------------------------------------
function MP_CMOF_Redefinable_Element_Redefined_Element_A_Redefinable_Element return AMF.Internals.CMOF_Element is
begin
return Base + 75;
end MP_CMOF_Redefinable_Element_Redefined_Element_A_Redefinable_Element;
----------------------------------------------------------------------------
-- MP_CMOF_Redefinable_Element_Redefinition_Context_A_Redefinable_Element --
----------------------------------------------------------------------------
function MP_CMOF_Redefinable_Element_Redefinition_Context_A_Redefinable_Element return AMF.Internals.CMOF_Element is
begin
return Base + 76;
end MP_CMOF_Redefinable_Element_Redefinition_Context_A_Redefinable_Element;
---------------------------------------------------------
-- MP_CMOF_Relationship_Related_Element_A_Relationship --
---------------------------------------------------------
function MP_CMOF_Relationship_Related_Element_A_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 77;
end MP_CMOF_Relationship_Related_Element_A_Relationship;
-------------------------------
-- MP_CMOF_Tag_Element_A_Tag --
-------------------------------
function MP_CMOF_Tag_Element_A_Tag return AMF.Internals.CMOF_Element is
begin
return Base + 78;
end MP_CMOF_Tag_Element_A_Tag;
----------------------
-- MP_CMOF_Tag_Name --
----------------------
function MP_CMOF_Tag_Name return AMF.Internals.CMOF_Element is
begin
return Base + 131;
end MP_CMOF_Tag_Name;
---------------------------------------
-- MP_CMOF_Tag_Tag_Owner_A_Owned_Tag --
---------------------------------------
function MP_CMOF_Tag_Tag_Owner_A_Owned_Tag return AMF.Internals.CMOF_Element is
begin
return Base + 132;
end MP_CMOF_Tag_Tag_Owner_A_Owned_Tag;
-----------------------
-- MP_CMOF_Tag_Value --
-----------------------
function MP_CMOF_Tag_Value return AMF.Internals.CMOF_Element is
begin
return Base + 133;
end MP_CMOF_Tag_Value;
---------------------------------------------
-- MP_CMOF_Type_Package_Package_Owned_Type --
---------------------------------------------
function MP_CMOF_Type_Package_Package_Owned_Type return AMF.Internals.CMOF_Element is
begin
return Base + 134;
end MP_CMOF_Type_Package_Package_Owned_Type;
------------------------------------------------
-- MP_CMOF_Typed_Element_Type_A_Typed_Element --
------------------------------------------------
function MP_CMOF_Typed_Element_Type_A_Typed_Element return AMF.Internals.CMOF_Element is
begin
return Base + 135;
end MP_CMOF_Typed_Element_Type_A_Typed_Element;
--------------------------------------------------------------
-- MP_CMOF_A_Element_Import_Element_Import_Imported_Element --
--------------------------------------------------------------
function MP_CMOF_A_Element_Import_Element_Import_Imported_Element return AMF.Internals.CMOF_Element is
begin
return Base + 776;
end MP_CMOF_A_Element_Import_Element_Import_Imported_Element;
-------------------------------------------------------
-- MP_CMOF_A_Owning_Package_Package_Packaged_Element --
-------------------------------------------------------
function MP_CMOF_A_Owning_Package_Package_Packaged_Element return AMF.Internals.CMOF_Element is
begin
return Base + 777;
end MP_CMOF_A_Owning_Package_Package_Packaged_Element;
-------------------------------
-- MP_CMOF_A_Tag_Tag_Element --
-------------------------------
function MP_CMOF_A_Tag_Tag_Element return AMF.Internals.CMOF_Element is
begin
return Base + 797;
end MP_CMOF_A_Tag_Tag_Element;
---------------------------------------
-- MP_CMOF_A_Owned_Tag_Tag_Tag_Owner --
---------------------------------------
function MP_CMOF_A_Owned_Tag_Tag_Tag_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 798;
end MP_CMOF_A_Owned_Tag_Tag_Tag_Owner;
----------------------------------------
-- MP_CMOF_A_Operation_Operation_Type --
----------------------------------------
function MP_CMOF_A_Operation_Operation_Type return AMF.Internals.CMOF_Element is
begin
return Base + 778;
end MP_CMOF_A_Operation_Operation_Type;
----------------------------------------------------------
-- MP_CMOF_A_Package_Merge_Package_Merge_Merged_Package --
----------------------------------------------------------
function MP_CMOF_A_Package_Merge_Package_Merge_Merged_Package return AMF.Internals.CMOF_Element is
begin
return Base + 779;
end MP_CMOF_A_Package_Merge_Package_Merge_Merged_Package;
-------------------------------------------------
-- MP_CMOF_A_Comment_Comment_Annotated_Element --
-------------------------------------------------
function MP_CMOF_A_Comment_Comment_Annotated_Element return AMF.Internals.CMOF_Element is
begin
return Base + 780;
end MP_CMOF_A_Comment_Comment_Annotated_Element;
---------------------------------------------------------
-- MP_CMOF_A_Relationship_Relationship_Related_Element --
---------------------------------------------------------
function MP_CMOF_A_Relationship_Relationship_Related_Element return AMF.Internals.CMOF_Element is
begin
return Base + 781;
end MP_CMOF_A_Relationship_Relationship_Related_Element;
------------------------------------------------------------------
-- MP_CMOF_A_Directed_Relationship_Directed_Relationship_Source --
------------------------------------------------------------------
function MP_CMOF_A_Directed_Relationship_Directed_Relationship_Source return AMF.Internals.CMOF_Element is
begin
return Base + 782;
end MP_CMOF_A_Directed_Relationship_Directed_Relationship_Source;
------------------------------------------------------------------
-- MP_CMOF_A_Directed_Relationship_Directed_Relationship_Target --
------------------------------------------------------------------
function MP_CMOF_A_Directed_Relationship_Directed_Relationship_Target return AMF.Internals.CMOF_Element is
begin
return Base + 783;
end MP_CMOF_A_Directed_Relationship_Directed_Relationship_Target;
------------------------------------------------
-- MP_CMOF_A_Typed_Element_Typed_Element_Type --
------------------------------------------------
function MP_CMOF_A_Typed_Element_Typed_Element_Type return AMF.Internals.CMOF_Element is
begin
return Base + 763;
end MP_CMOF_A_Typed_Element_Typed_Element_Type;
----------------------------------------------------------------------------
-- MP_CMOF_A_Redefinable_Element_Redefinable_Element_Redefinition_Context --
----------------------------------------------------------------------------
function MP_CMOF_A_Redefinable_Element_Redefinable_Element_Redefinition_Context return AMF.Internals.CMOF_Element is
begin
return Base + 784;
end MP_CMOF_A_Redefinable_Element_Redefinable_Element_Redefinition_Context;
-------------------------------------------------------------------------
-- MP_CMOF_A_Redefinable_Element_Redefinable_Element_Redefined_Element --
-------------------------------------------------------------------------
function MP_CMOF_A_Redefinable_Element_Redefinable_Element_Redefined_Element return AMF.Internals.CMOF_Element is
begin
return Base + 785;
end MP_CMOF_A_Redefinable_Element_Redefinable_Element_Redefined_Element;
-----------------------------------------------
-- MP_CMOF_A_Classifier_Classifier_Attribute --
-----------------------------------------------
function MP_CMOF_A_Classifier_Classifier_Attribute return AMF.Internals.CMOF_Element is
begin
return Base + 764;
end MP_CMOF_A_Classifier_Classifier_Attribute;
---------------------------------------------------------
-- MP_CMOF_A_Constraint_Constraint_Constrained_Element --
---------------------------------------------------------
function MP_CMOF_A_Constraint_Constraint_Constrained_Element return AMF.Internals.CMOF_Element is
begin
return Base + 786;
end MP_CMOF_A_Constraint_Constraint_Constrained_Element;
----------------------------------------------------
-- MP_CMOF_A_Property_Property_Redefined_Property --
----------------------------------------------------
function MP_CMOF_A_Property_Property_Redefined_Property return AMF.Internals.CMOF_Element is
begin
return Base + 765;
end MP_CMOF_A_Property_Property_Redefined_Property;
----------------------------------------------------------
-- MP_CMOF_A_Owning_Constraint_Constraint_Specification --
----------------------------------------------------------
function MP_CMOF_A_Owning_Constraint_Constraint_Specification return AMF.Internals.CMOF_Element is
begin
return Base + 787;
end MP_CMOF_A_Owning_Constraint_Constraint_Specification;
----------------------------------------------------
-- MP_CMOF_A_Property_Property_Subsetted_Property --
----------------------------------------------------
function MP_CMOF_A_Property_Property_Subsetted_Property return AMF.Internals.CMOF_Element is
begin
return Base + 766;
end MP_CMOF_A_Property_Property_Subsetted_Property;
---------------------------------------------
-- MP_CMOF_A_Classifier_Classifier_General --
---------------------------------------------
function MP_CMOF_A_Classifier_Classifier_General return AMF.Internals.CMOF_Element is
begin
return Base + 788;
end MP_CMOF_A_Classifier_Classifier_General;
------------------------------------------
-- MP_CMOF_A_Property_Property_Opposite --
------------------------------------------
function MP_CMOF_A_Property_Property_Opposite return AMF.Internals.CMOF_Element is
begin
return Base + 767;
end MP_CMOF_A_Property_Property_Opposite;
---------------------------------------
-- MP_CMOF_A_Class_Class_Super_Class --
---------------------------------------
function MP_CMOF_A_Class_Class_Super_Class return AMF.Internals.CMOF_Element is
begin
return Base + 768;
end MP_CMOF_A_Class_Class_Super_Class;
------------------------------------------
-- MP_CMOF_A_Namespace_Namespace_Member --
------------------------------------------
function MP_CMOF_A_Namespace_Namespace_Member return AMF.Internals.CMOF_Element is
begin
return Base + 789;
end MP_CMOF_A_Namespace_Namespace_Member;
------------------------------------------------
-- MP_CMOF_A_Association_Association_End_Type --
------------------------------------------------
function MP_CMOF_A_Association_Association_End_Type return AMF.Internals.CMOF_Element is
begin
return Base + 769;
end MP_CMOF_A_Association_Association_End_Type;
---------------------------------------------
-- MP_CMOF_A_Expression_Expression_Operand --
---------------------------------------------
function MP_CMOF_A_Expression_Expression_Operand return AMF.Internals.CMOF_Element is
begin
return Base + 790;
end MP_CMOF_A_Expression_Expression_Operand;
-----------------------------------------------------------
-- MP_CMOF_A_Association_Association_Navigable_Owned_End --
-----------------------------------------------------------
function MP_CMOF_A_Association_Association_Navigable_Owned_End return AMF.Internals.CMOF_Element is
begin
return Base + 791;
end MP_CMOF_A_Association_Association_Navigable_Owned_End;
----------------------------------------------------
-- MP_CMOF_A_Operation_Operation_Raised_Exception --
----------------------------------------------------
function MP_CMOF_A_Operation_Operation_Raised_Exception return AMF.Internals.CMOF_Element is
begin
return Base + 770;
end MP_CMOF_A_Operation_Operation_Raised_Exception;
----------------------------------------------------
-- MP_CMOF_A_Owning_Element_Element_Owned_Comment --
----------------------------------------------------
function MP_CMOF_A_Owning_Element_Element_Owned_Comment return AMF.Internals.CMOF_Element is
begin
return Base + 792;
end MP_CMOF_A_Owning_Element_Element_Owned_Comment;
-------------------------------------------------------
-- MP_CMOF_A_Operation_Operation_Redefined_Operation --
-------------------------------------------------------
function MP_CMOF_A_Operation_Operation_Redefined_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 771;
end MP_CMOF_A_Operation_Operation_Redefined_Operation;
------------------------------------------------------
-- MP_CMOF_A_Classifier_Classifier_Inherited_Member --
------------------------------------------------------
function MP_CMOF_A_Classifier_Classifier_Inherited_Member return AMF.Internals.CMOF_Element is
begin
return Base + 793;
end MP_CMOF_A_Classifier_Classifier_Inherited_Member;
---------------------------------------------------------------------
-- MP_CMOF_A_Owner_Formal_Param_Behavioral_Feature_Owned_Parameter --
---------------------------------------------------------------------
function MP_CMOF_A_Owner_Formal_Param_Behavioral_Feature_Owned_Parameter return AMF.Internals.CMOF_Element is
begin
return Base + 772;
end MP_CMOF_A_Owner_Formal_Param_Behavioral_Feature_Owned_Parameter;
--------------------------------------------------
-- MP_CMOF_A_Pre_Context_Operation_Precondition --
--------------------------------------------------
function MP_CMOF_A_Pre_Context_Operation_Precondition return AMF.Internals.CMOF_Element is
begin
return Base + 794;
end MP_CMOF_A_Pre_Context_Operation_Precondition;
----------------------------------------------------------------------
-- MP_CMOF_A_Behavioral_Feature_Behavioral_Feature_Raised_Exception --
----------------------------------------------------------------------
function MP_CMOF_A_Behavioral_Feature_Behavioral_Feature_Raised_Exception return AMF.Internals.CMOF_Element is
begin
return Base + 773;
end MP_CMOF_A_Behavioral_Feature_Behavioral_Feature_Raised_Exception;
----------------------------------------------------
-- MP_CMOF_A_Post_Context_Operation_Postcondition --
----------------------------------------------------
function MP_CMOF_A_Post_Context_Operation_Postcondition return AMF.Internals.CMOF_Element is
begin
return Base + 795;
end MP_CMOF_A_Post_Context_Operation_Postcondition;
---------------------------------------------------
-- MP_CMOF_A_Namespace_Namespace_Imported_Member --
---------------------------------------------------
function MP_CMOF_A_Namespace_Namespace_Imported_Member return AMF.Internals.CMOF_Element is
begin
return Base + 774;
end MP_CMOF_A_Namespace_Namespace_Imported_Member;
-----------------------------------------------------
-- MP_CMOF_A_Body_Context_Operation_Body_Condition --
-----------------------------------------------------
function MP_CMOF_A_Body_Context_Operation_Body_Condition return AMF.Internals.CMOF_Element is
begin
return Base + 796;
end MP_CMOF_A_Body_Context_Operation_Body_Condition;
--------------------------------------------------------------
-- MP_CMOF_A_Package_Import_Package_Import_Imported_Package --
--------------------------------------------------------------
function MP_CMOF_A_Package_Import_Package_Import_Imported_Package return AMF.Internals.CMOF_Element is
begin
return Base + 775;
end MP_CMOF_A_Package_Import_Package_Import_Imported_Package;
------------------------------------------------------------
-- MA_CMOF_Element_Import_Imported_Element_Element_Import --
------------------------------------------------------------
function MA_CMOF_Element_Import_Imported_Element_Element_Import return AMF.Internals.CMOF_Element is
begin
return Base + 136;
end MA_CMOF_Element_Import_Imported_Element_Element_Import;
----------------------------------------------------------
-- MA_CMOF_Namespace_Element_Import_Importing_Namespace --
----------------------------------------------------------
function MA_CMOF_Namespace_Element_Import_Importing_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 137;
end MA_CMOF_Namespace_Element_Import_Importing_Namespace;
----------------------------------------------------------
-- MA_CMOF_Namespace_Package_Import_Importing_Namespace --
----------------------------------------------------------
function MA_CMOF_Namespace_Package_Import_Importing_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 138;
end MA_CMOF_Namespace_Package_Import_Importing_Namespace;
-----------------------------------------------------
-- MA_CMOF_Package_Packaged_Element_Owning_Package --
-----------------------------------------------------
function MA_CMOF_Package_Packaged_Element_Owning_Package return AMF.Internals.CMOF_Element is
begin
return Base + 139;
end MA_CMOF_Package_Packaged_Element_Owning_Package;
-----------------------------
-- MA_CMOF_Tag_Element_Tag --
-----------------------------
function MA_CMOF_Tag_Element_Tag return AMF.Internals.CMOF_Element is
begin
return Base + 140;
end MA_CMOF_Tag_Element_Tag;
----------------------------------------
-- MA_CMOF_Package_Owned_Type_Package --
----------------------------------------
function MA_CMOF_Package_Owned_Type_Package return AMF.Internals.CMOF_Element is
begin
return Base + 141;
end MA_CMOF_Package_Owned_Type_Package;
-------------------------------------
-- MA_CMOF_Tag_Tag_Owner_Owned_Tag --
-------------------------------------
function MA_CMOF_Tag_Tag_Owner_Owned_Tag return AMF.Internals.CMOF_Element is
begin
return Base + 142;
end MA_CMOF_Tag_Tag_Owner_Owned_Tag;
------------------------------------------------
-- MA_CMOF_Association_Member_End_Association --
------------------------------------------------
function MA_CMOF_Association_Member_End_Association return AMF.Internals.CMOF_Element is
begin
return Base + 143;
end MA_CMOF_Association_Member_End_Association;
----------------------------------------------------
-- MA_CMOF_Package_Nested_Package_Nesting_Package --
----------------------------------------------------
function MA_CMOF_Package_Nested_Package_Nesting_Package return AMF.Internals.CMOF_Element is
begin
return Base + 144;
end MA_CMOF_Package_Nested_Package_Nesting_Package;
--------------------------------------
-- MA_CMOF_Operation_Type_Operation --
--------------------------------------
function MA_CMOF_Operation_Type_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 145;
end MA_CMOF_Operation_Type_Operation;
-----------------------------------------------------
-- MA_CMOF_Package_Package_Merge_Receiving_Package --
-----------------------------------------------------
function MA_CMOF_Package_Package_Merge_Receiving_Package return AMF.Internals.CMOF_Element is
begin
return Base + 146;
end MA_CMOF_Package_Package_Merge_Receiving_Package;
--------------------------------------------------------
-- MA_CMOF_Package_Merge_Merged_Package_Package_Merge --
--------------------------------------------------------
function MA_CMOF_Package_Merge_Merged_Package_Package_Merge return AMF.Internals.CMOF_Element is
begin
return Base + 147;
end MA_CMOF_Package_Merge_Merged_Package_Package_Merge;
-----------------------------------------
-- MA_CMOF_Element_Owned_Element_Owner --
-----------------------------------------
function MA_CMOF_Element_Owned_Element_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 148;
end MA_CMOF_Element_Owned_Element_Owner;
-----------------------------------------------
-- MA_CMOF_Comment_Annotated_Element_Comment --
-----------------------------------------------
function MA_CMOF_Comment_Annotated_Element_Comment return AMF.Internals.CMOF_Element is
begin
return Base + 149;
end MA_CMOF_Comment_Annotated_Element_Comment;
-------------------------------------------------------
-- MA_CMOF_Relationship_Related_Element_Relationship --
-------------------------------------------------------
function MA_CMOF_Relationship_Related_Element_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 150;
end MA_CMOF_Relationship_Related_Element_Relationship;
----------------------------------------------------------------
-- MA_CMOF_Directed_Relationship_Source_Directed_Relationship --
----------------------------------------------------------------
function MA_CMOF_Directed_Relationship_Source_Directed_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 151;
end MA_CMOF_Directed_Relationship_Source_Directed_Relationship;
----------------------------------------------------------------
-- MA_CMOF_Directed_Relationship_Target_Directed_Relationship --
----------------------------------------------------------------
function MA_CMOF_Directed_Relationship_Target_Directed_Relationship return AMF.Internals.CMOF_Element is
begin
return Base + 152;
end MA_CMOF_Directed_Relationship_Target_Directed_Relationship;
----------------------------------------------
-- MA_CMOF_Typed_Element_Type_Typed_Element --
----------------------------------------------
function MA_CMOF_Typed_Element_Type_Typed_Element return AMF.Internals.CMOF_Element is
begin
return Base + 153;
end MA_CMOF_Typed_Element_Type_Typed_Element;
--------------------------------------------------------------------------
-- MA_CMOF_Redefinable_Element_Redefinition_Context_Redefinable_Element --
--------------------------------------------------------------------------
function MA_CMOF_Redefinable_Element_Redefinition_Context_Redefinable_Element return AMF.Internals.CMOF_Element is
begin
return Base + 154;
end MA_CMOF_Redefinable_Element_Redefinition_Context_Redefinable_Element;
-----------------------------------------
-- MA_CMOF_Class_Owned_Attribute_Class --
-----------------------------------------
function MA_CMOF_Class_Owned_Attribute_Class return AMF.Internals.CMOF_Element is
begin
return Base + 155;
end MA_CMOF_Class_Owned_Attribute_Class;
-----------------------------------------
-- MA_CMOF_Class_Owned_Operation_Class --
-----------------------------------------
function MA_CMOF_Class_Owned_Operation_Class return AMF.Internals.CMOF_Element is
begin
return Base + 156;
end MA_CMOF_Class_Owned_Operation_Class;
-----------------------------------------------------------------------
-- MA_CMOF_Redefinable_Element_Redefined_Element_Redefinable_Element --
-----------------------------------------------------------------------
function MA_CMOF_Redefinable_Element_Redefined_Element_Redefinable_Element return AMF.Internals.CMOF_Element is
begin
return Base + 157;
end MA_CMOF_Redefinable_Element_Redefined_Element_Redefinable_Element;
------------------------------------------------------
-- MA_CMOF_Association_Owned_End_Owning_Association --
------------------------------------------------------
function MA_CMOF_Association_Owned_End_Owning_Association return AMF.Internals.CMOF_Element is
begin
return Base + 158;
end MA_CMOF_Association_Owned_End_Owning_Association;
---------------------------------------------
-- MA_CMOF_Classifier_Attribute_Classifier --
---------------------------------------------
function MA_CMOF_Classifier_Attribute_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 159;
end MA_CMOF_Classifier_Attribute_Classifier;
-----------------------------------------------------
-- MA_CMOF_Classifier_Feature_Featuring_Classifier --
-----------------------------------------------------
function MA_CMOF_Classifier_Feature_Featuring_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 160;
end MA_CMOF_Classifier_Feature_Featuring_Classifier;
-------------------------------------------------------
-- MA_CMOF_Constraint_Constrained_Element_Constraint --
-------------------------------------------------------
function MA_CMOF_Constraint_Constrained_Element_Constraint return AMF.Internals.CMOF_Element is
begin
return Base + 161;
end MA_CMOF_Constraint_Constrained_Element_Constraint;
--------------------------------------------------
-- MA_CMOF_Property_Redefined_Property_Property --
--------------------------------------------------
function MA_CMOF_Property_Redefined_Property_Property return AMF.Internals.CMOF_Element is
begin
return Base + 162;
end MA_CMOF_Property_Redefined_Property_Property;
--------------------------------------------------------
-- MA_CMOF_Constraint_Specification_Owning_Constraint --
--------------------------------------------------------
function MA_CMOF_Constraint_Specification_Owning_Constraint return AMF.Internals.CMOF_Element is
begin
return Base + 163;
end MA_CMOF_Constraint_Specification_Owning_Constraint;
--------------------------------------------------
-- MA_CMOF_Property_Subsetted_Property_Property --
--------------------------------------------------
function MA_CMOF_Property_Subsetted_Property_Property return AMF.Internals.CMOF_Element is
begin
return Base + 164;
end MA_CMOF_Property_Subsetted_Property_Property;
-------------------------------------------
-- MA_CMOF_Classifier_General_Classifier --
-------------------------------------------
function MA_CMOF_Classifier_General_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 165;
end MA_CMOF_Classifier_General_Classifier;
----------------------------------------
-- MA_CMOF_Property_Opposite_Property --
----------------------------------------
function MA_CMOF_Property_Opposite_Property return AMF.Internals.CMOF_Element is
begin
return Base + 166;
end MA_CMOF_Property_Opposite_Property;
----------------------------------------------
-- MA_CMOF_Namespace_Owned_Member_Namespace --
----------------------------------------------
function MA_CMOF_Namespace_Owned_Member_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 167;
end MA_CMOF_Namespace_Owned_Member_Namespace;
-------------------------------------
-- MA_CMOF_Class_Super_Class_Class --
-------------------------------------
function MA_CMOF_Class_Super_Class_Class return AMF.Internals.CMOF_Element is
begin
return Base + 168;
end MA_CMOF_Class_Super_Class_Class;
----------------------------------------
-- MA_CMOF_Namespace_Member_Namespace --
----------------------------------------
function MA_CMOF_Namespace_Member_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 169;
end MA_CMOF_Namespace_Member_Namespace;
----------------------------------------------
-- MA_CMOF_Association_End_Type_Association --
----------------------------------------------
function MA_CMOF_Association_End_Type_Association return AMF.Internals.CMOF_Element is
begin
return Base + 170;
end MA_CMOF_Association_End_Type_Association;
-------------------------------------------
-- MA_CMOF_Expression_Operand_Expression --
-------------------------------------------
function MA_CMOF_Expression_Operand_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 171;
end MA_CMOF_Expression_Operand_Expression;
---------------------------------------------------
-- MA_CMOF_Enumeration_Owned_Literal_Enumeration --
---------------------------------------------------
function MA_CMOF_Enumeration_Owned_Literal_Enumeration return AMF.Internals.CMOF_Element is
begin
return Base + 172;
end MA_CMOF_Enumeration_Owned_Literal_Enumeration;
---------------------------------------------------------
-- MA_CMOF_Association_Navigable_Owned_End_Association --
---------------------------------------------------------
function MA_CMOF_Association_Navigable_Owned_End_Association return AMF.Internals.CMOF_Element is
begin
return Base + 173;
end MA_CMOF_Association_Navigable_Owned_End_Association;
------------------------------------------------
-- MA_CMOF_Data_Type_Owned_Attribute_Datatype --
------------------------------------------------
function MA_CMOF_Data_Type_Owned_Attribute_Datatype return AMF.Internals.CMOF_Element is
begin
return Base + 174;
end MA_CMOF_Data_Type_Owned_Attribute_Datatype;
------------------------------------------------
-- MA_CMOF_Data_Type_Owned_Operation_Datatype --
------------------------------------------------
function MA_CMOF_Data_Type_Owned_Operation_Datatype return AMF.Internals.CMOF_Element is
begin
return Base + 175;
end MA_CMOF_Data_Type_Owned_Operation_Datatype;
-------------------------------------------------
-- MA_CMOF_Operation_Owned_Parameter_Operation --
-------------------------------------------------
function MA_CMOF_Operation_Owned_Parameter_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 176;
end MA_CMOF_Operation_Owned_Parameter_Operation;
--------------------------------------------------
-- MA_CMOF_Operation_Raised_Exception_Operation --
--------------------------------------------------
function MA_CMOF_Operation_Raised_Exception_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 177;
end MA_CMOF_Operation_Raised_Exception_Operation;
--------------------------------------------------
-- MA_CMOF_Element_Owned_Comment_Owning_Element --
--------------------------------------------------
function MA_CMOF_Element_Owned_Comment_Owning_Element return AMF.Internals.CMOF_Element is
begin
return Base + 178;
end MA_CMOF_Element_Owned_Comment_Owning_Element;
-----------------------------------------------------
-- MA_CMOF_Operation_Redefined_Operation_Operation --
-----------------------------------------------------
function MA_CMOF_Operation_Redefined_Operation_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 179;
end MA_CMOF_Operation_Redefined_Operation_Operation;
----------------------------------------------------
-- MA_CMOF_Classifier_Inherited_Member_Classifier --
----------------------------------------------------
function MA_CMOF_Classifier_Inherited_Member_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 180;
end MA_CMOF_Classifier_Inherited_Member_Classifier;
-------------------------------------------------------------------
-- MA_CMOF_Behavioral_Feature_Owned_Parameter_Owner_Formal_Param --
-------------------------------------------------------------------
function MA_CMOF_Behavioral_Feature_Owned_Parameter_Owner_Formal_Param return AMF.Internals.CMOF_Element is
begin
return Base + 181;
end MA_CMOF_Behavioral_Feature_Owned_Parameter_Owner_Formal_Param;
------------------------------------------------
-- MA_CMOF_Operation_Precondition_Pre_Context --
------------------------------------------------
function MA_CMOF_Operation_Precondition_Pre_Context return AMF.Internals.CMOF_Element is
begin
return Base + 182;
end MA_CMOF_Operation_Precondition_Pre_Context;
--------------------------------------------------------------------
-- MA_CMOF_Behavioral_Feature_Raised_Exception_Behavioral_Feature --
--------------------------------------------------------------------
function MA_CMOF_Behavioral_Feature_Raised_Exception_Behavioral_Feature return AMF.Internals.CMOF_Element is
begin
return Base + 183;
end MA_CMOF_Behavioral_Feature_Raised_Exception_Behavioral_Feature;
--------------------------------------------------
-- MA_CMOF_Operation_Postcondition_Post_Context --
--------------------------------------------------
function MA_CMOF_Operation_Postcondition_Post_Context return AMF.Internals.CMOF_Element is
begin
return Base + 184;
end MA_CMOF_Operation_Postcondition_Post_Context;
-------------------------------------------------
-- MA_CMOF_Namespace_Imported_Member_Namespace --
-------------------------------------------------
function MA_CMOF_Namespace_Imported_Member_Namespace return AMF.Internals.CMOF_Element is
begin
return Base + 185;
end MA_CMOF_Namespace_Imported_Member_Namespace;
---------------------------------------------------
-- MA_CMOF_Operation_Body_Condition_Body_Context --
---------------------------------------------------
function MA_CMOF_Operation_Body_Condition_Body_Context return AMF.Internals.CMOF_Element is
begin
return Base + 186;
end MA_CMOF_Operation_Body_Condition_Body_Context;
------------------------------------------------------------
-- MA_CMOF_Package_Import_Imported_Package_Package_Import --
------------------------------------------------------------
function MA_CMOF_Package_Import_Imported_Package_Package_Import return AMF.Internals.CMOF_Element is
begin
return Base + 187;
end MA_CMOF_Package_Import_Imported_Package_Package_Import;
------------------------------------------
-- MA_CMOF_Namespace_Owned_Rule_Context --
------------------------------------------
function MA_CMOF_Namespace_Owned_Rule_Context return AMF.Internals.CMOF_Element is
begin
return Base + 188;
end MA_CMOF_Namespace_Owned_Rule_Context;
-------------
-- MB_CMOF --
-------------
function MB_CMOF return AMF.Internals.AMF_Element is
begin
return Base;
end MB_CMOF;
-------------
-- MB_CMOF --
-------------
function ML_CMOF return AMF.Internals.AMF_Element is
begin
return Base + 800;
end ML_CMOF;
end AMF.Internals.Tables.CMOF_Metamodel;
|
reznikmm/matreshka | Ada | 3,585 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.DG.Lines.Hash is
new AMF.Elements.Generic_Hash (DG_Line, DG_Line_Access);
|
reznikmm/matreshka | Ada | 5,592 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.OCL.Unlimited_Natural_Literal_Exps.Collections is
pragma Preelaborate;
package OCL_Unlimited_Natural_Literal_Exp_Collections is
new AMF.Generic_Collections
(OCL_Unlimited_Natural_Literal_Exp,
OCL_Unlimited_Natural_Literal_Exp_Access);
type Set_Of_OCL_Unlimited_Natural_Literal_Exp is
new OCL_Unlimited_Natural_Literal_Exp_Collections.Set with null record;
Empty_Set_Of_OCL_Unlimited_Natural_Literal_Exp : constant Set_Of_OCL_Unlimited_Natural_Literal_Exp;
type Ordered_Set_Of_OCL_Unlimited_Natural_Literal_Exp is
new OCL_Unlimited_Natural_Literal_Exp_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_OCL_Unlimited_Natural_Literal_Exp : constant Ordered_Set_Of_OCL_Unlimited_Natural_Literal_Exp;
type Bag_Of_OCL_Unlimited_Natural_Literal_Exp is
new OCL_Unlimited_Natural_Literal_Exp_Collections.Bag with null record;
Empty_Bag_Of_OCL_Unlimited_Natural_Literal_Exp : constant Bag_Of_OCL_Unlimited_Natural_Literal_Exp;
type Sequence_Of_OCL_Unlimited_Natural_Literal_Exp is
new OCL_Unlimited_Natural_Literal_Exp_Collections.Sequence with null record;
Empty_Sequence_Of_OCL_Unlimited_Natural_Literal_Exp : constant Sequence_Of_OCL_Unlimited_Natural_Literal_Exp;
private
Empty_Set_Of_OCL_Unlimited_Natural_Literal_Exp : constant Set_Of_OCL_Unlimited_Natural_Literal_Exp
:= (OCL_Unlimited_Natural_Literal_Exp_Collections.Set with null record);
Empty_Ordered_Set_Of_OCL_Unlimited_Natural_Literal_Exp : constant Ordered_Set_Of_OCL_Unlimited_Natural_Literal_Exp
:= (OCL_Unlimited_Natural_Literal_Exp_Collections.Ordered_Set with null record);
Empty_Bag_Of_OCL_Unlimited_Natural_Literal_Exp : constant Bag_Of_OCL_Unlimited_Natural_Literal_Exp
:= (OCL_Unlimited_Natural_Literal_Exp_Collections.Bag with null record);
Empty_Sequence_Of_OCL_Unlimited_Natural_Literal_Exp : constant Sequence_Of_OCL_Unlimited_Natural_Literal_Exp
:= (OCL_Unlimited_Natural_Literal_Exp_Collections.Sequence with null record);
end AMF.OCL.Unlimited_Natural_Literal_Exps.Collections;
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.