repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
AdaCore/Ada_Drivers_Library | Ada | 3,272 | ads | -- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_T_Field is HAL.UInt7;
-- Control register
type CR_Register is record
-- 7-bit counter (MSB to LSB)
T : CR_T_Field := 16#7F#;
-- Activation bit
WDGA : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CFR_W_Field is HAL.UInt7;
-- CFR_WDGTB array
type CFR_WDGTB_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CFR_WDGTB
type CFR_WDGTB_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDGTB as a value
Val : HAL.UInt2;
when True =>
-- WDGTB as an array
Arr : CFR_WDGTB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CFR_WDGTB_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : CFR_W_Field := 16#7F#;
-- Timer base
WDGTB : CFR_WDGTB_Field := (As_Array => False, Val => 16#0#);
-- Early wakeup interrupt
EWI : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Window watchdog
type WWDG_Peripheral is record
-- Control register
CR : aliased CR_Register;
-- Configuration register
CFR : aliased CFR_Register;
-- Status register
SR : aliased SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 16#0# range 0 .. 31;
CFR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
end record;
-- Window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => System'To_Address (16#40002C00#);
end STM32_SVD.WWDG;
|
optikos/oasis | Ada | 286 | ads | with Anagram.Grammars;
with Program.Parsers.Nodes;
private procedure Program.Parsers.On_Reduce_1001
(Self : access Parse_Context;
Prod : Anagram.Grammars.Production_Index;
Nodes : in out Program.Parsers.Nodes.Node_Array);
pragma Preelaborate (Program.Parsers.On_Reduce_1001);
|
Kidev/Ada_Drivers_Library | Ada | 1,735 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Vendor : constant String := "STMicro"; -- From board definition
Max_Mount_Points : constant := 2; -- From default value
Max_Mount_Name_Length : constant := 128; -- From default value
Runtime_Profile : constant String := "ravenscar-full"; -- From command line
Device_Name : constant String := "STM32F407VGTx"; -- From board definition
Device_Family : constant String := "STM32F4"; -- From board definition
Runtime_Name : constant String := "ravenscar-full-stm32f4"; -- From default value
Has_Ravenscar_Full_Runtime : constant String := "True"; -- From board definition
CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition
Board : constant String := "STM32F407_Discovery"; -- From command line
Has_ZFP_Runtime : constant String := "False"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "True"; -- From board definition
High_Speed_External_Clock : constant := 8000000; -- From board definition
Max_Path_Length : constant := 1024; -- From default value
Runtime_Name_Suffix : constant String := "stm32f4"; -- From board definition
Architecture : constant String := "ARM"; -- From board definition
end ADL_Config;
|
Heziode/lsystem-editor | Ada | 2,095 | adb | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- 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.
-------------------------------------------------------------------------------
package body LSE.Utils.Angle is
function Is_Angle (Value : String) return Boolean
is
Tmp : Angle;
pragma Unreferenced (Tmp);
begin
Tmp := Angle'Value (Value);
return True;
exception
when others =>
return False;
end Is_Angle;
function To_Angle (Value : Float) return Angle
is
Tmp : Float := Value;
begin
while Tmp not in Angle'Range loop
if Tmp < Angle'First then
Tmp := Tmp + Degrees_Cycle;
else
Tmp := Tmp - Degrees_Cycle;
end if;
end loop;
return Angle ((if Tmp = Degrees_Cycle then Angle'First else Tmp));
end To_Angle;
end LSE.Utils.Angle;
|
anshumang/cp-snucl | Ada | 247 | ads | -- RUN: %llvmgcc -S -g %s
package Debug_Var_Size is
subtype Length_Type is Positive range 1 .. 64;
type T (Length : Length_Type := 1) is record
Varying_Length : String (1 .. Length);
Fixed_Length : Boolean;
end record;
end;
|
mitchelhaan/ncurses | Ada | 4,307 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Form_User_Data --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer <[email protected]> 1996
-- Version Control:
-- $Revision: 1.7 $
-- Binding Version 00.93
------------------------------------------------------------------------------
-- |
-- |=====================================================================
-- | man page form__userptr.3x
-- |=====================================================================
-- |
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Form_User_Data is
use type Interfaces.C.Int;
-- |
-- |
-- |
procedure Set_User_Data (Frm : in Form;
Data : in User_Access)
is
function Set_Form_Userptr (Frm : Form;
Data : User_Access) return C_Int;
pragma Import (C, Set_Form_Userptr, "set_form_userptr");
Res : constant Eti_Error := Set_Form_Userptr (Frm, Data);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_User_Data;
-- |
-- |
-- |
function Get_User_Data (Frm : in Form) return User_Access
is
function Form_Userptr (Frm : Form) return User_Access;
pragma Import (C, Form_Userptr, "form_userptr");
begin
return Form_Userptr (Frm);
end Get_User_Data;
procedure Get_User_Data (Frm : in Form;
Data : out User_Access)
is
begin
Data := Get_User_Data (Frm);
end Get_User_Data;
end Terminal_Interface.Curses.Forms.Form_User_Data;
|
DrenfongWong/tkm-rpc | Ada | 3,324 | ads | with Tkmrpc.Types;
package Tkmrpc.Contexts.dh
is
type dh_State_Type is
(clean,
-- Initial clean state.
invalid,
-- Error state.
stale,
-- DH context is stale.
created,
-- Waiting for remote pubvalue.
generated
-- Diffie-Hellman shared secret has been calculated and is ready to be used.
);
function Get_State
(Id : Types.dh_id_type)
return dh_State_Type
with
Pre => Is_Valid (Id);
function Is_Valid (Id : Types.dh_id_type) return Boolean;
-- Returns True if the given id has a valid value.
function Has_creation_time
(Id : Types.dh_id_type;
creation_time : Types.rel_time_type)
return Boolean
with
Pre => Is_Valid (Id);
-- Returns True if the context specified by id has the given
-- creation_time value.
function Has_dha_id
(Id : Types.dh_id_type;
dha_id : Types.dha_id_type)
return Boolean
with
Pre => Is_Valid (Id);
-- Returns True if the context specified by id has the given
-- dha_id value.
function Has_key
(Id : Types.dh_id_type;
key : Types.dh_key_type)
return Boolean
with
Pre => Is_Valid (Id);
-- Returns True if the context specified by id has the given
-- key value.
function Has_priv
(Id : Types.dh_id_type;
priv : Types.dh_priv_type)
return Boolean
with
Pre => Is_Valid (Id);
-- Returns True if the context specified by id has the given
-- priv value.
function Has_State
(Id : Types.dh_id_type;
State : dh_State_Type)
return Boolean
with
Pre => Is_Valid (Id);
-- Returns True if the context specified by id has the given
-- State value.
procedure consume
(Id : Types.dh_id_type;
dh_key : out Types.dh_key_type)
with
Pre => Is_Valid (Id) and then
(Has_State (Id, generated)),
Post => Has_State (Id, clean);
procedure create
(Id : Types.dh_id_type;
dha_id : Types.dha_id_type;
secvalue : Types.dh_priv_type)
with
Pre => Is_Valid (Id) and then
(Has_State (Id, clean)),
Post => Has_State (Id, created) and
Has_dha_id (Id, dha_id) and
Has_priv (Id, secvalue);
procedure generate
(Id : Types.dh_id_type;
dh_key : Types.dh_key_type;
timestamp : Types.rel_time_type)
with
Pre => Is_Valid (Id) and then
(Has_State (Id, created)),
Post => Has_State (Id, generated) and
Has_key (Id, dh_key) and
Has_creation_time (Id, timestamp);
function get_dha_id
(Id : Types.dh_id_type)
return Types.dha_id_type
with
Pre => Is_Valid (Id) and then
(Has_State (Id, created)),
Post => Has_dha_id (Id, get_dha_id'Result);
function get_secvalue
(Id : Types.dh_id_type)
return Types.dh_priv_type
with
Pre => Is_Valid (Id) and then
(Has_State (Id, created)),
Post => Has_priv (Id, get_secvalue'Result);
procedure invalidate
(Id : Types.dh_id_type)
with
Pre => Is_Valid (Id),
Post => Has_State (Id, invalid);
procedure reset
(Id : Types.dh_id_type)
with
Pre => Is_Valid (Id),
Post => Has_State (Id, clean);
end Tkmrpc.Contexts.dh;
|
reznikmm/matreshka | Ada | 4,059 | 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_Master_Page_Name_Attributes;
package Matreshka.ODF_Style.Master_Page_Name_Attributes is
type Style_Master_Page_Name_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Master_Page_Name_Attributes.ODF_Style_Master_Page_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Master_Page_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Master_Page_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Master_Page_Name_Attributes;
|
reznikmm/matreshka | Ada | 3,783 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body AMF.Internals.Collections.Strings is
-------------
-- Element --
-------------
overriding function Element
(Self : not null access constant Shared_String_Collection;
Index : Positive) return League.Holders.Holder is
begin
return
League.Holders.To_Holder
(Shared_String_Collection'Class (Self.all)'Access.Element (Index));
end Element;
end AMF.Internals.Collections.Strings;
|
optikos/oasis | Ada | 10,723 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Names;
with Program.Elements.Parameter_Specifications;
with Program.Elements.Aspect_Specifications;
with Program.Element_Vectors;
with Program.Elements.Exception_Handlers;
with Program.Elements.Expressions;
with Program.Elements.Procedure_Body_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Procedure_Body_Declarations is
pragma Preelaborate;
type Procedure_Body_Declaration is
new Program.Nodes.Node
and Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration
and Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration_Text
with private;
function Create
(Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Procedure_Body_Declaration;
type Implicit_Procedure_Body_Declaration is
new Program.Nodes.Node
and Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_Not : Boolean := False;
Has_Overriding : Boolean := False)
return Implicit_Procedure_Body_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Procedure_Body_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration
with record
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Procedure_Body_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Procedure_Body_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Procedure_Body_Declaration)
return not null Program.Elements.Defining_Names.Defining_Name_Access;
overriding function Parameters
(Self : Base_Procedure_Body_Declaration)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
overriding function Aspects
(Self : Base_Procedure_Body_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Declarations
(Self : Base_Procedure_Body_Declaration)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Statements
(Self : Base_Procedure_Body_Declaration)
return not null Program.Element_Vectors.Element_Vector_Access;
overriding function Exception_Handlers
(Self : Base_Procedure_Body_Declaration)
return Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
overriding function End_Name
(Self : Base_Procedure_Body_Declaration)
return Program.Elements.Expressions.Expression_Access;
overriding function Is_Procedure_Body_Declaration_Element
(Self : Base_Procedure_Body_Declaration)
return Boolean;
overriding function Is_Declaration_Element
(Self : Base_Procedure_Body_Declaration)
return Boolean;
type Procedure_Body_Declaration is
new Base_Procedure_Body_Declaration
and Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration_Text
with record
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Procedure_Body_Declaration_Text
(Self : aliased in out Procedure_Body_Declaration)
return Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration_Text_Access;
overriding function Not_Token
(Self : Procedure_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Overriding_Token
(Self : Procedure_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Procedure_Token
(Self : Procedure_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Left_Bracket_Token
(Self : Procedure_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Right_Bracket_Token
(Self : Procedure_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Procedure_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Procedure_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Begin_Token
(Self : Procedure_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Exception_Token
(Self : Procedure_Body_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Procedure_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Procedure_Body_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Has_Not
(Self : Procedure_Body_Declaration)
return Boolean;
overriding function Has_Overriding
(Self : Procedure_Body_Declaration)
return Boolean;
type Implicit_Procedure_Body_Declaration is
new Base_Procedure_Body_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
Has_Not : Boolean;
Has_Overriding : Boolean;
end record;
overriding function To_Procedure_Body_Declaration_Text
(Self : aliased in out Implicit_Procedure_Body_Declaration)
return Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Procedure_Body_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Procedure_Body_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Procedure_Body_Declaration)
return Boolean;
overriding function Has_Not
(Self : Implicit_Procedure_Body_Declaration)
return Boolean;
overriding function Has_Overriding
(Self : Implicit_Procedure_Body_Declaration)
return Boolean;
end Program.Nodes.Procedure_Body_Declarations;
|
reznikmm/matreshka | Ada | 3,689 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Table_Cell_Address_Elements is
pragma Preelaborate;
type ODF_Table_Cell_Address is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Cell_Address_Access is
access all ODF_Table_Cell_Address'Class
with Storage_Size => 0;
end ODF.DOM.Table_Cell_Address_Elements;
|
egustafson/sandbox | Ada | 2,167 | adb | -- generic_list.adb -*- Ada -*-
--
-- This package defines a generic list and list iterator.
--
-- Author: Eric Gustafson
-- Date: 25 August 1998
--
-- ------------------------------------------------------------
--
-- $Revision$
--
-- $Log$
-- ------------------------------------------------------------
package body Generic_List is
-- ----- List_Type Methods ---------------------------------
procedure List_Add( List : in out List_Type;
Element : in Element_Type ) is
begin
if List.Num_Elements = List.List'Last then
declare
New_List : Element_Array_Access
:= new Element_Array(1..List.List'Last+3);
begin
New_List(List.List'Range) := List.List.all;
-- Deallocate list.list access
List.List := New_List;
end;
end if;
List.Num_Elements := List.Num_Elements + 1;
List.List(List.Num_Elements) := Element;
end List_Add;
-- ---------------------------------------------------------
function List_New_Iterator( List : in List_Type )
return List_Iterator_Type is
List_Iterator : List_Iterator_Type;
begin
List_Iterator.List := List.List;
List_Iterator.Num_Elements := List.Num_Elements;
return List_Iterator;
end List_New_Iterator;
-- ----- List_Iterator_Type Methods ------------------------
function Is_Next( List_Iterator : in List_Iterator_Type )
return Boolean is
begin
if List_Iterator.Index <= List_Iterator.Num_Elements then
return True;
else
return False;
end if;
end Is_Next;
-- ---------------------------------------------------------
procedure Get_Next( List_Iterator : in out List_Iterator_Type;
Next_Element : out Element_Type ) is
begin
if not Is_Next( List_Iterator ) then
raise Iterator_Bound_Error;
end if;
Next_Element := List_Iterator.List(List_Iterator.Index);
List_Iterator.Index := List_Iterator.Index + 1;
end Get_Next;
end Generic_List;
|
SayCV/rtems-addon-packages | Ada | 3,615 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.My_Field_Type --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998,2006 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision$
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
with Terminal_Interface.Curses.Forms.Field_Types.User;
use Terminal_Interface.Curses.Forms.Field_Types.User;
-- This is a very simple user defined field type. It accepts only a
-- defined character as input into the field.
--
package Sample.My_Field_Type is
type My_Data is new User_Defined_Field_Type with
record
Ch : Character;
end record;
function Field_Check (Fld : Field;
Typ : My_Data) return Boolean;
function Character_Check (Ch : Character;
Typ : My_Data) return Boolean;
end Sample.My_Field_Type;
|
guillaume-lin/tsc | Ada | 5,307 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.10 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is
use type Interfaces.C.int;
function To_Argument_Access is new Ada.Unchecked_Conversion
(System.Address, Argument_Access);
function Generic_Next (Fld : Field;
Usr : System.Address) return C_Int
is
Result : Boolean;
Udf : User_Defined_Field_Type_With_Choice_Access :=
User_Defined_Field_Type_With_Choice_Access
(To_Argument_Access (Usr).Typ);
begin
Result := Next (Fld, Udf.all);
return C_Int (Boolean'Pos (Result));
end Generic_Next;
function Generic_Prev (Fld : Field;
Usr : System.Address) return C_Int
is
Result : Boolean;
Udf : User_Defined_Field_Type_With_Choice_Access :=
User_Defined_Field_Type_With_Choice_Access
(To_Argument_Access (Usr).Typ);
begin
Result := Previous (Fld, Udf.all);
return C_Int (Boolean'Pos (Result));
end Generic_Prev;
-- -----------------------------------------------------------------------
--
function C_Generic_Choice return C_Field_Type
is
Res : Eti_Error;
T : C_Field_Type;
begin
if M_Generic_Choice = Null_Field_Type then
T := New_Fieldtype (Generic_Field_Check'Access,
Generic_Char_Check'Access);
if T = Null_Field_Type then
raise Form_Exception;
else
Res := Set_Fieldtype_Arg (T,
Make_Arg'Access,
Copy_Arg'Access,
Free_Arg'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Res := Set_Fieldtype_Choice (T,
Generic_Next'Access,
Generic_Prev'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end if;
M_Generic_Choice := T;
end if;
pragma Assert (M_Generic_Choice /= Null_Field_Type);
return M_Generic_Choice;
end C_Generic_Choice;
end Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
|
reznikmm/matreshka | Ada | 5,262 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.Utp.Get_Timezone_Actions.Collections is
pragma Preelaborate;
package Utp_Get_Timezone_Action_Collections is
new AMF.Generic_Collections
(Utp_Get_Timezone_Action,
Utp_Get_Timezone_Action_Access);
type Set_Of_Utp_Get_Timezone_Action is
new Utp_Get_Timezone_Action_Collections.Set with null record;
Empty_Set_Of_Utp_Get_Timezone_Action : constant Set_Of_Utp_Get_Timezone_Action;
type Ordered_Set_Of_Utp_Get_Timezone_Action is
new Utp_Get_Timezone_Action_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_Utp_Get_Timezone_Action : constant Ordered_Set_Of_Utp_Get_Timezone_Action;
type Bag_Of_Utp_Get_Timezone_Action is
new Utp_Get_Timezone_Action_Collections.Bag with null record;
Empty_Bag_Of_Utp_Get_Timezone_Action : constant Bag_Of_Utp_Get_Timezone_Action;
type Sequence_Of_Utp_Get_Timezone_Action is
new Utp_Get_Timezone_Action_Collections.Sequence with null record;
Empty_Sequence_Of_Utp_Get_Timezone_Action : constant Sequence_Of_Utp_Get_Timezone_Action;
private
Empty_Set_Of_Utp_Get_Timezone_Action : constant Set_Of_Utp_Get_Timezone_Action
:= (Utp_Get_Timezone_Action_Collections.Set with null record);
Empty_Ordered_Set_Of_Utp_Get_Timezone_Action : constant Ordered_Set_Of_Utp_Get_Timezone_Action
:= (Utp_Get_Timezone_Action_Collections.Ordered_Set with null record);
Empty_Bag_Of_Utp_Get_Timezone_Action : constant Bag_Of_Utp_Get_Timezone_Action
:= (Utp_Get_Timezone_Action_Collections.Bag with null record);
Empty_Sequence_Of_Utp_Get_Timezone_Action : constant Sequence_Of_Utp_Get_Timezone_Action
:= (Utp_Get_Timezone_Action_Collections.Sequence with null record);
end AMF.Utp.Get_Timezone_Actions.Collections;
|
AdaCore/libadalang | Ada | 174 | adb | procedure Test is
A : Integer;
--% node.p_get_aspect("address")
--% node.p_get_at_clause()
B : Integer := 2;
for A use at B'Address;
begin
null;
end Test;
|
sungyeon/drake | Ada | 4,109 | adb | with Ada.Unchecked_Conversion;
package body Ada.Numerics.dSFMT.Generating is
-- SSE2 version
use type Interfaces.Unsigned_64;
type v2df is array (0 .. 1) of Long_Float;
for v2df'Alignment use 16;
pragma Machine_Attribute (v2df, "vector_type");
pragma Machine_Attribute (v2df, "may_alias");
pragma Suppress_Initialization (v2df);
function mm_add_pd (a, b : v2df) return v2df
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_addpd";
function mm_sub_pd (a, b : v2df) return v2df
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_subpd";
type v4si is array (0 .. 3) of Unsigned_32;
for v4si'Alignment use 16;
pragma Machine_Attribute (v4si, "vector_type");
pragma Machine_Attribute (v4si, "may_alias");
pragma Suppress_Initialization (v4si);
function mm_shuffle_epi32 (a : v4si; b : Integer) return v4si
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_pshufd";
type v2di is array (0 .. 1) of Unsigned_64;
for v2di'Alignment use 16;
pragma Machine_Attribute (v2di, "vector_type");
pragma Machine_Attribute (v2di, "may_alias");
pragma Suppress_Initialization (v2di);
function mm_and_si128 (a, b : v2di) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_pand128";
function mm_or_si128 (a, b : v2di) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_por128";
function mm_xor_si128 (a, b : v2di) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_pxor128";
function mm_slli_epi64 (a : v2di; b : Integer) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_psllqi128";
function mm_srli_epi64 (a : v2di; b : Integer) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_psrlqi128";
function To_v2df is new Unchecked_Conversion (v2di, v2df);
function To_v2df is new Unchecked_Conversion (w128_t, v2df);
function To_v2di is new Unchecked_Conversion (v4si, v2di);
function To_v2di is new Unchecked_Conversion (w128_t, v2di);
function To_w128_t is new Unchecked_Conversion (v2df, w128_t);
function To_w128_t is new Unchecked_Conversion (v2di, w128_t);
SSE2_SHUFF : constant := 16#1b#;
-- 1 in 64bit for sse2
sse2_int_one : constant v2di := (1, 1);
-- 2.0 double for sse2
sse2_double_two : constant v2df := (2.0, 2.0);
-- -1.0 double for sse2
sse2_double_m_one : constant v2df := (-1.0, -1.0);
-- implementation
procedure do_recursion (
r : aliased out w128_t;
a, b : aliased w128_t;
lung : aliased in out w128_t)
is
type v4si_Access is access all v4si;
type w128_t_Access is access all w128_t;
function To_v4si is
new Unchecked_Conversion (w128_t_Access, v4si_Access);
-- mask data for sse2
sse2_param_mask : constant v2di := (MSK1, MSK2);
v, w, x, y, z : v2di;
begin
x := To_v2di (a);
z := mm_slli_epi64 (x, SL1);
y := To_v2di (mm_shuffle_epi32 (To_v4si (lung'Access).all, SSE2_SHUFF));
z := mm_xor_si128 (z, To_v2di (b));
y := mm_xor_si128 (y, z);
v := mm_srli_epi64 (y, SR);
w := mm_and_si128 (y, sse2_param_mask);
v := mm_xor_si128 (v, x);
v := mm_xor_si128 (v, w);
r := To_w128_t (v);
lung := To_w128_t (y);
end do_recursion;
procedure convert_c0o1 (w : aliased in out w128_t) is
begin
w := To_w128_t (mm_add_pd (To_v2df (w), sse2_double_m_one));
end convert_c0o1;
procedure convert_o0c1 (w : aliased in out w128_t) is
begin
w := To_w128_t (mm_sub_pd (sse2_double_two, To_v2df (w)));
end convert_o0c1;
procedure convert_o0o1 (w : aliased in out w128_t) is
begin
w := To_w128_t (
mm_add_pd (
To_v2df (mm_or_si128 (To_v2di (w), sse2_int_one)),
sse2_double_m_one));
end convert_o0o1;
end Ada.Numerics.dSFMT.Generating;
|
pdaxrom/Kino2 | Ada | 11,849 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
-- Version Control:
-- $Revision: 1.13 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
with Ada.Unchecked_Deallocation;
with Ada.Unchecked_Conversion;
-- |
-- |=====================================================================
-- | man page form_fieldtype.3x
-- |=====================================================================
-- |
package body Terminal_Interface.Curses.Forms.Field_Types is
use type Interfaces.C.int;
use type System.Address;
function To_Argument_Access is new Ada.Unchecked_Conversion
(System.Address, Argument_Access);
function Get_Fieldtype (F : Field) return C_Field_Type;
pragma Import (C, Get_Fieldtype, "field_type");
function Get_Arg (F : Field) return System.Address;
pragma Import (C, Get_Arg, "field_arg");
-- |
-- |=====================================================================
-- | man page form_field_validation.3x
-- |=====================================================================
-- |
-- |
-- |
function Get_Type (Fld : in Field) return Field_Type_Access
is
Low_Level : constant C_Field_Type := Get_Fieldtype (Fld);
Arg : Argument_Access;
begin
if Low_Level = Null_Field_Type then
return null;
else
if Low_Level = M_Builtin_Router or else
Low_Level = M_Generic_Type or else
Low_Level = M_Choice_Router or else
Low_Level = M_Generic_Choice then
Arg := To_Argument_Access (Get_Arg (Fld));
if Arg = null then
raise Form_Exception;
else
return Arg.Typ;
end if;
else
raise Form_Exception;
end if;
end if;
end Get_Type;
function Make_Arg (Args : System.Address) return System.Address
is
-- Actually args is a double indirected pointer to the arguments
-- of a C variable argument list. In theory it is now quite
-- complicated to write portable routine that reads the arguments,
-- because one has to know the growth direction of the stack and
-- the sizes of the individual arguments.
-- Fortunately we are only interested in the first argument (#0),
-- we know its size and for the first arg we don't care about
-- into which stack direction we have to proceed. We simply
-- resolve the double indirection and thats it.
type V is access all System.Address;
function To_Access is new Ada.Unchecked_Conversion (System.Address,
V);
begin
return To_Access (To_Access (Args).all).all;
end Make_Arg;
function Copy_Arg (Usr : System.Address) return System.Address
is
begin
return Usr;
end Copy_Arg;
procedure Free_Arg (Usr : in System.Address)
is
procedure Free_Type is new Ada.Unchecked_Deallocation
(Field_Type'Class, Field_Type_Access);
procedure Freeargs is new Ada.Unchecked_Deallocation
(Argument, Argument_Access);
To_Be_Free : Argument_Access := To_Argument_Access (Usr);
Low_Level : C_Field_Type;
begin
if To_Be_Free /= null then
if To_Be_Free.Usr /= System.Null_Address then
Low_Level := To_Be_Free.Cft;
if Low_Level.Freearg /= null then
Low_Level.Freearg (To_Be_Free.Usr);
end if;
end if;
if To_Be_Free.Typ /= null then
Free_Type (To_Be_Free.Typ);
end if;
Freeargs (To_Be_Free);
end if;
end Free_Arg;
procedure Wrap_Builtin (Fld : Field;
Typ : Field_Type'Class;
Cft : C_Field_Type := C_Builtin_Router)
is
Usr_Arg : System.Address := Get_Arg (Fld);
Low_Level : constant C_Field_Type := Get_Fieldtype (Fld);
Arg : Argument_Access;
Res : Eti_Error;
function Set_Fld_Type (F : Field := Fld;
Cf : C_Field_Type := Cft;
Arg1 : Argument_Access) return C_Int;
pragma Import (C, Set_Fld_Type, "set_field_type");
begin
pragma Assert (Low_Level /= Null_Field_Type);
if Cft /= C_Builtin_Router and then Cft /= C_Choice_Router then
raise Form_Exception;
else
Arg := new Argument'(Usr => System.Null_Address,
Typ => new Field_Type'Class'(Typ),
Cft => Get_Fieldtype (Fld));
if Usr_Arg /= System.Null_Address then
if Low_Level.Copyarg /= null then
Arg.Usr := Low_Level.Copyarg (Usr_Arg);
else
Arg.Usr := Usr_Arg;
end if;
end if;
Res := Set_Fld_Type (Arg1 => Arg);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end if;
end Wrap_Builtin;
function Field_Check_Router (Fld : Field;
Usr : System.Address) return C_Int
is
Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
and then Arg.Typ /= null);
if Arg.Cft.Fcheck /= null then
return Arg.Cft.Fcheck (Fld, Arg.Usr);
else
return 1;
end if;
end Field_Check_Router;
function Char_Check_Router (Ch : C_Int;
Usr : System.Address) return C_Int
is
Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
and then Arg.Typ /= null);
if Arg.Cft.Ccheck /= null then
return Arg.Cft.Ccheck (Ch, Arg.Usr);
else
return 1;
end if;
end Char_Check_Router;
function Next_Router (Fld : Field;
Usr : System.Address) return C_Int
is
Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
and then Arg.Typ /= null);
if Arg.Cft.Next /= null then
return Arg.Cft.Next (Fld, Arg.Usr);
else
return 1;
end if;
end Next_Router;
function Prev_Router (Fld : Field;
Usr : System.Address) return C_Int
is
Arg : constant Argument_Access := To_Argument_Access (Usr);
begin
pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type
and then Arg.Typ /= null);
if Arg.Cft.Prev /= null then
return Arg.Cft.Prev (Fld, Arg.Usr);
else
return 1;
end if;
end Prev_Router;
-- -----------------------------------------------------------------------
--
function C_Builtin_Router return C_Field_Type
is
Res : Eti_Error;
T : C_Field_Type;
begin
if M_Builtin_Router = Null_Field_Type then
T := New_Fieldtype (Field_Check_Router'Access,
Char_Check_Router'Access);
if T = Null_Field_Type then
raise Form_Exception;
else
Res := Set_Fieldtype_Arg (T,
Make_Arg'Access,
Copy_Arg'Access,
Free_Arg'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end if;
M_Builtin_Router := T;
end if;
pragma Assert (M_Builtin_Router /= Null_Field_Type);
return M_Builtin_Router;
end C_Builtin_Router;
-- -----------------------------------------------------------------------
--
function C_Choice_Router return C_Field_Type
is
Res : Eti_Error;
T : C_Field_Type;
begin
if M_Choice_Router = Null_Field_Type then
T := New_Fieldtype (Field_Check_Router'Access,
Char_Check_Router'Access);
if T = Null_Field_Type then
raise Form_Exception;
else
Res := Set_Fieldtype_Arg (T,
Make_Arg'Access,
Copy_Arg'Access,
Free_Arg'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Res := Set_Fieldtype_Choice (T,
Next_Router'Access,
Prev_Router'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end if;
M_Choice_Router := T;
end if;
pragma Assert (M_Choice_Router /= Null_Field_Type);
return M_Choice_Router;
end C_Choice_Router;
end Terminal_Interface.Curses.Forms.Field_Types;
|
reznikmm/matreshka | Ada | 14,976 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Time_Observations is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Time_Observation_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Time_Observation
(AMF.UML.Time_Observations.UML_Time_Observation_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Time_Observation_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Time_Observation
(AMF.UML.Time_Observations.UML_Time_Observation_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Time_Observation_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Time_Observation
(Visitor,
AMF.UML.Time_Observations.UML_Time_Observation_Access (Self),
Control);
end if;
end Visit_Element;
---------------
-- Get_Event --
---------------
overriding function Get_Event
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Named_Elements.UML_Named_Element_Access is
begin
return
AMF.UML.Named_Elements.UML_Named_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Event
(Self.Element)));
end Get_Event;
---------------
-- Set_Event --
---------------
overriding procedure Set_Event
(Self : not null access UML_Time_Observation_Proxy;
To : AMF.UML.Named_Elements.UML_Named_Element_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Event
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Event;
---------------------
-- Get_First_Event --
---------------------
overriding function Get_First_Event
(Self : not null access constant UML_Time_Observation_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_First_Event
(Self.Element);
end Get_First_Event;
---------------------
-- Set_First_Event --
---------------------
overriding procedure Set_First_Event
(Self : not null access UML_Time_Observation_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_First_Event
(Self.Element, To);
end Set_First_Event;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Time_Observation_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Time_Observation_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Time_Observation_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Time_Observation_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Time_Observation_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Time_Observation_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Time_Observation_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Time_Observation_Proxy.Namespace";
return Namespace (Self);
end Namespace;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Time_Observation_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Time_Observation_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Time_Observation_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Time_Observation_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
end AMF.Internals.UML_Time_Observations;
|
hergin/ada2fuml | Ada | 59 | adb | with SomeClass;
procedure Main is
begin
null;
end Main;
|
BrickBot/Bound-T-H8-300 | Ada | 11,239 | adb | -- Options.Traversal (body)
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- This software is provided by the copyright holders and contributors "as is" and
-- any express or implied warranties, including, but not limited to, the implied
-- warranties of merchantability and fitness for a particular purpose are
-- disclaimed. In no event shall the copyright owner or contributors be liable for
-- any direct, indirect, incidental, special, exemplary, or consequential damages
-- (including, but not limited to, procurement of substitute goods or services;
-- loss of use, data, or profits; or business interruption) however caused and
-- on any theory of liability, whether in contract, strict liability, or tort
-- (including negligence or otherwise) arising in any way out of the use of this
-- software, even if advised of the possibility of such damage.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.2 $
-- $Date: 2015/10/24 20:05:50 $
--
-- $Log: options-traversal.adb,v $
-- Revision 1.2 2015/10/24 20:05:50 niklas
-- Moved to free licence.
--
-- Revision 1.1 2011-08-31 04:17:13 niklas
-- Added for BT-CH-0222: Option registry. Option -dump. External help files.
--
with Ada.Text_IO;
package body Options.Traversal is
function Top_Group (Among : Group_Set_T) return Group_Index_T
--
-- The group with the highest (numerically smallest) priority,
-- from Among a given set of groups.
--
-- Propagates Constraint_Error if the given group set is empty.
--
is
Cand_Known : Boolean := False;
-- We have a candidate for the top position.
Cand_Index : Group_Index_T;
-- The (index of the) candidate group.
Cand_Prio : Group_Priority_T := Group_Priority_T'Last;
-- The priority of the candidate group.
-- Initialization is to disable GNAT warnings.
begin
for A in Among'Range loop
if Among(A) then
if (not Cand_Known)
or else Priority_Of (A) < Cand_Prio
then
-- The first or best candidate we have found.
Cand_Known := True;
Cand_Index := A;
Cand_Prio := Priority_Of (A);
end if;
end if;
end loop;
if not Cand_Known then
-- The group set is empty.
raise Constraint_Error;
end if;
return Cand_Index;
end Top_Group;
type Group_List_T is array (Positive range <>) of Group_Index_T;
--
-- A list of (indices of) groups.
function Sorted (Groups : Group_Set_T) return Group_List_T
--
-- The Groups in high-to-low priority order.
--
is
List : Group_List_T (1 .. Groups'Length);
Last : Natural := 0;
-- The result will be List(1 .. Last).
Rest : Group_Set_T := Groups;
-- The rest of the Groups, not yet in List.
Top : Group_Index_T;
-- The highest-priority of the Rest groups.
begin
while Rest /= Null_Group_Set loop
Top := Top_Group (Rest);
Last := Last + 1;
List(Last) := Top;
Rest(Top) := False;
end loop;
return List(1 .. Last);
end Sorted;
procedure Enter_All (
Groups : in Group_List_T;
Visitor : in out Visitor_T'Class)
--
-- Enters all the Groups in the given order.
--
is
begin
for G in Groups'Range loop
Enter_Group (Visitor, Group_Table(Groups(G)));
end loop;
end Enter_All;
procedure Leave_All (
Groups : in Group_List_T;
Visitor : in out Visitor_T'Class)
--
-- Leaves all the Groups in the given order, reversed.
--
is
begin
for G in reverse Groups'Range loop
Leave_Group (Visitor, Group_Table(Groups(G)));
end loop;
end Leave_All;
function Choose (
From : Option_List_T;
Group : Group_Index_T;
Member : Boolean)
return Option_List_T
--
-- Those options From the given list, that are/are not Members
-- of the given Group.
--
is
Result : Option_List_T (1 .. From'Length);
Last : Natural := 0;
-- The result is Result(1 .. Last).
begin
for F in From'Range loop
if From(F).Groups(Group) = Member then
Last := Last + 1;
Result(Last) := From(F);
end if;
end loop;
return Result(1 .. Last);
end Choose;
procedure Traverse (
List : in Option_List_T;
Within : in Group_Set_T := Null_Group_Set;
Synonyms : in Boolean;
Visitor : in out Visitor_T'Class)
is
-- Principles of operation:
--
-- First we find the "common" set of groups to which all
-- these options belong (intersection of group sets) and
-- the "whole" set of groups to which any options below (union
-- of group sets).
--
-- The "differential" groups are those groups to which some
-- options belong, but to which not all options belong. This
-- is the set difference between the whole and common sets
-- of groups.
--
-- Now we present (show) all options that belong exactly
-- to the common set of groups, and only to those groups,
-- in the same order as in the List.
--
-- If there are any List options left, we divide them into
-- two sets based on the "top differential group" which is
-- the differential group with the highest priority, and
-- recursively traverse in the same manner first the options
-- that belong to the top group, and then those that do not
-- belong to the top group.
Common : Group_Set_T := (others => True);
-- The groups to which all List options belong
Whole : Group_Set_T := (others => False);
-- The groups to which some (any) List option belongs.
Differ : Group_Set_T;
-- The groups to which some, but not all, List options belong.
Current : Group_Set_T;
-- The currently "entered" set of groups.
Rest : Option_List_T (1 .. List'Length);
Last : Natural := 0;
-- The rest of the Listed options, not yet traversed,
-- are Rest(1 .. Last).
begin
--Ada.Text_IO.Put_Line (
-- "Traversing"
-- & Natural'Image (List'Length)
-- & " options, Within groups "
-- & Image (Within));
-- Find the common and whole sets of groups:
for L in List'Range loop
if Synonyms or not Is_Synonym (List(L)) then
Common := Common and List(L).Groups;
Whole := Whole or List(L).Groups;
end if;
end loop;
Differ := Whole and not Common;
--Ada.Text_IO.Put_Line ("Common groups: " & Image (Common));
--Ada.Text_IO.Put_Line ("Whole groups: " & Image (Whole ));
--Ada.Text_IO.Put_Line ("Differ groups: " & Image (Differ));
if Common = Null_Group_Set
and Differ /= Null_Group_Set
then
-- There are no common groups, but there are
-- some differentiating groups.
Last := List'Length;
Rest(1 .. Last) := List;
Current := Within;
else
-- There are some common groups, or there are no
-- differentiating groups (a special case is that
-- these options belong to no groups at all).
-- Visit the options that belong only to the common groups:
Enter_All (Sorted (Common and not Within), Visitor);
Current := Common or Within;
for L in List'Range loop
if Is_Synonym (List(L)) and not Synonyms then
-- A synonym to be skipped.
null;
elsif List(L).Groups = Common then
-- This option belongs only to the Common groups.
-- Visit it now.
Visit (Visitor, List(L));
else
-- This option belongs also to some other groups.
-- Visit it later.
Last := Last + 1;
Rest(Last) := List(L);
end if;
end loop;
end if;
if Last > 0 then
-- Some of the List options are not yet Visited.
-- This implies that there are some Differ groups.
declare
Top : constant Group_Index_T := Top_Group (Differ);
Outside : constant Option_List_T := Choose (
From => Rest(1 .. Last),
Group => Top,
Member => False);
-- Those options from Rest that do not belong to the Top group.
-- This set can be empty.
Inside : constant Option_List_T := Choose (
From => Rest(1 .. Last),
Group => Top,
Member => True);
-- Those options from Rest that belong to the Top group.
-- This set is non-empty; if it were empty, some options
-- already visited would have to belong to the Top group,
-- which means that Top would be one of the Common groups,
-- which is impossible because Top is a Differ group.
begin
--Ada.Text_IO.Put_Line (
-- "Top Differ group is "
-- & String_Pool.To_String (Group_Table(Top).Name));
Enter_Group (
Group => Group_Table(Top),
Visitor => Visitor);
Current(Top) := True;
Traverse (
List => Inside,
Within => Current,
Synonyms => Synonyms,
Visitor => Visitor);
Leave_Group (
Group => Group_Table(Top),
Visitor => Visitor);
Current(Top) := False;
if Outside'Length > 0 then
Traverse (
List => Outside,
Within => Current,
Synonyms => Synonyms,
Visitor => Visitor);
end if;
end;
end if;
if Common /= Null_Group_Set
or Differ = Null_Group_Set
then
-- We entered the Common groups, above, so we
-- should also leave them.
Leave_All (Sorted (Current and not Within), Visitor);
end if;
end Traverse;
end Options.Traversal;
|
burratoo/Acton | Ada | 1,541 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAKLAND COMPONENTS --
-- --
-- OAKLAND.PROTECTED_OBJECTS --
-- --
-- Copyright (C) 2011-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with Oak.Brokers; use Oak.Brokers;
with Oak.Indices; use Oak.Indices;
with Oak.Message; use Oak.Message;
with System; use System;
package Oakland.Protected_Objects with Preelaborate is
type Entry_Barrier_Function_Handler is
access function (PO : System.Address;
E : Protected_Entry_Index) return Boolean;
procedure Enter_Protected_Object
(PO : in Protected_Id;
Subprogram_Kind : in Protected_Subprogram_Type;
Entry_Id : in Entry_Index := No_Entry);
procedure Exit_Protected_Object (PO : Protected_Id);
function Entry_Count
(PO : in Protected_Id;
Entry_Id : in Entry_Index) return Natural;
end Oakland.Protected_Objects;
|
MinimSecure/unum-sdk | Ada | 921 | adb | -- Copyright 2007-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
I : Integer := 1;
begin
Call_Me (Int => 1, Flt => 2.0, Bln => True, Ary => (1, 4, 8), Chr => 'j',
Sad => I'Address, Rec => (A => 3, B => 7));
end Foo;
|
AdaCore/ada-traits-containers | Ada | 1,572 | ads | --
-- Copyright (C) 2015-2016, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
-- Unbounded lists of strings.
-- A special allocation strategy is used for strings, so that small strings
-- are directly stored in the list's node, and do not require memory
-- allocation. This might make things faster in some cases, at the cost of
-- using more memory since the nodes are bigger.
-- Consider using Conts.Lists.Indefinite_Unbounded_Ref for another list
-- usable with strings.
pragma Ada_2012;
with Ada.Finalization;
with Conts.Elements.Arrays;
with Conts.Lists.Generics;
with Conts.Lists.Storage.Unbounded;
package Conts.Lists.Strings is
pragma Assertion_Policy
(Pre => Suppressible, Ghost => Suppressible, Post => Ignore);
package Elements is new Conts.Elements.Arrays
(Positive, Character, String, Conts.Global_Pool);
package Storage is new Conts.Lists.Storage.Unbounded
(Elements => Elements.Traits,
Container_Base_Type => Ada.Finalization.Controlled,
Pool => Conts.Global_Pool);
package Lists is new Conts.Lists.Generics (Storage.Traits);
subtype Cursor is Lists.Cursor;
type List is new Lists.List with null record
with Iterable => (First => First_Primitive,
Next => Next_Primitive,
Has_Element => Has_Element_Primitive,
Element => Element_Primitive);
package Cursors renames Lists.Cursors;
package Maps renames Lists.Maps;
end Conts.Lists.Strings;
|
reznikmm/matreshka | Ada | 63,495 | 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$
------------------------------------------------------------------------------
-- Containment iterator for elements of UML metamodel. It should be used with
-- metamodel independent containment iterator (and others metamodel specific
-- containment iterators when necessary) to construct concrete usabe iterator.
------------------------------------------------------------------------------
with AMF.UML.Abstractions;
with AMF.UML.Accept_Call_Actions;
with AMF.UML.Accept_Event_Actions;
with AMF.UML.Action_Execution_Specifications;
with AMF.UML.Action_Input_Pins;
with AMF.UML.Activities;
with AMF.UML.Activity_Final_Nodes;
with AMF.UML.Activity_Parameter_Nodes;
with AMF.UML.Activity_Partitions;
with AMF.UML.Actors;
with AMF.UML.Add_Structural_Feature_Value_Actions;
with AMF.UML.Add_Variable_Value_Actions;
with AMF.UML.Any_Receive_Events;
with AMF.UML.Artifacts;
with AMF.UML.Associations;
with AMF.UML.Association_Classes;
with AMF.UML.Behavior_Execution_Specifications;
with AMF.UML.Broadcast_Signal_Actions;
with AMF.UML.Call_Behavior_Actions;
with AMF.UML.Call_Events;
with AMF.UML.Call_Operation_Actions;
with AMF.UML.Central_Buffer_Nodes;
with AMF.UML.Change_Events;
with AMF.UML.Classes;
with AMF.UML.Classifier_Template_Parameters;
with AMF.UML.Clauses;
with AMF.UML.Clear_Association_Actions;
with AMF.UML.Clear_Structural_Feature_Actions;
with AMF.UML.Clear_Variable_Actions;
with AMF.UML.Collaborations;
with AMF.UML.Collaboration_Uses;
with AMF.UML.Combined_Fragments;
with AMF.UML.Comments;
with AMF.UML.Communication_Paths;
with AMF.UML.Components;
with AMF.UML.Component_Realizations;
with AMF.UML.Conditional_Nodes;
with AMF.UML.Connectable_Element_Template_Parameters;
with AMF.UML.Connection_Point_References;
with AMF.UML.Connectors;
with AMF.UML.Connector_Ends;
with AMF.UML.Consider_Ignore_Fragments;
with AMF.UML.Constraints;
with AMF.UML.Continuations;
with AMF.UML.Control_Flows;
with AMF.UML.Create_Link_Actions;
with AMF.UML.Create_Link_Object_Actions;
with AMF.UML.Create_Object_Actions;
with AMF.UML.Data_Store_Nodes;
with AMF.UML.Data_Types;
with AMF.UML.Decision_Nodes;
with AMF.UML.Dependencies;
with AMF.UML.Deployments;
with AMF.UML.Deployment_Specifications;
with AMF.UML.Destroy_Link_Actions;
with AMF.UML.Destroy_Object_Actions;
with AMF.UML.Destruction_Occurrence_Specifications;
with AMF.UML.Devices;
with AMF.UML.Durations;
with AMF.UML.Duration_Constraints;
with AMF.UML.Duration_Intervals;
with AMF.UML.Duration_Observations;
with AMF.UML.Element_Imports;
with AMF.UML.Enumerations;
with AMF.UML.Enumeration_Literals;
with AMF.UML.Exception_Handlers;
with AMF.UML.Execution_Environments;
with AMF.UML.Execution_Occurrence_Specifications;
with AMF.UML.Expansion_Nodes;
with AMF.UML.Expansion_Regions;
with AMF.UML.Expressions;
with AMF.UML.Extends;
with AMF.UML.Extensions;
with AMF.UML.Extension_Ends;
with AMF.UML.Extension_Points;
with AMF.UML.Final_States;
with AMF.UML.Flow_Final_Nodes;
with AMF.UML.Fork_Nodes;
with AMF.UML.Function_Behaviors;
with AMF.UML.Gates;
with AMF.UML.General_Orderings;
with AMF.UML.Generalizations;
with AMF.UML.Generalization_Sets;
with AMF.UML.Images;
with AMF.UML.Includes;
with AMF.UML.Information_Flows;
with AMF.UML.Information_Items;
with AMF.UML.Initial_Nodes;
with AMF.UML.Input_Pins;
with AMF.UML.Instance_Specifications;
with AMF.UML.Instance_Values;
with AMF.UML.Interactions;
with AMF.UML.Interaction_Constraints;
with AMF.UML.Interaction_Operands;
with AMF.UML.Interaction_Uses;
with AMF.UML.Interfaces;
with AMF.UML.Interface_Realizations;
with AMF.UML.Interruptible_Activity_Regions;
with AMF.UML.Intervals;
with AMF.UML.Interval_Constraints;
with AMF.UML.Join_Nodes;
with AMF.UML.Lifelines;
with AMF.UML.Link_End_Creation_Datas;
with AMF.UML.Link_End_Datas;
with AMF.UML.Link_End_Destruction_Datas;
with AMF.UML.Literal_Booleans;
with AMF.UML.Literal_Integers;
with AMF.UML.Literal_Nulls;
with AMF.UML.Literal_Reals;
with AMF.UML.Literal_Strings;
with AMF.UML.Literal_Unlimited_Naturals;
with AMF.UML.Loop_Nodes;
with AMF.UML.Manifestations;
with AMF.UML.Merge_Nodes;
with AMF.UML.Messages;
with AMF.UML.Message_Occurrence_Specifications;
with AMF.UML.Models;
with AMF.UML.Nodes;
with AMF.UML.Object_Flows;
with AMF.UML.Occurrence_Specifications;
with AMF.UML.Opaque_Actions;
with AMF.UML.Opaque_Behaviors;
with AMF.UML.Opaque_Expressions;
with AMF.UML.Operations;
with AMF.UML.Operation_Template_Parameters;
with AMF.UML.Output_Pins;
with AMF.UML.Packages;
with AMF.UML.Package_Imports;
with AMF.UML.Package_Merges;
with AMF.UML.Parameters;
with AMF.UML.Parameter_Sets;
with AMF.UML.Part_Decompositions;
with AMF.UML.Ports;
with AMF.UML.Primitive_Types;
with AMF.UML.Profiles;
with AMF.UML.Profile_Applications;
with AMF.UML.Properties;
with AMF.UML.Protocol_Conformances;
with AMF.UML.Protocol_State_Machines;
with AMF.UML.Protocol_Transitions;
with AMF.UML.Pseudostates;
with AMF.UML.Qualifier_Values;
with AMF.UML.Raise_Exception_Actions;
with AMF.UML.Read_Extent_Actions;
with AMF.UML.Read_Is_Classified_Object_Actions;
with AMF.UML.Read_Link_Actions;
with AMF.UML.Read_Link_Object_End_Actions;
with AMF.UML.Read_Link_Object_End_Qualifier_Actions;
with AMF.UML.Read_Self_Actions;
with AMF.UML.Read_Structural_Feature_Actions;
with AMF.UML.Read_Variable_Actions;
with AMF.UML.Realizations;
with AMF.UML.Receptions;
with AMF.UML.Reclassify_Object_Actions;
with AMF.UML.Redefinable_Template_Signatures;
with AMF.UML.Reduce_Actions;
with AMF.UML.Regions;
with AMF.UML.Remove_Structural_Feature_Value_Actions;
with AMF.UML.Remove_Variable_Value_Actions;
with AMF.UML.Reply_Actions;
with AMF.UML.Send_Object_Actions;
with AMF.UML.Send_Signal_Actions;
with AMF.UML.Sequence_Nodes;
with AMF.UML.Signals;
with AMF.UML.Signal_Events;
with AMF.UML.Slots;
with AMF.UML.Start_Classifier_Behavior_Actions;
with AMF.UML.Start_Object_Behavior_Actions;
with AMF.UML.States;
with AMF.UML.State_Invariants;
with AMF.UML.State_Machines;
with AMF.UML.Stereotypes;
with AMF.UML.String_Expressions;
with AMF.UML.Structured_Activity_Nodes;
with AMF.UML.Substitutions;
with AMF.UML.Template_Bindings;
with AMF.UML.Template_Parameters;
with AMF.UML.Template_Parameter_Substitutions;
with AMF.UML.Template_Signatures;
with AMF.UML.Test_Identity_Actions;
with AMF.UML.Time_Constraints;
with AMF.UML.Time_Events;
with AMF.UML.Time_Expressions;
with AMF.UML.Time_Intervals;
with AMF.UML.Time_Observations;
with AMF.UML.Transitions;
with AMF.UML.Triggers;
with AMF.UML.Unmarshall_Actions;
with AMF.UML.Usages;
with AMF.UML.Use_Cases;
with AMF.UML.Value_Pins;
with AMF.UML.Value_Specification_Actions;
with AMF.UML.Variables;
with AMF.Visitors.UML_Iterators;
generic
type Base_Iterator is abstract tagged limited private;
package AMF.Visitors.Generic_UML_Containment is
type UML_Containment_Iterator is
limited new Base_Iterator
and AMF.Visitors.UML_Iterators.UML_Iterator
with private;
overriding procedure Visit_Abstraction
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Abstractions.UML_Abstraction_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Accept_Call_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Accept_Call_Actions.UML_Accept_Call_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Accept_Event_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Accept_Event_Actions.UML_Accept_Event_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Action_Execution_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Action_Execution_Specifications.UML_Action_Execution_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Action_Input_Pin
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Action_Input_Pins.UML_Action_Input_Pin_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Activity
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Activities.UML_Activity_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Activity_Final_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Activity_Final_Nodes.UML_Activity_Final_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Activity_Parameter_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Activity_Parameter_Nodes.UML_Activity_Parameter_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Activity_Partition
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Activity_Partitions.UML_Activity_Partition_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Actor
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Actors.UML_Actor_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Add_Structural_Feature_Value_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Add_Structural_Feature_Value_Actions.UML_Add_Structural_Feature_Value_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Add_Variable_Value_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Add_Variable_Value_Actions.UML_Add_Variable_Value_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Any_Receive_Event
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Any_Receive_Events.UML_Any_Receive_Event_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Artifact
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Artifacts.UML_Artifact_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Association
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Associations.UML_Association_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Association_Class
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Association_Classes.UML_Association_Class_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Behavior_Execution_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Behavior_Execution_Specifications.UML_Behavior_Execution_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Broadcast_Signal_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Broadcast_Signal_Actions.UML_Broadcast_Signal_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Call_Behavior_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Call_Behavior_Actions.UML_Call_Behavior_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Call_Event
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Call_Events.UML_Call_Event_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Call_Operation_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Call_Operation_Actions.UML_Call_Operation_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Central_Buffer_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Central_Buffer_Nodes.UML_Central_Buffer_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Change_Event
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Change_Events.UML_Change_Event_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Class
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Classes.UML_Class_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Classifier_Template_Parameter
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Clause
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Clauses.UML_Clause_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Clear_Association_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Clear_Association_Actions.UML_Clear_Association_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Clear_Structural_Feature_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Clear_Structural_Feature_Actions.UML_Clear_Structural_Feature_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Clear_Variable_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Clear_Variable_Actions.UML_Clear_Variable_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Collaboration
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Collaborations.UML_Collaboration_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Collaboration_Use
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Combined_Fragment
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Combined_Fragments.UML_Combined_Fragment_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Comment
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Comments.UML_Comment_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Communication_Path
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Communication_Paths.UML_Communication_Path_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Component
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Components.UML_Component_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Component_Realization
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Component_Realizations.UML_Component_Realization_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Conditional_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Conditional_Nodes.UML_Conditional_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Connectable_Element_Template_Parameter
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Connection_Point_Reference
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Connection_Point_References.UML_Connection_Point_Reference_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Connector
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Connectors.UML_Connector_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Connector_End
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Connector_Ends.UML_Connector_End_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Consider_Ignore_Fragment
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Consider_Ignore_Fragments.UML_Consider_Ignore_Fragment_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Constraint
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Constraints.UML_Constraint_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Continuation
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Continuations.UML_Continuation_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Control_Flow
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Control_Flows.UML_Control_Flow_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Create_Link_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Create_Link_Actions.UML_Create_Link_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Create_Link_Object_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Create_Link_Object_Actions.UML_Create_Link_Object_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Create_Object_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Create_Object_Actions.UML_Create_Object_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Data_Store_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Data_Store_Nodes.UML_Data_Store_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Data_Type
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Data_Types.UML_Data_Type_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Decision_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Decision_Nodes.UML_Decision_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Dependency
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Dependencies.UML_Dependency_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Deployment
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Deployments.UML_Deployment_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Deployment_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Deployment_Specifications.UML_Deployment_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Destroy_Link_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Destroy_Link_Actions.UML_Destroy_Link_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Destroy_Object_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Destroy_Object_Actions.UML_Destroy_Object_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Destruction_Occurrence_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Destruction_Occurrence_Specifications.UML_Destruction_Occurrence_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Device
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Devices.UML_Device_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Duration
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Durations.UML_Duration_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Duration_Constraint
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Duration_Constraints.UML_Duration_Constraint_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Duration_Interval
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Duration_Intervals.UML_Duration_Interval_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Duration_Observation
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Duration_Observations.UML_Duration_Observation_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Element_Import
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Element_Imports.UML_Element_Import_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Enumeration
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Enumerations.UML_Enumeration_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Enumeration_Literal
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Exception_Handler
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Exception_Handlers.UML_Exception_Handler_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Execution_Environment
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Execution_Environments.UML_Execution_Environment_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Execution_Occurrence_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Execution_Occurrence_Specifications.UML_Execution_Occurrence_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Expansion_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Expansion_Nodes.UML_Expansion_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Expansion_Region
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Expansion_Regions.UML_Expansion_Region_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Expression
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Expressions.UML_Expression_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Extend
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Extends.UML_Extend_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Extension
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Extensions.UML_Extension_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Extension_End
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Extension_Ends.UML_Extension_End_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Extension_Point
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Extension_Points.UML_Extension_Point_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Final_State
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Final_States.UML_Final_State_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Flow_Final_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Flow_Final_Nodes.UML_Flow_Final_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Fork_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Fork_Nodes.UML_Fork_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Function_Behavior
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Function_Behaviors.UML_Function_Behavior_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Gate
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Gates.UML_Gate_Access;
Control : in out Traverse_Control);
overriding procedure Visit_General_Ordering
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.General_Orderings.UML_General_Ordering_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Generalization
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Generalizations.UML_Generalization_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Generalization_Set
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Generalization_Sets.UML_Generalization_Set_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Image
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Images.UML_Image_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Include
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Includes.UML_Include_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Information_Flow
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Information_Flows.UML_Information_Flow_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Information_Item
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Information_Items.UML_Information_Item_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Initial_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Initial_Nodes.UML_Initial_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Input_Pin
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Input_Pins.UML_Input_Pin_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Instance_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Instance_Specifications.UML_Instance_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Instance_Value
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Instance_Values.UML_Instance_Value_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interaction
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interactions.UML_Interaction_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interaction_Constraint
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interaction_Constraints.UML_Interaction_Constraint_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interaction_Operand
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interaction_Use
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interaction_Uses.UML_Interaction_Use_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interface
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interfaces.UML_Interface_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interface_Realization
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interface_Realizations.UML_Interface_Realization_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interruptible_Activity_Region
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interval
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Intervals.UML_Interval_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Interval_Constraint
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Interval_Constraints.UML_Interval_Constraint_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Join_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Join_Nodes.UML_Join_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Lifeline
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Lifelines.UML_Lifeline_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Link_End_Creation_Data
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Link_End_Creation_Datas.UML_Link_End_Creation_Data_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Link_End_Data
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Link_End_Datas.UML_Link_End_Data_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Link_End_Destruction_Data
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Link_End_Destruction_Datas.UML_Link_End_Destruction_Data_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Literal_Boolean
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Literal_Booleans.UML_Literal_Boolean_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Literal_Integer
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Literal_Integers.UML_Literal_Integer_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Literal_Null
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Literal_Nulls.UML_Literal_Null_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Literal_Real
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Literal_Reals.UML_Literal_Real_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Literal_String
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Literal_Strings.UML_Literal_String_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Literal_Unlimited_Natural
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Literal_Unlimited_Naturals.UML_Literal_Unlimited_Natural_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Loop_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Loop_Nodes.UML_Loop_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Manifestation
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Manifestations.UML_Manifestation_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Merge_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Merge_Nodes.UML_Merge_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Message
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Messages.UML_Message_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Message_Occurrence_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Message_Occurrence_Specifications.UML_Message_Occurrence_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Model
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Models.UML_Model_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Nodes.UML_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Object_Flow
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Object_Flows.UML_Object_Flow_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Occurrence_Specification
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Opaque_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Opaque_Actions.UML_Opaque_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Opaque_Behavior
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Opaque_Behaviors.UML_Opaque_Behavior_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Opaque_Expression
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Operation
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Operations.UML_Operation_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Operation_Template_Parameter
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Output_Pin
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Output_Pins.UML_Output_Pin_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Package
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Packages.UML_Package_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Package_Import
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Package_Imports.UML_Package_Import_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Package_Merge
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Package_Merges.UML_Package_Merge_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Parameter
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Parameters.UML_Parameter_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Parameter_Set
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Parameter_Sets.UML_Parameter_Set_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Part_Decomposition
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Port
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Ports.UML_Port_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Primitive_Type
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Primitive_Types.UML_Primitive_Type_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Profile
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Profiles.UML_Profile_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Profile_Application
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Profile_Applications.UML_Profile_Application_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Property
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Properties.UML_Property_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Protocol_Conformance
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Protocol_Conformances.UML_Protocol_Conformance_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Protocol_State_Machine
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Protocol_State_Machines.UML_Protocol_State_Machine_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Protocol_Transition
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Protocol_Transitions.UML_Protocol_Transition_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Pseudostate
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Pseudostates.UML_Pseudostate_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Qualifier_Value
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Qualifier_Values.UML_Qualifier_Value_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Raise_Exception_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Raise_Exception_Actions.UML_Raise_Exception_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Extent_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Extent_Actions.UML_Read_Extent_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Is_Classified_Object_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Is_Classified_Object_Actions.UML_Read_Is_Classified_Object_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Link_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Link_Actions.UML_Read_Link_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Link_Object_End_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Link_Object_End_Actions.UML_Read_Link_Object_End_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Link_Object_End_Qualifier_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Link_Object_End_Qualifier_Actions.UML_Read_Link_Object_End_Qualifier_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Self_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Self_Actions.UML_Read_Self_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Structural_Feature_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Structural_Feature_Actions.UML_Read_Structural_Feature_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Read_Variable_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Read_Variable_Actions.UML_Read_Variable_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Realization
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Realizations.UML_Realization_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Reception
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Receptions.UML_Reception_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Reclassify_Object_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Reclassify_Object_Actions.UML_Reclassify_Object_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Redefinable_Template_Signature
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Reduce_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Reduce_Actions.UML_Reduce_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Region
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Regions.UML_Region_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Remove_Structural_Feature_Value_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Remove_Structural_Feature_Value_Actions.UML_Remove_Structural_Feature_Value_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Remove_Variable_Value_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Remove_Variable_Value_Actions.UML_Remove_Variable_Value_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Reply_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Reply_Actions.UML_Reply_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Send_Object_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Send_Object_Actions.UML_Send_Object_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Send_Signal_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Send_Signal_Actions.UML_Send_Signal_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Sequence_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Sequence_Nodes.UML_Sequence_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Signal
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Signals.UML_Signal_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Signal_Event
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Signal_Events.UML_Signal_Event_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Slot
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Slots.UML_Slot_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Start_Classifier_Behavior_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Start_Classifier_Behavior_Actions.UML_Start_Classifier_Behavior_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Start_Object_Behavior_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Start_Object_Behavior_Actions.UML_Start_Object_Behavior_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_State
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.States.UML_State_Access;
Control : in out Traverse_Control);
overriding procedure Visit_State_Invariant
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.State_Invariants.UML_State_Invariant_Access;
Control : in out Traverse_Control);
overriding procedure Visit_State_Machine
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.State_Machines.UML_State_Machine_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Stereotype
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Stereotypes.UML_Stereotype_Access;
Control : in out Traverse_Control);
overriding procedure Visit_String_Expression
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.String_Expressions.UML_String_Expression_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Structured_Activity_Node
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Substitution
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Substitutions.UML_Substitution_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Template_Binding
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Template_Bindings.UML_Template_Binding_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Template_Parameter
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Template_Parameter_Substitution
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Template_Parameter_Substitutions.UML_Template_Parameter_Substitution_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Template_Signature
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Template_Signatures.UML_Template_Signature_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Test_Identity_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Test_Identity_Actions.UML_Test_Identity_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Time_Constraint
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Time_Constraints.UML_Time_Constraint_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Time_Event
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Time_Events.UML_Time_Event_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Time_Expression
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Time_Expressions.UML_Time_Expression_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Time_Interval
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Time_Intervals.UML_Time_Interval_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Time_Observation
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Time_Observations.UML_Time_Observation_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Transition
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Transitions.UML_Transition_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Trigger
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Triggers.UML_Trigger_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Unmarshall_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Unmarshall_Actions.UML_Unmarshall_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Usage
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Usages.UML_Usage_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Use_Case
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Use_Cases.UML_Use_Case_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Value_Pin
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Value_Pins.UML_Value_Pin_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Value_Specification_Action
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Value_Specification_Actions.UML_Value_Specification_Action_Access;
Control : in out Traverse_Control);
overriding procedure Visit_Variable
(Self : in out UML_Containment_Iterator;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Element : not null AMF.UML.Variables.UML_Variable_Access;
Control : in out Traverse_Control);
private
type UML_Containment_Iterator is
limited new Base_Iterator
and AMF.Visitors.UML_Iterators.UML_Iterator
with null record;
end AMF.Visitors.Generic_UML_Containment;
|
reznikmm/matreshka | Ada | 4,043 | 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_Vertical_Align_Attributes;
package Matreshka.ODF_Style.Vertical_Align_Attributes is
type Style_Vertical_Align_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Vertical_Align_Attributes.ODF_Style_Vertical_Align_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Vertical_Align_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Vertical_Align_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Vertical_Align_Attributes;
|
zhmu/ananas | Ada | 1,457 | ads | with System;
package Init7 is
type Nested1 is record
C1 : Integer;
C2 : Integer;
C3 : Integer;
end record;
for Nested1'Bit_Order use System.Low_Order_First;
for Nested1'Scalar_Storage_Order use System.Low_Order_First;
for Nested1 use record
C1 at 0 range 0 .. 31;
C2 at 4 range 0 .. 31;
C3 at 8 range 0 .. 31;
end record;
type R1 is record
I : Integer;
N : Nested1;
end record;
for R1'Bit_Order use System.Low_Order_First;
for R1'Scalar_Storage_Order use System.Low_Order_First;
for R1 use record
I at 0 range 0 .. 31;
N at 4 range 0 .. 95;
end record;
type Nested2 is record
C1 : Integer;
C2 : Integer;
C3 : Integer;
end record;
for Nested2'Bit_Order use System.High_Order_First;
for Nested2'Scalar_Storage_Order use System.High_Order_First;
for Nested2 use record
C1 at 0 range 0 .. 31;
C2 at 4 range 0 .. 31;
C3 at 8 range 0 .. 31;
end record;
type R2 is record
I : Integer;
N : Nested2;
end record;
for R2'Bit_Order use System.High_Order_First;
for R2'Scalar_Storage_Order use System.High_Order_First;
for R2 use record
I at 0 range 0 .. 31;
N at 4 range 0 .. 95;
end record;
My_R1 : constant R1 := (I => 16#12345678#,
N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
My_R2 : constant R2 := (I => 16#12345678#,
N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
end Init7;
|
reznikmm/matreshka | Ada | 3,704 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Office_Annotation_End_Elements is
pragma Preelaborate;
type ODF_Office_Annotation_End is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Office_Annotation_End_Access is
access all ODF_Office_Annotation_End'Class
with Storage_Size => 0;
end ODF.DOM.Office_Annotation_End_Elements;
|
stcarrez/ada-util | Ada | 6,593 | ads | -----------------------------------------------------------------------
-- util-beans-objects-maps -- Object maps
-- Copyright (C) 2010, 2011, 2012, 2017, 2018, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Strings.Hash;
with Util.Beans.Basic;
with Util.Beans.Objects.Iterators;
-- == Object maps ==
-- The `Util.Beans.Objects.Maps` package provides a map of objects with a `String`
-- as key. This allows to associated names to objects.
-- To create an instance of the map, it is possible to use the `Create` function
-- as follows:
--
-- with Util.Beans.Objects.Maps;
-- ...
-- Person : Util.Beans.Objects.Object := Util.Beans.Objects.Maps.Create;
--
-- Then, it becomes possible to populate the map with objects by using
-- the `Set_Value` procedure as follows:
--
-- Util.Beans.Objects.Set_Value (Person, "name",
-- To_Object (Name));
-- Util.Beans.Objects.Set_Value (Person, "last_name",
-- To_Object (Last_Name));
-- Util.Beans.Objects.Set_Value (Person, "age",
-- To_Object (Age));
--
-- Getting a value from the map is done by using the `Get_Value` function:
--
-- Name : Util.Beans.Objects.Object := Get_Value (Person, "name");
--
-- It is also possible to iterate over the values of the map by using
-- the `Iterate` procedure or by using the iterator support provided by
-- the `Util.Beans.Objects.Iterators` package.
package Util.Beans.Objects.Maps is
subtype Iterator_Bean is Util.Beans.Objects.Iterators.Iterator_Bean;
package Maps is
new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String,
Element_Type => Object,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "=");
subtype Cursor is Maps.Cursor;
subtype Map is Maps.Map;
-- Make all the Maps operations available (a kind of 'use Maps' for anybody).
function Length (Container : in Map) return Ada.Containers.Count_Type renames Maps.Length;
function Is_Empty (Container : in Map) return Boolean renames Maps.Is_Empty;
procedure Clear (Container : in out Map) renames Maps.Clear;
function Key (Position : Cursor) return String renames Maps.Key;
procedure Include (Container : in out Map;
Key : in String;
New_Item : in Object) renames Maps.Include;
procedure Query_Element (Position : in Cursor;
Process : not null access procedure (Key : String;
Element : Object))
renames Maps.Query_Element;
function Has_Element (Position : Cursor) return Boolean renames Maps.Has_Element;
function Element (Position : Cursor) return Object renames Maps.Element;
procedure Next (Position : in out Cursor) renames Maps.Next;
function Next (Position : Cursor) return Cursor renames Maps.Next;
function Equivalent_Keys (Left, Right : Cursor) return Boolean renames Maps.Equivalent_Keys;
function Equivalent_Keys (Left : Cursor; Right : String) return Boolean
renames Maps.Equivalent_Keys;
function Equivalent_Keys (Left : String; Right : Cursor) return Boolean
renames Maps.Equivalent_Keys;
function Copy (Source : Maps.Map; Capacity : in Ada.Containers.Count_Type) return Maps.Map
renames Maps.Copy;
-- ------------------------------
-- Map Bean
-- ------------------------------
-- The <b>Map_Bean</b> is a map of objects that also exposes the <b>Bean</b> interface.
-- This allows the map to be available and accessed from an Object instance.
type Map_Bean is new Maps.Map and Util.Beans.Basic.Bean and Iterator_Bean with private;
type Map_Bean_Access is access all Map_Bean'Class;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Map_Bean;
Name : in String) return Object;
-- Set the value identified by the name.
-- If the map contains the given name, the value changed.
-- Otherwise name is added to the map and the value associated with it.
overriding
procedure Set_Value (From : in out Map_Bean;
Name : in String;
Value : in Object);
-- Get an iterator to iterate starting with the first element.
overriding
function First (From : in Map_Bean) return Iterators.Proxy_Iterator_Access;
-- Get an iterator to iterate starting with the last element.
overriding
function Last (From : in Map_Bean) return Iterators.Proxy_Iterator_Access;
-- Create an object that contains a <tt>Map_Bean</tt> instance.
function Create return Object;
-- Iterate over the members of the map.
procedure Iterate (From : in Object;
Process : not null access procedure (Name : in String;
Item : in Object));
private
type Map_Bean is new Maps.Map and Util.Beans.Basic.Bean
and Iterator_Bean with null record;
type Map_Iterator is new Iterators.Proxy_Map_Iterator with record
Pos : Cursor;
end record;
type Map_Iterator_Access is access all Map_Iterator;
overriding
function Has_Element (Iter : in Map_Iterator) return Boolean;
overriding
procedure Next (Iter : in out Map_Iterator);
overriding
procedure Previous (Iter : in out Map_Iterator);
overriding
function Element (Iter : in Map_Iterator) return Object;
overriding
function Key (Iter : in Map_Iterator) return String;
end Util.Beans.Objects.Maps;
|
simonjwright/sdlada | Ada | 34,107 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Video.Pixel_Formats
--
-- Description of various pixel formats.
--------------------------------------------------------------------------------------------------------------------
with Ada.Characters.Latin_1;
with Ada.Unchecked_Conversion;
with Interfaces;
with Interfaces.C;
with SDL.Video.Palettes;
package SDL.Video.Pixel_Formats is
pragma Preelaborate;
package C renames Interfaces.C;
subtype Unsigned_32 is Interfaces.Unsigned_32;
type Pixel_Types is
(Unknown,
Index_1,
Index_4,
Index_8,
Packed_8,
Packed_16,
Packed_32,
Array_U8,
Array_U16,
Array_U32,
Array_F16,
Array_F32) with
Convention => C;
-- Bitmap pixel order, high bit -> low bit.
type Bitmap_Pixel_Order is (None, Little_Endian, Big_Endian) with
Convention => C;
-- Packed component order, high bit -> low bit.
type Packed_Component_Order is
(None,
XRGB,
RGBX,
ARGB,
RGBA,
XBGR,
BGRX,
ABGR,
BGRA) with
Convention => C;
-- Array component order, low byte -> high byte.
type Array_Component_Order is (None, RGB, RGBA, ARGB, BGR, BGRA, ABGR);
-- Describe how the components are laid out in bit form.
type Packed_Component_Layout is
(None,
Bits_332,
Bits_4444,
Bits_1555,
Bits_5551,
Bits_565,
Bits_8888,
Bits_2101010,
Bits_1010102) with
Convention => C;
type Bits_Per_Pixels is range 0 .. 32 with
Static_Predicate => Bits_Per_Pixels in 0 | 1 | 4 | 8 | 12 | 15 | 16 | 24 | 32,
Convention => C;
Bits_Per_Pixel_Error : constant Bits_Per_Pixels := 0;
type Bytes_Per_Pixels is range 0 .. 4 with
Convention => C;
Bytes_Per_Pixel_Error : constant Bytes_Per_Pixels := Bytes_Per_Pixels'First;
-- 29 28 24 20 16 8 0
-- 000 1 ptpt popo llll bibibibi bybybyby
--
-- or
--
-- 24 16 8 0
-- DDDDDDDD CCCCCCCC BBBBBBBB AAAAAAAA
type Index_Order_Padding is range 0 .. 1 with
Convention => C;
type Pixel_Orders (Pixel_Type : Pixel_Types := Unknown) is
record
case Pixel_Type is
when Index_1 | Index_4 | Index_8 =>
Indexed_Order : Bitmap_Pixel_Order;
Indexed_Pad : Index_Order_Padding;
when Packed_8 | Packed_16 | Packed_32 =>
Packed_Order : Packed_Component_Order;
when Array_U8 | Array_U16 | Array_U32 | Array_F16 | Array_F32 =>
Array_Order : Array_Component_Order;
when others =>
null;
end case;
end record with
Unchecked_Union => True,
Convention => C,
Size => 4;
pragma Warnings (Off, "no component clause given"); -- Stop warning about Pixel_Type having no rep clause.
for Pixel_Orders use
record
Indexed_Order at 0 range 0 .. 2; -- This was 2 as that is the max size required but it causes a bit set bug!
Indexed_Pad at 0 range 3 .. 3;
Packed_Order at 0 range 0 .. 3;
Array_Order at 0 range 0 .. 3;
end record;
pragma Warnings (On, "no component clause given");
type Planar_Pixels is
record
A : Character;
B : Character;
C : Character;
D : Character;
end record with
Size => 32,
Convention => C;
for Planar_Pixels use
record
A at 0 range 0 .. 7;
B at 0 range 8 .. 15;
C at 0 range 16 .. 23;
D at 0 range 24 .. 31;
end record;
type Non_Planar_Pixel_Padding is range 0 .. 7 with
Convention => C;
type Non_Planar_Pixels is
record
Bytes_Per_Pixel : Bytes_Per_Pixels;
Bits_Per_Pixel : Bits_Per_Pixels;
Layout : Packed_Component_Layout;
Pixel_Order : Pixel_Orders;
Pixel_Type : Pixel_Types;
Flag : Boolean;
Padding : Non_Planar_Pixel_Padding;
end record with
Size => 32,
Convention => C;
for Non_Planar_Pixels use
record
Bytes_Per_Pixel at 0 range 0 .. 7;
Bits_Per_Pixel at 0 range 8 .. 15;
Layout at 0 range 16 .. 19;
Pixel_Order at 0 range 20 .. 23;
Pixel_Type at 0 range 24 .. 27;
Flag at 0 range 28 .. 28;
Padding at 0 range 29 .. 31;
end record;
type Pixel_Format_Names (Planar : Boolean := False) is
record
case Planar is
when True =>
Planar_Format : Planar_Pixels;
when False =>
Non_Planar_Format : Non_Planar_Pixels;
end case;
end record with
Unchecked_Union => True,
Size => 32,
Convention => C;
Pixel_Format_Unknown : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => True,
Planar_Format => Planar_Pixels'
(others => Ada.Characters.Latin_1.NUL));
Pixel_Format_Index_1_LSB : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Index_1,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Index_1,
Indexed_Order => Little_Endian,
Indexed_Pad => Index_Order_Padding'First),
Layout => None,
Bits_Per_Pixel => 1,
Bytes_Per_Pixel => 0));
Pixel_Format_Index_1_MSB : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Index_1,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Index_1,
Indexed_Order => Big_Endian,
Indexed_Pad => Index_Order_Padding'First),
Layout => None,
Bits_Per_Pixel => 1,
Bytes_Per_Pixel => 0));
Pixel_Format_Index_4_LSB : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Index_4,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Index_4,
Indexed_Order => Little_Endian,
Indexed_Pad => Index_Order_Padding'First),
Layout => None,
Bits_Per_Pixel => 4,
Bytes_Per_Pixel => 0));
Pixel_Format_Index_4_MSB : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Index_4,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Index_4,
Indexed_Order => Big_Endian,
Indexed_Pad => Index_Order_Padding'First),
Layout => None,
Bits_Per_Pixel => 4,
Bytes_Per_Pixel => 0));
Pixel_Format_Index_8 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Index_8,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Index_8,
Indexed_Order => None,
Indexed_Pad => Index_Order_Padding'First),
Layout => None,
Bits_Per_Pixel => 8,
Bytes_Per_Pixel => 1));
Pixel_Format_RGB_332 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_8,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_8,
Packed_Order => XRGB),
Layout => Bits_332,
Bits_Per_Pixel => 8,
Bytes_Per_Pixel => 1));
Pixel_Format_RGB_444 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => XRGB),
Layout => Bits_4444,
Bits_Per_Pixel => 12,
Bytes_Per_Pixel => 2));
Pixel_Format_RGB_555 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => XRGB),
Layout => Bits_1555,
Bits_Per_Pixel => 15,
Bytes_Per_Pixel => 2));
Pixel_Format_BGR_555 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => XBGR),
Layout => Bits_1555,
Bits_Per_Pixel => 15,
Bytes_Per_Pixel => 2));
Pixel_Format_ARGB_4444 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => ARGB),
Layout => Bits_4444,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_RGBA_4444 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => RGBA),
Layout => Bits_4444,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_ABGR_4444 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => ABGR),
Layout => Bits_4444,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_BGRA_4444 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => BGRA),
Layout => Bits_4444,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_ARGB_1555 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => ARGB),
Layout => Bits_1555,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_RGBA_5551 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => RGBA),
Layout => Bits_5551,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_ABGR_1555 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => ABGR),
Layout => Bits_1555,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_BGRA_5551 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => BGRA),
Layout => Bits_5551,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_RGB_565 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => XRGB),
Layout => Bits_565,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_BGR_565 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_16,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_16,
Packed_Order => XBGR),
Layout => Bits_565,
Bits_Per_Pixel => 16,
Bytes_Per_Pixel => 2));
Pixel_Format_RGB_24 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Array_U8,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Array_U8,
Array_Order => RGB),
Layout => None,
Bits_Per_Pixel => 24,
Bytes_Per_Pixel => 3));
Pixel_Format_BGR_24 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Array_U8,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Array_U8,
Array_Order => BGR),
Layout => None,
Bits_Per_Pixel => 24,
Bytes_Per_Pixel => 3));
Pixel_Format_RGB_888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => XRGB),
Layout => Bits_8888,
Bits_Per_Pixel => 24,
Bytes_Per_Pixel => 4));
Pixel_Format_RGBX_8888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => RGBX),
Layout => Bits_8888,
Bits_Per_Pixel => 24,
Bytes_Per_Pixel => 4));
Pixel_Format_BGR_888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => XBGR),
Layout => Bits_8888,
Bits_Per_Pixel => 24,
Bytes_Per_Pixel => 4));
Pixel_Format_BGRX_8888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => BGRX),
Layout => Bits_8888,
Bits_Per_Pixel => 24,
Bytes_Per_Pixel => 4));
Pixel_Format_ARGB_8888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => ARGB),
Layout => Bits_8888,
Bits_Per_Pixel => 32,
Bytes_Per_Pixel => 4));
Pixel_Format_RGBA_8888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => RGBA),
Layout => Bits_8888,
Bits_Per_Pixel => 32,
Bytes_Per_Pixel => 4));
Pixel_Format_ABGR_8888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => ABGR),
Layout => Bits_8888,
Bits_Per_Pixel => 32,
Bytes_Per_Pixel => 4));
Pixel_Format_BGRA_8888 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => BGRA),
Layout => Bits_8888,
Bits_Per_Pixel => 32,
Bytes_Per_Pixel => 4));
Pixel_Format_ARGB_2101010 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => False,
Non_Planar_Format => Non_Planar_Pixels'
(Padding => Non_Planar_Pixel_Padding'First,
Flag => True,
Pixel_Type => Packed_32,
Pixel_Order => Pixel_Orders'
(Pixel_Type => Packed_32,
Packed_Order => ARGB),
Layout => Bits_2101010,
Bits_Per_Pixel => 32,
Bytes_Per_Pixel => 4));
Pixel_Format_YV_12 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => True,
Planar_Format => Planar_Pixels'
(A => 'Y',
B => 'V',
C => '1',
D => '2'));
Pixel_Format_IYUV : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => True,
Planar_Format => Planar_Pixels'
(A => 'I',
B => 'Y',
C => 'U',
D => 'V'));
Pixel_Format_YUY_2 : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => True,
Planar_Format => Planar_Pixels'
(A => 'Y',
B => 'U',
C => 'Y',
D => '2'));
Pixel_Format_UYVY : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => True,
Planar_Format => Planar_Pixels'
(A => 'U',
B => 'Y',
C => 'V',
D => 'Y'));
Pixel_Format_YVYU : constant Pixel_Format_Names :=
Pixel_Format_Names'(Planar => True,
Planar_Format => Planar_Pixels'
(A => 'Y',
B => 'V',
C => 'Y',
D => 'U'));
type Colour_Mask is mod 2 ** 32 with
Convention => C;
type Pixel_Format;
-- TODO: Possibly change this to a controlled type.
type Pixel_Format_Access is access all Pixel_Format with
Convention => C;
-- Nobody needs to use this outside.
package Internals is
-- These fields are defined as "internal use" in the SDL docs.
type Private_Pixel_Format is private;
private
type Private_Pixel_Format is
record
Rred_Loss : Interfaces.Unsigned_8;
Green_Loss : Interfaces.Unsigned_8;
Blue_Loss : Interfaces.Unsigned_8;
Alpha_Loss : Interfaces.Unsigned_8;
Red_Shift : Interfaces.Unsigned_8;
Green_Shift : Interfaces.Unsigned_8;
Blue_Shift : Interfaces.Unsigned_8;
Alpha_Shift : Interfaces.Unsigned_8;
Ref_Count : C.int;
Next : Pixel_Format_Access;
end record with
Convention => C;
end Internals;
type Pixel_Format is
record
Format : Pixel_Format_Names;
Palette : Palettes.Palette_Access;
Bits : Bits_Per_Pixels;
Bytes : Bytes_Per_Pixels;
Padding : Interfaces.Unsigned_16;
Red_Mask : Colour_Mask;
Green_Mask : Colour_Mask;
Blue_Mask : Colour_Mask;
Alpha_Mask : Colour_Mask;
-- This is mainly padding to make sure the record size matches what is expected from C.
Private_Part : Internals.Private_Pixel_Format;
end record with
Convention => C;
function Create (Format : in Pixel_Format_Names) return Pixel_Format_Access with
Import => True,
Convention => C,
External_Name => "SDL_AllocFormat";
procedure Free (Format : in Pixel_Format_Access) with
Import => True,
Convention => C,
External_Name => "SDL_FreeFormat";
function Image (Format : in Pixel_Format_Names) return String;
-- Import => True,
-- Convention => C,
-- External_Name => "SDL_GetPixelFormatName";
procedure To_Components
(Pixel : in Interfaces.Unsigned_32;
Format : in Pixel_Format_Access;
Red : out Palettes.Colour_Component;
Green : out Palettes.Colour_Component;
Blue : out Palettes.Colour_Component) with
Import => True,
Convention => C,
External_Name => "SDL_GetRGB";
procedure To_Components
(Pixel : in Interfaces.Unsigned_32;
Format : in Pixel_Format_Access;
Red : out Palettes.Colour_Component;
Green : out Palettes.Colour_Component;
Blue : out Palettes.Colour_Component;
Alpha : out Palettes.Colour_Component) with
Import => True,
Convention => C,
External_Name => "SDL_GetRGBA";
function To_Pixel
(Format : in Pixel_Format_Access;
Red : in Palettes.Colour_Component;
Green : in Palettes.Colour_Component;
Blue : in Palettes.Colour_Component) return Interfaces.Unsigned_32 with
Import => True,
Convention => C,
External_Name => "SDL_MapRGB";
function To_Pixel
(Format : in Pixel_Format_Access;
Red : in Palettes.Colour_Component;
Green : in Palettes.Colour_Component;
Blue : in Palettes.Colour_Component;
Alpha : in Palettes.Colour_Component) return Interfaces.Unsigned_32 with
Import => True,
Convention => C,
External_Name => "SDL_MapRGBA";
function To_Colour (Pixel : in Interfaces.Unsigned_32; Format : in Pixel_Format_Access) return Palettes.Colour with
Inline => True;
function To_Pixel (Colour : in Palettes.Colour; Format : in Pixel_Format_Access) return Interfaces.Unsigned_32 with
Inline => True;
function To_Name
(Bits : in Bits_Per_Pixels;
Red_Mask : in Colour_Mask;
Green_Mask : in Colour_Mask;
Blue_Mask : in Colour_Mask;
Alpha_Mask : in Colour_Mask) return Pixel_Format_Names with
Import => True,
Convention => C,
External_Name => "SDL_MasksToPixelFormatEnum";
function To_Masks
(Format : in Pixel_Format_Names;
Bits : out Bits_Per_Pixels;
Red_Mask : out Colour_Mask;
Green_Mask : out Colour_Mask;
Blue_Mask : out Colour_Mask;
Alpha_Mask : out Colour_Mask) return Boolean with
Inline => True;
-- Gamma
type Gamma_Value is mod 2 ** 16 with
Convention => C;
type Gamma_Ramp is array (Integer range 1 .. 256) of Gamma_Value with
Convention => C;
procedure Calculate (Gamma : in Float; Ramp : out Gamma_Ramp) with
Import => True,
Convention => C,
External_Name => "SDL_CalculateGammaRamp";
end SDL.Video.Pixel_Formats;
|
reznikmm/matreshka | Ada | 3,953 | 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.Smil_Type_Attributes;
package Matreshka.ODF_Smil.Type_Attributes is
type Smil_Type_Attribute_Node is
new Matreshka.ODF_Smil.Abstract_Smil_Attribute_Node
and ODF.DOM.Smil_Type_Attributes.ODF_Smil_Type_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Smil_Type_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Smil_Type_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Smil.Type_Attributes;
|
AdaCore/Ada_Drivers_Library | Ada | 2,069 | ads | -- This spec has been automatically generated from STM32F7x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.CRC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype IDR_IDR_Field is HAL.UInt8;
-- Independent Data register
type IDR_Register is record
-- Independent Data register
IDR : IDR_IDR_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
IDR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Control register
type CR_Register is record
-- Write-only. Control regidter
CR : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
CR at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Cyclic Redundancy Check (CRC) unit
type CRC_Peripheral is record
-- Data register
DR : aliased HAL.UInt32;
-- Independent Data register
IDR : aliased IDR_Register;
-- Control register
CR : aliased CR_Register;
-- Initial CRC value
INIT : aliased HAL.UInt32;
-- CRC polynomial
POL : aliased HAL.UInt32;
end record
with Volatile;
for CRC_Peripheral use record
DR at 16#0# range 0 .. 31;
IDR at 16#4# range 0 .. 31;
CR at 16#8# range 0 .. 31;
INIT at 16#C# range 0 .. 31;
POL at 16#10# range 0 .. 31;
end record;
-- Cyclic Redundancy Check (CRC) unit
CRC_Periph : aliased CRC_Peripheral
with Import, Address => System'To_Address (16#40023000#);
end STM32_SVD.CRC;
|
stcarrez/hestia | Ada | 2,396 | ads | -----------------------------------------------------------------------
-- hestia-display-main -- Main display view manager
-- 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 HAL.Bitmap;
with HAL.Touch_Panel;
with Ada.Real_Time;
with Hestia.Time;
with UI.Buttons;
with UI.Displays;
package Hestia.Display.Main is
type Display_Type is limited new UI.Displays.Display_Type with private;
-- Draw the layout presentation frame.
overriding
procedure On_Restore (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class);
-- Refresh the current display.
overriding
procedure On_Refresh (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Deadline : out Ada.Real_Time.Time);
-- Handle touch events on the display.
overriding
procedure On_Touch (Display : in out Display_Type;
Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
States : in HAL.Touch_Panel.TP_State);
private
type Display_Info is limited record
Hour : Hestia.Time.Hour_Number := 0;
Minute : Hestia.Time.Minute_Number := 0;
end record;
type Display_Info_Array is array (UI.Displays.Display_Buffer_Index) of Display_Info;
type Display_Type is limited new UI.Displays.Display_Type with record
Info : Display_Info_Array;
Zone1_Button : UI.Buttons.Button_Type;
Zone2_Button : UI.Buttons.Button_Type;
Info_Button : UI.Buttons.Button_Type;
Sched1_Button : UI.Buttons.Button_Type;
Sched2_Button : UI.Buttons.Button_Type;
end record;
end Hestia.Display.Main;
|
Gabriel-Degret/adalib | Ada | 8,620 | 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
---------------------------------------------------------------------------
with Ada.Iterator_Interfaces;
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.Bounded_Ordered_Sets is
pragma Pure(Bounded_Ordered_Sets);
pragma Remote_Types(Bounded_Ordered_Sets);
function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
type Set (Capacity : Count_Type) 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);
Empty_Set : constant Set;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
package Set_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
function "=" (Left, Right : Set) return Boolean;
function Equivalent_Sets (Left, Right : Set) return Boolean;
function To_Set (New_Item : Element_Type) 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 : in Cursor;
New_Item : in Element_Type);
procedure Query_Element
(Position : in Cursor;
Process : not null access procedure (Element : in Element_Type));
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
function Constant_Reference (Container : aliased in Set;
Position : in Cursor)
return Constant_Reference_Type;
procedure Assign (Target : in out Set; Source : in Set);
function Copy (Source : Set;
Capacity : Count_Type := 0) return Set;
procedure Move (Target : in out Set;
Source : in out Set);
procedure Insert (Container : in out Set;
New_Item : in Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert (Container : in out Set;
New_Item : in Element_Type);
procedure Include (Container : in out Set;
New_Item : in Element_Type);
procedure Replace (Container : in out Set;
New_Item : in Element_Type);
procedure Exclude (Container : in out Set;
Item : in Element_Type);
procedure Delete (Container : in out Set;
Item : in Element_Type);
procedure Delete (Container : in out Set;
Position : in out Cursor);
procedure Delete_First (Container : in out Set);
procedure Delete_Last (Container : in out Set);
procedure Union (Target : in out Set;
Source : in Set);
function Union (Left, Right : Set) return Set;
function "or" (Left, Right : Set) return Set renames Union;
procedure Intersection (Target : in out Set;
Source : in Set);
function Intersection (Left, Right : Set) return Set;
function "and" (Left, Right : Set) return Set renames Intersection;
procedure Difference (Target : in out Set;
Source : in Set);
function Difference (Left, Right : Set) return Set;
function "-" (Left, Right : Set) return Set renames Difference;
procedure Symmetric_Difference (Target : in out Set;
Source : in 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;
function First_Element (Container : Set) return Element_Type;
function Last (Container : Set) return Cursor;
function Last_Element (Container : Set) 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;
procedure Iterate
(Container : in Set;
Process : not null access procedure (Position : in Cursor));
procedure Reverse_Iterate
(Container : in Set;
Process : not null access procedure (Position : in Cursor));
function Iterate (Container : in Set)
return Set_Iterator_Interfaces.Reversible_Iterator'Class;
function Iterate (Container : in Set; Start : in 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 : in Key_Type;
New_Item : in Element_Type);
procedure Exclude (Container : in out Set;
Key : in Key_Type);
procedure Delete (Container : in out Set;
Key : in 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 : in 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 : in Cursor)
return Reference_Type;
function Constant_Reference (Container : aliased in Set;
Key : in Key_Type)
return Constant_Reference_Type;
function Reference_Preserving_Key (Container : aliased in out Set;
Key : in Key_Type)
return Reference_Type;
end Generic_Keys;
private
-- not specified by the language
end Ada.Containers.Bounded_Ordered_Sets;
|
damaki/libkeccak | Ada | 2,582 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Keccak.Generic_KeccakF;
with Keccak.Generic_KeccakF.Bit_Lanes;
with Keccak.Generic_KeccakF.Lane_Complementing_Permutation;
with Keccak.Types;
pragma Elaborate_All (Keccak.Generic_KeccakF);
pragma Elaborate_All (Keccak.Generic_KeccakF.Bit_Lanes);
pragma Elaborate_All (Keccak.Generic_KeccakF.Lane_Complementing_Permutation);
-- @summary
-- Instantiation of Keccak with a state size of 25 bits (1-bit lanes).
package Keccak.Keccak_25
with SPARK_Mode => On
is
package KeccakF_25 is new Keccak.Generic_KeccakF
(Lane_Size_Log => 0,
Lane_Type => Keccak.Types.Unsigned_1);
subtype State is KeccakF_25.Lane_Complemented_State;
package KeccakF_25_Permutation is new KeccakF_25.Lane_Complementing_Permutation
(Rotate_Left => Keccak.Types.Rotate_Left_1);
package KeccakF_25_Lanes is new KeccakF_25.Bit_Lanes;
end Keccak.Keccak_25;
|
reznikmm/matreshka | Ada | 54,210 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with Ucd_Input;
with Utils;
package body Ucd_Data is
use Matreshka.Internals.Unicode;
use Matreshka.Internals.Unicode.Ucd;
use Utils;
UnicodeData_Name : constant String := "UnicodeData.txt";
PropList_Name : constant String := "PropList.txt";
DerivedCoreProperties_Name : constant String
:= "DerivedCoreProperties.txt";
EastAsianWidth_Name : constant String
:= "EastAsianWidth.txt";
GraphemeBreakProperty_Name : constant String
:= "auxiliary/GraphemeBreakProperty.txt";
WordBreakProperty_Name : constant String
:= "auxiliary/WordBreakProperty.txt";
SentenceBreakProperty_Name : constant String
:= "auxiliary/SentenceBreakProperty.txt";
LineBreak_Name : constant String := "LineBreak.txt";
SpecialCasing_Name : constant String := "SpecialCasing.txt";
CaseFolding_Name : constant String := "CaseFolding.txt";
DerivedNormalizationProps_Name : constant String
:= "DerivedNormalizationProps.txt";
CompositionExclusions_Name : constant String
:= "CompositionExclusions.txt";
NormalizationCorrections_Name : constant String
:= "NormalizationCorrections.txt";
subtype Primary_Core_Boolean_Properties is Boolean_Properties
range ASCII_Hex_Digit .. White_Space;
subtype Derived_Core_Boolean_Properties is Boolean_Properties
range Alphabetic .. XID_Start;
procedure Load_UnicodeData (Unidata_Directory : String);
-- Parse UnicodeData.txt file and fill internal data structures by the
-- parsed values.
procedure Load_PropList (Unidata_Directory : String);
-- Parse PropList.txt file and fill internal data structurs by the parsed
-- values.
procedure Load_DerivedCoreProperties (Unidata_Directory : String);
-- Parse DerivedCoreProperties.txt file and fill internal data structurs by
-- the parsed values.
procedure Load_EastAsianWidth (Unidata_Directory : String);
-- Parse EastAsianWidth.txt file and fill internal data structurs by --
-- the parsed values.
procedure Load_GraphemeBreakProperty (Unidata_Directory : String);
-- Parse GraphemeBreakProperty.txt file and fill internal data structurs by
-- the parsed values.
procedure Load_WordBreakProperty (Unidata_Directory : String);
-- Parse WordBreakProperty.txt file and fill internal data structurs by the
-- parsed values.
procedure Load_SentenceBreakProperty (Unidata_Directory : String);
-- Parse SentenceBreakProperty.txt file and fill internal data structurs by
-- the parsed values.
procedure Load_LineBreak (Unidata_Directory : String);
-- Parse LineBreak.txt file and fill internal data structurs by the parsed
-- values.
procedure Load_SpecialCasing (Unidata_Directory : String);
-- Parse SpecialCasing.txt file and fill internal data structurs by the
-- parsed values.
procedure Load_CaseFolding (Unidata_Directory : String);
-- Parse CaseFolding.txt file and fill internal data structurs by the
-- parsed values.
procedure Load_CompositionExclusions (Unidata_Directory : String);
-- Parse CompositionExclusions.txt file and fill internal data structures
-- by the parsed values.
procedure Load_DerivedNormalizationProps (Unidata_Directory : String);
-- Parse DerivedNormalizationProps.txt file and fill internal data
-- structures by the parsed values.
procedure Load_NormalizationCorrections (Unidata_Directory : String);
-- Parse NormalizationCorrections.txt file and fill internal data
-- structures by the parsed values.
procedure Compute_Full_Normalization_Data;
-- Compute full normalization mapping for both normalization forms.
procedure Parse_Code_Point
(Text : String;
Code : out Code_Point);
function Value (Item : String) return General_Category;
-- Converts two-character text representation of the General_Category
-- property into the value.
function Value (Item : String) return Grapheme_Cluster_Break;
-- Converts text representation of the Grapheme_Cluster_Break into the
-- value.
function Value (Item : String) return East_Asian_Width;
-- Converts text representation of the East_Asian_Width into value.
function Value (Item : String) return Word_Break;
-- Converts text representation of the Word_Break into the value.
function Value (Item : String) return Sentence_Break;
-- Converts text representation of the Sentence_Break into the value.
function Value (Item : String) return Line_Break;
-- Converts two-character text representation of the Line_Break into the
-- value.
function Value (Item : String) return Normalization_Quick_Check;
-- Converts one character text representation of the normalization quick
-- check into the value.
function Value (Item : String) return Decomposition_Type;
-- Converts text representation of the Decomposition_Type into the value.
procedure Free is
new Ada.Unchecked_Deallocation
(Code_Point_Sequence, Code_Point_Sequence_Access);
-------------------------------------
-- Compute_Full_Normalization_Data --
-------------------------------------
procedure Compute_Full_Normalization_Data is
procedure Expand (Kind : Normalization_Kinds);
------------
-- Expand --
------------
procedure Expand (Kind : Normalization_Kinds) is
function Has_Mapping (Code : Code_Point) return Boolean;
-- Returns True if code point has corresponding to Kind mapping.
function Decompose (Code : Code_Point) return Code_Point_Sequence;
-- Returns character's decomposition.
subtype S_Hangul is Code_Point
range Hangul_Syllable_First .. Hangul_Syllable_Last;
---------------
-- Decompose --
---------------
function Decompose (Code : Code_Point) return Code_Point_Sequence is
begin
if Code in S_Hangul then
raise Program_Error
with "Decomposition of Hangul Syllables doesn't supported"
& " for now";
else
return Norms (Code).Values (Kind).all;
end if;
end Decompose;
-----------------
-- Has_Mapping --
-----------------
function Has_Mapping (Code : Code_Point) return Boolean is
begin
if Code in S_Hangul then
return True;
else
case Kind is
when Canonical_Mapping =>
raise Program_Error;
when Canonical =>
return Norms (Code).DT = Canonical;
when Compatibility =>
return Norms (Code).DT /= None;
end case;
end if;
end Has_Mapping;
Expanded : Boolean;
begin
loop
Expanded := False;
for J in Norms'Range loop
if Has_Mapping (J) and then J not in S_Hangul then
declare
M : Code_Point_Sequence_Access := null;
A : Code_Point_Sequence_Access;
begin
for K in Norms (J).Values (Kind)'Range loop
if Has_Mapping (Norms (J).Values (Kind) (K)) then
if M = null then
M :=
new Code_Point_Sequence'
(Norms (J).Values (Kind) (1 .. K - 1)
& Decompose
(Norms (J).Values (Kind) (K)));
else
A := M;
M :=
new Code_Point_Sequence'
(A.all
& Decompose
(Norms (J).Values (Kind) (K)));
Free (A);
end if;
elsif M /= null then
A := M;
M :=
new Code_Point_Sequence'
(A.all & Norms (J).Values (Kind) (K));
Free (A);
end if;
end loop;
if M /= null then
Free (Norms (J).Values (Kind));
Norms (J).Values (Kind) := M;
Expanded := True;
end if;
end;
end if;
end loop;
exit when not Expanded;
end loop;
end Expand;
begin
Expand (Canonical);
Expand (Compatibility);
end Compute_Full_Normalization_Data;
----------
-- Load --
----------
procedure Load (Unidata_Directory : String) is
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, "Initializing UCD ...");
-- Initialize data structures to default values.
Core :=
new Core_Values_Array'
(others =>
(GC => Unassigned, -- see UCD.html
GCB => Other, -- see GraphemeBreakProperty.txt
WB => Other, -- see WordBreakProperty.txt
SB => Other, -- see SentenceBreakProperty.txt
LB => Unknown, -- see LineBreak.txt
EA => Neutral, -- see EastAsianWidth.txt
B => (others => False)));
Cases :=
new Case_Values_Array'
(others =>
(SUM | SLM | STM | SCF => (Present => False),
FUM | FLM | FTM =>
(Default => null, others => (others => null)),
FCF => null));
Norms :=
new Normalization_Values_Array'
(others => (CCC => Not_Reordered,
NQC => (others => Yes),
DT => None,
B => (others => False),
Values => (others => null)));
-- Load UnicodeData.txt, PropList.txt.
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
"Loading UCD (" & Unidata_Directory & ") ...");
Load_UnicodeData (Unidata_Directory);
Load_PropList (Unidata_Directory);
-- Load DerivedCoreProperties.txt.
-- NOTE: Data in the file is derived from the other information, so
-- it is possible to use it for verification purposes only.
Load_DerivedCoreProperties (Unidata_Directory);
-- Load EastAsianWidth.txt
Load_EastAsianWidth (Unidata_Directory);
-- Load GraphemeBreakProperty.txt, WordBreakProperty.txt.
Load_GraphemeBreakProperty (Unidata_Directory);
Load_WordBreakProperty (Unidata_Directory);
Load_SentenceBreakProperty (Unidata_Directory);
Load_LineBreak (Unidata_Directory);
-- Load SpecialCasing.txt, CaseFolding.txt
Load_SpecialCasing (Unidata_Directory);
Load_CaseFolding (Unidata_Directory);
-- Load CompositionExclusions.txt, DerivedNormalizationProps.txt,
-- NormalizationCorrections.txt.
Load_CompositionExclusions (Unidata_Directory);
Load_DerivedNormalizationProps (Unidata_Directory);
Load_NormalizationCorrections (Unidata_Directory);
-- Compute derived properties.
Compute_Full_Normalization_Data;
-- Verify data:
-- - DerivedGeneralCategory.txt
-- - DerivedCombiningClass.txt
-- - DerivedBinaryProperties.txt
-- - DerivedDecompositionType.txt
-- - DerivedLineBreak.txt
end Load;
----------------------
-- Load_CaseFolding --
----------------------
procedure Load_CaseFolding (Unidata_Directory : String) is
type Case_Folding_Status is (C, F, S, T);
File : Ucd_Input.File_Type;
Code : Code_Point;
Status : Case_Folding_Status;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & CaseFolding_Name);
Ucd_Input.Open (File, Unidata_Directory & '/' & CaseFolding_Name);
while not Ucd_Input.End_Of_Data (File) loop
Code := Ucd_Input.First_Code_Point (File);
-- Status
Status := Case_Folding_Status'Value (Ucd_Input.Field (File));
Ucd_Input.Next_Field (File);
-- Mapping
case Status is
when C | S =>
Cases (Code).SCF := (True, 0);
Parse_Code_Point (Ucd_Input.Field (File), Cases (Code).SCF.C);
when F =>
Cases (Code).FCF :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence (Ucd_Input.Field (File)));
when T =>
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " Ignore mapping: T");
end case;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_CaseFolding;
--------------------------------
-- Load_CompositionExclusions --
--------------------------------
procedure Load_CompositionExclusions (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & CompositionExclusions_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & CompositionExclusions_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
for J in First .. Last loop
Norms (J).B (Composition_Exclusion) := True;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_CompositionExclusions;
--------------------------------
-- Load_DerivedCoreProperties --
--------------------------------
procedure Load_DerivedCoreProperties (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Derived_Core_Boolean_Properties;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & DerivedCoreProperties_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & DerivedCoreProperties_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop :=
Derived_Core_Boolean_Properties'Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).B (Prop) := True;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_DerivedCoreProperties;
------------------------------------
-- Load_DerivedNormalizationProps --
------------------------------------
procedure Load_DerivedNormalizationProps (Unidata_Directory : String) is
type Property is
(FC_NFKC, -- + mapping
Full_Composition_Exclusion,
NFD_QC, -- + value
NFC_QC, -- + value
NFKD_QC, -- + value
NFKC_QC, -- + value
Expands_On_NFD,
Expands_On_NFC,
Expands_On_NFKD,
Expands_On_NFKC,
NFKC_CF, -- + mapping
Changes_When_NFKC_Casefolded);
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Property;
FC_NFKC_Ignored : Boolean := False;
NFKC_CF_Ignored : Boolean := False;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
" ... " & DerivedNormalizationProps_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & DerivedNormalizationProps_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop := Property'Value (Ucd_Input.Field (File));
Ucd_Input.Next_Field (File);
for J in First .. Last loop
case Prop is
when FC_NFKC =>
if not FC_NFKC_Ignored then
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
" Ignore property: FC_NFKC");
FC_NFKC_Ignored := True;
end if;
when Full_Composition_Exclusion =>
Norms (J).B (Full_Composition_Exclusion) := True;
when NFD_QC =>
Norms (J).NQC (NFD) := Value (Ucd_Input.Field (File));
when NFC_QC =>
Norms (J).NQC (NFC) := Value (Ucd_Input.Field (File));
when NFKD_QC =>
Norms (J).NQC (NFKD) := Value (Ucd_Input.Field (File));
when NFKC_QC =>
Norms (J).NQC (NFKC) := Value (Ucd_Input.Field (File));
when Expands_On_NFD =>
Norms (J).B (Expands_On_NFD) := True;
when Expands_On_NFC =>
Norms (J).B (Expands_On_NFC) := True;
when Expands_On_NFKD =>
Norms (J).B (Expands_On_NFKD) := True;
when Expands_On_NFKC =>
Norms (J).B (Expands_On_NFKD) := True;
when NFKC_CF =>
if not NFKC_CF_Ignored then
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
" Ignore property: NFKC_CF");
NFKC_CF_Ignored := True;
end if;
when Changes_When_NFKC_Casefolded =>
Core (J).B (Changes_When_NFKC_Casefolded) := True;
end case;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_DerivedNormalizationProps;
-------------------------
-- Load_EastAsianWidth --
-------------------------
procedure Load_EastAsianWidth (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : East_Asian_Width;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & EastAsianWidth_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & EastAsianWidth_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop := Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).EA := Prop;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_EastAsianWidth;
--------------------------------
-- Load_GraphemeBreakProperty --
--------------------------------
procedure Load_GraphemeBreakProperty (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Grapheme_Cluster_Break;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
" ... " & GraphemeBreakProperty_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & GraphemeBreakProperty_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop := Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).GCB := Prop;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_GraphemeBreakProperty;
--------------------
-- Load_LineBreak --
--------------------
procedure Load_LineBreak (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Line_Break;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & LineBreak_Name);
Ucd_Input.Open (File, Unidata_Directory & '/' & LineBreak_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop := Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).LB := Prop;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_LineBreak;
-----------------------------------
-- Load_NormalizationCorrections --
-----------------------------------
procedure Load_NormalizationCorrections (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
Code : Code_Point;
Original : Code_Point_Sequence_Access;
Corrected : Code_Point_Sequence_Access;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & NormalizationCorrections_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & NormalizationCorrections_Name);
while not Ucd_Input.End_Of_Data (File) loop
Code := Ucd_Input.First_Code_Point (File);
Original :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence (Ucd_Input.Field (File)));
Ucd_Input.Next_Field (File);
Corrected :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence (Ucd_Input.Field (File)));
if Norms (Code).Values (Canonical).all /= Original.all then
if Norms (Code).Values (Canonical).all /= Corrected.all then
raise Program_Error with "Wrong original decomposition";
else
Free (Corrected);
end if;
else
Free (Norms (Code).Values (Canonical));
Norms (Code).Values (Canonical) := Corrected;
if Norms (Code).DT /= Canonical then
Free (Norms (Code).Values (Compatibility));
Norms (Code).Values (Compatibility) :=
new Code_Point_Sequence'(Corrected.all);
end if;
end if;
Free (Original);
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_NormalizationCorrections;
-------------------
-- Load_PropList --
-------------------
procedure Load_PropList (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Primary_Core_Boolean_Properties;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & PropList_Name);
Ucd_Input.Open (File, Unidata_Directory & '/' & PropList_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop :=
Primary_Core_Boolean_Properties'Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).B (Prop) := True;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_PropList;
--------------------------------
-- Load_SentenceBreakProperty --
--------------------------------
procedure Load_SentenceBreakProperty (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Sentence_Break;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & SentenceBreakProperty_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & SentenceBreakProperty_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop := Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).SB := Prop;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_SentenceBreakProperty;
------------------------
-- Load_SpecialCasing --
------------------------
procedure Load_SpecialCasing (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
Code : Code_Point;
Lower : Code_Point_Sequence_Access;
Upper : Code_Point_Sequence_Access;
Title : Code_Point_Sequence_Access;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & SpecialCasing_Name);
Ucd_Input.Open
(File, Unidata_Directory & '/' & SpecialCasing_Name);
while not Ucd_Input.End_Of_Data (File) loop
Code := Ucd_Input.First_Code_Point (File);
-- Lowercase mapping
Lower :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence (Ucd_Input.Field (File)));
Ucd_Input.Next_Field (File);
-- Uppercase mapping
Upper :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence (Ucd_Input.Field (File)));
Ucd_Input.Next_Field (File);
-- Titlecase mapping
Title :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence (Ucd_Input.Field (File)));
Ucd_Input.Next_Field (File);
-- Conditions
declare
V : constant String := Ucd_Input.Field (File);
begin
if V = "Final_Sigma" then
if Upper'Length /= 1
or else Upper (1) /= Code
then
Cases (Code).FUM.Positive (Final_Sigma) := Upper;
end if;
if Lower'Length /= 1
or else Lower (1) /= Code
then
Cases (Code).FLM.Positive (Final_Sigma) := Lower;
end if;
if Title'Length /= 1
or else Title (1) /= Code
then
Cases (Code).FTM.Positive (Final_Sigma) := Title;
end if;
elsif V'Length = 0 then
Cases (Code).FUM.Default := Upper;
Cases (Code).FLM.Default := Lower;
Cases (Code).FTM.Default := Title;
else
-- XXX Ignore more complex contexts for now.
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
" Ignore mapping: " & Ucd_Input.Field (File));
end if;
end;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_SpecialCasing;
----------------------
-- Load_UnicodeData --
----------------------
procedure Load_UnicodeData (Unidata_Directory : String) is
type String_Access is access String;
procedure Process
(Code : Code_Point;
GC : General_Category;
CCC : Canonical_Combining_Class;
DT : Decomposition_Type;
DM : Code_Point_Sequence;
SUM : Optional_Code_Point;
SLM : Optional_Code_Point;
STM : Optional_Code_Point);
-- Process data for one code point.
procedure Free is new Ada.Unchecked_Deallocation (String, String_Access);
-------------
-- Process --
-------------
procedure Process
(Code : Code_Point;
GC : General_Category;
CCC : Canonical_Combining_Class;
DT : Decomposition_Type;
DM : Code_Point_Sequence;
SUM : Optional_Code_Point;
SLM : Optional_Code_Point;
STM : Optional_Code_Point) is
begin
Core (Code).GC := GC;
Norms (Code).CCC := CCC;
Norms (Code).DT := DT;
-- Canonical and compatibility normalization.
if DT /= None then
Norms (Code).Values (Compatibility) :=
new Code_Point_Sequence'(DM);
if DT = Canonical then
Norms (Code).Values (Canonical_Mapping)
:= new Code_Point_Sequence'(DM);
Norms (Code).Values (Canonical) := new Code_Point_Sequence'(DM);
end if;
end if;
-- Simple uppercase mapping
if SUM.Present and then SUM.C /= Code then
Cases (Code).SUM := SUM;
else
Cases (Code).SUM := (Present => False);
end if;
-- Simple lowercase mapping
if SLM.Present and then SLM.C /= Code then
Cases (Code).SLM := SLM;
else
Cases (Code).SLM := (Present => False);
end if;
-- Simple titlecase mapping
if STM.Present and then STM.C /= Code then
Cases (Code).STM := STM;
else
Cases (Code).STM := (Present => False);
end if;
end Process;
File : Ucd_Input.File_Type;
Code : Code_Point;
First_Code : Code_Point;
Name : String_Access;
GC : General_Category;
CCC : Canonical_Combining_Class;
SUM : Optional_Code_Point;
SLM : Optional_Code_Point;
STM : Optional_Code_Point;
DT : Decomposition_Type;
DM : Code_Point_Sequence_Access;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & UnicodeData_Name);
Ucd_Input.Open (File, Unidata_Directory & '/' & UnicodeData_Name);
while not Ucd_Input.End_Of_Data (File) loop
-- Parse code point
Code := Ucd_Input.First_Code_Point (File);
-- UnicodeData.txt uses only one code point for each record.
-- Parse Name (1)
Name := new String'(Ucd_Input.Field (File));
Ucd_Input.Next_Field (File);
-- Parse General_Category (2)
GC := Value (Ucd_Input.Field (File));
Ucd_Input.Next_Field (File);
-- Parse Canonical_Combining_Class (3)
CCC := Canonical_Combining_Class'Value (Ucd_Input.Field (File));
Ucd_Input.Next_Field (File);
-- Parse Bidi_Class (4)
-- XXX Not implemented
Ucd_Input.Next_Field (File);
-- Parse Decomposition_Type and Decomposition_Mapping (5)
declare
Field : constant String := Ucd_Input.Field (File);
First : Positive := Field'First;
Last : Natural := 0;
begin
if Field'Length /= 0 then
if Field (First) = '<' then
Last := First + 1;
while Field (Last) /= '>' loop
Last := Last + 1;
end loop;
DT := Value (Field (First + 1 .. Last - 1));
First := Last + 2;
else
DT := Canonical;
end if;
DM :=
new Code_Point_Sequence'
(Parse_Code_Point_Sequence
(Field (First .. Field'Last)));
else
DT := None;
DM := new Code_Point_Sequence (1 .. 0);
end if;
end;
Ucd_Input.Next_Field (File);
-- Parse Numeric_Type and Numeric_Value (6), (7), (8)
-- XXX Not implemented
Ucd_Input.Next_Field (File);
Ucd_Input.Next_Field (File);
Ucd_Input.Next_Field (File);
-- Parse Bidi_Mirrored (9)
-- XXX Not implemented
Ucd_Input.Next_Field (File);
-- Parse Unicode_1_Name (10)
-- XXX Not implemented
Ucd_Input.Next_Field (File);
-- Parse ISO_Comment (11)
-- XXX Not implemented
Ucd_Input.Next_Field (File);
-- Parse Simple_Uppercase_Mapping (12)
declare
F : constant String := Ucd_Input.Field (File);
begin
if F'Length = 0 then
SUM := (Present => False);
else
SUM := (True, 0);
Parse_Code_Point (F, SUM.C);
end if;
end;
Ucd_Input.Next_Field (File);
-- Parse Simple_Lowercase_Mapping (13)
declare
F : constant String := Ucd_Input.Field (File);
begin
if F'Length = 0 then
SLM := (Present => False);
else
SLM := (True, 0);
Parse_Code_Point (F, SLM.C);
end if;
end;
Ucd_Input.Next_Field (File);
-- Parse Simple_Titlecase_Mapping (14)
declare
F : constant String := Ucd_Input.Field (File);
begin
if F'Length = 0 then
STM := (Present => False);
else
STM := (True, 0);
Parse_Code_Point (F, STM.C);
end if;
end;
-- Special exception: if Name end on ", First>" it means a start of
-- range. Next line end of ", Last>" and means end of range.
if Name'Length > 7
and then Name (Name'Last - 7 .. Name'Last) = ", First>"
then
First_Code := Code;
elsif Name'Length > 6
and then Name (Name'Last - 6 .. Name'Last) = ", Last>"
then
if Name.all = "<Hangul Syllable, Last>" then
-- Hangul Syllables are decomposed algorithmically and there
-- are no Decomposition Type is defined in UnicodeData.txt
-- for them. We set Decomposition_Type to Canonical by hand.
DT := Canonical;
end if;
for J in First_Code .. Code loop
Process (J, GC, CCC, DT, DM.all, SUM, SLM, STM);
end loop;
else
Process (Code, GC, CCC, DT, DM.all, SUM, SLM, STM);
end if;
-- Cleanup.
Free (Name);
Free (DM);
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_UnicodeData;
----------------------------
-- Load_WordBreakProperty --
----------------------------
procedure Load_WordBreakProperty (Unidata_Directory : String) is
File : Ucd_Input.File_Type;
First : Code_Point;
Last : Code_Point;
Prop : Word_Break;
begin
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, " ... " & WordBreakProperty_Name);
Ucd_Input.Open (File, Unidata_Directory & '/' & WordBreakProperty_Name);
while not Ucd_Input.End_Of_Data (File) loop
First := Ucd_Input.First_Code_Point (File);
Last := Ucd_Input.Last_Code_Point (File);
Prop := Value (Ucd_Input.Field (File));
for J in First .. Last loop
Core (J).WB := Prop;
end loop;
Ucd_Input.Next_Record (File);
end loop;
Ucd_Input.Close (File);
end Load_WordBreakProperty;
----------------------
-- Parse_Code_Point --
----------------------
procedure Parse_Code_Point
(Text : String;
Code : out Code_Point)
is
First : Positive := Text'First;
Last : Natural;
begin
Last := First - 1;
while Last < Text'Last loop
Last := Last + 1;
if Text (Last) not in '0' .. '9'
and then Text (Last) not in 'A' .. 'F'
then
Last := Last - 1;
exit;
end if;
end loop;
Code := Code_Point'Value ("16#" & Text (First .. Last) & "#");
end Parse_Code_Point;
-----------
-- Value --
-----------
function Value (Item : String) return Decomposition_Type is
type Constant_String_Access is access constant String;
Compat_Image : aliased constant String := "compat";
Circle_Image : aliased constant String := "circle";
Final_Image : aliased constant String := "final";
Font_Image : aliased constant String := "font";
Fraction_Image : aliased constant String := "fraction";
Initial_Image : aliased constant String := "initial";
Isolated_Image : aliased constant String := "isolated";
Medial_Image : aliased constant String := "medial";
Narrow_Image : aliased constant String := "narrow";
Nobreak_Image : aliased constant String := "noBreak";
Small_Image : aliased constant String := "small";
Square_Image : aliased constant String := "square";
Sub_Image : aliased constant String := "sub";
Super_Image : aliased constant String := "super";
Vertical_Image : aliased constant String := "vertical";
Wide_Image : aliased constant String := "wide";
Mapping : constant
array (Decomposition_Type range Font .. Compat)
of Constant_String_Access
:= (Compat => Compat_Image'Access,
Circle => Circle_Image'Access,
Final => Final_Image'Access,
Font => font_Image'Access,
Fraction => Fraction_Image'Access,
Initial => Initial_Image'Access,
Isolated => Isolated_Image'Access,
Medial => Medial_Image'Access,
Narrow => Narrow_Image'Access,
No_Break => Nobreak_Image'Access,
Small => Small_Image'Access,
Square => Square_Image'Access,
Sub => sub_Image'Access,
Super => Super_Image'Access,
Vertical => Vertical_Image'Access,
Wide => wide_Image'Access);
begin
if Item'Length = 0 then
return Canonical;
end if;
for J in Mapping'Range loop
if Mapping (J).all = Item then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of Decomposition_Type";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return East_Asian_Width is
type Constant_String_Access is access constant String;
A_Image : aliased constant String := "A";
F_Image : aliased constant String := "F";
H_Image : aliased constant String := "H";
N_Image : aliased constant String := "N";
Na_Image : aliased constant String := "Na";
W_Image : aliased constant String := "W";
Mapping : constant array (East_Asian_Width) of Constant_String_Access
:= (Ambiguous => A_Image'Access,
Fullwidth => F_Image'Access,
Halfwidth => H_Image'Access,
Neutral => N_Image'Access,
Narrow => Na_Image'Access,
Wide => W_Image'Access);
begin
for J in Mapping'Range loop
if Mapping (J).all = Item then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of General_Category";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return General_Category is
Mapping : constant array (General_Category) of String (1 .. 2)
:= (Control => "Cc",
Format => "Cf",
Unassigned => "Cn",
Private_Use => "Co",
Surrogate => "Cs",
Lowercase_Letter => "Ll",
Modifier_Letter => "Lm",
Other_Letter => "Lo",
Titlecase_Letter => "Lt",
Uppercase_Letter => "Lu",
Spacing_Mark => "Mc",
Enclosing_Mark => "Me",
Nonspacing_Mark => "Mn",
Decimal_Number => "Nd",
Letter_Number => "Nl",
Other_Number => "No",
Connector_Punctuation => "Pc",
Dash_Punctuation => "Pd",
Close_Punctuation => "Pe",
Final_Punctuation => "Pf",
Initial_Punctuation => "Pi",
Other_Punctuation => "Po",
Open_Punctuation => "Ps",
Currency_Symbol => "Sc",
Modifier_Symbol => "Sk",
Math_Symbol => "Sm",
Other_Symbol => "So",
Line_Separator => "Zl",
Paragraph_Separator => "Zp",
Space_Separator => "Zs");
begin
for J in Mapping'Range loop
if Mapping (J) = Item then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of General_Category";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return Grapheme_Cluster_Break is
type Constant_String_Access is access constant String;
GCB_Control_Image : aliased constant String := "Control";
GCB_CR_Image : aliased constant String := "CR";
GCB_Extend_Image : aliased constant String := "Extend";
GCB_L_Image : aliased constant String := "L";
GCB_LF_Image : aliased constant String := "LF";
GCB_LV_Image : aliased constant String := "LV";
GCB_LVT_Image : aliased constant String := "LVT";
GCB_Prepend_Image : aliased constant String := "Prepend";
GCB_SpacingMark_Image : aliased constant String := "SpacingMark";
GCB_T_Image : aliased constant String := "T";
GCB_V_Image : aliased constant String := "V";
GCB_Other_Image : aliased constant String := "Other";
GCB_Regional_Indicator_Image :
aliased constant String := "Regional_Indicator";
Mapping : constant
array (Grapheme_Cluster_Break) of Constant_String_Access
:= (Control => GCB_Control_Image'Access,
CR => GCB_CR_Image'Access,
Extend => GCB_Extend_Image'Access,
L => GCB_L_Image'Access,
LF => GCB_LF_Image'Access,
LV => GCB_LV_Image'Access,
LVT => GCB_LVT_Image'Access,
Prepend => GCB_Prepend_Image'Access,
Spacing_Mark => GCB_SpacingMark_Image'Access,
T => GCB_T_Image'Access,
V => GCB_V_Image'Access,
Other => GCB_Other_Image'Access,
Regional_Indicator => GCB_Regional_Indicator_Image'Access);
begin
for J in Mapping'Range loop
if Item = Mapping (J).all then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of Grapheme_Cluster_Break";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return Line_Break is
Mapping : constant array (Line_Break) of String (1 .. 2)
:= (Ambiguous => "AI",
Alphabetic => "AL",
Break_Both => "B2",
Break_After => "BA",
Break_Before => "BB",
Mandatory_Break => "BK",
Contingent_Break => "CB",
Conditional_Japanese_Starter => "CJ",
Close_Punctuation => "CL",
Combining_Mark => "CM",
Close_Parenthesis => "CP",
Carriage_Return => "CR",
Exclamation => "EX",
Glue => "GL",
H2 => "H2",
H3 => "H3",
Hebrew_Letter => "HL",
Hyphen => "HY",
Ideographic => "ID",
Inseparable => "IN",
Infix_Numeric => "IS",
JL => "JL",
JT => "JT",
JV => "JV",
Line_Feed => "LF",
Next_Line => "NL",
Nonstarter => "NS",
Numeric => "NU",
Open_Punctuation => "OP",
Postfix_Numeric => "PO",
Prefix_Numeric => "PR",
Quotation => "QU",
Complex_Context => "SA",
Surrogate => "SG",
Space => "SP",
Break_Symbols => "SY",
Word_Joiner => "WJ",
Unknown => "XX",
ZW_Space => "ZW",
Regional_Indicator => "RI");
begin
for J in Mapping'Range loop
if Mapping (J) = Item then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of Line_Break";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return Normalization_Quick_Check is
Mapping : constant array (Normalization_Quick_Check) of String (1 .. 1)
:= (No => "N",
Maybe => "M",
Yes => "Y");
begin
for J in Mapping'Range loop
if Mapping (J) = Item then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of Normalization_Quick_Check";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return Sentence_Break is
type Constant_String_Access is access constant String;
SB_ATerm_Image : aliased constant String := "ATerm";
SB_Close_Image : aliased constant String := "Close";
SB_CR_Image : aliased constant String := "CR";
SB_Extend_Image : aliased constant String := "Extend";
SB_Format_Image : aliased constant String := "Format";
SB_OLetter_Image : aliased constant String := "OLetter";
SB_LF_Image : aliased constant String := "LF";
SB_Lower_Image : aliased constant String := "Lower";
SB_Numeric_Image : aliased constant String := "Numeric";
SB_SContinue_Image : aliased constant String := "SContinue";
SB_Sep_Image : aliased constant String := "Sep";
SB_Sp_Image : aliased constant String := "Sp";
SB_STerm_Image : aliased constant String := "STerm";
SB_Upper_Image : aliased constant String := "Upper";
SB_Other_Image : aliased constant String := "Other";
Mapping : constant array (Sentence_Break) of Constant_String_Access :=
(A_Term => SB_ATerm_Image'Access,
Close => SB_Close_Image'Access,
CR => SB_CR_Image'Access,
Extend => SB_Extend_Image'Access,
Format => SB_Format_Image'Access,
O_Letter => SB_OLetter_Image'Access,
LF => SB_LF_Image'Access,
Lower => SB_Lower_Image'Access,
Numeric => SB_Numeric_Image'Access,
S_Continue => SB_SContinue_Image'Access,
Sep => SB_Sep_Image'Access,
Sp => SB_Sp_Image'Access,
S_Term => SB_STerm_Image'Access,
Upper => SB_Upper_Image'Access,
Other => SB_Other_Image'Access);
begin
for J in Mapping'Range loop
if Item = Mapping (J).all then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of Sentence_Break";
end Value;
-----------
-- Value --
-----------
function Value (Item : String) return Word_Break is
type Constant_String_Access is access constant String;
WB_CR_Image : aliased constant String := "CR";
WB_ExtendNumLet_Image : aliased constant String := "ExtendNumLet";
WB_Extend_Image : aliased constant String := "Extend";
WB_Format_Image : aliased constant String := "Format";
WB_Katakana_Image : aliased constant String := "Katakana";
WB_ALetter_Image : aliased constant String := "ALetter";
WB_LF_Image : aliased constant String := "LF";
WB_MidNumLet_Image : aliased constant String := "MidNumLet";
WB_MidLetter_Image : aliased constant String := "MidLetter";
WB_MidNum_Image : aliased constant String := "MidNum";
WB_Newline_Image : aliased constant String := "Newline";
WB_Numeric_Image : aliased constant String := "Numeric";
WB_Other_Image : aliased constant String := "Other";
WB_Regional_Indicator_Image :
aliased constant String := "Regional_Indicator";
WB_Hebrew_Letter_Image : aliased constant String := "Hebrew_Letter";
WB_Single_Quote_Image : aliased constant String := "Single_Quote";
WB_Double_Quote_Image : aliased constant String := "Double_Quote";
Mapping : constant array (Word_Break) of Constant_String_Access :=
(CR => WB_CR_Image'Access,
Extend_Num_Let => WB_ExtendNumLet_Image'Access,
Extend => WB_Extend_Image'Access,
Format => WB_Format_Image'Access,
Katakana => WB_Katakana_Image'Access,
A_Letter => WB_ALetter_Image'Access,
LF => WB_LF_Image'Access,
Mid_Num_Let => WB_MidNumLet_Image'Access,
Mid_Letter => WB_MidLetter_Image'Access,
Mid_Num => WB_MidNum_Image'Access,
Newline => WB_Newline_Image'Access,
Numeric => WB_Numeric_Image'Access,
Other => WB_Other_Image'Access,
Regional_Indicator => WB_Regional_Indicator_Image'Access,
Hebrew_Letter => WB_Hebrew_Letter_Image'Access,
Single_Quote => WB_Single_Quote_Image'Access,
Double_Quote => WB_Double_Quote_Image'Access);
begin
for J in Mapping'Range loop
if Item = Mapping (J).all then
return J;
end if;
end loop;
raise Constraint_Error with "Invalid image of Word_Break";
end Value;
end Ucd_Data;
|
zhmu/ananas | Ada | 19,778 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . L I S T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2018-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body GNAT.Lists is
package body Doubly_Linked_Lists is
procedure Delete_Node
(L : Doubly_Linked_List;
Nod : Node_Ptr);
pragma Inline (Delete_Node);
-- Detach and delete node Nod from list L
procedure Ensure_Circular (Head : Node_Ptr);
pragma Inline (Ensure_Circular);
-- Ensure that dummy head Head is circular with respect to itself
procedure Ensure_Created (L : Doubly_Linked_List);
pragma Inline (Ensure_Created);
-- Verify that list L is created. Raise Not_Created if this is not the
-- case.
procedure Ensure_Full (L : Doubly_Linked_List);
pragma Inline (Ensure_Full);
-- Verify that list L contains at least one element. Raise List_Empty if
-- this is not the case.
procedure Ensure_Unlocked (L : Doubly_Linked_List);
pragma Inline (Ensure_Unlocked);
-- Verify that list L is unlocked. Raise Iterated if this is not the
-- case.
function Find_Node
(Head : Node_Ptr;
Elem : Element_Type) return Node_Ptr;
pragma Inline (Find_Node);
-- Travers a list indicated by dummy head Head to determine whethe there
-- exists a node with element Elem. If such a node exists, return it,
-- otherwise return null;
procedure Free is
new Ada.Unchecked_Deallocation
(Doubly_Linked_List_Attributes, Doubly_Linked_List);
procedure Free is new Ada.Unchecked_Deallocation (Node, Node_Ptr);
procedure Insert_Between
(L : Doubly_Linked_List;
Elem : Element_Type;
Left : Node_Ptr;
Right : Node_Ptr);
pragma Inline (Insert_Between);
-- Insert element Elem between nodes Left and Right of list L
function Is_Valid (Iter : Iterator) return Boolean;
pragma Inline (Is_Valid);
-- Determine whether iterator Iter refers to a valid element
function Is_Valid
(Nod : Node_Ptr;
Head : Node_Ptr) return Boolean;
pragma Inline (Is_Valid);
-- Determine whether node Nod is non-null and does not refer to dummy
-- head Head, thus making it valid.
procedure Lock (L : Doubly_Linked_List);
pragma Inline (Lock);
-- Lock all mutation functionality of list L
function Present (Nod : Node_Ptr) return Boolean;
pragma Inline (Present);
-- Determine whether node Nod exists
procedure Unlock (L : Doubly_Linked_List);
pragma Inline (Unlock);
-- Unlock all mutation functionality of list L
------------
-- Append --
------------
procedure Append
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
-- Ensure that the dummy head of an empty list is circular with
-- respect to itself.
Head := L.Nodes'Access;
Ensure_Circular (Head);
-- Append the node by inserting it between the last node and the
-- dummy head.
Insert_Between
(L => L,
Elem => Elem,
Left => Head.Prev,
Right => Head);
end Append;
------------
-- Create --
------------
function Create return Doubly_Linked_List is
begin
return new Doubly_Linked_List_Attributes;
end Create;
--------------
-- Contains --
--------------
function Contains
(L : Doubly_Linked_List;
Elem : Element_Type) return Boolean
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Elem);
return Is_Valid (Nod, Head);
end Contains;
------------
-- Delete --
------------
procedure Delete
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Elem);
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First (L : Doubly_Linked_List) is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Head.Next;
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (L : Doubly_Linked_List) is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Head.Prev;
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete_Last;
-----------------
-- Delete_Node --
-----------------
procedure Delete_Node
(L : Doubly_Linked_List;
Nod : Node_Ptr)
is
Ref : Node_Ptr := Nod;
pragma Assert (Present (Ref));
Next : constant Node_Ptr := Ref.Next;
Prev : constant Node_Ptr := Ref.Prev;
begin
pragma Assert (Present (L));
pragma Assert (Present (Next));
pragma Assert (Present (Prev));
Prev.Next := Next; -- Prev ---> Next
Next.Prev := Prev; -- Prev <--> Next
Ref.Next := null;
Ref.Prev := null;
L.Elements := L.Elements - 1;
-- Invoke the element destructor before deallocating the node
Destroy_Element (Nod.Elem);
Free (Ref);
end Delete_Node;
-------------
-- Destroy --
-------------
procedure Destroy (L : in out Doubly_Linked_List) is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
while Is_Valid (Head.Next, Head) loop
Delete_Node (L, Head.Next);
end loop;
Free (L);
end Destroy;
---------------------
-- Ensure_Circular --
---------------------
procedure Ensure_Circular (Head : Node_Ptr) is
pragma Assert (Present (Head));
begin
if not Present (Head.Next) and then not Present (Head.Prev) then
Head.Next := Head;
Head.Prev := Head;
end if;
end Ensure_Circular;
--------------------
-- Ensure_Created --
--------------------
procedure Ensure_Created (L : Doubly_Linked_List) is
begin
if not Present (L) then
raise Not_Created;
end if;
end Ensure_Created;
-----------------
-- Ensure_Full --
-----------------
procedure Ensure_Full (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
if L.Elements = 0 then
raise List_Empty;
end if;
end Ensure_Full;
---------------------
-- Ensure_Unlocked --
---------------------
procedure Ensure_Unlocked (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list has at least one outstanding iterator
if L.Iterators > 0 then
raise Iterated;
end if;
end Ensure_Unlocked;
-----------
-- Equal --
-----------
function Equal
(Left : Doubly_Linked_List;
Right : Doubly_Linked_List) return Boolean
is
Left_Head : Node_Ptr;
Left_Nod : Node_Ptr;
Right_Head : Node_Ptr;
Right_Nod : Node_Ptr;
begin
-- Two non-existent lists are considered equal
if Left = Nil and then Right = Nil then
return True;
-- A non-existent list is never equal to an already created list
elsif Left = Nil or else Right = Nil then
return False;
-- The two lists must contain the same number of elements to be equal
elsif Size (Left) /= Size (Right) then
return False;
end if;
-- Compare the two lists element by element
Left_Head := Left.Nodes'Access;
Left_Nod := Left_Head.Next;
Right_Head := Right.Nodes'Access;
Right_Nod := Right_Head.Next;
while Is_Valid (Left_Nod, Left_Head)
and then
Is_Valid (Right_Nod, Right_Head)
loop
if Left_Nod.Elem /= Right_Nod.Elem then
return False;
end if;
Left_Nod := Left_Nod.Next;
Right_Nod := Right_Nod.Next;
end loop;
return True;
end Equal;
---------------
-- Find_Node --
---------------
function Find_Node
(Head : Node_Ptr;
Elem : Element_Type) return Node_Ptr
is
pragma Assert (Present (Head));
Nod : Node_Ptr;
begin
-- Traverse the nodes of the list, looking for a matching element
Nod := Head.Next;
while Is_Valid (Nod, Head) loop
if Nod.Elem = Elem then
return Nod;
end if;
Nod := Nod.Next;
end loop;
return null;
end Find_Node;
-----------
-- First --
-----------
function First (L : Doubly_Linked_List) return Element_Type is
begin
Ensure_Created (L);
Ensure_Full (L);
return L.Nodes.Next.Elem;
end First;
--------------
-- Has_Next --
--------------
function Has_Next (Iter : Iterator) return Boolean is
Is_OK : constant Boolean := Is_Valid (Iter);
begin
-- The iterator is no longer valid which indicates that it has been
-- exhausted. Unlock all mutation functionality of the list because
-- the iterator cannot be advanced any further.
if not Is_OK then
Unlock (Iter.List);
end if;
return Is_OK;
end Has_Next;
------------------
-- Insert_After --
------------------
procedure Insert_After
(L : Doubly_Linked_List;
After : Element_Type;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, After);
if Is_Valid (Nod, Head) then
Insert_Between
(L => L,
Elem => Elem,
Left => Nod,
Right => Nod.Next);
end if;
end Insert_After;
-------------------
-- Insert_Before --
-------------------
procedure Insert_Before
(L : Doubly_Linked_List;
Before : Element_Type;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Before);
if Is_Valid (Nod, Head) then
Insert_Between
(L => L,
Elem => Elem,
Left => Nod.Prev,
Right => Nod);
end if;
end Insert_Before;
--------------------
-- Insert_Between --
--------------------
procedure Insert_Between
(L : Doubly_Linked_List;
Elem : Element_Type;
Left : Node_Ptr;
Right : Node_Ptr)
is
pragma Assert (Present (L));
pragma Assert (Present (Left));
pragma Assert (Present (Right));
Nod : constant Node_Ptr :=
new Node'(Elem => Elem,
Next => Right, -- Left Nod ---> Right
Prev => Left); -- Left <--- Nod ---> Right
begin
Left.Next := Nod; -- Left <--> Nod ---> Right
Right.Prev := Nod; -- Left <--> Nod <--> Right
L.Elements := L.Elements + 1;
end Insert_Between;
--------------
-- Is_Empty --
--------------
function Is_Empty (L : Doubly_Linked_List) return Boolean is
begin
Ensure_Created (L);
return L.Elements = 0;
end Is_Empty;
--------------
-- Is_Valid --
--------------
function Is_Valid (Iter : Iterator) return Boolean is
begin
-- The invariant of Iterate and Next ensures that the iterator always
-- refers to a valid node if there exists one.
return Is_Valid (Iter.Curr_Nod, Iter.List.Nodes'Access);
end Is_Valid;
--------------
-- Is_Valid --
--------------
function Is_Valid
(Nod : Node_Ptr;
Head : Node_Ptr) return Boolean
is
begin
-- A node is valid if it is non-null, and does not refer to the dummy
-- head of some list.
return Present (Nod) and then Nod /= Head;
end Is_Valid;
-------------
-- Iterate --
-------------
function Iterate (L : Doubly_Linked_List) return Iterator is
begin
Ensure_Created (L);
-- Lock all mutation functionality of the list while it is being
-- iterated on.
Lock (L);
return (List => L, Curr_Nod => L.Nodes.Next);
end Iterate;
----------
-- Last --
----------
function Last (L : Doubly_Linked_List) return Element_Type is
begin
Ensure_Created (L);
Ensure_Full (L);
return L.Nodes.Prev.Elem;
end Last;
----------
-- Lock --
----------
procedure Lock (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list may be locked multiple times if multiple iterators are
-- operating over it.
L.Iterators := L.Iterators + 1;
end Lock;
----------
-- Next --
----------
procedure Next
(Iter : in out Iterator;
Elem : out Element_Type)
is
Is_OK : constant Boolean := Is_Valid (Iter);
Saved : constant Node_Ptr := Iter.Curr_Nod;
begin
-- The iterator is no linger valid which indicates that it has been
-- exhausted. Unlock all mutation functionality of the list as the
-- iterator cannot be advanced any further.
if not Is_OK then
Unlock (Iter.List);
raise Iterator_Exhausted;
end if;
-- Advance to the next node along the list
Iter.Curr_Nod := Iter.Curr_Nod.Next;
Elem := Saved.Elem;
end Next;
-------------
-- Prepend --
-------------
procedure Prepend
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
-- Ensure that the dummy head of an empty list is circular with
-- respect to itself.
Head := L.Nodes'Access;
Ensure_Circular (Head);
-- Append the node by inserting it between the dummy head and the
-- first node.
Insert_Between
(L => L,
Elem => Elem,
Left => Head,
Right => Head.Next);
end Prepend;
-------------
-- Present --
-------------
function Present (L : Doubly_Linked_List) return Boolean is
begin
return L /= Nil;
end Present;
-------------
-- Present --
-------------
function Present (Nod : Node_Ptr) return Boolean is
begin
return Nod /= null;
end Present;
-------------
-- Replace --
-------------
procedure Replace
(L : Doubly_Linked_List;
Old_Elem : Element_Type;
New_Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Old_Elem);
if Is_Valid (Nod, Head) then
Nod.Elem := New_Elem;
end if;
end Replace;
----------
-- Size --
----------
function Size (L : Doubly_Linked_List) return Natural is
begin
Ensure_Created (L);
return L.Elements;
end Size;
------------
-- Unlock --
------------
procedure Unlock (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list may be locked multiple times if multiple iterators are
-- operating over it.
L.Iterators := L.Iterators - 1;
end Unlock;
end Doubly_Linked_Lists;
end GNAT.Lists;
|
zhmu/ananas | Ada | 95 | adb | -- { dg-do compile }
package body Prot8 is
protected body Prot is
end Prot;
end Prot8;
|
alvaromb/Compilemon | Ada | 23,924 | adb |
with parse_tokens, parse_goto, parse_shift_reduce, text_io, scanner;
with nfa, ccl, misc, misc_defs, sym, ecs, aflex_scanner;
with tstring, int_io, main_body, text_io, external_file_manager;
use aflex_scanner, external_file_manager;
package body parser is
-- build_eof_action - build the "<<EOF>>" action for the active start
-- conditions
use text_io, misc_defs;
procedure build_eof_action is
begin
text_io.put( temp_action_file, "when " );
for i in 1..actvp loop
if ( sceof(actvsc(i)) ) then
text_io.put( Standard_Error,
"multiple <<EOF>> rules for start condition ");
tstring.put( Standard_Error, scname(actvsc(i)));
main_body.aflexend(1);
else
sceof(actvsc(i)) := true;
text_io.put( temp_action_file, "YY_END_OF_BUFFER +" );
tstring.put( temp_action_file, scname(actvsc(i)) );
text_io.put_line( temp_action_file, " + 1 " );
if (i /= actvp) then
text_io.put_line( temp_action_file, " |" );
else
text_io.put_line( temp_action_file, " =>" );
end if;
end if;
end loop;
misc.line_directive_out( temp_action_file );
end build_eof_action;
-- yyerror - eat up an error message from the parser
--
-- synopsis
-- char msg[];
-- yyerror( msg );
procedure yyerror( msg : string ) is
begin
null;
end yyerror;
use Parse_Goto, Parse_Shift_Reduce, Text_IO, misc_defs, tstring;
procedure YYParse is
-- Rename User Defined Packages to Internal Names.
package yy_goto_tables renames
Parse_Goto;
package yy_shift_reduce_tables renames
Parse_Shift_Reduce;
package yy_tokens renames
Parse_Tokens;
use yy_tokens, yy_goto_tables, yy_shift_reduce_tables;
procedure yyerrok;
procedure yyclearin;
package yy is
-- the size of the value and state stacks
stack_size : constant Natural := 300;
-- subtype rule is natural;
subtype parse_state is natural;
-- subtype nonterminal is integer;
-- encryption constants
default : constant := -1;
first_shift_entry : constant := 0;
accept_code : constant := -1001;
error_code : constant := -1000;
-- stack data used by the parser
tos : natural := 0;
value_stack : array(0..stack_size) of yy_tokens.yystype;
state_stack : array(0..stack_size) of parse_state;
-- current input symbol and action the parser is on
action : integer;
rule_id : rule;
input_symbol : yy_tokens.token;
-- error recovery flag
error_flag : natural := 0;
-- indicates 3 - (number of valid shifts after an error occurs)
look_ahead : boolean := true;
index : integer;
-- Is Debugging option on or off
DEBUG : constant boolean := FALSE;
end yy;
function goto_state
(state : yy.parse_state;
sym : nonterminal) return yy.parse_state;
function parse_action
(state : yy.parse_state;
t : yy_tokens.token) return integer;
pragma inline(goto_state, parse_action);
function goto_state(state : yy.parse_state;
sym : nonterminal) return yy.parse_state is
index : integer;
begin
index := goto_offset(state);
while integer(goto_matrix(index).nonterm) /= sym loop
index := index + 1;
end loop;
return integer(goto_matrix(index).newstate);
end goto_state;
function parse_action(state : yy.parse_state;
t : yy_tokens.token) return integer is
index : integer;
tok_pos : integer;
default : constant integer := -1;
begin
tok_pos := yy_tokens.token'pos(t);
index := shift_reduce_offset(state);
while integer(shift_reduce_matrix(index).t) /= tok_pos and then
integer(shift_reduce_matrix(index).t) /= default
loop
index := index + 1;
end loop;
return integer(shift_reduce_matrix(index).act);
end parse_action;
-- error recovery stuff
procedure handle_error is
temp_action : integer;
begin
if yy.error_flag = 3 then -- no shift yet, clobber input.
if yy.debug then
text_io.put_line("Ayacc.YYParse: Error Recovery Clobbers " &
yy_tokens.token'image(yy.input_symbol));
end if;
if yy.input_symbol = yy_tokens.end_of_input then -- don't discard,
if yy.debug then
text_io.put_line("Ayacc.YYParse: Can't discard END_OF_INPUT, quiting...");
end if;
raise yy_tokens.syntax_error;
end if;
yy.look_ahead := true; -- get next token
return; -- and try again...
end if;
if yy.error_flag = 0 then -- brand new error
yyerror("Syntax Error");
end if;
yy.error_flag := 3;
-- find state on stack where error is a valid shift --
if yy.debug then
text_io.put_line("Ayacc.YYParse: Looking for state with error as valid shift");
end if;
loop
if yy.debug then
text_io.put_line("Ayacc.YYParse: Examining State " &
yy.parse_state'image(yy.state_stack(yy.tos)));
end if;
temp_action := parse_action(yy.state_stack(yy.tos), error);
if temp_action >= yy.first_shift_entry then
if yy.tos = yy.stack_size then
text_io.put_line(" Stack size exceeded on state_stack");
raise yy_Tokens.syntax_error;
end if;
yy.tos := yy.tos + 1;
yy.state_stack(yy.tos) := temp_action;
exit;
end if;
Decrement_Stack_Pointer :
begin
yy.tos := yy.tos - 1;
exception
when Constraint_Error =>
yy.tos := 0;
end Decrement_Stack_Pointer;
if yy.tos = 0 then
if yy.debug then
text_io.put_line("Ayacc.YYParse: Error recovery popped entire stack, aborting...");
end if;
raise yy_tokens.syntax_error;
end if;
end loop;
if yy.debug then
text_io.put_line("Ayacc.YYParse: Shifted error token in state " &
yy.parse_state'image(yy.state_stack(yy.tos)));
end if;
end handle_error;
-- print debugging information for a shift operation
procedure shift_debug(state_id: yy.parse_state; lexeme: yy_tokens.token) is
begin
text_io.put_line("Ayacc.YYParse: Shift "& yy.parse_state'image(state_id)&" on input symbol "&
yy_tokens.token'image(lexeme) );
end;
-- print debugging information for a reduce operation
procedure reduce_debug(rule_id: rule; state_id: yy.parse_state) is
begin
text_io.put_line("Ayacc.YYParse: Reduce by rule "&rule'image(rule_id)&" goto state "&
yy.parse_state'image(state_id));
end;
-- make the parser believe that 3 valid shifts have occured.
-- used for error recovery.
procedure yyerrok is
begin
yy.error_flag := 0;
end yyerrok;
-- called to clear input symbol that caused an error.
procedure yyclearin is
begin
-- yy.input_symbol := yylex;
yy.look_ahead := true;
end yyclearin;
begin
-- initialize by pushing state 0 and getting the first input symbol
yy.state_stack(yy.tos) := 0;
loop
yy.index := shift_reduce_offset(yy.state_stack(yy.tos));
if integer(shift_reduce_matrix(yy.index).t) = yy.default then
yy.action := integer(shift_reduce_matrix(yy.index).act);
else
if yy.look_ahead then
yy.look_ahead := false;
yy.input_symbol := yylex;
end if;
yy.action :=
parse_action(yy.state_stack(yy.tos), yy.input_symbol);
end if;
if yy.action >= yy.first_shift_entry then -- SHIFT
if yy.debug then
shift_debug(yy.action, yy.input_symbol);
end if;
-- Enter new state
if yy.tos = yy.stack_size then
text_io.put_line(" Stack size exceeded on state_stack");
raise yy_Tokens.syntax_error;
end if;
yy.tos := yy.tos + 1;
yy.state_stack(yy.tos) := yy.action;
yy.value_stack(yy.tos) := yylval;
if yy.error_flag > 0 then -- indicate a valid shift
yy.error_flag := yy.error_flag - 1;
end if;
-- Advance lookahead
yy.look_ahead := true;
elsif yy.action = yy.error_code then -- ERROR
handle_error;
elsif yy.action = yy.accept_code then
if yy.debug then
text_io.put_line("Ayacc.YYParse: Accepting Grammar...");
end if;
exit;
else -- Reduce Action
-- Convert action into a rule
yy.rule_id := -1 * yy.action;
-- Execute User Action
-- user_action(yy.rule_id);
case yy.rule_id is
when 1 =>
--#line 44
-- add default rule
pat := ccl.cclinit;
ccl.cclnegate( pat );
def_rule := nfa.mkstate( -pat );
nfa.finish_rule( def_rule, false, 0, 0 );
for i in 1 .. lastsc loop
scset(i) := nfa.mkbranch( scset(i), def_rule );
end loop;
if ( spprdflt ) then
text_io.put(temp_action_file,
"raise AFLEX_SCANNER_JAMMED;");
else
text_io.put( temp_action_file, "ECHO" );
text_io.put_line( temp_action_file, ";" );
end if;
when 2 =>
--#line 69
-- initialize for processing rules
-- create default DFA start condition
sym.scinstal( tstring.vstr("INITIAL"), false );
when 5 =>
--#line 80
misc.synerr( "unknown error processing section 1" );
when 7 =>
--#line 87
-- these productions are separate from the s1object
-- rule because the semantics must be done before
-- we parse the remainder of an s1object
xcluflg := false;
when 8 =>
--#line 97
xcluflg := true;
when 9 =>
--#line 101
sym.scinstal( nmstr, xcluflg );
when 10 =>
--#line 104
sym.scinstal( nmstr, xcluflg );
when 11 =>
--#line 107
misc.synerr( "bad start condition list" );
when 14 =>
--#line 115
-- initialize for a parse of one rule
trlcontxt := false;
variable_trail_rule := false;
varlength := false;
trailcnt := 0;
headcnt := 0;
rulelen := 0;
current_state_enum := STATE_NORMAL;
previous_continued_action := continued_action;
nfa.new_rule;
when 15 =>
--#line 130
pat := nfa.link_machines(
yy.value_stack(yy.tos-1),
yy.value_stack(yy.tos) );
nfa.finish_rule( pat, variable_trail_rule,
headcnt, trailcnt );
for i in 1 .. actvp loop
scbol(actvsc(i)) :=
nfa.mkbranch( scbol(actvsc(i)), pat );
end loop;
if ( not bol_needed ) then
bol_needed := true;
if ( performance_report ) then
text_io.put( Standard_Error,
"'^' operator results in sub-optimal performance");
text_io.new_line(Standard_Error);
end if;
end if;
when 16 =>
--#line 152
pat := nfa.link_machines(
yy.value_stack(yy.tos-1),
yy.value_stack(yy.tos) );
nfa.finish_rule( pat, variable_trail_rule,
headcnt, trailcnt );
for i in 1 .. actvp loop
scset(actvsc(i)) :=
nfa.mkbranch( scset(actvsc(i)), pat );
end loop;
when 17 =>
--#line 163
pat := nfa.link_machines(
yy.value_stack(yy.tos-1),
yy.value_stack(yy.tos) );
nfa.finish_rule( pat, variable_trail_rule,
headcnt, trailcnt );
-- add to all non-exclusive start conditions,
-- including the default (0) start condition
for i in 1 .. lastsc loop
if ( not scxclu(i) ) then
scbol(i) := nfa.mkbranch( scbol(i), pat );
end if;
end loop;
if ( not bol_needed ) then
bol_needed := true;
if ( performance_report ) then
text_io.put( Standard_Error,
"'^' operator results in sub-optimal performance");
text_io.new_line(Standard_Error);
end if;
end if;
when 18 =>
--#line 188
pat := nfa.link_machines(
yy.value_stack(yy.tos-1),
yy.value_stack(yy.tos) );
nfa.finish_rule( pat, variable_trail_rule,
headcnt, trailcnt );
for i in 1 .. lastsc loop
if ( not scxclu(i) ) then
scset(i) := nfa.mkbranch( scset(i), pat );
end if;
end loop;
when 19 =>
--#line 201
build_eof_action;
when 20 =>
--#line 204
-- this EOF applies only to the INITIAL start cond.
actvp := 1;
actvsc(actvp) := 1;
build_eof_action;
when 21 =>
--#line 212
misc.synerr( "unrecognized rule" );
when 23 =>
--#line 219
scnum := sym.sclookup( nmstr );
if (scnum = 0 ) then
text_io.put( Standard_Error,
"undeclared start condition ");
tstring.put( Standard_Error, nmstr );
main_body.aflexend( 1 );
else
actvp := actvp + 1;
actvsc(actvp) := scnum;
end if;
when 24 =>
--#line 233
scnum := sym.sclookup( nmstr );
if (scnum = 0 ) then
text_io.put( Standard_Error,
"undeclared start condition ");
tstring.put( Standard_Error, nmstr );
main_body.aflexend ( 1 );
else
actvp := 1;
actvsc(actvp) := scnum;
end if;
when 25 =>
--#line 247
misc.synerr( "bad start condition list" );
when 26 =>
--#line 251
if trlcontxt then
misc.synerr( "trailing context used twice" );
yyval := nfa.mkstate( SYM_EPSILON );
else
trlcontxt := true;
if ( not varlength ) then
headcnt := rulelen;
end if;
rulelen := rulelen + 1;
trailcnt := 1;
eps := nfa.mkstate( SYM_EPSILON );
yyval := nfa.link_machines( eps,
nfa.mkstate( CHARACTER'POS(ASCII.LF) ) );
end if;
when 27 =>
--#line 272
yyval := nfa.mkstate( SYM_EPSILON );
if ( trlcontxt ) then
if ( varlength and (headcnt = 0) ) then
-- both head and trail are variable-length
variable_trail_rule := true;
else
trailcnt := rulelen;
end if;
end if;
when 28 =>
--#line 287
varlength := true;
yyval := nfa.mkor(
yy.value_stack(yy.tos-2),
yy.value_stack(yy.tos) );
when 29 =>
--#line 294
if ( transchar(lastst(
yy.value_stack(yy.tos))) /= SYM_EPSILON ) then
-- provide final transition \now/ so it
-- will be marked as a trailing context
-- state
yy.value_stack(yy.tos) := nfa.link_machines(
yy.value_stack(yy.tos), nfa.mkstate( SYM_EPSILON ) );
end if;
nfa.mark_beginning_as_normal(
yy.value_stack(yy.tos) );
current_state_enum := STATE_NORMAL;
if ( previous_continued_action ) then
-- we need to treat this as variable trailing
-- context so that the backup does not happen
-- in the action but before the action switch
-- statement. If the backup happens in the
-- action, then the rules "falling into" this
-- one's action will *also* do the backup,
-- erroneously.
if ( (not varlength) or headcnt /= 0 ) then
text_io.put( Standard_Error,
"alex: warning - trailing context rule at line");
int_io.put(Standard_Error, linenum);
text_io.put( Standard_Error,
"made variable because of preceding '|' action" );
int_io.put(Standard_Error, linenum);
end if;
-- mark as variable
varlength := true;
headcnt := 0;
end if;
if ( varlength and (headcnt = 0) ) then
-- variable trailing context rule
-- mark the first part of the rule as the accepting
-- "head" part of a trailing context rule
-- by the way, we didn't do this at the beginning
-- of this production because back then
-- current_state_enum was set up for a trail
-- rule, and add_accept() can create a new
-- state ...
nfa.add_accept(
yy.value_stack(yy.tos-1),
misc.set_yy_trailing_head_mask(num_rules) );
end if;
yyval := nfa.link_machines(
yy.value_stack(yy.tos-1),
yy.value_stack(yy.tos) );
when 30 =>
--#line 348
yyval :=
yy.value_stack(yy.tos);
when 31 =>
--#line 353
-- this rule is separate from the others for "re" so
-- that the reduction will occur before the trailing
-- series is parsed
if ( trlcontxt ) then
misc.synerr( "trailing context used twice" );
else
trlcontxt := true;
end if;
if ( varlength ) then
-- we hope the trailing context is fixed-length
varlength := false;
else
headcnt := rulelen;
end if;
rulelen := 0;
current_state_enum := STATE_TRAILING_CONTEXT;
yyval :=
yy.value_stack(yy.tos-1);
when 32 =>
--#line 379
-- this is where concatenation of adjacent patterns
-- gets done
yyval := nfa.link_machines(
yy.value_stack(yy.tos-1),
yy.value_stack(yy.tos) );
when 33 =>
--#line 387
yyval :=
yy.value_stack(yy.tos);
when 34 =>
--#line 391
varlength := true;
yyval := nfa.mkclos(
yy.value_stack(yy.tos-1) );
when 35 =>
--#line 398
varlength := true;
yyval := nfa.mkposcl(
yy.value_stack(yy.tos-1) );
when 36 =>
--#line 405
varlength := true;
yyval := nfa.mkopt(
yy.value_stack(yy.tos-1) );
when 37 =>
--#line 412
varlength := true;
if ( (
yy.value_stack(yy.tos-3) >
yy.value_stack(yy.tos-1)) or (
yy.value_stack(yy.tos-3) < 0) ) then
misc.synerr( "bad iteration values" );
yyval :=
yy.value_stack(yy.tos-5);
else
if (
yy.value_stack(yy.tos-3) = 0 ) then
yyval := nfa.mkopt( nfa.mkrep(
yy.value_stack(yy.tos-5),
yy.value_stack(yy.tos-3),
yy.value_stack(yy.tos-1) ) );
else
yyval := nfa.mkrep(
yy.value_stack(yy.tos-5),
yy.value_stack(yy.tos-3),
yy.value_stack(yy.tos-1) );
end if;
end if;
when 38 =>
--#line 428
varlength := true;
if (
yy.value_stack(yy.tos-2) <= 0 ) then
misc.synerr( "iteration value must be positive" );
yyval :=
yy.value_stack(yy.tos-4);
else
yyval := nfa.mkrep(
yy.value_stack(yy.tos-4),
yy.value_stack(yy.tos-2), INFINITY );
end if;
when 39 =>
--#line 440
-- the singleton could be something like "(foo)",
-- in which case we have no idea what its length
-- is, so we punt here.
varlength := true;
if (
yy.value_stack(yy.tos-1) <= 0 ) then
misc.synerr( "iteration value must be positive" );
yyval :=
yy.value_stack(yy.tos-3);
else
yyval := nfa.link_machines(
yy.value_stack(yy.tos-3), nfa.copysingl(
yy.value_stack(yy.tos-3),
yy.value_stack(yy.tos-1) - 1 ) );
end if;
when 40 =>
--#line 456
if ( not madeany ) then
-- create the '.' character class
anyccl := ccl.cclinit;
ccl.ccladd( anyccl, ASCII.LF );
ccl.cclnegate( anyccl );
if ( useecs ) then
ecs.mkeccl(
ccltbl(cclmap(anyccl)..cclmap(anyccl) + ccllen(anyccl)),
ccllen(anyccl), nextecm,
ecgroup, CSIZE );
end if;
madeany := true;
end if;
rulelen := rulelen + 1;
yyval := nfa.mkstate( -anyccl );
when 41 =>
--#line 478
if ( not cclsorted ) then
-- sort characters for fast searching. We use a
-- shell sort since this list could be large.
-- misc.cshell( ccltbl + cclmap($1), ccllen($1) );
misc.cshell( ccltbl(cclmap(
yy.value_stack(yy.tos))..cclmap(
yy.value_stack(yy.tos)) + ccllen(
yy.value_stack(yy.tos))),
ccllen(
yy.value_stack(yy.tos)) );
end if;
if ( useecs ) then
ecs.mkeccl( ccltbl(cclmap(
yy.value_stack(yy.tos))..cclmap(
yy.value_stack(yy.tos)) + ccllen(
yy.value_stack(yy.tos))),
ccllen(
yy.value_stack(yy.tos)),nextecm, ecgroup, CSIZE );
end if;
rulelen := rulelen + 1;
yyval := nfa.mkstate( -
yy.value_stack(yy.tos) );
when 42 =>
--#line 499
rulelen := rulelen + 1;
yyval := nfa.mkstate( -
yy.value_stack(yy.tos) );
when 43 =>
--#line 506
yyval :=
yy.value_stack(yy.tos-1);
when 44 =>
--#line 509
yyval :=
yy.value_stack(yy.tos-1);
when 45 =>
--#line 512
rulelen := rulelen + 1;
if (
yy.value_stack(yy.tos) = CHARACTER'POS(ASCII.NUL) ) then
misc.synerr( "null in rule" );
end if;
if ( caseins and (
yy.value_stack(yy.tos) >= CHARACTER'POS('A')) and (
yy.value_stack(yy.tos) <= CHARACTER'POS('Z')) ) then
yy.value_stack(yy.tos) := misc.clower(
yy.value_stack(yy.tos) );
end if;
yyval := nfa.mkstate(
yy.value_stack(yy.tos) );
when 46 =>
--#line 528
yyval :=
yy.value_stack(yy.tos-1);
when 47 =>
--#line 531
-- *Sigh* - to be compatible Unix lex, negated ccls
-- match newlines
ccl.cclnegate(
yy.value_stack(yy.tos-1) );
yyval :=
yy.value_stack(yy.tos-1);
when 48 =>
--#line 540
if (
yy.value_stack(yy.tos-2) >
yy.value_stack(yy.tos) ) then
misc.synerr( "negative range in character class" );
else
if ( caseins ) then
if ( (
yy.value_stack(yy.tos-2) >= CHARACTER'POS('A')) and (
yy.value_stack(yy.tos-2) <= CHARACTER'POS('Z')) ) then
yy.value_stack(yy.tos-2) := misc.clower(
yy.value_stack(yy.tos-2) );
end if;
if ( (
yy.value_stack(yy.tos) >= CHARACTER'POS('A')) and (
yy.value_stack(yy.tos) <= CHARACTER'POS('Z')) ) then
yy.value_stack(yy.tos) := misc.clower(
yy.value_stack(yy.tos) );
end if;
end if;
for i in
yy.value_stack(yy.tos-2) ..
yy.value_stack(yy.tos) loop
ccl.ccladd(
yy.value_stack(yy.tos-3), CHARACTER'VAL(i) );
end loop;
-- keep track if this ccl is staying in
-- alphabetical order
cclsorted := cclsorted and (
yy.value_stack(yy.tos-2) > lastchar);
lastchar :=
yy.value_stack(yy.tos);
end if;
yyval :=
yy.value_stack(yy.tos-3);
when 49 =>
--#line 568
if ( caseins ) then
if ( (
yy.value_stack(yy.tos) >= CHARACTER'POS('A')) and (
yy.value_stack(yy.tos) <= CHARACTER'POS('Z')) ) then
yy.value_stack(yy.tos) := misc.clower(
yy.value_stack(yy.tos) );
end if;
end if;
ccl.ccladd(
yy.value_stack(yy.tos-1), CHARACTER'VAL(
yy.value_stack(yy.tos)) );
cclsorted := cclsorted and (
yy.value_stack(yy.tos) > lastchar);
lastchar :=
yy.value_stack(yy.tos);
yyval :=
yy.value_stack(yy.tos-1);
when 50 =>
--#line 581
cclsorted := true;
lastchar := 0;
yyval := ccl.cclinit;
when 51 =>
--#line 589
if ( caseins ) then
if ( (
yy.value_stack(yy.tos) >= CHARACTER'POS('A')) and (
yy.value_stack(yy.tos) <= CHARACTER'POS('Z')) ) then
yy.value_stack(yy.tos) := misc.clower(
yy.value_stack(yy.tos) );
end if;
end if;
rulelen := rulelen + 1;
yyval := nfa.link_machines(
yy.value_stack(yy.tos-1), nfa.mkstate(
yy.value_stack(yy.tos) ) );
when 52 =>
--#line 602
yyval := nfa.mkstate( SYM_EPSILON );
when others => null;
end case;
-- Pop RHS states and goto next state
yy.tos := yy.tos - rule_length(yy.rule_id) + 1;
if yy.tos > yy.stack_size then
text_io.put_line(" Stack size exceeded on state_stack");
raise yy_Tokens.syntax_error;
end if;
yy.state_stack(yy.tos) := goto_state(yy.state_stack(yy.tos-1) ,
get_lhs_rule(yy.rule_id));
yy.value_stack(yy.tos) := yyval;
if yy.debug then
reduce_debug(yy.rule_id,
goto_state(yy.state_stack(yy.tos - 1),
get_lhs_rule(yy.rule_id)));
end if;
end if;
end loop;
end yyparse;
end parser;
|
reznikmm/matreshka | Ada | 3,785 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.Constants;
package body Matreshka.ODF_Attributes.Style.Font_Name_Asian is
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Font_Name_Asian_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Font_Name_Asian_Name;
end Get_Local_Name;
end Matreshka.ODF_Attributes.Style.Font_Name_Asian;
|
reznikmm/matreshka | Ada | 4,767 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Packageable_Elements;
with AMF.UML.Classifiers.Collections;
package AMF.Internals.UML_Classifiers is
type UML_Classifier_Proxy is
abstract new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy
and AMF.UML.Classifiers.UML_Classifier
with null record;
overriding function All_Parents
(Self : not null access constant UML_Classifier_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Operation Classifier::allParents.
--
-- The query allParents() gives all of the direct and indirect ancestors
-- of a generalized Classifier.
overriding function Parents
(Self : not null access constant UML_Classifier_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Operation Classifier::parents.
--
-- The query parents() gives all of the immediate ancestors of a
-- generalized Classifier.
overriding procedure Set_Is_Abstract
(Self : not null access UML_Classifier_Proxy;
To : Boolean);
-- Setter 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.
end AMF.Internals.UML_Classifiers;
|
Rodeo-McCabe/orka | Ada | 5,912 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Finalization;
with GL.Objects;
with GL.Types;
private with GL.Low_Level;
package GL.Debug is
pragma Preelaborate;
use GL.Types;
type Source is (OpenGL, Window_System, Shader_Compiler,
Third_Party, Application, Other);
type Message_Type is (Error, Deprecated_Behavior, Undefined_Behavior,
Portability, Performance, Other, Marker,
Push_Group, Pop_Group);
type Severity is (Notification, High, Medium, Low);
type Callback_Reference is access procedure
(From : Source;
Kind : Message_Type;
Level : Severity;
ID : UInt;
Message : String);
-- By default Debug_Output_Synchronous is disabled (see GL.Toggles).
-- The graphics driver may call the procedure from multiple tasks,
-- concurrently, and/or asynchronously after executing an OpenGL command.
procedure Set_Message_Callback (Callback : not null Callback_Reference);
-- Set a message callback in order to receive debug messages
--
-- Generated messages will no longer be appended to the message log,
-- but instead passed to the given callback. Initially, messages with
-- severity Low are not enabled.
procedure Disable_Message_Callback;
-- Clear current message callback and disable message output
--
-- After having called this procedure, generated messages will instead
-- be added to the message log.
procedure Set (From : Source; Kind : Message_Type; Level : Severity;
Enabled : Boolean);
-- Enable or disable specific messages or groups of messages
procedure Set (Level : Severity; Enabled : Boolean);
-- Enable messages that have the given severity
procedure Set (From : Source; Kind : Message_Type; Identifiers : UInt_Array;
Enabled : Boolean)
with Pre => Identifiers'Length > 0;
-- Enable or disable messages that have one of the given message IDs
procedure Insert_Message (From : Source; Kind : Message_Type; Level : Severity;
Identifier : UInt; Message : String);
-- Generate a new debug message
--
-- From must be either Third_Party or Application. Instantiate the
-- generic package Messages below if you need to print multiple
-- messages with the same source and message type.
--
-- The generated debug message will either be passed to the callback
-- (if there is one), or added to the message log (if not full).
type Active_Group is limited new Ada.Finalization.Limited_Controlled with private;
function Push_Debug_Group (From : Source; Identifier : UInt; Message : String)
return Active_Group'Class;
-- Add a new debug group to the stack
--
-- From must be either Third_Party or Application.
--
-- The value returned is of a controlled type. This means you must
-- assign it to some local variable, so that the debug group will be
-- automatically removed when the variable goes out of scope.
--
-- When the debug group is pushed onto the stack, a message
-- is generated with the type Push_Group and severity Notification.
--
-- Any further calls to Set will only apply to the active debug
-- group. The currently active debug group inherits the message
-- filtering from the previous active group.
--
-- When the debug group is popped off the stack, a message is
-- generated with type Pop_Group and severity Notification.
procedure Annotate (Object : GL.Objects.GL_Object'Class; Message : String);
-- Attach a label to the given object in order for the debug
-- output to describe the object
function Get_Label (Object : GL.Objects.GL_Object'Class) return String;
-- Return the label attached to the given object
function Max_Message_Length return Size
with Post => Max_Message_Length'Result >= 1;
generic
From : Source;
Kind : Message_Type;
ID : UInt := 0;
package Messages is
procedure Log (Level : Severity; Message : String);
-- Generate a new debug message
end Messages;
private
for Source use
(OpenGL => 16#8246#,
Window_System => 16#8247#,
Shader_Compiler => 16#8248#,
Third_Party => 16#8249#,
Application => 16#824A#,
Other => 16#824B#);
for Source'Size use Low_Level.Enum'Size;
for Message_Type use
(Error => 16#824C#,
Deprecated_Behavior => 16#824D#,
Undefined_Behavior => 16#824E#,
Portability => 16#824F#,
Performance => 16#8250#,
Other => 16#8251#,
Marker => 16#8268#,
Push_Group => 16#8269#,
Pop_Group => 16#826A#);
for Message_Type'Size use Low_Level.Enum'Size;
for Severity use
(Notification => 16#826B#,
High => 16#9146#,
Medium => 16#9147#,
Low => 16#9148#);
for Severity'Size use Low_Level.Enum'Size;
type Active_Group is limited new Ada.Finalization.Limited_Controlled with record
Finalized : Boolean;
end record;
overriding
procedure Finalize (Object : in out Active_Group);
end GL.Debug;
|
AdaCore/training_material | Ada | 5,863 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
package SDL_filesystem_h is
-- Simple DirectMedia Layer
-- Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
--
--*
-- * \file SDL_filesystem.h
-- *
-- * \brief Include file for filesystem SDL API functions
--
-- Set up for C function definitions, even when using C++
--*
-- * \brief Get the path where the application resides.
-- *
-- * Get the "base path". This is the directory where the application was run
-- * from, which is probably the installation directory, and may or may not
-- * be the process's current working directory.
-- *
-- * This returns an absolute path in UTF-8 encoding, and is guaranteed to
-- * end with a path separator ('\\' on Windows, '/' most other places).
-- *
-- * The pointer returned by this function is owned by you. Please call
-- * SDL_free() on the pointer when you are done with it, or it will be a
-- * memory leak. This is not necessarily a fast call, though, so you should
-- * call this once near startup and save the string if you need it.
-- *
-- * Some platforms can't determine the application's path, and on other
-- * platforms, this might be meaningless. In such cases, this function will
-- * return NULL.
-- *
-- * \return String of base dir in UTF-8 encoding, or NULL on error.
-- *
-- * \sa SDL_GetPrefPath
--
function SDL_GetBasePath return Interfaces.C.Strings.chars_ptr; -- ..\SDL2_tmp\SDL_filesystem.h:63
pragma Import (C, SDL_GetBasePath, "SDL_GetBasePath");
--*
-- * \brief Get the user-and-app-specific path where files can be written.
-- *
-- * Get the "pref dir". This is meant to be where users can write personal
-- * files (preferences and save games, etc) that are specific to your
-- * application. This directory is unique per user, per application.
-- *
-- * This function will decide the appropriate location in the native filesystem,
-- * create the directory if necessary, and return a string of the absolute
-- * path to the directory in UTF-8 encoding.
-- *
-- * On Windows, the string might look like:
-- * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
-- *
-- * On Linux, the string might look like:
-- * "/home/bob/.local/share/My Program Name/"
-- *
-- * On Mac OS X, the string might look like:
-- * "/Users/bob/Library/Application Support/My Program Name/"
-- *
-- * (etc.)
-- *
-- * You specify the name of your organization (if it's not a real organization,
-- * your name or an Internet domain you own might do) and the name of your
-- * application. These should be untranslated proper names.
-- *
-- * Both the org and app strings may become part of a directory name, so
-- * please follow these rules:
-- *
-- * - Try to use the same org string (including case-sensitivity) for
-- * all your applications that use this function.
-- * - Always use a unique app string for each one, and make sure it never
-- * changes for an app once you've decided on it.
-- * - Unicode characters are legal, as long as it's UTF-8 encoded, but...
-- * - ...only use letters, numbers, and spaces. Avoid punctuation like
-- * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
-- *
-- * This returns an absolute path in UTF-8 encoding, and is guaranteed to
-- * end with a path separator ('\\' on Windows, '/' most other places).
-- *
-- * The pointer returned by this function is owned by you. Please call
-- * SDL_free() on the pointer when you are done with it, or it will be a
-- * memory leak. This is not necessarily a fast call, though, so you should
-- * call this once near startup and save the string if you need it.
-- *
-- * You should assume the path returned by this function is the only safe
-- * place to write files (and that SDL_GetBasePath(), while it might be
-- * writable, or even the parent of the returned path, aren't where you
-- * should be writing things).
-- *
-- * Some platforms can't determine the pref path, and on other
-- * platforms, this might be meaningless. In such cases, this function will
-- * return NULL.
-- *
-- * \param org The name of your organization.
-- * \param app The name of your application.
-- * \return UTF-8 string of user dir in platform-dependent notation. NULL
-- * if there's a problem (creating directory failed, etc).
-- *
-- * \sa SDL_GetBasePath
--
function SDL_GetPrefPath (org : Interfaces.C.Strings.chars_ptr; app : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr; -- ..\SDL2_tmp\SDL_filesystem.h:126
pragma Import (C, SDL_GetPrefPath, "SDL_GetPrefPath");
-- Ends C function definitions when using C++
-- vi: set ts=4 sw=4 expandtab:
end SDL_filesystem_h;
|
Skyfold/aws_sorter | Ada | 398 | ads | package Job_Types_Package.Sort is
type Job_Record_Sort is new Job_Record with private;
function Receive_Job (Channel : GNAT.Sockets.Stream_Access)
return Job_Record_Sort;
function Process_Job (E : in Job_Record_Sort)
return Job_Record_Sort;
private
type Job_Record_Sort is new Job_Record with null record;
end Job_Types_Package.Sort;
|
sebsgit/textproc | Ada | 1,196 | ads | with Ada.Numerics.Float_Random;
with Ada.Containers.Vectors; use Ada.Containers;
with Ada.Numerics.Generic_Elementary_Functions;
package MathUtils is
pragma Elaborate_Body(MathUtils);
pragma Assertion_Policy (Pre => Check,
Post => Check,
Type_Invariant => Check);
package Float_Vec is new Ada.Containers.Vectors(Index_Type => Positive,
Element_Type => Float);
package F is new Ada.Numerics.Generic_Elementary_Functions(Float_Type => Float);
subtype Vector is Float_Vec.Vector;
function rand01 return Float;
function rand(min, max: Float) return Float
with Pre => min < max;
function mse(a, b: in Vector) return Float
with Pre => a.Length = b.Length and b.Length > 0;
function logLoss(target, predictions: in Vector) return Float
with Pre => target.Length = predictions.Length and target.Length > 0;
procedure multiply(vec: in out Vector; value: Float);
procedure softmax(vec: in out Vector)
with Pre => vec.Length /= 0;
procedure print(vec: in Vector);
private
gen: Ada.Numerics.Float_Random.Generator;
end MathUtils;
|
MinimSecure/unum-sdk | Ada | 792 | adb | -- Copyright 2008-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
function Ident (X : Integer) return Integer is
begin
return X;
end Ident;
|
stcarrez/ada-ado | Ada | 52,303 | adb | -----------------------------------------------------------------------
-- Regtests.Audits.Model -- Regtests.Audits.Model
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
pragma Warnings (On);
package body Regtests.Audits.Model is
pragma Style_Checks ("-mrIu");
pragma Warnings (Off, "formal parameter * is not referenced");
pragma Warnings (Off, "use clause for type *");
pragma Warnings (Off, "use clause for private type *");
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
function Audit_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Audit_Key;
function Audit_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Audit_Key;
function "=" (Left, Right : Audit_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Audit_Ref'Class;
Impl : out Audit_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Audit_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Audit_Ref) is
Impl : Audit_Access;
begin
Impl := new Audit_Impl;
Impl.Entity_Id := ADO.NO_IDENTIFIER;
Impl.Entity_Type := 0;
Impl.Old_Value.Is_Null := True;
Impl.New_Value.Is_Null := True;
Impl.Date := ADO.DEFAULT_TIME;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Audit
-- ----------------------------------------
procedure Set_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Audit_Ref)
return ADO.Identifier is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Entity_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 2, Impl.Entity_Id, Value);
end Set_Entity_Id;
function Get_Entity_Id (Object : in Audit_Ref)
return ADO.Identifier is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Id;
end Get_Entity_Id;
procedure Set_Entity_Type (Object : in out Audit_Ref;
Value : in ADO.Entity_Type) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 3, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Audit_Ref)
return ADO.Entity_Type is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 4, Impl.Old_Value, Value);
end Set_Old_Value;
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 4, Impl.Old_Value, Value);
end Set_Old_Value;
function Get_Old_Value (Object : in Audit_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Old_Value;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Old_Value;
function Get_Old_Value (Object : in Audit_Ref)
return ADO.Nullable_String is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Old_Value;
end Get_Old_Value;
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 5, Impl.New_Value, Value);
end Set_New_Value;
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 5, Impl.New_Value, Value);
end Set_New_Value;
function Get_New_Value (Object : in Audit_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_New_Value;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_New_Value;
function Get_New_Value (Object : in Audit_Ref)
return ADO.Nullable_String is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.New_Value;
end Get_New_Value;
procedure Set_Date (Object : in out Audit_Ref;
Value : in Ada.Calendar.Time) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 6, Impl.Date, Value);
end Set_Date;
function Get_Date (Object : in Audit_Ref)
return Ada.Calendar.Time is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Date;
end Get_Date;
-- Copy of the object.
procedure Copy (Object : in Audit_Ref;
Into : in out Audit_Ref) is
Result : Audit_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Audit_Access
:= new Audit_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Entity_Id := Impl.Entity_Id;
Copy.Entity_Type := Impl.Entity_Type;
Copy.Old_Value := Impl.Old_Value;
Copy.New_Value := Impl.New_Value;
Copy.Date := Impl.Date;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Audit_Access := new Audit_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Audit_Access := new Audit_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Audit_Access := new Audit_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Audit_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Audit_Impl) is
type Audit_Impl_Ptr is access all Audit_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Audit_Impl, Audit_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Audit_Impl_Ptr := Audit_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, AUDIT_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (AUDIT_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- entity_id
Value => Object.Entity_Id);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_1_NAME, -- old_value
Value => Object.Old_Value);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_1_NAME, -- new_value
Value => Object.New_Value);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- date
Value => Object.Date);
Object.Clear_Modified (6);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (AUDIT_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- entity_id
Value => Object.Entity_Id);
Query.Save_Field (Name => COL_2_1_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Save_Field (Name => COL_3_1_NAME, -- old_value
Value => Object.Old_Value);
Query.Save_Field (Name => COL_4_1_NAME, -- new_value
Value => Object.New_Value);
Query.Save_Field (Name => COL_5_1_NAME, -- date
Value => Object.Date);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (AUDIT_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Audit_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Audit_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Audit_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "entity_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Id));
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
elsif Name = "old_value" then
if Impl.Old_Value.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Old_Value.Value);
end if;
elsif Name = "new_value" then
if Impl.New_Value.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.New_Value.Value);
end if;
elsif Name = "date" then
return Util.Beans.Objects.Time.To_Object (Impl.Date);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Audit_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, AUDIT_DEF'Access);
begin
Stmt.Execute;
Audit_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Audit_Ref;
Impl : constant Audit_Access := new Audit_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Audit_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Entity_Id := Stmt.Get_Identifier (1);
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (2));
Object.Old_Value := Stmt.Get_Nullable_String (3);
Object.New_Value := Stmt.Get_Nullable_String (4);
Object.Date := Stmt.Get_Time (5);
ADO.Objects.Set_Created (Object);
end Load;
function Email_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => EMAIL_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Email_Key;
function Email_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => EMAIL_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Email_Key;
function "=" (Left, Right : Email_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Email_Ref'Class;
Impl : out Email_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Email_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Email_Ref) is
Impl : Email_Access;
begin
Impl := new Email_Impl;
Impl.Email.Is_Null := True;
Impl.Status.Is_Null := True;
Impl.Date.Is_Null := True;
Impl.Create_Date := ADO.DEFAULT_TIME;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Email
-- ----------------------------------------
procedure Set_Id (Object : in out Email_Ref;
Value : in ADO.Identifier) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Email_Ref)
return ADO.Identifier is
Impl : constant Email_Access
:= Email_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Email (Object : in out Email_Ref;
Value : in String) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_String (Impl.all, 2, Impl.Email, Value);
end Set_Email;
procedure Set_Email (Object : in out Email_Ref;
Value : in ADO.Nullable_String) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_String (Impl.all, 2, Impl.Email, Value);
end Set_Email;
function Get_Email (Object : in Email_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Email;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Email;
function Get_Email (Object : in Email_Ref)
return ADO.Nullable_String is
Impl : constant Email_Access
:= Email_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Email;
end Get_Email;
procedure Set_Status (Object : in out Email_Ref;
Value : in ADO.Nullable_Integer) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Integer (Impl.all, 3, Impl.Status, Value);
end Set_Status;
function Get_Status (Object : in Email_Ref)
return ADO.Nullable_Integer is
Impl : constant Email_Access
:= Email_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Status;
end Get_Status;
procedure Set_Date (Object : in out Email_Ref;
Value : in ADO.Nullable_Time) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Time (Impl.all, 4, Impl.Date, Value);
end Set_Date;
function Get_Date (Object : in Email_Ref)
return ADO.Nullable_Time is
Impl : constant Email_Access
:= Email_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Date;
end Get_Date;
procedure Set_Create_Date (Object : in out Email_Ref;
Value : in Ada.Calendar.Time) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Time (Impl.all, 5, Impl.Create_Date, Value);
end Set_Create_Date;
function Get_Create_Date (Object : in Email_Ref)
return Ada.Calendar.Time is
Impl : constant Email_Access
:= Email_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Create_Date;
end Get_Create_Date;
procedure Set_Info (Object : in out Email_Ref;
Value : in String) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_String (Impl.all, 6, Impl.Info, Value);
end Set_Info;
procedure Set_Info (Object : in out Email_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Email_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Unbounded_String (Impl.all, 6, Impl.Info, Value);
end Set_Info;
function Get_Info (Object : in Email_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Info);
end Get_Info;
function Get_Info (Object : in Email_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Email_Access
:= Email_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Info;
end Get_Info;
-- Copy of the object.
procedure Copy (Object : in Email_Ref;
Into : in out Email_Ref) is
Result : Email_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Email_Access
:= Email_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Email_Access
:= new Email_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Email := Impl.Email;
Copy.Status := Impl.Status;
Copy.Date := Impl.Date;
Copy.Create_Date := Impl.Create_Date;
Copy.Info := Impl.Info;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Email_Access := new Email_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Email_Access := new Email_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Email_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Email_Access := new Email_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Email_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Email_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Email_Impl) is
type Email_Impl_Ptr is access all Email_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Email_Impl, Email_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Email_Impl_Ptr := Email_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, EMAIL_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Email_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (EMAIL_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- user_email
Value => Object.Email);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- email_status
Value => Object.Status);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- email_date
Value => Object.Date);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_2_NAME, -- email_create_date
Value => Object.Create_Date);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_2_NAME, -- email_info
Value => Object.Info);
Object.Clear_Modified (6);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
ADO.Audits.Save (Object, Session);
end;
end if;
end Save;
overriding
procedure Create (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (EMAIL_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- user_email
Value => Object.Email);
Query.Save_Field (Name => COL_2_2_NAME, -- email_status
Value => Object.Status);
Query.Save_Field (Name => COL_3_2_NAME, -- email_date
Value => Object.Date);
Query.Save_Field (Name => COL_4_2_NAME, -- email_create_date
Value => Object.Create_Date);
Query.Save_Field (Name => COL_5_2_NAME, -- email_info
Value => Object.Info);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
ADO.Audits.Save (Object, Session);
end Create;
overriding
procedure Delete (Object : in out Email_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (EMAIL_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Email_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Email_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Email_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "email" then
if Impl.Email.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Email.Value);
end if;
elsif Name = "status" then
if Impl.Status.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Status.Value));
end if;
elsif Name = "date" then
if Impl.Date.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.Time.To_Object (Impl.Date.Value);
end if;
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (Impl.Create_Date);
elsif Name = "info" then
return Util.Beans.Objects.To_Object (Impl.Info);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Email_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Email := Stmt.Get_Nullable_String (1);
Object.Status := Stmt.Get_Nullable_Integer (2);
Object.Date := Stmt.Get_Nullable_Time (3);
Object.Create_Date := Stmt.Get_Time (4);
Object.Info := Stmt.Get_Unbounded_String (5);
ADO.Objects.Set_Created (Object);
end Load;
function Property_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_STRING,
Of_Class => PROPERTY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Property_Key;
function Property_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_STRING,
Of_Class => PROPERTY_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Property_Key;
function "=" (Left, Right : Property_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Property_Ref'Class;
Impl : out Property_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Property_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Property_Ref) is
Impl : Property_Access;
begin
Impl := new Property_Impl;
Impl.Value.Is_Null := True;
Impl.Float_Value := 0.0;
Impl.Double_Value := 0.0;
Impl.Kind := 0;
Impl.Optional_Kind.Is_Null := True;
Impl.Object_Id := ADO.NO_IDENTIFIER;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Property
-- ----------------------------------------
procedure Set_Id (Object : in out Property_Ref;
Value : in String) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
procedure Set_Id (Object : in out Property_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Property_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Id);
end Get_Id;
function Get_Id (Object : in Property_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Value (Object : in out Property_Ref;
Value : in ADO.Nullable_Integer) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Integer (Impl.all, 2, Impl.Value, Value);
end Set_Value;
function Get_Value (Object : in Property_Ref)
return ADO.Nullable_Integer is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Value;
end Get_Value;
procedure Set_Float_Value (Object : in out Property_Ref;
Value : in Float) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Float (Impl.all, 3, Impl.Float_Value, Value);
end Set_Float_Value;
function Get_Float_Value (Object : in Property_Ref)
return Float is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Float_Value;
end Get_Float_Value;
procedure Set_Double_Value (Object : in out Property_Ref;
Value : in Long_Float) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Long_Float (Impl.all, 4, Impl.Double_Value, Value);
end Set_Double_Value;
function Get_Double_Value (Object : in Property_Ref)
return Long_Float is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Double_Value;
end Get_Double_Value;
procedure Set_Kind (Object : in out Property_Ref;
Value : in ADO.Entity_Type) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Entity_Type (Impl.all, 5, Impl.Kind, Value);
end Set_Kind;
function Get_Kind (Object : in Property_Ref)
return ADO.Entity_Type is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Kind;
end Get_Kind;
procedure Set_Optional_Kind (Object : in out Property_Ref;
Value : in ADO.Nullable_Entity_Type) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Entity_Type (Impl.all, 6, Impl.Optional_Kind, Value);
end Set_Optional_Kind;
function Get_Optional_Kind (Object : in Property_Ref)
return ADO.Nullable_Entity_Type is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Optional_Kind;
end Get_Optional_Kind;
procedure Set_Object_Id (Object : in out Property_Ref;
Value : in ADO.Identifier) is
Impl : Property_Access;
begin
Set_Field (Object, Impl);
ADO.Audits.Set_Field_Identifier (Impl.all, 7, Impl.Object_Id, Value);
end Set_Object_Id;
function Get_Object_Id (Object : in Property_Ref)
return ADO.Identifier is
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Object_Id;
end Get_Object_Id;
-- Copy of the object.
procedure Copy (Object : in Property_Ref;
Into : in out Property_Ref) is
Result : Property_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Property_Access
:= Property_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Property_Access
:= new Property_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.all.Set_Key (Impl.all.Get_Key);
Copy.Value := Impl.Value;
Copy.Float_Value := Impl.Float_Value;
Copy.Double_Value := Impl.Double_Value;
Copy.Kind := Impl.Kind;
Copy.Optional_Kind := Impl.Optional_Kind;
Copy.Object_Id := Impl.Object_Id;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Property_Access := new Property_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : constant Property_Access := new Property_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Property_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String;
Found : out Boolean) is
Impl : constant Property_Access := new Property_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Property_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Property_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Property_Impl) is
type Property_Impl_Ptr is access all Property_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Property_Impl, Property_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Property_Impl_Ptr := Property_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, PROPERTY_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Property_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant Ada.Strings.Unbounded.Unbounded_String := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (PROPERTY_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_3_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_3_NAME, -- user_email
Value => Object.Value);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_3_NAME, -- float_value
Value => Object.Float_Value);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_3_NAME, -- double_value
Value => Object.Double_Value);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_3_NAME, -- kind
Value => Object.Kind);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_3_NAME, -- optional_kind
Value => Object.Optional_Kind);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_3_NAME, -- object_id
Value => Object.Object_Id);
Object.Clear_Modified (7);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
ADO.Audits.Save (Object, Session);
end;
end if;
end Save;
overriding
procedure Create (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (PROPERTY_DEF'Access);
Result : Integer;
begin
Query.Save_Field (Name => COL_0_3_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_3_NAME, -- user_email
Value => Object.Value);
Query.Save_Field (Name => COL_2_3_NAME, -- float_value
Value => Object.Float_Value);
Query.Save_Field (Name => COL_3_3_NAME, -- double_value
Value => Object.Double_Value);
Query.Save_Field (Name => COL_4_3_NAME, -- kind
Value => Object.Kind);
Query.Save_Field (Name => COL_5_3_NAME, -- optional_kind
Value => Object.Optional_Kind);
Query.Save_Field (Name => COL_6_3_NAME, -- object_id
Value => Object.Object_Id);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
ADO.Audits.Save (Object, Session);
end Create;
overriding
procedure Delete (Object : in out Property_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (PROPERTY_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Property_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Property_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Property_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "value" then
if Impl.Value.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Value.Value));
end if;
elsif Name = "float_value" then
return Util.Beans.Objects.To_Object (Impl.Float_Value);
elsif Name = "double_value" then
return Util.Beans.Objects.To_Object (Impl.Double_Value);
elsif Name = "kind" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Kind));
elsif Name = "optional_kind" then
if Impl.Optional_Kind.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Optional_Kind.Value));
end if;
elsif Name = "object_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Object_Id));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Property_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Unbounded_String (0));
Object.Value := Stmt.Get_Nullable_Integer (1);
Object.Float_Value := Stmt.Get_Float (2);
Object.Double_Value := Stmt.Get_Long_Float (3);
Object.Kind := ADO.Entity_Type (Stmt.Get_Integer (4));
Object.Optional_Kind := Stmt.Get_Nullable_Entity_Type (5);
Object.Object_Id := Stmt.Get_Identifier (6);
ADO.Objects.Set_Created (Object);
end Load;
end Regtests.Audits.Model;
|
AdaDoom3/wayland_ada_binding | Ada | 4,130 | adb | ------------------------------------------------------------------------------
-- Copyright (C) 2016, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
package body Conts.Functional.Maps with SPARK_Mode => Off is
use Key_Containers;
use Element_Containers;
pragma Assertion_Policy
(Pre => Suppressible, Ghost => Suppressible, Post => Ignore);
---------
-- "=" --
---------
function "=" (M1, M2 : Map) return Boolean is
(M1.Keys <= M2.Keys and M2 <= M1);
----------
-- "<=" --
----------
function "<=" (M1, M2 : Map) return Boolean is
I2 : Count_Type;
begin
for I1 in 1 .. Length (M1.Keys) loop
I2 := Find (M2.Keys, Get (M1.Keys, I1));
if I2 = 0
or else Get (M2.Elements, I2) /= Get (M1.Elements, I1)
then
return False;
end if;
end loop;
return True;
end "<=";
---------
-- Add --
---------
function Add (M : Map; K : Key_Type; E : Element_Type) return Map is
(Keys => Add (M.Keys, K),
Elements => Add (M.Elements, E));
---------
-- Get --
---------
function Get (M : Map; K : Key_Type) return Element_Type is
(Get (M.Elements, Find (M.Keys, K)));
------------
-- Is_Add --
------------
function Is_Add
(M : Map; K : Key_Type; E : Element_Type; Result : Map) return Boolean
is
(not Mem (M, K)
and then Mem (Result, K) and then Get (Result, K) = E
and then (for all K of M => Mem (Result, K)
and then Get (Result, K) = Get (M, K))
and then (for all KK of Result => KK = K or Mem (M, KK)));
--------------
-- Is_Empty --
--------------
function Is_Empty (M : Map) return Boolean is
(Length (M.Keys) = 0);
------------
-- Is_Set --
------------
function Is_Set
(M : Map; K : Key_Type; E : Element_Type; Result : Map) return Boolean
is
(Mem (M, K)
and then Mem (Result, K)
and then Get (Result, K) = E
and then (for all KK of M => Mem (Result, KK)
and then
(if K /= KK
then Get (Result, KK) = Get (M, KK)))
and then (for all K of Result => Mem (M, K)));
------------
-- Length --
------------
function Length (M : Map) return Count_Type is (Length (M.Elements));
---------
-- Mem --
---------
function Mem (M : Map; K : Key_Type) return Boolean is
(Find (M.Keys, K) > 0);
---------
-- Set --
---------
function Set (M : Map; K : Key_Type; E : Element_Type) return Map is
(Keys => M.Keys, Elements => Set (M.Elements, Find (M.Keys, K), E));
end Conts.Functional.Maps;
|
Fabien-Chouteau/samd51-hal | Ada | 7,277 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020-2021, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System;
with System.Machine_Code; use System.Machine_Code;
with SAM_SVD.QSPI; use SAM_SVD.QSPI;
package body SAM.QSPI is
QSPI_Region : constant := 16#04000000#;
Empty : UInt8_Array (1 .. 0);
------------
-- Enable --
------------
procedure Enable is
begin
QSPI_Periph.CTRLA.ENABLE := True;
end Enable;
-----------
-- Reset --
-----------
procedure Reset is
begin
QSPI_Periph.CTRLA.SWRST := True;
end Reset;
---------------
-- Configure --
---------------
procedure Configure (Baud : UInt8) is
begin
QSPI_Periph.BAUD.BAUD := Baud;
QSPI_Periph.CTRLB.MODE := MEMORY;
QSPI_Periph.CTRLB.DATALEN := Val_8BITS;
QSPI_Periph.CTRLB.CSMODE := LASTXFER;
end Configure;
---------
-- Run --
---------
procedure Run (Command : UInt8) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := READ;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, 0, Empty);
end Run;
----------
-- Read --
----------
procedure Read (Command : UInt8; Data : out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := READ;
Iframe.DATAEN := True;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, 0, Data);
end Read;
-----------
-- Write --
-----------
procedure Write (Command : UInt8; Data : in out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := WRITE;
Iframe.DATAEN := Data'Length /= 0;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, 0, Data);
end Write;
-----------
-- Erase --
-----------
procedure Erase (Command : UInt8; Addr : UInt32) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := SINGLE_BIT_SPI;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := WRITE;
Iframe.ADDREN := True;
Iframe.INSTREN := True;
Run_Instruction (Command, Iframe, Addr, Empty);
end Erase;
-----------------
-- Read_Memory --
-----------------
procedure Read_Memory (Addr : UInt32; Data : out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := QUAD_OUTPUT;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := READMEMORY;
Iframe.ADDREN := True;
Iframe.DATAEN := True;
Iframe.INSTREN := True;
Iframe.DUMMYLEN := 8;
Run_Instruction (16#6B#, Iframe, Addr, Data);
end Read_Memory;
------------------
-- Write_Memory --
------------------
procedure Write_Memory (Addr : UInt32; Data : in out UInt8_Array) is
Iframe : QSPI_INSTRFRAME_Register := (others => <>);
begin
Iframe.WIDTH := QUAD_OUTPUT;
Iframe.ADDRLEN := Val_24BITS;
Iframe.TFRTYPE := WRITEMEMORY;
Iframe.ADDREN := True;
Iframe.DATAEN := True;
Iframe.INSTREN := True;
Run_Instruction (16#32#, Iframe, Addr, Data);
end Write_Memory;
---------------------
-- Run_Instruction --
---------------------
procedure Run_Instruction
(Command : UInt8;
Iframe : SAM_SVD.QSPI.QSPI_INSTRFRAME_Register;
Addr : UInt32;
Buffer : in out UInt8_Array)
is
Unused : QSPI_INSTRFRAME_Register;
begin
-- WTF?!?
-- if Command in 16#20# | 16#D8# then
-- QSPI_Periph.INSTRADDR := Addr;
-- end if;
QSPI_Periph.INSTRCTRL.INSTR := Command;
QSPI_Periph.INSTRADDR := Addr;
QSPI_Periph.INSTRFRAME := Iframe;
-- Dummy read of INSTRFRAME needed to synchronize.
-- See Instruction Transmission Flow Diagram, figure 37.9, page 995
-- and Example 4, page 998, section 37.6.8.5.
Unused := QSPI_Periph.INSTRFRAME;
if Buffer'Length /= 0 then
declare
Mem : UInt8_Array (Buffer'First .. Buffer'Last)
with Address => System'To_Address (QSPI_Region + Addr);
begin
case Iframe.TFRTYPE is
when READ | READMEMORY =>
Buffer := Mem;
when WRITE | WRITEMEMORY =>
Mem := Buffer;
end case;
end;
end if;
Asm ("dsb" & ASCII.LF & ASCII.HT &
"isb",
Volatile => True);
QSPI_Periph.CTRLA := (SWRST => False, ENABLE => True, LASTXFER => True,
others => <>);
while not QSPI_Periph.INTFLAG.INSTREND loop
null;
end loop;
QSPI_Periph.INTFLAG.INSTREND := True;
end Run_Instruction;
end SAM.QSPI;
|
iyan22/AprendeAda | Ada | 826 | adb |
with ada.text_io, ada.integer_text_io;
use ada.text_io, ada.integer_text_io;
with factorial;
procedure prueba_factorial is
n1:integer:=0;
begin
-- Caso de prueba 1:
n1:=4;
put("El resultado deberia de ser: 24");
new_line;
put("Y tu programa dice que:");
put(factorial(n1));
new_line;
-- Caso de prueba 2:
n1:=0;
put("El resultado deberia de ser: 1");
new_line;
put("Y tu programa dice que:");
put(factorial(n1));
new_line;
-- Caso de prueba 3:
n1:=6;
put("El resultado deberia de ser: 720");
new_line;
put("Y tu programa dice que:");
put(factorial(n1));
new_line;
-- Caso de prueba 4:
n1:=1;
put("El resultado deberia de ser: 1");
new_line;
put("Y tu programa dice que:");
put(factorial(n1));
new_line;
end prueba_factorial;
|
faelys/natools | Ada | 3,354 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2013-2015, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Encodings;
package body Natools.S_Expressions.Printers is
overriding procedure Open_List (Output : in out Canonical) is
begin
Output.Stream.Write ((0 => Encodings.List_Begin));
end Open_List;
overriding procedure Append_Atom (Output : in out Canonical;
Data : in Atom)
is
Length_Image : constant String := Count'Image (Data'Length);
Length_Data : Atom (0 .. Length_Image'Length);
begin
Length_Data (0 .. Length_Image'Length - 1) := To_Atom (Length_Image);
Length_Data (Length_Data'Last) := Encodings.Verbatim_Begin;
Output.Stream.Write (Length_Data (1 .. Length_Data'Last));
Output.Stream.Write (Data);
end Append_Atom;
overriding procedure Close_List (Output : in out Canonical) is
begin
Output.Stream.Write ((0 => Encodings.List_End));
end Close_List;
procedure Append_String (Output : in out Printer'Class; Data : in String) is
begin
Append_Atom (Output, To_Atom (Data));
end Append_String;
procedure Transfer
(Source : in out Descriptor'Class;
Target : in out Printer'Class;
Check_Level : in Boolean := False)
is
procedure Print_Atom (Data : in Atom);
procedure Print_Atom (Data : in Atom) is
begin
Target.Append_Atom (Data);
end Print_Atom;
Event : Events.Event := Source.Current_Event;
Starting_Level : Natural := Source.Current_Level;
begin
if Events."=" (Event, Events.Open_List) then
Starting_Level := Starting_Level - 1;
end if;
loop
case Event is
when Events.Error | Events.End_Of_Input =>
exit;
when Events.Open_List =>
Target.Open_List;
when Events.Close_List =>
exit when Check_Level
and then Source.Current_Level < Starting_Level;
Target.Close_List;
when Events.Add_Atom =>
Source.Query_Atom (Print_Atom'Access);
end case;
Source.Next (Event);
end loop;
end Transfer;
end Natools.S_Expressions.Printers;
|
FrankBuss/Ada_Synth | Ada | 397 | adb | with Interfaces; use Interfaces;
with Ada.Text_IO; use Ada.Text_IO;
with Ringbuffers;
procedure Test_Ringbuffer is
package FIFO_Package is new Ringbuffers (256, Unsigned_8);
subtype FIFO is FIFO_Package.Ringbuffer;
Test : FIFO;
begin
Test.Write (1);
Test.Write (7);
while not Test.Is_Empty loop
Put_Line (Unsigned_8'Image (Test.Read));
end loop;
end Test_Ringbuffer;
|
jwarwick/aoc_2019_ada | Ada | 330 | adb | -- AOC, Day 4
with Ada.Text_IO; use Ada.Text_IO;
with Password;
procedure main is
first : constant Natural := 134564;
last : constant Natural := 585159;
begin
put_line("Part 1: " & Positive'Image(Password.part1_count(first, last)));
put_line("Part 2: " & Positive'Image(Password.part2_count(first, last)));
end main;
|
msrLi/portingSources | Ada | 956 | adb | -- Copyright 2012-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
type Color is (Black, Red, Green, Blue, White);
type Full_Table is array (Color) of Integer;
Full : Full_Table := (144, 233, 377, 610, 987);
begin
Do_Nothing (Full'Address); -- STOP
end Foo;
|
mirror/ncurses | Ada | 3,504 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1999-2003,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.13 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is
pragma Preelaborate
(Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric);
type AlphaNumeric_Field is new Field_Type
with record
Minimum_Field_Width : Natural := 0;
end record;
procedure Set_Field_Type (Fld : Field;
Typ : AlphaNumeric_Field);
pragma Inline (Set_Field_Type);
end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric;
|
reznikmm/matreshka | Ada | 4,049 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Escape_Direction_Attributes;
package Matreshka.ODF_Draw.Escape_Direction_Attributes is
type Draw_Escape_Direction_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Escape_Direction_Attributes.ODF_Draw_Escape_Direction_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Escape_Direction_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Escape_Direction_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Escape_Direction_Attributes;
|
HeisenbugLtd/flac-ada | Ada | 6,599 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. ([email protected])
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
-- FLAC/Ada
--
-- Reader
--
-- Reads FLAC files.
------------------------------------------------------------------------------
private with Ada.Streams.Stream_IO;
with Flac.Types;
with Interfaces;
private with SPARK_Stream_IO;
package Flac.Reader with
SPARK_Mode => On
is
type File_Handle is limited private
with
Default_Initial_Condition =>
(not Is_Open (File_Handle) and
Get_Error (File_Handle) = No_Error);
---------------------------------------------------------------------------
-- Open
---------------------------------------------------------------------------
procedure Open (File : in String;
Flac_File : in out File_Handle) with
Pre => not Is_Open (Handle => Flac_File),
Post => (case Get_Error (Flac_File).Main is
when None =>
Is_Open (Handle => Flac_File),
when Open_Error | Not_A_Flac_File =>
not Is_Open (Handle => Flac_File));
-- FIXME: Properties need to be mentioned in the post condition.
-- Opens a given file in FLAC format. Errors will be communicated via the
-- returned File_Type.
---------------------------------------------------------------------------
-- Close
---------------------------------------------------------------------------
procedure Close (Flac_File : in out File_Handle)
with
Pre => Is_Open (Handle => Flac_File),
Post => not Is_Open (Handle => Flac_File);
---------------------------------------------------------------------------
-- Is_Open
---------------------------------------------------------------------------
function Is_Open (Handle : in File_Handle) return Boolean;
---------------------------------------------------------------------------
-- Get_Error
---------------------------------------------------------------------------
function Get_Error (Handle : in File_Handle) return Error_Type
with
Depends => (Get_Error'Result => Handle);
---------------------------------------------------------------------------
-- Num_Channels
---------------------------------------------------------------------------
function Num_Channels (Handle : in File_Handle) return Types.Channel_Count
with
Depends => (Num_Channels'Result => Handle),
Pre => Is_Open (Handle => Handle);
---------------------------------------------------------------------------
-- Bits_Per_Sample
---------------------------------------------------------------------------
function Bits_Per_Sample
(Handle : in File_Handle) return Types.Bits_Per_Sample
with
Depends => (Bits_Per_Sample'Result => Handle),
Pre => Is_Open (Handle => Handle);
---------------------------------------------------------------------------
-- Sample_Rate
---------------------------------------------------------------------------
function Sample_Rate (Handle : in File_Handle) return Types.Sample_Rate
with
Depends => (Sample_Rate'Result => Handle),
Pre => Is_Open (Handle => Handle);
---------------------------------------------------------------------------
-- Num_Samples
---------------------------------------------------------------------------
function Num_Samples (Handle : in File_Handle) return Types.Sample_Count
with
Depends => (Num_Samples'Result => Handle),
Pre => Is_Open (Handle => Handle);
private
type Stream_Properties is
record
Num_Channels : Types.Channel_Count := 1; -- 1 .. 8
Bits_Per_Sample : Types.Bits_Per_Sample := 4; -- 4 .. 32
Sample_Rate : Types.Sample_Rate := 1; -- 1 .. 655350
Num_Samples : Types.Sample_Count := 0; -- actually 36 bits
end record;
type File_Handle is
record
File : Ada.Streams.Stream_IO.File_Type;
-- The associated file.
Error : Error_Type := No_Error;
Open : Boolean := False;
-- Status information.
Properties : Stream_Properties;
-- FLAC properties read from the file.
end record;
---------------------------------------------------------------------------
-- Is_Open
---------------------------------------------------------------------------
function Is_Open (Handle : in File_Handle) return Boolean is
(Handle.Open and then SPARK_Stream_IO.Is_Open (Handle.File));
---------------------------------------------------------------------------
-- Get_Error
---------------------------------------------------------------------------
function Get_Error (Handle : in File_Handle) return Error_Type is
(Handle.Error);
---------------------------------------------------------------------------
-- Num_Channels
---------------------------------------------------------------------------
function Num_Channels
(Handle : in File_Handle) return Types.Channel_Count
is
(Handle.Properties.Num_Channels);
---------------------------------------------------------------------------
-- Bits_Per_Sample
---------------------------------------------------------------------------
function Bits_Per_Sample
(Handle : in File_Handle) return Types.Bits_Per_Sample
is
(Handle.Properties.Bits_Per_Sample);
---------------------------------------------------------------------------
-- Sample_Rate
---------------------------------------------------------------------------
function Sample_Rate (Handle : in File_Handle) return Types.Sample_Rate is
(Types.Sample_Rate (Handle.Properties.Sample_Rate));
---------------------------------------------------------------------------
-- Num_Samples
---------------------------------------------------------------------------
function Num_Samples (Handle : in File_Handle) return Types.Sample_Count
is
(Handle.Properties.Num_Samples);
end Flac.Reader;
|
zhmu/ananas | Ada | 21,508 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P A R . T C H K --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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. --
-- --
------------------------------------------------------------------------------
-- Token scan routines
-- Error recovery: none of the T_xxx or TF_xxx routines raise Error_Resync
separate (Par)
package body Tchk is
type Position is (SC, BC, AP);
-- Specify position of error message (see Error_Msg_SC/BC/AP)
-----------------------
-- Local Subprograms --
-----------------------
procedure Check_Token (T : Token_Type; P : Position);
pragma Inline (Check_Token);
-- Called by T_xx routines to check for reserved keyword token. P is the
-- position of the error message if the token is missing (see Wrong_Token)
procedure Wrong_Token (T : Token_Type; P : Position);
-- Called when scanning a reserved keyword when the keyword is not present.
-- T is the token type for the keyword, and P indicates the position to be
-- used to place a message relative to the current token if the keyword is
-- not located nearby.
-----------------
-- Check_Token --
-----------------
procedure Check_Token (T : Token_Type; P : Position) is
begin
if Token = T then
Scan;
return;
else
Wrong_Token (T, P);
end if;
end Check_Token;
-------------
-- T_Abort --
-------------
procedure T_Abort is
begin
Check_Token (Tok_Abort, SC);
end T_Abort;
-------------
-- T_Arrow --
-------------
procedure T_Arrow is
begin
if Token = Tok_Arrow then
Scan;
-- A little recovery helper, accept then in place of =>
elsif Token = Tok_Then then
Error_Msg_BC -- CODEFIX
("|THEN should be ""='>""");
Scan; -- past THEN used in place of =>
elsif Token = Tok_Colon_Equal then
Error_Msg_SC -- CODEFIX
("|"":="" should be ""='>""");
Scan; -- past := used in place of =>
else
Error_Msg_AP -- CODEFIX
("missing ""='>""");
end if;
end T_Arrow;
----------
-- T_At --
----------
procedure T_At is
begin
Check_Token (Tok_At, SC);
end T_At;
------------
-- T_Body --
------------
procedure T_Body is
begin
Check_Token (Tok_Body, BC);
end T_Body;
-----------
-- T_Box --
-----------
procedure T_Box is
begin
if Token = Tok_Box then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing ""'<'>""");
end if;
end T_Box;
-------------
-- T_Colon --
-------------
procedure T_Colon is
begin
if Token = Tok_Colon then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing "":""");
end if;
end T_Colon;
-------------------
-- T_Colon_Equal --
-------------------
procedure T_Colon_Equal is
begin
if Token = Tok_Colon_Equal then
Scan;
elsif Token = Tok_Equal then
Error_Msg_SC -- CODEFIX
("|""="" should be "":=""");
Scan;
elsif Token = Tok_Colon then
Error_Msg_SC -- CODEFIX
("|"":"" should be "":=""");
Scan;
elsif Token = Tok_Is then
Error_Msg_SC -- CODEFIX
("|IS should be "":=""");
Scan;
else
Error_Msg_AP -- CODEFIX
("missing "":=""");
end if;
end T_Colon_Equal;
-------------
-- T_Comma --
-------------
procedure T_Comma is
begin
if Token = Tok_Comma then
Scan;
else
if Token = Tok_Pragma then
P_Pragmas_Misplaced;
end if;
if Token = Tok_Comma then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing "",""");
end if;
end if;
if Token = Tok_Pragma then
P_Pragmas_Misplaced;
end if;
end T_Comma;
---------------
-- T_Dot_Dot --
---------------
procedure T_Dot_Dot is
begin
if Token = Tok_Dot_Dot then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing ""..""");
end if;
end T_Dot_Dot;
-----------
-- T_For --
-----------
procedure T_For is
begin
Check_Token (Tok_For, AP);
end T_For;
-----------------------
-- T_Greater_Greater --
-----------------------
procedure T_Greater_Greater is
begin
if Token = Tok_Greater_Greater then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing ""'>'>""");
end if;
end T_Greater_Greater;
------------------
-- T_Identifier --
------------------
procedure T_Identifier is
begin
if Token = Tok_Identifier then
Scan;
elsif Token in Token_Class_Literal then
Error_Msg_SC ("identifier expected");
Scan;
else
Error_Msg_AP ("identifier expected");
end if;
end T_Identifier;
----------
-- T_In --
----------
procedure T_In is
begin
Check_Token (Tok_In, AP);
end T_In;
----------
-- T_Is --
----------
procedure T_Is is
begin
Ignore (Tok_Semicolon);
-- If we have IS scan past it
if Token = Tok_Is then
Scan;
-- And ignore any following semicolons
Ignore (Tok_Semicolon);
-- Allow OF, => or = to substitute for IS with complaint
elsif Token = Tok_Arrow then
Error_Msg_SC -- CODEFIX
("|""=>"" should be IS");
Scan; -- past =>
elsif Token = Tok_Of then
Error_Msg_SC -- CODEFIX
("|OF should be IS");
Scan; -- past OF
elsif Token = Tok_Equal then
Error_Msg_SC -- CODEFIX
("|""="" should be IS");
Scan; -- past =
else
Wrong_Token (Tok_Is, AP);
end if;
-- Ignore extra IS keywords
while Token = Tok_Is loop
Error_Msg_SC -- CODEFIX
("|extra IS ignored");
Scan;
end loop;
end T_Is;
------------------
-- T_Left_Paren --
------------------
procedure T_Left_Paren is
begin
if Token = Tok_Left_Paren then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing ""(""");
end if;
end T_Left_Paren;
------------
-- T_Loop --
------------
procedure T_Loop is
begin
if Token = Tok_Do then
Error_Msg_SC -- CODEFIX
("LOOP expected");
Scan;
else
Check_Token (Tok_Loop, AP);
end if;
end T_Loop;
-----------
-- T_Mod --
-----------
procedure T_Mod is
begin
Check_Token (Tok_Mod, AP);
end T_Mod;
-----------
-- T_New --
-----------
procedure T_New is
begin
Check_Token (Tok_New, AP);
end T_New;
----------
-- T_Of --
----------
procedure T_Of is
begin
Check_Token (Tok_Of, AP);
end T_Of;
----------
-- T_Or --
----------
procedure T_Or is
begin
Check_Token (Tok_Or, AP);
end T_Or;
---------------
-- T_Private --
---------------
procedure T_Private is
begin
Check_Token (Tok_Private, SC);
end T_Private;
-------------
-- T_Range --
-------------
procedure T_Range is
begin
Check_Token (Tok_Range, AP);
end T_Range;
--------------
-- T_Record --
--------------
procedure T_Record is
begin
Check_Token (Tok_Record, AP);
end T_Record;
---------------------
-- T_Right_Bracket --
---------------------
procedure T_Right_Bracket is
begin
if Token = Tok_Right_Bracket then
Scan;
else
Error_Msg_AP -- CODEFIX
("|missing ""']'""");
end if;
end T_Right_Bracket;
-------------------
-- T_Right_Paren --
-------------------
procedure T_Right_Paren is
begin
if Token = Tok_Right_Paren then
Scan;
else
Error_Msg_AP -- CODEFIX
("|missing "")""");
end if;
end T_Right_Paren;
-----------------
-- T_Semicolon --
-----------------
procedure T_Semicolon is
begin
if Token = Tok_Semicolon then
Scan;
if Token = Tok_Semicolon then
Error_Msg_SC -- CODEFIX
("|extra "";"" ignored");
Scan;
end if;
return;
elsif Token = Tok_Colon then
Error_Msg_SC -- CODEFIX
("|"":"" should be "";""");
Scan;
return;
elsif Token = Tok_Comma then
Error_Msg_SC -- CODEFIX
("|"","" should be "";""");
Scan;
return;
elsif Token = Tok_Dot then
Error_Msg_SC -- CODEFIX
("|""."" should be "";""");
Scan;
return;
-- An interesting little case. If the previous token is a semicolon,
-- then there is no way that we can legitimately need another semicolon.
-- This could only arise in an situation where an error has already been
-- signalled. By simply ignoring the request for a semicolon in this
-- case, we avoid some spurious missing semicolon messages.
elsif Prev_Token = Tok_Semicolon then
return;
-- If the current token is | then this is a reasonable place to suggest
-- the possibility of a "C" confusion.
elsif Token = Tok_Vertical_Bar then
Error_Msg_SC -- CODEFIX
("unexpected occurrence of ""'|"", did you mean OR'?");
Resync_Past_Semicolon;
return;
-- Deal with pragma. If pragma is not at start of line, it is considered
-- misplaced otherwise we treat it as a normal missing semicolon case.
elsif Token = Tok_Pragma and then not Token_Is_At_Start_Of_Line then
P_Pragmas_Misplaced;
if Token = Tok_Semicolon then
Scan;
return;
end if;
end if;
-- If none of those tests return, we really have a missing semicolon
Error_Msg_AP -- CODEFIX
("|missing "";""");
return;
end T_Semicolon;
------------
-- T_Then --
------------
procedure T_Then is
begin
Check_Token (Tok_Then, AP);
end T_Then;
------------
-- T_Type --
------------
procedure T_Type is
begin
Check_Token (Tok_Type, BC);
end T_Type;
-----------
-- T_Use --
-----------
procedure T_Use is
begin
Check_Token (Tok_Use, SC);
end T_Use;
------------
-- T_When --
------------
procedure T_When is
begin
Check_Token (Tok_When, SC);
end T_When;
------------
-- T_With --
------------
procedure T_With is
begin
Check_Token (Tok_With, BC);
end T_With;
--------------
-- TF_Arrow --
--------------
procedure TF_Arrow is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Arrow then
Scan; -- skip arrow and we are done
elsif Token = Tok_Colon_Equal then
T_Arrow; -- Let T_Arrow give the message
else
T_Arrow; -- give missing arrow message
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Arrow then
Scan; -- past arrow
return;
end if;
end loop;
end if;
end TF_Arrow;
-----------
-- TF_Is --
-----------
procedure TF_Is is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Is then
T_Is; -- past IS and we are done
-- Allow OF or => or = in place of IS (with error message)
elsif Token = Tok_Of
or else Token = Tok_Arrow
or else Token = Tok_Equal
then
T_Is; -- give missing IS message and skip bad token
else
T_Is; -- give missing IS message
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Is
or else Token = Tok_Of
or else Token = Tok_Arrow
then
Scan; -- past IS or OF or =>
return;
end if;
end loop;
end if;
end TF_Is;
-------------
-- TF_Loop --
-------------
procedure TF_Loop is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Loop then
Scan; -- past LOOP and we are done
-- Allow DO or THEN in place of LOOP
elsif Token = Tok_Then or else Token = Tok_Do then
T_Loop; -- give missing LOOP message
else
T_Loop; -- give missing LOOP message
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Loop or else Token = Tok_Then then
Scan; -- past loop or then (message already generated)
return;
end if;
end loop;
end if;
end TF_Loop;
--------------
-- TF_Return--
--------------
procedure TF_Return is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Return then
Scan; -- skip RETURN and we are done
else
Error_Msg_SC -- CODEFIX
("missing RETURN");
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Return then
Scan; -- past RETURN
return;
end if;
end loop;
end if;
end TF_Return;
------------------
-- TF_Semicolon --
------------------
procedure TF_Semicolon is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Semicolon then
T_Semicolon;
return;
-- An interesting little test here. If the previous token is a
-- semicolon, then there is no way that we can legitimately need
-- another semicolon. This could only arise in an error situation
-- where an error has already been signalled. By simply ignoring
-- the request for a semicolon in this case, we avoid some spurious
-- missing semicolon messages.
elsif Prev_Token = Tok_Semicolon then
return;
else
-- Deal with pragma. If pragma is not at start of line, it is
-- considered misplaced otherwise we treat it as a normal
-- missing semicolon case.
if Token = Tok_Pragma
and then not Token_Is_At_Start_Of_Line
then
P_Pragmas_Misplaced;
if Token = Tok_Semicolon then
T_Semicolon;
return;
end if;
end if;
-- Here we definitely have a missing semicolon, so give message
T_Semicolon;
-- Scan out junk on rest of line. Scan stops on END keyword, since
-- that seems to help avoid cascaded errors.
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_EOF
or else Token = Tok_End
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Semicolon then
T_Semicolon;
return;
elsif Token in Token_Class_After_SM then
return;
end if;
end loop;
end if;
end TF_Semicolon;
-------------
-- TF_Then --
-------------
procedure TF_Then is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Then then
Scan; -- past THEN and we are done
else
T_Then; -- give missing THEN message
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Then then
Scan; -- past THEN
return;
end if;
end loop;
end if;
end TF_Then;
------------
-- TF_Use --
------------
procedure TF_Use is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Use then
Scan; -- past USE and we are done
else
T_Use; -- give USE expected message
Save_Scan_State (Scan_State); -- at start of junk tokens
loop
if Prev_Token_Ptr < Current_Line_Start
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
Scan; -- continue search
if Token = Tok_Use then
Scan; -- past use
return;
end if;
end loop;
end if;
end TF_Use;
------------------
-- U_Left_Paren --
------------------
procedure U_Left_Paren is
begin
if Token = Tok_Left_Paren then
Scan;
else
Error_Msg_AP -- CODEFIX
("missing ""(""!");
end if;
end U_Left_Paren;
-------------------
-- U_Right_Paren --
-------------------
procedure U_Right_Paren is
begin
if Token = Tok_Right_Paren then
Scan;
else
Error_Msg_AP -- CODEFIX
("|missing "")""!");
end if;
end U_Right_Paren;
-----------------
-- Wrong_Token --
-----------------
procedure Wrong_Token (T : Token_Type; P : Position) is
Missing : constant String := "missing ";
Image : constant String := Token_Type'Image (T);
Tok_Name : constant String := Image (5 .. Image'Length);
M : constant String := Missing & Tok_Name;
begin
if Token = Tok_Semicolon then
Scan;
if Token = T then
Error_Msg_SP -- CODEFIX
("|extra "";"" ignored");
Scan;
else
Error_Msg_SP (M);
end if;
elsif Token = Tok_Comma then
Scan;
if Token = T then
Error_Msg_SP -- CODEFIX
("|extra "","" ignored");
Scan;
else
Error_Msg_SP (M);
end if;
else
case P is
when SC => Error_Msg_SC (M);
when BC => Error_Msg_BC (M);
when AP => Error_Msg_AP (M);
end case;
end if;
end Wrong_Token;
end Tchk;
|
Tim-Tom/project-euler | Ada | 2,849 | adb | package body Rational is
function gcd(a_in, b_in : Long_Long_Integer) return Long_Long_Integer is
a : Long_Long_Integer := a_in;
b : Long_Long_Integer := b_in;
begin
if a = 0 then
return b;
end if;
while b /= 0 loop
if a > b then
a := a - b;
else
b := b - a;
end if;
end loop;
return a;
end gcd;
function Create(num : in Long_Long_Integer; den : in Long_Long_Integer) return Rat is
r : Rat;
begin
r.numerator := num;
r.denomonator := den;
return r;
end;
function "+" (left, right: in Rat) return Rat is
result : Rat := left;
begin
Add(result, right);
return result;
end "+";
function "-" (left, right: in Rat) return Rat is
result : Rat := left;
begin
Subtract(result, right);
return result;
end "-";
function "*" (left, right: in Rat) return Rat is
result : Rat := left;
begin
Multiply(result, right);
return result;
end "*";
function Inverse(r : in Rat) return Rat is
result : Rat := r;
begin
Inverse(result);
return result;
end Inverse;
procedure Inverse(r : in out Rat) is
temp : constant Long_Long_Integer := r.numerator;
begin
r.numerator := r.denomonator;
r.denomonator := temp;
end Inverse;
procedure Add(left : in out Rat; right : in Rat) is
begin
left.numerator := left.numerator * right.denomonator + right.numerator * left.denomonator;
left.denomonator := left.denomonator * right.denomonator;
end Add;
procedure Subtract(left : in out Rat; right : in Rat) is
begin
left.numerator := left.numerator * right.denomonator - right.numerator * left.denomonator;
left.denomonator := left.denomonator * right.denomonator;
end Subtract;
procedure Multiply(left : in out Rat; right : in Rat) is
begin
left.numerator := left.numerator * right.numerator;
left.denomonator := left.denomonator * right.denomonator;
end Multiply;
function Numerator(r : in Rat) return Long_Long_Integer is
begin
return r.numerator;
end Numerator;
function Denomonator(r : in Rat) return Long_Long_Integer is
begin
return r.denomonator;
end Denomonator;
function Normalize(r : in Rat) return Rat is
result : Rat := r;
begin
Normalize(result);
return result;
end;
procedure Normalize(r : in out Rat) is
g : constant Long_Long_Integer := gcd(r.numerator, r.denomonator);
begin
r.numerator := r.numerator / g;
r.denomonator := r.denomonator / g;
end;
function ToString(r : in Rat) return String is
begin
return Long_Long_Integer'Image(r.numerator) & " / " & Long_Long_Integer'Image(r.denomonator);
end;
end Rational;
|
AdaCore/libadalang | Ada | 60 | adb | with Missing_Unit;
procedure Missing is
begin
end Missing;
|
BrickBot/Bound-T-H8-300 | Ada | 4,947 | ads | -- Options.Interval_Sets (decl)
--
-- Sets of (disjoint) integer intervals as options.
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- This software is provided by the copyright holders and contributors "as is" and
-- any express or implied warranties, including, but not limited to, the implied
-- warranties of merchantability and fitness for a particular purpose are
-- disclaimed. In no event shall the copyright owner or contributors be liable for
-- any direct, indirect, incidental, special, exemplary, or consequential damages
-- (including, but not limited to, procurement of substitute goods or services;
-- loss of use, data, or profits; or business interruption) however caused and
-- on any theory of liability, whether in contract, strict liability, or tort
-- (including negligence or otherwise) arising in any way out of the use of this
-- software, even if advised of the possibility of such damage.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.3 $
-- $Date: 2015/10/24 19:36:50 $
--
-- $Log: options-interval_sets.ads,v $
-- Revision 1.3 2015/10/24 19:36:50 niklas
-- Moved to free licence.
--
-- Revision 1.2 2014/06/01 10:35:35 niklas
-- Added the query function Is_Empty.
--
-- Revision 1.1 2013-02-03 12:32:38 niklas
-- First version.
--
with Storage.Bounds;
with Unbounded_Vectors;
package Options.Interval_Sets is
type Interval_Set_T is private;
--
-- A set of non-empty, disjoint integer (Storage.Value_T) intervals.
-- The default initial value of any Interval_Set_T is the empty set.
-- Options of this kind are not enumerable.
procedure Add (
Item : in Storage.Bounds.Interval_T;
To : in out Interval_Set_T);
--
-- Adds the Item To the set, taking care to keep the intervals
-- in the set disjoint and non-emptz. If the new Item intersects
-- some interval(s) already in the set, that/those interval(s)
-- is/are replaced by the union of the intervals.
function Is_Empty (Set : Interval_Set_T) return Boolean;
--
-- Whether the Set contains some intervals.
function Max (
Left : Storage.Value_T;
Right : Interval_Set_T)
return Storage.Value_T;
--
-- The larger of the Left value and the largest value contained
-- in any interval in the Right set. If the set is empty, the
-- Left value is returned. If the set contains an interval that
-- has no upper limit, the exception Storage.Bounds.Unbounded
-- is propagated.
type Option_T is new Options.Option_T with record
Value : Interval_Set_T;
end record;
--
-- An option that has an interval-set as its value.
-- The default value is the null set.
overriding
function Type_And_Default (Option : access Option_T)
return String;
overriding
procedure Reset (Option : access Option_T);
--
-- Clears the Option by setting its value to the null set.
overriding
procedure Set (
Option : access Option_T;
Value : in String);
--
-- The interval described by the Value string is added to
-- the Option's value, merging intervals to keep them
-- disjoint and rejecting any empty intervals.
function To_List (Option : Option_T)
return Storage.Bounds.Interval_List_T;
--
-- All the interval in the Option, as a list in numerically
-- increasing order.
private
Deallocate : Boolean := True;
--
-- Whether to use Unchecked_Deallocation for Interval_Set_Ts.
package Interval_Vectors
is new Unbounded_Vectors (
Element_Type => Storage.Bounds.Interval_T,
Vector_Type => Storage.Bounds.Interval_List_T,
Initial_Size => 10,
Size_Increment => 50,
Deallocate => Deallocate);
--
-- The size and increment may not be good for all uses :-)
type Interval_Set_T is new Interval_Vectors.Unbounded_Vector;
--
-- The vector of intervals is kept sorted into numerically
-- ascending order, and the intervals are kept disjoint.
end Options.Interval_Sets;
|
Heziode/lsystem-editor | Ada | 1,795 | adb | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- 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.
-------------------------------------------------------------------------------
package body LSE.Model.L_System.Error.Missing_Axiom is
function Initialize return Instance
is
begin
return Instance '(Error => Error_Type.Missing_Axiom);
end Initialize;
function Get_Error (This : Instance) return String
is
pragma Unreferenced (This);
begin
return "Axiom not found";
end Get_Error;
end LSE.Model.L_System.Error.Missing_Axiom;
|
Fabien-Chouteau/GESTE | Ada | 9,725 | ads | package GESTE_Fonts.FreeMonoOblique6pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeMonoOblique6pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#08#, 16#08#, 16#08#,
16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#36#,
16#24#, 16#24#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#08#, 16#14#, 16#3E#, 16#18#, 16#3C#, 16#28#, 16#28#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#32#, 16#18#, 16#04#,
16#04#, 16#18#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#24#,
16#28#, 16#18#, 16#1E#, 16#2C#, 16#14#, 16#1C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0C#, 16#10#, 16#10#, 16#34#, 16#34#, 16#28#, 16#34#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#08#, 16#08#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#,
16#04#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#20#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#1A#, 16#0C#, 16#18#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#08#, 16#08#, 16#3E#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#10#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#,
16#00#, 16#02#, 16#02#, 16#04#, 16#08#, 16#08#, 16#10#, 16#20#, 16#20#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#12#, 16#22#, 16#22#, 16#22#,
16#24#, 16#24#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#,
16#18#, 16#08#, 16#08#, 16#10#, 16#10#, 16#7C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0C#, 16#32#, 16#02#, 16#04#, 16#08#, 16#10#, 16#60#, 16#7C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#02#, 16#02#, 16#0C#, 16#04#,
16#04#, 16#44#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#04#, 16#0C#,
16#14#, 16#14#, 16#24#, 16#3C#, 16#08#, 16#1C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1E#, 16#10#, 16#20#, 16#1C#, 16#02#, 16#02#, 16#04#, 16#38#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#08#, 16#10#, 16#2C#, 16#32#,
16#22#, 16#24#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#12#,
16#04#, 16#04#, 16#08#, 16#08#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0C#, 16#12#, 16#22#, 16#1C#, 16#24#, 16#24#, 16#24#, 16#38#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#12#, 16#22#, 16#22#, 16#1E#,
16#04#, 16#0C#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#10#, 16#30#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#0C#, 16#30#,
16#10#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3E#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#10#, 16#08#, 16#06#, 16#0C#, 16#30#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#02#, 16#04#, 16#00#,
16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#12#,
16#26#, 16#3C#, 16#34#, 16#2C#, 16#20#, 16#20#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#18#, 16#14#, 16#14#, 16#24#, 16#3C#, 16#44#, 16#E6#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#22#, 16#22#, 16#3C#,
16#22#, 16#42#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1D#,
16#22#, 16#40#, 16#40#, 16#40#, 16#40#, 16#3C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#22#, 16#22#, 16#42#, 16#42#, 16#44#, 16#78#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#20#, 16#20#, 16#38#,
16#28#, 16#42#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#,
16#20#, 16#20#, 16#38#, 16#28#, 16#40#, 16#70#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1F#, 16#22#, 16#40#, 16#40#, 16#4E#, 16#42#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#33#, 16#22#, 16#22#, 16#3C#,
16#24#, 16#44#, 16#6E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#,
16#08#, 16#08#, 16#08#, 16#10#, 16#10#, 16#7C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#02#, 16#02#, 16#04#, 16#44#, 16#44#, 16#38#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3B#, 16#22#, 16#2C#, 16#38#,
16#44#, 16#44#, 16#66#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#,
16#10#, 16#10#, 16#20#, 16#20#, 16#22#, 16#7E#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#21#, 16#33#, 16#56#, 16#5A#, 16#42#, 16#42#, 16#E6#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#23#, 16#32#, 16#32#, 16#4A#,
16#4A#, 16#4C#, 16#64#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#22#, 16#42#, 16#42#, 16#42#, 16#44#, 16#38#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#22#, 16#22#, 16#22#, 16#3C#, 16#40#, 16#70#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#22#, 16#42#, 16#42#,
16#42#, 16#44#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#,
16#22#, 16#22#, 16#3C#, 16#44#, 16#44#, 16#62#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1C#, 16#22#, 16#20#, 16#1C#, 16#02#, 16#44#, 16#78#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#29#, 16#08#, 16#08#,
16#10#, 16#10#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#33#,
16#22#, 16#22#, 16#22#, 16#22#, 16#24#, 16#38#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#73#, 16#22#, 16#22#, 16#24#, 16#28#, 16#28#, 16#10#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#33#, 16#21#, 16#5A#, 16#5A#,
16#6A#, 16#6C#, 16#44#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#33#,
16#22#, 16#14#, 16#08#, 16#38#, 16#44#, 16#66#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#33#, 16#22#, 16#14#, 16#08#, 16#10#, 16#10#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#22#, 16#04#, 16#18#,
16#20#, 16#44#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#08#,
16#08#, 16#08#, 16#10#, 16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#,
16#00#, 16#10#, 16#10#, 16#10#, 16#10#, 16#08#, 16#08#, 16#08#, 16#08#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#08#, 16#08#, 16#08#, 16#10#,
16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#,
16#14#, 16#22#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#3C#, 16#44#, 16#44#, 16#7E#, 16#00#, 16#00#, 16#00#,
16#00#, 16#20#, 16#20#, 16#20#, 16#3C#, 16#22#, 16#42#, 16#42#, 16#FC#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#22#,
16#40#, 16#40#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#02#,
16#02#, 16#1E#, 16#22#, 16#44#, 16#44#, 16#3A#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#62#, 16#7E#, 16#40#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#08#, 16#10#, 16#3E#, 16#10#,
16#10#, 16#10#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1F#, 16#22#, 16#44#, 16#44#, 16#3C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#20#, 16#20#, 16#20#, 16#3C#, 16#22#, 16#42#, 16#44#, 16#6E#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#18#, 16#08#,
16#10#, 16#10#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#04#,
16#00#, 16#3C#, 16#04#, 16#04#, 16#08#, 16#08#, 16#00#, 16#00#, 16#00#,
16#00#, 16#30#, 16#20#, 16#20#, 16#26#, 16#28#, 16#30#, 16#28#, 16#4E#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#08#, 16#08#, 16#08#, 16#10#,
16#10#, 16#10#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#76#, 16#4A#, 16#52#, 16#52#, 16#DA#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#22#, 16#42#, 16#42#, 16#66#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#22#,
16#42#, 16#44#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#7C#, 16#22#, 16#42#, 16#22#, 16#5C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#22#, 16#42#, 16#44#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#36#, 16#18#,
16#20#, 16#20#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1E#, 16#22#, 16#1C#, 16#44#, 16#78#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#10#, 16#20#, 16#3C#, 16#20#, 16#20#, 16#20#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#26#, 16#24#,
16#24#, 16#24#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#77#, 16#22#, 16#24#, 16#28#, 16#10#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#63#, 16#4A#, 16#4A#, 16#7C#, 16#24#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#36#, 16#24#,
16#18#, 16#34#, 16#6E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#33#, 16#22#, 16#24#, 16#28#, 16#10#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#24#, 16#18#, 16#20#, 16#7C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#04#, 16#08#, 16#08#, 16#08#, 16#38#,
16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#,
16#08#, 16#08#, 16#08#, 16#10#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#,
16#00#, 16#08#, 16#08#, 16#08#, 16#08#, 16#04#, 16#08#, 16#10#, 16#10#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#32#, 16#0C#,
16#00#, 16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 12,
Glyph_Width => 8,
Glyph_Height => 12,
Data => FreeMonoOblique6pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeMonoOblique6pt7b;
|
reznikmm/matreshka | Ada | 12,561 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013-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.JSON.Documents.Internals;
with League.JSON.Values.Internals;
with Matreshka.JSON_Documents;
package body League.JSON.Arrays is
package Array_Iterable_Holder_Cursors is
type Cursor is new League.Holders.Iterable_Holder_Cursors.Cursor
with record
Data : JSON_Array;
Index : Natural := 0;
end record;
overriding function Next (Self : in out Cursor) return Boolean;
overriding function Element (Self : Cursor) return League.Holders.Holder;
end Array_Iterable_Holder_Cursors;
package body Array_Iterable_Holder_Cursors is
-------------
-- Element --
-------------
overriding function Element
(Self : Cursor) return League.Holders.Holder is
begin
return League.JSON.Values.To_Holder
(Self.Data.Element (Self.Index));
end Element;
----------
-- Next --
----------
overriding function Next (Self : in out Cursor) return Boolean is
begin
Self.Index := Self.Index + 1;
-- There is no corresponding value for 'null' JSON value, so stop
-- iteration if we found a such value.
return Self.Index <= Self.Data.Length
and then Self.Data.Element (Self.Index).Kind not in
League.JSON.Values.Null_Value;
end Next;
end Array_Iterable_Holder_Cursors;
------------
-- Adjust --
------------
overriding procedure Adjust (Self : in out JSON_Array) is
begin
Matreshka.JSON_Types.Reference (Self.Data);
end Adjust;
------------
-- Append --
------------
procedure Append
(Self : in out JSON_Array'Class; Value : League.JSON.Values.JSON_Value)
is
Aux : constant Matreshka.JSON_Types.Shared_JSON_Value_Access
:= League.JSON.Values.Internals.Internal (Value);
begin
Matreshka.JSON_Types.Mutate (Self.Data);
Matreshka.JSON_Types.Reference (Aux);
Self.Data.Values.Append (Aux);
end Append;
------------
-- Delete --
------------
procedure Delete (Self : in out JSON_Array'Class; Index : Positive) is
Aux : Matreshka.JSON_Types.Shared_JSON_Value_Access;
begin
if Index
in Self.Data.Values.First_Index .. Self.Data.Values.Last_Index
then
Matreshka.JSON_Types.Mutate (Self.Data);
Aux := Self.Data.Values.Element (Index);
Self.Data.Values.Delete (Index);
Matreshka.JSON_Types.Dereference (Aux);
end if;
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First (Self : in out JSON_Array'Class) is
Aux : Matreshka.JSON_Types.Shared_JSON_Value_Access;
begin
if not Self.Data.Values.Is_Empty then
Matreshka.JSON_Types.Mutate (Self.Data);
Aux := Self.Data.Values.First_Element;
Self.Data.Values.Delete_First;
Matreshka.JSON_Types.Dereference (Aux);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (Self : in out JSON_Array'Class) is
Aux : Matreshka.JSON_Types.Shared_JSON_Value_Access;
begin
if not Self.Data.Values.Is_Empty then
Matreshka.JSON_Types.Mutate (Self.Data);
Aux := Self.Data.Values.Last_Element;
Self.Data.Values.Delete_Last;
Matreshka.JSON_Types.Dereference (Aux);
end if;
end Delete_Last;
-------------
-- Element --
-------------
function Element
(Self : JSON_Array'Class;
Index : Positive) return League.JSON.Values.JSON_Value is
begin
if Index
in Self.Data.Values.First_Index .. Self.Data.Values.Last_Index
then
return
League.JSON.Values.Internals.Create
(Self.Data.Values.Element (Index));
else
return League.JSON.Values.Empty_JSON_Value;
end if;
end Element;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Self : in out JSON_Array) is
use type Matreshka.JSON_Types.Shared_JSON_Array_Access;
begin
if Self.Data /= null then
Matreshka.JSON_Types.Dereference (Self.Data);
end if;
end Finalize;
-----------
-- First --
-----------
function First
(Self : aliased JSON_Array)
return League.Holders.Iterable_Holder_Cursors.Cursor'Class is
begin
return Array_Iterable_Holder_Cursors.Cursor'(Self, 0);
end First;
-------------------
-- First_Element --
-------------------
function First_Element
(Self : JSON_Array'Class) return League.JSON.Values.JSON_Value is
begin
if not Self.Data.Values.Is_Empty then
return
League.JSON.Values.Internals.Create
(Self.Data.Values.First_Element);
else
return League.JSON.Values.Empty_JSON_Value;
end if;
end First_Element;
------------
-- Insert --
------------
procedure Insert
(Self : in out JSON_Array'Class;
Index : Positive;
Value : League.JSON.Values.JSON_Value)
is
Aux : constant Matreshka.JSON_Types.Shared_JSON_Value_Access
:= League.JSON.Values.Internals.Internal (Value);
begin
if Index
in Self.Data.Values.First_Index .. Self.Data.Values.Last_Index
then
Matreshka.JSON_Types.Mutate (Self.Data);
Matreshka.JSON_Types.Reference (Aux);
Self.Data.Values.Insert (Index, Aux);
end if;
end Insert;
--------------
-- Is_Empty --
--------------
function Is_Empty (Self : JSON_Array'Class) return Boolean is
begin
return Self.Data.Values.Is_Empty;
end Is_Empty;
------------------
-- Last_Element --
------------------
function Last_Element
(Self : JSON_Array'Class) return League.JSON.Values.JSON_Value is
begin
if not Self.Data.Values.Is_Empty then
return
League.JSON.Values.Internals.Create (Self.Data.Values.Last_Element);
else
return League.JSON.Values.Empty_JSON_Value;
end if;
end Last_Element;
------------
-- Length --
------------
function Length (Self : JSON_Array'Class) return Natural is
begin
return Natural (Self.Data.Values.Length);
end Length;
-------------
-- Prepend --
-------------
procedure Prepend
(Self : in out JSON_Array'Class; Value : League.JSON.Values.JSON_Value)
is
Aux : constant Matreshka.JSON_Types.Shared_JSON_Value_Access
:= League.JSON.Values.Internals.Internal (Value);
begin
Matreshka.JSON_Types.Mutate (Self.Data);
Matreshka.JSON_Types.Reference (Aux);
Self.Data.Values.Prepend (Aux);
end Prepend;
-------------
-- Replace --
-------------
procedure Replace
(Self : in out JSON_Array'Class;
Index : Positive;
Value : League.JSON.Values.JSON_Value)
is
New_Value : constant Matreshka.JSON_Types.Shared_JSON_Value_Access
:= League.JSON.Values.Internals.Internal (Value);
Old_Value : Matreshka.JSON_Types.Shared_JSON_Value_Access;
begin
if Index
in Self.Data.Values.First_Index .. Self.Data.Values.Last_Index
then
Matreshka.JSON_Types.Mutate (Self.Data);
Matreshka.JSON_Types.Reference (New_Value);
Old_Value := Self.Data.Values.Element (Index);
Self.Data.Values.Replace_Element (Index, New_Value);
Matreshka.JSON_Types.Dereference (Old_Value);
end if;
end Replace;
----------
-- Take --
----------
function Take
(Self : in out JSON_Array'Class;
Index : Positive) return League.JSON.Values.JSON_Value
is
Old_Value : Matreshka.JSON_Types.Shared_JSON_Value_Access;
begin
if Index
in Self.Data.Values.First_Index .. Self.Data.Values.Last_Index
then
Matreshka.JSON_Types.Mutate (Self.Data);
Old_Value := Self.Data.Values.Element (Index);
Self.Data.Values.Delete (Index);
return League.JSON.Values.Internals.Wrap (Old_Value);
else
return League.JSON.Values.Empty_JSON_Value;
end if;
end Take;
----------------------
-- To_JSON_Document --
----------------------
function To_JSON_Document
(Self : JSON_Array'Class) return League.JSON.Documents.JSON_Document is
begin
Matreshka.JSON_Types.Reference (Self.Data);
return
League.JSON.Documents.Internals.Wrap
(new Matreshka.JSON_Documents.Shared_JSON_Document'
(Counter => <>,
Array_Value => Self.Data,
Object_Value => null));
end To_JSON_Document;
-------------------
-- To_JSON_Value --
-------------------
function To_JSON_Value
(Self : JSON_Array'Class) return League.JSON.Values.JSON_Value is
begin
Matreshka.JSON_Types.Reference (Self.Data);
return
League.JSON.Values.Internals.Wrap
(new Matreshka.JSON_Types.Shared_JSON_Value'
(Counter => <>,
Value =>
(Kind => Matreshka.JSON_Types.Array_Value,
Array_Value => Self.Data)));
end To_JSON_Value;
end League.JSON.Arrays;
|
reznikmm/matreshka | Ada | 4,673 | 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_Hidden_Elements;
package Matreshka.ODF_Form.Hidden_Elements is
type Form_Hidden_Element_Node is
new Matreshka.ODF_Form.Abstract_Form_Element_Node
and ODF.DOM.Form_Hidden_Elements.ODF_Form_Hidden
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Form_Hidden_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Form_Hidden_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Form_Hidden_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_Hidden_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_Hidden_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.Hidden_Elements;
|
Gabriel-Degret/adalib | Ada | 779 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package Ada.Numerics is
pragma Pure (Numerics);
Argument_Error : exception;
Pi : constant :=
3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511;
π : constant := Pi;
e : constant :=
2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996;
end Ada.Numerics;
|
guillaume-lin/tsc | Ada | 4,519 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Form_Demo.Handler --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.10 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Sample.Form_Demo.Aux;
package body Sample.Form_Demo.Handler is
package Aux renames Sample.Form_Demo.Aux;
procedure Drive_Me (F : in Form;
Title : in String := "")
is
L : Line_Count;
C : Column_Count;
Y : Line_Position;
X : Column_Position;
begin
Aux.Geometry (F, L, C, Y, X);
Drive_Me (F, Y, X, Title);
end Drive_Me;
procedure Drive_Me (F : in Form;
Lin : in Line_Position;
Col : in Column_Position;
Title : in String := "")
is
Pan : Panel := Aux.Create (F, Title, Lin, Col);
V : Cursor_Visibility := Normal;
Handle_CRLF : Boolean := True;
begin
Set_Cursor_Visibility (V);
if Aux.Count_Active (F) = 1 then
Handle_CRLF := False;
end if;
loop
declare
K : Key_Code := Aux.Get_Request (F, Pan, Handle_CRLF);
R : Driver_Result;
begin
if (K = 13 or else K = 10) and then not Handle_CRLF then
R := Unknown_Request;
else
R := Driver (F, K);
end if;
case R is
when Form_Ok => null;
when Unknown_Request =>
if My_Driver (F, K, Pan) then
exit;
end if;
when others => Beep;
end case;
end;
end loop;
Set_Cursor_Visibility (V);
Aux.Destroy (F, Pan);
end Drive_Me;
end Sample.Form_Demo.Handler;
|
burratoo/Acton | Ada | 11,196 | adb | ------------------------------------------------------------------------------------------
-- --
-- OAK CORE SUPPORT PACKAGE --
-- ATMEL AVR --
-- --
-- OAK.CORE_SUPPORT_PACKAGE.TASK_SUPPORT --
-- --
-- Copyright (C) 2012-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with Oak.Oak_Time.Internal; use Oak.Oak_Time.Internal;
with Oak.Core_Support_Package.Time.Clock;
use Oak.Core_Support_Package.Time.Clock;
with System; use System;
with System.Machine_Code; use System.Machine_Code;
with Oak.Core; use Oak.Core;
with AVR; use AVR;
with AVR.Timers; use AVR.Timers;
with Oak.Agent;
with Oak.Agent.Tasks;
package body Oak.Core_Support_Package.Task_Support is
type Direction is (From_Agent, From_Oak);
-- Applying the naked attribute to Context_Switch raises
-- useless warnings about other attributes.
procedure Context_Switch (Context_Switch_Direction : Direction);
pragma Machine_Attribute (Context_Switch, "naked");
pragma Suppress (All_Checks);
-- Suppress all checks since they get in the way and cause unpredictable
-- problems.
-- Clock set to run 1024 Hz
procedure Initialise_Task_Enviroment is
Output_Compare : constant := 31;
begin
Timer_Counter2_Interrupt_Mask_Register :=
(Output_Compare_Match_B_Interrupt => Disabled,
Output_Compare_Match_A_Interrupt => Disabled,
Overflow_Interrupt => Disabled);
Asynchronous_Status_Register.Async_Timer_Counter_2 := Enabled;
Timer_Counter2_Register := 0;
Output_Compare2_Register_A := Output_Compare;
Timer_Counter2_Control_Register_A :=
(Compare_Match_Output_A_Mode => Normal,
Compare_Match_Output_B_Mode => Normal,
Waveform_Generation_Mode_0 => False,
Waveform_Generation_Mode_1 => True);
Timer_Counter2_Control_Register_B :=
(Force_Output_Compare_A => False,
Force_Output_Compare_B => False,
Waveform_Generation_Mode_2 => False,
Clock_Select => No_Scaling);
while Asynchronous_Status_Register.TC_Control_Register_2B_Update_Busy
loop
null;
end loop;
Timer_Counter2_Interrupt_Flag_Register :=
(Output_Compare_B => Raised,
Output_Compare_A => Raised,
Overflow => Raised);
Timer_Counter2_Interrupt_Mask_Register :=
(Output_Compare_Match_B_Interrupt => Disabled,
Output_Compare_Match_A_Interrupt => Enabled,
Overflow_Interrupt => Disabled);
-- Oak.Processor_Support_Package.Interrupts.Initialise_Interrupts;
end Initialise_Task_Enviroment;
------------------------------
-- Context_Switch_To_Kernel --
------------------------------
procedure Context_Switch_To_Kernel
is
begin
Context_Switch (From_Agent);
end Context_Switch_To_Kernel;
----------------------------
-- Context_Switch_To_Task --
----------------------------
procedure Context_Switch_To_Task
is
begin
Context_Switch (From_Oak);
end Context_Switch_To_Task;
---------------------------------------
-- Context_Switch_To_Scheduler_Agent --
---------------------------------------
procedure Context_Switch_To_Scheduler_Agent is
begin
Context_Switch (From_Oak);
end Context_Switch_To_Scheduler_Agent;
-------------------------------
-- Yield_Processor_To_Kernel --
-------------------------------
procedure Yield_Processor_To_Kernel is
begin
-- Ensure that r1 is actually zero.
Asm ("clr r1", Volatile => True);
Context_Switch (From_Agent);
end Yield_Processor_To_Kernel;
---------------------------
-- Set_Oak_Wake_Up_Timer --
---------------------------
procedure Set_Oak_Wake_Up_Timer (Wake_Up_At : Oak_Time.Time) is
begin
Set_Interrupt_Time (To_Internal_Time (Wake_Up_At));
end Set_Oak_Wake_Up_Timer;
------------------
-- Sleep_Kernel --
------------------
procedure Sleep_Agent is
begin
loop
null;
end loop;
end Sleep_Agent;
----------------------------
-- Context_Switch_To_Task --
-----------------------------
procedure Context_Switch (Context_Switch_Direction : Direction) is
use Oak.Core_Support_Package;
Task_Stack_Pointer : Address;
begin
-- Store registers to task's stack space.
Asm
("cli" & ASCII.LF & ASCII.HT &
"push r0" & ASCII.LF & ASCII.HT &
"push r1" & ASCII.LF & ASCII.HT &
"push r2" & ASCII.LF & ASCII.HT &
"push r3" & ASCII.LF & ASCII.HT &
"push r4" & ASCII.LF & ASCII.HT &
"push r5" & ASCII.LF & ASCII.HT &
"push r6" & ASCII.LF & ASCII.HT &
"push r7" & ASCII.LF & ASCII.HT &
"push r8" & ASCII.LF & ASCII.HT &
"push r9" & ASCII.LF & ASCII.HT &
"push r10" & ASCII.LF & ASCII.HT &
"push r11" & ASCII.LF & ASCII.HT &
"push r12" & ASCII.LF & ASCII.HT &
"push r13" & ASCII.LF & ASCII.HT &
"push r14" & ASCII.LF & ASCII.HT &
"push r15" & ASCII.LF & ASCII.HT &
"push r16" & ASCII.LF & ASCII.HT &
"push r17" & ASCII.LF & ASCII.HT &
"push r18" & ASCII.LF & ASCII.HT &
"push r19" & ASCII.LF & ASCII.HT &
"push r20" & ASCII.LF & ASCII.HT &
"push r21" & ASCII.LF & ASCII.HT &
"push r22" & ASCII.LF & ASCII.HT &
"push r23" & ASCII.LF & ASCII.HT &
"push r24" & ASCII.LF & ASCII.HT &
"push r25" & ASCII.LF & ASCII.HT &
"push r26" & ASCII.LF & ASCII.HT &
"push r27" & ASCII.LF & ASCII.HT &
"push r28" & ASCII.LF & ASCII.HT &
"push r29" & ASCII.LF & ASCII.HT &
"push r30" & ASCII.LF & ASCII.HT &
"push r31" & ASCII.LF & ASCII.HT &
"in r0, __SREG__" & ASCII.LF & ASCII.HT &
"push r0" & ASCII.LF & ASCII.HT & -- SREG
"in %A0, __SP_L__" & ASCII.LF & ASCII.HT &
"in %B0, __SP_H__" & ASCII.LF & ASCII.HT &
"clr r1", -- Ada code below requires r1 to be zero.
Outputs => Address'Asm_Output ("=z", Task_Stack_Pointer),
Volatile => True);
case Context_Switch_Direction is
when From_Agent =>
Core.Set_Current_Agent_Stack_Pointer (SP => Task_Stack_Pointer);
Task_Stack_Pointer := Core.Oak_Stack_Pointer;
when From_Oak =>
Core.Set_Oak_Stack_Pointer (Task_Stack_Pointer);
Task_Stack_Pointer := Core.Current_Agent_Stack_Pointer;
end case;
-- Load To task's registers
-- We need to turn on or off the interrupts for tasks based on the
-- global Interrupts_Disable flag. This requires us to modify the task's
-- copy of SREG before we load it into its register. This is complicated
-- by the clock interupt also turning off interrupts. We want the clock
-- interrupt to turn back on the task's interrupt itself, so as to
-- prevent ballooning of the stack due to repeated firing of the timer
-- before the handler has a chance to restore the stack. What we do
-- then is ensure that the zero register, r1, is zero when the task
-- voluntary yields (see Yield_Processor_To_Kernel). When the increment
-- clock interrupt fires and it switches to the kernel, r1 carries the
-- value 0x80 (see Time.Clock.Increment_Clock). When the complement of
-- r1 is ANDed with the task's SREG, in the former case it will do
-- nothing and in the latter case it will ensure that the interrupts are
-- disabled.
Asm
("out __SP_L__, %A0" & ASCII.LF & ASCII.HT &
"out __SP_H__, %B0" & ASCII.LF & ASCII.HT &
"pop r16", -- SREG
Inputs => Address'Asm_Input ("z", Task_Stack_Pointer),
Volatile => True);
if Context_Switch_Direction = From_Oak
and then Core.Current_Agent.all in Oak.Agent.Tasks.Task_Agent'Class
and then not Interrupts_Disabled
then
Asm ("sbr r16, 7", Volatile => True);
else
Asm ("cbr r16, 7", Volatile => True);
end if;
Asm
("mov r0, r16" & ASCII.LF & ASCII.HT &
"pop r31" & ASCII.LF & ASCII.HT &
"pop r30" & ASCII.LF & ASCII.HT &
"pop r29" & ASCII.LF & ASCII.HT &
"pop r28" & ASCII.LF & ASCII.HT &
"pop r27" & ASCII.LF & ASCII.HT &
"pop r26" & ASCII.LF & ASCII.HT &
"pop r25" & ASCII.LF & ASCII.HT &
"pop r24" & ASCII.LF & ASCII.HT &
"pop r23" & ASCII.LF & ASCII.HT &
"pop r22" & ASCII.LF & ASCII.HT &
"pop r21" & ASCII.LF & ASCII.HT &
"pop r20" & ASCII.LF & ASCII.HT &
"pop r19" & ASCII.LF & ASCII.HT &
"pop r18" & ASCII.LF & ASCII.HT &
"pop r17" & ASCII.LF & ASCII.HT &
"pop r16" & ASCII.LF & ASCII.HT &
"pop r15" & ASCII.LF & ASCII.HT &
"pop r14" & ASCII.LF & ASCII.HT &
"pop r13" & ASCII.LF & ASCII.HT &
"pop r12" & ASCII.LF & ASCII.HT &
"pop r11" & ASCII.LF & ASCII.HT &
"pop r10" & ASCII.LF & ASCII.HT &
"pop r9" & ASCII.LF & ASCII.HT &
"pop r8" & ASCII.LF & ASCII.HT &
"pop r7" & ASCII.LF & ASCII.HT &
"pop r6" & ASCII.LF & ASCII.HT &
"pop r5" & ASCII.LF & ASCII.HT &
"pop r4" & ASCII.LF & ASCII.HT &
"pop r3" & ASCII.LF & ASCII.HT &
"pop r2" & ASCII.LF & ASCII.HT &
"pop r1" & ASCII.LF & ASCII.HT &
"com r1" & ASCII.LF & ASCII.HT & -- Now we have r1, we can
"and r0, r1" & ASCII.LF & ASCII.HT & -- apply it to SREG
"clr r1" & ASCII.LF & ASCII.HT &
"out __SREG__, r0" & ASCII.LF & ASCII.HT &
"pop r0" & ASCII.LF & ASCII.HT &
"ret",
Volatile => True);
end Context_Switch;
procedure Task_Interruptible is
begin
Interrupts_Disabled := False;
end Task_Interruptible;
procedure Task_Not_Interruptible is
begin
Interrupts_Disabled := True;
end Task_Not_Interruptible;
end Oak.Core_Support_Package.Task_Support;
|
Fabien-Chouteau/GESTE | Ada | 1,710 | adb |
with GESTE;
with GESTE.Text;
with Ada.Text_IO; use Ada.Text_IO;
with Console_Char_Screen;
with GESTE_Fonts.FreeMonoBold8pt7b;
procedure Collision_Text is
package Font_A renames GESTE_Fonts.FreeMonoBold8pt7b;
package Console_Screen is new Console_Char_Screen
(Width => 10,
Height => 16,
Buffer_Size => 45,
Init_Char => ' ');
Text_A : aliased GESTE.Text.Instance
(Font_A.Font, 1, 1, '#', ' ');
begin
Text_A.Put ("T");
Text_A.Move ((0, 0));
GESTE.Add (Text_A'Unrestricted_Access, 0);
GESTE.Render_All
(Screen_Rect => Console_Screen.Screen_Rect,
Background => ' ',
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
-- Collisions not enabled on the text layer
Console_Screen.Test_Collision (5, 5, False);
-- Collisions enabled on the text layer
Text_A.Enable_Collisions;
Console_Screen.Test_Collision (5, 5, True);
-- Invert the text so now it shouldn't collide any more
Text_A.Invert_All;
Ada.Text_IO.New_Line;
GESTE.Render_All
(Screen_Rect => Console_Screen.Screen_Rect,
Background => ' ',
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
Console_Screen.Test_Collision (5, 5, False);
-- Test collision outside the text layer
Console_Screen.Test_Collision (20, 20, False);
end Collision_Text;
|
veyselharun/ABench2020 | Ada | 1,022 | adb | --
-- ABench2020 Benchmark Suite
--
-- Softmax Program
--
-- Licensed under the MIT License. See LICENSE file in the ABench root
-- directory for license information.
--
-- Uncomment the lines below to print the result.
-- with Ada.Text_IO; use Ada.Text_IO;
procedure Softmax is
type Vector is array (1..15) of Integer;
Result : array (1..15) of Float;
Exp : constant := 2.71828;
procedure Calculate_Softmax (Sample: Vector) is
Denonminator : Float := 0.0;
begin
for I in Sample'Range loop
Denonminator := Denonminator + (Exp ** Sample (I));
end loop;
for I in Sample'Range loop
Result (I) := (Exp ** Sample (I)) / Denonminator;
end loop;
end;
Sample : Vector := (1, 5, 3, 7, 4, 10, 4, 9, 4, 1, 9, 12, 3, 8, 5);
begin
Calculate_Softmax (Sample);
-- Uncomment the lines below to print the result.
-- for I in Sample'Range loop
-- Put (Float'Image (Result (I)) & " ");
-- end loop;
end;
|
RREE/ada-util | Ada | 1,557 | ads | -----------------------------------------------------------------------
-- log.tests -- Unit tests for loggers
-- Copyright (C) 2009, 2010, 2011, 2015, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Log.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Log_Perf (T : in out Test);
procedure Test_Log (T : in out Test);
procedure Test_Debug (T : in out Test);
procedure Test_File_Appender (T : in out Test);
procedure Test_List_Appender (T : in out Test);
procedure Test_Console_Appender (T : in out Test);
procedure Test_Missing_Config (T : in out Test);
procedure Test_Log_Traceback (T : in out Test);
-- Test file appender with different modes.
procedure Test_File_Appender_Modes (T : in out Test);
end Util.Log.Tests;
|
charlie5/cBound | Ada | 2,050 | 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_create_cursor_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
cid : aliased xcb.xcb_cursor_t;
source : aliased xcb.xcb_pixmap_t;
mask : aliased xcb.xcb_pixmap_t;
fore_red : aliased Interfaces.Unsigned_16;
fore_green : aliased Interfaces.Unsigned_16;
fore_blue : aliased Interfaces.Unsigned_16;
back_red : aliased Interfaces.Unsigned_16;
back_green : aliased Interfaces.Unsigned_16;
back_blue : aliased Interfaces.Unsigned_16;
x : aliased Interfaces.Unsigned_16;
y : aliased Interfaces.Unsigned_16;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_create_cursor_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_create_cursor_request_t.Item,
Element_Array => xcb.xcb_create_cursor_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_create_cursor_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_create_cursor_request_t.Pointer,
Element_Array => xcb.xcb_create_cursor_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_create_cursor_request_t;
|
afrl-rq/OpenUxAS | Ada | 2,733 | ads | with AVTAS.LMCP.Types; use AVTAS.LMCP.Types; -- used by child packages
with Ada.Containers.Formal_Hashed_Sets;
with Ada.Strings.Hash;
with Dynamic_Strings; use Dynamic_Strings;
package UxAS.Comms is
Subscription_Address_Max_Length : constant := 255; -- arbitrary
subtype Subscription_Address is Dynamic_String (Capacity => Subscription_Address_Max_Length);
-- a constrained subtype for the sake of instantiating the Containers generic
function Hashed_Subscription_Address (Element : Subscription_Address) return Ada.Containers.Hash_Type is
(Ada.Strings.Hash (Value (Element)));
pragma Assertion_Policy (Post => Ignore);
package Subscription_Addresses is new Ada.Containers.Formal_Hashed_Sets
(Element_Type => Subscription_Address,
Hash => Hashed_Subscription_Address,
Equivalent_Elements => "=");
pragma Assertion_Policy (Post => Suppressible);
Max_Subscription_Addresses : constant := 255; -- arbitrary
subtype Subscription_Address_Set is Subscription_Addresses.Set
(Capacity => Max_Subscription_Addresses,
Modulus => Subscription_Addresses.Default_Modulus (Max_Subscription_Addresses));
-- These constants are used for defining the capacities of the dynamic
-- strings. They are declared so that others (including child packages)
-- can reference them when needed.
Content_String_Max_Length : constant := 570 * 1024;
Content_Type_Max_Length : constant := 255; -- arbitrary
Descriptor_Max_Length : constant := 255; -- arbitrary
Source_Group_Max_Length : constant := 255; -- arbitrary
Source_Entity_Id_Max_Length : constant := 255; -- arbitrary
Source_Service_Id_Max_Length : constant := 255; -- arbitrary
Address_Max_Length : constant := 255; -- arbitrary
Payload_Max_Length : constant := 570 * 1024;
Max_Network_Name_Length : constant := 255; -- arbitrary
Max_Socket_Address_Length : constant := 255; -- arbitrary
Entity_Id_String_Max_Length : constant := 255; -- arbitrary
Service_Id_String_Max_Length : constant := 255; -- arbitrary
Msg_Source_Group_Max_Length : constant := 255; -- arbitrary
Entity_Type_Max_Length : constant := 255; -- arbitrary
Network_Id_Max_Length : constant := 255; -- arbitrary
Entity_Id_Max_Length : constant := 255; -- arbitrary
Unicast_Message_Max_Length : constant := 255; -- arbitrary
Network_Client_Type_Name_Max_Length : constant := 255; -- arbitrary
Cast_All_Address_Max_Length : constant := 255; -- arbitrary
end UxAS.Comms;
|
reznikmm/matreshka | Ada | 3,754 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Layout_Grid_Lines_Attributes is
pragma Preelaborate;
type ODF_Style_Layout_Grid_Lines_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Layout_Grid_Lines_Attribute_Access is
access all ODF_Style_Layout_Grid_Lines_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Layout_Grid_Lines_Attributes;
|
AdaCore/training_material | Ada | 2,178 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package mm3dnow_h is
-- Copyright (C) 2004-2017 Free Software Foundation, Inc.
-- This file is part of GCC.
-- GCC 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, or (at your option)
-- any later version.
-- GCC 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.
-- 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/>.
-- Implemented from the mm3dnow.h (of supposedly AMD origin) included with
-- MSVC 7.1.
-- skipped func _m_femms
-- skipped func _m_pavgusb
-- skipped func _m_pf2id
-- skipped func _m_pfacc
-- skipped func _m_pfadd
-- skipped func _m_pfcmpeq
-- skipped func _m_pfcmpge
-- skipped func _m_pfcmpgt
-- skipped func _m_pfmax
-- skipped func _m_pfmin
-- skipped func _m_pfmul
-- skipped func _m_pfrcp
-- skipped func _m_pfrcpit1
-- skipped func _m_pfrcpit2
-- skipped func _m_pfrsqrt
-- skipped func _m_pfrsqit1
-- skipped func _m_pfsub
-- skipped func _m_pfsubr
-- skipped func _m_pi2fd
-- skipped func _m_pmulhrw
-- skipped func _m_prefetch
-- _MM_HINT_T0
-- skipped func _m_from_float
-- skipped func _m_to_float
-- skipped func _m_pf2iw
-- skipped func _m_pfnacc
-- skipped func _m_pfpnacc
-- skipped func _m_pi2fw
-- skipped func _m_pswapd
end mm3dnow_h;
|
reznikmm/matreshka | Ada | 3,969 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Points_Attributes;
package Matreshka.ODF_Draw.Points_Attributes is
type Draw_Points_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Points_Attributes.ODF_Draw_Points_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Points_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Points_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Points_Attributes;
|
MinimSecure/unum-sdk | Ada | 892 | adb | -- Copyright 2014-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
Result1 : Data_Type;
GGG1 : GADataType'Class := GADataType'Class (Result1);
begin
Do_Nothing (GGG1'Address); -- BREAK
end Foo;
|
simonjwright/sdlada | Ada | 2,585 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
package body SDL is
function Initialise (Flags : in Init_Flags := Enable_Everything) return Boolean is
function SDL_Init (Flags : in Init_Flags := Enable_Everything) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_Init";
Result : constant C.int := SDL_Init (Flags);
begin
return (Result = Success);
end Initialise;
function Initialise_Sub_System (Flags : in Init_Flags) return Boolean is
function SDL_Init_Sub_System (Flags : in Init_Flags) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_InitSubSystem";
Result : constant C.int := SDL_Init_Sub_System (Flags);
begin
return (Result = Success);
end Initialise_Sub_System;
function SDL_Was_Initialised (Flags : in Init_Flags := Null_Init_Flags) return Init_Flags with
Import => True,
Convention => C,
External_Name => "SDL_WasInit";
function Was_Initialised return Init_Flags is
begin
return SDL_Was_Initialised;
end Was_Initialised;
function Was_Initialised (Flags : in Init_Flags) return Boolean is
begin
return (SDL_Was_Initialised (Flags) = Flags);
end Was_Initialised;
function To_Bool (Value : in Boolean) return SDL_Bool is
begin
return (if Value then SDL_True else SDL_False);
end To_Bool;
end SDL;
|
reznikmm/matreshka | Ada | 4,033 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Meta_Sentence_Count_Attributes;
package Matreshka.ODF_Meta.Sentence_Count_Attributes is
type Meta_Sentence_Count_Attribute_Node is
new Matreshka.ODF_Meta.Abstract_Meta_Attribute_Node
and ODF.DOM.Meta_Sentence_Count_Attributes.ODF_Meta_Sentence_Count_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Meta_Sentence_Count_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Meta_Sentence_Count_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Meta.Sentence_Count_Attributes;
|
AdaCore/langkit | Ada | 1,289 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Libfoolang.Analysis; use Libfoolang.Analysis;
with Libfoolang.Common; use Libfoolang.Common;
procedure Main is
U : constant Analysis_Unit := Create_Context.Get_From_File ("main.txt");
procedure P_Of (N : Foo_Node);
-- Iterate over `N`'s children with the for .. of loop kind
procedure P_In (N : Foo_Node);
-- Iterate over `N`'s children with the for .. in loop kind
----------
-- P_Of --
----------
procedure P_Of (N : Foo_Node) is
begin
Put ("Node: " & N.Image);
Put (" has the following children: [");
for C of N.Children_And_Trivia loop
if C.Kind = Child then
Put (C.Node.Image);
end if;
end loop;
Put_Line ("]");
end P_Of;
----------
-- P_In --
----------
procedure P_In (N : Foo_Node) is
A : constant Children_Array := N.Children_And_Trivia;
begin
Put ("Node: " & N.Image);
Put (" has the following children: [");
for C in A loop
if Element (A, C).Kind = Child then
Put (Element (A, C).Node.Image);
end if;
end loop;
Put_Line ("]");
end P_In;
begin
P_Of (U.Root.Children (1));
P_In (U.Root.Children (1));
Put_Line ("main.adb: Done.");
end Main;
|
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.Table_Table_Cell_Elements;
package Matreshka.ODF_Table.Table_Cell_Elements is
type Table_Table_Cell_Element_Node is
new Matreshka.ODF_Table.Abstract_Table_Element_Node
and ODF.DOM.Table_Table_Cell_Elements.ODF_Table_Table_Cell
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Table_Cell_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Table_Table_Cell_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Table_Table_Cell_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Table_Table_Cell_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Table_Table_Cell_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Table.Table_Cell_Elements;
|
reznikmm/matreshka | Ada | 6,858 | 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_Db.Table_Filter_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Table_Filter_Element_Node is
begin
return Self : Db_Table_Filter_Element_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Db_Table_Filter_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_Db_Table_Filter
(ODF.DOM.Db_Table_Filter_Elements.ODF_Db_Table_Filter_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 Db_Table_Filter_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Table_Filter_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Db_Table_Filter_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_Db_Table_Filter
(ODF.DOM.Db_Table_Filter_Elements.ODF_Db_Table_Filter_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 Db_Table_Filter_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_Db_Table_Filter
(Visitor,
ODF.DOM.Db_Table_Filter_Elements.ODF_Db_Table_Filter_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.Db_URI,
Matreshka.ODF_String_Constants.Table_Filter_Element,
Db_Table_Filter_Element_Node'Tag);
end Matreshka.ODF_Db.Table_Filter_Elements;
|
AdaCore/libadalang | Ada | 480 | adb | package body Pkg is
procedure Proc_1 is separate;
--% node.p_syntactic_fully_qualified_name
task type Task_1 is
entry E;
end Task_1;
task body Task_1 is separate;
--% node.p_syntactic_fully_qualified_name
protected type P_Body_1 is
procedure Proc_4;
end P_Body_1;
protected body P_Body_1 is separate;
--% node.p_syntactic_fully_qualified_name
package body Nested_1 is separate;
--% node.p_syntactic_fully_qualified_name
end Pkg;
|
Gabriel-Degret/adalib | Ada | 1,088 | 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
---------------------------------------------------------------------------
generic
type Element_Type is private;
package Ada.Containers.Synchronized_Queue_Interfaces is
pragma Pure(Synchronized_Queue_Interfaces);
type Queue is synchronized interface;
procedure Enqueue
(Container : in out Queue;
New_Item : in Element_Type) is abstract
with Synchronization => By_Entry;
procedure Dequeue
(Container : in out Queue;
Element : out Element_Type) is abstract
with Synchronization => By_Entry;
function Current_Use (Container : Queue) return Count_Type is abstract;
function Peak_Use (Container : Queue) return Count_Type is abstract;
end Ada.Containers.Synchronized_Queue_Interfaces;
|
onox/orka | Ada | 5,816 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Finalization;
with GL.Objects;
with GL.Types;
with Orka;
private with GL.Low_Level;
package GL.Debug is
pragma Preelaborate;
use GL.Types;
type Source is (OpenGL, Window_System, Shader_Compiler,
Third_Party, Application, Other);
type Message_Type is (Error, Deprecated_Behavior, Undefined_Behavior,
Portability, Performance, Other, Marker,
Push_Group, Pop_Group);
type Severity is (Notification, High, Medium, Low);
type Callback_Reference is access procedure
(From : Source;
Kind : Message_Type;
Level : Severity;
ID : UInt;
Message : String);
-- By default Debug_Output_Synchronous is disabled (see GL.Toggles).
-- The graphics driver may call the procedure from multiple tasks,
-- concurrently, and/or asynchronously after executing an OpenGL command.
procedure Set_Message_Callback (Callback : not null Callback_Reference);
-- Set a message callback in order to receive debug messages
--
-- Generated messages will no longer be appended to the message log,
-- but instead passed to the given callback. Initially, messages with
-- severity Low are not enabled.
procedure Disable_Message_Callback;
-- Clear current message callback and disable message output
--
-- After having called this procedure, generated messages will instead
-- be added to the message log.
procedure Set (From : Source; Kind : Message_Type; Level : Severity;
Enabled : Boolean);
-- Enable or disable specific messages or groups of messages
procedure Set (Level : Severity; Enabled : Boolean);
-- Enable messages that have the given severity
procedure Set (From : Source; Kind : Message_Type; Identifiers : Orka.Unsigned_32_Array;
Enabled : Boolean)
with Pre => Identifiers'Length > 0;
-- Enable or disable messages that have one of the given message IDs
procedure Insert_Message (From : Source; Kind : Message_Type; Level : Severity;
Identifier : UInt; Message : String)
with Pre => From in Third_Party | Application;
-- Generate a new debug message
--
-- From must be either Third_Party or Application. Instantiate the
-- generic package Messages below if you need to print multiple
-- messages with the same source and message type.
--
-- The generated debug message will either be passed to the callback
-- (if there is one), or added to the message log (if not full).
type Active_Group is limited new Ada.Finalization.Limited_Controlled with private;
function Push_Debug_Group (From : Source; Identifier : UInt; Message : String)
return Active_Group'Class
with Pre => From in Third_Party | Application;
-- Add a new debug group to the stack
--
-- From must be either Third_Party or Application.
--
-- The value returned is of a controlled type. This means you must
-- assign it to some local variable, so that the debug group will be
-- automatically removed when the variable goes out of scope.
--
-- When the debug group is pushed onto the stack, a message
-- is generated with the type Push_Group and severity Notification.
--
-- Any further calls to Set will only apply to the active debug
-- group. The currently active debug group inherits the message
-- filtering from the previous active group.
--
-- When the debug group is popped off the stack, a message is
-- generated with type Pop_Group and severity Notification.
procedure Annotate (Object : GL.Objects.GL_Object'Class; Message : String);
-- Attach a label to the given object in order for the debug
-- output to describe the object
function Get_Label (Object : GL.Objects.GL_Object'Class) return String;
-- Return the label attached to the given object
function Max_Message_Length return Size
with Post => Max_Message_Length'Result >= 1;
private
for Source use
(OpenGL => 16#8246#,
Window_System => 16#8247#,
Shader_Compiler => 16#8248#,
Third_Party => 16#8249#,
Application => 16#824A#,
Other => 16#824B#);
for Source'Size use Low_Level.Enum'Size;
for Message_Type use
(Error => 16#824C#,
Deprecated_Behavior => 16#824D#,
Undefined_Behavior => 16#824E#,
Portability => 16#824F#,
Performance => 16#8250#,
Other => 16#8251#,
Marker => 16#8268#,
Push_Group => 16#8269#,
Pop_Group => 16#826A#);
for Message_Type'Size use Low_Level.Enum'Size;
for Severity use
(Notification => 16#826B#,
High => 16#9146#,
Medium => 16#9147#,
Low => 16#9148#);
for Severity'Size use Low_Level.Enum'Size;
type Active_Group is limited new Ada.Finalization.Limited_Controlled with record
Finalized : Boolean;
end record;
overriding
procedure Finalize (Object : in out Active_Group);
end GL.Debug;
|
reznikmm/matreshka | Ada | 3,714 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Office_Document_Content_Elements is
pragma Preelaborate;
type ODF_Office_Document_Content is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Office_Document_Content_Access is
access all ODF_Office_Document_Content'Class
with Storage_Size => 0;
end ODF.DOM.Office_Document_Content_Elements;
|
optikos/oasis | Ada | 1,030 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Definitions;
with Program.Lexical_Elements;
package Program.Elements.Others_Choices is
pragma Pure (Program.Elements.Others_Choices);
type Others_Choice is
limited interface and Program.Elements.Definitions.Definition;
type Others_Choice_Access is access all Others_Choice'Class
with Storage_Size => 0;
type Others_Choice_Text is limited interface;
type Others_Choice_Text_Access is access all Others_Choice_Text'Class
with Storage_Size => 0;
not overriding function To_Others_Choice_Text
(Self : aliased in out Others_Choice)
return Others_Choice_Text_Access is abstract;
not overriding function Others_Token
(Self : Others_Choice_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Others_Choices;
|
reznikmm/matreshka | Ada | 677 | ads | with Ada.Streams;
with League.Strings;
package Styx.Messages.Versions is
type Version_Request is new Request with record
MSize : Size;
Version : League.Strings.Universal_String;
end record;
procedure Visit
(Visiter : in out Styx.Request_Visiters.Request_Visiter'Class;
Value : Version_Request);
type Version_Request_Access is access all Version_Request;
type Version_Reply is new Reply with record
MSize : Size;
Version : League.Strings.Universal_String;
end record;
procedure Visit
(Visiter : in out Styx.Reply_Visiters.Reply_Visiter'Class;
Value : Version_Reply);
end Styx.Messages.Versions;
|
optikos/oasis | Ada | 6,040 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Subtype_Declarations is
function Create
(Subtype_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Subtype_Declaration is
begin
return Result : Subtype_Declaration :=
(Subtype_Token => Subtype_Token, Name => Name, Is_Token => Is_Token,
Subtype_Indication => Subtype_Indication, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Subtype_Declaration is
begin
return Result : Implicit_Subtype_Declaration :=
(Name => Name, Subtype_Indication => Subtype_Indication,
Aspects => Aspects, Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Name
(Self : Base_Subtype_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is
begin
return Self.Name;
end Name;
overriding function Subtype_Indication
(Self : Base_Subtype_Declaration)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is
begin
return Self.Subtype_Indication;
end Subtype_Indication;
overriding function Aspects
(Self : Base_Subtype_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is
begin
return Self.Aspects;
end Aspects;
overriding function Subtype_Token
(Self : Subtype_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Subtype_Token;
end Subtype_Token;
overriding function Is_Token
(Self : Subtype_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Is_Token;
end Is_Token;
overriding function With_Token
(Self : Subtype_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.With_Token;
end With_Token;
overriding function Semicolon_Token
(Self : Subtype_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Subtype_Declaration)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Subtype_Declaration)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Subtype_Declaration)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Subtype_Declaration'Class) is
begin
Set_Enclosing_Element (Self.Name, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Subtype_Indication, Self'Unchecked_Access);
for Item in Self.Aspects.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Subtype_Declaration_Element
(Self : Base_Subtype_Declaration)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Subtype_Declaration_Element;
overriding function Is_Declaration_Element
(Self : Base_Subtype_Declaration)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Declaration_Element;
overriding procedure Visit
(Self : not null access Base_Subtype_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Subtype_Declaration (Self);
end Visit;
overriding function To_Subtype_Declaration_Text
(Self : aliased in out Subtype_Declaration)
return Program.Elements.Subtype_Declarations
.Subtype_Declaration_Text_Access is
begin
return Self'Unchecked_Access;
end To_Subtype_Declaration_Text;
overriding function To_Subtype_Declaration_Text
(Self : aliased in out Implicit_Subtype_Declaration)
return Program.Elements.Subtype_Declarations
.Subtype_Declaration_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Subtype_Declaration_Text;
end Program.Nodes.Subtype_Declarations;
|
zhmu/ananas | Ada | 1,343 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ T E X T _ I O . T E X T _ S T R E A M 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. --
-- --
------------------------------------------------------------------------------
with Ada.Streams;
package Ada.Wide_Wide_Text_IO.Text_Streams is
type Stream_Access is access all Streams.Root_Stream_Type'Class;
function Stream (File : File_Type) return Stream_Access;
end Ada.Wide_Wide_Text_IO.Text_Streams;
|
reznikmm/matreshka | Ada | 3,963 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Style_Wrap_Attributes;
package Matreshka.ODF_Style.Wrap_Attributes is
type Style_Wrap_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Wrap_Attributes.ODF_Style_Wrap_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Wrap_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Wrap_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Wrap_Attributes;
|
AdaCore/ada-traits-containers | Ada | 1,900 | adb | --
-- Copyright (C) 2016-2016, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
pragma Ada_2012;
with Ada.Finalization;
with Conts; use Conts;
with Conts.Elements.Null_Elements; use Conts.Elements.Null_Elements;
with Conts.Graphs.Adjacency_List;
with Conts.Graphs.Components; use Conts.Graphs.Components;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type Vertex_With_Null is (Null_V, A, B, C, D, E, F, G, H);
subtype Vertex is Vertex_With_Null range A .. Vertex_With_Null'Last;
package Graphs is new Conts.Graphs.Adjacency_List
(Vertex_Type => Vertex,
Vertex_Properties => Conts.Elements.Null_Elements.Traits,
Edge_Properties => Conts.Elements.Null_Elements.Traits,
Container_Base_Type => Ada.Finalization.Controlled);
use Graphs;
procedure Strong is new Strongly_Connected_Components
(Graphs.Traits, Graphs.Integer_Maps.As_Map);
Gr : Graphs.Graph;
Map : Graphs.Integer_Maps.Map;
Count : Positive;
begin
Gr.Add_Vertices
(No_Element,
Count => Vertex'Pos (Vertex'Last) - Vertex'Pos (Vertex'First) + 1);
Gr.Add_Edge (A, B, No_Element);
Gr.Add_Edge (B, C, No_Element);
Gr.Add_Edge (C, A, No_Element);
Gr.Add_Edge (D, B, No_Element);
Gr.Add_Edge (D, C, No_Element);
Gr.Add_Edge (D, E, No_Element);
Gr.Add_Edge (E, D, No_Element);
Gr.Add_Edge (E, F, No_Element);
Gr.Add_Edge (F, C, No_Element);
Gr.Add_Edge (F, G, No_Element);
Gr.Add_Edge (G, F, No_Element);
Gr.Add_Edge (H, G, No_Element);
Gr.Add_Edge (H, F, No_Element);
Gr.Add_Edge (H, H, No_Element);
Strong (Gr, Map, Components_Count => Count);
Put_Line ("Found" & Count'Img & " components");
for V in Vertex loop
Put_Line ("Component for " & V'Img
& " is" & Graphs.Integer_Maps.Get (Map, V)'Img);
end loop;
end Main;
|
AdaCore/Ada_Drivers_Library | Ada | 4,520 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This version of the LCH writes information about the unhandled exception
-- to the LCD. Note that it uses the package LCD_Std_Out, and that package
-- body's elaboration assignes GPIO ports and pins, as well as a SPI port,
-- to initialize the ILI9341 component.
-- Note this version is for use with the ravenscar-sfp runtime, in which full
-- exception semantics are not available.
with STM32.Board; use STM32.Board;
with LCD_Std_Out;
with BMP_Fonts;
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Unchecked_Conversion;
package body Last_Chance_Handler is
package LCD_Text renames LCD_Std_Out;
-- we use the LCD_Std_Out generic, rather than directly using the Drawing
-- package, because we want the text to wrap around the screen if necessary
procedure Put (Ptr : System.Address);
---------
-- Put --
---------
procedure Put (Ptr : System.Address) is
type C_String_Ptr is access String (1 .. Positive'Last) with
Storage_Size => 0, Size => Standard'Address_Size;
function As_C_String_Ptr is new Ada.Unchecked_Conversion
(System.Address, C_String_Ptr);
Msg_Str : constant C_String_Ptr := As_C_String_Ptr (Ptr);
begin
for J in Msg_Str'Range loop
exit when Msg_Str (J) = Character'Val (0);
LCD_Text.Put (Msg_Str (J));
end loop;
end Put;
-------------------------
-- Last_Chance_Handler --
-------------------------
procedure Last_Chance_Handler (Msg : System.Address; Line : Integer) is
begin
Initialize_LEDs; -- in case no other use in the application
All_LEDs_Off;
LCD_Text.Set_Font (To => BMP_Fonts.Font12x12);
LCD_Text.Clear_Screen;
if Line /= 0 then
LCD_Text.Put ("Predefined exception at ");
Put (Msg);
LCD_Text.Put (" line");
LCD_Text.Put (Line'Img);
else
LCD_Text.Put ("User-defined exception, message: ");
Put (Msg);
end if;
LCD_Text.New_Line;
loop
LCH_LED.Toggle;
delay until Clock + Milliseconds (500);
end loop;
end Last_Chance_Handler;
end Last_Chance_Handler;
|
reznikmm/matreshka | Ada | 24,972 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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 Ada.Exceptions;
with League.Strings.Internals;
with XML.SAX.Locators.Internals;
with XML.SAX.Parse_Exceptions.Internals;
with XML.SAX.Simple_Readers.Resolver;
package body XML.SAX.Simple_Readers.Callbacks is
---------------------
-- Call_Characters --
---------------------
procedure Call_Characters
(Self : in out Simple_Reader'Class;
Text : not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Content_Handler.Characters
(League.Strings.Internals.Create (Text), Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Characters;
------------------
-- Call_Comment --
------------------
procedure Call_Comment
(Self : in out Simple_Reader'Class;
Comment : League.Strings.Universal_String) is
begin
Self.Lexical_Handler.Comment (Comment, Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Lexical_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Comment;
--------------------
-- Call_End_CDATA --
--------------------
procedure Call_End_CDATA (Self : in out Simple_Reader'Class) is
begin
Self.Lexical_Handler.End_CDATA (Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_End_CDATA;
-----------------------
-- Call_End_Document --
-----------------------
procedure Call_End_Document (Self : in out Simple_Reader'Class) is
begin
Self.Content_Handler.End_Document (Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_End_Document;
------------------
-- Call_End_DTD --
------------------
procedure Call_End_DTD (Self : in out Simple_Reader'Class) is
begin
Self.Lexical_Handler.End_DTD (Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Lexical_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_End_DTD;
----------------------
-- Call_End_Element --
----------------------
procedure Call_End_Element
(Self : in out Simple_Reader'Class;
Namespace_URI :
not null Matreshka.Internals.Strings.Shared_String_Access;
Local_Name :
not null Matreshka.Internals.Strings.Shared_String_Access;
Qualified_Name :
not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Content_Handler.End_Element
(Namespace_URI => League.Strings.Internals.Create (Namespace_URI),
Local_Name => League.Strings.Internals.Create (Local_Name),
Qualified_Name => League.Strings.Internals.Create (Qualified_Name),
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_End_Element;
-----------------------------
-- Call_End_Prefix_Mapping --
-----------------------------
procedure Call_End_Prefix_Mapping
(Self : in out Simple_Reader'Class;
Prefix : not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Content_Handler.End_Prefix_Mapping
(Prefix => League.Strings.Internals.Create (Prefix),
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_End_Prefix_Mapping;
----------------
-- Call_Error --
----------------
procedure Call_Error
(Self : in out Simple_Reader'Class;
Message : League.Strings.Universal_String) is
begin
Self.Error_Handler.Error
(XML.SAX.Parse_Exceptions.Internals.Create
(Public_Id => Self.Locator.Public_Id,
System_Id => Self.Locator.System_Id,
Line => Self.Locator.Line,
Column => Self.Locator.Column,
Message => Message),
Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Error_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Error;
--------------------------------------
-- Call_External_Entity_Declaration --
--------------------------------------
procedure Call_External_Entity_Declaration
(Self : in out Simple_Reader'Class;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String) is
begin
Self.Declaration_Handler.External_Entity_Declaration
(Name, Public_Id, System_Id, Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Declaration_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_External_Entity_Declaration;
----------------------
-- Call_Fatal_Error --
----------------------
procedure Call_Fatal_Error
(Self : in out Simple_Reader'Class;
Message : League.Strings.Universal_String) is
begin
Self.Error_Handler.Fatal_Error
(XML.SAX.Parse_Exceptions.Internals.Create
(Public_Id => Self.Locator.Public_Id,
System_Id => Self.Locator.System_Id,
Line => Self.Locator.Line,
Column => Self.Locator.Column,
Message => Message));
Self.Continue := False;
Self.Error_Reported := True;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
-- Opposite to all other callbacks, where is no reason to call
-- Fatal_Error here again.
Self.Continue := False;
Self.Error_Reported := True;
end Call_Fatal_Error;
-------------------------------
-- Call_Ignorable_Whitespace --
-------------------------------
procedure Call_Ignorable_Whitespace
(Self : in out Simple_Reader'Class;
Text : not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Content_Handler.Ignorable_Whitespace
(League.Strings.Internals.Create (Text), Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Ignorable_Whitespace;
--------------------------------------
-- Call_Internal_Entity_Declaration --
--------------------------------------
procedure Call_Internal_Entity_Declaration
(Self : in out Simple_Reader'Class;
Name : League.Strings.Universal_String;
Value : League.Strings.Universal_String) is
begin
Self.Declaration_Handler.Internal_Entity_Declaration
(Name, Value, Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Declaration_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Internal_Entity_Declaration;
-------------------------------
-- Call_Notation_Declaration --
-------------------------------
procedure Call_Notation_Declaration
(Self : in out Simple_Reader'Class;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Public_Id : not null Matreshka.Internals.Strings.Shared_String_Access;
System_Id : not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.DTD_Handler.Notation_Declaration
(Name =>
Matreshka.Internals.XML.Symbol_Tables.Name (Self.Symbols, Name),
Public_Id => League.Strings.Internals.Create (Public_Id),
System_Id => League.Strings.Internals.Create (System_Id),
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.DTD_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Notation_Declaration;
---------------------------------
-- Call_Processing_Instruction --
---------------------------------
procedure Call_Processing_Instruction
(Self : in out Simple_Reader'Class;
Target : Matreshka.Internals.XML.Symbol_Identifier;
Data : not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Content_Handler.Processing_Instruction
(Target =>
Matreshka.Internals.XML.Symbol_Tables.Name (Self.Symbols, Target),
Data => League.Strings.Internals.Create (Data),
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Processing_Instruction;
-------------------------
-- Call_Resolve_Entity --
-------------------------
procedure Call_Resolve_Entity
(Self : in out Simple_Reader'Class;
Entity : Matreshka.Internals.XML.Entity_Identifier;
Public_Id : not null Matreshka.Internals.Strings.Shared_String_Access;
Base_URI : not null Matreshka.Internals.Strings.Shared_String_Access;
System_Id : not null Matreshka.Internals.Strings.Shared_String_Access;
Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access)
is
use type XML.SAX.Readers.SAX_Entity_Resolver_Access;
use type XML.SAX.Input_Sources.SAX_Input_Source_Access;
Name_String : League.Strings.Universal_String
:= Matreshka.Internals.XML.Symbol_Tables.Name
(Self.Symbols,
Matreshka.Internals.XML.Entity_Tables.Name
(Self.Entities, Entity));
Public_Id_String : constant League.Strings.Universal_String
:= League.Strings.Internals.Create (Public_Id);
Base_URI_String : constant League.Strings.Universal_String
:= League.Strings.Internals.Create (Base_URI);
System_Id_String : constant League.Strings.Universal_String
:= League.Strings.Internals.Create (System_Id);
begin
-- Set Source to null for safety.
Source := null;
-- Try to use user defined entity resolver if specified first.
if Self.Entity_Resolver /= null then
if Matreshka.Internals.XML.Entity_Tables.Is_External_Subset
(Self.Entities, Entity)
then
-- Name of external subset must be "[dtd]" always.
Name_String := League.Strings.To_Universal_String ("[dtd]");
elsif Matreshka.Internals.XML.Entity_Tables.Is_Parameter_Entity
(Self.Entities, Entity)
then
-- Name of parameter entity must start from '%'.
Name_String.Prepend ('%');
end if;
Self.Entity_Resolver.Resolve_Entity
(Name => Name_String,
Public_Id => Public_Id_String,
Base_URI => Base_URI_String,
System_Id => System_Id_String,
Source => Source,
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Entity_Resolver.Error_String);
return;
end if;
end if;
-- Use built-in entity resolver when entity was not resolved by user
-- defined entity resolver.
if Source = null then
XML.SAX.Simple_Readers.Resolver.Resolve_Entity
(Public_Id => Public_Id_String,
Base_URI => Base_URI_String,
System_Id => System_Id_String,
Source => Source,
Success => Self.Continue,
Error_Message => Self.Error_Message);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Error_Message);
return;
end if;
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String
("exception come from entity resolver"));
end Call_Resolve_Entity;
-------------------------------
-- Call_Set_Document_Locator --
-------------------------------
procedure Call_Set_Document_Locator
(Self : in out Simple_Reader'Class) is
begin
Self.Content_Handler.Set_Document_Locator
(XML.SAX.Locators.Internals.Create
(Matreshka.Internals.SAX_Locators.Shared_Locator_Access
(Self.Locator)));
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Set_Document_Locator;
----------------------
-- Call_Start_CDATA --
----------------------
procedure Call_Start_CDATA (Self : in out Simple_Reader'Class) is
begin
Self.Lexical_Handler.Start_CDATA (Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Start_CDATA;
-------------------------
-- Call_Start_Document --
-------------------------
procedure Call_Start_Document (Self : in out Simple_Reader'Class) is
begin
Self.Content_Handler.Start_Document (Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Start_Document;
--------------------
-- Call_Start_DTD --
--------------------
procedure Call_Start_DTD
(Self : in out Simple_Reader'Class;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Public_Id : not null Matreshka.Internals.Strings.Shared_String_Access;
System_Id : not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Lexical_Handler.Start_DTD
(Name =>
Matreshka.Internals.XML.Symbol_Tables.Name (Self.Symbols, Name),
Public_Id => League.Strings.Internals.Create (Public_Id),
System_Id => League.Strings.Internals.Create (System_Id),
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Lexical_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Start_DTD;
------------------------
-- Call_Start_Element --
------------------------
procedure Call_Start_Element
(Self : in out Simple_Reader'Class;
Namespace_URI :
not null Matreshka.Internals.Strings.Shared_String_Access;
Local_Name :
not null Matreshka.Internals.Strings.Shared_String_Access;
Qualified_Name :
not null Matreshka.Internals.Strings.Shared_String_Access;
Attributes : XML.SAX.Attributes.SAX_Attributes) is
begin
Self.Content_Handler.Start_Element
(Namespace_URI => League.Strings.Internals.Create (Namespace_URI),
Local_Name => League.Strings.Internals.Create (Local_Name),
Qualified_Name => League.Strings.Internals.Create (Qualified_Name),
Attributes => Attributes,
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Start_Element;
-------------------------------
-- Call_Start_Prefix_Mapping --
-------------------------------
procedure Call_Start_Prefix_Mapping
(Self : in out Simple_Reader'Class;
Prefix :
not null Matreshka.Internals.Strings.Shared_String_Access;
Namespace_URI :
not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Content_Handler.Start_Prefix_Mapping
(Prefix => League.Strings.Internals.Create (Prefix),
Namespace_URI => League.Strings.Internals.Create (Namespace_URI),
Success => Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Content_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Start_Prefix_Mapping;
--------------------------------------
-- Call_Unparsed_Entity_Declaration --
--------------------------------------
procedure Call_Unparsed_Entity_Declaration
(Self : in out Simple_Reader'Class;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Notation_Name : League.Strings.Universal_String) is
begin
Self.DTD_Handler.Unparsed_Entity_Declaration
(Name, Public_Id, System_Id, Notation_Name, Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.DTD_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Unparsed_Entity_Declaration;
------------------
-- Call_Warning --
------------------
procedure Call_Warning
(Self : in out Simple_Reader'Class;
Message : League.Strings.Universal_String) is
begin
Self.Error_Handler.Warning
(XML.SAX.Parse_Exceptions.Internals.Create
(Public_Id => Self.Locator.Public_Id,
System_Id => Self.Locator.System_Id,
Line => Self.Locator.Line,
Column => Self.Locator.Column,
Message => Message),
Self.Continue);
if not Self.Continue then
Call_Fatal_Error (Self, Self.Error_Handler.Error_String);
end if;
exception
when E : others =>
Ada.Exceptions.Save_Occurrence (Self.User_Exception, E);
Call_Fatal_Error
(Self,
League.Strings.To_Universal_String ("exception come from handler"));
end Call_Warning;
end XML.SAX.Simple_Readers.Callbacks;
|
SayCV/rtems-addon-packages | Ada | 7,973 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000,2006 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision$
-- $Date$
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with ncurses2.util; use ncurses2.util;
-- Graphic-rendition test (adapted from vttest)
procedure ncurses2.test_sgr_attributes is
procedure xAdd (l : Line_Position; c : Column_Position; s : String);
procedure xAdd (l : Line_Position; c : Column_Position; s : String) is
begin
Add (Line => l, Column => c, Str => s);
end xAdd;
normal, current : Attributed_Character;
begin
for pass in reverse Boolean loop
if pass then
normal := (Ch => ' ', Attr => Normal_Video, Color => 0);
else
normal := (Ch => ' ', Attr =>
(Reverse_Video => True, others => False), Color => 0);
end if;
-- Use non-default colors if possible to exercise bce a little
if Has_Colors then
Init_Pair (1, White, Blue);
normal.Color := 1;
end if;
Set_Background (Ch => normal);
Erase;
xAdd (1, 20, "Graphic rendition test pattern:");
xAdd (4, 1, "vanilla");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
Set_Background (Ch => current);
xAdd (4, 40, "bold");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
Set_Background (Ch => current);
xAdd (6, 6, "underline");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
Set_Background (Ch => current);
xAdd (6, 45, "bold underline");
current := normal;
current.Attr.Blink := not current.Attr.Blink;
Set_Background (Ch => current);
xAdd (8, 1, "blink");
current := normal;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
Set_Background (Ch => current);
xAdd (8, 40, "bold blink");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
Set_Background (Ch => current);
xAdd (10, 6, "underline blink");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
Set_Background (Ch => current);
xAdd (10, 45, "bold underline blink");
current := normal;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (12, 1, "negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (12, 40, "bold negative");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (14, 6, "underline negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (14, 45, "bold underline negative");
current := normal;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (16, 1, "blink negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (16, 40, "bold blink negative");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (18, 6, "underline blink negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (18, 45, "bold underline blink negative");
Set_Background (Ch => normal);
Move_Cursor (Line => Lines - 2, Column => 1);
if pass then
Add (Str => "Dark");
else
Add (Str => "Light");
end if;
Add (Str => " background. ");
Clear_To_End_Of_Line;
Pause;
end loop;
Set_Background (Ch => Blank2);
Erase;
End_Windows;
end ncurses2.test_sgr_attributes;
|
sungyeon/drake | Ada | 565 | ads | pragma License (Unrestricted);
-- implementation unit required by compiler
package System.WCh_WtS is
pragma Pure;
-- (s-wchcon.ads)
type WC_Encoding_Method is range 1 .. 6;
-- required for T'Wide_Value by compiler (s-wchwts.ads)
function Wide_String_To_String (
S : Wide_String;
EM : WC_Encoding_Method)
return String;
-- required for T'Wide_Wide_Value by compiler (s-wchwts.ads)
function Wide_Wide_String_To_String (
S : Wide_Wide_String;
EM : WC_Encoding_Method)
return String;
end System.WCh_WtS;
|
jwarwick/aoc_2020 | Ada | 912 | adb | -- with AUnit.Assertions; use AUnit.Assertions;
package body Day.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
-- t1 : constant Natural := ingredient_count("test1.txt");
begin
ingredient_count("test1.txt");
-- Assert(t1 = 5, "Wrong number, expected 5, got" & t1'IMAGE);
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
null;
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day.Test;
|
sebsgit/textproc | Ada | 2,601 | ads | with Ada.Containers.Vectors; use Ada.Containers;
with MathUtils;
package NeuralNet is
pragma Assertion_Policy (Pre => Check,
Post => Check,
Type_Invariant => Check);
type Activator is (RELU, LOGISTIC);
type LossFunction is (MSE);
type Shape is array (Positive range <>) of Positive;
type Weights is array (Positive range <>) of Float;
type LearningRate is new Float range 0.0 .. Float'Last;
subtype NeuronIndex is Positive range 1 .. 2048;
subtype LayerIndex is Positive range 1 .. 32;
type Neuron (size: NeuronIndex := 1) is record
a: Float := 0.0;
z: Float := 0.0;
bias: Float := 0.0;
act: Activator := RELU;
w: Weights (1 .. size) := (others => MathUtils.rand01 * (1.0 / MathUtils.F.Sqrt(Float(size))));
end record;
type Config (size: LayerIndex) is record
act: Activator := RELU;
inputSize: Positive := 1;
lr: LearningRate := 0.05;
gradientClipAbs: Float := 5.0;
sizes: Shape(1 .. size);
end record;
package NeuronVecPkg is new Ada.Containers.Vectors(Index_Type => NeuronIndex,
Element_Type => Neuron);
package NeuronLayerVecPkg is new Ada.Containers.Vectors(Index_Type => LayerIndex,
Element_Type => NeuronVecPkg.Vector,
"=" => NeuronVecPkg."=");
package LayerErrorVecPkg is new Ada.Containers.Vectors(Index_Type => LayerIndex,
Element_Type => MathUtils.Vector,
"=" => MathUtils.Float_Vec."=");
subtype LayerVector is NeuronLayerVecPkg.Vector;
type Net (size: Positive) is tagged record
layers: LayerVector;
gradients: LayerErrorVecPkg.Vector;
conf: Config (size);
end record;
function create(conf: Config) return Net;
procedure print(n: in Neuron);
procedure print(nn: in Net);
function forward(n: in out Neuron; values: in MathUtils.Vector) return Float
with Pre => values.Length = n.w'Length;
function forward(nn: in out Net; values: in MathUtils.Vector) return MathUtils.Vector
with Pre => values.Length = nn.layers(1)(1).w'Length,
Post => forward'Result.Length = nn.layers.Last_Element.Length;
procedure train(nn: in out Net; input: in MathUtils.Vector; target: MathUtils.Vector)
with Pre => input.Length = nn.layers(1)(1).w'Length;
end NeuralNet;
|
reznikmm/matreshka | Ada | 4,033 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Text_Style_Override_Attributes;
package Matreshka.ODF_Text.Style_Override_Attributes is
type Text_Style_Override_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Style_Override_Attributes.ODF_Text_Style_Override_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Style_Override_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Style_Override_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Style_Override_Attributes;
|
AdaCore/Ada_Drivers_Library | Ada | 2,519 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, 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. --
-- --
------------------------------------------------------------------------------
separate (nRF.Clock)
procedure Set_High_Freq_External_Frequency (Freq : High_Freq_Ext_Freq) is
begin
null;
end Set_High_Freq_External_Frequency;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.