repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
reznikmm/matreshka | Ada | 11,367 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.OCL.Any_Types;
with AMF.OCL.Association_Class_Call_Exps;
with AMF.OCL.Bag_Types;
with AMF.OCL.Boolean_Literal_Exps;
with AMF.OCL.Collection_Items;
with AMF.OCL.Collection_Literal_Exps;
with AMF.OCL.Collection_Ranges;
with AMF.OCL.Collection_Types;
with AMF.OCL.Enum_Literal_Exps;
with AMF.OCL.Expression_In_Ocls;
with AMF.OCL.If_Exps;
with AMF.OCL.Integer_Literal_Exps;
with AMF.OCL.Invalid_Literal_Exps;
with AMF.OCL.Invalid_Types;
with AMF.OCL.Iterate_Exps;
with AMF.OCL.Iterator_Exps;
with AMF.OCL.Let_Exps;
with AMF.OCL.Message_Exps;
with AMF.OCL.Message_Types;
with AMF.OCL.Null_Literal_Exps;
with AMF.OCL.Operation_Call_Exps;
with AMF.OCL.Ordered_Set_Types;
with AMF.OCL.Property_Call_Exps;
with AMF.OCL.Real_Literal_Exps;
with AMF.OCL.Sequence_Types;
with AMF.OCL.Set_Types;
with AMF.OCL.State_Exps;
with AMF.OCL.String_Literal_Exps;
with AMF.OCL.Template_Parameter_Types;
with AMF.OCL.Tuple_Literal_Exps;
with AMF.OCL.Tuple_Literal_Parts;
with AMF.OCL.Tuple_Types;
with AMF.OCL.Type_Exps;
with AMF.OCL.Unlimited_Natural_Literal_Exps;
with AMF.OCL.Unspecified_Value_Exps;
with AMF.OCL.Variable_Exps;
with AMF.OCL.Variables;
with AMF.OCL.Void_Types;
package AMF.Factories.OCL_Factories is
pragma Preelaborate;
type OCL_Factory is limited interface
and AMF.Factories.Factory;
type OCL_Factory_Access is access all OCL_Factory'Class;
for OCL_Factory_Access'Storage_Size use 0;
not overriding function Create_Any_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Any_Types.OCL_Any_Type_Access is abstract;
not overriding function Create_Association_Class_Call_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Association_Class_Call_Exps.OCL_Association_Class_Call_Exp_Access is abstract;
not overriding function Create_Bag_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Bag_Types.OCL_Bag_Type_Access is abstract;
not overriding function Create_Boolean_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Boolean_Literal_Exps.OCL_Boolean_Literal_Exp_Access is abstract;
not overriding function Create_Collection_Item
(Self : not null access OCL_Factory)
return AMF.OCL.Collection_Items.OCL_Collection_Item_Access is abstract;
not overriding function Create_Collection_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Collection_Literal_Exps.OCL_Collection_Literal_Exp_Access is abstract;
not overriding function Create_Collection_Range
(Self : not null access OCL_Factory)
return AMF.OCL.Collection_Ranges.OCL_Collection_Range_Access is abstract;
not overriding function Create_Collection_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Collection_Types.OCL_Collection_Type_Access is abstract;
not overriding function Create_Enum_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Enum_Literal_Exps.OCL_Enum_Literal_Exp_Access is abstract;
not overriding function Create_Expression_In_Ocl
(Self : not null access OCL_Factory)
return AMF.OCL.Expression_In_Ocls.OCL_Expression_In_Ocl_Access is abstract;
not overriding function Create_If_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.If_Exps.OCL_If_Exp_Access is abstract;
not overriding function Create_Integer_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Integer_Literal_Exps.OCL_Integer_Literal_Exp_Access is abstract;
not overriding function Create_Invalid_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Invalid_Literal_Exps.OCL_Invalid_Literal_Exp_Access is abstract;
not overriding function Create_Invalid_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Invalid_Types.OCL_Invalid_Type_Access is abstract;
not overriding function Create_Iterate_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Iterate_Exps.OCL_Iterate_Exp_Access is abstract;
not overriding function Create_Iterator_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Iterator_Exps.OCL_Iterator_Exp_Access is abstract;
not overriding function Create_Let_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Let_Exps.OCL_Let_Exp_Access is abstract;
not overriding function Create_Message_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Message_Exps.OCL_Message_Exp_Access is abstract;
not overriding function Create_Message_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Message_Types.OCL_Message_Type_Access is abstract;
not overriding function Create_Null_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Null_Literal_Exps.OCL_Null_Literal_Exp_Access is abstract;
not overriding function Create_Operation_Call_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Operation_Call_Exps.OCL_Operation_Call_Exp_Access is abstract;
not overriding function Create_Ordered_Set_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Ordered_Set_Types.OCL_Ordered_Set_Type_Access is abstract;
not overriding function Create_Property_Call_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Property_Call_Exps.OCL_Property_Call_Exp_Access is abstract;
not overriding function Create_Real_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Real_Literal_Exps.OCL_Real_Literal_Exp_Access is abstract;
not overriding function Create_Sequence_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Sequence_Types.OCL_Sequence_Type_Access is abstract;
not overriding function Create_Set_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Set_Types.OCL_Set_Type_Access is abstract;
not overriding function Create_State_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.State_Exps.OCL_State_Exp_Access is abstract;
not overriding function Create_String_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.String_Literal_Exps.OCL_String_Literal_Exp_Access is abstract;
not overriding function Create_Template_Parameter_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Template_Parameter_Types.OCL_Template_Parameter_Type_Access is abstract;
not overriding function Create_Tuple_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Tuple_Literal_Exps.OCL_Tuple_Literal_Exp_Access is abstract;
not overriding function Create_Tuple_Literal_Part
(Self : not null access OCL_Factory)
return AMF.OCL.Tuple_Literal_Parts.OCL_Tuple_Literal_Part_Access is abstract;
not overriding function Create_Tuple_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Tuple_Types.OCL_Tuple_Type_Access is abstract;
not overriding function Create_Type_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Type_Exps.OCL_Type_Exp_Access is abstract;
not overriding function Create_Unlimited_Natural_Literal_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Unlimited_Natural_Literal_Exps.OCL_Unlimited_Natural_Literal_Exp_Access is abstract;
not overriding function Create_Unspecified_Value_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Unspecified_Value_Exps.OCL_Unspecified_Value_Exp_Access is abstract;
not overriding function Create_Variable
(Self : not null access OCL_Factory)
return AMF.OCL.Variables.OCL_Variable_Access is abstract;
not overriding function Create_Variable_Exp
(Self : not null access OCL_Factory)
return AMF.OCL.Variable_Exps.OCL_Variable_Exp_Access is abstract;
not overriding function Create_Void_Type
(Self : not null access OCL_Factory)
return AMF.OCL.Void_Types.OCL_Void_Type_Access is abstract;
end AMF.Factories.OCL_Factories;
|
Skyfold/aws_sorter | Ada | 447 | ads | package waiting_for_quit is
-- This package, when included, will intercept terminal input.
-- If a q is input, run_when_q won't hang.
-- Use this as such:
-- select waiting_for_quit.q_sstatus.run_when_q;
-- then abort
-- -- your code to do in the mean time
-- end select;
protected q_status is
entry run_when_q;
procedure set_q;
private
q : Boolean := False;
end q_status;
end waiting_for_quit;
|
PThierry/ewok-kernel | Ada | 1,976 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared; use ewok.tasks_shared;
with soc.interrupts;
with rings;
package ewok.softirq
with spark_mode => off
is
type t_state is (DONE, WAITING);
type t_isr_parameters is record
handler : system_address;
interrupt : soc.interrupts.t_interrupt;
posthook_status : unsigned_32;
posthook_data : unsigned_32;
end record;
type t_isr_request is record
caller_id : ewok.tasks_shared.t_task_id;
state : t_state;
params : t_isr_parameters;
end record;
-- softirq input queue depth. Can be configured depending
-- on the devices behavior (IRQ bursts)
-- defaulting to 20 (see Kconfig)
MAX_QUEUE_SIZE : constant := $CONFIG_KERNEL_SOFTIRQ_QUEUE_DEPTH;
package p_isr_requests is new rings (t_isr_request, MAX_QUEUE_SIZE);
use p_isr_requests;
isr_queue : p_isr_requests.ring;
procedure init;
procedure push_isr
(task_id : in ewok.tasks_shared.t_task_id;
params : in t_isr_parameters);
procedure isr_handler (req : in t_isr_request);
procedure main_task;
private
previous_isr_owner : t_task_id := ID_UNUSED;
end ewok.softirq;
|
Pateldisolution/tictactoe | Ada | 1,467 | ads | package Tictactoe
with SPARK_Mode => On
is
type Slot is (Empty, Player, Computer);
type Pos is new Integer range 1 .. 3;
type Column is array (Pos) of Slot;
type Board is array (Pos) of Column;
My_Board : Board := (others => (others => Empty));
-- Game operations
procedure Initialize
with Post => Num_Free_Slots = 9;
procedure Player_Play (S : String)
with Pre => not Is_Full and Won = Empty,
Post => Num_Free_Slots = Num_Free_Slots'Old - 1;
procedure Computer_Play
with Pre => not Is_Full and Won = Empty,
Post => Num_Free_Slots = Num_Free_Slots'Old - 1;
procedure Display;
function Won return Slot;
function One_Free_Slot (X, Y : Pos) return Integer is
(if My_Board(X)(Y) = Empty then 1 else 0);
function Count_Free_Slots (X, Y : Pos) return Integer is
(One_Free_Slot(1,1) +
(if Y >= 2 then One_Free_Slot(1,2) else 0) +
(if Y >= 3 then One_Free_Slot(1,3) else 0) +
(if X >= 2 then
One_Free_Slot(2,1) +
(if Y >= 2 then One_Free_Slot(2,2) else 0) +
(if Y >= 3 then One_Free_Slot(2,3) else 0)
else 0) +
(if X >= 3 then
One_Free_Slot(3,1) +
(if Y >= 2 then One_Free_Slot(3,2) else 0) +
(if Y >= 3 then One_Free_Slot(3,3) else 0)
else 0));
function Num_Free_Slots return Natural is
(Count_Free_Slots(3,3));
function Is_Full return Boolean is (Num_Free_Slots = 0);
end Tictactoe;
|
stcarrez/ada-security | Ada | 1,463 | ads | -----------------------------------------------------------------------
-- Security-oayth-jwt-tests - Unit tests for JSON Web Token
-- Copyright (C) 2013 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 Security.OAuth.JWT.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test Decode operation with errors.
procedure Test_Decode_Error (T : in out Test);
generic
with function Get (From : in Token) return String;
Value : String;
procedure Test_Operation (T : in out Test);
generic
with function Get (From : in Token) return Ada.Calendar.Time;
Value : String;
procedure Test_Time_Operation (T : in out Test);
end Security.OAuth.JWT.Tests;
|
reznikmm/matreshka | Ada | 7,364 | 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.DG.Clip_Paths;
with AMF.DG.Graphical_Elements.Collections;
with AMF.DG.Groups;
with AMF.DG.Styles.Collections;
with AMF.Internals.DG_Elements;
with AMF.Visitors;
package AMF.Internals.DG_Clip_Paths is
type DG_Clip_Path_Proxy is
limited new AMF.Internals.DG_Elements.DG_Element_Proxy
and AMF.DG.Clip_Paths.DG_Clip_Path with null record;
overriding function Get_Clipped_Element
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Graphical_Elements.DG_Graphical_Element_Access;
-- Getter of ClipPath::clippedElement.
--
-- a reference to the owning element that is clipped by this clip path.
overriding procedure Set_Clipped_Element
(Self : not null access DG_Clip_Path_Proxy;
To : AMF.DG.Graphical_Elements.DG_Graphical_Element_Access);
-- Setter of ClipPath::clippedElement.
--
-- a reference to the owning element that is clipped by this clip path.
overriding function Get_Member
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Graphical_Elements.Collections.Ordered_Set_Of_DG_Graphical_Element;
-- Getter of Group::member.
--
-- the list of graphical elements that are members of (owned by) this
-- group.
overriding function Get_Group
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Groups.DG_Group_Access;
-- Getter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding procedure Set_Group
(Self : not null access DG_Clip_Path_Proxy;
To : AMF.DG.Groups.DG_Group_Access);
-- Setter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding function Get_Local_Style
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::localStyle.
--
-- a list of locally-owned styles for this graphical element.
overriding function Get_Shared_Style
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::sharedStyle.
--
-- a list of shared styles for this graphical element.
overriding function Get_Transform
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Sequence_Of_DG_Transform;
-- Getter of GraphicalElement::transform.
--
-- a list of zero or more transforms to apply to this graphical element.
overriding function Get_Clip_Path
(Self : not null access constant DG_Clip_Path_Proxy)
return AMF.DG.Clip_Paths.DG_Clip_Path_Access;
-- Getter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Set_Clip_Path
(Self : not null access DG_Clip_Path_Proxy;
To : AMF.DG.Clip_Paths.DG_Clip_Path_Access);
-- Setter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Enter_Element
(Self : not null access constant DG_Clip_Path_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant DG_Clip_Path_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant DG_Clip_Path_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.DG_Clip_Paths;
|
PThierry/ewok-kernel | Ada | 1,007 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with m4.cpu;
with ewok.layout;
package body processor
with spark_mode => on
is
procedure processor_init is
begin
m4.cpu.set_msp_register (ewok.layout.STACK_TOP_TASK_INITIAL);
end processor_init;
end processor;
|
io7m/coreland-sqlite3-ada | Ada | 28,017 | ads | with SQLite3.Types;
with Interfaces.C.Strings;
package SQLite3.Thin is
package CS renames Interfaces.C.Strings;
function aggregate_context
(context : SQLite3.Types.context_t;
num_bytes : SQLite3.Types.int_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, aggregate_context, "SQLite3_aggregate_context");
function auto_extension
(entry_point : SQLite3.Types.void_ptr_t) return SQLite3.Types.int_t;
pragma Import (C, auto_extension, "sqlite3_auto_extension");
function bind_blob
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
blob : SQLite3.Types.void_ptr_t;
num_bytes : SQLite3.Types.int_t;
destructor : SQLite3.Types.destructor_callback_t) return SQLite3.Types.int_t;
pragma Import (C, bind_blob, "sqlite3_bind_blob");
function bind_double
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
value : SQLite3.Types.double_t) return SQLite3.Types.int_t;
pragma Import (C, bind_double, "sqlite3_bind_double");
function bind_int
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
value : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, bind_int, "sqlite3_bind_int");
function bind_int64
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
value : SQLite3.Types.int64_t) return SQLite3.Types.int_t;
pragma Import (C, bind_int64, "sqlite3_bind_int64");
function bind_null
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, bind_null, "sqlite3_bind_null");
function bind_parameter_count
(stmt : SQLite3.Types.statement_t;
num : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, bind_parameter_count, "sqlite3_bind_parameter_count");
function bind_parameter_index
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, bind_parameter_index, "sqlite3_bind_parameter_index");
function bind_parameter_name
(stmt : SQLite3.Types.statement_t;
name : CS.chars_ptr) return CS.chars_ptr;
pragma Import (C, bind_parameter_name, "sqlite3_bind_parameter_name");
function bind_text
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
blob : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t;
destructor : SQLite3.Types.destructor_callback_t) return SQLite3.Types.int_t;
pragma Import (C, bind_text, "sqlite3_bind_text");
function bind_text16
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
text : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t;
destructor : SQLite3.Types.destructor_callback_t) return SQLite3.Types.int_t;
pragma Import (C, bind_text16, "sqlite3_bind_text16");
function bind_value
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
value : SQLite3.Types.value_t) return SQLite3.Types.int_t;
pragma Import (C, bind_value, "sqlite3_bind_value");
function bind_zeroblob
(stmt : SQLite3.Types.statement_t;
index : SQLite3.Types.int_t;
num_bytes : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, bind_zeroblob, "sqlite3_bind_zeroblob");
function blob_bytes
(blob : SQLite3.Types.blob_t) return SQLite3.Types.int_t;
pragma Import (C, blob_bytes, "sqlite3_blob_bytes");
function blob_close
(blob : SQLite3.Types.blob_t) return SQLite3.Types.int_t;
pragma Import (C, blob_close, "sqlite3_blob_close");
function blob_open
(sql : SQLite3.Types.Database_t;
db : CS.chars_ptr;
table : CS.chars_ptr;
column : CS.chars_ptr;
row : SQLite3.Types.int64_t;
flags : SQLite3.Types.int_t;
blob : access SQLite3.Types.blob_t) return SQLite3.Types.int_t;
pragma Import (C, blob_open, "sqlite3_blob_open");
function blob_read
(blob : SQLite3.Types.blob_t;
buffer : SQLite3.Types.void_ptr_t;
num_bytes : SQLite3.Types.int_t;
offset : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, blob_read, "sqlite3_blob_read");
function blob_write
(blob : SQLite3.Types.blob_t;
buffer : SQLite3.Types.void_ptr_t;
num_bytes : SQLite3.Types.int_t;
offset : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, blob_write, "sqlite3_blob_write");
function busy_handler
(sql : SQLite3.Types.Database_t;
callback : SQLite3.Types.busy_callback_t;
context : SQLite3.Types.void_ptr_t) return SQLite3.Types.int_t;
pragma Import (C, busy_handler, "sqlite3_busy_handler");
function busy_timeout
(sql : SQLite3.Types.Database_t;
ms : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, busy_timeout, "sqlite3_busy_timeout");
function changes
(sql : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, changes, "sqlite3_changes");
function clear_bindings
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, clear_bindings, "sqlite3_clear_bindings");
function close
(sql : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, close, "sqlite3_close");
function collation_needed
(db : SQLite3.Types.Database_t;
context : SQLite3.Types.void_ptr_t;
callback : SQLite3.Types.collation_callback_t) return SQLite3.Types.int_t;
pragma Import (C, collation_needed, "sqlite3_collation_needed");
function collation_needed16
(db : SQLite3.Types.Database_t;
context : CS.chars_ptr;
callback : SQLite3.Types.collation16_callback_t) return SQLite3.Types.int_t;
pragma Import (C, collation_needed16, "sqlite3_collation_needed16");
function column_blob
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, column_blob, "sqlite3_column_blob");
function column_bytes
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, column_bytes, "sqlite3_column_bytes");
function column_bytes16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, column_bytes16, "sqlite3_column_bytes16");
function column_count
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, column_count, "sqlite3_column_count");
function column_database_name
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_database_name, "SQLite3_column_database_name");
function column_database_name16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_database_name16, "sqlite3_column_database_name16");
function column_decltype
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_decltype, "sqlite3_column_decltype");
function column_decltype16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_decltype16, "sqlite3_column_decltype16");
function column_double
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.double_t;
pragma Import (C, column_double, "sqlite3_column_double");
function column_int
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, column_int, "sqlite3_column_int");
function column_int64
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.int64_t;
pragma Import (C, column_int64, "sqlite3_column_int64");
function column_name
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_name, "sqlite3_column_name");
function column_name16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_name16, "sqlite3_column_name16");
function column_origin_name
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_origin_name, "sqlite3_column_origin_name");
function column_origin_name16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_origin_name16, "sqlite3_column_origin_name16");
function column_table_name
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_table_name, "sqlite3_column_table_name");
function column_table_name16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_table_name16, "sqlite3_column_table_name16");
function column_text
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_text, "sqlite3_column_text");
function column_text16
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return CS.chars_ptr;
pragma Import (C, column_text16, "sqlite3_column_text16");
function column_type
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, column_type, "sqlite3_column_type");
function column_value
(stmt : SQLite3.Types.statement_t;
column : SQLite3.Types.int_t) return SQLite3.Types.value_t;
pragma Import (C, column_value, "sqlite3_column_value");
function commit_hook
(sql : SQLite3.Types.Database_t;
callback : SQLite3.Types.commit_callback_t;
context : SQLite3.Types.void_ptr_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, commit_hook, "sqlite3_commit_hook");
function complete
(sql : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, complete, "sqlite3_complete");
function complete16
(sql : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, complete16, "sqlite3_complete16");
function context_db_handle
(context : SQLite3.Types.context_t) return SQLite3.Types.Database_t;
pragma Import (C, context_db_handle, "sqlite3_context_db_handle");
function create_collation
(sql : SQLite3.Types.Database_t;
name : CS.chars_ptr;
encoding : SQLite3.Types.text_encoding_t;
context : SQLite3.Types.void_ptr_t;
callback : SQLite3.Types.compare_callback_t) return SQLite3.Types.int_t;
pragma Import (C, create_collation, "sqlite3_create_collation");
function create_collation16
(sql : SQLite3.Types.Database_t;
name : CS.chars_ptr;
encoding : SQLite3.Types.text_encoding_t;
context : SQLite3.Types.void_ptr_t;
callback : SQLite3.Types.compare_callback_t) return SQLite3.Types.int_t;
pragma Import (C, create_collation16, "sqlite3_create_collation16");
function create_function
(sql : SQLite3.Types.Database_t;
name : CS.chars_ptr;
num_arguments : SQLite3.Types.int_t;
encoding : SQLite3.Types.text_encoding_t;
user_data : SQLite3.Types.void_ptr_t;
func : SQLite3.Types.create_func_callback_t;
step : SQLite3.Types.create_step_callback_t;
final : SQLite3.Types.create_final_callback_t) return SQLite3.Types.int_t;
pragma Import (C, create_function, "sqlite3_create_function");
function create_function16
(sql : SQLite3.Types.Database_t;
name : CS.chars_ptr;
num_arguments : SQLite3.Types.int_t;
encoding : SQLite3.Types.text_encoding_t;
user_data : SQLite3.Types.void_ptr_t;
func : SQLite3.Types.create_func_callback_t;
step : SQLite3.Types.create_step_callback_t;
final : SQLite3.Types.create_final_callback_t) return SQLite3.Types.int_t;
pragma Import (C, create_function16, "sqlite3_create_function16");
function data_count
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, data_count, "sqlite3_data_count");
function db_handle
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.Database_t;
pragma Import (C, db_handle, "sqlite3_db_handle");
function enable_load_extension
(db : SQLite3.Types.Database_t;
onoff : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, enable_load_extension, "sqlite3_enable_load_extension");
function enable_shared_cache
(onoff : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, enable_shared_cache, "sqlite3_enable_shared_cache");
function errcode
(db : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, errcode, "sqlite3_errcode");
function errmsg
(db : SQLite3.Types.Database_t) return CS.chars_ptr;
pragma Import (C, errmsg, "sqlite3_errmsg");
function errmsg16
(db : SQLite3.Types.Database_t) return CS.chars_ptr;
pragma Import (C, errmsg16, "sqlite3_errmsg16");
function exec
(db : SQLite3.Types.Database_t;
sql : CS.chars_ptr;
callback : SQLite3.Types.exec_callback_t;
context : SQLite3.Types.void_ptr_t;
error_message : SQLite3.Types.char_2star_t) return SQLite3.Types.int_t;
pragma Import (C, exec, "sqlite3_exec");
function extended_result_codes
(db : SQLite3.Types.Database_t;
onoff : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, extended_result_codes, "sqlite3_extended_result_codes");
function file_control
(db : SQLite3.Types.Database_t;
db_name : CS.chars_ptr;
op : SQLite3.Types.int_t;
context : SQLite3.Types.void_ptr_t) return SQLite3.Types.int_t;
pragma Import (C, file_control, "sqlite3_file_control");
function finalize
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, finalize, "sqlite3_finalize");
procedure free
(address : SQLite3.Types.void_ptr_t);
pragma Import (C, free, "sqlite3_free");
procedure free_table
(table : SQLite3.Types.char_2star_t);
pragma Import (C, free_table, "sqlite3_free_table");
function get_autocommit
(db : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, get_autocommit, "sqlite3_get_autocommit");
function get_auxdata
(context : SQLite3.Types.context_t;
n : SQLite3.Types.int_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, get_auxdata, "sqlite3_get_auxdata");
function get_table
(db : SQLite3.Types.Database_t;
sql : CS.chars_ptr;
result : SQLite3.Types.char_3star_t;
row : SQLite3.Types.int_access_t;
column : SQLite3.Types.int_access_t;
error_message : SQLite3.Types.char_2star_t) return SQLite3.Types.int_t;
pragma Import (C, get_table, "sqlite3_get_table");
function initialize return SQLite3.Types.int_t;
pragma Import (C, initialize, "sqlite3_initialize");
procedure interrupt
(db : SQLite3.Types.Database_t);
pragma Import (C, interrupt, "sqlite3_interrupt");
function last_insert_rowid
(db : SQLite3.Types.Database_t) return SQLite3.Types.int64_t;
pragma Import (C, last_insert_rowid, "sqlite3_last_insert_rowid");
function libversion return CS.chars_ptr;
pragma Import (C, libversion, "sqlite3_libversion");
function libversion_number return SQLite3.Types.int_t;
pragma Import (C, libversion_number, "sqlite3_libversion_number");
function limit
(db : SQLite3.Types.Database_t;
id : SQLite3.Types.int_t;
new_value : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, limit, "sqlite3_limit");
function load_extension
(db : SQLite3.Types.Database_t;
file : CS.chars_ptr;
exten_entry : CS.chars_ptr;
error_message : SQLite3.Types.char_2star_t) return SQLite3.Types.int_t;
pragma Import (C, load_extension, "sqlite3_load_extension");
function malloc
(bytes : SQLite3.Types.int_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, malloc, "sqlite3_malloc");
function memory_highwater
(reset_flag : SQLite3.Types.int_t) return SQLite3.Types.int64_t;
pragma Import (C, memory_highwater, "sqlite3_memory_highwater");
function memory_used return SQLite3.Types.int64_t;
pragma Import (C, memory_used, "sqlite3_memory_used");
function mutex_alloc
(mutex_type : SQLite3.Types.mutex_type_t) return SQLite3.Types.mutex_t;
pragma Import (C, mutex_alloc, "sqlite3_mutex_alloc");
procedure mutex_enter
(mutex : SQLite3.Types.mutex_t);
pragma Import (C, mutex_enter, "sqlite3_mutex_enter");
procedure mutex_free
(mutex : SQLite3.Types.mutex_t);
pragma Import (C, mutex_free, "sqlite3_mutex_free");
function mutex_held
(mutex : SQLite3.Types.mutex_t) return SQLite3.Types.int_t;
pragma Import (C, mutex_held, "sqlite3_mutex_held");
procedure mutex_leave
(mutex : SQLite3.Types.mutex_t);
pragma Import (C, mutex_leave, "sqlite3_mutex_leave");
function mutex_notheld
(mutex : SQLite3.Types.mutex_t) return SQLite3.Types.int_t;
pragma Import (C, mutex_notheld, "sqlite3_mutex_notheld");
function mutex_try
(mutex : SQLite3.Types.mutex_t) return SQLite3.Types.int_t;
pragma Import (C, mutex_try, "sqlite3_mutex_try");
function next_stmt
(db : SQLite3.Types.Database_t;
stmt : SQLite3.Types.statement_t) return SQLite3.Types.statement_t;
pragma Import (C, next_stmt, "sqlite3_next_stmt");
function open
(file : CS.chars_ptr;
db : access SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, open, "sqlite3_open");
function open16
(file : CS.chars_ptr;
db : access SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, open16, "sqlite3_open16");
function os_end return SQLite3.Types.int_t;
pragma Import (C, os_end, "sqlite3_os_end");
function os_init return SQLite3.Types.int_t;
pragma Import (C, os_init, "sqlite3_os_init");
-- "Note that the use of SQLite3_prepare() is not recommended for new
-- applications. The alternative routine SQLite3_prepare_v2() should be
-- used instead."
function prepare
(db : SQLite3.Types.Database_t;
sql : CS.chars_ptr;
sql_length : SQLite3.Types.int_t;
stmt : access SQLite3.Types.statement_t;
tail : SQLite3.Types.char_2star_t) return SQLite3.Types.int_t;
pragma Import (C, prepare, "sqlite3_prepare_v2");
function prepare16
(db : SQLite3.Types.Database_t;
sql : CS.chars_ptr;
sql_length : SQLite3.Types.int_t;
stmt : access SQLite3.Types.statement_t;
tail : SQLite3.Types.char_2star_t) return SQLite3.Types.int_t;
pragma Import (C, prepare16, "sqlite3_prepare16_v2");
procedure progress_handler
(db : SQLite3.Types.Database_t;
opcodes : SQLite3.Types.int_t;
callback : SQLite3.Types.progress_callback_t;
context : SQLite3.Types.void_ptr_t);
pragma Import (C, progress_handler, "sqlite3_progress_handler");
procedure randomness
(bytes : SQLite3.Types.int_t;
address : SQLite3.Types.void_ptr_t);
pragma Import (C, randomness, "sqlite3_randomness");
function realloc
(address : SQLite3.Types.void_ptr_t;
size : SQLite3.Types.int_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, realloc, "sqlite3_realloc");
function release_memory
(flag : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, release_memory, "sqlite3_release_memory");
function reset
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, reset, "sqlite3_reset");
procedure reset_auto_extension;
pragma Import (C, reset_auto_extension, "sqlite3_reset_auto_extension");
procedure result_blob
(context : SQLite3.Types.context_t;
blob : SQLite3.Types.void_ptr_t;
num_bytes : SQLite3.Types.int_t;
callback : SQLite3.Types.result_callback_t);
pragma Import (C, result_blob, "sqlite3_result_blob");
procedure result_double
(context : SQLite3.Types.context_t;
value : SQLite3.Types.double_t);
pragma Import (C, result_double, "sqlite3_result_double");
procedure result_error
(context : SQLite3.Types.context_t;
value : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t);
pragma Import (C, result_error, "sqlite3_result_error");
procedure result_error16
(context : SQLite3.Types.context_t;
value : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t);
pragma Import (C, result_error16, "sqlite3_result_error16");
procedure result_error_code
(context : SQLite3.Types.context_t;
error_code : SQLite3.Types.int_t);
pragma Import (C, result_error_code, "sqlite3_result_error_code");
procedure result_error_nomem
(context : SQLite3.Types.context_t);
pragma Import (C, result_error_nomem, "sqlite3_result_error_nomem");
procedure result_error_toobig
(context : SQLite3.Types.context_t);
pragma Import (C, result_error_toobig, "sqlite3_result_error_toobig");
procedure result_int
(context : SQLite3.Types.context_t;
value : SQLite3.Types.int_t);
pragma Import (C, result_int, "sqlite3_result_int");
procedure result_int64
(context : SQLite3.Types.context_t;
value : SQLite3.Types.int64_t);
pragma Import (C, result_int64, "sqlite3_result_int64");
procedure result_null
(context : SQLite3.Types.context_t);
pragma Import (C, result_null, "sqlite3_result_null");
procedure result_text
(context : SQLite3.Types.context_t;
text : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t;
callback : SQLite3.Types.result_callback_t);
pragma Import (C, result_text, "sqlite3_result_text");
procedure result_text16
(context : SQLite3.Types.context_t;
text : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t;
callback : SQLite3.Types.result_callback_t);
pragma Import (C, result_text16, "sqlite3_result_text16");
procedure result_text16be
(context : SQLite3.Types.context_t;
text : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t;
callback : SQLite3.Types.result_callback_t);
pragma Import (C, result_text16be, "sqlite3_result_text16be");
procedure result_text16le
(context : SQLite3.Types.context_t;
text : CS.chars_ptr;
num_bytes : SQLite3.Types.int_t;
callback : SQLite3.Types.result_callback_t);
pragma Import (C, result_text16le, "sqlite3_result_text16le");
procedure result_value
(context : SQLite3.Types.context_t;
value : SQLite3.Types.value_t);
pragma Import (C, result_value, "sqlite3_result_value");
procedure result_zeroblob
(context : SQLite3.Types.context_t;
num_bytes : SQLite3.Types.int_t);
pragma Import (C, result_zeroblob, "sqlite3_result_zeroblob");
function rollback_hook
(sql : SQLite3.Types.Database_t;
callback : SQLite3.Types.rollback_callback_t;
context : SQLite3.Types.void_ptr_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, rollback_hook, "sqlite3_rollback_hook");
function set_authorizer
(db : SQLite3.Types.Database_t;
callback : SQLite3.Types.auth_callback_t;
context : SQLite3.Types.void_ptr_t) return SQLite3.Types.int_t;
pragma Import (C, set_authorizer, "sqlite3_set_authorizer");
function set_auxdata
(context : SQLite3.Types.context_t;
index : SQLite3.Types.int_t;
data : SQLite3.Types.void_ptr_t;
callback : SQLite3.Types.auxdata_callback_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, set_auxdata, "sqlite3_set_auxdata");
function shutdown return SQLite3.Types.int_t;
pragma Import (C, shutdown, "sqlite3_shutdown");
function sleep
(time : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, sleep, "sqlite3_sleep");
procedure soft_heap_limit
(limit : SQLite3.Types.int_t);
pragma Import (C, soft_heap_limit, "sqlite3_soft_heap_limit");
function sql
(stmt : SQLite3.Types.statement_t) return CS.chars_ptr;
pragma Import (C, sql, "sqlite3_sql");
function step
(stmt : SQLite3.Types.statement_t) return SQLite3.Types.int_t;
pragma Import (C, step, "sqlite3_step");
function table_column_metadata
(db : SQLite3.Types.Database_t;
db_name : CS.chars_ptr;
table_name : CS.chars_ptr;
column_name : CS.chars_ptr;
data_type : SQLite3.Types.char_2star_t;
collation_seq : SQLite3.Types.char_2star_t;
not_null : SQLite3.Types.int_access_t;
primary_key : SQLite3.Types.int_access_t;
auto_increment : SQLite3.Types.int_access_t) return SQLite3.Types.int_t;
pragma Import (C, table_column_metadata, "sqlite3_table_column_metadata");
function threadsafe return SQLite3.Types.int_t;
pragma Import (C, threadsafe, "sqlite3_threadsafe");
function total_changes
(db : SQLite3.Types.Database_t) return SQLite3.Types.int_t;
pragma Import (C, total_changes, "sqlite3_total_changes");
function update_hook
(db : SQLite3.Types.Database_t;
callback : SQLite3.Types.change_callback_t;
context : SQLite3.Types.void_ptr_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, update_hook, "sqlite3_update_hook");
function user_data
(context : SQLite3.Types.context_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, user_data, "sqlite3_user_data");
function value_blob
(value : SQLite3.Types.value_t) return SQLite3.Types.void_ptr_t;
pragma Import (C, value_blob, "sqlite3_value_blob");
function value_bytes
(value : SQLite3.Types.value_t) return SQLite3.Types.int_t;
pragma Import (C, value_bytes, "sqlite3_value_bytes");
function value_bytes16
(value : SQLite3.Types.value_t) return SQLite3.Types.int_t;
pragma Import (C, value_bytes16, "sqlite3_value_bytes16");
function value_double
(value : SQLite3.Types.value_t) return SQLite3.Types.double_t;
pragma Import (C, value_double, "sqlite3_value_double");
function value_int
(value : SQLite3.Types.value_t) return SQLite3.Types.int_t;
pragma Import (C, value_int, "sqlite3_value_int");
function value_int64
(value : SQLite3.Types.value_t) return SQLite3.Types.int64_t;
pragma Import (C, value_int64, "sqlite3_value_int64");
function value_numeric_type
(value : SQLite3.Types.value_t) return SQLite3.Types.int_t;
pragma Import (C, value_numeric_type, "sqlite3_value_numeric_type");
function value_text
(value : SQLite3.Types.value_t) return CS.chars_ptr;
pragma Import (C, value_text, "sqlite3_value_text");
function value_text16
(value : SQLite3.Types.value_t) return CS.chars_ptr;
pragma Import (C, value_text16, "sqlite3_value_text16");
function value_text16be
(value : SQLite3.Types.value_t) return CS.chars_ptr;
pragma Import (C, value_text16be, "sqlite3_value_text16be");
function value_text16le
(value : SQLite3.Types.value_t) return CS.chars_ptr;
pragma Import (C, value_text16le, "sqlite3_value_text16le");
function value_type
(value : SQLite3.Types.value_t) return SQLite3.Types.int_t;
pragma Import (C, value_type, "sqlite3_value_type");
function vfs_find
(name : CS.chars_ptr) return SQLite3.Types.vfs_t;
pragma Import (C, vfs_find, "sqlite3_vfs_find");
function vfs_register
(vfs : SQLite3.Types.vfs_t;
make_default : SQLite3.Types.int_t) return SQLite3.Types.int_t;
pragma Import (C, vfs_register, "sqlite3_vfs_register");
function vfs_unregister
(vfs : SQLite3.Types.vfs_t) return SQLite3.Types.int_t;
pragma Import (C, vfs_unregister, "sqlite3_vfs_unregister");
end SQLite3.Thin;
|
Vikash-Kothary/swagger-aem | Ada | 25,352 | ads | -- Adobe Experience Manager (AEM) API
-- Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
-- ------------ EDIT NOTE ------------
-- This file was generated with openapi-generator. You can modify it to implement
-- the server. After you modify this file, you should add the following line
-- to the .openapi-generator-ignore file:
--
-- src/-servers.ads
--
-- Then, you can drop this edit note comment.
-- ------------ EDIT NOTE ------------
with Swagger.Servers;
with .Models;
with .Skeletons;
package .Servers is
use .Models;
type Server_Type is limited new .Skeletons.Server_Type with null record;
--
overriding
procedure Get_Aem_Product_Info
(Server : in out Server_Type
;
Result : out Swagger.UString_Vectors.Vector;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Config_Mgr
(Server : in out Server_Type
;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Bundle
(Server : in out Server_Type;
Name : in Swagger.UString;
Action : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Jmx_Repository
(Server : in out Server_Type;
Action : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Saml_Configuration
(Server : in out Server_Type;
Post : in Swagger.Nullable_Boolean;
Apply : in Swagger.Nullable_Boolean;
Delete : in Swagger.Nullable_Boolean;
Action : in Swagger.Nullable_UString;
Dollarlocation : in Swagger.Nullable_UString;
Path : in Swagger.UString_Vectors.Vector;
Service_Periodranking : in Swagger.Nullable_Integer;
Idp_Url : in Swagger.Nullable_UString;
Idp_Cert_Alias : in Swagger.Nullable_UString;
Idp_Http_Redirect : in Swagger.Nullable_Boolean;
Service_Provider_Entity_Id : in Swagger.Nullable_UString;
Assertion_Consumer_Service_U_R_L : in Swagger.Nullable_UString;
Sp_Private_Key_Alias : in Swagger.Nullable_UString;
Key_Store_Password : in Swagger.Nullable_UString;
Default_Redirect_Url : in Swagger.Nullable_UString;
User_I_D_Attribute : in Swagger.Nullable_UString;
Use_Encryption : in Swagger.Nullable_Boolean;
Create_User : in Swagger.Nullable_Boolean;
Add_Group_Memberships : in Swagger.Nullable_Boolean;
Group_Membership_Attribute : in Swagger.Nullable_UString;
Default_Groups : in Swagger.UString_Vectors.Vector;
Name_Id_Format : in Swagger.Nullable_UString;
Synchronize_Attributes : in Swagger.UString_Vectors.Vector;
Handle_Logout : in Swagger.Nullable_Boolean;
Logout_Url : in Swagger.Nullable_UString;
Clock_Tolerance : in Swagger.Nullable_Integer;
Digest_Method : in Swagger.Nullable_UString;
Signature_Method : in Swagger.Nullable_UString;
User_Intermediate_Path : in Swagger.Nullable_UString;
Propertylist : in Swagger.UString_Vectors.Vector;
Result : out .Models.SamlConfigurationInfo_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Login_Page
(Server : in out Server_Type
;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Cq_Actions
(Server : in out Server_Type;
Authorizable_Id : in Swagger.UString;
Changelog : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Crxde_Status
(Server : in out Server_Type
;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Install_Status
(Server : in out Server_Type
;
Result : out .Models.InstallStatus_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Package_Manager_Servlet
(Server : in out Server_Type
;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Package_Service
(Server : in out Server_Type;
Cmd : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Package_Service_Json
(Server : in out Server_Type;
Path : in Swagger.UString;
Cmd : in Swagger.UString;
Group_Name : in Swagger.Nullable_UString;
Package_Name : in Swagger.Nullable_UString;
Package_Version : in Swagger.Nullable_UString;
Charset : in Swagger.Nullable_UString;
Force : in Swagger.Nullable_Boolean;
Recursive : in Swagger.Nullable_Boolean;
P_Package : in Swagger.File_Part_Type;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Package_Update
(Server : in out Server_Type;
Group_Name : in Swagger.UString;
Package_Name : in Swagger.UString;
Version : in Swagger.UString;
Path : in Swagger.UString;
Filter : in Swagger.Nullable_UString;
Charset : in Swagger.Nullable_UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Set_Password
(Server : in out Server_Type;
Old : in Swagger.UString;
Plain : in Swagger.UString;
Verify : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Aem_Health_Check
(Server : in out Server_Type;
Tags : in Swagger.Nullable_UString;
Combine_Tags_Or : in Swagger.Nullable_Boolean;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Aem_Health_Check_Servlet
(Server : in out Server_Type;
Bundles_Periodignored : in Swagger.UString_Vectors.Vector;
Bundles_Periodignored_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Aem_Password_Reset
(Server : in out Server_Type;
Pwdreset_Periodauthorizables : in Swagger.UString_Vectors.Vector;
Pwdreset_Periodauthorizables_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Delete_Agent
(Server : in out Server_Type;
Runmode : in Swagger.UString;
Name : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Delete_Node
(Server : in out Server_Type;
Path : in Swagger.UString;
Name : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Agent
(Server : in out Server_Type;
Runmode : in Swagger.UString;
Name : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Agents
(Server : in out Server_Type;
Runmode : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Authorizable_Keystore
(Server : in out Server_Type;
Intermediate_Path : in Swagger.UString;
Authorizable_Id : in Swagger.UString;
Result : out .Models.KeystoreInfo_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Keystore
(Server : in out Server_Type;
Intermediate_Path : in Swagger.UString;
Authorizable_Id : in Swagger.UString;
Result : out Swagger.Http_Content_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Node
(Server : in out Server_Type;
Path : in Swagger.UString;
Name : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Package
(Server : in out Server_Type;
Group : in Swagger.UString;
Name : in Swagger.UString;
Version : in Swagger.UString;
Result : out Swagger.Http_Content_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Package_Filter
(Server : in out Server_Type;
Group : in Swagger.UString;
Name : in Swagger.UString;
Version : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Query
(Server : in out Server_Type;
Path : in Swagger.UString;
P_Periodlimit : in Swagger.Number;
1_Property : in Swagger.UString;
1_Property_Periodvalue : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Truststore
(Server : in out Server_Type
;
Result : out Swagger.Http_Content_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Get_Truststore_Info
(Server : in out Server_Type
;
Result : out .Models.TruststoreInfo_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Agent
(Server : in out Server_Type;
Runmode : in Swagger.UString;
Name : in Swagger.UString;
Jcr_Content_Slashcq_Distribute : in Swagger.Nullable_Boolean;
Jcr_Content_Slashcq_Distribute_At_Type_Hint : in Swagger.Nullable_UString;
Jcr_Content_Slashcq_Name : in Swagger.Nullable_UString;
Jcr_Content_Slashcq_Template : in Swagger.Nullable_UString;
Jcr_Content_Slashenabled : in Swagger.Nullable_Boolean;
Jcr_Content_Slashjcr_Description : in Swagger.Nullable_UString;
Jcr_Content_Slashjcr_Last_Modified : in Swagger.Nullable_UString;
Jcr_Content_Slashjcr_Last_Modified_By : in Swagger.Nullable_UString;
Jcr_Content_Slashjcr_Mixin_Types : in Swagger.Nullable_UString;
Jcr_Content_Slashjcr_Title : in Swagger.Nullable_UString;
Jcr_Content_Slashlog_Level : in Swagger.Nullable_UString;
Jcr_Content_Slashno_Status_Update : in Swagger.Nullable_Boolean;
Jcr_Content_Slashno_Versioning : in Swagger.Nullable_Boolean;
Jcr_Content_Slashprotocol_Connect_Timeout : in Swagger.Number;
Jcr_Content_Slashprotocol_H_T_T_P_Connection_Closed : in Swagger.Nullable_Boolean;
Jcr_Content_Slashprotocol_H_T_T_P_Expired : in Swagger.Nullable_UString;
Jcr_Content_Slashprotocol_H_T_T_P_Headers : in Swagger.UString_Vectors.Vector;
Jcr_Content_Slashprotocol_H_T_T_P_Headers_At_Type_Hint : in Swagger.Nullable_UString;
Jcr_Content_Slashprotocol_H_T_T_P_Method : in Swagger.Nullable_UString;
Jcr_Content_Slashprotocol_H_T_T_P_S_Relaxed : in Swagger.Nullable_Boolean;
Jcr_Content_Slashprotocol_Interface : in Swagger.Nullable_UString;
Jcr_Content_Slashprotocol_Socket_Timeout : in Swagger.Number;
Jcr_Content_Slashprotocol_Version : in Swagger.Nullable_UString;
Jcr_Content_Slashproxy_N_T_L_M_Domain : in Swagger.Nullable_UString;
Jcr_Content_Slashproxy_N_T_L_M_Host : in Swagger.Nullable_UString;
Jcr_Content_Slashproxy_Host : in Swagger.Nullable_UString;
Jcr_Content_Slashproxy_Password : in Swagger.Nullable_UString;
Jcr_Content_Slashproxy_Port : in Swagger.Number;
Jcr_Content_Slashproxy_User : in Swagger.Nullable_UString;
Jcr_Content_Slashqueue_Batch_Max_Size : in Swagger.Number;
Jcr_Content_Slashqueue_Batch_Mode : in Swagger.Nullable_UString;
Jcr_Content_Slashqueue_Batch_Wait_Time : in Swagger.Number;
Jcr_Content_Slashretry_Delay : in Swagger.Nullable_UString;
Jcr_Content_Slashreverse_Replication : in Swagger.Nullable_Boolean;
Jcr_Content_Slashserialization_Type : in Swagger.Nullable_UString;
Jcr_Content_Slashsling_Resource_Type : in Swagger.Nullable_UString;
Jcr_Content_Slashssl : in Swagger.Nullable_UString;
Jcr_Content_Slashtransport_N_T_L_M_Domain : in Swagger.Nullable_UString;
Jcr_Content_Slashtransport_N_T_L_M_Host : in Swagger.Nullable_UString;
Jcr_Content_Slashtransport_Password : in Swagger.Nullable_UString;
Jcr_Content_Slashtransport_Uri : in Swagger.Nullable_UString;
Jcr_Content_Slashtransport_User : in Swagger.Nullable_UString;
Jcr_Content_Slashtrigger_Distribute : in Swagger.Nullable_Boolean;
Jcr_Content_Slashtrigger_Modified : in Swagger.Nullable_Boolean;
Jcr_Content_Slashtrigger_On_Off_Time : in Swagger.Nullable_Boolean;
Jcr_Content_Slashtrigger_Receive : in Swagger.Nullable_Boolean;
Jcr_Content_Slashtrigger_Specific : in Swagger.Nullable_Boolean;
Jcr_Content_Slashuser_Id : in Swagger.Nullable_UString;
Jcr_Primary_Type : in Swagger.Nullable_UString;
Operation : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Authorizable_Keystore
(Server : in out Server_Type;
Intermediate_Path : in Swagger.UString;
Authorizable_Id : in Swagger.UString;
Operation : in Swagger.Nullable_UString;
Current_Password : in Swagger.Nullable_UString;
New_Password : in Swagger.Nullable_UString;
Re_Password : in Swagger.Nullable_UString;
Key_Password : in Swagger.Nullable_UString;
Key_Store_Pass : in Swagger.Nullable_UString;
Alias : in Swagger.Nullable_UString;
New_Alias : in Swagger.Nullable_UString;
Remove_Alias : in Swagger.Nullable_UString;
Cert_Chain : in Swagger.File_Part_Type;
Pk : in Swagger.File_Part_Type;
Key_Store : in Swagger.File_Part_Type;
Result : out .Models.KeystoreInfo_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Authorizables
(Server : in out Server_Type;
Authorizable_Id : in Swagger.UString;
Intermediate_Path : in Swagger.UString;
Create_User : in Swagger.Nullable_UString;
Create_Group : in Swagger.Nullable_UString;
Rep_Password : in Swagger.Nullable_UString;
Profile_Slashgiven_Name : in Swagger.Nullable_UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Adobe_Granite_Saml_Authentication_Handler
(Server : in out Server_Type;
Key_Store_Password : in Swagger.Nullable_UString;
Key_Store_Password_At_Type_Hint : in Swagger.Nullable_UString;
Service_Periodranking : in Swagger.Nullable_Integer;
Service_Periodranking_At_Type_Hint : in Swagger.Nullable_UString;
Idp_Http_Redirect : in Swagger.Nullable_Boolean;
Idp_Http_Redirect_At_Type_Hint : in Swagger.Nullable_UString;
Create_User : in Swagger.Nullable_Boolean;
Create_User_At_Type_Hint : in Swagger.Nullable_UString;
Default_Redirect_Url : in Swagger.Nullable_UString;
Default_Redirect_Url_At_Type_Hint : in Swagger.Nullable_UString;
User_I_D_Attribute : in Swagger.Nullable_UString;
User_I_D_Attribute_At_Type_Hint : in Swagger.Nullable_UString;
Default_Groups : in Swagger.UString_Vectors.Vector;
Default_Groups_At_Type_Hint : in Swagger.Nullable_UString;
Idp_Cert_Alias : in Swagger.Nullable_UString;
Idp_Cert_Alias_At_Type_Hint : in Swagger.Nullable_UString;
Add_Group_Memberships : in Swagger.Nullable_Boolean;
Add_Group_Memberships_At_Type_Hint : in Swagger.Nullable_UString;
Path : in Swagger.UString_Vectors.Vector;
Path_At_Type_Hint : in Swagger.Nullable_UString;
Synchronize_Attributes : in Swagger.UString_Vectors.Vector;
Synchronize_Attributes_At_Type_Hint : in Swagger.Nullable_UString;
Clock_Tolerance : in Swagger.Nullable_Integer;
Clock_Tolerance_At_Type_Hint : in Swagger.Nullable_UString;
Group_Membership_Attribute : in Swagger.Nullable_UString;
Group_Membership_Attribute_At_Type_Hint : in Swagger.Nullable_UString;
Idp_Url : in Swagger.Nullable_UString;
Idp_Url_At_Type_Hint : in Swagger.Nullable_UString;
Logout_Url : in Swagger.Nullable_UString;
Logout_Url_At_Type_Hint : in Swagger.Nullable_UString;
Service_Provider_Entity_Id : in Swagger.Nullable_UString;
Service_Provider_Entity_Id_At_Type_Hint : in Swagger.Nullable_UString;
Assertion_Consumer_Service_U_R_L : in Swagger.Nullable_UString;
Assertion_Consumer_Service_U_R_L_At_Type_Hint : in Swagger.Nullable_UString;
Handle_Logout : in Swagger.Nullable_Boolean;
Handle_Logout_At_Type_Hint : in Swagger.Nullable_UString;
Sp_Private_Key_Alias : in Swagger.Nullable_UString;
Sp_Private_Key_Alias_At_Type_Hint : in Swagger.Nullable_UString;
Use_Encryption : in Swagger.Nullable_Boolean;
Use_Encryption_At_Type_Hint : in Swagger.Nullable_UString;
Name_Id_Format : in Swagger.Nullable_UString;
Name_Id_Format_At_Type_Hint : in Swagger.Nullable_UString;
Digest_Method : in Swagger.Nullable_UString;
Digest_Method_At_Type_Hint : in Swagger.Nullable_UString;
Signature_Method : in Swagger.Nullable_UString;
Signature_Method_At_Type_Hint : in Swagger.Nullable_UString;
User_Intermediate_Path : in Swagger.Nullable_UString;
User_Intermediate_Path_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Apache_Felix_Jetty_Based_Http_Service
(Server : in out Server_Type;
Org_Periodapache_Periodfelix_Periodhttps_Periodnio : in Swagger.Nullable_Boolean;
Org_Periodapache_Periodfelix_Periodhttps_Periodnio_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodpassword : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey_Periodpassword : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore_Periodpassword : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodclientcertificate : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodclientcertificate_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodapache_Periodfelix_Periodhttps_Periodenable : in Swagger.Nullable_Boolean;
Org_Periodapache_Periodfelix_Periodhttps_Periodenable_At_Type_Hint : in Swagger.Nullable_UString;
Org_Periodosgi_Periodservice_Periodhttp_Periodport_Periodsecure : in Swagger.Nullable_UString;
Org_Periodosgi_Periodservice_Periodhttp_Periodport_Periodsecure_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Apache_Http_Components_Proxy_Configuration
(Server : in out Server_Type;
Proxy_Periodhost : in Swagger.Nullable_UString;
Proxy_Periodhost_At_Type_Hint : in Swagger.Nullable_UString;
Proxy_Periodport : in Swagger.Nullable_Integer;
Proxy_Periodport_At_Type_Hint : in Swagger.Nullable_UString;
Proxy_Periodexceptions : in Swagger.UString_Vectors.Vector;
Proxy_Periodexceptions_At_Type_Hint : in Swagger.Nullable_UString;
Proxy_Periodenabled : in Swagger.Nullable_Boolean;
Proxy_Periodenabled_At_Type_Hint : in Swagger.Nullable_UString;
Proxy_Perioduser : in Swagger.Nullable_UString;
Proxy_Perioduser_At_Type_Hint : in Swagger.Nullable_UString;
Proxy_Periodpassword : in Swagger.Nullable_UString;
Proxy_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Apache_Sling_Dav_Ex_Servlet
(Server : in out Server_Type;
Alias : in Swagger.Nullable_UString;
Alias_At_Type_Hint : in Swagger.Nullable_UString;
Dav_Periodcreate_Absolute_Uri : in Swagger.Nullable_Boolean;
Dav_Periodcreate_Absolute_Uri_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Apache_Sling_Get_Servlet
(Server : in out Server_Type;
Json_Periodmaximumresults : in Swagger.Nullable_UString;
Json_Periodmaximumresults_At_Type_Hint : in Swagger.Nullable_UString;
Enable_Periodhtml : in Swagger.Nullable_Boolean;
Enable_Periodhtml_At_Type_Hint : in Swagger.Nullable_UString;
Enable_Periodtxt : in Swagger.Nullable_Boolean;
Enable_Periodtxt_At_Type_Hint : in Swagger.Nullable_UString;
Enable_Periodxml : in Swagger.Nullable_Boolean;
Enable_Periodxml_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Config_Apache_Sling_Referrer_Filter
(Server : in out Server_Type;
Allow_Periodempty : in Swagger.Nullable_Boolean;
Allow_Periodempty_At_Type_Hint : in Swagger.Nullable_UString;
Allow_Periodhosts : in Swagger.Nullable_UString;
Allow_Periodhosts_At_Type_Hint : in Swagger.Nullable_UString;
Allow_Periodhosts_Periodregexp : in Swagger.Nullable_UString;
Allow_Periodhosts_Periodregexp_At_Type_Hint : in Swagger.Nullable_UString;
Filter_Periodmethods : in Swagger.Nullable_UString;
Filter_Periodmethods_At_Type_Hint : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Node
(Server : in out Server_Type;
Path : in Swagger.UString;
Name : in Swagger.UString;
Operation : in Swagger.Nullable_UString;
Delete_Authorizable : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Node_Rw
(Server : in out Server_Type;
Path : in Swagger.UString;
Name : in Swagger.UString;
Add_Members : in Swagger.Nullable_UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Path
(Server : in out Server_Type;
Path : in Swagger.UString;
Jcr_Primary_Type : in Swagger.UString;
Name : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Query
(Server : in out Server_Type;
Path : in Swagger.UString;
P_Periodlimit : in Swagger.Number;
1_Property : in Swagger.UString;
1_Property_Periodvalue : in Swagger.UString;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Tree_Activation
(Server : in out Server_Type;
Ignoredeactivated : in Boolean;
Onlymodified : in Boolean;
Path : in Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Truststore
(Server : in out Server_Type;
Operation : in Swagger.Nullable_UString;
New_Password : in Swagger.Nullable_UString;
Re_Password : in Swagger.Nullable_UString;
Key_Store_Type : in Swagger.Nullable_UString;
Remove_Alias : in Swagger.Nullable_UString;
Certificate : in Swagger.File_Part_Type;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
--
overriding
procedure Post_Truststore_P_K_C_S12
(Server : in out Server_Type;
Truststore_Periodp12 : in Swagger.File_Part_Type;
Result : out Swagger.UString;
Context : in out Swagger.Servers.Context_Type);
package Server_Impl is
new .Skeletons.Shared_Instance (Server_Type);
end .Servers;
|
Rodeo-McCabe/orka | Ada | 6,359 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Text_IO;
with GL.Types;
with GL.Toggles;
with Orka.Cameras.Rotate_Around_Cameras;
with Orka.Contexts;
with Orka.Rendering.Buffers;
with Orka.Rendering.Drawing;
with Orka.Rendering.Framebuffers;
with Orka.Rendering.Programs.Modules;
with Orka.Rendering.Programs.Uniforms;
with Orka.Resources.Locations.Directories;
with Orka.Transforms.Doubles.Vector_Conversions;
with Orka.Transforms.Singles.Matrices;
with Orka.Types;
with Orka.Windows.GLFW;
-- In this example we render many instances of a cube, each at a different
-- position.
procedure Orka_Test.Test_11_Instancing is
Width : constant := 500;
Height : constant := 500;
Library : constant Orka.Contexts.Library'Class
:= Orka.Windows.GLFW.Initialize (Major => 4, Minor => 2);
Window : aliased Orka.Windows.Window'Class
:= Library.Create_Window (Width => Width, Height => Height, Resizable => False);
Context : constant Orka.Contexts.Context'Class := Window.Context;
use Orka.Rendering.Buffers;
use Orka.Rendering.Framebuffers;
use Orka.Rendering.Programs;
use GL.Types;
Instances_Dimension : constant := 40;
Space_Between_Cubes : constant := 0.2;
function Create_Matrices return Orka.Types.Singles.Matrix4_Array is
package Transforms renames Orka.Transforms.Singles.Matrices;
Distance_Multiplier : constant := 1.0 + Space_Between_Cubes;
Matrices : Orka.Types.Singles.Matrix4_Array (1 .. Instances_Dimension**3);
Index : Int := Matrices'First;
X, Y, Z : Single;
Offset : constant := Instances_Dimension / 2;
begin
for Index_X in 1 .. Instances_Dimension loop
X := Single (Index_X - Offset) * Distance_Multiplier;
for Index_Y in 1 .. Instances_Dimension loop
Y := Single (Index_Y - Offset) * Distance_Multiplier;
for Index_Z in 1 .. Instances_Dimension loop
Z := Single (Index_Z - Offset) * Distance_Multiplier;
Matrices (Index) := Transforms.T ((X, Y, Z, 0.0));
Index := Index + 1;
end loop;
end loop;
end loop;
return Matrices;
end Create_Matrices;
Indices : constant UInt_Array
:= (1, 2, 0, -- Back
0, 2, 3,
1, 0, 5, -- Top
5, 0, 4,
5, 4, 6, -- Front
6, 4, 7,
1, 5, 2, -- Right
2, 5, 6,
7, 4, 3, -- Left
3, 4, 0,
3, 2, 7, -- Bottom
7, 2, 6);
Vertices : constant Single_Array
:= (-0.5, 0.5, -0.5, 1.0, 1.0, 1.0, 1.0, 1.0,
0.5, 0.5, -0.5, 1.0, 0.0, 1.0, 0.0, 1.0,
0.5, -0.5, -0.5, 1.0, 0.0, 0.0, 1.0, 1.0,
-0.5, -0.5, -0.5, 1.0, 1.0, 0.0, 0.0, 1.0,
-0.5, 0.5, 0.5, 1.0, 0.0, 0.0, 1.0, 1.0,
0.5, 0.5, 0.5, 1.0, 1.0, 0.0, 0.0, 1.0,
0.5, -0.5, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0,
-0.5, -0.5, 0.5, 1.0, 0.0, 1.0, 0.0, 1.0);
-- vec4 in_Position
-- vec4 in_Color
Matrices : constant Orka.Types.Singles.Matrix4_Array := Create_Matrices;
-- Create buffers containing attributes and indices
Buffer_1 : constant Buffer := Create_Buffer ((others => False), Vertices);
Buffer_2 : constant Buffer := Create_Buffer ((others => False), Indices);
Buffer_3 : constant Buffer := Create_Buffer ((others => False), Matrices);
use Orka.Resources;
Location_Shaders : constant Locations.Location_Ptr
:= Locations.Directories.Create_Location ("../examples/gl/shaders");
Program_1 : Program := Create_Program (Modules.Create_Module
(Location_Shaders, VS => "instancing.vert", FS => "instancing.frag"));
Uni_View : constant Uniforms.Uniform := Program_1.Uniform ("view");
Uni_Proj : constant Uniforms.Uniform := Program_1.Uniform ("proj");
FB_D : Framebuffer := Create_Default_Framebuffer (Width, Height);
use Orka.Cameras;
Lens : constant Lens_Ptr
:= new Camera_Lens'Class'(Create_Lens (Width, Height, 45.0, Context));
Current_Camera : constant Camera_Ptr
:= new Camera'Class'(Camera'Class
(Rotate_Around_Cameras.Create_Camera (Window.Pointer_Input, Lens, FB_D)));
begin
Ada.Text_IO.Put_Line ("Instances of cube: " & Positive'Image (Matrices'Length));
declare
Distance_Center : Double := Double (Instances_Dimension);
begin
Distance_Center := Distance_Center + (Distance_Center - 1.0) * Space_Between_Cubes;
Rotate_Around_Cameras.Rotate_Around_Camera (Current_Camera.all).Set_Radius
(1.5 * Distance_Center);
end;
FB_D.Set_Default_Values ((Color => (0.0, 0.0, 0.0, 1.0), Depth => 1.0, others => <>));
Program_1.Use_Program;
-- Projection matrix
Uni_Proj.Set_Matrix (Current_Camera.Projection_Matrix);
GL.Toggles.Enable (GL.Toggles.Cull_Face);
GL.Toggles.Enable (GL.Toggles.Depth_Test);
Buffer_1.Bind (Shader_Storage, 0);
Buffer_3.Bind (Shader_Storage, 1);
while not Window.Should_Close loop
Window.Process_Input;
Current_Camera.Update (0.01666);
declare
VP : constant Transforms.Vector4 :=
Orka.Transforms.Doubles.Vector_Conversions.Convert (Current_Camera.View_Position);
use Transforms.Vectors;
use Transforms;
TM : constant Transforms.Matrix4 := Transforms.T (Transforms.Zero_Point - VP);
begin
Uni_View.Set_Matrix (Current_Camera.View_Matrix * TM);
end;
FB_D.Clear ((Color | Depth => True, others => False));
Orka.Rendering.Drawing.Draw_Indexed (Triangles, Buffer_2, 0, Indices'Length, Matrices'Length);
-- Swap front and back buffers and process events
Window.Swap_Buffers;
end loop;
end Orka_Test.Test_11_Instancing;
|
Fabien-Chouteau/samd51-hal | Ada | 6,188 | ads | pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.FREQM is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Control A Register
type FREQM_CTRLA_Register is record
-- Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for FREQM_CTRLA_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Control B Register
type FREQM_CTRLB_Register is record
-- Write-only. Start Measurement
START : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for FREQM_CTRLB_Register use record
START at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
subtype FREQM_CFGA_REFNUM_Field is HAL.UInt8;
-- Config A register
type FREQM_CFGA_Register is record
-- Number of Reference Clock Cycles
REFNUM : FREQM_CFGA_REFNUM_Field := 16#0#;
-- unspecified
Reserved_8_15 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for FREQM_CFGA_Register use record
REFNUM at 0 range 0 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
end record;
-- Interrupt Enable Clear Register
type FREQM_INTENCLR_Register is record
-- Measurement Done Interrupt Enable
DONE : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for FREQM_INTENCLR_Register use record
DONE at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Enable Set Register
type FREQM_INTENSET_Register is record
-- Measurement Done Interrupt Enable
DONE : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for FREQM_INTENSET_Register use record
DONE at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Flag Register
type FREQM_INTFLAG_Register is record
-- Measurement Done
DONE : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for FREQM_INTFLAG_Register use record
DONE at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Status Register
type FREQM_STATUS_Register is record
-- FREQM Status
BUSY : Boolean := False;
-- Sticky Count Value Overflow
OVF : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for FREQM_STATUS_Register use record
BUSY at 0 range 0 .. 0;
OVF at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Synchronization Busy Register
type FREQM_SYNCBUSY_Register is record
-- Read-only. Software Reset
SWRST : Boolean;
-- Read-only. Enable
ENABLE : Boolean;
-- unspecified
Reserved_2_31 : HAL.UInt30;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FREQM_SYNCBUSY_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype FREQM_VALUE_VALUE_Field is HAL.UInt24;
-- Count Value Register
type FREQM_VALUE_Register is record
-- Read-only. Measurement Value
VALUE : FREQM_VALUE_VALUE_Field;
-- unspecified
Reserved_24_31 : HAL.UInt8;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FREQM_VALUE_Register use record
VALUE at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Frequency Meter
type FREQM_Peripheral is record
-- Control A Register
CTRLA : aliased FREQM_CTRLA_Register;
-- Control B Register
CTRLB : aliased FREQM_CTRLB_Register;
-- Config A register
CFGA : aliased FREQM_CFGA_Register;
-- Interrupt Enable Clear Register
INTENCLR : aliased FREQM_INTENCLR_Register;
-- Interrupt Enable Set Register
INTENSET : aliased FREQM_INTENSET_Register;
-- Interrupt Flag Register
INTFLAG : aliased FREQM_INTFLAG_Register;
-- Status Register
STATUS : aliased FREQM_STATUS_Register;
-- Synchronization Busy Register
SYNCBUSY : aliased FREQM_SYNCBUSY_Register;
-- Count Value Register
VALUE : aliased FREQM_VALUE_Register;
end record
with Volatile;
for FREQM_Peripheral use record
CTRLA at 16#0# range 0 .. 7;
CTRLB at 16#1# range 0 .. 7;
CFGA at 16#2# range 0 .. 15;
INTENCLR at 16#8# range 0 .. 7;
INTENSET at 16#9# range 0 .. 7;
INTFLAG at 16#A# range 0 .. 7;
STATUS at 16#B# range 0 .. 7;
SYNCBUSY at 16#C# range 0 .. 31;
VALUE at 16#10# range 0 .. 31;
end record;
-- Frequency Meter
FREQM_Periph : aliased FREQM_Peripheral
with Import, Address => FREQM_Base;
end SAM_SVD.FREQM;
|
reznikmm/matreshka | Ada | 4,089 | 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.Presentation_Class_Names_Attributes;
package Matreshka.ODF_Presentation.Class_Names_Attributes is
type Presentation_Class_Names_Attribute_Node is
new Matreshka.ODF_Presentation.Abstract_Presentation_Attribute_Node
and ODF.DOM.Presentation_Class_Names_Attributes.ODF_Presentation_Class_Names_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Presentation_Class_Names_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Presentation_Class_Names_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Presentation.Class_Names_Attributes;
|
AdaCore/gpr | Ada | 3,385 | adb |
with Ada.Finalization; use Ada.Finalization;
with Ada.Text_IO; use Ada.Text_IO;
with Dash_Board;
package body Gauge is
use InDash;
package Percent_IO is new Decimal_IO (Percent);
use Percent_IO;
type Life_Controller is new Limited_Controlled with null record;
overriding procedure Initialize (LC : in out Life_Controller);
overriding procedure Finalize (LC : in out Life_Controller);
F, W : Any_Instrument;
------------------------
-- Make_Numeric_Gauge --
------------------------
function Make_Numeric_Gauge
(Name : String; Value : Percent; Rate : Float) return Any_Instrument
is
Result : Numeric_Gauge_Reference;
begin
Result := new Numeric_Gauge;
InDash.Any_Instrument(Result).Set_Name (Name);
Result.Value := Value;
Result.Rate := Rate;
return Any_Instrument (Result);
end Make_Numeric_Gauge;
------------------------
-- Make_Graphic_Gauge --
------------------------
function Make_Graphic_Gauge
(Name : String;
Value : Percent;
Rate : Float;
Size : Integer;
Fill : Character := '*';
Empty : Character := ' ') return Any_Instrument
is
Result : Graphic_Gauge_Reference;
begin
Result := new Graphic_Gauge;
InDash.Any_Instrument(Result).Set_Name (Name);
Result.Value := Value;
Result.Rate := Rate;
Result.Size := Size;
Result.Fill := Fill;
Result.Empty := Empty;
return Any_Instrument (Result);
end Make_Graphic_Gauge;
----------------
-- Initialize --
----------------
overriding procedure Initialize (LC : in out Life_Controller) is
begin
F := Make_Numeric_Gauge ("Fuel", 60.0, 1.0);
Dash_Board.Register (F);
W := Make_Graphic_Gauge ("Water", 80.0, 2.0, 20);
Dash_Board.Register (W);
-- O := Make_Graphic_Gauge ("Oil", 40.0, 2.0, 20);
-- Dash_Board.Register (O);
end Initialize;
--------------
-- Finalize --
--------------
overriding procedure Finalize (LC : in out Life_Controller) is
begin
Put_Line ("Unregister Gauge");
Dash_Board.Unregister (F);
Dash_Board.Unregister (W);
-- Dash_Board.Unregister (O);
end Finalize;
-------------
-- Display --
-------------
procedure Display (G : access Numeric_Gauge) is
begin
InDash.Instrument_Reference (G).Display;
Put (G.Value, 3);
Put (" %");
end Display;
------------
-- Update --
------------
procedure Update (G : access Numeric_Gauge; Millisec : Integer) is
Elapsed_Seconds : constant Float := Float(Millisec) / 1000.0;
Elapsed_Minutes : constant Float := Elapsed_Seconds / 60.0;
begin
G.Value := G.Value - Percent(G.Rate * Elapsed_Minutes);
end Update;
-------------
-- Display --
-------------
procedure Display (G : access Graphic_Gauge) is
Lg : constant Integer := G.Size * Integer(G.Value) / 100;
S1 : constant String (1 .. Lg) := (others => G.Fill);
S2 : constant String (Lg + 1 .. G.Size) := (others => G.Empty);
begin
InDash.Instrument_Reference (G).Display;
Put ('<');
Put (S1);
Put (S2);
Put ('>');
end Display;
-- Declared at the end to ensure all routines are elaborated before
-- calling them.
LC : Life_Controller;
end Gauge;
|
optikos/oasis | Ada | 5,477 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Defining_Identifiers;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
with Program.Elements.Generalized_Iterator_Specifications;
with Program.Element_Visitors;
package Program.Nodes.Generalized_Iterator_Specifications is
pragma Preelaborate;
type Generalized_Iterator_Specification is
new Program.Nodes.Node
and Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification
and Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Text
with private;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
In_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access;
Iterator_Name : not null Program.Elements.Expressions.Expression_Access)
return Generalized_Iterator_Specification;
type Implicit_Generalized_Iterator_Specification is
new Program.Nodes.Node
and Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification
with private;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Iterator_Name : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_Reverse : Boolean := False)
return Implicit_Generalized_Iterator_Specification
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Generalized_Iterator_Specification is
abstract new Program.Nodes.Node
and Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification
with record
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Iterator_Name : not null Program.Elements.Expressions
.Expression_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Generalized_Iterator_Specification'Class);
overriding procedure Visit
(Self : not null access Base_Generalized_Iterator_Specification;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Generalized_Iterator_Specification)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
overriding function Iterator_Name
(Self : Base_Generalized_Iterator_Specification)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Generalized_Iterator_Specification_Element
(Self : Base_Generalized_Iterator_Specification)
return Boolean;
overriding function Is_Declaration_Element
(Self : Base_Generalized_Iterator_Specification)
return Boolean;
type Generalized_Iterator_Specification is
new Base_Generalized_Iterator_Specification
and Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Text
with record
In_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Generalized_Iterator_Specification_Text
(Self : aliased in out Generalized_Iterator_Specification)
return Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Text_Access;
overriding function In_Token
(Self : Generalized_Iterator_Specification)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Reverse_Token
(Self : Generalized_Iterator_Specification)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Has_Reverse
(Self : Generalized_Iterator_Specification)
return Boolean;
type Implicit_Generalized_Iterator_Specification is
new Base_Generalized_Iterator_Specification
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
Has_Reverse : Boolean;
end record;
overriding function To_Generalized_Iterator_Specification_Text
(Self : aliased in out Implicit_Generalized_Iterator_Specification)
return Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Generalized_Iterator_Specification)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Generalized_Iterator_Specification)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Generalized_Iterator_Specification)
return Boolean;
overriding function Has_Reverse
(Self : Implicit_Generalized_Iterator_Specification)
return Boolean;
end Program.Nodes.Generalized_Iterator_Specifications;
|
ohenley/awt | Ada | 2,183 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Strings.Unbounded;
with AWT.Inputs;
package AWT.Drag_And_Drop is
package SU renames Ada.Strings.Unbounded;
type Receive_Callback is access protected procedure (Value : SU.Unbounded_String);
use all type AWT.Inputs.Action_Kind;
function Supported_Actions return AWT.Inputs.Actions;
function Valid_Action return AWT.Inputs.Action_Kind;
procedure Set_Action (Action : AWT.Inputs.Action_Kind);
-- Set the requested action that must happen when the user
-- drops something on the current focused window
procedure Finish (Action : AWT.Inputs.Action_Kind)
with Pre => Action /= Ask and Valid_Action /= None;
-- Finish the current drag-and-drop operation.
--
-- To accept the operation, use Copy or Move. If the last set
-- action was Ask, then the value may either be Copy or Move,
-- otherwise it must match the last set action.
--
-- To reject the operation, use None.
procedure Get (Callback : not null Receive_Callback)
with Pre => Valid_Action /= None;
-- Receive data from a drag-and-drop operation
--
-- Before calling this procedure, call function Valid_Actions
-- to determine what kind of operation needs to take place. If "Ask" is
-- true, then the application may want to show menu to let the user
-- choose.
--
-- After the given callback has been executed, finish the operation
-- by calling Finish to accept or reject the received data.
function Get return String;
end AWT.Drag_And_Drop;
|
reznikmm/matreshka | Ada | 6,504 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A package import is a relationship that allows the use of unqualified
-- names to refer to package members from other namespaces.
------------------------------------------------------------------------------
with AMF.UML.Directed_Relationships;
limited with AMF.UML.Namespaces;
limited with AMF.UML.Packages;
package AMF.UML.Package_Imports is
pragma Preelaborate;
type UML_Package_Import is limited interface
and AMF.UML.Directed_Relationships.UML_Directed_Relationship;
type UML_Package_Import_Access is
access all UML_Package_Import'Class;
for UML_Package_Import_Access'Storage_Size use 0;
not overriding function Get_Imported_Package
(Self : not null access constant UML_Package_Import)
return AMF.UML.Packages.UML_Package_Access is abstract;
-- Getter of PackageImport::importedPackage.
--
-- Specifies the Package whose members are imported into a Namespace.
not overriding procedure Set_Imported_Package
(Self : not null access UML_Package_Import;
To : AMF.UML.Packages.UML_Package_Access) is abstract;
-- Setter of PackageImport::importedPackage.
--
-- Specifies the Package whose members are imported into a Namespace.
not overriding function Get_Importing_Namespace
(Self : not null access constant UML_Package_Import)
return AMF.UML.Namespaces.UML_Namespace_Access is abstract;
-- Getter of PackageImport::importingNamespace.
--
-- Specifies the Namespace that imports the members from a Package.
not overriding procedure Set_Importing_Namespace
(Self : not null access UML_Package_Import;
To : AMF.UML.Namespaces.UML_Namespace_Access) is abstract;
-- Setter of PackageImport::importingNamespace.
--
-- Specifies the Namespace that imports the members from a Package.
not overriding function Get_Visibility
(Self : not null access constant UML_Package_Import)
return AMF.UML.UML_Visibility_Kind is abstract;
-- Getter of PackageImport::visibility.
--
-- Specifies the visibility of the imported PackageableElements within the
-- importing Namespace, i.e., whether imported elements will in turn be
-- visible to other packages that use that importingPackage as an
-- importedPackage. If the PackageImport is public, the imported elements
-- will be visible outside the package, while if it is private they will
-- not.
not overriding procedure Set_Visibility
(Self : not null access UML_Package_Import;
To : AMF.UML.UML_Visibility_Kind) is abstract;
-- Setter of PackageImport::visibility.
--
-- Specifies the visibility of the imported PackageableElements within the
-- importing Namespace, i.e., whether imported elements will in turn be
-- visible to other packages that use that importingPackage as an
-- importedPackage. If the PackageImport is public, the imported elements
-- will be visible outside the package, while if it is private they will
-- not.
end AMF.UML.Package_Imports;
|
godunko/cga | Ada | 1,441 | adb | --
-- Copyright (C) 2023, Vadim Godunko <[email protected]>
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
with CGK.Primitives.Directions_2D;
with CGK.Primitives.XYs;
package body CGK.Primitives.Line_Segments_2D.Builders is
use CGK.Primitives.Axes_2D;
use CGK.Primitives.Directions_2D;
use CGK.Primitives.Points_2D;
use CGK.Primitives.XYs;
use CGK.Reals;
-----------
-- Build --
-----------
procedure Build
(Self : in out Line_Segment_2D_Builder;
Point_1 : CGK.Primitives.Points_2D.Point_2D;
Point_2 : CGK.Primitives.Points_2D.Point_2D)
is
D : constant Real := Distance (Point_1, Point_2);
begin
if D >= Resolution then
Self.Segment :=
Create_Line_Segment_2D
(Create_Axis_2D
(Point_1,
Create_Direction_2D
(Points_2D.XY (Point_2) - Points_2D.XY (Point_1))),
0.0,
D);
Self.State := Valid;
else
Self.State := Confused_Points_Error;
end if;
end Build;
------------------
-- Line_Segment --
------------------
function Line_Segment
(Self : Line_Segment_2D_Builder)
return CGK.Primitives.Line_Segments_2D.Line_Segment_2D is
begin
Assert_Invalid_State_Error (Self.State = Valid);
return Self.Segment;
end Line_Segment;
end CGK.Primitives.Line_Segments_2D.Builders;
|
reznikmm/matreshka | Ada | 6,137 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Matreshka.Internals.Strings.Operations is
pragma Preelaborate;
procedure Append
(Self : in out not null Shared_String_Access;
Code : Matreshka.Internals.Unicode.Code_Point);
-- Appends character to the string, reallocate memory if needed.
procedure Unterminated_Append
(Self : in out not null Shared_String_Access;
Code : Matreshka.Internals.Unicode.Code_Point);
-- Appends character to the string, reallocate memory if needed. Null
-- terminator is not filled.
procedure Append
(Self : in out not null Shared_String_Access;
Item : Shared_String_Access);
-- Appends data from to Item to the string, reallocate string when needed.
procedure Prepend
(Target : in out not null Shared_String_Access;
Code : Matreshka.Internals.Unicode.Code_Point);
-- Prepends character to the string, reallocate memory if needed.
procedure Prepend
(Target : in out not null Shared_String_Access;
Item : Shared_String_Access);
-- Prepends data from to Item to the string, reallocate string when needed.
procedure Copy_Slice
(Self : in out not null Shared_String_Access;
Source : not null Shared_String_Access;
First : Matreshka.Internals.Utf16.Utf16_String_Index;
Size : Matreshka.Internals.Utf16.Utf16_String_Index;
Length : Natural);
-- Copy slice from the Source string into the string, reallocate string
-- when needed.
function Slice
(Source : not null Shared_String_Access;
First : Matreshka.Internals.Utf16.Utf16_String_Index;
Size : Matreshka.Internals.Utf16.Utf16_String_Index;
Length : Natural)
return not null Shared_String_Access;
-- Returns slice from First to First + Size - 1. Length specify expected
-- length of the result.
procedure Slice
(Item : in out not null Shared_String_Access;
First : Matreshka.Internals.Utf16.Utf16_String_Index;
Size : Matreshka.Internals.Utf16.Utf16_String_Index;
Length : Natural);
-- Sets Item to its slice from First to First + Size - 1. Length specify
-- expected length of the result.
procedure Replace
(String : in out not null Shared_String_Access;
First : Matreshka.Internals.Utf16.Utf16_String_Index;
Size : Matreshka.Internals.Utf16.Utf16_String_Index;
Length : Natural;
By : not null Shared_String_Access);
procedure Reset (Self : in out not null Shared_String_Access);
-- Resets specified shared string to have empty length or sets it to
-- shared empty string when shared string is used.
-- function Copy (Source : not null String_Private_Data_Access)
-- return not null String_Private_Data_Access;
-- Creates copy of string data.
end Matreshka.Internals.Strings.Operations;
|
jscparker/math_packages | Ada | 11,380 | adb |
-- Tests LU decomposition on a real valued banded matrix.
--
-- Shows how interative refinement can clean up the mess when no
-- pivoting is used in LU decomposition. Also shows that iterative
-- refinement is ineffective if the problem is ill-conditioned.
-- (Pivoting doesn't solve the problem of ill-conditioning either.)
with Banded_LU;
With Text_IO; use Text_IO;
procedure banded_lu_demo_1 is
type Real is digits 15;
-- Create a data structure for making banded matrices.
No_Of_Off_Diagonals : constant Integer := 20; -- if 1, it's tri-diagonal
Max_Size_Of_Matrix : constant Integer := 150;
package lu is new Banded_LU (Real, Max_Size_Of_Matrix, No_Of_Off_Diagonals);
use lu;
package rio is new Float_IO(Real);
use rio;
package iio is new Integer_IO(Integer);
use iio;
type Matrix is array(Index) of Column; -- not type Banded_Matrix
Starting_Index : constant Index := Index'First + 10;
Max_Index : constant Index := Index'Last - 10;
C_band : Banded_Matrix := (others => (others => 0.0)); -- exported by LU
C_full : Matrix := (others => (others => 0.0));
C_Inverse : Matrix := (others => (others => 0.0));
No_Of_Iterations : Integer := 0;
Off_Factor : Real;
Sum, Del, Error_Off_Diag, Error_Diag, Max_Error : Real;
-----------
-- Pause --
-----------
procedure Pause (s1,s2,s3,s4,s5,s6,s7,s8,s9 : string := "") is
Continue : Character := ' ';
begin
new_line;
if S1 /= "" then put_line (S1); end if;
if S2 /= "" then put_line (S2); end if;
if S3 /= "" then put_line (S3); end if;
if S4 /= "" then put_line (S4); end if;
if S5 /= "" then put_line (S5); end if;
if S6 /= "" then put_line (S6); end if;
if S7 /= "" then put_line (S7); end if;
if S8 /= "" then put_line (S8); end if;
if S9 /= "" then put_line (S9); end if;
new_line(1);
begin
put ("Type a character to continue: ");
get_Immediate (Continue);
new_line(1);
exception
when others => null;
end;
end pause;
------------
-- Invert --
------------
-- Get Inverse of the Matrix:
procedure Invert
(M : in Banded_Matrix;
M_Inv : out Matrix;
Max_Index : in Index;
Starting_Index : in Index;
Max_Error : out Real;
No_Of_Iterations : in Integer)
is
Unit_Vector, Solution_Vector, Error, Diag_Inverse : Column;
Zero_Vector : constant Column := (others => 0.0);
M_LU : Banded_Matrix := M;
begin
Max_Error := 0.0;
LU_decompose (M_LU, Diag_Inverse, Max_Index, Starting_Index);
for I in Starting_Index..Max_Index loop
Unit_Vector := Zero_Vector;
Unit_Vector(I) := 1.0;
--Solve(Solution_Vector, Unit_Vector, M_LU, Diag_Inverse, M,
-- Max_Index, Starting_Index);
Refine_Solution
(Solution_Vector, Unit_Vector, M_LU, Diag_Inverse, M,
No_Of_Iterations, Max_Index, Starting_Index);
Error := Product (M, Solution_Vector, Max_Index, Starting_Index);
for J in Starting_Index .. Max_Index loop
Error (J) := Error(J) - Unit_Vector(J);
end loop;
for I in Starting_Index .. Max_Index loop
if Abs(Error(I)) > Max_Error then
Max_Error := Abs(Error(I));
end if;
end loop;
-- Solution vector is the I-th column of M_Inverse:
for J in Starting_Index .. Max_Index loop
M_Inv (J)(I) := Solution_Vector(J);
end loop;
end loop;
end Invert;
-------------------------------------
-- Test_Inversion_On_Banded_Matrix --
-------------------------------------
procedure Test_Inversion_On_Banded_Matrix
(Off_Factor : in Real;
No_Of_Iterations : in Integer)
is
begin
-- construct matrix.
C_band := (others => (others => 0.0));
C_full := (others => (others => 0.0));
for I in Index loop
C_band(I)(0) := 1.01010101010;
C_full(I)(I) := C_band(I)(0);
end loop;
for Diagonal in Diag_Index'First .. -1 loop
for Row in Index'First - Diagonal .. Index'Last loop
C_full(Row)(Diagonal + Row)
:= 0.033 * Real(Row) / Real(Index'Last)
+ Off_Factor / Abs Real(Diagonal);
C_band(Row)(Diagonal)
:= 0.033 * Real(Row) / Real(Index'Last)
+ Off_Factor / Abs Real(Diagonal);
end loop;
end loop;
for Diagonal in 1 .. Diag_Index'Last loop
for Row in Index'First .. Index'Last - Diagonal loop
C_full(Row)(Diagonal + Row)
:= 0.013 * Real(Row) / Real(Index'Last)
+ Off_Factor / Abs Real(Diagonal) + 0.3;
C_band(Row)(Diagonal)
:= 0.013 * Real(Row) / Real(Index'Last)
+ Off_Factor / Abs Real(Diagonal) + 0.3;
end loop;
end loop;
-- Test Matrix_Val procedure:
for Row in Index loop
for Col in Index loop
if Abs (C_full(Row)(Col) - Matrix_Val (C_band, Row, Col)) > 1.0e14 then
put_line("Some error in procedure Matrix_Val or ... ");
end if;
end loop;
end loop;
-- Construct inverse of C_band:
Invert (C_band, C_Inverse, Max_Index, Starting_Index, Max_Error, No_Of_Iterations);
pause("We just took the matrix inverse. Error estimate follows.");
new_line(2);
put ("Max Error according to Residual function is: "); put (Max_Error);
new_line;
-- Multiply Original C_band and C_Inverse as test. Get Max error:
Error_Off_Diag := 0.0;
Error_Diag := 0.0;
for I in Starting_Index..Max_Index loop
for J in Starting_Index..Max_Index loop
Sum := 0.0;
for K in Starting_Index..Max_Index loop
Sum := Sum + C_Inverse(I)(k) * C_full(k)(J);
end loop;
-- Product(I,J) := Sum;
-- The product should be the unit matrix. Calculate the error:
if I = J then
Del := Abs (Sum - 1.0);
if Del > Error_Diag then
Error_Diag := Del;
end if;
else
Del := Abs (Sum);
if Del > Error_Off_Diag then
Error_Off_Diag := Del;
end if;
end if;
end loop;
end loop;
pause
("We just took the product the inverse matrix with the original,",
"matrix and then calculated the difference between this product",
"and the unit matrix. The error is printed below.");
new_line;
put("Max error along diagonals of product: "); put(Error_Diag);
new_line;
put("Max error along off-diagonals of product: "); put(Error_Off_Diag);
new_line;
-- Multiply Original C and C_Inverse as test. Get Max error:
Error_Off_Diag := 0.0;
Error_Diag := 0.0;
for I in Starting_Index..Max_Index loop
for J in Starting_Index..Max_Index loop
Sum := 0.0;
for K in Starting_Index..Max_Index loop
Sum := Sum + C_full(I)(K) * C_Inverse(K)(J);
end loop;
-- Product(I,J) := Sum;
-- The product should be the unit matrix. Calculate the error:
if I = J then
Del := Abs (Sum - 1.0);
if Del > Error_Diag then
Error_Diag := Del;
end if;
ELSE
Del := Abs (Sum);
if Del > Error_Off_Diag then
Error_Off_Diag := Del;
end if;
end if;
end loop;
end loop;
pause
("We just took the product the original matrix with the inverse matrix,",
"and then calculated the difference between this product and",
"the unit matrix. The error is printed below.");
new_line;
put("Max error along diagonals of product: "); put(Error_Diag);
new_line;
put("Max error along off-diagonals of product: "); put(Error_Off_Diag);
new_line;
end Test_Inversion_On_Banded_Matrix;
begin
--put("Input Size Of Matrix To Invert (enter an Integer)"); new_line;
--get(IO_Max_Index);
--Max_Index := Index'First + Index (IO_Max_Index-1);
pause
("The first example demonstrates LU decomposition and inversion of",
"of a diagonally dominant matrix. The off-diagonals of the matrix",
"are all multiplied by 0.5 to make them fall off fast enough for",
"diagonal dominance (i.e. Off_Factor = 0.5). No iterative refinement",
"is done. (i.e. No_Of_Iterations = 0).");
Off_Factor := 0.5;
No_Of_Iterations := 0;
Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations);
pause
("The 2nd example demonstrates LU decomposition and inversion of",
"a non-diagonally dominant matrix. The off-diagonals of the matrix",
"are all multiplied by 10_000_000_000.0 to make them far greater in value",
"than the diagonal (i.e. Off_Factor = 1.0e10). No iterative refinement",
"is done. (i.e. No_Of_Iterations = 0). A large amount of error should",
"be evident.");
Off_Factor := 10_000_000_000.0;
No_Of_Iterations := 0;
Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations);
pause
("The 3rd example demonstrates LU decomposition and inversion of",
"a non-diagonally dominant matrix along with iterative refinement. The",
"off-diagonals of the matrix are again multiplied by 1.0e10 to make",
"them far greater in value than the diagonal.",
"Two iterations of the iterative refinement procedure are performed. ",
"(i.e. No_Of_Iterations = 2). Error should be greatly reduced.");
Off_Factor := 10_000_000_000.0;
No_Of_Iterations := 2;
Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations);
pause
("The 4rth example demonstrates LU decomposition and inversion of",
"of a non-diagonally dominant matrix which is mildly ill-conditioned.",
"The off-diagonals of the matrix are multiplied by 0.8.",
"No iterative refinement is performed. (i.e. No_Of_Iterations = 0).",
"Large error should be evident.");
Off_Factor := 0.8;
No_Of_Iterations := 0;
Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations);
pause
("The final example demonstrates LU decomposition and inversion of",
"of a mildly ill-conditioned matrix along with iterative refinement.",
"The off-diagonals of the matrix are again multiplied by 0.8.",
"Iterative refinement is performed. (i.e. No_Of_Iterations = 1).",
"No amount of iterative refinement helps much here.");
Off_Factor := 0.8;
No_Of_Iterations := 1;
Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations);
new_line(2);
put ("Choose your own values for Off_Factor and No_Of_Iterations.");
new_line(2);
put ("Input factor for scaling the off diagonals (e.g. 1.0e13):");
get(Off_Factor);
new_line;
put("Input number of iterative refinements of the solution (e.g. 4):");
get(No_Of_Iterations);
new_line;
Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations);
end;
|
reznikmm/matreshka | Ada | 409 | adb | with Calc, calc_lex.IO, Text_IO;
procedure driver is
in_file_name: string(1..80);
last : natural;
begin
Text_IO.Put("Enter input file: ");
Text_IO.Get_Line(in_file_name, last);
calc_lex.IO.open_input(in_file_name(1..last));
--calc_lex.IO.open_input("/dev/tty");
calc_lex.IO.create_output;
Calc.yyparse;
calc_lex.IO.close_input;
calc_lex.IO.close_output;
end driver;
|
reznikmm/matreshka | Ada | 3,797 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Testsuite 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$
------------------------------------------------------------------------------
with League.Strings;
with Web_Services.SOAP.Payloads;
package SOAPConf.Payloads is
pragma Preelaborate;
type Echo_OK is
limited new Web_Services.SOAP.Payloads.Abstract_SOAP_Payload with record
Text : League.Strings.Universal_String;
end record;
type Response_OK is
limited new Web_Services.SOAP.Payloads.Abstract_SOAP_Payload with record
Text : League.Strings.Universal_String;
end record;
end SOAPConf.Payloads;
|
reznikmm/matreshka | Ada | 3,526 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009-2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Holders.Generic_Integers;
package League.Holders.Long_Integers is
new League.Holders.Generic_Integers (Long_Integer);
pragma Preelaborate (League.Holders.Long_Integers);
|
reznikmm/matreshka | Ada | 3,737 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
package AMF.Factories.DC_Factories is
pragma Preelaborate;
type DC_Factory is limited interface
and AMF.Factories.Factory;
type DC_Factory_Access is access all DC_Factory'Class;
for DC_Factory_Access'Storage_Size use 0;
end AMF.Factories.DC_Factories;
|
vikasbidhuri1995/DW1000 | Ada | 9,027 | ads | -- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- 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, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, 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 Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be
-- reverse engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR
-- ASA 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 spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces; use Interfaces;
with System;
-- nRF52832 reference description for radio MCU with ARM 32-bit Cortex-M4
-- Microcontroller
package NRF52 is
pragma Preelaborate;
---------------
-- Base type --
---------------
type UInt32 is new Interfaces.Unsigned_32;
type UInt16 is new Interfaces.Unsigned_16;
type Byte is new Interfaces.Unsigned_8;
type Bit is mod 2**1
with Size => 1;
type UInt2 is mod 2**2
with Size => 2;
type UInt3 is mod 2**3
with Size => 3;
type UInt4 is mod 2**4
with Size => 4;
type UInt5 is mod 2**5
with Size => 5;
type UInt6 is mod 2**6
with Size => 6;
type UInt7 is mod 2**7
with Size => 7;
type UInt9 is mod 2**9
with Size => 9;
type UInt10 is mod 2**10
with Size => 10;
type UInt11 is mod 2**11
with Size => 11;
type UInt12 is mod 2**12
with Size => 12;
type UInt13 is mod 2**13
with Size => 13;
type UInt14 is mod 2**14
with Size => 14;
type UInt15 is mod 2**15
with Size => 15;
type UInt17 is mod 2**17
with Size => 17;
type UInt18 is mod 2**18
with Size => 18;
type UInt19 is mod 2**19
with Size => 19;
type UInt20 is mod 2**20
with Size => 20;
type UInt21 is mod 2**21
with Size => 21;
type UInt22 is mod 2**22
with Size => 22;
type UInt23 is mod 2**23
with Size => 23;
type UInt24 is mod 2**24
with Size => 24;
type UInt25 is mod 2**25
with Size => 25;
type UInt26 is mod 2**26
with Size => 26;
type UInt27 is mod 2**27
with Size => 27;
type UInt28 is mod 2**28
with Size => 28;
type UInt29 is mod 2**29
with Size => 29;
type UInt30 is mod 2**30
with Size => 30;
type UInt31 is mod 2**31
with Size => 31;
--------------------
-- Base addresses --
--------------------
FICR_Base : constant System.Address := System'To_Address (16#10000000#);
UICR_Base : constant System.Address := System'To_Address (16#10001000#);
BPROT_Base : constant System.Address := System'To_Address (16#40000000#);
POWER_Base : constant System.Address := System'To_Address (16#40000000#);
CLOCK_Base : constant System.Address := System'To_Address (16#40000000#);
RADIO_Base : constant System.Address := System'To_Address (16#40001000#);
UARTE0_Base : constant System.Address := System'To_Address (16#40002000#);
UART0_Base : constant System.Address := System'To_Address (16#40002000#);
SPIM0_Base : constant System.Address := System'To_Address (16#40003000#);
SPIS0_Base : constant System.Address := System'To_Address (16#40003000#);
TWIM0_Base : constant System.Address := System'To_Address (16#40003000#);
TWIS0_Base : constant System.Address := System'To_Address (16#40003000#);
SPI0_Base : constant System.Address := System'To_Address (16#40003000#);
TWI0_Base : constant System.Address := System'To_Address (16#40003000#);
SPIM1_Base : constant System.Address := System'To_Address (16#40004000#);
SPIS1_Base : constant System.Address := System'To_Address (16#40004000#);
TWIM1_Base : constant System.Address := System'To_Address (16#40004000#);
TWIS1_Base : constant System.Address := System'To_Address (16#40004000#);
SPI1_Base : constant System.Address := System'To_Address (16#40004000#);
TWI1_Base : constant System.Address := System'To_Address (16#40004000#);
NFCT_Base : constant System.Address := System'To_Address (16#40005000#);
GPIOTE_Base : constant System.Address := System'To_Address (16#40006000#);
SAADC_Base : constant System.Address := System'To_Address (16#40007000#);
TIMER0_Base : constant System.Address := System'To_Address (16#40008000#);
TIMER1_Base : constant System.Address := System'To_Address (16#40009000#);
TIMER2_Base : constant System.Address := System'To_Address (16#4000A000#);
RTC0_Base : constant System.Address := System'To_Address (16#4000B000#);
TEMP_Base : constant System.Address := System'To_Address (16#4000C000#);
RNG_Base : constant System.Address := System'To_Address (16#4000D000#);
ECB_Base : constant System.Address := System'To_Address (16#4000E000#);
CCM_Base : constant System.Address := System'To_Address (16#4000F000#);
AAR_Base : constant System.Address := System'To_Address (16#4000F000#);
WDT_Base : constant System.Address := System'To_Address (16#40010000#);
RTC1_Base : constant System.Address := System'To_Address (16#40011000#);
QDEC_Base : constant System.Address := System'To_Address (16#40012000#);
COMP_Base : constant System.Address := System'To_Address (16#40013000#);
LPCOMP_Base : constant System.Address := System'To_Address (16#40013000#);
SWI0_Base : constant System.Address := System'To_Address (16#40014000#);
EGU0_Base : constant System.Address := System'To_Address (16#40014000#);
SWI1_Base : constant System.Address := System'To_Address (16#40015000#);
EGU1_Base : constant System.Address := System'To_Address (16#40015000#);
SWI2_Base : constant System.Address := System'To_Address (16#40016000#);
EGU2_Base : constant System.Address := System'To_Address (16#40016000#);
SWI3_Base : constant System.Address := System'To_Address (16#40017000#);
EGU3_Base : constant System.Address := System'To_Address (16#40017000#);
SWI4_Base : constant System.Address := System'To_Address (16#40018000#);
EGU4_Base : constant System.Address := System'To_Address (16#40018000#);
SWI5_Base : constant System.Address := System'To_Address (16#40019000#);
EGU5_Base : constant System.Address := System'To_Address (16#40019000#);
TIMER3_Base : constant System.Address := System'To_Address (16#4001A000#);
TIMER4_Base : constant System.Address := System'To_Address (16#4001B000#);
PWM0_Base : constant System.Address := System'To_Address (16#4001C000#);
PDM_Base : constant System.Address := System'To_Address (16#4001D000#);
NVMC_Base : constant System.Address := System'To_Address (16#4001E000#);
PPI_Base : constant System.Address := System'To_Address (16#4001F000#);
MWU_Base : constant System.Address := System'To_Address (16#40020000#);
PWM1_Base : constant System.Address := System'To_Address (16#40021000#);
PWM2_Base : constant System.Address := System'To_Address (16#40022000#);
SPIM2_Base : constant System.Address := System'To_Address (16#40023000#);
SPIS2_Base : constant System.Address := System'To_Address (16#40023000#);
SPI2_Base : constant System.Address := System'To_Address (16#40023000#);
RTC2_Base : constant System.Address := System'To_Address (16#40024000#);
I2S_Base : constant System.Address := System'To_Address (16#40025000#);
FPU_Base : constant System.Address := System'To_Address (16#40026000#);
P0_Base : constant System.Address := System'To_Address (16#50000000#);
end NRF52;
|
AdaCore/libadalang | Ada | 180 | ads | package Pkg.Child_Pkg is
pragma Elaborate_Body;
type Origin_Pkg_Child_Pkg_Public is private;
private
type Origin_Pkg_Child_Pkg_Private is null record;
end Pkg.Child_Pkg;
|
zhmu/ananas | Ada | 5,846 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- SYSTEM.PUT_IMAGES --
-- --
-- S p e c --
-- --
-- Copyright (C) 2020-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.Strings.Text_Buffers;
with System.Unsigned_Types;
package System.Put_Images with Pure is
-- This package contains subprograms that are called by the generated code
-- for the 'Put_Image attribute.
--
-- For a signed integer type that fits in Integer, the actual parameter is
-- converted to Integer, and Put_Image_Integer is called. For larger types,
-- Put_Image_Long_Long_Integer or Put_Image_Long_Long_Long_Integer is used.
-- For a modular integer type, this is similar with Integer replaced with
-- Unsigned. Access values are unchecked-converted to either Thin_Pointer
-- or Fat_Pointer, and Put_Image_Thin_Pointer or Put_Image_Fat_Pointer is
-- called. The Before/Between/After procedures are called before printing
-- the components of a composite type, between pairs of components, and
-- after them. See Exp_Put_Image in the compiler for details of these
-- calls.
pragma Preelaborate;
subtype Sink is Ada.Strings.Text_Buffers.Root_Buffer_Type;
procedure Put_Image_Integer (S : in out Sink'Class; X : Integer);
procedure Put_Image_Long_Long_Integer
(S : in out Sink'Class; X : Long_Long_Integer);
procedure Put_Image_Long_Long_Long_Integer
(S : in out Sink'Class; X : Long_Long_Long_Integer);
subtype Unsigned is Unsigned_Types.Unsigned;
subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
procedure Put_Image_Unsigned (S : in out Sink'Class; X : Unsigned);
procedure Put_Image_Long_Long_Unsigned
(S : in out Sink'Class; X : Long_Long_Unsigned);
procedure Put_Image_Long_Long_Long_Unsigned
(S : in out Sink'Class; X : Long_Long_Long_Unsigned);
type Byte is new Character with Alignment => 1;
type Byte_String is array (Positive range <>) of Byte with Alignment => 1;
type Thin_Pointer is access all Byte with Storage_Size => 0;
type Fat_Pointer is access all Byte_String with Storage_Size => 0;
procedure Put_Image_Thin_Pointer (S : in out Sink'Class; X : Thin_Pointer);
procedure Put_Image_Fat_Pointer (S : in out Sink'Class; X : Fat_Pointer);
-- Print "null", or the address of the designated object as an unsigned
-- hexadecimal integer.
procedure Put_Image_Access_Subp (S : in out Sink'Class; X : Thin_Pointer);
-- For access-to-subprogram types
procedure Put_Image_Access_Prot_Subp
(S : in out Sink'Class; X : Thin_Pointer);
-- For access-to-protected-subprogram types
procedure Put_Image_String (S : in out Sink'Class; X : String);
procedure Put_Image_Wide_String (S : in out Sink'Class; X : Wide_String);
procedure Put_Image_Wide_Wide_String
(S : in out Sink'Class; X : Wide_Wide_String);
procedure Array_Before (S : in out Sink'Class);
procedure Array_Between (S : in out Sink'Class);
procedure Array_After (S : in out Sink'Class);
procedure Simple_Array_Between (S : in out Sink'Class);
-- For "simple" arrays, where we don't want a newline between every
-- component.
procedure Record_Before (S : in out Sink'Class);
procedure Record_Between (S : in out Sink'Class);
procedure Record_After (S : in out Sink'Class);
procedure Put_Arrow (S : in out Sink'Class);
procedure Put_Image_Unknown (S : in out Sink'Class; Type_Name : String);
-- For Put_Image of types that don't have the attribute, such as type
-- Sink.
end System.Put_Images;
|
zrmyers/VulkanAda | Ada | 56,996 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenFType;
with Vulkan.Math.GenDType;
with Vulkan.Math.GenUType;
with Vulkan.Math.GenIType;
with Vulkan.Math.GenBType;
with Vulkan.Math.Relational;
use Vulkan.Math.GenFType;
use Vulkan.Math.GenDType;
use Vulkan.Math.GenUType;
use Vulkan.Math.GenIType;
use Vulkan.Math.GenBType;
use Vulkan.Math.Relational;
--------------------------------------------------------------------------------
--< @group Vulkan Math Operators
--------------------------------------------------------------------------------
--< @summary
--< This package provides operator definitions for all basic vector and matrix
--< types.
--------------------------------------------------------------------------------
package Vulkan.Math.Operators is
pragma Preelaborate;
pragma Pure;
----------------------------------------------------------------------------
-- The Operators for boolean vectors are defined here.
--
-- A summary of operators that can be used with GenBType values of different
-- size:
-- - "&", Concatenation
--
-- A summary of operators that are component-wise Unary:
-- - "not", Bitwise complement operator
--
-- A summary of operators that are component-wise on two input vectors of the
-- same length. Additionally, a scalar may appear instead of a vector on the
-- left or right hand side of these operators:
-- - "and", Bitwise AND operator.
-- - "or" , Bitwise OR operator.
-- - "xor", Bitwise XOR operator.
--
-- A summary of relational operators which return a scalar boolean value.
-- - "=", Equality operator
-- - "/=", Non-Equality operator
--
----------------------------------------------------------------------------
-- GenBType Concatenation Operators
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType concatenation operator.
--<
--< @description
--< Concatenate two Vkm_GenBType vectors.
--< vector := vector & vector
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right vector to left vector.
----------------------------------------------------------------------------
function "&" (left, right : in Vkm_GenBType) return Vkm_GenBType renames GBT.Concatenate;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType concatenation operator.
--<
--< @description
--< Concatenate a scalar Vkm_Bool and a Vkm_GenBType vector.
--< vector := scalar & vector
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right vector to left scalar.
----------------------------------------------------------------------------
function "&" (left : in Vkm_Bool ;
right : in Vkm_GenBType) return Vkm_GenBType is
(GBT.Make_GenType(left).Concatenate(right)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType concatenation operator.
--<
--< @description
--< Concatenate a scalar Vkm_Bool and a Vkm_GenBType vector.
--< vector := vector & scalar;
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right scalar to left vector.
----------------------------------------------------------------------------
function "&" (left : in Vkm_GenBType;
right : in Vkm_Bool ) return Vkm_GenBType is
(left.Concatenate(GBT.Make_GenType(right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType concatenation operator.
--<
--< @description
--< Concatenate two scalar Vkm_Bool parameters.
--< vector := scalar & scalar;
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right scalar to left scalar.
----------------------------------------------------------------------------
function "&" (left, right : in Vkm_Bool ) return Vkm_GenBType is
(GBT.Make_GenType(left, right)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "not" operator.
--<
--< @description
--< Apply a logical complement component-wise on a Vkm_GenBType vector.
--< vector := not vector
----------------------------------------------------------------------------
function "not" is new GBT.Apply_Func_IV_RV("not");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "and" operator.
--<
--< @description
--< Apply a logical "and" component-wise on two Vkm_GenBType vectors.
--< vector := vector and vector;
----------------------------------------------------------------------------
function "and" is new GBT.Apply_Func_IV_IV_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "and" operator.
--<
--< @description
--< Apply a logical "and" component-wise on a Vkm_GenBType vector and
--< Vkm_Bool scalar.
--< vector := vector and scalar;
----------------------------------------------------------------------------
function "and" is new GBT.Apply_Func_IV_IS_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "and" operator.
--<
--< @description
--< Apply a logical "and" component-wise on a Vkm_GenBType vector and
--< Vkm_Bool scalar.
--< vector := scalar and scalar;
----------------------------------------------------------------------------
function "and" is new GBT.Apply_Func_IS_IV_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "or" operator.
--<
--< @description
--< Apply a logical "or" component-wise on two Vkm_GenBType vectors.
--< vector := vector or vector;
----------------------------------------------------------------------------
function "or" is new GBT.Apply_Func_IV_IV_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "or" operator.
--<
--< @description
--< Apply a logical "or" component-wise on a Vkm_GenBType vector and
--< Vkm_Bool scalar.
--< vector := vector or scalar;
----------------------------------------------------------------------------
function "or" is new GBT.Apply_Func_IV_IS_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "or" operator.
--<
--< @description
--< Apply a logical "or" component-wise on a Vkm_GenBType vector and
--< Vkm_Bool scalar.
--< vector := scalar or vector;
----------------------------------------------------------------------------
function "or" is new GBT.Apply_Func_IS_IV_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "xor" operator.
--<
--< @description
--< Apply a logical "xor" component-wise on two Vkm_GenBType vectors.
--< vector := vector xor vector;
----------------------------------------------------------------------------
function "xor" is new GBT.Apply_Func_IV_IV_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "xor" operator.
--<
--< @description
--< Apply a logical "xor" component-wise on a Vkm_GenBType vector and
--< Vkm_Bool scalar.
--< vector := vector xor scalar;
----------------------------------------------------------------------------
function "xor" is new GBT.Apply_Func_IV_IS_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType logical "xor" operator.
--<
--< @description
--< Apply a logical "xor" component-wise on a Vkm_GenBType vector and
--< Vkm_Bool scalar.
--< vector := scalar xor vector;
----------------------------------------------------------------------------
function "xor" is new GBT.Apply_Func_IS_IV_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType equality operator.
--<
--< @description
--< Determine whether all components of two vectors are equal to each other.
--< is_equal := vector = vector;
--<
--< @param left
--< The left parameter in the comparison.
--<
--< @param right
--< The right parameter in the comparison.
--<
--< @return
--< Whether the two vectors are equal to each other.
----------------------------------------------------------------------------
function "=" (left, right : in Vkm_GenBType) return Vkm_Bool is
(Is_All(Equal(left,right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenBType inequality operator.
--<
--< @description
--< Determine whether all components of two vectors are not equal to each other.
--< is_equal := vector /= vector;
--<
--< @param left
--< The left parameter in the comparison.
--<
--< @param right
--< The right parameter in the comparison.
--<
--< @return
--< Whether the two vectors are not equal to each other.
----------------------------------------------------------------------------
function "/=" (left, right : in Vkm_GenBType) return Vkm_Bool is
(Is_Any(Not_Equal(left, right))) with Inline;
----------------------------------------------------------------------------
-- The Operators for unsigned integer vectors are defined here.
--
-- A summary of operators that can be used with GenUType values of different
-- size:
-- - "&", Concatenation
--
-- A summary of operators that are component-wise Unary:
-- - "+" , Unary plus operator.
-- - "not", Bitwise complement operator
--
-- A summary of operators that are component-wise on two input vectors of the
-- same length. Additionally, a scalar may appear instead of a vector on the
-- left or right hand side of these operators:
-- - "mod", Modulus operator.
-- - "+", Addition operator.
-- - "-", Subtraction operator.
-- - "rem", Remainder operator.
-- - "*", Multiplication operator.
-- - "/", Division operator.
-- - "and", Bitwise AND operator.
-- - "or" , Bitwise OR operator.
-- - "xor", Bitwise XOR operator.
--
-- A summary of relational operators that are component-wise on two input vecotrs
-- of the same length, and return a vector of booleans of the same length:
-- - "<", Less than operator
-- - ">", Greater than operator
-- - "<=", Less than or equal to operator
-- - ">=", Greater than or equal to operator
--
-- A summary of relational operators which return a scalar boolean value.
-- - "=", Equality operator
-- - "/=", Non-Equality operator
--
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType concatenation operator.
--<
--< @description
--< Concatenate two Vkm_GenUType vectors.
--< vector := vector & vector
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right vector to left vector.
----------------------------------------------------------------------------
function "&" (left, right : in Vkm_GenUType) return Vkm_GenUType renames GUT.Concatenate;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType concatenation operator.
--<
--< @description
--< Concatenate a scalar Vkm_Uint and a Vkm_GenUType vector.
--< vector := scalar & vector;
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right vector to left scalar.
----------------------------------------------------------------------------
function "&" (left : in Vkm_Uint ;
right : in Vkm_GenUType) return Vkm_GenUType is
(GUT.Make_GenType(left).Concatenate(right)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType concatenation operator.
--<
--< @description
--< Concatenate a scalar Vkm_Uint and a Vkm_GenUType vector.
--< vector := vector & scalar;
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right scalar to left vector.
----------------------------------------------------------------------------
function "&" (left : in Vkm_GenUType;
right : in Vkm_Uint ) return Vkm_GenUType is
(left.Concatenate(GUT.Make_GenType(right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType concatenation operator.
--<
--< @description
--< Concatenate a two scalars of Vkm_Uint type.
--< vector := scalar & scalar;
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right scalar to left scalar.
----------------------------------------------------------------------------
function "&" (left, right : in Vkm_Uint ) return Vkm_GenUType is
(GUT.Make_GenType(left, right)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType unary plus operator.
--<
--< @description
--< Return the vector unmodified.
--< vector := +vector
----------------------------------------------------------------------------
function "+" is new GUT.Apply_Func_IV_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise complement operator.
--<
--< @description
--< Apply the bitwise complement operator to each component of the vector,
--< returning the resulting vector.
--< vector := not vector
----------------------------------------------------------------------------
function "not" is new GUT.Apply_Func_IV_RV("not");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType modulus operator.
--<
--< @description
--< Apply a modulus component-wise on two Vkm_GenBType vectors.
--< vector := vector mod vector;
----------------------------------------------------------------------------
function "mod" is new GUT.Apply_Func_IV_IV_RV("mod");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType modulus operator.
--<
--< @description
--< Apply a scalar modulus component-wise on a Vkm_GenUType vector.
--< vector := vector mod scalar;
----------------------------------------------------------------------------
function "mod" is new GUT.Apply_Func_IV_IS_RV("mod");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType modulus operator.
--<
--< @description
--< Apply a vector modulus component-wise on a Vkm_Uint scalar.
--< vector := scalar mod vector;
----------------------------------------------------------------------------
function "mod" is new GUT.Apply_Func_IS_IV_RV("mod");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType addition operator.
--<
--< @description
--< Apply a addition component-wise on two Vkm_GenUType vectors.
--< vector := vector + vector;
----------------------------------------------------------------------------
function "+" is new GUT.Apply_Func_IV_IV_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType addition operator.
--<
--< @description
--< Add a scalar to each component of a vector.
--< vector := vector + scalar;
----------------------------------------------------------------------------
function "+" is new GUT.Apply_Func_IV_IS_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType addition operator.
--<
--< @description
--< Add a scalar to each component of a vector.
--< vector := scalar + vector;
----------------------------------------------------------------------------
function "+" is new GUT.Apply_Func_IS_IV_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType subtraction operator.
--<
--< @description
--< Apply subtraction component-wise on two Vkm_GenUType vectors.
--< vector := vector - vector;
----------------------------------------------------------------------------
function "-" is new GUT.Apply_Func_IV_IV_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType subtraction operator.
--<
--< @description
--< Subtract a scalar from each component of a vector.
--< vector := vector - scalar;
----------------------------------------------------------------------------
function "-" is new GUT.Apply_Func_IV_IS_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType subtraction operator.
--<
--< @description
--< Subtract each component of the vector from the scalar, returning the result
--< for each subtraction in the corresponding component of a new vector.
--< vector := scalar - vector;
----------------------------------------------------------------------------
function "-" is new GUT.Apply_Func_IS_IV_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType remainder operator.
--<
--< @description
--< Return the remainder from component-wise division of two Vkm_GenUType vectors.
--< vector := vector rem vector;
----------------------------------------------------------------------------
function "rem" is new GUT.Apply_Func_IV_IV_RV("rem");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType remainder operator.
--<
--< @description
--< Return the remainder from division of each component of a vector by a scalar.
--< vector := vector rem scalar;
----------------------------------------------------------------------------
function "rem" is new GUT.Apply_Func_IV_IS_RV("rem");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType remainder operator.
--<
--< @description
--< Return the remainder from division of a scalar by each component of a vector.
--< vector := scalar rem vector;
----------------------------------------------------------------------------
function "rem" is new GUT.Apply_Func_IS_IV_RV("rem");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType mulitiplication operator.
--<
--< @description
--< Return the result of component-wise multiplication between the two vectors.
--< vector := vector * vector;
----------------------------------------------------------------------------
function "*" is new GUT.Apply_Func_IV_IV_RV("*");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType mulitiplication operator.
--<
--< @description
--< Return the result of component-wise multiplication of a vector and a scalar.
--< vector := vector * scalar;
----------------------------------------------------------------------------
function "*" is new GUT.Apply_Func_IV_IS_RV("*");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType mulitiplication operator.
--<
--< @description
--< Return the result of component-wise multiplication of a vector and a scalar.
--< vector := scalar * vector;
----------------------------------------------------------------------------
function "*" is new GUT.Apply_Func_IS_IV_RV("*");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType division operator.
--<
--< @description
--< Return the result of component-wise division between the two vectors.
--< vector := vector * vector;
----------------------------------------------------------------------------
function "/" is new GUT.Apply_Func_IV_IV_RV("/");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType division operator.
--<
--< @description
--< Return the result of component-wise division between a vector and a scalar.
--< vector := vector / scalar;
----------------------------------------------------------------------------
function "/" is new GUT.Apply_Func_IV_IS_RV("/");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType division operator.
--<
--< @description
--< Return the result of component-wise division between a vector and a scalar.
--< vector := scalar / vector;
----------------------------------------------------------------------------
function "/" is new GUT.Apply_Func_IS_IV_RV("/");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "and" operator.
--<
--< @description
--< Return the result of component-wise bitwise "and" between the two vectors.
--< vector := vector and vector;
----------------------------------------------------------------------------
function "and" is new GUT.Apply_Func_IV_IV_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "and" operator.
--<
--< @description
--< Return the result of component-wise bitwise "and" between a scalar and a vector.
--< vector := vector and scalar;
----------------------------------------------------------------------------
function "and" is new GUT.Apply_Func_IV_IS_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "and" operator.
--<
--< @description
--< Return the result of component-wise bitwise "and" between a scalar and a vector.
--< vector := scalar and vector;
----------------------------------------------------------------------------
function "and" is new GUT.Apply_Func_IS_IV_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "or" operator.
--<
--< @description
--< Return the result of component-wise bitwise "or" between the two vectors.
--< vector := vector or vector;
----------------------------------------------------------------------------
function "or" is new GUT.Apply_Func_IV_IV_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "or" operator.
--<
--< @description
--< Return the result of component-wise bitwise "or" between a scalar and a vector.
--< vector := vector or scalar;
----------------------------------------------------------------------------
function "or" is new GUT.Apply_Func_IV_IS_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "or" operator.
--<
--< @description
--< Return the result of component-wise bitwise "or" between a scalar and a vector.
--< vector := scalar or vector;
----------------------------------------------------------------------------
function "or" is new GUT.Apply_Func_IS_IV_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "xor" operator.
--<
--< @description
--< Return the result of component-wise bitwise "xor" between the two vectors.
--< vector := vector xor vector;
----------------------------------------------------------------------------
function "xor" is new GUT.Apply_Func_IV_IV_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "xor" operator.
--<
--< @description
--< Return the result of component-wise bitwise "xor" between a vector and a scalar.
--< vector := vector xor scalar;
----------------------------------------------------------------------------
function "xor" is new GUT.Apply_Func_IV_IS_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType bitwise "xor" operator.
--<
--< @description
--< Return the result of component-wise bitwise "xor" between a vector and a scalar.
--< vector := scalar xor vector;
----------------------------------------------------------------------------
function "xor" is new GUT.Apply_Func_IS_IV_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType less than operator.
--<
--< @description
--< Return the result of the component-wise less than operator on two vectors.
--< bool_vector := vector < vector;
----------------------------------------------------------------------------
function "<" is new Apply_Func_IVU_IVU_RVB("<" );
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType less than or equal to operator.
--<
--< @description
--< Return the result of the component-wise less than or equal operator on two vectors.
--< bool_vector := vector <= vector;
----------------------------------------------------------------------------
function "<=" is new Apply_Func_IVU_IVU_RVB("<=");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType greater than operator.
--<
--< @description
--< Return the result of the component-wise greater than operator on two vectors.
--< bool_vector := vector > vector;
----------------------------------------------------------------------------
function ">" is new Apply_Func_IVU_IVU_RVB(">" );
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType greater than or equal to operator.
--<
--< @description
--< Return the result of the component-wise greater than or equal to operator on two vectors.
--< bool_vector := vector >= vector;
----------------------------------------------------------------------------
function ">=" is new Apply_Func_IVU_IVU_RVB(">=");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType equality operator.
--<
--< @description
--< Determine whether all components of two vectors are equal to each other.
--< is_equal := vector = vector;
--<
--< @param left
--< The left parameter in the comparison.
--<
--< @param right
--< The right parameter in the comparison.
--<
--< @return
--< Whether the two vectors are equal to each other.
----------------------------------------------------------------------------
function "=" (left, right : in Vkm_GenUType) return Vkm_Bool is
(Is_All(Equal(left,right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenUType inequality operator.
--<
--< @description
--< Determine whether all components of two vectors are not equal to each other.
--< is_equal := vector /= vector;
--<
--< @param left
--< The left parameter in the comparison.
--<
--< @param right
--< The right parameter in the comparison.
--<
--< @return
--< Whether the two vectors are not equal to each other.
----------------------------------------------------------------------------
function "/=" (left, right : in Vkm_GenUType) return Vkm_Bool is
(Is_Any(Not_Equal(left, right))) with Inline;
----------------------------------------------------------------------------
-- The Operators for integer vectors are defined here.
--
-- A summary of operators that can be used with GenIType values of different
-- size:
-- - "&", Concatenation
--
-- A summary of operators that are component-wise Unary:
-- - "+" , Unary plus operator.
-- - "-" , Unary minus operator.
-- - "not", Bitwise complement operator
-- - "abs", Unary absolute value operator.
--
-- A summary of operators that are component-wise on two input vectors of the
-- same length. Additionally, a scalar may appear instead of a vector on the
-- left or right hand side of these operators:
-- - "mod", Modulus operator.
-- - "+", Addition operator.
-- - "-", Subtraction operator.
-- - "rem", Remainder operator.
-- - "*", Multiplication operator.
-- - "/", Division operator.
-- - "and", Bitwise AND operator.
-- - "or" , Bitwise OR operator.
-- - "xor", Bitwise XOR operator.
--
-- A summary of relational operators that are component-wise on two input vecotrs
-- of the same length, and return a vector of booleans of the same length:
-- - "<", Less than operator
-- - ">", Greater than operator
-- - "<=", Less than or equal to operator
-- - ">=", Greater than or equal to operator
--
-- A summary of relational operators which return a scalar boolean value.
-- - "=", Equality operator
-- - "/=", Non-Equality operator
--
----------------------------------------------------------------------------
-- GenIType Concatenation Operators
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType concatenation operator.
--<
--< @description
--< Concatenate two Vkm_GenIType vectors.
--< vector := vector & vector
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right vector to left vector.
----------------------------------------------------------------------------
function "&" (left, right : in Vkm_GenIType) return Vkm_GenIType renames GIT.Concatenate;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType concatenation operator.
--<
--< @description
--< Concatenate a Vkm_GenIType vector and a Vkm_Int scalar.
--< vector := scalar & vector
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right vector to left scalar.
----------------------------------------------------------------------------
function "&" (left : in Vkm_Int ;
right : in Vkm_GenIType) return Vkm_GenIType is
(GIT.Make_GenType(left).Concatenate(right)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType concatenation operator.
--<
--< @description
--< Concatenate a Vkm_GenIType vector and a Vkm_Int scalar.
--< vector := vector & scalar
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right scalar to left vector.
----------------------------------------------------------------------------
function "&" (left : in Vkm_GenIType;
right : in Vkm_Int ) return Vkm_GenIType is
(left.Concatenate(GIT.Make_GenType(right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType concatenation operator.
--<
--< @description
--< Concatenate two Vkm_Int scalars.
--< vector := scalar & scalar
--<
--< @param left
--< Parameter to the left of the '&' symbol.
--<
--< @param right
--< Parameter to the right of the '&' symbol.
--<
--< @return
--< Append right scalar to left scalar.
----------------------------------------------------------------------------
function "&" (left, right : in Vkm_Int ) return Vkm_GenIType is
(GIT.Make_GenType(left, right)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType unary plus operator.
--<
--< @description
--< Return the vector unmodified.
--< vector := +vector
----------------------------------------------------------------------------
function "+" is new GIT.Apply_Func_IV_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType unary minus operator.
--<
--< @description
--< Return the vector negated.
--< vector := -vector
----------------------------------------------------------------------------
function "-" is new GIT.Apply_Func_IV_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_Int bitwise complement operator.
--<
--< @description
--< Return the 1's complement for the Vkm_Int value.
--<
--< @param value
--< The value to perform the 1's complement of.
--<
--< @return
--< The 1's complement of the value.
----------------------------------------------------------------------------
function "not" (value : in Vkm_Int) return Vkm_Int is
(To_Vkm_Int(not To_Vkm_Uint(value))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise complement operator.
--<
--< @description
--< Return the 1's complement for each component of the Vkm_GenIType vector.
----------------------------------------------------------------------------
function "not" is new GIT.Apply_Func_IV_RV("not");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType unary absolute value operator.
--<
--< @description
--< Return the absolute value for each component of the vector.
--< vector := abs vector
----------------------------------------------------------------------------
function "abs" is new GIT.Apply_Func_IV_RV("abs");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType modulus operator.
--<
--< @description
--< Apply a modulus component-wise on two Vkm_GenIType vectors.
--< vector := vector mod vector;
----------------------------------------------------------------------------
function "mod" is new GIT.Apply_Func_IV_IV_RV("mod");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType modulus operator.
--<
--< @description
--< Apply a scalar modulus component-wise on a vector.
--< vector := vector mod scalar;
----------------------------------------------------------------------------
function "mod" is new GIT.Apply_Func_IV_IS_RV("mod");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType modulus operator.
--<
--< @description
--< Apply a vector modulus component-wise on a scalar.
--< vector := scalar mod vector;
----------------------------------------------------------------------------
function "mod" is new GIT.Apply_Func_IS_IV_RV("mod");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType addition operator.
--<
--< @description
--< Apply addition component-wise on two vectors.
--< vector := vector + vector;
----------------------------------------------------------------------------
function "+" is new GIT.Apply_Func_IV_IV_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType addition operator.
--<
--< @description
--< Add a scalar to each component of a vector.
--< vector := vector + scalar;
----------------------------------------------------------------------------
function "+" is new GIT.Apply_Func_IV_IS_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType addition operator.
--<
--< @description
--< Add a scalar to each component of a vector.
--< vector := scalar + vector;
----------------------------------------------------------------------------
function "+" is new GIT.Apply_Func_IS_IV_RV("+");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType subtraction operator.
--<
--< @description
--< Subtract a vector from another vector.
--< vector := vector - vector;
----------------------------------------------------------------------------
function "-" is new GIT.Apply_Func_IV_IV_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType subtraction operator.
--<
--< @description
--< Subtract a scalar from each component of a vector.
--< vector := vector - scalar;
----------------------------------------------------------------------------
function "-" is new GIT.Apply_Func_IV_IS_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType subtraction operator.
--<
--< @description
--< Subtract each component of a vector from a scalar, returning a vector of
--< the result.
--< vector := scalar - vector;
----------------------------------------------------------------------------
function "-" is new GIT.Apply_Func_IS_IV_RV("-");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType remainder operator.
--<
--< @description
--< Return the remainder from component-wise division of two Vkm_GenIType vectors.
--< vector := vector rem vector;
----------------------------------------------------------------------------
function "rem" is new GIT.Apply_Func_IV_IV_RV("rem");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType remainder operator.
--<
--< @description
--< Return the remainder from division of a vector by a scalar.
--< vector := vector rem scalar;
----------------------------------------------------------------------------
function "rem" is new GIT.Apply_Func_IV_IS_RV("rem");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType remainder operator.
--<
--< @description
--< Return the remainder from division of a scalar by a vector.
--< vector := scalar rem vector;
----------------------------------------------------------------------------
function "rem" is new GIT.Apply_Func_IS_IV_RV("rem");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType multiplication operator.
--<
--< @description
--< Apply multiplication component-wise on two vectors.
--< vector := vector * vector;
----------------------------------------------------------------------------
function "*" is new GIT.Apply_Func_IV_IV_RV("*");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType multiplication operator.
--<
--< @description
--< Multiply each component of a vector by a scalar.
--< vector := vector * scalar;
----------------------------------------------------------------------------
function "*" is new GIT.Apply_Func_IV_IS_RV("*");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType multiplication operator.
--<
--< @description
--< Multiply each component of a vector by a scalar.
--< vector := scalar * vector;
----------------------------------------------------------------------------
function "*" is new GIT.Apply_Func_IS_IV_RV("*");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType division operator.
--<
--< @description
--< Apply division component-wise on two vectors.
--< vector := vector / vector;
----------------------------------------------------------------------------
function "/" is new GIT.Apply_Func_IV_IV_RV("/");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType division operator.
--<
--< @description
--< Apply divide components of a vector by a scalar.
--< vector := vector / scalar;
----------------------------------------------------------------------------
function "/" is new GIT.Apply_Func_IV_IS_RV("/");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType division operator.
--<
--< @description
--< Divide a scalar by components of a vector.
--< vector := scalar / vector;
----------------------------------------------------------------------------
function "/" is new GIT.Apply_Func_IS_IV_RV("/");
----------------------------------------------------------------------------
--< @summary
--< Vkm_Int bitwise "and" operator.
--<
--< @description
--< Return the result of the bitwise "and" for to scalar values.
--< scalar := scalar and scalar;
--<
--< @param left
--< The parameter to the left of the "and" keyword.
--<
--< @param right
--< The parameter to the right of the "and" keyword.
--<
--< @return
--< The bitwise and of left with right.
----------------------------------------------------------------------------
function "and" (left, right : in Vkm_Int) return Vkm_Int is
(To_Vkm_Int( To_Vkm_Uint(left) and To_Vkm_Uint(right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "and" operator.
--<
--< @description
--< Return the component-wise bitwise "and" for two vectors.
--< vector := vector and vector;
----------------------------------------------------------------------------
function "and" is new GIT.Apply_Func_IV_IV_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "and" operator.
--<
--< @description
--< Return the component-wise bitwise "and" for a vector and a scalar.
--< vector := vector and scalar;
----------------------------------------------------------------------------
function "and" is new GIT.Apply_Func_IV_IS_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "and" operator.
--<
--< @description
--< Return the component-wise bitwise "and" for a vector and a scalar.
--< vector := scalar and vector;
----------------------------------------------------------------------------
function "and" is new GIT.Apply_Func_IS_IV_RV("and");
----------------------------------------------------------------------------
--< @summary
--< Vkm_Int bitwise "or" operator.
--<
--< @description
--< Return the result of the bitwise "or" for to scalar values.
--< scalar := scalar or scalar;
--<
--< @param left
--< The parameter to the left of the "or" keyword.
--<
--< @param right
--< The parameter to the right of the "or" keyword.
--<
--< @return
--< The result of the bitwise "or" operation.
----------------------------------------------------------------------------
function "or" (left, right : in Vkm_Int) return Vkm_Int is
(To_Vkm_Int(To_Vkm_Uint(left) or To_Vkm_Uint(right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "or" operator.
--<
--< @description
--< Return the component-wise bitwise "or" for two vectors.
--< vector := vector or vector;
----------------------------------------------------------------------------
function "or" is new GIT.Apply_Func_IV_IV_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "or" operator.
--<
--< @description
--< Return the component-wise bitwise "or" for a vector and a scalar.
--< vector := vector or scalar;
----------------------------------------------------------------------------
function "or" is new GIT.Apply_Func_IV_IS_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "or" operator.
--<
--< @description
--< Return the component-wise bitwise "or" for a vector and a scalar.
--< vector := scalar or vector;
----------------------------------------------------------------------------
function "or" is new GIT.Apply_Func_IS_IV_RV("or");
----------------------------------------------------------------------------
--< @summary
--< Vkm_Int bitwise "xor" operator.
--<
--< @description
--< Return the result of the bitwise "xor" for to scalar values.
--< scalar := scalar xor scalar;
--<
--< @param left
--< The parameter to the left of the "xor" keyword.
--<
--< @param right
--< The parameter to the right of the "xor" keyword.
--<
--< @return
--< The result of the bitwise "xor" operation.
----------------------------------------------------------------------------
function "xor" (left, right : in Vkm_Int) return Vkm_Int is
(To_Vkm_Int(To_Vkm_Uint(left) xor To_Vkm_Uint(right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "xor" operator.
--<
--< @description
--< Return the component-wise bitwise "xor" for two vectors.
--< vector := vector xor vector;
----------------------------------------------------------------------------
function "xor" is new GIT.Apply_Func_IV_IV_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "xor" operator.
--<
--< @description
--< Return the component-wise bitwise "xor" for a vector and a scalar.
--< vector := vector xor scalar;
----------------------------------------------------------------------------
function "xor" is new GIT.Apply_Func_IV_IS_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType bitwise "xor" operator.
--<
--< @description
--< Return the component-wise bitwise "xor" for a vector and a scalar.
--< vector := scalar xor vector;
----------------------------------------------------------------------------
function "xor" is new GIT.Apply_Func_IS_IV_RV("xor");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType less than operator.
--<
--< @description
--< Return the result of the component-wise less than operator on two vectors.
--< bool_vector := vector < vector;
----------------------------------------------------------------------------
function "<" is new Apply_Func_IVI_IVI_RVB("<" );
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType less than or equal to operator.
--<
--< @description
--< Return the result of the component-wise less than or equal to operator on
--< two vectors.
--< bool_vector := vector < vector;
----------------------------------------------------------------------------
function "<=" is new Apply_Func_IVI_IVI_RVB("<=");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType greater than operator.
--<
--< @description
--< Return the result of the component-wise greater than operator on
--< two vectors.
--< bool_vector := vector < vector;
----------------------------------------------------------------------------
function ">" is new Apply_Func_IVI_IVI_RVB(">" );
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType greater than or equal operator.
--<
--< @description
--< Return the result of the component-wise greater than or equal to operator
--< on two vectors.
--< bool_vector := vector < vector;
----------------------------------------------------------------------------
function ">=" is new Apply_Func_IVI_IVI_RVB(">=");
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType equality operator.
--<
--< @description
--< Return true if each component of two vectors are equal to each other.
--< Otherwise return false.
--< is_equal := vector = vector;
--<
--< @param left
--< The left vector in the comparison.
--<
--< @param right
--< The right vector in the comparison.
--<
--< @return
--< Whether the two vectors are equal to each other.
----------------------------------------------------------------------------
function "=" (left, right : in Vkm_GenIType) return Vkm_Bool is
(Is_All(Equal(left, right))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Vkm_GenIType inequality operator.
--<
--< @description
--< Return true if any component of the two vectors are not equal to each other.
--< Otherwise return false.
--< is_equal := vector /= vector;
--<
--< @param left
--< The left vector in the comparison.
--<
--< @param right
--< The right vector in the comparison.
--<
--< @return
--< Whether the two vectors are equal to each other.
----------------------------------------------------------------------------
function "/=" (left, right : in Vkm_GenIType) return Vkm_Bool is
(Is_Any(Not_Equal(left, right))) with Inline;
end Vulkan.Math.Operators;
|
zhmu/ananas | Ada | 9,051 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 2 2 --
-- --
-- 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_22 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_22;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
-- The following declarations are for the case where the address
-- passed to GetU_22 or SetU_22 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_ClusterU_Ref is access Rev_ClusterU;
------------
-- Get_22 --
------------
function Get_22
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_22
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_22;
-------------
-- GetU_22 --
-------------
function GetU_22
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_22
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end GetU_22;
------------
-- Set_22 --
------------
procedure Set_22
(Arr : System.Address;
N : Natural;
E : Bits_22;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_22;
-------------
-- SetU_22 --
-------------
procedure SetU_22
(Arr : System.Address;
N : Natural;
E : Bits_22;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end SetU_22;
end System.Pack_22;
|
reznikmm/matreshka | Ada | 4,899 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.UML.Durations.Collections is
pragma Preelaborate;
package UML_Duration_Collections is
new AMF.Generic_Collections
(UML_Duration,
UML_Duration_Access);
type Set_Of_UML_Duration is
new UML_Duration_Collections.Set with null record;
Empty_Set_Of_UML_Duration : constant Set_Of_UML_Duration;
type Ordered_Set_Of_UML_Duration is
new UML_Duration_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Duration : constant Ordered_Set_Of_UML_Duration;
type Bag_Of_UML_Duration is
new UML_Duration_Collections.Bag with null record;
Empty_Bag_Of_UML_Duration : constant Bag_Of_UML_Duration;
type Sequence_Of_UML_Duration is
new UML_Duration_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Duration : constant Sequence_Of_UML_Duration;
private
Empty_Set_Of_UML_Duration : constant Set_Of_UML_Duration
:= (UML_Duration_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Duration : constant Ordered_Set_Of_UML_Duration
:= (UML_Duration_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Duration : constant Bag_Of_UML_Duration
:= (UML_Duration_Collections.Bag with null record);
Empty_Sequence_Of_UML_Duration : constant Sequence_Of_UML_Duration
:= (UML_Duration_Collections.Sequence with null record);
end AMF.UML.Durations.Collections;
|
charlie5/cBound | Ada | 1,410 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_clip_plane_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_clip_plane_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_clip_plane_cookie_t.Item,
Element_Array => xcb.xcb_glx_get_clip_plane_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_clip_plane_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_clip_plane_cookie_t.Pointer,
Element_Array => xcb.xcb_glx_get_clip_plane_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_clip_plane_cookie_t;
|
sungyeon/drake | Ada | 9,158 | adb | with System.Formatting.Decimal;
with System.Formatting.Fixed;
with System.Formatting.Float;
with System.Long_Long_Integer_Types;
package body Ada.Formatting is
pragma Suppress (All_Checks);
use type System.Long_Long_Integer_Types.Word_Unsigned;
use type System.Long_Long_Integer_Types.Long_Long_Unsigned;
subtype Word_Unsigned is System.Long_Long_Integer_Types.Word_Unsigned;
subtype Long_Long_Unsigned is
System.Long_Long_Integer_Types.Long_Long_Unsigned;
pragma Compile_Time_Error (
No_Sign /= System.Formatting.No_Sign,
"No_Sign mismatch");
function Integer_Image (Item : T) return String is
Longest_Abs_Item : Long_Long_Unsigned;
Word_Abs_Item : Word_Unsigned;
Result : String (
1 .. 4 + Long_Long_Integer'Width + Digits_Width); -- "16##"
Last : Natural := Result'First - 1;
Error : Boolean;
begin
declare
Sign : Character;
begin
if Item < 0 then
if T'Size > Standard'Word_Size then
Longest_Abs_Item := -Long_Long_Unsigned'Mod (Item);
else
Word_Abs_Item := -Word_Unsigned'Mod (Item);
end if;
Sign := Signs (-1);
else
if T'Size > Standard'Word_Size then
Longest_Abs_Item := Long_Long_Unsigned (Item);
else
Word_Abs_Item := Word_Unsigned (Item);
end if;
if Item > 0 then
Sign := Signs (1);
else
Sign := Signs (0);
end if;
end if;
if Sign /= No_Sign then
Last := Last + 1;
Result (Last) := Sign;
end if;
end;
if Form = Ada and then Base /= 10 then
System.Formatting.Image (
Word_Unsigned (Base),
Result (Last + 1 .. Result'Last),
Last,
Error => Error);
Last := Last + 1;
Result (Last) := '#';
end if;
if T'Size > Standard'Word_Size then
System.Formatting.Image (
Longest_Abs_Item,
Result (Last + 1 .. Result'Last),
Last,
Base => Base,
Set =>
System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Width => Digits_Width,
Fill => Digits_Fill,
Error => Error);
else
System.Formatting.Image (
Word_Abs_Item,
Result (Last + 1 .. Result'Last),
Last,
Base => Base,
Set =>
System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Width => Digits_Width,
Fill => Digits_Fill,
Error => Error);
end if;
if Form = Ada and then Base /= 10 then
Last := Last + 1;
Result (Last) := '#';
end if;
return Result (1 .. Last);
end Integer_Image;
function Modular_Image (Item : T) return String is
Result : String (
1 .. 4 + Long_Long_Unsigned'Width + Digits_Width); -- "16##"
Last : Natural := Result'First - 1;
Error : Boolean;
begin
declare
Sign : Character;
begin
if Item > 0 then
Sign := Signs (1);
else
Sign := Signs (0);
end if;
if Sign /= No_Sign then
Last := Last + 1;
Result (Last) := Sign;
end if;
end;
if Form = Ada and then Base /= 10 then
System.Formatting.Image (
Word_Unsigned (Base),
Result (Last + 1 .. Result'Last),
Last,
Error => Error);
Last := Last + 1;
Result (Last) := '#';
end if;
if T'Size > Standard'Word_Size then
System.Formatting.Image (
Long_Long_Unsigned (Item),
Result (Last + 1 .. Result'Last),
Last,
Base => Base,
Set =>
System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Width => Digits_Width,
Fill => Digits_Fill,
Error => Error);
else
System.Formatting.Image (
Word_Unsigned (Item),
Result (Last + 1 .. Result'Last),
Last,
Base => Base,
Set =>
System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Width => Digits_Width,
Fill => Digits_Fill,
Error => Error);
end if;
if Form = Ada and then Base /= 10 then
Last := Last + 1;
Result (Last) := '#';
end if;
return Result (1 .. Last);
end Modular_Image;
function Float_Image (Item : T) return String is
Result : String (
1 ..
Fore_Digits_Width + Aft_Width + Exponent_Digits_Width
+ 13); -- 5(15bit exponent) + 8("-16#.#E-")
Fore_Last, Last : Natural;
begin
System.Formatting.Float.Image (
Long_Long_Float (Item),
Result,
Fore_Last,
Last,
Signs => (Signs (-1), Signs (0), Signs (1)),
Base => Base,
Base_Form => Form = Ada and then Base /= 10,
Set => System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Fore_Digits_Width => Fore_Digits_Width,
Fore_Digits_Fill => Fore_Digits_Fill,
Aft_Width => Aft_Width,
Exponent_Mark => Exponent_Mark,
Exponent_Signs =>
(Exponent_Signs (-1), Exponent_Signs (0), Exponent_Signs (1)),
Exponent_Digits_Width => Exponent_Digits_Width,
Exponent_Digits_Fill => Exponent_Digits_Fill,
NaN => NaN,
Infinity => Infinity);
return Result (1 .. Last);
end Float_Image;
function Fixed_Image (Item : T) return String is
Result : String (
1 ..
Integer'Max (
System.Formatting.Float.Fore_Digits_Width (
Long_Long_Float (T'First),
Long_Long_Float (T'Last),
Base => Base),
Fore_Digits_Width)
+ Aft_Width + Exponent_Digits_Width
+ 13); -- 5(15bit exponent) + 8("-16#.#E-")
Fore_Last, Last : Natural;
begin
if Exponent then
System.Formatting.Float.Image (
Long_Long_Float (Item),
Result,
Fore_Last,
Last,
Signs => (Signs (-1), Signs (0), Signs (1)),
Base => Base,
Base_Form => Form = Ada and then Base /= 10,
Set =>
System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Fore_Digits_Width => Fore_Digits_Width,
Fore_Digits_Fill => Fore_Digits_Fill,
Aft_Width => Aft_Width,
Exponent_Mark => Exponent_Mark,
Exponent_Signs =>
(Exponent_Signs (-1), Exponent_Signs (0), Exponent_Signs (1)),
Exponent_Digits_Width => Exponent_Digits_Width,
Exponent_Digits_Fill => Exponent_Digits_Fill);
else
System.Formatting.Fixed.Image (
Long_Long_Float (Item),
Result,
Fore_Last,
Last,
Signs => (Signs (-1), Signs (0), Signs (1)),
Base => Base,
Base_Form => Form = Ada and then Base /= 10,
Set =>
System.Formatting.Type_Set'Enum_Val (Type_Set'Enum_Rep (Set)),
Fore_Digits_Width => Fore_Digits_Width,
Fore_Digits_Fill => Fore_Digits_Fill,
Aft_Width => Aft_Width);
end if;
return Result (1 .. Last);
end Fixed_Image;
function Decimal_Image (Item : T) return String is
Result : String (
1 ..
Integer'Max (
System.Formatting.Float.Fore_Digits_Width (
Long_Long_Float (T'First),
Long_Long_Float (T'Last)),
Fore_Digits_Width)
+ Aft_Width + Exponent_Digits_Width
+ 13); -- 5(15bit exponent) + 8("-16#.#E-")
Fore_Last, Last : Natural;
begin
if Exponent then
System.Formatting.Float.Image (
Long_Long_Float (Item),
Result,
Fore_Last,
Last,
Signs => (Signs (-1), Signs (0), Signs (1)),
Fore_Digits_Width => Fore_Digits_Width,
Fore_Digits_Fill => Fore_Digits_Fill,
Aft_Width => Aft_Width,
Exponent_Mark => Exponent_Mark,
Exponent_Signs =>
(Exponent_Signs (-1), Exponent_Signs (0), Exponent_Signs (1)),
Exponent_Digits_Width => Exponent_Digits_Width,
Exponent_Digits_Fill => Exponent_Digits_Fill);
else
System.Formatting.Decimal.Image (
Long_Long_Integer'Integer_Value (Item),
Result,
Fore_Last,
Last,
T'Scale,
Signs => (Signs (-1), Signs (0), Signs (1)),
Fore_Digits_Width => Fore_Digits_Width,
Fore_Digits_Fill => Fore_Digits_Fill,
Aft_Width => Aft_Width);
end if;
return Result (1 .. Last);
end Decimal_Image;
end Ada.Formatting;
|
apple-oss-distributions/old_ncurses | Ada | 3,347 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Header_Handler --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer <[email protected]> 1996
-- Version Control
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
-- This package handles the painting of the header line of the screen.
--
package Sample.Header_Handler is
procedure Init_Header_Handler;
-- Initialize the handler for the headerlines.
procedure Update_Header_Window;
-- Update the information in the header window
end Sample.Header_Handler;
|
reznikmm/matreshka | Ada | 4,657 | 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_Number.Decimal_Places_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Number_Decimal_Places_Attribute_Node is
begin
return Self : Number_Decimal_Places_Attribute_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Number_Decimal_Places_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Decimal_Places_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Decimal_Places_Attribute,
Number_Decimal_Places_Attribute_Node'Tag);
end Matreshka.ODF_Number.Decimal_Places_Attributes;
|
coopht/axmpp | Ada | 5,578 | ads | ------------------------------------------------------------------------------
-- --
-- AXMPP Project --
-- --
-- XMPP Library for Ada --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2016, Alexander Basov <[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 Alexander Basov, 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.Containers.Vectors;
with League.Strings;
with XML.SAX.Pretty_Writers;
with XMPP.IQS;
with XMPP.Services_Features;
with XMPP.Services_Identities;
package XMPP.Services is
Query_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("query");
type Service_Item is record
JID : League.Strings.Universal_String;
Name : League.Strings.Universal_String;
Node : League.Strings.Universal_String;
end record;
package Service_Items_Package is
new Ada.Containers.Vectors (Natural, Service_Item);
type XMPP_Service is new XMPP.IQS.XMPP_IQ with private;
type XMPP_Service_Access is access all XMPP_Service'Class;
overriding function Get_Kind (Self : XMPP_Service) return Object_Kind;
overriding procedure Serialize
(Self : XMPP_Service;
Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer'Class);
overriding
procedure Set_Content (Self : in out XMPP_Service;
Parameter : League.Strings.Universal_String;
Value : League.Strings.Universal_String);
function Create return not null XMPP_Service_Access;
function Get_Type (Self : XMPP_Service) return XMPP.Feature;
procedure Set_Type (Self : in out XMPP_Service;
Val : XMPP.Feature);
function Get_Identities (Self : XMPP_Service)
return XMPP.Services_Identities.Identities_Vector;
function Get_Features (Self : XMPP_Service)
return XMPP.Services_Features.Features_Vector;
procedure Add_Identity (Self : in out XMPP_Service;
Val : XMPP.Services_Identities.Identity);
procedure Add_Feature (Self : in out XMPP_Service;
Val : XMPP.Feature);
procedure Add_Feature (Self : in out XMPP_Service;
Val : League.Strings.Universal_String);
function Get_Items (Self : XMPP_Service)
return Service_Items_Package.Vector;
procedure Add_Item (Self : in out XMPP_Service; Item : Service_Item);
private
type XMPP_Service is new XMPP.IQS.XMPP_IQ with
record
Type_Of_Service : XMPP.Feature;
Identities : XMPP.Services_Identities.Identities_Vector;
Features : XMPP.Services_Features.Features_Vector;
Items : Service_Items_Package.Vector;
end record;
end XMPP.Services;
|
reznikmm/matreshka | Ada | 3,749 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Style_Header_Footer_Properties_Elements is
pragma Preelaborate;
type ODF_Style_Header_Footer_Properties is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Style_Header_Footer_Properties_Access is
access all ODF_Style_Header_Footer_Properties'Class
with Storage_Size => 0;
end ODF.DOM.Style_Header_Footer_Properties_Elements;
|
reznikmm/matreshka | Ada | 4,736 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Style.Layout_Grid_Standard_Mode_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Layout_Grid_Standard_Mode_Attribute_Node is
begin
return Self : Style_Layout_Grid_Standard_Mode_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Layout_Grid_Standard_Mode_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Layout_Grid_Standard_Mode_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Layout_Grid_Standard_Mode_Attribute,
Style_Layout_Grid_Standard_Mode_Attribute_Node'Tag);
end Matreshka.ODF_Style.Layout_Grid_Standard_Mode_Attributes;
|
zhmu/ananas | Ada | 2,420 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ S M E M --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains routines involved in processing of shared memory
-- variables, i.e. variables declared in shared passive partitions.
with Types; use Types;
package Sem_Smem is
procedure Check_Shared_Var
(Id : Entity_Id;
T : Entity_Id;
N : Node_Id);
-- This routine checks that the object declaration, N, for identifier,
-- Id, of type, T, is valid, i.e. that it does not violate restrictions
-- on the kind of variables we support in shared passive partitions.
end Sem_Smem;
|
skill-lang/adaCommon | Ada | 761 | ads | -- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ tasks package --
-- |___/_|\_\_|_|____| by: Dennis Przytarski --
-- --
pragma Ada_2012;
-- usage:
-- X : Run (Some_Procedure'Access);
-- X.Start;
package Skill.Tasks is
pragma Preelaborate;
type Closure_T is tagged null record;
type Closure is not null access Closure_T'Class;
task type Run (Runnable : not null access procedure(C : Closure)) is
entry Start (C : Closure);
end Run;
end Skill.Tasks;
|
zhmu/ananas | Ada | 310 | ads | package Predicate10_Pkg is
type I_Array is array (Positive range <>) of access Integer;
subtype NI_Array is I_Array with Dynamic_Predicate =>
(for all I of NI_Array => I /= null);
type I_Pointer is access Integer;
procedure Foo (
Length : Natural;
Initial : I_Pointer
);
end;
|
onox/inotify-ada | Ada | 8,332 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 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.Containers.Bounded_Vectors;
with Ada.Directories;
with Ada.IO_Exceptions;
package body Inotify.Recursive is
function "+" (Value : String) return SU.Unbounded_String renames SU.To_Unbounded_String;
function "+" (Value : SU.Unbounded_String) return String renames SU.To_String;
package Watch_Vectors is new Ada.Containers.Bounded_Vectors (Positive, Watch);
package Move_Vectors is new Ada.Containers.Bounded_Vectors (Positive, Move);
overriding
function Add_Watch
(Object : in out Recursive_Instance;
Path : String;
Mask : Watch_Bits := All_Events) return Watch
is
Recursive_Mask : Watch_Bits := Mask;
procedure Add_Entry (Next_Entry : Ada.Directories.Directory_Entry_Type) is
use all type Ada.Directories.File_Kind;
Name : constant String := Ada.Directories.Simple_Name (Next_Entry);
begin
if Ada.Directories.Kind (Next_Entry) = Directory and Name not in "." | ".." then
Object.Add_Watch (Ada.Directories.Compose (Path, Name), Recursive_Mask);
end if;
exception
-- Ignore the folder if the user has no permission to scan it
-- or if the file is a symlink
when Ada.IO_Exceptions.Use_Error =>
null;
end Add_Entry;
begin
Recursive_Mask.Created := True;
Recursive_Mask.Deleted_Self := True;
Recursive_Mask.Moved_From := True;
Recursive_Mask.Moved_To := True;
Recursive_Mask.Moved_Self := True;
-- Do not follow symlinks
if Ada.Directories.Full_Name (Path) /= Path then
raise Ada.IO_Exceptions.Use_Error;
end if;
Ada.Directories.Search (Path, "", Process => Add_Entry'Access);
return Result : constant Watch := Instance (Object).Add_Watch (Path, Recursive_Mask) do
Object.Masks.Insert (Result.Watch, Mask);
end return;
end Add_Watch;
procedure Remove_Children (Object : in out Recursive_Instance; Subject : Watch) is
Path : constant String := Object.Watches.Element (Subject.Watch);
Watches : Watch_Vectors.Vector (Capacity => Object.Watches.Length);
procedure Iterate (Position : Watch_Maps.Cursor) is
Other_Path : constant String := Watch_Maps.Element (Position);
begin
if Other_Path'Length > Path'Length
and then Path & '/' = Other_Path (1 .. Path'Length + 1)
then
Watches.Append ((Watch => Watch_Maps.Key (Position)));
end if;
end Iterate;
begin
Object.Watches.Iterate (Iterate'Access);
for Element of Watches loop
Instance (Object).Remove_Watch (Element);
Object.Masks.Delete (Element.Watch);
end loop;
end Remove_Children;
overriding
procedure Remove_Watch (Object : in out Recursive_Instance; Subject : Watch) is
begin
-- Procedure Process_Events might read multiple events for a specific
-- watch and the callback for the first event may immediately try to
-- remove the watch
if Object.Defer_Remove then
if not Object.Pending_Removals.Contains (Subject) then
Object.Pending_Removals.Append (Subject);
end if;
return;
end if;
Object.Remove_Children (Subject);
Instance (Object).Remove_Watch (Subject);
Object.Masks.Delete (Subject.Watch);
end Remove_Watch;
overriding
procedure Process_Events
(Object : in out Recursive_Instance;
Handle : not null access procedure
(Subject : Watch;
Event : Event_Kind;
Is_Directory : Boolean;
Name : String);
Move_Handle : not null access procedure
(Subject : Watch;
Is_Directory : Boolean;
From, To : String))
is
Moves : Move_Vectors.Vector (Capacity => Object.Watches.Length);
procedure Handle_Event
(Subject : Inotify.Watch;
Event : Inotify.Event_Kind;
Is_Directory : Boolean;
Name : String)
is
Mask : constant Watch_Bits := Object.Masks (Subject.Watch);
begin
case Event is
when Created =>
if Mask.Created then
Handle (Subject, Event, Is_Directory, Name);
end if;
if Is_Directory then
Object.Add_Watch (Name, Mask);
end if;
when Deleted_Self =>
if Mask.Deleted_Self then
Handle (Subject, Event, Is_Directory, Name);
-- TODO Is_Directory is always False even if inode is a directory
end if;
-- The OS will already have deleted the watch and generated
-- an Ignored event, which caused the watch to be deleted from
-- Object.Watches in Instance.Process_Events
Object.Masks.Delete (Subject.Watch);
when Moved_From =>
if Mask.Moved_From then
Handle (Subject, Event, Is_Directory, Name);
end if;
when Moved_To =>
if Mask.Moved_To then
Handle (Subject, Event, Is_Directory, Name);
end if;
when Moved_Self =>
if Mask.Moved_Self then
Handle (Subject, Event, Is_Directory, Name);
-- TODO Is_Directory is always False even if inode is a directory
end if;
declare
Cursor : Move_Vectors.Cursor := Move_Vectors.No_Element;
procedure Process_Move (Position : Move_Vectors.Cursor) is
Element : constant Move := Moves (Position);
begin
if +Element.From = Name then
Object.Remove_Watch (Subject);
Object.Add_Watch (+Element.To, Mask);
Cursor := Position;
end if;
end Process_Move;
use type Move_Vectors.Cursor;
begin
Moves.Iterate (Process_Move'Access);
if Cursor /= Move_Vectors.No_Element then
Moves.Delete (Cursor);
else
Object.Remove_Watch (Subject);
-- TODO Delete cookie as well
end if;
end;
when others =>
Handle (Subject, Event, Is_Directory, Name);
end case;
end Handle_Event;
procedure Handle_Move_Event
(Subject : Watch;
Is_Directory : Boolean;
From, To : String) is
begin
Move_Handle (Subject, Is_Directory, From, To);
if Is_Directory then
if From /= "" then
Moves.Append ((+From, +To));
else
Object.Add_Watch (To, Object.Masks.Element (Subject.Watch));
end if;
end if;
end Handle_Move_Event;
begin
Instance (Object).Process_Events (Handle_Event'Access, Handle_Move_Event'Access);
end Process_Events;
overriding
procedure Process_Events
(Object : in out Recursive_Instance;
Handle : not null access procedure
(Subject : Watch;
Event : Event_Kind;
Is_Directory : Boolean;
Name : String))
is
procedure Move_Handle
(Subject : Watch;
Is_Directory : Boolean;
From, To : String) is null;
begin
Object.Process_Events (Handle, Move_Handle'Access);
end Process_Events;
end Inotify.Recursive;
|
nerilex/ada-util | Ada | 12,955 | adb | -----------------------------------------------------------------------
-- util-dates-formats-tests - Test for date formats
-- Copyright (C) 2011, 2013, 2014, 2016 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar.Formatting;
with Util.Test_Caller;
with Util.Assertions;
with Util.Properties.Bundles;
with Util.Log.Loggers;
with Util.Dates.RFC7231;
with Util.Dates.ISO8601;
package body Util.Dates.Formats.Tests is
use Util.Tests;
use Ada.Strings.Unbounded;
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Dates.Formats.Tests");
package Caller is new Util.Test_Caller (Test, "Dates");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Dates.Split",
Test_Split'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Formats.Format",
Test_Format'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Get_Day_Start",
Test_Get_Day_Start'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Get_Week_Start",
Test_Get_Week_Start'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Get_Month_Start",
Test_Get_Month_Start'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Get_Day_End",
Test_Get_Day_End'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Get_Week_End",
Test_Get_Week_End'Access);
Caller.Add_Test (Suite, "Test Util.Dates.Get_Month_End",
Test_Get_Month_End'Access);
Caller.Add_Test (Suite, "Test Util.Dates.RFC7231.Append_Date",
Test_Append_Date'Access);
Caller.Add_Test (Suite, "Test Util.Dates.ISO8601.Image",
Test_ISO8601'Access);
end Add_Tests;
procedure Test_Format (T : in out Test) is
Bundle : Util.Properties.Bundles.Manager;
procedure Check (Pattern : in String;
Date : in Ada.Calendar.Time;
Expect : in String);
procedure Check (Pattern : in String;
Date : in Ada.Calendar.Time;
Expect : in String) is
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
Util.Dates.Formats.Format (Pattern => Pattern,
Date => Date,
Bundle => Bundle,
Into => Result);
Util.Tests.Assert_Equals (T, Expect, To_String (Result),
"Invalid result for: " & Pattern);
end Check;
T1 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (1980, 1, 2, 10, 30, 23);
T2 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2011, 11, 19, 0, 0, 0);
T3 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2011, 11, 19, 23, 0, 0);
begin
Check ("%H", T1, "10");
Check ("%H", T2, "00");
Check ("%I", T3, "11");
Check ("%k", T2, " 0");
Check ("%k", T3, "23");
Check ("%l", T2, " 0");
Check ("%l", T3, "11");
Check ("%r", T3, "11:00:00 PM");
Check ("%r", T2, "00:00:00 AM");
Check ("%R:%S", T3, "23:00:00");
Check ("%y-%Y %m/%d %T", T1, "80-1980 01/02 10:30:23");
Check ("%C %d %D", T1, "19 02 01/02/80");
Check ("%e", T1, " 1");
Check ("%F", T1, "1980-01-02");
Check ("%G", T1, "1980W01");
Check ("%g", T1, "80W01");
end Test_Format;
procedure Check (T : in out Test'Class;
Year : in Ada.Calendar.Year_Number;
Month : in Ada.Calendar.Month_Number;
Day : in Ada.Calendar.Day_Number;
Expect_Day : in Ada.Calendar.Day_Number;
Message : in String;
Is_End : in Boolean;
Operation : access function (D : in Ada.Calendar.Time)
return Ada.Calendar.Time) is
use type Ada.Calendar.Time;
Date : Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (Year, Month, Day,
0, 0, 0);
begin
for I in 1 .. 47 loop
declare
R : constant Ada.Calendar.Time := Operation (Date);
D : Date_Record;
begin
Split (D, R);
Log.Info ("{0} ({1}) => {2}",
Ada.Calendar.Formatting.Image (Date),
Message, Ada.Calendar.Formatting.Image (R));
Util.Tests.Assert_Equals (T, Natural (Year), Natural (D.Year),
"Invalid year " & Message);
Util.Tests.Assert_Equals (T, Natural (Month), Natural (D.Month),
"Invalid month " & Message);
Util.Tests.Assert_Equals (T, Natural (Expect_Day), Natural (D.Month_Day),
"Invalid day " & Message);
if Is_End then
Util.Tests.Assert_Equals (T, 23, Natural (D.Hour),
"Invalid hour " & Message);
Util.Tests.Assert_Equals (T, 59, Natural (D.Minute),
"Invalid minute " & Message);
Util.Tests.Assert_Equals (T, 59, Natural (D.Second),
"Invalid second " & Message);
else
Util.Tests.Assert_Equals (T, 0, Natural (D.Hour),
"Invalid hour " & Message);
Util.Tests.Assert_Equals (T, 0, Natural (D.Minute),
"Invalid minute " & Message);
Util.Tests.Assert_Equals (T, 0, Natural (D.Second),
"Invalid second " & Message);
end if;
end;
Date := Date + 1800.0;
end loop;
end Check;
-- ------------------------------
-- Test the Get_Day_Start operation.
-- ------------------------------
procedure Test_Get_Day_Start (T : in out Test) is
begin
Check (T, 2013, 6, 04, 04, "Get_Day_Start", False, Get_Day_Start'Access);
Check (T, 2010, 2, 14, 14, "Get_Day_Start", False, Get_Day_Start'Access);
end Test_Get_Day_Start;
-- ------------------------------
-- Test the Get_Week_Start operation.
-- ------------------------------
procedure Test_Get_Week_Start (T : in out Test) is
begin
Check (T, 2013, 6, 04, 03, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2013, 6, 03, 03, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2013, 6, 05, 03, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2013, 6, 08, 03, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2010, 2, 14, 08, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2010, 2, 13, 08, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2010, 2, 10, 08, "Get_Week_Start", False, Get_Week_Start'Access);
Check (T, 2010, 2, 15, 15, "Get_Week_Start", False, Get_Week_Start'Access);
end Test_Get_Week_Start;
-- ------------------------------
-- Test the Get_Month_Start operation.
-- ------------------------------
procedure Test_Get_Month_Start (T : in out Test) is
begin
Check (T, 2013, 6, 04, 01, "Get_Month_Start", False, Get_Month_Start'Access);
Check (T, 2010, 2, 14, 01, "Get_Month_Start", False, Get_Month_Start'Access);
end Test_Get_Month_Start;
-- ------------------------------
-- Test the Get_Day_End operation.
-- ------------------------------
procedure Test_Get_Day_End (T : in out Test) is
begin
Check (T, 2013, 6, 04, 04, "Get_Day_Start", True, Get_Day_End'Access);
Check (T, 2010, 2, 14, 14, "Get_Day_Start", True, Get_Day_End'Access);
end Test_Get_Day_End;
-- ------------------------------
-- Test the Get_Week_End operation.
-- ------------------------------
procedure Test_Get_Week_End (T : in out Test) is
begin
Check (T, 2013, 6, 04, 09, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2013, 6, 03, 09, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2013, 6, 05, 09, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2013, 6, 08, 09, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2010, 2, 14, 14, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2010, 2, 13, 14, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2010, 2, 10, 14, "Get_Week_End", True, Get_Week_End'Access);
Check (T, 2010, 2, 15, 21, "Get_Week_End", True, Get_Week_End'Access);
end Test_Get_Week_End;
-- ------------------------------
-- Test the Get_Month_End operation.
-- ------------------------------
procedure Test_Get_Month_End (T : in out Test) is
begin
Check (T, 2013, 6, 04, 30, "Get_Month_End", True, Get_Month_End'Access);
Check (T, 2010, 2, 14, 28, "Get_Month_End", True, Get_Month_End'Access);
Check (T, 2000, 2, 14, 29, "Get_Month_End", True, Get_Month_End'Access);
end Test_Get_Month_End;
-- ------------------------------
-- Test the Split operation.
-- ------------------------------
procedure Test_Split (T : in out Test) is
procedure Assert_Equals is
new Util.Assertions.Assert_Equals_T (Ada.Calendar.Formatting.Day_Name);
Date : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2014, 11, 12,
23, 30, 0);
D : Date_Record;
begin
Split (D, Date);
Util.Tests.Assert_Equals (T, 2014, Natural (D.Year), "Invalid year ");
Util.Tests.Assert_Equals (T, 11, Natural (D.Month), "Invalid month ");
Util.Tests.Assert_Equals (T, 12, Natural (D.Month_Day), "Invalid day ");
Util.Tests.Assert_Equals (T, 23, Natural (D.Hour), "Invalid hour ");
Util.Tests.Assert_Equals (T, 30, Natural (D.Minute), "Invalid minute ");
Assert_Equals (T, Ada.Calendar.Formatting.Wednesday, D.Day, "Invalid day ");
end Test_Split;
procedure Check (T : in out Test;
Date : in String) is
D : constant Ada.Calendar.Time := Util.Dates.RFC7231.Value (Date);
F : constant String := Util.Dates.RFC7231.Image (D);
begin
Util.Tests.Assert_Equals (T, Date, F, "Invalid date conversion");
end Check;
-- ------------------------------
-- Test the Append_Date as well as the Image operation
-- ------------------------------
procedure Test_Append_Date (T : in out Test) is
begin
Check (T, "Mon, 26 Mar 2012 19:43:47 GMT");
Check (T, "Tue, 02 Feb 2016 15:18:35 GMT");
Check (T, "Wed, 07 Oct 2015 03:41:11 GMT");
Check (T, "Thu, 17 Sep 2015 10:07:02 GMT");
Check (T, "Sat, 03 Oct 2015 17:09:58 GMT");
Check (T, "Fri, 17 Jul 2015 16:07:54 GMT");
Check (T, "Sun, 04 Oct 2015 15:10:44 GMT");
end Test_Append_Date;
-- ------------------------------
-- Test the ISO8601 operations.
-- ------------------------------
procedure Test_ISO8601 (T : in out Test) is
Date : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2014, 11, 12,
23, 30, 4, 0.123456);
D : Date_Record;
begin
Split (D, Date);
Util.Tests.Assert_Equals (T, "2014", ISO8601.Image (D, ISO8601.YEAR));
Util.Tests.Assert_Equals (T, "2014-11", ISO8601.Image (D, ISO8601.MONTH));
Util.Tests.Assert_Equals (T, "2014-11-12", ISO8601.Image (D, ISO8601.DAY));
Util.Tests.Assert_Equals (T, "2014-11-12T23", ISO8601.Image (D, ISO8601.HOUR));
Util.Tests.Assert_Equals (T, "2014-11-12T23:30", ISO8601.Image (D, ISO8601.MINUTE));
Util.Tests.Assert_Equals (T, "2014-11-12T23:30:04", ISO8601.Image (D, ISO8601.SECOND));
Util.Tests.Assert_Equals (T, "2014-11-12T23:30:04.123+00:00",
ISO8601.Image (D, ISO8601.SUBSECOND));
end Test_ISO8601;
end Util.Dates.Formats.Tests;
|
charlie5/lace | Ada | 841 | ads | with
lace.Environ.Paths;
private
with
ada.Strings.unbounded;
package lace.Environ.Users
--
-- Models operating system users.
--
is
type User is private;
function to_User (Name : in String) return User;
function "+" (Name : in String) return User renames to_User;
function Name (Self : in User) return String;
function current_User return User;
function home_Folder (Self : in User := current_User) return Paths.Folder;
procedure add_User (Self : in User; Super : in Boolean := False);
procedure rid_User (Self : in User);
procedure switch_to (Self : in User);
private
use ada.Strings.unbounded;
type User is
record
Name : unbounded_String;
end record;
end lace.Environ.Users;
|
zrmyers/VulkanAda | Ada | 1,829 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides a single precision floating point vector with 2 components.
--------------------------------------------------------------------------------
package Vulkan.Math.Vec2.Test is
-- Test Harness for Mat2x2 regression tests
procedure Test_Vec2;
end Vulkan.Math.Vec2.Test;
|
reznikmm/matreshka | Ada | 3,568 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2016-2017, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
private with League.Strings;
package WUI is
pragma Preelaborate;
private
function "+"
(Right : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
end WUI;
|
AdaCore/Ada_Drivers_Library | Ada | 1,875 | ads | -- This spec has been automatically generated from STM32F429x.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;
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;
end record;
-- Cyclic Redundancy Check (CRC) unit
CRC_Periph : aliased CRC_Peripheral
with Import, Address => System'To_Address (16#40023000#);
end STM32_SVD.CRC;
|
sungyeon/drake | Ada | 1,023 | ads | pragma License (Unrestricted);
-- implementation unit
package Ada.Containers.Binary_Trees.Simple is
pragma Preelaborate;
Node_Size : constant := Standard'Address_Size * 3;
type Node is new Binary_Trees.Node;
for Node'Size use Node_Size;
procedure Insert (
Container : in out Node_Access;
Length : in out Count_Type;
Before : Node_Access;
New_Item : not null Node_Access);
procedure Remove (
Container : in out Node_Access;
Length : in out Count_Type;
Position : not null Node_Access);
procedure Copy (
Target : out Node_Access;
Length : out Count_Type;
Source : Node_Access;
Copy : not null access procedure (
Target : out Node_Access;
Source : not null Node_Access));
-- set operations
procedure Merge is
new Binary_Trees.Merge (Insert => Insert, Remove => Remove);
procedure Copying_Merge is
new Binary_Trees.Copying_Merge (Insert => Insert);
end Ada.Containers.Binary_Trees.Simple;
|
zhmu/ananas | Ada | 10,651 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ C H A R A C T E R S . U N I C O D E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2005-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Unicode categorization routines for Wide_Character. Note that this
-- package is strictly speaking Ada 2005 (since it is a child of an
-- Ada 2005 unit), but we make it available in Ada 95 mode, since it
-- only deals with wide characters.
with System.UTF_32;
package Ada.Wide_Characters.Unicode is
pragma Pure;
-- The following type defines the categories from the unicode definitions.
-- The one addition we make is Fe, which represents the characters FFFE
-- and FFFF in any of the planes.
type Category is new System.UTF_32.Category;
-- Cc Other, Control
-- Cf Other, Format
-- Cn Other, Not Assigned
-- Co Other, Private Use
-- Cs Other, Surrogate
-- Ll Letter, Lowercase
-- Lm Letter, Modifier
-- Lo Letter, Other
-- Lt Letter, Titlecase
-- Lu Letter, Uppercase
-- Mc Mark, Spacing Combining
-- Me Mark, Enclosing
-- Mn Mark, Nonspacing
-- Nd Number, Decimal Digit
-- Nl Number, Letter
-- No Number, Other
-- Pc Punctuation, Connector
-- Pd Punctuation, Dash
-- Pe Punctuation, Close
-- Pf Punctuation, Final quote
-- Pi Punctuation, Initial quote
-- Po Punctuation, Other
-- Ps Punctuation, Open
-- Sc Symbol, Currency
-- Sk Symbol, Modifier
-- Sm Symbol, Math
-- So Symbol, Other
-- Zl Separator, Line
-- Zp Separator, Paragraph
-- Zs Separator, Space
-- Fe relative position FFFE/FFFF in plane
function Get_Category (U : Wide_Character) return Category;
pragma Inline (Get_Category);
-- Given a Wide_Character, returns corresponding Category, or Cn if the
-- code does not have an assigned unicode category.
-- The following functions perform category tests corresponding to lexical
-- classes defined in the Ada standard. There are two interfaces for each
-- function. The second takes a Category (e.g. returned by Get_Category).
-- The first takes a Wide_Character. The form taking the Wide_Character is
-- typically more efficient than calling Get_Category, but if several
-- different tests are to be performed on the same code, it is more
-- efficient to use Get_Category to get the category, then test the
-- resulting category.
function Is_Letter (U : Wide_Character) return Boolean;
function Is_Letter (C : Category) return Boolean;
pragma Inline (Is_Letter);
-- Returns true iff U is a letter that can be used to start an identifier,
-- or if C is one of the corresponding categories, which are the following:
-- Letter, Uppercase (Lu)
-- Letter, Lowercase (Ll)
-- Letter, Titlecase (Lt)
-- Letter, Modifier (Lm)
-- Letter, Other (Lo)
-- Number, Letter (Nl)
function Is_Digit (U : Wide_Character) return Boolean;
function Is_Digit (C : Category) return Boolean;
pragma Inline (Is_Digit);
-- Returns true iff U is a digit that can be used to extend an identifer,
-- or if C is one of the corresponding categories, which are the following:
-- Number, Decimal_Digit (Nd)
function Is_Line_Terminator (U : Wide_Character) return Boolean;
pragma Inline (Is_Line_Terminator);
-- Returns true iff U is an allowed line terminator for source programs,
-- if U is in the category Zp (Separator, Paragaph), or Zs (Separator,
-- Line), or if U is a conventional line terminator (CR, LF, VT, FF).
-- There is no category version for this function, since the set of
-- characters does not correspond to a set of Unicode categories.
function Is_Mark (U : Wide_Character) return Boolean;
function Is_Mark (C : Category) return Boolean;
pragma Inline (Is_Mark);
-- Returns true iff U is a mark character which can be used to extend an
-- identifier, or if C is one of the corresponding categories, which are
-- the following:
-- Mark, Non-Spacing (Mn)
-- Mark, Spacing Combining (Mc)
function Is_Other (U : Wide_Character) return Boolean;
function Is_Other (C : Category) return Boolean;
pragma Inline (Is_Other);
-- Returns true iff U is an other format character, which means that it
-- can be used to extend an identifier, but is ignored for the purposes of
-- matching of identifiers, or if C is one of the corresponding categories,
-- which are the following:
-- Other, Format (Cf)
function Is_Punctuation (U : Wide_Character) return Boolean;
function Is_Punctuation (C : Category) return Boolean;
pragma Inline (Is_Punctuation);
-- Returns true iff U is a punctuation character that can be used to
-- separate pices of an identifier, or if C is one of the corresponding
-- categories, which are the following:
-- Punctuation, Connector (Pc)
function Is_Space (U : Wide_Character) return Boolean;
function Is_Space (C : Category) return Boolean;
pragma Inline (Is_Space);
-- Returns true iff U is considered a space to be ignored, or if C is one
-- of the corresponding categories, which are the following:
-- Separator, Space (Zs)
function Is_NFKC (U : Wide_Character) return Boolean;
pragma Inline (Is_NFKC);
-- Returns True if the Wide_Character designated by U could be present
-- in a string normalized to Normalization Form KC (as defined by Clause
-- 21 of ISO/IEC 10646:2017), otherwise returns False.
function Is_Non_Graphic (U : Wide_Character) return Boolean;
function Is_Non_Graphic (C : Category) return Boolean;
pragma Inline (Is_Non_Graphic);
-- Returns true iff U is considered to be a non-graphic character, or if C
-- is one of the corresponding categories, which are the following:
-- Other, Control (Cc)
-- Other, Private Use (Co)
-- Other, Surrogate (Cs)
-- Separator, Line (Zl)
-- Separator, Paragraph (Zp)
-- FFFE or FFFF positions in any plane (Fe)
--
-- Note that the Ada category format effector is subsumed by the above
-- list of Unicode categories.
--
-- Note that Other, Unassiged (Cn) is quite deliberately not included
-- in the list of categories above. This means that should any of these
-- code positions be defined in future with graphic characters they will
-- be allowed without a need to change implementations or the standard.
--
-- Note that Other, Format (Cf) is also quite deliberately not included
-- in the list of categories above. This means that these characters can
-- be included in character and string literals.
function Is_Basic (U : Wide_Character) return Boolean;
pragma Inline (Is_Basic);
-- Returns True if the Wide_Character designated by Item has no
-- Decomposition Mapping in the code charts of ISO/IEC 10646:2017,
-- otherwise returns False.
function To_Basic (U : Wide_Character) return Wide_Character;
pragma Inline (To_Basic);
-- Returns the Wide_Character whose code point is given by the first value
-- of its Decomposition Mapping in the code charts of ISO/IEC 10646:2017 if
-- any, returns Item otherwise.
-- The following function is used to fold to upper case, as required by
-- the Ada 2005 standard rules for identifier case folding. Two
-- identifiers are equivalent if they are identical after folding all
-- letters to upper case using this routine. A corresponding function to
-- fold to lower case is also provided.
function To_Lower_Case (U : Wide_Character) return Wide_Character;
pragma Inline (To_Lower_Case);
-- If U represents an upper case letter, returns the corresponding lower
-- case letter, otherwise U is returned unchanged. The folding is locale
-- independent as defined by documents referenced in the note in section
-- 1 of ISO/IEC 10646:2003
function To_Upper_Case (U : Wide_Character) return Wide_Character;
pragma Inline (To_Upper_Case);
-- If U represents a lower case letter, returns the corresponding upper
-- case letter, otherwise U is returned unchanged. The folding is locale
-- independent as defined by documents referenced in the note in section
-- 1 of ISO/IEC 10646:2003
end Ada.Wide_Characters.Unicode;
|
stcarrez/ada-security | Ada | 1,170 | ads | -----------------------------------------------------------------------
-- security-random-tests - Tests for random package
-- Copyright (C) 2017, 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 Util.Tests;
package Security.Random.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Generate (T : in out Test);
procedure Test_Generate_String (T : in out Test);
end Security.Random.Tests;
|
onox/orka | Ada | 1,311 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.AVX.Singles.Logical is
pragma Pure;
function And_Not (Left, Right : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_andnps256";
function "and" (Left, Right : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_andps256";
function "or" (Left, Right : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_orps256";
function "xor" (Left, Right : m256) return m256
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_xorps256";
end Orka.SIMD.AVX.Singles.Logical;
|
jfouquart/synth | Ada | 47,804 | adb | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Ada.Command_Line;
with PortScan.Ops;
with Signals;
with Unix;
package body PortScan.Packages is
package CLI renames Ada.Command_Line;
package OPS renames PortScan.Ops;
package SIG renames Signals;
---------------------------
-- wipe_out_repository --
---------------------------
procedure wipe_out_repository (repository : String)
is
pkg_search : AD.Search_Type;
dirent : AD.Directory_Entry_Type;
begin
AD.Start_Search (Search => pkg_search,
Directory => repository,
Filter => (AD.Ordinary_File => True, others => False),
Pattern => "*.txz");
while AD.More_Entries (Search => pkg_search) loop
AD.Get_Next_Entry (Search => pkg_search,
Directory_Entry => dirent);
declare
pkgname : String := repository & "/" & AD.Simple_Name (dirent);
begin
AD.Delete_File (pkgname);
end;
end loop;
end wipe_out_repository;
-----------------------------
-- remove_queue_packages --
-----------------------------
procedure remove_queue_packages (repository : String)
is
procedure remove_package (cursor : ranking_crate.Cursor);
procedure remove_package (cursor : ranking_crate.Cursor)
is
QR : constant queue_record := ranking_crate.Element (cursor);
fullpath : constant String := repository & "/" &
JT.USS (all_ports (QR.ap_index).package_name);
begin
if AD.Exists (fullpath) then
AD.Delete_File (fullpath);
end if;
end remove_package;
begin
rank_queue.Iterate (remove_package'Access);
end remove_queue_packages;
----------------------------
-- initial_package_scan --
----------------------------
procedure initial_package_scan (repository : String; id : port_id) is
begin
if id = port_match_failed then
return;
end if;
if not all_ports (id).scanned then
return;
end if;
declare
pkgname : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkgname;
msg_opt : constant String := pkgname & " failed option check.";
msg_abi : constant String := pkgname & " failed architecture (ABI) check.";
begin
if AD.Exists (fullpath) then
all_ports (id).pkg_present := True;
else
return;
end if;
if not passed_option_check (repository, id, True) then
obsolete_notice (msg_opt, True);
all_ports (id).deletion_due := True;
return;
end if;
if not passed_abi_check (repository, id, True) then
obsolete_notice (msg_abi, True);
all_ports (id).deletion_due := True;
return;
end if;
end;
all_ports (id).pkg_dep_query := result_of_dependency_query (repository, id);
end initial_package_scan;
---------------------------
-- remote_package_scan --
---------------------------
procedure remote_package_scan (id : port_id) is
begin
if passed_abi_check (repository => "", id => id,
skip_exist_check => True)
then
all_ports (id).remote_pkg := True;
else
return;
end if;
if not passed_option_check (repository => "", id => id,
skip_exist_check => True)
then
all_ports (id).remote_pkg := False;
return;
end if;
all_ports (id).pkg_dep_query :=
result_of_dependency_query (repository => "", id => id);
end remote_package_scan;
----------------------------
-- limited_sanity_check --
----------------------------
procedure limited_sanity_check (repository : String; dry_run : Boolean;
suppress_remote : Boolean)
is
procedure prune_packages (cursor : ranking_crate.Cursor);
procedure check_package (cursor : ranking_crate.Cursor);
procedure prune_queue (cursor : subqueue.Cursor);
procedure print (cursor : subqueue.Cursor);
procedure fetch (cursor : subqueue.Cursor);
procedure check (cursor : subqueue.Cursor);
already_built : subqueue.Vector;
fetch_list : subqueue.Vector;
fetch_fail : Boolean := False;
clean_pass : Boolean := False;
listlog : TIO.File_Type;
goodlog : Boolean;
using_screen : constant Boolean := Unix.screen_attached;
filename : constant String := "/var/synth/synth_prefetch_list.txt";
package_list : JT.Text := JT.blank;
procedure check_package (cursor : ranking_crate.Cursor)
is
target : port_id := ranking_crate.Element (cursor).ap_index;
pkgname : String := JT.USS (all_ports (target).package_name);
available : constant Boolean := all_ports (target).remote_pkg or else
(all_ports (target).pkg_present and then
not all_ports (target).deletion_due);
begin
if not available then
return;
end if;
if passed_dependency_check
(query_result => all_ports (target).pkg_dep_query, id => target)
then
already_built.Append (New_Item => target);
if all_ports (target).remote_pkg then
fetch_list.Append (New_Item => target);
end if;
else
if all_ports (target).remote_pkg then
-- silently fail, remote packages are a bonus anyway
all_ports (target).remote_pkg := False;
else
obsolete_notice (pkgname & " failed dependency check.", True);
all_ports (target).deletion_due := True;
end if;
clean_pass := False;
end if;
end check_package;
procedure prune_queue (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
begin
OPS.cascade_successful_build (id);
end prune_queue;
procedure prune_packages (cursor : ranking_crate.Cursor)
is
target : port_id := ranking_crate.Element (cursor).ap_index;
delete_it : Boolean := all_ports (target).deletion_due;
pkgname : String := JT.USS (all_ports (target).package_name);
fullpath : constant String := repository & "/" & pkgname;
begin
if delete_it then
AD.Delete_File (fullpath);
end if;
exception
when others => null;
end prune_packages;
procedure print (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
line : constant String := JT.USS (all_ports (id).package_name) &
" (" & get_catport (all_ports (id)) & ")";
begin
TIO.Put_Line (" => " & line);
if goodlog then
TIO.Put_Line (listlog, line);
end if;
end print;
procedure fetch (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
begin
JT.SU.Append (package_list, " " & id2pkgname (id));
end fetch;
procedure check (cursor : subqueue.Cursor)
is
id : constant port_index := subqueue.Element (cursor);
name : constant String := JT.USS (all_ports (id).package_name);
loc : constant String := JT.USS (PM.configuration.dir_repository) &
"/" & name;
begin
if not AD.Exists (loc) then
TIO.Put_Line ("Download failed: " & name);
fetch_fail := True;
end if;
end check;
begin
if Unix.env_variable_defined ("WHYFAIL") then
activate_debugging_code;
end if;
establish_package_architecture;
original_queue_len := rank_queue.Length;
for m in scanners'Range loop
mq_progress (m) := 0;
end loop;
start_obsolete_package_logging;
parallel_package_scan (repository, False, using_screen);
if SIG.graceful_shutdown_requested then
TIO.Close (obsolete_pkg_log);
return;
end if;
while not clean_pass loop
clean_pass := True;
already_built.Clear;
rank_queue.Iterate (check_package'Access);
end loop;
if not suppress_remote and then PM.configuration.defer_prebuilt then
-- The defer_prebuilt options has been elected, so check all the
-- missing and to-be-pruned ports for suitable prebuilt packages
-- So we need to an incremental scan (skip valid, present packages)
for m in scanners'Range loop
mq_progress (m) := 0;
end loop;
parallel_package_scan (repository, True, using_screen);
if SIG.graceful_shutdown_requested then
TIO.Close (obsolete_pkg_log);
return;
end if;
clean_pass := False;
while not clean_pass loop
clean_pass := True;
already_built.Clear;
fetch_list.Clear;
rank_queue.Iterate (check_package'Access);
end loop;
end if;
TIO.Close (obsolete_pkg_log);
if SIG.graceful_shutdown_requested then
return;
end if;
if dry_run then
if not fetch_list.Is_Empty then
begin
-- Try to defend malicious symlink: https://en.wikipedia.org/wiki/Symlink_race
if AD.Exists (filename) then
AD.Delete_File (filename);
end if;
TIO.Create (File => listlog, Mode => TIO.Out_File, Name => filename);
goodlog := True;
exception
when others => goodlog := False;
end;
TIO.Put_Line ("These are the packages that would be fetched:");
fetch_list.Iterate (print'Access);
TIO.Put_Line ("Total packages that would be fetched:" &
fetch_list.Length'Img);
if goodlog then
TIO.Close (listlog);
TIO.Put_Line ("The complete build list can also be found at:"
& LAT.LF & filename);
end if;
else
if PM.configuration.defer_prebuilt then
TIO.Put_Line ("No packages qualify for prefetching from " &
"official package repository.");
end if;
end if;
else
rank_queue.Iterate (prune_packages'Access);
fetch_list.Iterate (fetch'Access);
if not JT.equivalent (package_list, JT.blank) then
declare
cmd : constant String := host_pkg8 & " fetch -r " &
JT.USS (external_repository) & " -U -y --output " &
JT.USS (PM.configuration.dir_packages) & JT.USS (package_list);
begin
if Unix.external_command (cmd) then
null;
end if;
end;
fetch_list.Iterate (check'Access);
end if;
end if;
if fetch_fail then
TIO.Put_Line ("At least one package failed to fetch, aborting build!");
rank_queue.Clear;
else
already_built.Iterate (prune_queue'Access);
end if;
end limited_sanity_check;
---------------------------
-- preclean_repository --
---------------------------
procedure preclean_repository (repository : String)
is
procedure insert (cursor : string_crate.Cursor);
using_screen : constant Boolean := Unix.screen_attached;
uniqid : PortScan.port_id := 0;
procedure insert (cursor : string_crate.Cursor)
is
key2 : JT.Text := string_crate.Element (cursor);
begin
if not portlist.Contains (key2) then
uniqid := uniqid + 1;
portlist.Insert (key2, uniqid);
end if;
end insert;
begin
if not scan_repository (repository) then
return;
end if;
parallel_preliminary_package_scan (repository, using_screen);
for ndx in scanners'Range loop
stored_origins (ndx).Iterate (insert'Access);
stored_origins (ndx).Clear;
end loop;
end preclean_repository;
-----------------------
-- scan_repository --
-----------------------
function scan_repository (repository : String) return Boolean
is
pkg_search : AD.Search_Type;
dirent : AD.Directory_Entry_Type;
pkg_index : scanners := scanners'First;
result : Boolean := False;
begin
AD.Start_Search (Search => pkg_search,
Directory => repository,
Filter => (AD.Ordinary_File => True, others => False),
Pattern => "*.txz");
while AD.More_Entries (Search => pkg_search) loop
AD.Get_Next_Entry (Search => pkg_search,
Directory_Entry => dirent);
declare
pkgname : JT.Text := JT.SUS (AD.Simple_Name (dirent));
begin
stored_packages (pkg_index).Append (New_Item => pkgname);
if pkg_index = scanners (number_cores) then
pkg_index := scanners'First;
else
pkg_index := pkg_index + 1;
end if;
pkgscan_total := pkgscan_total + 1;
result := True;
end;
end loop;
return result;
end scan_repository;
-----------------------------
-- generic_system_command --
-----------------------------
function generic_system_command (command : String) return JT.Text
is
content : JT.Text;
status : Integer;
begin
content := Unix.piped_command (command, status);
if status /= 0 then
raise pkgng_execution with "pkg options query cmd: " & command &
" (return code =" & status'Img & ")";
end if;
return content;
end generic_system_command;
---------------------------
-- passed_option_check --
---------------------------
function passed_option_check (repository : String; id : port_id;
skip_exist_check : Boolean := False)
return Boolean
is
begin
if id = port_match_failed or else not all_ports (id).scanned then
return False;
end if;
declare
pkg_base : constant String := id2pkgname (id);
pkg_name : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkg_name;
command : constant String := host_pkg8 & " query -F " & fullpath &
" %Ok:%Ov";
remocmd : constant String := host_pkg8 & " rquery -r " &
JT.USS (external_repository) & " -U %Ok:%Ov " & pkg_base;
content : JT.Text;
topline : JT.Text;
colon : Natural;
required : Natural := Natural (all_ports (id).options.Length);
counter : Natural := 0;
begin
if not skip_exist_check and then not AD.Exists (Name => fullpath)
then
return False;
end if;
declare
begin
if repository = "" then
content := generic_system_command (remocmd);
else
content := generic_system_command (command);
end if;
exception
when pkgng_execution => return False;
end;
loop
JT.nextline (lineblock => content, firstline => topline);
exit when JT.IsBlank (topline);
colon := JT.SU.Index (Source => topline, Pattern => ":");
if colon < 2 then
raise unknown_format with JT.USS (topline);
end if;
declare
knob : String := JT.SU.Slice (Source => topline,
Low => colon + 1,
High => JT.SU.Length (topline));
namekey : JT.Text := JT.SUS (JT.SU.Slice (Source => topline,
Low => 1,
High => colon - 1));
knobval : Boolean;
begin
if knob = "on" then
knobval := True;
elsif knob = "off" then
knobval := False;
else
raise unknown_format
with "knob=" & knob & "(" & JT.USS (topline) & ")";
end if;
counter := counter + 1;
if counter > required then
-- package has more options than we are looking for
declare
msg : String := "options " & JT.USS (namekey) & LAT.LF &
pkg_name & " has more options than required " &
"(" & JT.int2str (required) & ")";
begin
obsolete_notice (msg, debug_opt_check);
end;
return False;
end if;
if all_ports (id).options.Contains (namekey) then
if knobval /= all_ports (id).options.Element (namekey) then
-- port option value doesn't match package option value
declare
msg_on : String := pkg_name & " " & JT.USS (namekey) &
" is ON but port says it must be OFF";
msg_off : String := pkg_name & " " & JT.USS (namekey) &
" is OFF but port says it must be ON";
begin
if knobval then
obsolete_notice (msg_on, debug_opt_check);
else
obsolete_notice (msg_off, debug_opt_check);
end if;
end;
return False;
end if;
else
-- Name of package option not found in port options
declare
msg : String := pkg_name & " option " & JT.USS (namekey) &
" is no longer present in the port";
begin
obsolete_notice (msg, debug_opt_check);
end;
return False;
end if;
end;
end loop;
if counter < required then
-- The ports tree has more options than the existing package
declare
msg : String := pkg_name & " has less options than required "
& "(" & JT.int2str (required) & ")";
begin
obsolete_notice (msg, debug_opt_check);
end;
return False;
end if;
-- If we get this far, the package options must match port options
return True;
end;
exception
when issue : others =>
obsolete_notice ("option check exception" & LAT.LF &
EX.Exception_Message (issue), debug_opt_check);
return False;
end passed_option_check;
----------------------------------
-- result_of_dependency_query --
----------------------------------
function result_of_dependency_query (repository : String; id : port_id)
return JT.Text
is
pkg_base : constant String := id2pkgname (id);
pkg_name : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkg_name;
command : constant String := host_pkg8 & " query -F " & fullpath & " %do:%dn-%dv";
remocmd : constant String := host_pkg8 & " rquery -r " &
JT.USS (external_repository) & " -U %do:%dn-%dv " & pkg_base;
begin
if repository = "" then
return generic_system_command (remocmd);
else
return generic_system_command (command);
end if;
exception
when others => return JT.blank;
end result_of_dependency_query;
-------------------------------
-- passed_dependency_check --
-------------------------------
function passed_dependency_check (query_result : JT.Text; id : port_id)
return Boolean
is
begin
declare
content : JT.Text := query_result;
topline : JT.Text;
colon : Natural;
min_deps : constant Natural := all_ports (id).min_librun;
max_deps : constant Natural := Natural (all_ports (id).librun.Length);
headport : constant String := get_catport (all_ports (id));
counter : Natural := 0;
begin
loop
JT.nextline (lineblock => content, firstline => topline);
exit when JT.IsBlank (topline);
colon := JT.SU.Index (Source => topline, Pattern => ":");
if colon < 2 then
raise unknown_format with JT.USS (topline);
end if;
declare
line : constant String := JT.USS (topline);
origin : constant String := JT.part_1 (line, ":");
deppkg : constant String := JT.part_2 (line, ":") & ".txz";
origintxt : JT.Text := JT.SUS (origin);
target_id : port_index;
target_pkg : JT.Text;
available : Boolean;
begin
-- The packages contain only the origin. We have no idea about which
-- flavor is used if that origin features flavors. We have to probe all
-- flavors and deduce the correct flavor (Definitely, FPC flavors are inferior
-- to Ravenports variants).
--
-- The original implementation looked up the first listed flavor. If it had
-- flavors defined, it would iterate through the list to match packages. We
-- can't use this approach because the "rebuild-repository" routine only does
-- a partial scan, so the first flavor may not be populated. Instead, we
-- linearly go through the serial list until we find a match (or first part
-- of origin doesn't match.
if so_porthash.Contains (origintxt) then
declare
probe_id : port_index := so_porthash.Element (origintxt);
base_pkg : String := JT.head (deppkg, "-");
found_it : Boolean := False;
maxprobe : port_index := port_index (so_serial.Length) - 1;
begin
loop
if all_ports (probe_id).scanned then
declare
pkg_file : String := JT.USS (all_ports (probe_id).package_name);
test_pkg : String := JT.head (pkg_file, "-");
begin
if test_pkg = base_pkg then
found_it := True;
target_id := probe_id;
exit;
end if;
end;
end if;
probe_id := probe_id + 1;
exit when probe_id > maxprobe;
exit when not JT.leads (so_serial.Element (probe_id), origin);
end loop;
if not found_it then
obsolete_notice (origin & " package unmatched", debug_dep_check);
return False;
end if;
end;
target_pkg := all_ports (target_id).package_name;
available := all_ports (target_id).remote_pkg or else
(all_ports (target_id).pkg_present and then
not all_ports (target_id).deletion_due);
else
-- package has a dependency that has been removed from the ports tree
declare
msg : String := origin & " has been removed from the ports tree";
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
counter := counter + 1;
if counter > max_deps then
-- package has more dependencies than we are looking for
declare
msg : String := headport & " package has more dependencies than the port " &
"requires (" & JT.int2str (max_deps) & ")" & LAT.LF &
"Query: " & JT.USS (query_result) & LAT.LF &
"Tripped on: " & JT.USS (target_pkg) & ":" & origin;
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
if deppkg /= JT.USS (target_pkg)
then
-- The version that the package requires differs from the
-- version that the ports tree will now produce
declare
msg : String :=
"Current " & headport & " package depends on " & deppkg &
", but this is a different version than requirement of " &
JT.USS (target_pkg) & " (from " & origin & ")";
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
if not available then
-- Even if all the versions are matching, we still need
-- the package to be in repository.
declare
msg : String :=
headport & " package depends on " & JT.USS (target_pkg) &
" which doesn't exist or has been scheduled " &
"for deletion";
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
end;
end loop;
if counter < min_deps then
-- The ports tree requires more dependencies than the existing
-- package does
declare
msg : String :=
headport & " package has less dependencies than the port " &
"requires (" & JT.int2str (min_deps) & ")" & LAT.LF &
"Query: " & JT.USS (query_result);
begin
obsolete_notice (msg, debug_dep_check);
end;
return False;
end if;
-- If we get this far, the package dependencies match what the
-- port tree requires exactly. This package passed sanity check.
return True;
end;
exception
when issue : others =>
obsolete_notice ("Dependency check exception" & LAT.LF &
EX.Exception_Message (issue), debug_dep_check);
return False;
end passed_dependency_check;
------------------
-- id2pkgname --
------------------
function id2pkgname (id : port_id) return String
is
pkg_name : constant String := JT.USS (all_ports (id).package_name);
len : constant Natural := pkg_name'Length - 4;
begin
return pkg_name (1 .. len);
end id2pkgname;
------------------------
-- passed_abi_check --
------------------------
function passed_abi_check (repository : String; id : port_id;
skip_exist_check : Boolean := False)
return Boolean
is
pkg_base : constant String := id2pkgname (id);
pkg_name : constant String := JT.USS (all_ports (id).package_name);
fullpath : constant String := repository & "/" & pkg_name;
command : constant String := host_pkg8 & " query -F " & fullpath & " %q";
remocmd : constant String := host_pkg8 & " rquery -r " &
JT.USS (external_repository) & " -U %q " & pkg_base;
content : JT.Text;
topline : JT.Text;
begin
if not skip_exist_check and then not AD.Exists (Name => fullpath)
then
return False;
end if;
declare
begin
if repository = "" then
content := generic_system_command (remocmd);
else
content := generic_system_command (command);
end if;
exception
when pkgng_execution => return False;
end;
JT.nextline (lineblock => content, firstline => topline);
if JT.equivalent (topline, abi_formats.calculated_abi) then
return True;
end if;
if JT.equivalent (topline, abi_formats.calc_abi_noarch) then
return True;
end if;
if JT.equivalent (topline, abi_formats.calculated_alt_abi) then
return True;
end if;
if JT.equivalent (topline, abi_formats.calc_alt_abi_noarch) then
return True;
end if;
return False;
exception
when others => return False;
end passed_abi_check;
----------------------
-- queue_is_empty --
----------------------
function queue_is_empty return Boolean is
begin
return rank_queue.Is_Empty;
end queue_is_empty;
--------------------------------------
-- establish_package_architecture --
--------------------------------------
procedure establish_package_architecture is
begin
abi_formats := Replicant.Platform.determine_package_architecture;
end establish_package_architecture;
---------------------------
-- original_queue_size --
---------------------------
function original_queue_size return Natural is
begin
return Natural (original_queue_len);
end original_queue_size;
----------------------------------
-- passed_options_cache_check --
----------------------------------
function passed_options_cache_check (id : port_id) return Boolean
is
target_dname : String := JT.replace (get_catport (all_ports (id)),
reject => LAT.Solidus,
shiny => LAT.Low_Line);
target_path : constant String := JT.USS (PM.configuration.dir_options) &
LAT.Solidus & target_dname & LAT.Solidus & "options";
marker : constant String := "+=";
option_file : TIO.File_Type;
required : Natural := Natural (all_ports (id).options.Length);
counter : Natural := 0;
result : Boolean := False;
begin
if not AD.Exists (target_path) then
return True;
end if;
TIO.Open (File => option_file,
Mode => TIO.In_File,
Name => target_path);
while not TIO.End_Of_File (option_file) loop
declare
Line : String := TIO.Get_Line (option_file);
namekey : JT.Text;
valid : Boolean := False;
begin
-- If "marker" starts at 17, it's OPTIONS_FILES_SET
-- if "marker" starts at 19, it's OPTIONS_FILES_UNSET
-- if neither, we don't care.
if Line (17 .. 18) = marker then
namekey := JT.SUS (Line (19 .. Line'Last));
valid := True;
elsif Line (19 .. 20) = marker then
namekey := JT.SUS (Line (21 .. Line'Last));
valid := True;
end if;
if valid then
counter := counter + 1;
if counter > required then
-- The port used to have more options, abort!
goto clean_exit;
end if;
if not all_ports (id).options.Contains (namekey) then
-- cached option not found in port anymore, abort!
goto clean_exit;
end if;
end if;
end;
end loop;
if counter = required then
result := True;
end if;
<<clean_exit>>
TIO.Close (option_file);
return result;
end passed_options_cache_check;
------------------------------------
-- limited_cached_options_check --
------------------------------------
function limited_cached_options_check return Boolean
is
procedure check_port (cursor : ranking_crate.Cursor);
fail_count : Natural := 0;
first_fail : queue_record;
procedure check_port (cursor : ranking_crate.Cursor)
is
QR : constant queue_record := ranking_crate.Element (cursor);
id : port_index := QR.ap_index;
prelude : constant String := "Cached options obsolete: ";
begin
if not passed_options_cache_check (id) then
if fail_count = 0 then
first_fail := QR;
end if;
fail_count := fail_count + 1;
TIO.Put_Line (prelude & get_catport (all_ports (id)));
end if;
end check_port;
begin
rank_queue.Iterate (Process => check_port'Access);
if fail_count > 0 then
CLI.Set_Exit_Status (1);
TIO.Put (LAT.LF & "A preliminary scan has revealed the cached " &
"options of");
if fail_count = 1 then
TIO.Put_Line (" one port are");
else
TIO.Put_Line (fail_count'Img & " ports are");
end if;
TIO.Put_Line ("obsolete. Please update or remove the saved " &
"options and try again.");
declare
portsdir : String := JT.USS (PM.configuration.dir_portsdir) &
LAT.Solidus;
catport : String := get_catport (all_ports (first_fail.ap_index));
begin
TIO.Put_Line (" e.g. make -C " & portsdir & catport & " config");
TIO.Put_Line (" e.g. make -C " & portsdir & catport & " rmconfig");
end;
end if;
return (fail_count = 0);
end limited_cached_options_check;
-----------------------------
-- parallel_package_scan --
-----------------------------
procedure parallel_package_scan (repository : String; remote_scan : Boolean;
show_progress : Boolean)
is
task type scan (lot : scanners);
finished : array (scanners) of Boolean := (others => False);
combined_wait : Boolean := True;
label_shown : Boolean := False;
aborted : Boolean := False;
task body scan
is
procedure populate (cursor : subqueue.Cursor);
procedure populate (cursor : subqueue.Cursor)
is
target_port : port_index := subqueue.Element (cursor);
important : constant Boolean := all_ports (target_port).scanned;
begin
if not aborted and then important then
if remote_scan and then
not all_ports (target_port).never_remote
then
if not all_ports (target_port).pkg_present or else
all_ports (target_port).deletion_due
then
remote_package_scan (target_port);
end if;
else
initial_package_scan (repository, target_port);
end if;
end if;
mq_progress (lot) := mq_progress (lot) + 1;
end populate;
begin
make_queue (lot).Iterate (populate'Access);
finished (lot) := True;
end scan;
scan_01 : scan (lot => 1);
scan_02 : scan (lot => 2);
scan_03 : scan (lot => 3);
scan_04 : scan (lot => 4);
scan_05 : scan (lot => 5);
scan_06 : scan (lot => 6);
scan_07 : scan (lot => 7);
scan_08 : scan (lot => 8);
scan_09 : scan (lot => 9);
scan_10 : scan (lot => 10);
scan_11 : scan (lot => 11);
scan_12 : scan (lot => 12);
scan_13 : scan (lot => 13);
scan_14 : scan (lot => 14);
scan_15 : scan (lot => 15);
scan_16 : scan (lot => 16);
scan_17 : scan (lot => 17);
scan_18 : scan (lot => 18);
scan_19 : scan (lot => 19);
scan_20 : scan (lot => 20);
scan_21 : scan (lot => 21);
scan_22 : scan (lot => 22);
scan_23 : scan (lot => 23);
scan_24 : scan (lot => 24);
scan_25 : scan (lot => 25);
scan_26 : scan (lot => 26);
scan_27 : scan (lot => 27);
scan_28 : scan (lot => 28);
scan_29 : scan (lot => 29);
scan_30 : scan (lot => 30);
scan_31 : scan (lot => 31);
scan_32 : scan (lot => 32);
begin
while combined_wait loop
delay 1.0;
combined_wait := False;
for j in scanners'Range loop
if not finished (j) then
combined_wait := True;
exit;
end if;
end loop;
if combined_wait then
if not label_shown then
label_shown := True;
TIO.Put_Line ("Scanning existing packages.");
end if;
if show_progress then
TIO.Put (scan_progress);
end if;
if SIG.graceful_shutdown_requested then
aborted := True;
end if;
end if;
end loop;
end parallel_package_scan;
-----------------------------------------
-- parallel_preliminary_package_scan --
-----------------------------------------
procedure parallel_preliminary_package_scan (repository : String;
show_progress : Boolean)
is
task type scan (lot : scanners);
finished : array (scanners) of Boolean := (others => False);
combined_wait : Boolean := True;
label_shown : Boolean := False;
aborted : Boolean := False;
task body scan
is
procedure check (csr : string_crate.Cursor);
procedure check (csr : string_crate.Cursor) is
begin
if aborted then
return;
end if;
declare
pkgname : constant String := JT.USS (string_crate.Element (csr));
pkgpath : constant String := repository & "/" & pkgname;
origin : constant String := query_origin (pkgpath);
path1 : constant String := JT.USS (PM.configuration.dir_portsdir) & "/" & origin;
remove : Boolean := True;
begin
if AD.Exists (path1) then
declare
full_origin : constant String := query_full_origin (pkgpath, origin);
begin
if current_package_name (full_origin, pkgname) then
stored_origins (lot).Append (New_Item => JT.SUS (full_origin));
remove := False;
end if;
end;
end if;
if remove then
AD.Delete_File (pkgpath);
TIO.Put_Line ("Removed: " & pkgname);
end if;
exception
when others =>
TIO.Put_Line (" Failed to remove " & pkgname);
end;
pkgscan_progress (lot) := pkgscan_progress (lot) + 1;
end check;
begin
stored_packages (lot).Iterate (check'Access);
stored_packages (lot).Clear;
finished (lot) := True;
end scan;
scan_01 : scan (lot => 1);
scan_02 : scan (lot => 2);
scan_03 : scan (lot => 3);
scan_04 : scan (lot => 4);
scan_05 : scan (lot => 5);
scan_06 : scan (lot => 6);
scan_07 : scan (lot => 7);
scan_08 : scan (lot => 8);
scan_09 : scan (lot => 9);
scan_10 : scan (lot => 10);
scan_11 : scan (lot => 11);
scan_12 : scan (lot => 12);
scan_13 : scan (lot => 13);
scan_14 : scan (lot => 14);
scan_15 : scan (lot => 15);
scan_16 : scan (lot => 16);
scan_17 : scan (lot => 17);
scan_18 : scan (lot => 18);
scan_19 : scan (lot => 19);
scan_20 : scan (lot => 20);
scan_21 : scan (lot => 21);
scan_22 : scan (lot => 22);
scan_23 : scan (lot => 23);
scan_24 : scan (lot => 24);
scan_25 : scan (lot => 25);
scan_26 : scan (lot => 26);
scan_27 : scan (lot => 27);
scan_28 : scan (lot => 28);
scan_29 : scan (lot => 29);
scan_30 : scan (lot => 30);
scan_31 : scan (lot => 31);
scan_32 : scan (lot => 32);
begin
while combined_wait loop
delay 1.0;
if show_progress then
TIO.Put (package_scan_progress);
end if;
combined_wait := False;
for j in scanners'Range loop
if not finished (j) then
combined_wait := True;
exit;
end if;
end loop;
if combined_wait then
if not label_shown then
label_shown := True;
TIO.Put_Line ("Stand by, prescanning existing packages.");
end if;
if SIG.graceful_shutdown_requested then
aborted := True;
end if;
end if;
end loop;
end parallel_preliminary_package_scan;
-----------------------------------
-- located_external_repository --
-----------------------------------
function located_external_repository return Boolean
is
command : constant String := host_pkg8 & " -vv";
dump : JT.Text;
topline : JT.Text;
crlen1 : Natural;
crlen2 : Natural;
found : Boolean := False;
inspect : Boolean := False;
begin
declare
begin
dump := generic_system_command (command);
exception
when pkgng_execution => return False;
end;
crlen1 := JT.SU.Length (dump);
loop
JT.nextline (lineblock => dump, firstline => topline);
crlen2 := JT.SU.Length (dump);
exit when crlen1 = crlen2;
crlen1 := crlen2;
if inspect then
declare
line : constant String := JT.USS (topline);
len : constant Natural := line'Length;
begin
if len > 7 and then
line (1 .. 2) = " " and then
line (len - 3 .. len) = ": { " and then
line (3 .. len - 4) /= "Synth"
then
found := True;
external_repository := JT.SUS (line (3 .. len - 4));
exit;
end if;
end;
else
if JT.equivalent (topline, "Repositories:") then
inspect := True;
end if;
end if;
end loop;
return found;
end located_external_repository;
-------------------------------
-- top_external_repository --
-------------------------------
function top_external_repository return String is
begin
return JT.USS (external_repository);
end top_external_repository;
-------------------------------
-- activate_debugging_code --
-------------------------------
procedure activate_debugging_code is
begin
debug_opt_check := True;
debug_dep_check := True;
end activate_debugging_code;
--------------------
-- query_origin --
--------------------
function query_origin (fullpath : String) return String
is
command : constant String := host_pkg8 & " query -F " & fullpath & " %o";
content : JT.Text;
topline : JT.Text;
begin
content := generic_system_command (command);
JT.nextline (lineblock => content, firstline => topline);
return JT.USS (topline);
exception
when others => return "";
end query_origin;
---------------------
-- query_pkgbase --
---------------------
function query_pkgbase (fullpath : String) return String
is
command : constant String := host_pkg8 & " query -F " & fullpath & " %n";
content : JT.Text;
topline : JT.Text;
begin
content := generic_system_command (command);
JT.nextline (lineblock => content, firstline => topline);
return JT.USS (topline);
exception
when others => return "";
end query_pkgbase;
-------------------------
-- query_full_origin --
-------------------------
function query_full_origin (fullpath, origin : String) return String
is
command : constant String := host_pkg8 & " query -F " & fullpath & " %At:%Av";
content : JT.Text;
begin
content := generic_system_command (command);
declare
contents : constant String := JT.USS (content);
markers : JT.Line_Markers;
begin
JT.initialize_markers (contents, markers);
if JT.next_line_with_content_present (contents, "flavor:", markers) then
declare
line : constant String := JT.extract_line (contents, markers);
begin
return origin & "@" & JT.part_2 (line, ":");
end;
else
return origin;
end if;
end;
exception
when others => return origin;
end query_full_origin;
----------------------------
-- current_package_name --
----------------------------
function current_package_name (origin, file_name : String) return Boolean
is
cpn : constant String := get_pkg_name (origin);
begin
return cpn = file_name;
end current_package_name;
-----------------------------
-- package_scan_progress --
-----------------------------
function package_scan_progress return String
is
type percent is delta 0.01 digits 5;
complete : port_index := 0;
pc : percent;
total : constant Float := Float (pkgscan_total);
begin
for k in scanners'Range loop
complete := complete + pkgscan_progress (k);
end loop;
pc := percent (100.0 * Float (complete) / total);
return " progress:" & pc'Img & "% " & LAT.CR;
end package_scan_progress;
--------------------------------------
-- start_obsolete_package_logging --
--------------------------------------
procedure start_obsolete_package_logging
is
logpath : constant String := JT.USS (PM.configuration.dir_logs)
& "/06_obsolete_packages.log";
begin
-- Try to defend malicious symlink: https://en.wikipedia.org/wiki/Symlink_race
if AD.Exists (logpath) then
AD.Delete_File (logpath);
end if;
TIO.Create (File => obsolete_pkg_log,
Mode => TIO.Out_File,
Name => logpath);
obsolete_log_open := True;
exception
when others =>
obsolete_log_open := False;
end start_obsolete_package_logging;
-----------------------
-- obsolete_notice --
-----------------------
procedure obsolete_notice (message : String; write_to_screen : Boolean)
is
begin
if obsolete_log_open then
TIO.Put_Line (obsolete_pkg_log, message);
end if;
if write_to_screen then
TIO.Put_Line (message);
end if;
end obsolete_notice;
end PortScan.Packages;
|
AdaCore/libadalang | Ada | 22,695 | adb | ------------------------------------------------------------------------------
-- G P S --
-- --
-- Copyright (C) 2010-2017, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
with Ada_Semantic_Tree.Parts; use Ada_Semantic_Tree.Parts;
with Ada.Unchecked_Deallocation;
with Language.Ada; use Language.Ada;
package body Ada_Semantic_Tree is
-----------------------
-- Get_Documentation --
-----------------------
function Get_Documentation
(E : access Entity_View_Record) return String is
begin
pragma Unreferenced (E);
return "";
end Get_Documentation;
-------------------
-- Get_Construct --
-------------------
function Get_Construct
(E : access Entity_View_Record'Class)
return access Simple_Construct_Information
is
Entity : Entity_Access;
begin
if E = null then
return null;
end if;
Entity := E.Get_Entity;
if Entity /= Null_Entity_Access then
return Get_Construct (Entity);
else
return null;
end if;
end Get_Construct;
-------------------
-- Is_Accessible --
-------------------
function Is_Accessible
(E : access Entity_View_Record)
return Boolean
is
pragma Unreferenced (E);
begin
return True;
end Is_Accessible;
------------------
-- Get_Category --
------------------
function Get_Category
(E : access Entity_View_Record) return Language_Category
is
Construct : access Simple_Construct_Information;
begin
if E = null then
return Cat_Unknown;
end if;
Construct := E.Get_Construct;
if Construct /= null then
return Construct.Category;
else
return Cat_Unknown;
end if;
end Get_Category;
--------------------------------
-- To_Construct_Tree_Iterator --
--------------------------------
function To_Construct_Tree_Iterator
(E : Entity_View) return Construct_Tree_Iterator is
begin
return To_Construct_Tree_Iterator (E.Get_Entity);
end To_Construct_Tree_Iterator;
--------------
-- Get_File --
--------------
function Get_File (E : Entity_View) return Structured_File_Access is
begin
if E.Entity /= Null_Entity_Access then
return Get_File (E.Entity);
else
return Get_File (E.Persistent);
end if;
end Get_File;
------------
-- Is_All --
------------
function Is_All (E : Entity_View) return Boolean is
begin
return E.Is_All;
end Is_All;
----------------
-- Set_Is_All --
----------------
procedure Set_Is_All (E : Entity_View; Is_All : Boolean) is
begin
E.Is_All := Is_All;
end Set_Is_All;
----------
-- Free --
----------
procedure Free (E : in out Entity_View) is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Entity_View_Record'Class, Entity_View);
begin
if E /= null then
Free (E.all);
if E.Persistent /= Null_Entity_Persistent_Access then
Unref (E.Persistent);
end if;
Unchecked_Free (E);
end if;
end Free;
---------------
-- Deep_Copy --
---------------
function Deep_Copy (E : Entity_View) return Entity_View
is
Copy : Entity_View;
begin
if E = null then
return null;
else
Copy := new Entity_View_Record'Class'(E.all);
if Copy.Entity /= Null_Entity_Access then
Copy.Persistent := To_Entity_Persistent_Access (Copy.Entity);
Copy.Entity := Null_Entity_Access;
elsif Copy.Persistent /= Null_Entity_Persistent_Access then
Ref (Copy.Persistent);
end if;
Deep_Copy (Copy.all);
return Copy;
end if;
end Deep_Copy;
-----------------
-- Copy_On_Get --
-----------------
procedure Copy_On_Get (E : in out Entity_View) is
begin
E := Deep_Copy (E);
end Copy_On_Get;
----------------
-- Get_Entity --
----------------
function Get_Entity
(E : access Entity_View_Record'Class) return Entity_Access
is
begin
if E = null then
return Null_Entity_Access;
elsif E.Entity /= Null_Entity_Access then
return E.Entity;
elsif E.Persistent /= Null_Entity_Persistent_Access then
return To_Entity_Access (E.Persistent);
else
return Null_Entity_Access;
end if;
end Get_Entity;
---------------
-- Filter_In --
---------------
function Filter_In
(Filter : Entity_Filter; E : Entity_Access) return Boolean is
begin
case Filter.Kind is
when Categories_Filter =>
return Filter.Categories (Get_Construct (E).Category);
when Exceptions_Only =>
if Get_Construct (E).Category = Cat_Package then
return True;
elsif Get_Construct (E).Category = Cat_Local_Variable
or else Get_Construct (E).Category = Cat_Variable
then
declare
List : constant Referenced_Identifiers_List :=
Get_Referenced_Identifiers
(To_Construct_Tree_Iterator (E));
begin
if List /= Null_Referenced_Identifiers_List then
if Get_Identifier (List) =
Find_Normalized (Ada_Lang.Symbols, "exception")
then
return True;
end if;
end if;
end;
end if;
return False;
when others =>
return True;
end case;
end Filter_In;
------------
-- Create --
------------
function Create
(Categories : Category_Array) return Entity_Filter
is
Result : Entity_Filter (Categories_Filter);
begin
Result.Categories := (others => False);
for J in Categories'Range loop
Result.Categories (Categories (J)) := True;
end loop;
return Result;
end Create;
----------
-- Free --
----------
procedure Free (List : in out Entity_List) is
begin
Free (List.Contents);
Unref (List.Excluded_List);
end Free;
----------
-- Free --
----------
procedure Free (It : in out Entity_Iterator) is
begin
-- Excluded_List is freed with the list, no need to free it here
Free (It.It);
end Free;
-----------
-- First --
-----------
function First (List : Entity_List) return Entity_Iterator is
Result : Entity_Iterator;
begin
Result :=
(It => Entity_List_Pckg.First (List.Contents),
Excluded_List => List.Excluded_List,
From_Visibility => List.From_Visibility);
while not Is_Valid (Result) loop
Next (Result);
end loop;
return Result;
end First;
----------
-- Next --
----------
procedure Next (It : in out Entity_Iterator) is
begin
Next (It.It);
while not Is_Valid (It) loop
Next (It.It);
end loop;
end Next;
------------
-- At_End --
------------
function At_End (It : Entity_Iterator) return Boolean is
begin
return At_End (It.It);
end At_End;
--------------
-- Is_Valid --
--------------
function Is_Valid (It : Entity_Iterator) return Boolean is
Result : Boolean;
begin
if At_End (It) then
return True;
else
Result := not Is_Excluded (It.Excluded_List, Get_Entity (It));
return Result;
end if;
end Is_Valid;
--------------
-- Get_View --
--------------
function Get_View (It : Entity_Iterator) return Entity_View is
E : Entity_View;
begin
-- This assumes that a copy of the data is done below, by the sub
-- iterator
E := Get (It.It);
if Is_Excluded (It.Excluded_List, E.Get_Entity) then
return Null_Entity_View;
end if;
Configure_View (E.all, It);
return E;
end Get_View;
----------------
-- Get_Entity --
----------------
function Get_Entity (It : Entity_Iterator) return Entity_Access is
View : Entity_View := Get (It.It);
Result : Entity_Access;
begin
if View = Null_Entity_View then
return Null_Entity_Access;
end if;
Result := View.Get_Entity;
Free (View);
-- ??? It's a bit annoying to have to create and free a temporary view,
-- would be better to somehow get the entity directly.
return Result;
end Get_Entity;
----------------
-- Pop_Entity --
----------------
procedure Pop_Entity (Stack : in out Excluded_Stack_Type) is
begin
Stack.Entities.Delete_First;
end Pop_Entity;
-----------------
-- Push_Entity --
-----------------
procedure Push_Entity
(Stack : in out Excluded_Stack_Type; Entity : Entity_Access) is
begin
Prepend (Stack.Entities, Entity);
end Push_Entity;
-----------------
-- Is_Excluded --
-----------------
function Is_Excluded
(Stack : Excluded_Stack_Type; Entity : Entity_Access) return Boolean is
begin
if Stack = null then
return False;
end if;
for Item of Stack.Entities loop
-- If the two entities are exactly on the same construct, or if
-- they are parts of the same enitity, then we found an excluded
-- construct.
if (Get_File (Item) = Get_File (Entity)
and then To_Construct_Tree_Iterator (Item) =
To_Construct_Tree_Iterator (Entity))
or else Are_Same_Entity (Item, Entity)
then
return True;
end if;
end loop;
return False;
end Is_Excluded;
---------
-- Ref --
---------
procedure Ref (Stack : in out Excluded_Stack_Type) is
begin
if Stack = null then
Stack := new Excluded_Stack_Type_Record;
end if;
Stack.Refs := Stack.Refs + 1;
end Ref;
-----------
-- Unref --
-----------
procedure Unref (Stack : in out Excluded_Stack_Type) is
procedure Free is new Ada.Unchecked_Deallocation
(Excluded_Stack_Type_Record, Excluded_Stack_Type);
begin
if Stack /= null then
Stack.Refs := Stack.Refs - 1;
if Stack.Refs = 0 then
Stack.Entities.Clear;
Free (Stack);
end if;
end if;
end Unref;
-------------------------------
-- Parse_Expression_Backward --
-------------------------------
function Parse_Expression_Backward
(Buffer : access constant UTF8_String;
Start_Offset : String_Index_Type;
End_Offset : String_Index_Type := 0;
Multiple_Operands : Boolean := False)
return Parsed_Expression
is
use Token_List;
Result : Parsed_Expression;
Expression_Depth : Natural := 0;
Expression_Token : Token_Record;
Last_Token : Token_Record := Null_Token;
Last_Non_Blank_Token : Token_Record := Null_Token;
In_Found : Boolean := False;
All_Found : Boolean := False;
With_Token_Found : Token_Record := Null_Token;
procedure Handle_Token (Token : Token_Record; Stop : in out Boolean);
------------------
-- Handle_Token --
------------------
procedure Handle_Token (Token : Token_Record; Stop : in out Boolean) is
begin
Stop := False;
if Expression_Depth = 0 then
if Token.Tok_Type /= Tok_Blank then
if With_Token_Found /= Null_Token then
-- If token before "with" not a semicolon then
-- "with" token is for an aspect or for a record definition
-- for new type. "type T_Child is new T with null record;"
-- Result contains Tok_Aspect
-- take into account limited private with clause.
case Token.Tok_Type is
when Tok_Limited | Tok_Private =>
return;
when Tok_Semicolon =>
null;
when others =>
With_Token_Found.Tok_Type := Tok_Aspect;
end case;
Prepend (Result.Tokens, With_Token_Found);
With_Token_Found := Null_Token;
Stop := True;
return;
end if;
if In_Found then
-- If the 'in' keyword is found, we need to make sure that
-- we're on a variable declaration, e.g.:
-- V : in Integer;
-- in such cases, we need to check that the current token is
-- a semicolon, add it and leave.
-- In all other situations, dismiss the in and leave.
if Token.Tok_Type = Tok_Colon then
Prepend (Result.Tokens, Token);
Stop := True;
else
Stop := not Multiple_Operands;
end if;
if Stop then
return;
end if;
end if;
if All_Found and then Token.Tok_Type /= Tok_Dot then
-- The only thing that we analyse so far is the
-- .all expression. In any other case, e.g. access all, we
-- just dismiss the all keyword and stop the analysis.
Result.Tokens.Delete_First;
Stop := True;
return;
else
All_Found := False;
end if;
end if;
case Token.Tok_Type is
when Tok_Use
| Tok_Pragma
| Tok_Colon
| Tok_Accept
| Tok_Raise =>
Prepend (Result.Tokens, Token);
Stop := True;
when Tok_Identifier =>
if Last_Non_Blank_Token.Tok_Type = Tok_Identifier then
Stop := not Multiple_Operands;
elsif Result.Tokens.Is_Empty
and then Last_Token.Tok_Type = Tok_Blank
then
Stop := not Multiple_Operands;
else
Prepend (Result.Tokens, Token);
end if;
when Tok_With =>
With_Token_Found := Token;
when Tok_Tick
| Tok_Arrow
| Tok_Dot =>
Prepend (Result.Tokens, Token);
when Tok_All =>
All_Found := True;
Prepend (Result.Tokens, Token);
when Tok_Close_Parenthesis =>
if Last_Non_Blank_Token.Tok_Type = Tok_In then
-- We're on e.g. for X in A, don't get more things
if not Multiple_Operands then
Stop := True;
return;
end if;
end if;
Prepend (Result.Tokens, Token);
Expression_Depth := 1;
Expression_Token.Tok_Type := Tok_Expression;
when Tok_Comma =>
if Last_Non_Blank_Token = Null_Token then
Expression_Depth := 1;
Expression_Token.Tok_Type := Tok_Expression;
else
Stop := True;
end if;
when Tok_Open_Parenthesis =>
if Last_Non_Blank_Token = Null_Token then
Prepend (Result.Tokens, Token);
else
Stop := True;
end if;
when Tok_In =>
-- In declaration, e.g. A : in B. Ignore the
-- modifier keywords, but store it to see later if we're
-- actually in a case like 'for A in B'.
In_Found := True;
when Tok_Aliased
| Tok_Access
| Tok_Constant
| Tok_Null
| Tok_Not
| Tok_Out =>
-- In declaration, e.g. A : constant B. Ignore the
-- modifier keywords
null;
when Tok_Blank =>
null;
when Tok_Operator
| Tok_And
| Tok_Mod
| Tok_Or
| Tok_Rem
| Tok_Xor =>
Stop := not Multiple_Operands;
when Tok_Then
| Tok_Else =>
-- ??? We should probably be smarter here, and work the
-- "or else" and "and then" things, but doesn't seems to
-- be too much of a problem so far given the way things are
-- used.
Stop := not Multiple_Operands;
when others =>
Stop := True;
end case;
if Token.Tok_Type /= Tok_Blank then
Last_Non_Blank_Token := Token;
end if;
Last_Token := Token;
else
if Token.Tok_Type = Tok_Close_Parenthesis then
Expression_Depth := Expression_Depth + 1;
elsif Token.Tok_Type = Tok_Open_Parenthesis then
Expression_Depth := Expression_Depth - 1;
elsif Token.Tok_Type = Tok_Comma and then Expression_Depth = 1 then
Prepend (Result.Tokens, Expression_Token);
Expression_Token := (Tok_Expression, 0, 0);
end if;
if Expression_Depth = 0 then
Prepend (Result.Tokens, Expression_Token);
if Token.Tok_Type = Tok_Open_Parenthesis then
Prepend (Result.Tokens, Token);
end if;
elsif Token.Tok_Type /= Tok_Comma
and then Token.Tok_Type /= Tok_Blank
then
if Expression_Token.Token_Last = 0 then
Expression_Token.Token_Last := Token.Token_Last;
end if;
Expression_Token.Token_First := Token.Token_First;
end if;
Last_Token := Expression_Token;
Last_Non_Blank_Token := Token;
end if;
end Handle_Token;
begin
Result.Original_Buffer := Buffer;
Ada_Lang.Parse_Tokens_Backwards
(Buffer => Buffer.all,
Start_Offset => Start_Offset,
End_Offset => End_Offset,
Callback => Handle_Token'Access);
if With_Token_Found /= Null_Token then
Prepend (Result.Tokens, With_Token_Found);
With_Token_Found := Null_Token;
end if;
return Result;
end Parse_Expression_Backward;
-------------------------------
-- Parse_Expression_Backward --
-------------------------------
function Parse_Expression_Backward
(Buffer : access constant UTF8_String) return Parsed_Expression
is
begin
if Buffer /= null then
return Parse_Expression_Backward
(Buffer, String_Index_Type (Buffer'Last), 0);
else
return Null_Parsed_Expression;
end if;
end Parse_Expression_Backward;
--------------
-- Get_Name --
--------------
function Get_Name
(Expression : Parsed_Expression; Token : Token_Record) return String is
begin
case Ada_Token'(Token.Tok_Type) is
when No_Token =>
return "";
when Tok_Dot =>
return ".";
when Tok_Open_Parenthesis =>
return "(";
when Tok_Close_Parenthesis =>
return ")";
when Tok_Colon =>
return " : ";
when Tok_Arrow =>
return "=>";
when Tok_Identifier
| Tok_Expression
| Tok_Operator
| Tok_String
| Ada_Reserved_Token =>
if Token.Token_First /= 0 and then Token.Token_Last /= 0 then
return Expression.Original_Buffer
(Natural (Token.Token_First) .. Natural (Token.Token_Last));
else
return "";
end if;
when Tok_Tick =>
return "'";
when Tok_Comma =>
return ", ";
when Tok_Semicolon =>
return ";";
when Tok_Blank =>
return "";
when Tok_Dot_Dot =>
return "..";
end case;
end Get_Name;
---------------
-- To_String --
---------------
function To_String (Expression : Parsed_Expression) return String is
use Token_List;
Length : Natural := 0;
begin
for Item of Expression.Tokens loop
Length := Length + Get_Name (Expression, Item)'Length;
end loop;
return Result : String (1 .. Length) do
Length := Result'First;
for Item of Expression.Tokens loop
declare
N : constant String := Get_Name (Expression, Item);
begin
Result (Length .. Length + N'Length - 1) := N;
Length := Length + N'Length;
end;
end loop;
end return;
end To_String;
----------
-- Free --
----------
procedure Free (Expression : in out Parsed_Expression) is
begin
Expression.Tokens.Clear;
end Free;
end Ada_Semantic_Tree;
|
zhmu/ananas | Ada | 522 | ads | package Vect9_Pkg is
type Unit is array (1 .. 4) of Float;
for Unit'Alignment use 32;
pragma Machine_Attribute (Unit, "vector_type");
pragma Machine_Attribute (Unit, "may_alias");
Zero_Unit : constant Unit := (others => 0.0);
function Mul (X : in Unit; Y : in Unit) return Unit;
function "+"(Left, Right : Unit) return Unit;
function "*"(Left, Right : Unit) return Unit;
type Unit_Vector is array (Positive range <>) of Unit;
type Vector_Access is access all Unit_Vector;
end Vect9_Pkg;
|
sungyeon/drake | Ada | 705 | ads | pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Packed_Arrays;
package System.Compare_Array_Unsigned_16 is
pragma Preelaborate;
-- It can not be Pure, subprograms would become __attribute__((const)).
type Unsigned_16 is mod 2 ** 16;
for Unsigned_16'Size use 16;
for Unsigned_16'Alignment use 1;
package Ordering is new Packed_Arrays.Ordering (Unsigned_16);
-- required to compare arrays by compiler (s-caun16.ads)
function Compare_Array_U16 (
Left : Address;
Right : Address;
Left_Len : Natural;
Right_Len : Natural)
return Integer
renames Ordering.Compare;
end System.Compare_Array_Unsigned_16;
|
reznikmm/matreshka | Ada | 24,366 | 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_Read_Extent_Actions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Read_Extent_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Read_Extent_Action
(AMF.UML.Read_Extent_Actions.UML_Read_Extent_Action_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Read_Extent_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Read_Extent_Action
(AMF.UML.Read_Extent_Actions.UML_Read_Extent_Action_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Read_Extent_Action_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Read_Extent_Action
(Visitor,
AMF.UML.Read_Extent_Actions.UML_Read_Extent_Action_Access (Self),
Control);
end if;
end Visit_Element;
--------------------
-- Get_Classifier --
--------------------
overriding function Get_Classifier
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier
(Self.Element)));
end Get_Classifier;
--------------------
-- Set_Classifier --
--------------------
overriding procedure Set_Classifier
(Self : not null access UML_Read_Extent_Action_Proxy;
To : AMF.UML.Classifiers.UML_Classifier_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Classifier
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Classifier;
----------------
-- Get_Result --
----------------
overriding function Get_Result
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Output_Pins.UML_Output_Pin_Access is
begin
return
AMF.UML.Output_Pins.UML_Output_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Result
(Self.Element)));
end Get_Result;
----------------
-- Set_Result --
----------------
overriding procedure Set_Result
(Self : not null access UML_Read_Extent_Action_Proxy;
To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Result
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Result;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Context
(Self.Element)));
end Get_Context;
---------------
-- Get_Input --
---------------
overriding function Get_Input
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is
begin
return
AMF.UML.Input_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Input
(Self.Element)));
end Get_Input;
------------------------------
-- Get_Is_Locally_Reentrant --
------------------------------
overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant
(Self.Element);
end Get_Is_Locally_Reentrant;
------------------------------
-- Set_Is_Locally_Reentrant --
------------------------------
overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Read_Extent_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant
(Self.Element, To);
end Set_Is_Locally_Reentrant;
-----------------------------
-- Get_Local_Postcondition --
-----------------------------
overriding function Get_Local_Postcondition
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition
(Self.Element)));
end Get_Local_Postcondition;
----------------------------
-- Get_Local_Precondition --
----------------------------
overriding function Get_Local_Precondition
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition
(Self.Element)));
end Get_Local_Precondition;
----------------
-- Get_Output --
----------------
overriding function Get_Output
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is
begin
return
AMF.UML.Output_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Output
(Self.Element)));
end Get_Output;
-----------------
-- Get_Handler --
-----------------
overriding function Get_Handler
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is
begin
return
AMF.UML.Exception_Handlers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler
(Self.Element)));
end Get_Handler;
------------------
-- Get_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Activities.UML_Activity_Access is
begin
return
AMF.UML.Activities.UML_Activity_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity
(Self.Element)));
end Get_Activity;
------------------
-- Set_Activity --
------------------
overriding procedure Set_Activity
(Self : not null access UML_Read_Extent_Action_Proxy;
To : AMF.UML.Activities.UML_Activity_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Activity;
------------------
-- Get_In_Group --
------------------
overriding function Get_In_Group
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
begin
return
AMF.UML.Activity_Groups.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group
(Self.Element)));
end Get_In_Group;
---------------------------------
-- Get_In_Interruptible_Region --
---------------------------------
overriding function Get_In_Interruptible_Region
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is
begin
return
AMF.UML.Interruptible_Activity_Regions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region
(Self.Element)));
end Get_In_Interruptible_Region;
----------------------
-- Get_In_Partition --
----------------------
overriding function Get_In_Partition
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is
begin
return
AMF.UML.Activity_Partitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition
(Self.Element)));
end Get_In_Partition;
----------------------------
-- Get_In_Structured_Node --
----------------------------
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is
begin
return
AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node
(Self.Element)));
end Get_In_Structured_Node;
----------------------------
-- Set_In_Structured_Node --
----------------------------
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Read_Extent_Action_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_In_Structured_Node;
------------------
-- Get_Incoming --
------------------
overriding function Get_Incoming
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
(Self.Element)));
end Get_Incoming;
------------------
-- Get_Outgoing --
------------------
overriding function Get_Outgoing
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
(Self.Element)));
end Get_Outgoing;
------------------------
-- Get_Redefined_Node --
------------------------
overriding function Get_Redefined_Node
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
begin
return
AMF.UML.Activity_Nodes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node
(Self.Element)));
end Get_Redefined_Node;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Read_Extent_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Read_Extent_Action_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Context unimplemented");
raise Program_Error with "Unimplemented procedure UML_Read_Extent_Action_Proxy.Context";
return Context (Self);
end Context;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Read_Extent_Action_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Read_Extent_Action_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Read_Extent_Action_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Read_Extent_Action_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Read_Extent_Action_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Read_Extent_Action_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Read_Extent_Action_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Read_Extent_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Read_Extent_Action_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Read_Extent_Actions;
|
stcarrez/ada-awa | Ada | 980 | ads | -----------------------------------------------------------------------
-- awa-events-queues-observers -- Event queue observers
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Listeners.Observers;
package AWA.Events.Queues.Observers is new Util.Listeners.Observers (Queue_Ref);
|
reznikmm/matreshka | Ada | 6,820 | 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$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.UML.Models;
with AMF.Visitors.Standard_Profile_L3_Iterators;
with AMF.Visitors.Standard_Profile_L3_Visitors;
package body AMF.Internals.Standard_Profile_L3_Metamodels is
--------------------
-- Get_Base_Model --
--------------------
overriding function Get_Base_Model
(Self : not null access constant Standard_Profile_L3_Metamodel_Proxy)
return AMF.UML.Models.UML_Model_Access is
begin
return
AMF.UML.Models.UML_Model_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Base_Model
(Self.Element)));
end Get_Base_Model;
--------------------
-- Set_Base_Model --
--------------------
overriding procedure Set_Base_Model
(Self : not null access Standard_Profile_L3_Metamodel_Proxy;
To : AMF.UML.Models.UML_Model_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Base_Model
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Base_Model;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant Standard_Profile_L3_Metamodel_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Standard_Profile_L3_Visitors.Standard_Profile_L3_Visitor'Class then
AMF.Visitors.Standard_Profile_L3_Visitors.Standard_Profile_L3_Visitor'Class
(Visitor).Enter_Metamodel
(AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant Standard_Profile_L3_Metamodel_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Standard_Profile_L3_Visitors.Standard_Profile_L3_Visitor'Class then
AMF.Visitors.Standard_Profile_L3_Visitors.Standard_Profile_L3_Visitor'Class
(Visitor).Leave_Metamodel
(AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant Standard_Profile_L3_Metamodel_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.Standard_Profile_L3_Iterators.Standard_Profile_L3_Iterator'Class then
AMF.Visitors.Standard_Profile_L3_Iterators.Standard_Profile_L3_Iterator'Class
(Iterator).Visit_Metamodel
(Visitor,
AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.Standard_Profile_L3_Metamodels;
|
io7m/coreland-spatial_hash | Ada | 836 | ads | with Ada.Containers.Ordered_Sets;
with Spatial_Hash;
pragma Elaborate_All (Spatial_Hash);
package Data is
use type Ada.Containers.Count_Type;
type Entity_ID_t is new Positive;
procedure Bounding_Box
(Entity : in Entity_ID_t;
Bottom : out Integer;
Height : out Integer;
Left : out Integer;
Width : out Integer);
package Entity_Sets is new Ada.Containers.Ordered_Sets
(Element_Type => Entity_ID_t);
package Spatial_Hashing is new Standard.Spatial_Hash
(Discrete_Axis_Value_Type => Integer,
Entity_ID_Type => Entity_ID_t,
Entity_Sets => Entity_Sets,
Bounding_Box => Bounding_Box);
Spatial_Hash : Spatial_Hashing.Spatial_Hash_t;
Active_Cells : Spatial_Hashing.Cell_Set_t;
Entities : Entity_Sets.Set;
end Data;
|
stcarrez/ada-util | Ada | 990 | adb | --
-- Copyright (c) 2008 Tero Koskinen <[email protected]>
--
-- 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.
--
-- UNIX version of OS compatibility package
package body Ahven_Compat is
function Directory_Separator return String is
begin
return "/";
end Directory_Separator;
end Ahven_Compat;
|
stcarrez/dynamo | Ada | 107,505 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . E L E M E N T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Unchecked_Conversion;
with Interfaces; use Interfaces;
with GNAT.HTable;
with Asis.Clauses;
with Asis.Compilation_Units;
with Asis.Declarations; use Asis.Declarations;
with Asis.Definitions;
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Extensions;
with Asis.Limited_Views; use Asis.Limited_Views;
with Asis.Statements;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Output; use A4G.A_Output;
with A4G.A_Sem; use A4G.A_Sem;
with A4G.A_Sinput; use A4G.A_Sinput;
with A4G.A_Types;
with A4G.Asis_Tables; use A4G.Asis_Tables;
with A4G.Contt; use A4G.Contt;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Encl_El; use A4G.Encl_El;
with A4G.Knd_Conv; use A4G.Knd_Conv;
with A4G.Mapping; use A4G.Mapping;
with A4G.Vcheck; use A4G.Vcheck;
with Atree; use Atree;
with Einfo; use Einfo;
with Namet; use Namet;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Snames; use Snames;
with Stand; use Stand;
package body Asis.Elements is
function "=" (Left, Right : Element) return Boolean
renames Asis.Set_Get."=";
Package_Name : constant String := "Asis.Elements.";
------------------------------------------------------------------------------
---------------------------
-- ASIS 2005 Draft stuff --
---------------------------
----------------------------
-- Access_Definition_Kind --
----------------------------
function Access_Definition_Kind
(Definition : Asis.Definition)
return Asis.Access_Definition_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Access_Definition_Kind");
return Access_Definition_Kind_From_Internal (Int_Kind (Definition));
end Access_Definition_Kind;
--------------------
-- Interface_Kind --
--------------------
function Interface_Kind
(Definition : Asis.Definition)
return Asis.Interface_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Interface_Kind");
return Interface_Kind_From_Internal (Int_Kind (Definition));
end Interface_Kind;
------------------------
-- Is_Not_Null_Return --
------------------------
function Is_Not_Null_Return
(Element : Asis.Element)
return Boolean
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Arg_Node : Node_Id := Node (Element);
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Is_Not_Null_Return");
case Arg_Kind is
when A_Function_Declaration |
A_Function_Body_Declaration |
A_Function_Renaming_Declaration |
A_Function_Body_Stub |
A_Generic_Function_Declaration |
A_Formal_Function_Declaration =>
Arg_Node := Specification (Arg_Node);
Result := Null_Exclusion_Present (Arg_Node);
when An_Access_To_Function |
An_Access_To_Protected_Function |
An_Anonymous_Access_To_Function |
An_Anonymous_Access_To_Protected_Function =>
Result := Null_Exclusion_Present (Arg_Node);
when others =>
null;
end case;
return Result;
end Is_Not_Null_Return;
------------------------
-- Is_Prefix_Notation --
------------------------
function Is_Prefix_Notation (Call : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Call);
Arg_Node : constant Node_Id := R_Node (Call);
Result : Boolean := False;
begin
Check_Validity (Call, Package_Name & "Is_Prefix_Notation");
if Arg_Kind = A_Procedure_Call_Statement then
if Is_Rewrite_Substitution (Arg_Node)
and then
Nkind (Original_Node (Arg_Node)) = Nkind (Arg_Node)
and then
Nkind (Sinfo.Name (Arg_Node)) = N_Identifier
and then
Nkind (Sinfo.Name (Original_Node (Arg_Node))) =
N_Selected_Component
then
Result := True;
end if;
elsif Arg_Kind = A_Function_Call
and then
Is_Rewrite_Substitution (Arg_Node)
then
-- If prefix notation is used for a function call, the corresponding
-- A_Function_Call element is based on the rewritten node and the
-- original node is not used at all
if Node (Call) = Arg_Node then
Result := Is_Rewritten_Function_Prefix_Notation (Arg_Node);
elsif Nkind (Arg_Node) = N_Explicit_Dereference then
-- This is a case of *implicit* dereference :(
Result :=
Is_Rewritten_Impl_Deref_Function_Prefix_Notation (Node (Call));
end if;
end if;
return Result;
end Is_Prefix_Notation;
-----------------------------------
-- From ARG ASIS 2005 definition --
-----------------------------------
------------------
-- Has_Abstract --
------------------
function Has_Abstract (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Arg_Node : Node_Id;
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Abstract");
case Arg_Kind is
when An_Ordinary_Type_Declaration =>
Arg_Node := Sinfo.Type_Definition (Node (Element));
when A_Formal_Procedure_Declaration |
A_Formal_Function_Declaration |
A_Function_Declaration |
A_Private_Type_Declaration |
A_Private_Extension_Declaration |
A_Procedure_Declaration |
A_Private_Extension_Definition |
A_Tagged_Private_Type_Definition |
Internal_Type_Kinds |
A_Formal_Tagged_Private_Type_Definition |
A_Formal_Derived_Type_Definition =>
Arg_Node := Node (Element);
when others =>
return False;
end case;
Result := Nkind (Arg_Node) = N_Abstract_Subprogram_Declaration
or else
Nkind (Arg_Node) = N_Formal_Abstract_Subprogram_Declaration
or else
Abstract_Present (Arg_Node);
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Abstract",
Ex => Ex,
Arg_Element => Element);
end Has_Abstract;
-----------------
-- Has_Aliased --
-----------------
function Has_Aliased (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Aliased");
case Arg_Kind is
when A_Constant_Declaration |
A_Deferred_Constant_Declaration |
A_Return_Variable_Specification |
A_Return_Constant_Specification |
A_Variable_Declaration |
A_Component_Definition |
A_Parameter_Specification =>
Result := Aliased_Present (Node (Element));
when others =>
return False;
end case;
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Aliased",
Ex => Ex,
Arg_Element => Element);
end Has_Aliased;
-----------------
-- Has_Limited --
-----------------
function Has_Limited (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Arg_Node : Node_Id;
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Limited");
case Arg_Kind is
when A_With_Clause |
A_Private_Type_Declaration |
A_Private_Extension_Declaration |
Internal_Type_Kinds |
A_Private_Type_Definition |
A_Tagged_Private_Type_Definition |
A_Private_Extension_Definition |
A_Formal_Private_Type_Definition |
A_Formal_Tagged_Private_Type_Definition |
A_Formal_Derived_Type_Definition =>
Arg_Node := Node (Element);
when An_Ordinary_Type_Declaration =>
Arg_Node := Sinfo.Type_Definition (Node (Element));
when others => return False;
end case;
Result := Limited_Present (Arg_Node);
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Limited",
Ex => Ex,
Arg_Element => Element);
end Has_Limited;
-----------------
-- Has_Private --
-----------------
function Has_Private (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
begin
Check_Validity (Element, Package_Name & "Has_Private");
-- There is no case when a type definition element may contain PRIVATE
case Arg_Kind is
when A_With_Clause =>
return Private_Present (Node (Element));
when A_Private_Extension_Declaration |
A_Private_Type_Declaration |
A_Private_Type_Definition |
A_Tagged_Private_Type_Definition |
A_Private_Extension_Definition |
A_Formal_Private_Type_Definition |
A_Formal_Tagged_Private_Type_Definition =>
return True;
when others => return False;
end case;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Private",
Ex => Ex,
Arg_Element => Element);
end Has_Private;
-------------------
-- Has_Protected --
-------------------
function Has_Protected (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
begin
Check_Validity (Element, Package_Name & "Has_Protected");
-- If our interpretation is correct, there is nothing to compute here,
-- and the result is completely defined by the argument kind
case Arg_Kind is
when A_Protected_Definition |
A_Protected_Body_Declaration |
A_Protected_Type_Declaration |
A_Single_Protected_Declaration |
A_Protected_Body_Stub |
A_Protected_Interface |
A_Formal_Protected_Interface =>
return True;
when others =>
return False;
end case;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Protected",
Ex => Ex,
Arg_Element => Element);
end Has_Protected;
-----------------
-- Has_Reverse --
-----------------
function Has_Reverse (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Arg_Node : Node_Id;
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Reverse");
case Arg_Kind is
when A_Loop_Parameter_Specification |
A_Generalized_Iterator_Specification |
An_Element_Iterator_Specification =>
Arg_Node := Node (Element);
Result := Reverse_Present (Arg_Node);
when others =>
null;
end case;
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Reverse",
Ex => Ex,
Arg_Element => Element);
end Has_Reverse;
----------------------
-- Has_Synchronized --
----------------------
function Has_Synchronized (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Synchronized");
case Arg_Kind is
when A_Synchronized_Interface |
A_Formal_Synchronized_Interface =>
Result := True;
when A_Private_Extension_Definition |
A_Formal_Derived_Type_Definition =>
Result := Synchronized_Present (R_Node (Element));
when others =>
null;
end case;
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Synchronized",
Ex => Ex,
Arg_Element => Element);
end Has_Synchronized;
----------------
-- Has_Tagged --
----------------
function Has_Tagged (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Tagged");
case Arg_Kind is
when A_Tagged_Incomplete_Type_Declaration |
A_Tagged_Private_Type_Definition |
A_Tagged_Record_Type_Definition |
A_Formal_Tagged_Private_Type_Definition =>
Result := True;
when A_Formal_Incomplete_Type_Declaration =>
Result :=
Tagged_Present (Sinfo.Formal_Type_Definition (Node (Element)));
when others =>
null;
end case;
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Tagged",
Ex => Ex,
Arg_Element => Element);
end Has_Tagged;
---------------
-- Has_Task --
---------------
function Has_Task (Element : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Result : Boolean := False;
begin
Check_Validity (Element, Package_Name & "Has_Task");
case Arg_Kind is
when A_Task_Definition |
A_Task_Type_Declaration |
A_Single_Task_Declaration |
A_Task_Body_Declaration |
A_Task_Body_Stub |
A_Task_Interface |
A_Formal_Task_Interface =>
Result := True;
when others =>
null;
end case;
return Result;
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Task",
Ex => Ex,
Arg_Element => Element);
end Has_Task;
------------------------
-- Has_Null_Exclusion --
------------------------
function Has_Null_Exclusion
(Element : Asis.Element)
return Boolean
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Arg_Node : Node_Id;
begin
Check_Validity (Element, Package_Name & "Has_Null_Exclusion");
case Arg_Kind is
when Internal_Access_Definition_Kinds |
Internal_Access_Type_Kinds |
A_Parameter_Specification =>
Arg_Node := Node (Element);
when A_Discriminant_Specification =>
Arg_Node := Node (Element);
if not Null_Exclusion_Present (Arg_Node) then
Arg_Node := Discriminant_Type (Arg_Node);
if Nkind (Arg_Node) /= N_Access_Definition then
return False;
end if;
end if;
when An_Object_Renaming_Declaration |
A_Formal_Object_Declaration =>
Arg_Node := Node (Element);
if not Null_Exclusion_Present (Arg_Node)
and then
Present (Access_Definition (Arg_Node))
then
Arg_Node := Access_Definition (Arg_Node);
end if;
when A_Subtype_Indication =>
Arg_Node := Parent (Node (Element));
when others =>
return False;
end case;
return Null_Exclusion_Present (Arg_Node);
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Null_Exclusion",
Ex => Ex,
Arg_Element => Element);
end Has_Null_Exclusion;
------------------------------------------------------------------------------
function Unit_Declaration
(Compilation_Unit : Asis.Compilation_Unit)
return Asis.Declaration
is
Unit_Kind : Asis.Unit_Kinds;
Unit_Declaration_Node : Node_Id;
Special_Case : Special_Cases := Not_A_Special_Case;
begin
Check_Validity (Compilation_Unit, Package_Name & "Unit_Declaration");
Reset_Context (Encl_Cont_Id (Compilation_Unit));
Unit_Kind := Kind (Compilation_Unit);
if Unit_Kind = Not_A_Unit then
Raise_ASIS_Inappropriate_Compilation_Unit
(Package_Name & "Unit_Declaration");
end if;
if Unit_Kind = A_Nonexistent_Declaration or else
Unit_Kind = A_Nonexistent_Body or else
Unit_Kind = An_Unknown_Unit or else
Unit_Kind = A_Configuration_Compilation
then
return Nil_Element;
end if;
if Is_Standard (Compilation_Unit) then
Special_Case := Explicit_From_Standard;
Unit_Declaration_Node := Standard_Package_Node;
else
Unit_Declaration_Node := Unit (Top (Compilation_Unit));
end if;
if Has_Limited_View_Only (Compilation_Unit) then
Special_Case := From_Limited_View;
end if;
if Unit_Kind = A_Procedure_Body_Subunit or else
Unit_Kind = A_Function_Body_Subunit or else
Unit_Kind = A_Package_Body_Subunit or else
Unit_Kind = A_Task_Body_Subunit or else
Unit_Kind = A_Protected_Body_Subunit
then
-- one step down the tree is required. No Asis Element can correspond
-- to the N_Subunit Node
Unit_Declaration_Node := Proper_Body (Unit_Declaration_Node);
end if;
return Node_To_Element_New (Node => Unit_Declaration_Node,
Spec_Case => Special_Case,
In_Unit => Compilation_Unit);
exception
when ASIS_Inappropriate_Compilation_Unit =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Unit_Declaration");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Unit_Declaration",
Ex => Ex,
Arg_CU => Compilation_Unit);
end Unit_Declaration;
-----------------------------------------------------------------------------
function Enclosing_Compilation_Unit
(Element : Asis.Element)
return Asis.Compilation_Unit
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
begin
Check_Validity (Element, Package_Name & "Enclosing_Compilation_Unit");
if Arg_Kind = Not_An_Element then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Enclosing_Compilation_Unit",
Wrong_Kind => Arg_Kind);
end if;
return Encl_Unit (Element);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Enclosing_Compilation_Unit");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Enclosing_Compilation_Unit",
Ex => Ex,
Arg_Element => Element);
end Enclosing_Compilation_Unit;
-----------------------------------------------------------------------------
function Context_Clause_Elements
(Compilation_Unit : Asis.Compilation_Unit;
Include_Pragmas : Boolean := False)
return Asis.Context_Clause_List
is
Unit_Kind : Asis.Unit_Kinds; -- Compilation_Unit kind
List_Before : List_Id;
begin
Check_Validity
(Compilation_Unit, Package_Name & "Context_Clause_Elements");
Unit_Kind := Kind (Compilation_Unit);
if Unit_Kind = Not_A_Unit then
Raise_ASIS_Inappropriate_Compilation_Unit
(Package_Name & "Context_Clause_Elements");
end if;
if Is_Standard (Compilation_Unit) or else
Unit_Kind = A_Nonexistent_Declaration or else
Unit_Kind = A_Nonexistent_Body or else
Unit_Kind = An_Unknown_Unit or else
Unit_Kind = A_Configuration_Compilation or else
Has_Limited_View_Only (Compilation_Unit)
then
-- The last part of the condition comes from the GNAT compilation
-- model. But it seems that it should be in the definition of
-- this query in the ASIS Standard
return Nil_Element_List;
end if;
List_Before := Context_Items (Top (Compilation_Unit));
return N_To_E_List_New
(List => List_Before,
Include_Pragmas => Include_Pragmas,
In_Unit => Compilation_Unit);
exception
when ASIS_Inappropriate_Compilation_Unit =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Context_Clause_Elements",
Bool_Par => Include_Pragmas);
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Context_Clause_Elements",
Ex => Ex,
Arg_CU => Compilation_Unit,
Bool_Par_ON => Include_Pragmas);
end Context_Clause_Elements;
------------------------------------------------------------------------------
function Configuration_Pragmas
(The_Context : Asis.Context)
return Asis.Pragma_Element_List
is
begin
Check_Validity (The_Context, Package_Name & "Configuration_Pragmas");
-- In the GNAT environment, "a list of pragmas that apply to all future
-- compilation_unit elements compiled into The_Context" is defined by
-- the -gnatA and -gnatec options used when calling the compiler and
-- by the content of configuration file(s) at the moment of the compiler
-- call. These things cannot be detected from the set of tree files
-- making up the Context, so the only thing we can do is to return
-- Nil_Element_List
return Nil_Element_List;
exception
when ASIS_Inappropriate_Context =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Configuration_Pragmas");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Configuration_Pragmas",
Ex => Ex);
end Configuration_Pragmas;
-----------------------------------------------------------------------------
function Compilation_Pragmas
(Compilation_Unit : Asis.Compilation_Unit)
return Asis.Pragma_Element_List
is
Unit_Kind : Asis.Unit_Kinds;
Config_Prgms : List_Id := No_List;
List_Before : List_Id;
Next_Pragma : Node_Id;
List_After : List_Id;
begin
Check_Validity (Compilation_Unit,
Package_Name & "Compilation_Pragmas");
Unit_Kind := Kind (Compilation_Unit);
if Unit_Kind = Not_A_Unit then
Raise_ASIS_Inappropriate_Compilation_Unit
(Package_Name & "Compilation_Pragmas");
end if;
if Is_Standard (Compilation_Unit) or else
Unit_Kind = A_Nonexistent_Declaration or else
Unit_Kind = A_Nonexistent_Body or else
Unit_Kind = An_Unknown_Unit or else
Unit_Kind = A_Configuration_Compilation or else
Has_Limited_View_Only (Compilation_Unit)
then
-- The last part of the condition is GNAT-specific
return Nil_Element_List;
end if;
Reset_Context (Encl_Cont_Id (Compilation_Unit));
-- For the GNAT compilation model, we consider that configuration
-- pragmas from the configuration file(s) are applied to the main unit
-- of the compilation only. So if some unit belonging to the Context
-- is compiled only as a supporter of some other units, but not on
-- their own, the result of Compilation_Pragmas applied to this unit
-- does not include any configuration pragmas from the configuration
-- file(s).
if Asis.Extensions.Is_Main_Unit_In_Tree (Compilation_Unit) then
Reset_Main_Tree (Compilation_Unit);
Config_Prgms :=
Config_Pragmas (Aux_Decls_Node (Top (Compilation_Unit)));
end if;
List_Before := Context_Items (Top (Compilation_Unit));
List_After := Pragmas_After (Aux_Decls_Node (Top (Compilation_Unit)));
Set_Element_List
(List => Config_Prgms,
Include_Pragmas => True,
Node_Knd => N_Pragma,
Special_Case => Configuration_File_Pragma,
In_Unit => Compilation_Unit,
Append => False);
-- The middle part - pragmas from the context clause - we have to
-- compose by hands, because we can add to the result only the
-- configuration pragmas
if Present (List_Before) then
Next_Pragma := First (List_Before);
Next_Pragma := Get_Next_Configuration_Pragma (Next_Pragma);
while Present (Next_Pragma) loop
Internal_Asis_Element_Table.Append
(Node_To_Element_New
(Node => Next_Pragma,
In_Unit => Compilation_Unit));
Next_Pragma := Get_Next_Configuration_Pragma (Next (Next_Pragma));
end loop;
end if;
Set_Element_List
(List => List_After,
Include_Pragmas => True,
Node_Knd => N_Pragma,
In_Unit => Compilation_Unit,
Append => True);
return Asis.Pragma_Element_List
(Internal_Asis_Element_Table.Table
(1 .. Internal_Asis_Element_Table.Last));
exception
when ASIS_Inappropriate_Compilation_Unit =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Compilation_Pragmas");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Compilation_Pragmas",
Ex => Ex,
Arg_CU => Compilation_Unit);
end Compilation_Pragmas;
------------------------------------------------------------------------------
function Element_Kind
(Element : Asis.Element)
return Asis.Element_Kinds
is
begin
Check_Validity (Element, Package_Name & "Element_Kind");
return Kind (Element);
end Element_Kind;
-----------------------------------------------------------------------------
function Pragma_Kind
(Pragma_Element : Asis.Pragma_Element)
return Asis.Pragma_Kinds
is
begin
Check_Validity (Pragma_Element, Package_Name & "Pragma_Kind");
return Pragma_Kind_From_Internal (Int_Kind (Pragma_Element));
end Pragma_Kind;
-----------------------------------------------------------------------------
function Defining_Name_Kind
(Defining_Name : Asis.Defining_Name)
return Asis.Defining_Name_Kinds
is
begin
Check_Validity (Defining_Name, Package_Name & "Defining_Name_Kind");
return Defining_Name_Kind_From_Internal (Int_Kind (Defining_Name));
end Defining_Name_Kind;
-----------------------------------------------------------------------------
function Declaration_Kind
(Declaration : Asis.Declaration)
return Asis.Declaration_Kinds
is
begin
Check_Validity (Declaration, Package_Name & "Declaration_Kind");
return Declaration_Kind_From_Internal (Int_Kind (Declaration));
end Declaration_Kind;
----------------
-- Trait_Kind --
----------------
function Trait_Kind (Element : Asis.Element) return Asis.Trait_Kinds is
-- Trait-related flag values:
Is_Abstract : Boolean;
Is_Limited : Boolean;
Is_Aliased : Boolean;
Is_Private : Boolean;
Arg_Node : Node_Id;
Result : Asis.Trait_Kinds := An_Ordinary_Trait;
begin
Check_Validity (Element, Package_Name & "Trait_Kind");
-- ASIS_Element_Kinds.Trait_Kinds literals and GNAT tree flags mapping:
--
-- (This nice piece of documentation is for ASIS/Ada 95 only, we have not
-- extended it for Ada 2005)
--
-- type Trait_Kinds is (
--
-- Not_A_Trait, --> Unexpected element, its node always has no
-- -- corresponding flags and its kind does not belong
-- -- to the Node Kinds for which A_Private_Trait could
-- -- be determined
--
-- An_Ordinary_Trait, --> all flags are set off, and the node kind
-- does not belong to the Node Kinds for which
-- A_Private_Trait could be determined
--
-- An_Aliased_Trait, --> Aliased_Present set ON
--
-- An_Access_Definition_Trait, --> no special flag, could be defined
-- -- on the base of the presence of
-- -- the N_Access_Definition node as the
-- -- child node of the argument node
--
-- A_Reverse_Trait, --> Reverse_Present set ON
--
-- A_Private_Trait, --> except the case of
-- A_Formal_Derived_Type_Definition,
-- -- no special flag is presented in the corresponding
-- -- node, the A_Private_Trait could be defined
-- -- on the base of Node Kinds and setting other
-- -- flags OFF;
-- -- for A_Formal_Derived_Type_Definition -
-- -- Private_Present set ON
--
-- A_Limited_Trait, --> Limited_Present set ON and corresponding node
-- -- does not belong to the Node Kinds for which
-- -- A_Private_Trait could be defined
--
-- A_Limited_Private_Trait, --> Limited_Present set ON and corresponding
-- -- node belongs to the Node Kinds for which
-- -- A_Private_Trait could be defined
--
-- An_Abstract_Trait, --> For types: Abstract_Present set ON and
-- -- corresponding node does not belong to the
-- -- Node Kinds for which A_Private_Trait could be
-- -- defined;
-- -- For subprograms: no special flag, could be
-- -- defined on the base of the Node Kind of the
-- -- argument node
--
-- An_Abstract_Private_Trait, --> except the case of
-- -- A_Formal_Derived_Type_Definition,
-- -- Abstract_Present set ON and corresponding
-- -- node belongs to the Node Kinds for which
-- -- A_Private_Trait could be defined;
-- -- for A_Formal_Derived_Type_Definition -
-- -- Abstract_Present set ON and
-- -- Private_Present set ON
--
-- An_Abstract_Limited_Trait, --> Abstract_Present set ON,
-- -- Limited_Present set ON
-- -- and corresponding node does not belong
-- -- to the Node Kinds for which
-- -- A_Private_Trait could be defined
--
-- An_Abstract_Limited_Private_Trait); --> Abstract_Present set ON,
-- -- Limited_Present set ON and
-- -- corresponding node belongs
-- -- to Node Kinds for which
-- -- A_Private_Trait could be defined
--
----------------------------------------------------------------------------
-- Expected Argument_Kinds: -> Corresponding tree Nodes:
-- Possible Trait values: --> Provided trait-related flags and
-- combination of their values
-- corresponding to the Trait value
----------------------------------------------------------------------------
--
-- Expected Declaration_Kinds:
-- ==========================
--
-- A_Private_Type_Declaration -> N_Private_Type_Declaration (*1*)
-- A_Private_Trait --> Abstract_Present = OFF
-- Limited_Present = OFF
--
-- A_Limited_Private_Trait --> Abstract_Present = OFF
-- Limited_Present = ON
--
-- An_Abstract_Private_Trait --> Abstract_Present = ON
-- Limited_Present = OFF
--
-- An_Abstract_Limited_Private_Trait --> Abstract_Present = ON
-- Limited_Present = ON
-----------------------------------------------
-- A_Private_Extension_Declaration -> N_Private_Extension_Declaration (*2*)
-- A_Private_Trait --> Abstract_Present = OFF
--
-- An_Abstract_Private_Trait --> Abstract_Present = ON
-----------------------------------------------
-- A_Variable_Declaration -> N_Object_Declaration (*3*)
-- An_Ordinary_Trait --> Aliased_Present = OFF
--
-- An_Aliased_Trait --> Aliased_Present = ON
-----------------------------------------------
-- A_Constant_Declaration -> N_Object_Declaration (*3*)
-- An_Ordinary_Trait --> Aliased_Present = OFF
--
-- An_Aliased_Trait --> Aliased_Present = ON
-----------------------------------------------
-- A_Deferred_Constant_Declaration -> N_Object_Declaration (*3*)
-- An_Ordinary_Trait --> Aliased_Present = OFF
--
-- An_Aliased_Trait --> Aliased_Present = ON
-----------------------------------------------
-- A_Discriminant_Specification -> N_Discriminant_Specification (*4*)
-- Has no trait-related flags
--
-- An_Ordinary_Trait --> Nkind(Discriminant_Type(Definition.Node))
-- /= N_Access_Definition
-- An_Access_Definition_Trait--> Nkind(Discriminant_Type(Definition.Node))
-- = N_Access_Definition
-----------------------------------------------
-- A_Loop_Parameter_Specification -> N_Loop_Parameter_Specification (*5*)
-- A_Generalized_Iterator_Specification -> N_Iterator_Specification (*5*)
-- An_Element_Iterator_Specification -> N_Iterator_Specification (*5*)
--
-- An_Ordinary_Trait --> Reverse_Present = OFF
--
-- A_Reverse_Trait --> Reverse_Present = ON
-----------------------------------------------
-- A_Procedure_Declaration -> N_Subprogram_Declaration (*6*)
-- An_Ordinary_Trait --> No flag needed to determine the trait
-- -> N_Abstract_Subprogram_Declaration
-- An_Abstract_Trait --> No flag needed to determine the trait
-----------------------------------------------
-- A_Function_Declaration -> N_Subprogram_Declaration (*6*)
-- An_Ordinary_Trait --> No flag needed to determine the trait
-- -> N_Abstract_Subprogram_Declaration
-- An_Abstract_Trait --> No flag needed to determine the trait
-----------------------------------------------
-- A_Parameter_Specification -> N_Parameter_Specification (*4*)
-- Has no trait-related flags
--
-- An_Ordinary_Trait --> Nkind(Parameter_Type(Definition.Node))
-- /= N_Access_Definition
-- An_Access_Definition_Trait --> Nkind(Parameter_Type(Definition.Node))
-- = N_Access_Definition
-----------------------------------------------
--
-- Expected Definition_Kinds:
-- =========================
--
-- A_Component_Definition -> N_Subtype_Indication (*10*)
-- N_Identifier
-- N_Expanded_Name
-- An_Ordinary_Trait --> Aliased_Present set OFF in the PARENT node
-- An_Aliased_Trait --> Aliased_Present set ON in the PARENT nod
--
-- A_Private_Type_Definition -> N_Private_Type_Declaration (*1*)
-- The situation is just the same as for A_Private_Type_Declaration
-----------------------------------------------
-- A_Tagged_Private_Type_Definition-> N_Private_Type_Declaration (*1*)
-- The situation is just the same as for A_Private_Type_Declaration
-----------------------------------------------
-- A_Private_Extension_Definition -> N_Private_Extension_Declaration (*2*)
-- The situation is just the same as for N_Private_Extension_Declaration
-----------------------------------------------
--
-- Expected Type_Kinds:
-- ===================
--
-----------------------------------------------
-- A_Derived_Type_Definition -> N_Derived_Type_Definition (*7*)
-- An_Ordinary_Trait --> Abstract_Present = OFF
--
-- An_Abstract_Trait --> Abstract_Present = ON
-----------------------------------------------
-- A_Derived_Record_Extension_Definition -> N_Derived_Type_Definition (*7*)
-- An_Ordinary_Trait --> Abstract_Present = OFF
--
-- An_Abstract_Trait --> Abstract_Present = ON
-----------------------------------------------
-- A_Record_Type_Definition -> N_Record_Definition (*8*)
-- An_Ordinary_Trait --> Abstract_Present = OFF
-- Limited_Present = OFF
--
-- An_Abstract_Trait --> Abstract_Present = ON
-- Limited_Present = OFF
--
-- A_Limited_Trait --> Abstract_Present = OFF
-- Limited_Present = ON
--
-- An_Abstract_Limited_Trait --> Abstract_Present = ON
-- Limited_Present = ON
-----------------------------------------------
-- A_Tagged_Record_Type_Definition -> N_Record_Definition (*8*)
-- An_Ordinary_Trait --> Abstract_Present = OFF
-- Limited_Present = OFF
--
-- An_Abstract_Trait --> Abstract_Present = ON
-- Limited_Present = OFF
--
-- A_Limited_Trait --> Abstract_Present = OFF
-- Limited_Present = ON
--
-- An_Abstract_Limited_Trait --> Abstract_Present = ON
-- Limited_Present = ON
-----------------------------------------------
--
-- Expected Formal_Type_Kinds:
-- ==========================
--
-- A_Formal_Private_Type_Definition -> N_Formal_Private_Type_Definition
-- (*1*)
-- The situation is just the same as for A_Private_Type_Declaration
-----------------------------------------------
-- A_Formal_Tagged_Private_Type_Definition ->
-- N_Formal_Private_Type_Definition (*1*)
--
-- The situation is just the same as for A_Private_Type_Declaration
-----------------------------------------------
-- A_Formal_Derived_Type_Definition -> N_Formal_Derived_Type_Definition(*9*)
-- An_Ordinary_Trait --> Abstract_Present = OFF
-- Private_Present = OFF
--
-- An_Abstract_Trait --> Abstract_Present = ON
-- Private_Present = OFF
--
-- A_Private_Trait --> Abstract_Present = OFF
-- Private_Present = ON
--
-- An_Abstract_Private_Trait --> Abstract_Present = ON
-- Private_Present = ON
------------------------------------------------------------------------------
Arg_Node := Node (Element);
case Int_Kind (Element) is
-- expected argument:
when -- (*1*)
A_Private_Type_Declaration
| A_Private_Type_Definition
| A_Tagged_Private_Type_Definition
| A_Formal_Private_Type_Definition
| A_Formal_Tagged_Private_Type_Definition =>
Is_Abstract := Abstract_Present (Arg_Node);
Is_Limited := Limited_Present (Arg_Node);
if Is_Abstract and Is_Limited then
Result := An_Abstract_Limited_Private_Trait;
elsif Is_Abstract then
Result := An_Abstract_Private_Trait;
elsif Is_Limited then
Result := A_Limited_Private_Trait;
else
Result := A_Private_Trait;
end if;
when -- (*2*)
A_Private_Extension_Declaration
| A_Private_Extension_Definition =>
Is_Abstract := Abstract_Present (Arg_Node);
if Is_Abstract then
Result := An_Abstract_Private_Trait;
else
Result := A_Private_Trait;
end if;
when -- (*3*)
A_Variable_Declaration
| A_Constant_Declaration
| A_Deferred_Constant_Declaration =>
Is_Aliased := Aliased_Present (Arg_Node);
if Is_Aliased then
Result := An_Aliased_Trait;
end if;
when -- (*4*)
A_Discriminant_Specification
| A_Parameter_Specification =>
-- --|A2005 start
if Null_Exclusion_Present (Arg_Node) then
Result := A_Null_Exclusion_Trait;
elsif Int_Kind (Element) = A_Parameter_Specification
and then
Aliased_Present (Arg_Node)
then
Result := An_Aliased_Trait;
end if;
-- --|A2005 end
when -- (*5*)
A_Loop_Parameter_Specification |
A_Generalized_Iterator_Specification |
An_Element_Iterator_Specification =>
if Reverse_Present (Arg_Node) then
Result := A_Reverse_Trait;
end if;
when -- (*6*)
A_Procedure_Declaration
| A_Function_Declaration =>
if Nkind (Arg_Node) = N_Abstract_Subprogram_Declaration then
Result := An_Abstract_Trait;
end if;
-- --|A2005 start
when
A_Formal_Procedure_Declaration
| A_Formal_Function_Declaration =>
if Nkind (Arg_Node) = N_Formal_Abstract_Subprogram_Declaration then
Result := An_Abstract_Trait;
end if;
-- --|A2005 end
when -- (*7*)
A_Derived_Type_Definition
| A_Derived_Record_Extension_Definition =>
if Abstract_Present (Arg_Node) then
Result := An_Abstract_Trait;
end if;
when -- (*8*)
A_Record_Type_Definition
| A_Tagged_Record_Type_Definition =>
Is_Abstract := Abstract_Present (Arg_Node);
Is_Limited := Limited_Present (Arg_Node);
if Is_Abstract and Is_Limited then
Result := An_Abstract_Limited_Trait;
elsif Is_Abstract then
Result := An_Abstract_Trait;
elsif Is_Limited then
Result := A_Limited_Trait;
end if;
when -- (*9*)
A_Formal_Derived_Type_Definition =>
Is_Abstract := Abstract_Present (Arg_Node);
Is_Limited := Limited_Present (Arg_Node);
Is_Private := Private_Present (Arg_Node);
if Is_Abstract and Is_Limited and Is_Private then
Result := An_Abstract_Limited_Private_Trait;
elsif Is_Abstract and Is_Limited then
Result := An_Abstract_Limited_Trait;
elsif Is_Abstract and Is_Private then
Result := An_Abstract_Private_Trait;
elsif Is_Limited and Is_Private then
Result := A_Limited_Private_Trait;
elsif Is_Abstract then
Result := An_Abstract_Trait;
elsif Is_Limited then
Result := A_Limited_Trait;
elsif Is_Private then
Result := A_Private_Trait;
end if;
when -- (*10*)
A_Component_Definition =>
if Aliased_Present (R_Node (Element)) then
Result := An_Aliased_Trait;
end if;
-- --|A2005 start
when A_With_Clause =>
Is_Limited := Limited_Present (Arg_Node);
Is_Private := Private_Present (Arg_Node);
if Is_Limited then
if Is_Private then
Result := A_Limited_Private_Trait;
else
Result := A_Limited_Trait;
end if;
elsif Is_Private then
Result := A_Private_Trait;
end if;
when Internal_Access_Type_Kinds =>
if Null_Exclusion_Present (Arg_Node) then
Result := A_Null_Exclusion_Trait;
end if;
when Internal_Access_Definition_Kinds =>
if Present (Sinfo.Access_To_Subprogram_Definition (Arg_Node)) then
Arg_Node := Sinfo.Access_To_Subprogram_Definition (Arg_Node);
end if;
if Null_Exclusion_Present (Arg_Node) then
Result := A_Null_Exclusion_Trait;
end if;
when A_Subtype_Indication =>
Arg_Node := Parent (Arg_Node);
if Null_Exclusion_Present (Arg_Node) then
Result := A_Null_Exclusion_Trait;
end if;
-- --|A2005 end
when others =>
-- unexpected argument:
Result := Not_A_Trait;
end case;
return Result;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Trait_Kind");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Trait_Kind",
Ex => Ex,
Arg_Element => Element);
end Trait_Kind;
------------------------------------------------------------------------------
function Declaration_Origin
(Declaration : Asis.Declaration)
return Asis.Declaration_Origins
is
begin
-- The implementation may require revising when the semantic queries
-- and implicit elements are implemented.
Check_Validity (Declaration, Package_Name & "Declaration_Origin");
if Int_Kind (Declaration) not in Internal_Declaration_Kinds then
return Not_A_Declaration_Origin;
elsif not Is_From_Implicit (Declaration) then
return An_Explicit_Declaration;
elsif Is_From_Inherited (Declaration) then
return An_Implicit_Inherited_Declaration;
else
return An_Implicit_Predefined_Declaration;
end if;
end Declaration_Origin;
-----------------------------------------------------------------------------
function Mode_Kind
(Declaration : Asis.Declaration)
return Asis.Mode_Kinds
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration);
Arg_Node : Node_Id;
begin
Check_Validity (Declaration, Package_Name & "Mode_Kind");
if not (Arg_Kind = A_Parameter_Specification or else
Arg_Kind = A_Formal_Object_Declaration)
then
return Not_A_Mode;
end if;
Arg_Node := Node (Declaration);
if In_Present (Arg_Node) and then Out_Present (Arg_Node) then
return An_In_Out_Mode;
elsif In_Present (Arg_Node) then
return An_In_Mode;
elsif Out_Present (Arg_Node) then
return An_Out_Mode;
else
return A_Default_In_Mode;
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Declaration,
Outer_Call => Package_Name & "Mode_Kind");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Mode_Kind",
Ex => Ex,
Arg_Element => Declaration);
end Mode_Kind;
-----------------------------------------------------------------------------
function Default_Kind
(Declaration : Asis.Generic_Formal_Parameter)
return Asis.Subprogram_Default_Kinds
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Declaration);
Arg_Node : Node_Id;
begin
Check_Validity (Declaration, Package_Name & "Default_Kind");
Arg_Node := Node (Declaration);
if not (Arg_Kind = A_Formal_Procedure_Declaration or else
Arg_Kind = A_Formal_Function_Declaration)
then
return Not_A_Default;
elsif Box_Present (Arg_Node) then
return A_Box_Default;
elsif Present (Default_Name (Arg_Node)) then
return A_Name_Default;
elsif Nkind (Specification (Arg_Node)) = N_Procedure_Specification
and then
Null_Present (Specification (Arg_Node))
then
return A_Null_Default;
else
return A_Nil_Default;
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Declaration,
Outer_Call => Package_Name & "Default_Kind");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Default_Kind",
Ex => Ex,
Arg_Element => Declaration);
end Default_Kind;
-----------------------------------------------------------------------------
function Definition_Kind
(Definition : Asis.Definition)
return Asis.Definition_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Definition_Kind");
return Definition_Kind_From_Internal (Int_Kind (Definition));
end Definition_Kind;
-----------------------------------------------------------------------------
function Type_Kind
(Definition : Asis.Type_Definition)
return Asis.Type_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Type_Kind");
return Type_Kind_From_Internal (Int_Kind (Definition));
end Type_Kind;
-----------------------------------------------------------------------------
function Formal_Type_Kind
(Definition : Asis.Type_Definition)
return Asis.Formal_Type_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Formal_Type_Kind");
return Formal_Type_Kind_From_Internal (Int_Kind (Definition));
end Formal_Type_Kind;
-----------------------------------------------------------------------------
function Access_Type_Kind
(Definition : Asis.Type_Definition)
return Asis.Access_Type_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Access_Type_Kind");
return Access_Type_Kind_From_Internal (Int_Kind (Definition));
end Access_Type_Kind;
-----------------------------------------------------------------------------
function Root_Type_Kind
(Definition : Asis.Type_Definition)
return Asis.Root_Type_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Root_Type_Kind");
return Root_Type_Kind_From_Internal (Int_Kind (Definition));
end Root_Type_Kind;
-----------------------------------------------------------------------------
function Constraint_Kind
(Definition : Asis.Definition)
return Asis.Constraint_Kinds
is
begin
Check_Validity (Definition, Package_Name & "Constraint_Kind");
return Constraint_Kind_From_Internal (Int_Kind (Definition));
end Constraint_Kind;
-----------------------------------------------------------------------------
function Discrete_Range_Kind
(Definition : Asis.Definition)
return Asis.Discrete_Range_Kinds
is
begin
Check_Validity (Definition, "Discrete_Range_Kind.Expression_Kind");
return Discrete_Range_Kind_From_Internal (Int_Kind (Definition));
end Discrete_Range_Kind;
-----------------------------------------------------------------------------
function Expression_Kind
(Expression : Asis.Expression)
return Asis.Expression_Kinds
is
begin
Check_Validity (Expression, Package_Name & "Expression_Kind");
return Expression_Kind_From_Internal (Int_Kind (Expression));
end Expression_Kind;
-----------------------------------------------------------------------------
function Operator_Kind
(Element : Asis.Element)
return Asis.Operator_Kinds
is
begin
Check_Validity (Element, Package_Name & "Operator_Kind");
return Operator_Kind_From_Internal (Int_Kind (Element));
end Operator_Kind;
-----------------------------------------------------------------------------
function Attribute_Kind
(Expression : Asis.Expression)
return Asis.Attribute_Kinds
is
begin
Check_Validity (Expression, Package_Name & "Attribute_Kind");
return Attribute_Kind_From_Internal (Int_Kind (Expression));
end Attribute_Kind;
-----------------------------------------------------------------------------
function Association_Kind
(Association : Asis.Association)
return Asis.Association_Kinds
is
begin
Check_Validity (Association, Package_Name & "Association_Kind");
return Association_Kind_From_Internal (Int_Kind (Association));
end Association_Kind;
-----------------------------------------------------------------------------
function Statement_Kind
(Statement : Asis.Statement)
return Asis.Statement_Kinds
is
begin
Check_Validity (Statement, Package_Name & "Statement_Kind");
return Statement_Kind_From_Internal (Int_Kind (Statement));
end Statement_Kind;
-----------------------------------------------------------------------------
function Path_Kind (Path : Asis.Path) return Asis.Path_Kinds is
begin
Check_Validity (Path, Package_Name & "Clause_Kind");
return Path_Kind_From_Internal (Int_Kind (Path));
end Path_Kind;
-----------------------------------------------------------------------------
function Clause_Kind (Clause : Asis.Clause) return Asis.Clause_Kinds is
begin
Check_Validity (Clause, Package_Name & "Clause_Kind");
return Clause_Kind_From_Internal (Int_Kind (Clause));
end Clause_Kind;
-----------------------------------------------------------------------------
function Representation_Clause_Kind
(Clause : Asis.Clause)
return Asis.Representation_Clause_Kinds
is
begin
Check_Validity (Clause, Package_Name & "Representation_Clause_Kind");
return Representation_Clause_Kind_From_Internal (Int_Kind (Clause));
end Representation_Clause_Kind;
-----------------------------------------------------------------------------
function Is_Nil (Right : Asis.Element) return Boolean is
begin
return Right = Asis.Nil_Element;
end Is_Nil;
-----------------------------------------------------------------------------
function Is_Nil (Right : Asis.Element_List) return Boolean is
begin
return Right'Length = 0;
end Is_Nil;
-----------------------------------------------------------------------------
function Is_Equal
(Left : Asis.Element;
Right : Asis.Element)
return Boolean
is
C_Left : Context_Id;
C_Right : Context_Id;
U_Left : Unit_Id;
U_Right : Unit_Id;
CU_Left : Compilation_Unit;
CU_Right : Compilation_Unit;
N_Left : Node_Id;
N_Right : Node_Id;
Result : Boolean := False;
begin
Check_Validity (Left, Package_Name & "Is_Equal");
Check_Validity (Right, Package_Name & "Is_Equal");
-- To minimize the performance penalties, we are trying to filter
-- out simple cases first. These are (more or less) simple cases
-- when the function should return False
-- First, checking the case when one of the arguments is Nil_Element
if Int_Kind (Left) = Not_An_Element or else
Int_Kind (Right) = Not_An_Element
then
return (Int_Kind (Left) = Int_Kind (Right));
end if;
-- Then, we are checking if the basic properties of the argument are
-- the same
if not (Special_Case (Left) = Special_Case (Right) and then
Int_Kind (Left) = Int_Kind (Right) and then
Character_Code (Left) = Character_Code (Right) and then
Is_From_Implicit (Left) = Is_From_Implicit (Right) and then
Is_From_Inherited (Left) = Is_From_Inherited (Right) and then
Is_From_Instance (Left) = Is_From_Instance (Right) and then
Normalization_Case (Left) = Normalization_Case (Right) and then
Parenth_Count (Left) = Parenth_Count (Right))
then
return False;
end if;
-- Now, checking that arguments are from the same Ada unit
C_Left := Encl_Cont_Id (Left);
U_Left := Encl_Unit_Id (Left);
C_Right := Encl_Cont_Id (Right);
U_Right := Encl_Unit_Id (Right);
if C_Left = C_Right then
if U_Left /= U_Right then
return False;
end if;
else
-- This case is a bit more complicated: we have to compare names
-- and time stamps of enclosed units
if U_Left = Standard_Id or else U_Right = Standard_Id then
if U_Left /= U_Right then
return False;
end if;
else
if Time_Stamp (C_Left, U_Left) /=
Time_Stamp (C_Right, U_Right)
then
return False;
end if;
-- Here we have to compare unit names. Let's check unit kind
-- and class first
CU_Left := Encl_Unit (Left);
CU_Right := Encl_Unit (Right);
if not (Kind (CU_Left) = Kind (CU_Right) and then
Class (CU_Left) = Class (CU_Right))
then
return False;
end if;
-- And now - unit names. This case does not seem to be
-- encountered very often, so we simply use Unit_Full_Name
-- query to avoid manual Context switching:
if Asis.Compilation_Units.Unit_Full_Name (CU_Left) /=
Asis.Compilation_Units.Unit_Full_Name (CU_Right)
then
return False;
end if;
end if;
end if;
-- And if we are here, we are in the following situation: both Left
-- and Right are non-nil Elements, they have all their properties
-- the same and they are from the same Compilation_Unit.
-- And now we have to check if they represents the same construct.
if U_Left = Standard_Id or else
(C_Left = C_Right
and then
Encl_Tree (Left) = Encl_Tree (Right))
then
-- In Standard, we may just compare the node values.
-- In the same tree we may do the same
return R_Node (Left) = R_Node (Right);
end if;
-- In case of configuration pragmas and components thereof we are very
-- conservative - two elements can be equal only if there are from
-- the same tree. The reason for this is that in ASIS we have no
-- means to control that the content of the configuration files
-- is the same in different trees.
if Special_Case (Left) = Configuration_File_Pragma then
return Encl_Tree (Left) = Encl_Tree (Right) and then
R_Node (Left) = R_Node (Right);
end if;
-- And if we are here, we have to compare Elements obtained from
-- different trees
if not Is_From_Instance (Left) then
-- May be, we have to use source-trace-based approach for
-- all cases....????
return Rel_Sloc (Left) = Rel_Sloc (Right);
end if;
-- If we are here, we have to compare node traces.
Reset_Context (C_Left);
N_Left := R_Node (Left);
Create_Node_Trace (N_Left);
Reset_Context (C_Right);
N_Right := R_Node (Right);
Result := True;
for J in Node_Trace.First .. Node_Trace.Last loop
if No (N_Right) or else
not Is_Equal (N_Right, Node_Trace.Table (J))
then
Result := False;
exit;
end if;
N_Right := A4G.Asis_Tables.Enclosing_Scope (N_Right);
end loop;
return Result;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call => Package_Name & "Is_Equal");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Is_Equal",
Ex => Ex,
Arg_Element => Left,
Arg_Element_2 => Right);
end Is_Equal;
-----------------------------------------------------------------------------
function Is_Identical
(Left : Asis.Element;
Right : Asis.Element)
return Boolean
is
C_Left : Context_Id;
C_Right : Context_Id;
begin
Check_Validity (Left, Package_Name & "Is_Identical");
Check_Validity (Right, Package_Name & "Is_Identical");
C_Left := Encl_Cont_Id (Left);
C_Right := Encl_Cont_Id (Right);
if C_Left /= C_Right then
return False;
else
return Is_Equal (Left, Right);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call => Package_Name & "Is_Identical");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Is_Identical",
Ex => Ex,
Arg_Element => Left,
Arg_Element_2 => Right);
end Is_Identical;
------------------------------------------------------------------------------
-- The general principle of the implementation
-- of the Is_Part_Of_... functions:
--
-- These functions simply returns the corresponding flag value from the
-- Element passed as their argument. All necessary work should be done
-- during the creation of the Element when these flags are set
--
-- All of them (as well as the function Declaration_Origin above) will
-- require revisiting during semantic queries implementation
------------------------------------------------------------------------------
function Is_Part_Of_Implicit (Element : Asis.Element) return Boolean is
begin
Check_Validity (Element, Package_Name & "Is_Part_Of_Implicit");
return Is_From_Implicit (Element) or else
Normalization_Case (Element) in Normalized_Association;
-- for normalized associations Is_Part_Of_Implicit is not set ON ???
-- unless the association is from some enclosing implicit construct. ???
end Is_Part_Of_Implicit;
-----------------------------------------------------------------------------
function Is_Part_Of_Inherited (Element : Asis.Element) return Boolean is
begin
Check_Validity (Element, Package_Name & "Is_Part_Of_Inherited");
return Is_From_Inherited (Element);
end Is_Part_Of_Inherited;
-----------------------------------------------------------------------------
function Is_Part_Of_Instance (Element : Asis.Element) return Boolean is
begin
Check_Validity (Element, Package_Name & "Is_Part_Of_Instance");
return Is_From_Instance (Element);
end Is_Part_Of_Instance;
-----------------------------------------------------------------------------
function Enclosing_Element
(Element : Asis.Element)
return Asis.Element
is
Argument_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Arg_Spec_Case : constant Special_Cases := Special_Case (Element);
begin
Check_Validity (Element, Package_Name & "Enclosing_Element");
if Argument_Kind = Not_An_Element then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Enclosing_Element",
Wrong_Kind => Argument_Kind);
end if;
-- if the argument is an expanded generic declaration we have
-- to return the corresponding instantiation:
if Arg_Spec_Case in Expanded_Spec then
return Corresponding_Instantiation (Element);
end if;
-- if the argument is from an expanded generic declaration,
-- we have to be careful when coming from some top-level component
-- of the expanded declaration to the declaration itself - we
-- need to set the Special_Case field properly
if Is_From_Instance (Element) and then
not Is_From_Implicit (Element)
then
if Arg_Spec_Case in
Dummy_Base_Attribute_Designator .. Dummy_Class_Attribute_Prefix
then
declare
Result : Asis.Element := Element;
begin
Set_Special_Case (Result, Not_A_Special_Case);
if Arg_Spec_Case = Dummy_Class_Attribute_Designator
or else
Arg_Spec_Case = Dummy_Class_Attribute_Prefix
then
Set_Int_Kind (Result, A_Class_Attribute);
elsif Arg_Spec_Case = Dummy_Base_Attribute_Designator
or else
Arg_Spec_Case = Dummy_Base_Attribute_Prefix
then
Set_Int_Kind (Result, A_Base_Attribute);
end if;
return Result;
end;
else
return Enclosing_For_Explicit_Instance_Component (Element);
end if;
end if;
if not (Is_From_Implicit (Element) or else
Is_From_Inherited (Element))
or else
-- 'floating' labels in Ada 2012
Statement_Kind (Element) = A_Null_Statement
then
return Enclosing_Element_For_Explicit (Element);
elsif Is_From_Limited_View (Element) then
return Enclosing_Element_For_Limited_View (Element);
else
return Enclosing_Element_For_Implicit (Element);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Enclosing_Element");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Enclosing_Element",
Ex => Ex,
Arg_Element => Element);
end Enclosing_Element;
------------------------------------------------------------------------------
function Enclosing_Element
(Element : Asis.Element;
Expected_Enclosing_Element : Asis.Element)
return Asis.Element
is
begin
Check_Validity
(Element,
Package_Name & "Enclosing_Element (the Element parameter)");
Check_Validity
(Expected_Enclosing_Element,
Package_Name &
"Enclosing_Element (the Expected_Enclosing_Element parameter)");
return Enclosing_Element (Element);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Enclosing_Element");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Enclosing_Element",
Ex => Ex,
Arg_Element => Element,
Arg_Element_2 => Expected_Enclosing_Element);
end Enclosing_Element;
-----------------------------------------------------------------------------
function Pragmas
(The_Element : Asis.Element)
return Asis.Pragma_Element_List
is
-- This implementation is based on the following statement in the function
-- documentation:
--
-- This interface returns exactly those pragmas that would be returned by the
-- various interfaces, that accept these same argument kinds, and that
-- return Declaration_Lists and Statement_Lists, where the inclusion of
-- Pragmas is controlled by an Include_Pragmas parameter.
--
-- The general idea of the implementation is straightforward - to get
-- the "full" Element_List by the call of the corresponding interface
-- with Include_Pragmas => True, and then select only A_Pragma elements
-- from this intermediate result.
--
-- Some loss of effectiveness could be considered as the disadvantage of
-- this approach, but its advantages are:
--
-- - it saves implementation efforts;
-- - it allows to check whether the documentation fragment cited above
-- is really correct;
-- - it saves the debugging efforts on the first prototyping stage
-- (there is no need for the special debugging of this function
-- if other ASIS interfaces used for its implementation work correctly);
-- - it is more convenient for incremental development
-- - it yields the vendor-independent implementation of this function
Context_Internal_Kind : Internal_Element_Kinds;
function Extract_Pragmas
(List : Asis.Element_List)
return Asis.Pragma_Element_List;
-- function extracts Elements of A_Pragma kind from its
-- List parameter and returns the new List constructed from these
-- Pragma Elements (in their order of appearance) as its result
function Extract_Pragmas
(List : Asis.Element_List)
return Asis.Pragma_Element_List
is
Pragma_List : Asis.Pragma_Element_List (List'Range);
Pragma_List_Actual_Lenght : Asis.ASIS_Integer := 0;
begin
for I in List'Range loop
if Element_Kind (List (I)) = A_Pragma then
Pragma_List_Actual_Lenght := Pragma_List_Actual_Lenght + 1;
Pragma_List (Pragma_List_Actual_Lenght) := List (I);
end if;
end loop;
return Pragma_List (1 .. Pragma_List_Actual_Lenght);
end Extract_Pragmas;
begin -- Pragmas
Check_Validity (The_Element, Package_Name & "Pragmas");
Context_Internal_Kind := Int_Kind (The_Element);
if not -- Appropriate Element_Kinds:
(Context_Internal_Kind in Internal_Statement_Path_Kinds
or else Context_Internal_Kind = An_Exception_Handler
-- Appropriate Declaration_Kinds:
or else Context_Internal_Kind = A_Procedure_Body_Declaration
or else Context_Internal_Kind = A_Function_Body_Declaration
or else Context_Internal_Kind = A_Package_Declaration
or else Context_Internal_Kind = A_Package_Body_Declaration
or else Context_Internal_Kind = A_Task_Body_Declaration
or else Context_Internal_Kind = A_Protected_Body_Declaration
or else Context_Internal_Kind = An_Entry_Body_Declaration
or else Context_Internal_Kind = A_Generic_Procedure_Declaration
or else Context_Internal_Kind = A_Generic_Function_Declaration
or else Context_Internal_Kind = A_Generic_Package_Declaration
-- Appropriate Definition_Kinds:
or else Context_Internal_Kind = A_Record_Definition
or else Context_Internal_Kind = A_Variant_Part
or else Context_Internal_Kind = A_Variant
or else Context_Internal_Kind = A_Task_Definition
or else Context_Internal_Kind = A_Protected_Definition
-- Appropriate Statement_Kinds:
or else Context_Internal_Kind = A_Loop_Statement
or else Context_Internal_Kind = A_While_Loop_Statement
or else Context_Internal_Kind = A_For_Loop_Statement
or else Context_Internal_Kind = A_Block_Statement
or else Context_Internal_Kind = An_Accept_Statement
-- Representation_Clause_Kinds:
or else Context_Internal_Kind = A_Record_Representation_Clause)
then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Pragmas",
Wrong_Kind => Context_Internal_Kind);
end if;
case Context_Internal_Kind is
-- Appropriate Element_Kinds:
when Internal_Path_Kinds =>
-- A_Path: (pragmas from the statement list)
return Extract_Pragmas (
Asis.Statements.Sequence_Of_Statements (
Path => The_Element,
Include_Pragmas => True));
when An_Exception_Handler =>
-- (pragmas from the statement list)
return Extract_Pragmas (
Asis.Statements.Handler_Statements (
Handler => The_Element,
Include_Pragmas => True));
-- Appropriate Declaration_Kinds:
when A_Procedure_Body_Declaration -- (pragmas from decl region
| A_Function_Body_Declaration -- + statements)
| A_Package_Body_Declaration -- !! SEE OPEN_PROBLEMS.1 BELOW
| A_Task_Body_Declaration
| An_Entry_Body_Declaration =>
return (Extract_Pragmas (
Asis.Declarations.Body_Declarative_Items (
Declaration => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Declarations.Body_Statements (
Declaration => The_Element,
Include_Pragmas => True)));
when A_Package_Declaration =>
-- (pragmas from visible + private decl regions)
return (Extract_Pragmas (
Asis.Declarations.Visible_Part_Declarative_Items (
Declaration => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Declarations.Private_Part_Declarative_Items (
Declaration => The_Element,
Include_Pragmas => True)));
when A_Protected_Body_Declaration =>
-- (pragmas from decl region)
return Extract_Pragmas (
Asis.Declarations.Protected_Operation_Items (
Declaration => The_Element,
Include_Pragmas => True));
when A_Generic_Procedure_Declaration
| A_Generic_Function_Declaration =>
-- (pragmas from formal decl region
return Extract_Pragmas (
Asis.Declarations.Generic_Formal_Part (
Declaration => The_Element,
Include_Pragmas => True));
when A_Generic_Package_Declaration =>
-- (pragmas from formal + visible + private decl regions)
return (Extract_Pragmas (
Asis.Declarations.Generic_Formal_Part (
Declaration => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Declarations.Visible_Part_Declarative_Items (
Declaration => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Declarations.Private_Part_Declarative_Items (
Declaration => The_Element,
Include_Pragmas => True)));
-- Appropriate Definition_Kinds:
when A_Record_Definition
| A_Variant =>
-- (pragmas from the component list)
return Extract_Pragmas (
Asis.Definitions.Record_Components (
Definition => The_Element,
Include_Pragmas => True));
when A_Variant_Part =>
-- (pragmas from between variants)
return Extract_Pragmas (
Asis.Definitions.Variants (
Variant_Part => The_Element,
Include_Pragmas => True));
when A_Task_Definition
| A_Protected_Definition =>
-- (pragmas from visible + private decl regions)
return (Extract_Pragmas (
Asis.Definitions.Visible_Part_Items (
Definition => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Definitions.Private_Part_Items (
Definition => The_Element,
Include_Pragmas => True)));
-- Appropriate Statement_Kinds:
when A_Loop_Statement
| A_While_Loop_Statement
| A_For_Loop_Statement =>
-- (pragmas from statement list)
return Extract_Pragmas (
Asis.Statements.Loop_Statements (
Statement => The_Element,
Include_Pragmas => True));
when A_Block_Statement =>
-- (pragmas from decl region + statements)
return (Extract_Pragmas (
Asis.Statements.Block_Declarative_Items (
Statement => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Statements.Block_Statements (
Statement => The_Element,
Include_Pragmas => True)));
when An_Accept_Statement =>
-- (pragmas from statement list+ pragma immediately preceding
-- the first exception handler, if any)
-- !! SEE OPEN_PROBLEMS.2 BELOW
return (Extract_Pragmas (
Asis.Statements.Accept_Body_Statements (
Statement => The_Element,
Include_Pragmas => True))
&
Extract_Pragmas (
Asis.Statements.Accept_Body_Exception_Handlers (
Statement => The_Element,
Include_Pragmas => True)));
-- Appropriate Representation_Clause_Kinds:
when A_Record_Representation_Clause =>
-- (pragmas from component specifications)
return Extract_Pragmas (
Asis.Clauses.Component_Clauses (
Clause => The_Element,
Include_Pragmas => True));
when others =>
-- Should never been reached !!!
raise Internal_Implementation_Error;
end case;
exception
when ASIS_Inappropriate_Element =>
Add_Call_Information (Outer_Call => Package_Name & "Pragmas");
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => The_Element,
Outer_Call => Package_Name & "Pragmas");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Pragmas",
Ex => Ex,
Arg_Element => The_Element);
end Pragmas;
------------------------------------------------------------------------------
-- PARTIALLY IMPLEMENTED
---------------------------
-- Corresponding_Pragmas --
---------------------------
function Corresponding_Pragmas
(Element : Asis.Element)
return Asis.Pragma_Element_List
is
Next_Rep_Node : Node_Id;
Next_Pragma_Node : Node_Id := Empty;
Arg_Node : Node_Id;
begin
Check_Validity (Element, Package_Name & "Corresponding_Pragmas");
if not (Element_Kind (Element) = A_Declaration
or else
Element_Kind (Element) = A_Statement)
then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Corresponding_Pragmas",
Wrong_Kind => Int_Kind (Element));
end if;
-- At the moment, this is a partial implementation:
-- - for A_Statement argument Nil_Element_List is always returned;
-- - for A_Declaration argument that represents
-- - for A_Declaration argument that corresponds to a unit declaration
-- from the compilation unit or to the proper body of subunit, nothing
-- is returned.
-- - implicit inherited declarations are not properly processed
-- - the result list contains representation pragmas only
if Element_Kind (Element) = A_Statement then
return Nil_Element_List;
else
Asis_Element_Table.Init;
case Declaration_Kind (Element) is
when A_Procedure_Declaration |
A_Function_Declaration |
A_Procedure_Body_Declaration |
A_Function_Body_Declaration |
A_Procedure_Renaming_Declaration |
A_Function_Renaming_Declaration |
An_Entry_Declaration |
A_Procedure_Body_Stub |
A_Function_Body_Stub |
A_Procedure_Instantiation |
A_Function_Instantiation =>
-- Overloadable entities, pragmas are not chained.
-- At the moment we can process only explicit stuff.
-- First, collect Pre- and Postcondition pragmas, if any.
Arg_Node := R_Node (Element);
case Declaration_Kind (Element) is
when A_Procedure_Declaration |
A_Function_Declaration =>
if Is_List_Member (Arg_Node) then
Next_Pragma_Node := Next (Arg_Node);
else
-- Spec of a library-level subprogram
Next_Pragma_Node := Aux_Decls_Node (Parent (Arg_Node));
if Present (Pragmas_After (Next_Pragma_Node)) then
Next_Pragma_Node :=
First (Pragmas_After (Next_Pragma_Node));
else
Next_Pragma_Node := Empty;
end if;
end if;
when A_Procedure_Body_Declaration |
A_Function_Body_Declaration =>
Next_Pragma_Node := First (Sinfo.Declarations (Arg_Node));
while Present (Next_Pragma_Node)
and then
not Comes_From_Source
(Original_Node (Next_Pragma_Node))
loop
Next_Pragma_Node := Next (Next_Pragma_Node);
end loop;
when others => null;
end case;
while Present (Next_Pragma_Node)
and then
Nkind (Next_Pragma_Node) = N_Pragma
loop
if Comes_From_Source (Original_Node (Next_Pragma_Node))
and then
(Pragma_Name (Original_Node (Next_Pragma_Node)) in
Name_Postcondition .. Name_Precondition)
-- SCz
-- or else
-- Pragma_Name (Original_Node (Next_Pragma_Node)) =
-- Name_Test_Case
-- or else
-- Pragma_Name (Original_Node (Next_Pragma_Node)) =
-- Name_Contract_Case)
then
Asis_Element_Table.Append
(Node_To_Element_New
(Starting_Element => Element,
Node => Next_Pragma_Node));
end if;
Next_Pragma_Node := Next (Next_Pragma_Node);
while Present (Next_Pragma_Node)
and then
not Comes_From_Source (Original_Node (Next_Pragma_Node))
loop
Next_Pragma_Node := Next (Next_Pragma_Node);
end loop;
end loop;
-- Now - general processing of all the other pragmas that can be
-- semantically associated with the argument
if not Is_Part_Of_Implicit (Element)
and then
Enclosing_Element (Element) /= Nil_Element
then
case Nkind (Arg_Node) is
when N_Subprogram_Declaration |
N_Abstract_Subprogram_Declaration |
N_Subprogram_Body |
N_Subprogram_Renaming_Declaration |
N_Subprogram_Body_Stub =>
Arg_Node := Defining_Unit_Name (Specification (Arg_Node));
when N_Entry_Declaration =>
Arg_Node := Defining_Identifier (Arg_Node);
when N_Procedure_Instantiation |
N_Function_Instantiation =>
Arg_Node := Defining_Unit_Name (Arg_Node);
when others =>
pragma Assert (False);
null;
end case;
Next_Rep_Node := R_Node (Element);
Next_Rep_Node := Next (Next_Rep_Node);
while Present (Next_Rep_Node) loop
if Nkind (Next_Rep_Node) = N_Pragma
and then
Is_Applied_To (Next_Rep_Node, Arg_Node)
then
Asis_Element_Table.Append
(Node_To_Element_New
(Starting_Element => Element,
Node => Next_Rep_Node));
end if;
Next_Rep_Node := Next (Next_Rep_Node);
end loop;
-- In case if the argument declaration is in the visible part
-- of the package spec, traverse the private part:
Next_Rep_Node := Parent (R_Node (Element));
if Nkind (Next_Rep_Node) = N_Package_Specification
and then
List_Containing (R_Node (Element)) =
Visible_Declarations (Next_Rep_Node)
then
Next_Rep_Node :=
First (Private_Declarations (Next_Rep_Node));
while Present (Next_Rep_Node) loop
if Nkind (Next_Rep_Node) = N_Pragma
and then
Is_Applied_To (Next_Rep_Node, Arg_Node)
then
Asis_Element_Table.Append
(Node_To_Element_New
(Starting_Element => Element,
Node => Next_Rep_Node));
end if;
Next_Rep_Node := Next (Next_Rep_Node);
end loop;
end if;
end if;
when others =>
-- Non-overloadable entity. This implementation is not good,
-- but we have to deal with an error in query definition -
-- the query should actually be applied to an entity, but not
-- to a declaration that can define more than one entity.
declare
Decl_Names : constant Element_List := Names (Element);
Next_Name : Asis.Element;
begin
for J in Decl_Names'Range loop
Next_Name := Decl_Names (J);
if Defining_Name_Kind (Next_Name) =
A_Defining_Expanded_Name
then
Next_Name := Defining_Selector (Next_Name);
end if;
Next_Rep_Node := First_Rep_Item (R_Node (Next_Name));
while Present (Next_Rep_Node) loop
if Nkind (Next_Rep_Node) = N_Pragma then
Asis_Element_Table.Append
(Node_To_Element_New
(Starting_Element => Element,
Node => Next_Rep_Node));
end if;
Next_Rep_Node := Next_Rep_Item (Next_Rep_Node);
end loop;
end loop;
end;
end case;
return Asis.Pragma_Element_List
(Asis_Element_Table.Table (1 .. Asis_Element_Table.Last));
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Corresponding_Pragmas");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Corresponding_Pragmas",
Ex => Ex,
Arg_Element => Element);
end Corresponding_Pragmas;
-----------------------------------------------------------------------------
function Pragma_Name_Image
(Pragma_Element : Asis.Pragma_Element)
return Wide_String
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Pragma_Element);
Arg_Node : Node_Id;
Image_Start : Source_Ptr;
Image_End : Source_Ptr;
begin
Check_Validity (Pragma_Element, Package_Name & "Pragma_Name_Image");
if Arg_Kind not in Internal_Pragma_Kinds then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Pragma_Name_Image",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Pragma_Element);
Image_Start := Next_Identifier (Sloc (Arg_Node) + 5);
Image_End := Get_Word_End (P => Image_Start,
In_Word => In_Identifier'Access);
return Get_Wide_Word (Image_Start, Image_End);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Pragma_Element,
Outer_Call => Package_Name & "Pragma_Name_Image");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Pragma_Name_Image",
Ex => Ex,
Arg_Element => Pragma_Element);
end Pragma_Name_Image;
-----------------------------------------------------------------------------
function Pragma_Argument_Associations
(Pragma_Element : Asis.Pragma_Element)
return Asis.Association_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Pragma_Element);
Arg_Node : Node_Id;
begin
Check_Validity
(Pragma_Element, Package_Name & "Pragma_Argument_Associations");
if Arg_Kind not in Internal_Pragma_Kinds then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Pragma_Argument_Associations",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Pragma_Element);
return N_To_E_List_New
(List => Pragma_Argument_Associations (Arg_Node),
Internal_Kind => A_Pragma_Argument_Association,
Starting_Element => Pragma_Element);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Pragma_Element,
Outer_Call => Package_Name & "Pragma_Argument_Associations");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Pragma_Argument_Associations",
Ex => Ex,
Arg_Element => Pragma_Element);
end Pragma_Argument_Associations;
-----------------------------------------------------------------------------
function Debug_Image (Element : Asis.Element) return Wide_String is
LT : String renames A4G.A_Types.ASIS_Line_Terminator;
begin
Check_Validity (Element, Package_Name & "Debug_Image");
Debug_String (Element);
return To_Wide_String (
LT & "Element Debug_Image:" & LT &
Debug_Buffer (1 .. Debug_Buffer_Len));
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Debug_Image");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Debug_Image",
Ex => Ex,
Arg_Element => Element);
end Debug_Image;
-----------------------------------------------------------------------------
-- The following constants are used in the computation of hash values for
-- Elements which are not from Standard:
Line_Pos : constant Natural := 6;
Bit_Pos : constant Natural := 1;
Impl_Pos : Natural renames Bit_Pos;
Inh_Pos : Natural renames Bit_Pos;
Inst_Pos : Natural renames Bit_Pos;
Kind_Pos : constant Natural := 8;
Col_Pos : constant Natural := 4;
Name_Pos : constant Natural := 9;
Spec_Pos : constant Natural := 2;
Max_Names : constant Unsigned_32 := 2 ** Name_Pos;
Max_Cols : constant Unsigned_32 := 2 ** Col_Pos;
Max_Kinds : constant Unsigned_32 := 2 ** Kind_Pos;
Max_Lines : constant Unsigned_32 := 2 ** Line_Pos;
Max_Specs : constant Unsigned_32 := 2 ** Spec_Pos;
subtype Unit_Name_Hash_Range is Integer range 0 .. Integer (Max_Names) - 1;
function Ada_Name_Hash is new GNAT.HTable.Hash (Unit_Name_Hash_Range);
function Hash (Element : Asis.Element) return Asis.ASIS_Integer is
N : Node_Id;
S : Source_Ptr;
L : Physical_Line_Number;
C : Column_Number;
Result : Unsigned_32 := 0;
function Get_Ada_Name return String;
-- Returns Ada name of the Element's enclosing unit appended with 'S' if
-- the unit is a spec unit and with 'B' if it is a body unit. Returns
-- null string for Nil_Element
function Get_Ada_Name return String is
CU : Asis.Compilation_Unit;
Spec_Or_Body : Character := 'B';
begin
if Is_Nil (Element) then
return "";
else
CU := Enclosing_Compilation_Unit (Element);
if Asis.Compilation_Units.Unit_Kind (CU) in
A_Procedure .. A_Generic_Package_Renaming
then
Spec_Or_Body := 'S';
end if;
return To_String
(Asis.Compilation_Units.Unit_Full_Name (CU)) & Spec_Or_Body;
end if;
end Get_Ada_Name;
function To_ASIS_Integer is new
Ada.Unchecked_Conversion
(Source => Unsigned_32,
Target => Asis.ASIS_Integer);
begin
Check_Validity (Element, Package_Name & "Hash");
-- The hash value for Elements is first created as 32-bit unsigned
-- integer and then converted into ASIS_Integer
--
-- Different approaches are used to create this 32-bit unsigned
-- integer value for Elements which are and which are not from the
-- predefined Standard package.
--
-- For Elements from Standard:
-- - If Element represents the An_Enumeration_Literal_Specification
-- or A_Defining_Character_Literal from types Character or
-- Standard_Character, the corresponding character code is used
-- as hash value
-- - otherwise the Node Id of the Element is used as hash value;
--
-- For Elements which are not from Standard the 32 bits are first
-- filled in by the following information:
--
-- 0 .. 8 - the hash value computed from the Ada name of enclosing
-- unit
-- 9 - Is_Part_Of_Implicit
-- 10 .. 13 - column in the source file computed from the Sloc of
-- Element's Node reference
-- 14 - Is_Part_Of_Inherited
-- 15 .. 22 - Internal kind (converted to 'Pos value)
-- 23 - Is_Part_Of_Instance
-- 24 .. 29 - line in the source file computed from the Sloc of
-- Element's Node reference
-- 30 .. 31 - Special_Case (converted to 'Pos value)
--
-- All the values are reduced modulo the corresponding values to fit
-- the corresponding range. In case of extended generic code, line
-- and column are computed as the sum of all the lines and columns
-- in the chain of the source references corresponding to the
-- instantiation
--
-- After creating such a value, it is rotated right by the number of
-- the lines computed from Sloc of Element's Node reference
if Encl_Unit_Id (Element) = Standard_Id then
if Character_Code (Element) /= 0 then
Result := Result + (Unsigned_32 (Character_Code (Element)));
else
N := Node_Value (Element);
Result := Unsigned_32 (N);
end if;
elsif not Is_Nil (Element) then
N := Node (Element);
S := Sloc (N);
L := Get_Physical_Line_Number (Sloc (N));
C := Get_Column_Number (Sloc (N));
S := Instantiation_Location (S);
while S /= No_Location loop
L := L + Get_Physical_Line_Number (Sloc (N));
C := C + Get_Column_Number (Sloc (N));
S := Instantiation_Location (S);
end loop;
-- Special Case:
Result := Result +
(Unsigned_32 (
Special_Cases'Pos (Special_Case (Element))) mod Max_Specs);
Result := Shift_Left (Result, Line_Pos);
-- Line:
Result := Result + (Unsigned_32 (L) mod Max_Lines);
Result := Shift_Left (Result, Inst_Pos);
-- Is_Part_Of_Instance
if Is_From_Instance (Element) then
Result := Result + 1;
end if;
Result := Shift_Left (Result, Kind_Pos);
-- Internal kind:
Result := Result +
(Internal_Element_Kinds'Pos (Int_Kind (Element)) mod Max_Kinds);
Result := Shift_Left (Result, Inh_Pos);
-- Is_Part_Of_Inherited
if Is_From_Inherited (Element) then
Result := Result + 1;
end if;
Result := Shift_Left (Result, Col_Pos);
-- Column:
Result := Result + (Unsigned_32 (C) mod Max_Cols);
Result := Shift_Left (Result, Impl_Pos);
-- Is_Part_Of_Implicit:
if Is_From_Implicit (Element) then
Result := Result + 1;
end if;
Result := Shift_Left (Result, Name_Pos);
-- Hash value computed from the name of enclosed unit:
Result := Result + Unsigned_32 (Ada_Name_Hash (Get_Ada_Name));
-- And now, rotating Result
Result := Rotate_Right (Result, Natural (L));
end if;
return To_ASIS_Integer (Result);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Element,
Outer_Call => Package_Name & "Hash");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Hash",
Ex => Ex,
Arg_Element => Element);
end Hash;
-----------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Processing of the Ada extensions that most likely will be included in --
-- Ada 2015 and that are already implemented in GNAT --
------------------------------------------------------------------------------
end Asis.Elements;
|
PThierry/ewok-kernel | Ada | 31 | adb | ../stm32f439/soc-interrupts.adb |
mirror/ncurses | Ada | 3,095 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- tour --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1998-2002,2003 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.11 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Sample; use Sample;
procedure Tour is
begin
Whow;
end Tour;
|
darkestkhan/cbap | Ada | 2,581 | adb | pragma License (GPL);
------------------------------------------------------------------------------
-- EMAIL: <[email protected]> --
-- License: GNU GPLv3 or any later as published by Free Software Foundation --
-- (see COPYING file) --
-- --
-- Copyright © 2015 darkestkhan --
------------------------------------------------------------------------------
-- 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 Ada.Command_Line;
with CBAP;
procedure CBAP_Register_Error_Test is
---------------------------------------------------------------------------
procedure Cause_Error (Argument: in String) is null;
---------------------------------------------------------------------------
Got_Errors: Natural := 0;
---------------------------------------------------------------------------
begin
begin
CBAP.Register (Cause_Error'Unrestricted_Access, "letsroll=die");
exception
when CBAP.Incorrect_Called_On => Got_Errors := Got_Errors + 1;
end;
begin
CBAP.Register (Cause_Error'Unrestricted_Access, "help");
CBAP.Register (Cause_Error'Unrestricted_Access, "help");
exception
when Constraint_Error => Got_Errors := Got_Errors + 1;
end;
if Got_Errors /= 2 then
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
else
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Success);
end if;
end CBAP_Register_Error_Test;
|
reznikmm/matreshka | Ada | 4,666 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Number_Era_Elements;
package Matreshka.ODF_Number.Era_Elements is
type Number_Era_Element_Node is
new Matreshka.ODF_Number.Abstract_Number_Element_Node
and ODF.DOM.Number_Era_Elements.ODF_Number_Era
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Number_Era_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Number_Era_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Number_Era_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Number_Era_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Number_Era_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Number.Era_Elements;
|
zhmu/ananas | Ada | 55,573 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A L I --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the internal data structures used for representation
-- of Ada Library Information (ALI) acquired from the ALI files generated by
-- the front end.
with Casing; use Casing;
with Gnatvsn; use Gnatvsn;
with Namet; use Namet;
with Rident; use Rident;
with Table;
with Types; use Types;
with GNAT.Dynamic_Tables;
with GNAT.HTable; use GNAT.HTable;
package ALI is
--------------
-- Id Types --
--------------
type ALI_Id is range 0 .. 99_999_999;
-- Id values used for ALIs table entries
type Unit_Id is range 0 .. 99_999_999;
-- Id values used for Unit table entries
type With_Id is range 0 .. 99_999_999;
-- Id values used for Withs table entries
type Arg_Id is range 0 .. 99_999_999;
-- Id values used for argument table entries
type Sdep_Id is range 0 .. 99_999_999;
-- Id values used for Sdep table entries
type Source_Id is range 0 .. 99_999_999;
-- Id values used for Source table entries
type Interrupt_State_Id is range 0 .. 99_999_999;
-- Id values used for Interrupt_State table entries
type Priority_Specific_Dispatching_Id is range 0 .. 99_999_999;
-- Id values used for Priority_Specific_Dispatching table entries
type Invocation_Construct_Id is range 0 .. 99_999_999;
-- Id values used for Invocation_Constructs table entries
type Invocation_Relation_Id is range 0 .. 99_999_999;
-- Id values used for Invocation_Relations table entries
type Invocation_Signature_Id is range 0 .. 99_999_999;
-- Id values used for Invocation_Signatures table entries
function Present (IC_Id : Invocation_Construct_Id) return Boolean;
pragma Inline (Present);
-- Determine whether invocation construct IC_Id exists
function Present (IR_Id : Invocation_Relation_Id) return Boolean;
pragma Inline (Present);
-- Determine whether invocation relation IR_Id exists
function Present (IS_Id : Invocation_Signature_Id) return Boolean;
pragma Inline (Present);
-- Determine whether invocation signature IS_Id exists
function Present (Dep : Sdep_Id) return Boolean;
pragma Inline (Present);
-- Determine whether dependant Dep exists
function Present (U_Id : Unit_Id) return Boolean;
pragma Inline (Present);
-- Determine whether unit U_Id exists
function Present (W_Id : With_Id) return Boolean;
pragma Inline (Present);
-- Determine whether with W_Id exists
--------------------
-- ALI File Table --
--------------------
-- Each ALI file read generates an entry in the ALIs table
No_ALI_Id : constant ALI_Id := ALI_Id'First;
-- Special value indicating no ALI entry
First_ALI_Entry : constant ALI_Id := No_ALI_Id + 1;
-- Id of first actual entry in table
-- The following type enumerates all possible invocation-graph encoding
-- kinds.
type Invocation_Graph_Encoding_Kind is
(Endpoints_Encoding,
-- The invocation construct and relation lines contain information for
-- the start construct and end target found on an invocation-graph path.
Full_Path_Encoding,
-- The invocation construct and relation lines contain information for
-- all constructs and targets found on a invocation-graph path.
No_Encoding);
type Main_Program_Type is (None, Proc, Func);
-- Indicator of whether unit can be used as main program
type ALIs_Record is record
Afile : File_Name_Type;
-- Name of ALI file
Ofile_Full_Name : File_Name_Type;
-- Full name of object file corresponding to the ALI file
Sfile : File_Name_Type;
-- Name of source file that generates this ALI file (which is equal
-- to the name of the source file in the first unit table entry for
-- this ALI file, since the body if present is always first).
Ver : String (1 .. Ver_Len_Max);
-- Value of library version (V line in ALI file). Not set if
-- V lines are ignored as a result of the Ignore_Lines parameter.
Ver_Len : Natural;
-- Length of characters stored in Ver. Not set if V lines are ignored as
-- a result of the Ignore_Lines parameter.
SAL_Interface : Boolean;
-- Set True when this is an interface to a standalone library
First_Unit : Unit_Id;
-- Id of first Unit table entry for this file
Last_Unit : Unit_Id;
-- Id of last Unit table entry for this file
First_Sdep : Sdep_Id;
-- Id of first Sdep table entry for this file
Last_Sdep : Sdep_Id;
-- Id of last Sdep table entry for this file
Main_Program : Main_Program_Type;
-- Indicator of whether first unit can be used as main program. Not set
-- if 'M' appears in Ignore_Lines.
Main_Priority : Int;
-- Indicates priority value if Main_Program field indicates that this
-- can be a main program. A value of -1 (No_Main_Priority) indicates
-- that no parameter was found, or no M line was present. Not set if
-- 'M' appears in Ignore_Lines.
Main_CPU : Int;
-- Indicates processor if Main_Program field indicates that this can
-- be a main program. A value of -1 (No_Main_CPU) indicates that no C
-- parameter was found, or no M line was present. Not set if 'M' appears
-- in Ignore_Lines.
Time_Slice_Value : Int;
-- Indicates value of time slice parameter from T=xxx on main program
-- line. A value of -1 indicates that no T=xxx parameter was found, or
-- no M line was present. Not set if 'M' appears in Ignore_Lines.
WC_Encoding : Character;
-- Wide character encoding if main procedure. Otherwise not relevant.
-- Not set if 'M' appears in Ignore_Lines.
Locking_Policy : Character;
-- Indicates locking policy for units in this file. Space means tasking
-- was not used, or that no Locking_Policy pragma was present or that
-- this is a language defined unit. Otherwise set to first character
-- (upper case) of policy name. Not set if 'P' appears in Ignore_Lines.
Partition_Elaboration_Policy : Character;
-- Indicates partition elaboration policy for units in this file. Space
-- means that no Partition_Elaboration_Policy pragma was present or that
-- this is a language defined unit. Otherwise set to first character
-- (upper case) of policy name. Not set if 'P' appears in Ignore_Lines.
Queuing_Policy : Character;
-- Indicates queuing policy for units in this file. Space means tasking
-- was not used, or that no Queuing_Policy pragma was present or that
-- this is a language defined unit. Otherwise set to first character
-- (upper case) of policy name. Not set if 'P' appears in Ignore_Lines.
Task_Dispatching_Policy : Character;
-- Indicates task dispatching policy for units in this file. Space means
-- tasking was not used, or that no Task_Dispatching_Policy pragma was
-- present or that this is a language defined unit. Otherwise set to
-- first character (upper case) of policy name. Not set if 'P' appears
-- in Ignore_Lines.
Compile_Errors : Boolean;
-- Set to True if compile errors for unit. Note that No_Object will
-- always be set as well in this case. Not set if 'P' appears in
-- Ignore_Lines.
GNATprove_Mode : Boolean;
-- Set to True if ALI and object file produced in GNATprove_Mode as
-- signalled by GP appearing on the P line. Not set if 'P' appears in
-- Ignore_Lines.
No_Component_Reordering : Boolean;
-- Set to True if file was compiled with a configuration pragma file
-- containing pragma No_Component_Reordering. Not set if 'P' appears
-- in Ignore_Lines.
No_Object : Boolean;
-- Set to True if no object file generated. Not set if 'P' appears in
-- Ignore_Lines.
Normalize_Scalars : Boolean;
-- Set to True if file was compiled with Normalize_Scalars. Not set if
-- 'P' appears in Ignore_Lines.
SSO_Default : Character;
-- Set to 'H' or 'L' if file was compiled with a configuration pragma
-- file containing Default_Scalar_Storage_Order (High/Low_Order_First).
-- Set to ' ' if neither pragma was present. Not set if 'P' appears in
-- Ignore_Lines.
Unit_Exception_Table : Boolean;
-- Set to True if unit exception table pointer generated. Not set if 'P'
-- appears in Ignore_Lines.
Frontend_Exceptions : Boolean;
-- Set to True if file was compiled with front-end exceptions. Not set
-- if 'P' appears in Ignore_Lines.
Zero_Cost_Exceptions : Boolean;
-- Set to True if file was compiled with zero cost exceptions. Not set
-- if 'P' appears in Ignore_Lines.
Restrictions : Restrictions_Info;
-- Restrictions information reconstructed from R lines
First_Interrupt_State : Interrupt_State_Id;
Last_Interrupt_State : Interrupt_State_Id'Base;
-- These point to the first and last entries in the interrupt state
-- table for this unit. If no entries, then Last_Interrupt_State =
-- First_Interrupt_State - 1 (that's why the 'Base reference is there,
-- it can be one less than the lower bound of the subtype). Not set if
-- 'I' appears in Ignore_Lines
First_Specific_Dispatching : Priority_Specific_Dispatching_Id;
Last_Specific_Dispatching : Priority_Specific_Dispatching_Id'Base;
-- These point to the first and last entries in the priority specific
-- dispatching table for this unit. If there are no entries, then
-- Last_Specific_Dispatching = First_Specific_Dispatching - 1. That
-- is why the 'Base reference is there, it can be one less than the
-- lower bound of the subtype. Not set if 'S' appears in Ignore_Lines.
Invocation_Graph_Encoding : Invocation_Graph_Encoding_Kind;
-- The encoding format used to capture information about the invocation
-- constructs and relations within the corresponding ALI file of this
-- unit.
end record;
No_Main_Priority : constant Int := -1;
-- Code for no main priority set
No_Main_CPU : constant Int := -1;
-- Code for no main cpu set
package ALIs is new Table.Table (
Table_Component_Type => ALIs_Record,
Table_Index_Type => ALI_Id,
Table_Low_Bound => First_ALI_Entry,
Table_Initial => 500,
Table_Increment => 200,
Table_Name => "ALIs");
----------------
-- Unit Table --
----------------
-- Each unit within an ALI file generates an entry in the unit table
No_Unit_Id : constant Unit_Id := Unit_Id'First;
-- Special value indicating no unit table entry
First_Unit_Entry : constant Unit_Id := No_Unit_Id + 1;
-- Id of first actual entry in table
type Unit_Type is (Is_Spec, Is_Body, Is_Spec_Only, Is_Body_Only);
-- Indicates type of entry, if both body and spec appear in the ALI file,
-- then the first unit is marked Is_Body, and the second is marked Is_Spec.
-- If only a spec appears, then it is marked as Is_Spec_Only, and if only
-- a body appears, then it is marked Is_Body_Only).
subtype Version_String is String (1 .. 8);
-- Version string, taken from unit record
type Unit_Record is record
My_ALI : ALI_Id;
-- Corresponding ALI entry
Uname : Unit_Name_Type;
-- Name of Unit
Sfile : File_Name_Type;
-- Name of source file
Preelab : Boolean;
-- Indicates presence of PR parameter for a preelaborated package
No_Elab : Boolean;
-- Indicates presence of NE parameter for a unit that has does not
-- have an elaboration routine (since it has no elaboration code).
Pure : Boolean;
-- Indicates presence of PU parameter for a package having pragma Pure
Dynamic_Elab : Boolean;
-- Set to True if the unit was compiled with dynamic elaboration checks
-- (i.e. either -gnatE or pragma Elaboration_Checks (RM) was used to
-- compile the unit).
Elaborate_Body : Boolean;
-- Indicates presence of EB parameter for a package which has a pragma
-- Elaborate_Body, and also for generic package instantiations.
Set_Elab_Entity : Boolean;
-- Indicates presence of EE parameter for a unit which has an
-- elaboration entity which must be set true as part of the
-- elaboration of the unit.
Has_RACW : Boolean;
-- Indicates presence of RA parameter for a package that declares at
-- least one Remote Access to Class_Wide (RACW) object.
Remote_Types : Boolean;
-- Indicates presence of RT parameter for a package which has a
-- pragma Remote_Types.
Serious_Errors : Boolean;
-- Indicates presence of SE parameter indicating that compilation of
-- the unit encountered as serious error.
Shared_Passive : Boolean;
-- Indicates presence of SP parameter for a package which has a pragma
-- Shared_Passive.
RCI : Boolean;
-- Indicates presence of RC parameter for a package which has a pragma
-- Remote_Call_Interface.
Predefined : Boolean;
-- Indicates if unit is language predefined (or a child of such a unit)
Internal : Boolean;
-- Indicates if unit is an internal unit (or a child of such a unit)
First_With : With_Id;
-- Id of first withs table entry for this file
Last_With : With_Id;
-- Id of last withs table entry for this file
First_Arg : Arg_Id;
-- Id of first args table entry for this file
Last_Arg : Arg_Id;
-- Id of last args table entry for this file
First_Invocation_Construct : Invocation_Construct_Id;
-- Id of the first invocation construct for this unit
Last_Invocation_Construct : Invocation_Construct_Id;
-- Id of the last invocation construct for this unit
First_Invocation_Relation : Invocation_Relation_Id;
-- Id of the first invocation relation for this unit
Last_Invocation_Relation : Invocation_Relation_Id;
-- Id of the last invocation relation for this unit
Utype : Unit_Type;
-- Type of entry
Is_Generic : Boolean;
-- True for generic unit (i.e. a generic declaration, or a generic
-- body). False for a non-generic unit.
Unit_Kind : Character;
-- Indicates the nature of the unit. 'p' for Packages and 's' for
-- subprograms.
Version : Version_String;
-- Version of unit
Icasing : Casing_Type;
-- Indicates casing of identifiers in source file for this unit. This
-- is used for informational output, and also for constructing the main
-- unit if it is being built in Ada.
Kcasing : Casing_Type;
-- Indicates casing of keywords in source file for this unit. This is
-- used for informational output, and also for constructing the main
-- unit if it is being built in Ada.
Elab_Position : Nat;
-- Initialized to zero. Set non-zero when a unit is chosen and
-- placed in the elaboration order. The value represents the
-- ordinal position in the elaboration order.
Init_Scalars : Boolean;
-- Set True if IS qualifier appears in ALI file, indicating that
-- an Initialize_Scalars pragma applies to the unit.
SAL_Interface : Boolean;
-- Set True when this is an interface to a standalone library
Directly_Scanned : Boolean;
-- True iff it is a unit from an ALI file specified to gnatbind
Body_Needed_For_SAL : Boolean;
-- Indicates that the source for the body of the unit (subprogram,
-- package, or generic unit) must be included in a standalone library.
Elaborate_Body_Desirable : Boolean;
-- Indicates that the front end elaboration circuitry decided that it
-- would be a good idea if this package had Elaborate_Body. The binder
-- will attempt, but does not promise, to place the elaboration call
-- for the body right after the call for the spec, or at least as close
-- together as possible.
Optimize_Alignment : Character;
-- Optimize_Alignment setting. Set to L/S/T/O for OL/OS/OT/OO present.
Has_Finalizer : Boolean;
-- Indicates whether a package body or a spec has a library-level
-- finalization routine.
Primary_Stack_Count : Int;
-- Indicates the number of task objects declared in this unit that have
-- default sized primary stacks.
Sec_Stack_Count : Int;
-- Indicates the number of task objects declared in this unit that have
-- default sized secondary stacks.
end record;
package Units is new Table.Table (
Table_Component_Type => Unit_Record,
Table_Index_Type => Unit_Id,
Table_Low_Bound => First_Unit_Entry,
Table_Initial => 100,
Table_Increment => 200,
Table_Name => "Unit");
package Unit_Id_Tables is new GNAT.Dynamic_Tables
(Table_Component_Type => Unit_Id,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => 500,
Table_Increment => 200);
subtype Unit_Id_Table is Unit_Id_Tables.Instance;
subtype Unit_Id_Array is Unit_Id_Tables.Table_Type;
---------------------------
-- Interrupt State Table --
---------------------------
-- An entry is made in this table for each I (interrupt state) line
-- encountered in the input ALI file. The First/Last_Interrupt_Id
-- fields of the ALI file entry show the range of entries defined
-- within a particular ALI file.
type Interrupt_State_Record is record
Interrupt_Id : Nat;
-- Id from interrupt state entry
Interrupt_State : Character;
-- State from interrupt state entry ('u'/'r'/'s')
IS_Pragma_Line : Nat;
-- Line number of Interrupt_State pragma
end record;
package Interrupt_States is new Table.Table (
Table_Component_Type => Interrupt_State_Record,
Table_Index_Type => Interrupt_State_Id'Base,
Table_Low_Bound => Interrupt_State_Id'First,
Table_Initial => 100,
Table_Increment => 200,
Table_Name => "Interrupt_States");
-----------------------------------------
-- Priority Specific Dispatching Table --
-----------------------------------------
-- An entry is made in this table for each S (priority specific
-- dispatching) line encountered in the input ALI file. The
-- First/Last_Specific_Dispatching_Id fields of the ALI file
-- entry show the range of entries defined within a particular
-- ALI file.
type Specific_Dispatching_Record is record
Dispatching_Policy : Character;
-- First character (upper case) of the corresponding policy name
First_Priority : Nat;
-- Lower bound of the priority range to which the specified dispatching
-- policy applies.
Last_Priority : Nat;
-- Upper bound of the priority range to which the specified dispatching
-- policy applies.
PSD_Pragma_Line : Nat;
-- Line number of Priority_Specific_Dispatching pragma
end record;
package Specific_Dispatching is new Table.Table (
Table_Component_Type => Specific_Dispatching_Record,
Table_Index_Type => Priority_Specific_Dispatching_Id'Base,
Table_Low_Bound => Priority_Specific_Dispatching_Id'First,
Table_Initial => 100,
Table_Increment => 200,
Table_Name => "Priority_Specific_Dispatching");
--------------
-- Switches --
--------------
-- These switches record status information about ali files that
-- have been read, for quick reference without searching tables.
-- Note: a switch will be left set at its default value if the line
-- which might otherwise set it is ignored (from Ignore_Lines).
Dynamic_Elaboration_Checks_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if Scan_ALI reads
-- a unit for which dynamic elaboration checking is enabled.
Frontend_Exceptions_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file is read that
-- has a P line specifying the generation of front-end exceptions.
GNATprove_Mode_Specified : Boolean := False;
-- Set to True if an ali file was produced in GNATprove mode.
Initialize_Scalars_Used : Boolean := False;
-- Set True if an ali file contains the Initialize_Scalars flag
Locking_Policy_Specified : Character := ' ';
-- Set to blank by Initialize_ALI. Set to the appropriate locking policy
-- character if an ali file contains a P line setting the locking policy.
No_Normalize_Scalars_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file indicates
-- that the file was compiled without normalize scalars.
No_Component_Reordering_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file contains
-- the No_Component_Reordering flag.
No_Object_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file contains
-- the No_Object flag.
Normalize_Scalars_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file indicates
-- that the file was compiled in Normalize_Scalars mode.
Partition_Elaboration_Policy_Specified : Character := ' ';
-- Set to blank by Initialize_ALI. Set to the appropriate partition
-- elaboration policy character if an ali file contains a P line setting
-- the policy.
Queuing_Policy_Specified : Character := ' ';
-- Set to blank by Initialize_ALI. Set to the appropriate queuing policy
-- character if an ali file contains a P line setting the queuing policy.
Cumulative_Restrictions : Restrictions_Info := No_Restrictions;
-- This variable records the cumulative contributions of R lines in all
-- ali files, showing whether a restriction pragma exists anywhere, and
-- accumulating the aggregate knowledge of violations.
SSO_Default_Specified : Boolean := False;
-- Set to True if at least one ALI file contains an OH/OL flag indicating
-- that it was compiled with a configuration pragmas file containing the
-- pragma Default_Scalar_Storage_Order (OH/OL present in ALI file P line).
Stack_Check_Switch_Set : Boolean := False;
-- Set to True if at least one ALI file contains '-fstack-check' in its
-- argument list.
Task_Dispatching_Policy_Specified : Character := ' ';
-- Set to blank by Initialize_ALI. Set to the appropriate task dispatching
-- policy character if an ali file contains a P line setting the
-- task dispatching policy.
Unreserve_All_Interrupts_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file is read that
-- has P line specifying unreserve all interrupts mode.
Zero_Cost_Exceptions_Specified : Boolean := False;
-- Set to False by Initialize_ALI. Set to True if an ali file is read that
-- has a P line specifying the generation of zero cost exceptions.
-----------------
-- Withs Table --
-----------------
-- Each With line (W line) in an ALI file generates a Withs table entry
-- Note: there will be no entries in this table if 'W' lines are ignored
No_With_Id : constant With_Id := With_Id'First;
-- Special value indicating no withs table entry
First_With_Entry : constant With_Id := No_With_Id + 1;
-- Id of first actual entry in table
type With_Record is record
Uname : Unit_Name_Type;
-- Name of Unit
Sfile : File_Name_Type;
-- Name of source file, set to No_File in generic case
Afile : File_Name_Type;
-- Name of ALI file, set to No_File in generic case
Elaborate : Boolean;
-- Indicates presence of E parameter
Elaborate_All : Boolean;
-- Indicates presence of EA parameter
Elab_All_Desirable : Boolean;
-- Indicates presence of AD parameter
Elab_Desirable : Boolean;
-- Indicates presence of ED parameter
SAL_Interface : Boolean := False;
-- True if the Unit is an Interface of a Stand-Alone Library
Implicit_With : Boolean := False;
-- True if this is an implicit with generated by the compiler
Limited_With : Boolean := False;
-- True if this is a limited_with_clause
end record;
package Withs is new Table.Table (
Table_Component_Type => With_Record,
Table_Index_Type => With_Id,
Table_Low_Bound => First_With_Entry,
Table_Initial => 5000,
Table_Increment => 200,
Table_Name => "Withs");
---------------------
-- Arguments Table --
---------------------
-- Each Arg line (A line) in an ALI file generates an Args table entry
-- Note: there will be no entries in this table if 'A' lines are ignored
No_Arg_Id : constant Arg_Id := Arg_Id'First;
-- Special value indicating no args table entry
First_Arg_Entry : constant Arg_Id := No_Arg_Id + 1;
-- Id of first actual entry in table
package Args is new Table.Table (
Table_Component_Type => String_Ptr,
Table_Index_Type => Arg_Id,
Table_Low_Bound => First_Arg_Entry,
Table_Initial => 1000,
Table_Increment => 100,
Table_Name => "Args");
--------------------------
-- Linker_Options Table --
--------------------------
-- If an ALI file has one of more Linker_Options lines, then a single
-- entry is made in this table. If more than one Linker_Options lines
-- appears in a given ALI file, then the arguments are concatenated
-- to form the entry in this table, using a NUL character as the
-- separator, and a final NUL character is appended to the end.
-- Note: there will be no entries in this table if 'L' lines are ignored
type Linker_Option_Record is record
Name : Name_Id;
-- Name entry containing concatenated list of Linker_Options
-- arguments separated by NUL and ended by NUL as described above.
Unit : Unit_Id;
-- Unit_Id for the entry
Internal_File : Boolean;
-- Set True if the linker options are from an internal file. This is
-- used to insert certain standard entries after all the user entries
-- but before the entries from the run-time.
end record;
-- The indexes of active entries in this table range from 1 to the value of
-- Linker_Options.Last. The zeroth element is for convenience if the table
-- needs to be sorted.
package Linker_Options is new Table.Table (
Table_Component_Type => Linker_Option_Record,
Table_Index_Type => Integer,
Table_Low_Bound => 0,
Table_Initial => 200,
Table_Increment => 400,
Table_Name => "Linker_Options");
-----------------
-- Notes Table --
-----------------
-- The notes table records entries from N lines
type Notes_Record is record
Pragma_Type : Character;
-- 'A', 'C', 'I', 'S', 'T' for Annotate/Comment/Ident/Subtitle/Title
Pragma_Line : Nat;
-- Line number of pragma
Pragma_Col : Nat;
-- Column number of pragma
Pragma_Source_File : File_Name_Type;
-- Source file of pragma
Pragma_Args : Name_Id;
-- Pragma arguments. No_Name if no arguments, otherwise a single
-- name table entry consisting of all the characters on the notes
-- line from the first non-blank character following the source
-- location to the last character on the line.
end record;
-- The indexes of active entries in this table range from 1 to the value of
-- Notes.Last. The zeroth element is for convenience if the table needs to
-- be sorted.
package Notes is new Table.Table (
Table_Component_Type => Notes_Record,
Table_Index_Type => Integer,
Table_Low_Bound => 0,
Table_Initial => 200,
Table_Increment => 400,
Table_Name => "Notes");
-------------------------------------------
-- External Version Reference Hash Table --
-------------------------------------------
-- This hash table keeps track of external version reference strings
-- as read from E lines in the ali file. The stored values do not
-- include the terminating quote characters.
-- Note: there will be no entries in this table if 'E' lines are ignored
type Vindex is range 0 .. 98;
-- Type to define range of headers
function SHash (S : String_Ptr) return Vindex;
-- Hash function for this table
function SEq (F1, F2 : String_Ptr) return Boolean;
-- Equality function for this table
package Version_Ref is new Simple_HTable (
Header_Num => Vindex,
Element => Boolean,
No_Element => False,
Key => String_Ptr,
Hash => SHash,
Equal => SEq);
-------------------------
-- No_Dependency Table --
-------------------------
-- Each R line for a No_Dependency Restriction generates an entry in
-- this No_Dependency table.
type No_Dep_Record is record
ALI_File : ALI_Id;
-- ALI File containing the entry
No_Dep_Unit : Name_Id;
-- Id for names table entry including entire name, including periods
end record;
package No_Deps is new Table.Table (
Table_Component_Type => No_Dep_Record,
Table_Index_Type => Integer,
Table_Low_Bound => 0,
Table_Initial => 200,
Table_Increment => 400,
Table_Name => "No_Deps");
------------------------------------
-- Sdep (Source Dependency) Table --
------------------------------------
-- Each source dependency (D line) in an ALI file generates an entry in the
-- Sdep table.
-- Note: there will be no entries in this table if 'D' lines are ignored
No_Sdep_Id : constant Sdep_Id := Sdep_Id'First;
-- Special value indicating no Sdep table entry
First_Sdep_Entry : Sdep_Id := No_Sdep_Id + 1;
-- Id of first Sdep entry for current ali file. This is initialized to the
-- first Sdep entry in the table, and then incremented appropriately as
-- successive ALI files are scanned.
type Sdep_Record is record
Sfile : File_Name_Type;
-- Name of source file
Stamp : Time_Stamp_Type;
-- Time stamp value. Note that this will be all zero characters for the
-- dummy entries for missing or non-dependent files.
Checksum : Word;
-- Checksum value. Note that this will be all zero characters for the
-- dummy entries for missing or non-dependent files
Dummy_Entry : Boolean;
-- Set True for dummy entries that correspond to missing files or files
-- where no dependency relationship exists.
Subunit_Name : Name_Id;
-- Name_Id for subunit name if present, else No_Name
Unit_Name : Name_Id;
-- Name_Id for the unit name if not a subunit (No_Name for a subunit)
Rfile : File_Name_Type;
-- Reference file name. Same as Sfile unless a Source_Reference pragma
-- was used, in which case it reflects the name used in the pragma.
Start_Line : Nat;
-- Starting line number in file. Always 1, unless a Source_Reference
-- pragma was used, in which case it reflects the line number value
-- given in the pragma.
end record;
package Sdep is new Table.Table (
Table_Component_Type => Sdep_Record,
Table_Index_Type => Sdep_Id,
Table_Low_Bound => First_Sdep_Entry,
Table_Initial => 5000,
Table_Increment => 200,
Table_Name => "Sdep");
----------------------------
-- Use of Name Table Info --
----------------------------
-- All unit names and file names are entered into the Names table. The Info
-- fields of these entries are used as follows:
-- Unit name Info field has Unit_Id of unit table entry
-- ALI file name Info field has ALI_Id of ALI table entry
-- Source file name Info field has Source_Id of source table entry
--------------------------
-- Cross-Reference Data --
--------------------------
-- The following table records cross-reference sections, there is one entry
-- for each X header line in the ALI file for an xref section.
-- Note: there will be no entries in this table if 'X' lines are ignored
type Xref_Section_Record is record
File_Num : Sdep_Id;
-- Dependency number for file (entry in Sdep.Table)
File_Name : File_Name_Type;
-- Name of file
First_Entity : Nat;
-- First entry in Xref_Entity table
Last_Entity : Nat;
-- Last entry in Xref_Entity table
end record;
package Xref_Section is new Table.Table (
Table_Component_Type => Xref_Section_Record,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 300,
Table_Name => "Xref_Section");
-- The following is used to indicate whether a typeref field is present
-- for the entity, and if so what kind of typeref field.
type Tref_Kind is (
Tref_None, -- No typeref present
Tref_Access, -- Access type typeref (points to designated type)
Tref_Derived, -- Derived type typeref (points to parent type)
Tref_Type); -- All other cases
type Visibility_Kind is
(Global, -- Library level entity
Static, -- Static C/C++ entity
Other); -- Local and other entity
-- The following table records entities for which xrefs are recorded
type Xref_Entity_Record is record
Line : Pos;
-- Line number of definition
Etype : Character;
-- Set to the identification character for the entity. See section
-- "Cross-Reference Entity Identifiers" in lib-xref.ads for details.
Col : Pos;
-- Column number of definition
Visibility : Visibility_Kind;
-- Visibility of entity
Entity : Name_Id;
-- Name of entity
Iref_File_Num : Sdep_Id;
-- This field is set to the dependency reference for the file containing
-- the generic entity that this one instantiates, or to No_Sdep_Id if
-- the current entity is not an instantiation
Iref_Line : Nat;
-- This field is set to the line number in Iref_File_Num of the generic
-- entity that this one instantiates, or to zero if the current entity
-- is not an instantiation.
Rref_Line : Nat;
-- This field is set to the line number of a renaming reference if
-- one is present, or to zero if no renaming reference is present
Rref_Col : Nat;
-- This field is set to the column number of a renaming reference
-- if one is present, or to zero if no renaming reference is present.
Tref : Tref_Kind;
-- Indicates if a typeref is present, and if so what kind. Set to
-- Tref_None if no typeref field is present.
Tref_File_Num : Sdep_Id;
-- This field is set to No_Sdep_Id if no typeref is present, or
-- if the typeref refers to an entity in standard. Otherwise it
-- it is the dependency reference for the file containing the
-- declaration of the typeref entity.
Tref_Line : Nat;
-- This field is set to zero if no typeref is present, or if the
-- typeref refers to an entity in standard. Otherwise it contains
-- the line number of the declaration of the typeref entity.
Tref_Type : Character;
-- This field is set to blank if no typeref is present, or if the
-- typeref refers to an entity in standard. Otherwise it contains
-- the identification character for the typeref entity. See section
-- "Cross-Reference Entity Identifiers" in lib-xref.ads for details.
Tref_Col : Nat;
-- This field is set to zero if no typeref is present, or if the
-- typeref refers to an entity in standard. Otherwise it contains
-- the column number of the declaration of the parent type.
Tref_Standard_Entity : Name_Id;
-- This field is set to No_Name if no typeref is present or if the
-- typeref refers to a declared entity rather than an entity in
-- package Standard. If there is a typeref that references an
-- entity in package Standard, then this field is a Name_Id
-- reference for the entity name.
Oref_File_Num : Sdep_Id;
-- This field is set to No_Sdep_Id if the entity doesn't override any
-- other entity, or to the dependency reference for the overridden
-- entity.
Oref_Line : Nat;
Oref_Col : Nat;
-- These two fields are set to the line and column of the overridden
-- entity.
First_Xref : Nat;
-- Index into Xref table of first cross-reference
Last_Xref : Nat;
-- Index into Xref table of last cross-reference. The value in
-- Last_Xref can be less than the First_Xref value to indicate
-- that no entries are present in the Xref Table.
end record;
package Xref_Entity is new Table.Table (
Table_Component_Type => Xref_Entity_Record,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => 500,
Table_Increment => 300,
Table_Name => "Xref_Entity");
Array_Index_Reference : constant Character := '*';
Interface_Reference : constant Character := 'I';
-- Some special types of references. In the ALI file itself, these
-- are output as attributes of the entity, not as references, but
-- there is no provision in Xref_Entity_Record for storing multiple
-- such references.
-- The following table records actual cross-references
type Xref_Record is record
File_Num : Sdep_Id;
-- Set to the file dependency number for the cross-reference. Note
-- that if no file entry is present explicitly, this is just a copy
-- of the reference for the current cross-reference section.
Line : Nat;
-- Line number for the reference. This is zero when referencing a
-- predefined entity, but in this case Name is set.
Rtype : Character;
-- Indicates type of reference, using code used in ALI file:
-- r = reference
-- m = modification
-- b = body entity
-- c = completion of private or incomplete type
-- x = type extension
-- i = implicit reference
-- Array_Index_Reference = reference to the index of an array
-- Interface_Reference = reference to an interface implemented
-- by the type
-- See description in lib-xref.ads for further details
Col : Nat;
-- Column number for the reference
Name : Name_Id := No_Name;
-- This is only used when referencing a predefined entity. Currently,
-- this only occurs for array indexes.
-- Note: for instantiation references, Rtype is set to ' ', and Col is
-- set to zero. One or more such entries can follow any other reference.
-- When there is more than one such entry, this is to be read as:
-- e.g. ref1 ref2 ref3
-- ref1 is a reference to an entity that was instantied at ref2.
-- ref2 itself is also the result of an instantiation, that took
-- place at ref3
Imported_Lang : Name_Id := No_Name;
Imported_Name : Name_Id := No_Name;
-- Language and name of imported entity reference
end record;
package Xref is new Table.Table (
Table_Component_Type => Xref_Record,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => 2000,
Table_Increment => 300,
Table_Name => "Xref");
----------------------------
-- Invocation Graph Types --
----------------------------
-- The following type identifies an invocation construct
No_Invocation_Construct : constant Invocation_Construct_Id :=
Invocation_Construct_Id'First;
First_Invocation_Construct : constant Invocation_Construct_Id :=
No_Invocation_Construct + 1;
-- The following type identifies an invocation relation
No_Invocation_Relation : constant Invocation_Relation_Id :=
Invocation_Relation_Id'First;
First_Invocation_Relation : constant Invocation_Relation_Id :=
No_Invocation_Relation + 1;
-- The following type identifies an invocation signature
No_Invocation_Signature : constant Invocation_Signature_Id :=
Invocation_Signature_Id'First;
First_Invocation_Signature : constant Invocation_Signature_Id :=
No_Invocation_Signature + 1;
-- The following type enumerates all possible placements of an invocation
-- construct's spec and body with respect to the unit it is declared in.
type Declaration_Placement_Kind is
(In_Body,
-- The declaration of the invocation construct is within the body of the
-- unit it is declared in.
In_Spec,
-- The declaration of the invocation construct is within the spec of the
-- unit it is declared in.
No_Declaration_Placement);
-- The invocation construct does not have a declaration
-- The following type enumerates all possible invocation construct kinds
type Invocation_Construct_Kind is
(Elaborate_Body_Procedure,
-- The invocation construct denotes the procedure which elaborates a
-- package body.
Elaborate_Spec_Procedure,
-- The invocation construct denotes the procedure which elaborates a
-- package spec.
Regular_Construct);
-- The invocation construct is a normal invocation construct
-- The following type enumerates all possible invocation kinds
type Invocation_Kind is
(Accept_Alternative,
Access_Taken,
Call,
Controlled_Adjustment,
Controlled_Finalization,
Controlled_Initialization,
Default_Initial_Condition_Verification,
Initial_Condition_Verification,
Instantiation,
Internal_Controlled_Adjustment,
Internal_Controlled_Finalization,
Internal_Controlled_Initialization,
Invariant_Verification,
Postcondition_Verification,
Protected_Entry_Call,
Protected_Subprogram_Call,
Task_Activation,
Task_Entry_Call,
Type_Initialization,
No_Invocation);
subtype Internal_Controlled_Invocation_Kind is Invocation_Kind range
Internal_Controlled_Adjustment ..
-- Internal_Controlled_Finalization
Internal_Controlled_Initialization;
-- The following type enumerates all possible invocation-graph ALI lines
type Invocation_Graph_Line_Kind is
(Invocation_Construct_Line,
Invocation_Graph_Attributes_Line,
Invocation_Relation_Line);
----------------------------------
-- Invocation Graph Subprograms --
----------------------------------
procedure Add_Invocation_Construct
(Body_Placement : Declaration_Placement_Kind;
Kind : Invocation_Construct_Kind;
Signature : Invocation_Signature_Id;
Spec_Placement : Declaration_Placement_Kind;
Update_Units : Boolean := True);
pragma Inline (Add_Invocation_Construct);
-- Add a new invocation construct described by its attributes. Update_Units
-- should be set when this addition must be reflected in the attributes of
-- the current unit.
procedure Add_Invocation_Relation
(Extra : Name_Id;
Invoker : Invocation_Signature_Id;
Kind : Invocation_Kind;
Target : Invocation_Signature_Id;
Update_Units : Boolean := True);
pragma Inline (Add_Invocation_Relation);
-- Add a new invocation relation described by its attributes. Update_Units
-- should be set when this addition must be reflected in the attributes of
-- the current unit.
function Body_Placement
(IC_Id : Invocation_Construct_Id) return Declaration_Placement_Kind;
pragma Inline (Body_Placement);
-- Obtain the location of invocation construct IC_Id's body with respect to
-- the unit where it is declared.
function Code_To_Declaration_Placement_Kind
(Code : Character) return Declaration_Placement_Kind;
pragma Inline (Code_To_Declaration_Placement_Kind);
-- Obtain the declaration placement kind of character encoding Code
function Code_To_Invocation_Construct_Kind
(Code : Character) return Invocation_Construct_Kind;
pragma Inline (Code_To_Invocation_Construct_Kind);
-- Obtain the invocation construct kind of character encoding Code
function Code_To_Invocation_Graph_Encoding_Kind
(Code : Character) return Invocation_Graph_Encoding_Kind;
pragma Inline (Code_To_Invocation_Graph_Encoding_Kind);
-- Obtain the invocation-graph encoding kind of character encoding Code
function Code_To_Invocation_Kind
(Code : Character) return Invocation_Kind;
pragma Inline (Code_To_Invocation_Kind);
-- Obtain the invocation kind of character encoding Code
function Code_To_Invocation_Graph_Line_Kind
(Code : Character) return Invocation_Graph_Line_Kind;
pragma Inline (Code_To_Invocation_Graph_Line_Kind);
-- Obtain the invocation-graph line kind of character encoding Code
function Column (IS_Id : Invocation_Signature_Id) return Nat;
pragma Inline (Column);
-- Obtain the column number of invocation signature IS_Id
function Declaration_Placement_Kind_To_Code
(Kind : Declaration_Placement_Kind) return Character;
pragma Inline (Declaration_Placement_Kind_To_Code);
-- Obtain the character encoding of declaration placement kind Kind
function Extra (IR_Id : Invocation_Relation_Id) return Name_Id;
pragma Inline (Extra);
-- Obtain the name of the additional entity used in error diagnostics for
-- invocation relation IR_Id.
type Invocation_Construct_Processor_Ptr is
access procedure (IC_Id : Invocation_Construct_Id);
procedure For_Each_Invocation_Construct
(Processor : Invocation_Construct_Processor_Ptr);
pragma Inline (For_Each_Invocation_Construct);
-- Invoke Processor on each invocation construct
procedure For_Each_Invocation_Construct
(U_Id : Unit_Id;
Processor : Invocation_Construct_Processor_Ptr);
pragma Inline (For_Each_Invocation_Construct);
-- Invoke Processor on each invocation construct of unit U_Id
type Invocation_Relation_Processor_Ptr is
access procedure (IR_Id : Invocation_Relation_Id);
procedure For_Each_Invocation_Relation
(Processor : Invocation_Relation_Processor_Ptr);
pragma Inline (For_Each_Invocation_Relation);
-- Invoke Processor on each invocation relation
procedure For_Each_Invocation_Relation
(U_Id : Unit_Id;
Processor : Invocation_Relation_Processor_Ptr);
pragma Inline (For_Each_Invocation_Relation);
-- Invoke Processor on each invocation relation of unit U_Id
function Invocation_Construct_Kind_To_Code
(Kind : Invocation_Construct_Kind) return Character;
pragma Inline (Invocation_Construct_Kind_To_Code);
-- Obtain the character encoding of invocation kind Kind
function Invocation_Graph_Encoding return Invocation_Graph_Encoding_Kind;
pragma Inline (Invocation_Graph_Encoding);
-- Obtain the encoding format used to capture information about the
-- invocation constructs and relations within the ALI file of the main
-- unit.
function Invocation_Graph_Encoding_Kind_To_Code
(Kind : Invocation_Graph_Encoding_Kind) return Character;
pragma Inline (Invocation_Graph_Encoding_Kind_To_Code);
-- Obtain the character encoding for invocation-graph encoding kind Kind
function Invocation_Graph_Line_Kind_To_Code
(Kind : Invocation_Graph_Line_Kind) return Character;
pragma Inline (Invocation_Graph_Line_Kind_To_Code);
-- Obtain the character encoding for invocation line kind Kind
function Invocation_Kind_To_Code
(Kind : Invocation_Kind) return Character;
pragma Inline (Invocation_Kind_To_Code);
-- Obtain the character encoding of invocation kind Kind
function Invocation_Signature_Of
(Column : Nat;
Line : Nat;
Locations : Name_Id;
Name : Name_Id;
Scope : Name_Id) return Invocation_Signature_Id;
pragma Inline (Invocation_Signature_Of);
-- Obtain the invocation signature that corresponds to the input attributes
function Invoker
(IR_Id : Invocation_Relation_Id) return Invocation_Signature_Id;
pragma Inline (Invoker);
-- Obtain the signature of the invocation relation IR_Id's invoker
function Kind
(IC_Id : Invocation_Construct_Id) return Invocation_Construct_Kind;
pragma Inline (Kind);
-- Obtain the nature of invocation construct IC_Id
function Kind
(IR_Id : Invocation_Relation_Id) return Invocation_Kind;
pragma Inline (Kind);
-- Obtain the nature of invocation relation IR_Id
function Line (IS_Id : Invocation_Signature_Id) return Nat;
pragma Inline (Line);
-- Obtain the line number of invocation signature IS_Id
function Locations (IS_Id : Invocation_Signature_Id) return Name_Id;
pragma Inline (Locations);
-- Obtain the sequence of column and line numbers within nested instances
-- of invocation signature IS_Id
function Name (IS_Id : Invocation_Signature_Id) return Name_Id;
pragma Inline (Name);
-- Obtain the name of invocation signature IS_Id
function IS_Scope (IS_Id : Invocation_Signature_Id) return Name_Id;
pragma Inline (IS_Scope);
-- Obtain the scope of invocation signature IS_Id
procedure Set_Invocation_Graph_Encoding
(Kind : Invocation_Graph_Encoding_Kind;
Update_Units : Boolean := True);
pragma Inline (Set_Invocation_Graph_Encoding);
-- Set the encoding format used to capture information about the invocation
-- constructs and relations within the ALI file of the main unit to Kind.
-- Update_Units should be set when this action must be reflected in the
-- attributes of the current unit.
function Signature
(IC_Id : Invocation_Construct_Id) return Invocation_Signature_Id;
pragma Inline (Signature);
-- Obtain the signature of invocation construct IC_Id
function Spec_Placement
(IC_Id : Invocation_Construct_Id) return Declaration_Placement_Kind;
pragma Inline (Spec_Placement);
-- Obtain the location of invocation construct IC_Id's spec with respect to
-- the unit where it is declared.
function Target
(IR_Id : Invocation_Relation_Id) return Invocation_Signature_Id;
pragma Inline (Target);
-- Obtain the signature of the invocation relation IR_Id's target
--------------------------------------
-- Subprograms for Reading ALI File --
--------------------------------------
procedure Initialize_ALI;
-- Initialize the ALI tables. Also resets all switch values to defaults
function Scan_ALI
(F : File_Name_Type;
T : Text_Buffer_Ptr;
Err : Boolean;
Ignore_Lines : String := "X";
Ignore_Errors : Boolean := False;
Directly_Scanned : Boolean := False) return ALI_Id;
-- Given the text, T, of an ALI file, F, scan and store the information
-- from the file, and return the Id of the resulting entry in the ALI
-- table. Switch settings may be modified as described above in the
-- switch description settings.
--
-- Err determines the action taken on an incorrectly formatted file.
-- If Err is False, then an error message is output, and the program
-- is terminated. If Err is True, then no error message is output,
-- and No_ALI_Id is returned.
--
-- Ignore_Lines requests that Scan_ALI ignore any lines that start
-- with any given key character. The default value of X causes all
-- Xref lines to be ignored. The corresponding data in the ALI
-- tables will not be filled in this case. It is not possible
-- to ignore U (unit) lines, they are always read.
--
-- Ignore_Errors is normally False. If it is set True, then Scan_ALI
-- will do its best to scan through a file and extract all information
-- it can, even if there are errors. In this case Err is only set if
-- Scan_ALI was completely unable to process the file (e.g. it did not
-- look like an ALI file at all). Ignore_Errors is intended to improve
-- the downward compatibility of new compilers with old tools.
--
-- Directly_Scanned is normally False. If it is set to True, then the
-- units (spec and/or body) corresponding to the ALI file are marked as
-- such. It is used to decide for what units gnatbind should generate
-- the symbols corresponding to 'Version or 'Body_Version in
-- Stand-Alone Libraries.
end ALI;
|
melwyncarlo/ProjectEuler | Ada | 1,160 | adb | with Ada.Integer_Text_IO;
with Ada.Numerics.Long_Elementary_Functions;
-- Copyright 2021 Melwyn Francis Carlo
procedure A002 is
use Ada.Integer_Text_IO;
use Ada.Numerics.Long_Elementary_Functions;
----------------------------------------------------------------------------
function Binets_Formula (N_Val : in Integer) return Long_Float;
function Binets_Formula (N_Val : in Integer) return Long_Float is
begin
return (1.0 / Sqrt (5.0)) * ((((1.0 + Sqrt (5.0)) / 2.0) ** N_Val)
- (((1.0 - Sqrt (5.0)) / 2.0) ** N_Val));
end Binets_Formula;
----------------------------------------------------------------------------
N : Integer;
Fn_Sum, Fn_Sum_Even : Long_Float;
Fn_Max : constant Long_Float := 4.0E+6;
----------------------------------------------------------------------------
begin
N := Integer (Log ((Fn_Max * Sqrt (5.0)) + 0.5)
/ Log ((1.0 + Sqrt (5.0)) / 2.0));
Fn_Sum := Binets_Formula (N + 2) - 1.0;
Fn_Sum_Even := Fn_Sum / 2.0;
Put (Integer (Fn_Sum_Even), Width => 0);
end A002;
|
thieryw/snake | Ada | 2,013 | adb | with ada.text_io,ada.integer_text_io,nt_console ;
use ada.text_io ;
package body display is
procedure render(screen : grid) is
--Clear screen character for UNIX
procedure clear_screen is
begin
ada.text_io.put(ASCII.ESC & "[2J") ;
end clear_screen ;
screen_buffer : string(1..((screen'length(1) + 2) * (screen'length(2) + 2) + (screen'length(1) + 2))) ;
buffer_index : integer := 1 ;
begin
for i in screen'first(1)-1..screen'last(1)+1 loop
for j in screen'first(2)-1..screen'last(2)+1 loop
if
i = screen'first(1)-1
or
j = screen'first(2)-1
or
i = screen'last(1)+1
or
j = screen'last(2)+1
then
screen_buffer(buffer_index) := ('#') ;
else
if screen(i,j) = true then
screen_buffer(buffer_index) := ('#') ;
else
screen_buffer(buffer_index) := (' ') ;
end if ;
end if ;
buffer_index := buffer_index + 1 ;
end loop ;
screen_buffer(buffer_index) := character'val(10) ;
buffer_index := buffer_index+1 ;
end loop ;
nt_console.clear_screen ;
put(screen_buffer) ;
end render ;
end display ;
|
reznikmm/matreshka | Ada | 1,660 | ads | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- This software was developed by John Self of the Arcadia project
-- at the University of California, Irvine.
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- TITLE equivalence class
-- AUTHOR: John Self (UCI)
-- DESCRIPTION finds equivalence classes so DFA will be smaller
-- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/ecsS.a,v 1.4 90/01/12 15:19:57 self Exp Locker: self $
with MISC_DEFS; use MISC_DEFS;
package ECS is
procedure CCL2ECL;
procedure CRE8ECS(FWD : C_SIZE_ARRAY;
BCK : in out C_SIZE_ARRAY;
NUM : INTEGER;
RESULT : out INTEGER);
procedure MKECCL
(CCLS : Unicode_Character_Array;
LENCCL : Integer;
FWD, BCK : in out UNBOUNDED_INT_ARRAY;
LLSIZ : Integer);
procedure MKECHAR(TCH : in INTEGER;
FWD, BCK : in out C_SIZE_ARRAY);
end ECS;
|
MinimSecure/unum-sdk | Ada | 787 | adb | -- Copyright 2011-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
begin
Dummy_Task.Start;
end Foo;
|
charlie5/cBound | Ada | 1,461 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_render_glyph_iterator_t is
-- Item
--
type Item is record
data : access xcb.xcb_render_glyph_t;
the_rem : aliased Interfaces.C.int;
index : aliased Interfaces.C.int;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_render_glyph_iterator_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_glyph_iterator_t.Item,
Element_Array => xcb.xcb_render_glyph_iterator_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_render_glyph_iterator_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_glyph_iterator_t.Pointer,
Element_Array => xcb.xcb_render_glyph_iterator_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_render_glyph_iterator_t;
|
Fabien-Chouteau/pygamer-simulator | Ada | 570 | ads | private with sf.Graphics;
private with sf.Graphics.Image;
private with Sf;
private with HAL;
package PyGamer is
pragma Elaborate_Body;
private
Screen_Width : constant := 160;
Screen_Height : constant := 128;
Frame_Buffer : array (0 .. (Screen_Width * Screen_Height * 4) - 1) of
aliased Sf.sfUInt8
:= (others => 127);
Scroll_Val : HAL.UInt8 := 0;
type SFML_Keys is (A, B, Left, Right, Up, Down, Sel, Start);
SFML_Pressed : array (SFML_Keys) of Boolean := (others => False);
pragma Volatile_Components (SFML_Pressed);
end PyGamer;
|
zhmu/ananas | Ada | 5,852 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- B I N D O . W R I T E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2019-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- For full architecture, see unit Bindo.
-- The following unit contains facilities to output the various graphs used in
-- determining the elaboration order, as well as the elaboration order itself
-- to standard output.
with Types; use Types;
with Bindo.Graphs;
use Bindo.Graphs;
use Bindo.Graphs.Invocation_Graphs;
use Bindo.Graphs.Library_Graphs;
package Bindo.Writers is
-----------------
-- Indentation --
-----------------
-- The following type defines the level of indentation used in various
-- output routines.
type Indentation_Level is new Natural;
No_Indentation : constant Indentation_Level := Indentation_Level'First;
Nested_Indentation : constant Indentation_Level := 2;
-- The level of indentation for a nested new line
Number_Column : constant Indentation_Level := 6;
-- The level of right justification of numbers
Step_Column : constant Indentation_Level := 4;
-- The level of right justification of the elaboration order step
procedure Indent_By (Indent : Indentation_Level);
pragma Inline (Indent_By);
-- Indent the current line by Indent spaces
procedure Write_Num
(Val : Int;
Val_Indent : Indentation_Level := Number_Column);
pragma Inline (Write_Num);
-- Output integer value Val in a right-justified form based on the value of
-- Val_Col.
-----------------
-- ALI_Writers --
-----------------
package ALI_Writers is
procedure Write_ALI_Tables;
-- Write the contents of the following tables to standard output:
--
-- * ALI.Invocation_Constructs
-- * ALI.Invocation_Relations
end ALI_Writers;
-------------------
-- Cycle_Writers --
-------------------
package Cycle_Writers is
procedure Write_Cycles (G : Library_Graph);
-- Write all cycles of library graph G to standard output
end Cycle_Writers;
------------------------
-- Dependency_Writers --
------------------------
package Dependency_Writers is
procedure Write_Dependencies (G : Library_Graph);
-- Write all elaboration dependencies of the units represented by
-- vertices of library graph G.
end Dependency_Writers;
-------------------------------
-- Elaboration_Order_Writers --
-------------------------------
package Elaboration_Order_Writers is
procedure Write_Elaboration_Order (Order : Unit_Id_Table);
-- Write elaboration order Order to standard output
end Elaboration_Order_Writers;
------------------------------
-- Invocation_Graph_Writers --
------------------------------
package Invocation_Graph_Writers is
procedure Write_Invocation_Graph (G : Invocation_Graph);
-- Write invocation graph G to standard output
end Invocation_Graph_Writers;
---------------------------
-- Library_Graph_Writers --
---------------------------
package Library_Graph_Writers is
procedure Write_Library_Graph (G : Library_Graph);
-- Write library graph G to standard output
end Library_Graph_Writers;
-------------------
-- Phase_Writers --
-------------------
package Phase_Writers is
procedure End_Phase (Phase : Elaboration_Phase);
pragma Inline (End_Phase);
-- Write the end message associated with elaboration phase Phase to
-- standard output.
procedure Start_Phase (Phase : Elaboration_Phase);
pragma Inline (Start_Phase);
-- Write the start message associated with elaboration phase Phase to
-- standard output.
end Phase_Writers;
--------------------------
-- Unit_Closure_Writers --
--------------------------
package Unit_Closure_Writers is
procedure Write_Unit_Closure (Order : Unit_Id_Table);
-- Write all sources in the closure of the main unit as enumerated in
-- elaboration order Order.
end Unit_Closure_Writers;
end Bindo.Writers;
|
Hamster-Furtif/JeremyPlusPlus | Ada | 3,584 | adb | with Ada.Numerics.Discrete_Random, utils;
use utils;
with botIO; use botIO;
package body montecarlo is
package Rand_Int is new Ada.Numerics.Discrete_Random(Positive);
gen : Rand_Int.Generator;
function initSample(sample : in out T_set; hand : in T_set; table : in T_set) return Integer is
c : T_card;
size : Integer :=0;
begin
size := 2 + 5 - get_size(table);
emptySet(sample);
for i in 1..size loop
loop
c := randomCard(52);
exit when not cardInSet(c, sample+hand+table);
end loop;
addToSet(c, sample);
end loop;
return size;
end initSample;
function randomCard(max : in Integer) return T_card is
nb : Integer;
card : T_card;
begin
Rand_Int.Reset(gen);
nb := Rand_Int.Random(gen) mod max;
set_rank(card, nb mod 13);
set_colour(card, T_colour'Val(1+(nb - nb mod 13)/13));
return card;
end randomCard;
function chancesOfWinning(hand : T_set; table : T_set) return float is
sample_size : Integer :=0;
complementary_set : T_Set; -- Composé de 2 + (5-x) cartes, avec x le nombre de cartes dans T_set.
set_enemy : T_set;
set_jeremy : T_set;
complementary_table_set : T_set;
best_enemy : T_combination; -- La meilleure combinaison de la table, et de la main générée de l'ennemi.
best_jeremy : T_combination; -- La meilleure combinaison de la table et notre main.
wins : Float := 0.0; -- Compteur de victoires.
begin
for i in 1..30000 loop
sample_size := initSample(complementary_set,hand,table);
emptySet(complementary_table_set);
emptySet(set_enemy);
emptySet(set_jeremy);
--if i<50 then Put_Line("SAMPLE SIZE :"&Integer'Image(sample_size)&", TABLE_SIZE:"&Integer'Image(get_size(table)));end if;
if sample_size>0 then
for i in 1..(8-sample_size) loop
addToSet(get_card(complementary_set,i-1), complementary_table_set);
end loop;
end if;
set_enemy := set_enemy + table; -- On rajoute la table au set de l'ennemi.
set_enemy := set_enemy + complementary_set; -- On rajoute les cartes générées aléatoirement au set de l'ennemi.
set_jeremy := set_jeremy + table;
set_jeremy := set_jeremy + hand;
set_jeremy := set_jeremy + complementary_table_set;
best_enemy:=getBestCombination(set_enemy);
best_jeremy:=getBestCombination(set_jeremy);
if(best_jeremy > best_enemy) then
wins := wins +1.0;
end if;
if i<50 and FALSE then
Put_Line("------------------------------");Put_Line("Taille Jeremy :"&Integer'Image(get_size(set_jeremy))&", taille ennemy :"&Integer'Image(get_size(set_enemy)));
Put_Line("Combinaison Jeremy :");
for i in 1..get_size(set_jeremy) loop
printCard(get_card(set_jeremy,i-1));
end loop;
Put_Line("VS ....");
Put_Line("Combinaison Enemy :");
for i in 1..get_size(set_enemy) loop
printCard(get_card(set_enemy,i-1));
end loop;
Put_Line("RESULT : "&T_combination_type'Image(getBestCombination(set_jeremy).comb_type)&"vs"&T_combination_type'Image(getBestCombination(set_enemy).comb_type)&Boolean'Image(getBestCombination(set_jeremy)>getBestCombination(set_enemy)));
end if;
end loop;
return wins/50000.0;
end chancesOfWinning;
end montecarlo;
|
databuzzword/ai-api-marketplace | Ada | 2,479 | adb | -- FastAPI
-- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
--
-- The version of the OpenAPI document: 0.1.0
--
--
-- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0.
-- https://openapi-generator.tech
-- Do not edit the class manually.
with Swagger.Streams;
package body .Clients is
-- Read Users
procedure Read_Users_Image_Image_Uncolorization_Users_Get
(Client : in out Client_Type;
Result : out Swagger.Object) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/image/image/uncolorization/users/");
Client.Call (Swagger.Clients.GET, URI, Reply);
.Models.Deserialize (Reply, "", Result);
end Read_Users_Image_Image_Uncolorization_Users_Get;
-- Root
procedure Root_Get
(Client : in out Client_Type;
Result : out Swagger.Object) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/");
Client.Call (Swagger.Clients.GET, URI, Reply);
.Models.Deserialize (Reply, "", Result);
end Root_Get;
-- Read User
procedure Read_User_Image_Image_Uncolorization_Users_Username_Post
(Client : in out Client_Type;
Username : in Swagger.UString;
Result : out Swagger.Object) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/image/image/uncolorization/users/{username}");
URI.Set_Path_Param ("username", Username);
Client.Call (Swagger.Clients.POST, URI, Reply);
.Models.Deserialize (Reply, "", Result);
end Read_User_Image_Image_Uncolorization_Users_Username_Post;
-- Read User Me
procedure Read_User_Me_Image_Image_Uncolorization_Users_Me_Get
(Client : in out Client_Type;
Result : out Swagger.Object) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/image/image/uncolorization/users/me");
Client.Call (Swagger.Clients.GET, URI, Reply);
.Models.Deserialize (Reply, "", Result);
end Read_User_Me_Image_Image_Uncolorization_Users_Me_Get;
end .Clients;
|
reznikmm/matreshka | Ada | 3,930 | 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.Boolean_Collections.Internals is
---------------
-- To_Holder --
---------------
function To_Holder
(Item : Collection_Of_Boolean'Class) return League.Holders.Holder is
begin
raise Program_Error with "Not yet implemented";
return League.Holders.Empty_Holder;
end To_Holder;
----------
-- Wrap --
----------
function Wrap
(Collection : AMF.Internals.AMF_Collection_Of_Boolean)
return Collection_Of_Boolean is
begin
return X : Collection_Of_Boolean;
end Wrap;
end AMF.Boolean_Collections.Internals;
|
FredPraca/distributed_cbsg | Ada | 886 | adb | with Interfaces; use Interfaces;
package body CorbaCBSG_CBSG_Hash is
P : constant array (0 .. 1) of Natural :=
(4, 10);
T1 : constant array (0 .. 1) of Unsigned_8 :=
(7, 6);
T2 : constant array (0 .. 1) of Unsigned_8 :=
(2, 19);
G : constant array (0 .. 20) of Unsigned_8 :=
(4, 0, 0, 7, 0, 0, 0, 0, 1, 3, 1, 3, 0, 0, 5, 0, 0, 5, 0, 2, 0);
function Hash (S : String) return Natural is
F : constant Natural := S'First - 1;
L : constant Natural := S'Length;
F1, F2 : Natural := 0;
J : Natural;
begin
for K in P'Range loop
exit when L < P (K);
J := Character'Pos (S (P (K) + F));
F1 := (F1 + Natural (T1 (K)) * J) mod 21;
F2 := (F2 + Natural (T2 (K)) * J) mod 21;
end loop;
return (Natural (G (F1)) + Natural (G (F2))) mod 10;
end Hash;
end CorbaCBSG_CBSG_Hash;
|
tum-ei-rcs/StratoX | Ada | 2,896 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . F A T _ F L T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains an instantiation of the floating-point attribute
-- runtime routines for the type Float.
with System.Fat_Gen;
package System.Fat_Flt is
pragma Pure;
-- Note the only entity from this package that is accessed by Rtsfind
-- is the name of the package instantiation. Entities within this package
-- (i.e. the individual floating-point attribute routines) are accessed
-- by name using selected notation.
package Attr_Float is new System.Fat_Gen (Float);
end System.Fat_Flt;
|
persan/A-gst | Ada | 18,468 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h;
with glib;
with glib.Values;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstadapter_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideodecoder_h is
-- unsupported macro: GST_TYPE_BASE_VIDEO_DECODER (gst_base_video_decoder_get_type())
-- arg-macro: function GST_BASE_VIDEO_DECODER (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoder);
-- arg-macro: function GST_BASE_VIDEO_DECODER_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass);
-- arg-macro: function GST_BASE_VIDEO_DECODER_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass);
-- arg-macro: function GST_IS_BASE_VIDEO_DECODER (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_DECODER);
-- arg-macro: function GST_IS_BASE_VIDEO_DECODER_CLASS (obj)
-- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_DECODER);
GST_BASE_VIDEO_DECODER_SINK_NAME : aliased constant String := "sink" & ASCII.NUL; -- gst/video/gstbasevideodecoder.h:53
GST_BASE_VIDEO_DECODER_SRC_NAME : aliased constant String := "src" & ASCII.NUL; -- gst/video/gstbasevideodecoder.h:59
-- unsupported macro: GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS
-- unsupported macro: GST_BASE_VIDEO_DECODER_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS_1
-- unsupported macro: GST_BASE_AUDIO_DECODER_ERROR(el,w,domain,code,text,debug,ret) G_STMT_START { gchar *__txt = _gst_element_error_printf text; gchar *__dbg = _gst_element_error_printf debug; GstBaseVideoDecoder *dec = GST_BASE_VIDEO_DECODER (el); ret = _gst_base_video_decoder_error (dec, w, GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); } G_STMT_END
-- GStreamer
-- * Copyright (C) 2008 David Schleef <[email protected]>
-- * Copyright (C) 2011 Mark Nauwelaerts <[email protected]>.
-- * Copyright (C) 2011 Nokia Corporation. All rights reserved.
-- * Contact: Stefan Kost <[email protected]>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
--*
-- * GST_BASE_VIDEO_DECODER_SINK_NAME:
-- *
-- * The name of the templates for the sink pad.
--
--*
-- * GST_BASE_VIDEO_DECODER_SRC_NAME:
-- *
-- * The name of the templates for the source pad.
--
--*
-- * GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA:
-- *
-- * Returned while parsing to indicate more data is needed.
-- *
--*
-- * GST_BASE_VIDEO_DECODER_FLOW_DROPPED:
-- *
-- * Returned when the event/buffer should be dropped.
--
type GstBaseVideoDecoder;
type u_GstBaseVideoDecoder_padding_array is array (0 .. 19) of System.Address;
--subtype GstBaseVideoDecoder is u_GstBaseVideoDecoder; -- gst/video/gstbasevideodecoder.h:75
type GstBaseVideoDecoderClass;
type u_GstBaseVideoDecoderClass_padding_array is array (0 .. 19) of System.Address;
--subtype GstBaseVideoDecoderClass is u_GstBaseVideoDecoderClass; -- gst/video/gstbasevideodecoder.h:76
-- do not use this one, use macro below
-- skipped func _gst_base_video_decoder_error
--*
-- * GST_BASE_VIDEO_DECODER_ERROR:
-- * @el: the base video decoder element that generates the error
-- * @weight: element defined weight of the error, added to error count
-- * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
-- * @code: error code defined for that domain (see #gstreamer-GstGError)
-- * @text: the message to display (format string and args enclosed in
-- * parentheses)
-- * @debug: debugging information for the message (format string and args
-- * enclosed in parentheses)
-- * @ret: variable to receive return value
-- *
-- * Utility function that audio decoder elements can use in case they encountered
-- * a data processing error that may be fatal for the current "data unit" but
-- * need not prevent subsequent decoding. Such errors are counted and if there
-- * are too many, as configured in the context's max_errors, the pipeline will
-- * post an error message and the application will be requested to stop further
-- * media processing. Otherwise, it is considered a "glitch" and only a warning
-- * is logged. In either case, @ret is set to the proper value to
-- * return to upstream/caller (indicating either GST_FLOW_ERROR or GST_FLOW_OK).
--
--*
-- * GstBaseVideoDecoder:
-- *
-- * The opaque #GstBaseVideoDecoder data structure.
--
type GstBaseVideoDecoder is record
base_video_codec : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstBaseVideoCodec; -- gst/video/gstbasevideodecoder.h:125
sink_clipping : aliased GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:128
do_byte_time : aliased GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:129
packetized : aliased GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:130
max_errors : aliased GLIB.gint; -- gst/video/gstbasevideodecoder.h:131
input_adapter : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstadapter_h.GstAdapter; -- gst/video/gstbasevideodecoder.h:135
output_adapter : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstadapter_h.GstAdapter; -- gst/video/gstbasevideodecoder.h:137
current_frame : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame; -- gst/video/gstbasevideodecoder.h:145
current_frame_events : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:147
input_offset : aliased GLIB.guint64; -- gst/video/gstbasevideodecoder.h:149
frame_offset : aliased GLIB.guint64; -- gst/video/gstbasevideodecoder.h:151
timestamps : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:153
have_sync : aliased GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:155
timestamp_offset : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/video/gstbasevideodecoder.h:160
field_index : aliased int; -- gst/video/gstbasevideodecoder.h:161
last_timestamp : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/video/gstbasevideodecoder.h:164
error_count : aliased GLIB.gint; -- gst/video/gstbasevideodecoder.h:165
gather : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:169
parse : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:171
parse_gather : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:173
decode : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:175
queued : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/video/gstbasevideodecoder.h:177
process : aliased GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:178
base_picture_number : aliased GLIB.guint64; -- gst/video/gstbasevideodecoder.h:181
reorder_depth : aliased int; -- gst/video/gstbasevideodecoder.h:182
distance_from_sync : aliased int; -- gst/video/gstbasevideodecoder.h:183
dropped : aliased GLIB.guint; -- gst/video/gstbasevideodecoder.h:186
processed : aliased GLIB.guint; -- gst/video/gstbasevideodecoder.h:187
padding : u_GstBaseVideoDecoder_padding_array; -- gst/video/gstbasevideodecoder.h:190
end record;
pragma Convention (C_Pass_By_Copy, GstBaseVideoDecoder); -- gst/video/gstbasevideodecoder.h:123
--< protected >
-- parse tracking
-- input data
-- assembles current frame
--< private >
-- FIXME move to real private part ?
-- * (and introduce a context ?)
-- ... being tracked here;
-- * only available during parsing
-- FIXME remove and add parameter to method
-- events that should apply to the current frame
-- relative offset of input data
-- relative offset of frame
-- tracking ts and offsets
-- whether parsing is in sync
-- maybe sort-of protected ?
-- combine to yield (presentation) ts
-- last outgoing ts
-- reverse playback
-- collect input
-- to-be-parsed
-- collected parsed frames
-- frames to be handled == decoded
-- collected output
-- no comment ...
-- qos messages: frames dropped/processed
-- FIXME before moving to base
--*
-- * GstBaseVideoDecoderClass:
-- * @start: Optional.
-- * Called when the element starts processing.
-- * Allows opening external resources.
-- * @stop: Optional.
-- * Called when the element stops processing.
-- * Allows closing external resources.
-- * @set_format: Notifies subclass of incoming data format (caps).
-- * @scan_for_sync: Optional.
-- * Allows subclass to obtain sync for subsequent parsing
-- * by custom means (above an beyond scanning for specific
-- * marker and mask).
-- * @parse_data: Required for non-packetized input.
-- * Allows chopping incoming data into manageable units (frames)
-- * for subsequent decoding.
-- * @reset: Optional.
-- * Allows subclass (codec) to perform post-seek semantics reset.
-- * @handle_frame: Provides input data frame to subclass.
-- * @finish: Optional.
-- * Called to request subclass to dispatch any pending remaining
-- * data (e.g. at EOS).
-- *
-- * Subclasses can override any of the available virtual methods or not, as
-- * needed. At minimum @handle_frame needs to be overridden, and @set_format
-- * and likely as well. If non-packetized input is supported or expected,
-- * @parse needs to be overridden as well.
--
type GstBaseVideoDecoderClass is record
base_video_codec_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstBaseVideoCodecClass; -- gst/video/gstbasevideodecoder.h:223
start : access function (arg1 : access GstBaseVideoDecoder) return GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:225
stop : access function (arg1 : access GstBaseVideoDecoder) return GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:227
scan_for_sync : access function
(arg1 : access GstBaseVideoDecoder;
arg2 : GLIB.gboolean;
arg3 : int;
arg4 : int) return int; -- gst/video/gstbasevideodecoder.h:230
parse_data : access function (arg1 : access GstBaseVideoDecoder; arg2 : GLIB.gboolean) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:232
set_format : access function (arg1 : access GstBaseVideoDecoder; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoState) return GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:234
reset : access function (arg1 : access GstBaseVideoDecoder) return GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:236
finish : access function (arg1 : access GstBaseVideoDecoder) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:238
handle_frame : access function (arg1 : access GstBaseVideoDecoder; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:240
capture_mask : aliased GLIB.guint32; -- gst/video/gstbasevideodecoder.h:244
capture_pattern : aliased GLIB.guint32; -- gst/video/gstbasevideodecoder.h:245
padding : u_GstBaseVideoDecoderClass_padding_array; -- gst/video/gstbasevideodecoder.h:248
end record;
pragma Convention (C_Pass_By_Copy, GstBaseVideoDecoderClass); -- gst/video/gstbasevideodecoder.h:221
--< private >
-- FIXME before moving to base
procedure gst_base_video_decoder_class_set_capture_pattern
(klass : access GstBaseVideoDecoderClass;
mask : GLIB.guint32;
pattern : GLIB.guint32); -- gst/video/gstbasevideodecoder.h:251
pragma Import (C, gst_base_video_decoder_class_set_capture_pattern, "gst_base_video_decoder_class_set_capture_pattern");
function gst_base_video_decoder_get_frame (coder : access GstBaseVideoDecoder; frame_number : int) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame; -- gst/video/gstbasevideodecoder.h:254
pragma Import (C, gst_base_video_decoder_get_frame, "gst_base_video_decoder_get_frame");
function gst_base_video_decoder_get_oldest_frame (coder : access GstBaseVideoDecoder) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame; -- gst/video/gstbasevideodecoder.h:256
pragma Import (C, gst_base_video_decoder_get_oldest_frame, "gst_base_video_decoder_get_oldest_frame");
procedure gst_base_video_decoder_add_to_frame (base_video_decoder : access GstBaseVideoDecoder; n_bytes : int); -- gst/video/gstbasevideodecoder.h:258
pragma Import (C, gst_base_video_decoder_add_to_frame, "gst_base_video_decoder_add_to_frame");
procedure gst_base_video_decoder_lost_sync (base_video_decoder : access GstBaseVideoDecoder); -- gst/video/gstbasevideodecoder.h:260
pragma Import (C, gst_base_video_decoder_lost_sync, "gst_base_video_decoder_lost_sync");
function gst_base_video_decoder_have_frame (base_video_decoder : access GstBaseVideoDecoder) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:261
pragma Import (C, gst_base_video_decoder_have_frame, "gst_base_video_decoder_have_frame");
procedure gst_base_video_decoder_set_sync_point (base_video_decoder : access GstBaseVideoDecoder); -- gst/video/gstbasevideodecoder.h:263
pragma Import (C, gst_base_video_decoder_set_sync_point, "gst_base_video_decoder_set_sync_point");
function gst_base_video_decoder_set_src_caps (base_video_decoder : access GstBaseVideoDecoder) return GLIB.gboolean; -- gst/video/gstbasevideodecoder.h:264
pragma Import (C, gst_base_video_decoder_set_src_caps, "gst_base_video_decoder_set_src_caps");
function gst_base_video_decoder_alloc_src_buffer (base_video_decoder : access GstBaseVideoDecoder) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/video/gstbasevideodecoder.h:265
pragma Import (C, gst_base_video_decoder_alloc_src_buffer, "gst_base_video_decoder_alloc_src_buffer");
function gst_base_video_decoder_alloc_src_frame (base_video_decoder : access GstBaseVideoDecoder; frame : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:266
pragma Import (C, gst_base_video_decoder_alloc_src_frame, "gst_base_video_decoder_alloc_src_frame");
function gst_base_video_decoder_get_state (base_video_decoder : access GstBaseVideoDecoder) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoState; -- gst/video/gstbasevideodecoder.h:268
pragma Import (C, gst_base_video_decoder_get_state, "gst_base_video_decoder_get_state");
function gst_base_video_decoder_get_max_decode_time (base_video_decoder : access GstBaseVideoDecoder; frame : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTimeDiff; -- gst/video/gstbasevideodecoder.h:269
pragma Import (C, gst_base_video_decoder_get_max_decode_time, "gst_base_video_decoder_get_max_decode_time");
function gst_base_video_decoder_finish_frame (base_video_decoder : access GstBaseVideoDecoder; frame : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:272
pragma Import (C, gst_base_video_decoder_finish_frame, "gst_base_video_decoder_finish_frame");
function gst_base_video_decoder_drop_frame (dec : access GstBaseVideoDecoder; frame : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideocodec_h.GstVideoFrame) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/video/gstbasevideodecoder.h:274
pragma Import (C, gst_base_video_decoder_drop_frame, "gst_base_video_decoder_drop_frame");
function gst_base_video_decoder_get_type return GLIB.GType; -- gst/video/gstbasevideodecoder.h:276
pragma Import (C, gst_base_video_decoder_get_type, "gst_base_video_decoder_get_type");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_video_gstbasevideodecoder_h;
|
stcarrez/ada-util | Ada | 2,299 | ads | -----------------------------------------------------------------------
-- util-strings-formats -- String formatting helper
-- Copyright (C) 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.Strings.Builders;
package Util.Strings.Formats is
type String_Access is access constant String;
type String_Array_Access is array (Positive range <>) of String_Access;
procedure Append (Result : in out Util.Strings.Builders.Builder;
Item : in String_Access);
procedure Format is
new Util.Strings.Builders.Format (Value => String_Access,
Value_List => String_Array_Access,
Append => Append);
-- Format the message and append it to the string builder.
procedure Format (Into : in out Util.Strings.Builders.Builder;
Message : in String;
Arg1 : in String);
procedure Format (Into : in out Util.Strings.Builders.Builder;
Message : in String;
Arg1 : in String;
Arg2 : in String;
Arg3 : in String;
Arg4 : in String);
-- Format the message and return the formatted message.
function Format (Message : in String;
Arg1 : in String) return String;
function Format (Message : in String;
Arg1 : in String;
Arg2 : in String;
Arg3 : in String;
Arg4 : in String) return String;
end Util.Strings.Formats;
|
reznikmm/matreshka | Ada | 4,615 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Institution_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Institution_Attribute_Node is
begin
return Self : Text_Institution_Attribute_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Institution_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Institution_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Institution_Attribute,
Text_Institution_Attribute_Node'Tag);
end Matreshka.ODF_Text.Institution_Attributes;
|
Schol-R-LEA/sarcos | Ada | 102 | ads | /home/schol-r-lea/Documents/Programming/Projects/OS-Experiments/sarcos/sarcos/ada/rts/src/g-souinf.ads |
Gabriel-Degret/adalib | Ada | 2,334 | 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.Strings.Wide_Maps.Wide_Constants is
pragma Preelaborate (Wide_Constants);
Control_Set : constant Wide_Character_Set;
Graphic_Set : constant Wide_Character_Set;
Letter_Set : constant Wide_Character_Set;
Lower_Set : constant Wide_Character_Set;
Upper_Set : constant Wide_Character_Set;
Basic_Set : constant Wide_Character_Set;
Decimal_Digit_Set : constant Wide_Character_Set;
Hexadecimal_Digit_Set : constant Wide_Character_Set;
Alphanumeric_Set : constant Wide_Character_Set;
Special_Set : constant Wide_Character_Set;
ISO_646_Set : constant Wide_Character_Set;
Character_Set : constant Wide_Character_Set;
-- Contains each Wide_Character value WC such that
-- Characters.Conversions.Is_Character(WC) is True
Lower_Case_Map : constant Wide_Character_Mapping;
-- Wide_Maps to lower case for letters, else identity
Upper_Case_Map : constant Wide_Character_Mapping;
-- Wide_Maps to upper case for letters, else identity
Basic_Map : constant Wide_Character_Mapping;
-- Wide_Maps to basic letter for letters, else identity
private
pragma Import (Ada, Control_Set);
pragma Import (Ada, Graphic_Set);
pragma Import (Ada, Letter_Set);
pragma Import (Ada, Lower_Set);
pragma Import (Ada, Upper_Set);
pragma Import (Ada, Basic_Set);
pragma Import (Ada, Decimal_Digit_Set);
pragma Import (Ada, Hexadecimal_Digit_Set);
pragma Import (Ada, Alphanumeric_Set);
pragma Import (Ada, Special_Set);
pragma Import (Ada, ISO_646_Set);
pragma Import (Ada, Lower_Case_Map);
pragma Import (Ada, Upper_Case_Map);
pragma Import (Ada, Basic_Map);
pragma Import (Ada, Character_Set);
end Ada.Strings.Wide_Maps.Wide_Constants;
|
ZinebZaad/ENSEEIHT | Ada | 3,988 | adb | -- Auteurs : HATHOUTE Hamza, GUEMIL Walid
-- Equipe :
-- Mini-projet 1 : Le jeu du devin
with Ada.Text_Io; use Ada.Text_Io;
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
-- TODO: à compléter...
procedure Jeu_Devin is
Min : constant Integer := 1;
Max : constant Integer := 999;
-- les nombres à trouver sont entre Min et Max
-- TODO: Mettre le bon commentaire !
procedure Faire_deviner_un_nombre is -- TODO: Donner un nom significatif !
-- TODO: Déclarer ici les variables nécessaires pour cet exercice
a: Integer;
x: Integer;
compteur: Integer;
begin
Put ("J'ai choisi ");
Get (a);
compteur := 0;
loop
Put ("Proposez un nombre : ");
Get (x);
if x>a then
Put_Line ("Le nombre proposé est trop grand.");
elsif x<a then
Put_Line("Le nombre proposé est trop petit.");
else
Put_Line ("Trouvé !");
end if;
compteur := compteur + 1;
exit when x=a;
end loop;
Put ("Bravo ! Vous avez trouvé en ");
Put (Compteur,1);
Put_Line (" essai(s).");
end Faire_deviner_un_nombre; -- TODO: à changer
-- TODO: Mettre le bon commentaire !
procedure Deviner_un_nombre is -- TODO: Donner un nom significatif !
-- TODO: Déclarer ici les variables nécessaires pour cet exercice
BorneMin: Integer; -- la borne minimale.
BorneMax: Integer; -- la borne maximale.
Nombre: Integer; -- le nombre que l'ordinateur devine
Essaies: Integer; -- le nombre d'essaies
Choix: Character; -- le choix de l'utilisateur
begin
loop
Put("Avez-vous choisi un nombre compris entre 1 et 999 (o/n) ? ");
Get(Choix);
exit when Choix = 'o';
Put_Line("J'attends...");
end loop;
-- Initialiser les variables
BorneMin := Min;
BorneMax := Max;
Nombre := 500;
Essaies := 0;
-- Chercher le nombre deviné
loop
-- Mettre à jour les variables
if Choix = 'g' then
BorneMax := Nombre - 1;
elsif Choix = 'p' then
BorneMin := Nombre + 1;
end if;
-- Verifier si l'utilisateur ne triche pas
if BorneMax < BorneMin then
Put_Line("Vous trichez. J'arrête cette partie.");
return;
end if;
-- Calculer le nombre
Nombre := (BorneMin + BorneMax)/2; -- Valeur médiane
-- Incrementer les essaies
Essaies := Essaies + 1;
-- Afficher la proposition
Put ("Je propose ");
Put (Item => Nombre, Width => 1);
Put_Line("");
-- Saisir l'indice
loop
Put("Votre indice (t/p/g) ? ");
Get(Choix);
exit when Choix = 't' or Choix = 'p' or Choix = 'g';
end loop;
exit when Choix = 't';
end loop;
-- Afficher le nombre trouvé
Put ("J'ai trouvé ");
Put (Item => Nombre, Width => 1);
Put(" en ");
Put (Item => Essaies, Width => 1);
Put(" essai(s).");
end Deviner_un_nombre;
choix: Integer;
-- TODO: Déclarer ici les variables pour le programme principal
begin
loop
New_Line;
Put_Line ("1- L'ordinateur choisit un nombre et vous le devinez");
Put_Line ("2- Vous choisissez un nombre et l'ordinateur le devine");
Put_Line ("0- Quitter");
Put("Votre choix :");
Get (choix);
New_Line;
case choix is
when 1 => Faire_deviner_un_nombre;
when 2 => Deviner_un_nombre;
when others => null;
end case;
exit when choix = 0;
end loop;
end Jeu_Devin; |
Rodeo-McCabe/orka | Ada | 2,984 | 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 Orka.Transforms.SIMD_Vectors;
generic
with package Vectors is new Orka.Transforms.SIMD_Vectors (<>);
package Orka.Transforms.SIMD_Quaternions is
pragma Pure;
type Quaternion is new Vectors.Vector_Type;
subtype Vector4 is Vectors.Vector_Type;
type Axis_Angle is record
Axis : Vector4;
Angle : Vectors.Element_Type;
end record;
function Identity_Value return Quaternion is
((0.0, 0.0, 0.0, 1.0))
with Inline;
function "*" (Left, Right : Quaternion) return Quaternion;
function Conjugate (Elements : Quaternion) return Quaternion;
function Norm (Elements : Quaternion) return Vectors.Element_Type;
function Normalize (Elements : Quaternion) return Quaternion;
function Normalized (Elements : Quaternion) return Boolean;
function To_Axis_Angle (Elements : Quaternion) return Axis_Angle;
function R
(Axis : Vector4;
Angle : Vectors.Element_Type) return Quaternion
with Pre => Vectors.Normalized (Axis),
Post => Normalized (R'Result);
-- Return a quaternion that will cause a rotation of Angle radians
-- about the given Axis
function R (Left, Right : Vector4) return Quaternion
with Post => Normalized (R'Result);
-- Return the rotation from direction Left to Right
function Difference (Left, Right : Quaternion) return Quaternion
with Post => Normalized (Difference'Result);
-- Return a quaternion describing the rotation from quaternion Left
-- to Right (Right is a composite rotation of Left and the result)
procedure Rotate_At_Origin
(Vector : in out Vector4;
Elements : Quaternion)
with Pre => Normalized (Elements);
function Lerp
(Left, Right : Quaternion;
Time : Vectors.Element_Type) return Quaternion
with Pre => Time in 0.0 .. 1.0,
Post => Normalized (Lerp'Result);
-- Return the interpolated normalized quaternion on the chord
-- between the Left and Right quaternions.
function Slerp
(Left, Right : Quaternion;
Time : Vectors.Element_Type) return Quaternion
with Pre => Time in 0.0 .. 1.0,
Post => Normalized (Slerp'Result);
-- Return the interpolated unit quaternion on the shortest arc
-- between the Left and Right quaternions.
end Orka.Transforms.SIMD_Quaternions;
|
stcarrez/ada-awa | Ada | 4,451 | adb | -----------------------------------------------------------------------
-- awa-wikis-modules-tests -- Unit tests for wikis service
-- Copyright (C) 2015, 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Measures;
with Util.Test_Caller;
with AWA.Tests.Helpers;
with AWA.Tests.Helpers.Users;
with AWA.Services.Contexts;
with AWA.Counters.Definition;
with AWA.Users.Models;
with Security.Contexts;
package body AWA.Counters.Modules.Tests is
package User_Counter is
new AWA.Counters.Definition (AWA.Users.Models.USER_TABLE);
package Session_Counter is
new AWA.Counters.Definition (AWA.Users.Models.SESSION_TABLE);
package Global_Counter is
new AWA.Counters.Definition (null, "count");
package Caller is new Util.Test_Caller (Test, "Counters.Modules");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Counters.Modules.Increment",
Test_Increment'Access);
Caller.Add_Test (Suite, "Test AWA.Counters.Modules.Increment (global counter)",
Test_Global_Counter'Access);
end Add_Tests;
-- ------------------------------
-- Test incrementing counters and flushing.
-- ------------------------------
procedure Test_Increment (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
Before : Integer;
After : Integer;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]");
T.Manager := AWA.Counters.Modules.Get_Counter_Module;
T.Assert (T.Manager /= null, "There is no counter plugin");
T.Manager.Get_Counter (User_Counter.Index, Context.Get_User, Before);
AWA.Counters.Increment (User_Counter.Index, Context.Get_User);
T.Manager.Flush;
T.Manager.Get_Counter (User_Counter.Index, Context.Get_User, After);
Util.Tests.Assert_Equals (T, Before + 1, After, "The counter must have been incremented");
declare
S : Util.Measures.Stamp;
begin
for I in 1 .. 1_000 loop
AWA.Counters.Increment (User_Counter.Index, Context.Get_User);
end loop;
Util.Measures.Report (S, "AWA.Counters.Increment", 1000);
end;
declare
S : Util.Measures.Stamp;
begin
for I in 1 .. 1_000 loop
AWA.Counters.Increment (Session_Counter.Index, Context.Get_User_Session);
end loop;
Util.Measures.Report (S, "AWA.Counters.Increment", 1000);
end;
AWA.Counters.Increment (User_Counter.Index, Context.Get_User);
declare
S : Util.Measures.Stamp;
begin
T.Manager.Flush;
Util.Measures.Report (S, "AWA.Counters.Flush");
end;
T.Manager.Get_Counter (User_Counter.Index, Context.Get_User, After);
Util.Tests.Assert_Equals (T, Before + 2 + 1_000, After,
"The counter must have been incremented");
end Test_Increment;
-- ------------------------------
-- Test creation of a wiki page.
-- ------------------------------
-- Test incrementing a global counter.
procedure Test_Global_Counter (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]");
T.Manager := AWA.Counters.Modules.Get_Counter_Module;
T.Assert (T.Manager /= null, "There is no counter plugin");
-- T.Manager.Get_Counter (Global_Counter.Index, Before);
AWA.Counters.Increment (Global_Counter.Index);
T.Manager.Flush;
end Test_Global_Counter;
end AWA.Counters.Modules.Tests;
|
alexcamposruiz/dds-requestreply | Ada | 35,151 | adb |
package body DDS.Request_Reply.Connext_C_Requester.Generic_Requester is
-- /* $Id$
--
-- (c) Copyright, Real-Time Innovations, 2012-2016.
-- All rights reserved.
-- No duplications, whole or partial, manual or electronic, may be made
-- without express written permission. Any such copies, or
-- revisions thereof, must display this notice unaltered.
-- This code contains trade secrets of Real-Time Innovations, Inc.
--
-- modification history
-- ---------------------
-- 5.20,20aug14,acr Fixed declaration of copy_or_loan (REQREPLY-18)
-- 5.0.1,10jul13,fcs Fixed comp warnings
-- 1.0a,18jun12,jch Created.
-- ============================================================================ */
--
-- #include "log/log_makeheader.h"
--
-- /*#include <stdlib.h>*/
--
-- #ifndef log_common_h
-- #include "log/log_common.h"
-- #endif
--
-- #ifndef connext_c_requester_h
-- #include "connext_c/connext_c_requester.h"
-- #endif
--
-- #ifndef connext_c_requester_impl_h
-- #include "connext_c/connext_c_requester_impl.h"
-- #endif
--
-- #include "dds_c/dds_c_log_impl.h"
--
-- #include "connext_c/connext_c_untyped_impl.h"
--
-- #define DDS_CURRENT_SUBMODULE DDS_SUBMODULE_MASK_DATA
--
-- #define concatenate(A, B) A ## B
--
-- #define RTI_Connext_Requester_INITIALIZER {NULL}
--
-- #if defined(TReq) && defined(TRep)
--
-- #define TReqTRep_name_c(TReq, TRep) concatenate(TReq, TRep)
-- #define TReqTRep_name TReqTRep_name_c(TReq, TRep)
--
-- #ifdef TRequester
-- #define TReqTRepRequester_name_c(Requester_name) Requester_name
-- #define TReqTRepRequester_name TReqTRepRequester_name_c(TRequester)
-- #define TReqTRepRequester TReqTRepRequester_name_c(TRequester)
-- #else
-- #define TReqTRepRequester_name_c(TReqTRep_name) concatenate(TReqTRep_name, Requester)
-- #define TReqTRepRequester_name TReqTRepRequester_name_c(TReqTRep_name)
-- #define TReqTRepRequester TReqTRepRequester_name_c(TReqTRep_name)
-- #endif
--
-- #define TReqTypeSupport_c(TReq) concatenate(TReq, TypeSupport)
-- #define TReqTypeSupport TReqTypeSupport_c(TReq)
--
-- #define TRepTypeSupport_c(TRep) concatenate(TRep, TypeSupport)
-- #define TRepTypeSupport TRepTypeSupport_c(TRep)
--
-- #define TReqTypeSupport_register_type_c(TReqTypeSupport) concatenate(TReqTypeSupport, _register_type)
-- #define TReqTypeSupport_register_type TReqTypeSupport_register_type_c(TReqTypeSupport)
--
-- #define TReqTypeSupport_get_type_name_c(TReqTypeSupport) concatenate(TReqTypeSupport, _get_type_name)
-- #define TReqTypeSupport_get_type_name TReqTypeSupport_get_type_name_c(TReqTypeSupport)
--
-- #define TRepTypeSupport_register_type_c(TRepTypeSupport) concatenate(TRepTypeSupport, _register_type)
-- #define TRepTypeSupport_register_type TRepTypeSupport_register_type_c(TRepTypeSupport)
--
-- #define TRepTypeSupport_get_type_name_c(TRepTypeSupport) concatenate(TRepTypeSupport, _get_type_name)
-- #define TRepTypeSupport_get_type_name TRepTypeSupport_get_type_name_c(TRepTypeSupport)
--
-- #define TReqDataWriter_c(TReq) concatenate(TReq, DataWriter)
-- #define TReqDataWriter TReqDataWriter_c(TReq)
--
-- #define TReqDataWriter_narrow_c(TReq) concatenate(TReq, DataWriter_narrow)
-- #define TReqDataWriter_narrow TReqDataWriter_narrow_c(TReq)
--
-- #define TRepTypeSupport_copy_data_c(TRepTypeSupport) concatenate(TRepTypeSupport, _copy_data)
-- #define TRepTypeSupport_copy_data TRepTypeSupport_copy_data_c(TRepTypeSupport)
--
-- #define TRepSeq_c(TRep) concatenate(TRep, Seq)
-- #define TRepSeq TRepSeq_c(TRep)
--
-- #define TRepSeq_get_length_c(TRepSeq) concatenate(TRepSeq, _get_length)
-- #define TRepSeq_get_length TRepSeq_get_length_c(TRepSeq)
--
-- #define TRepSeq_get_maximum_c(TRepSeq) concatenate(TRepSeq, _get_maximum)
-- #define TRepSeq_get_maximum TRepSeq_get_maximum_c(TRepSeq)
--
-- #define TRepSeq_has_ownership_c(TRepSeq) concatenate(TRepSeq, _has_ownership)
-- #define TRepSeq_has_ownership TRepSeq_has_ownership_c(TRepSeq)
--
-- #define TRepSeq_set_length_c(TRepSeq) concatenate(TRepSeq, _set_length)
-- #define TRepSeq_set_length TRepSeq_set_length_c(TRepSeq)
--
-- #define TRepSeq_get_contiguous_bufferI_c(TRepSeq) concatenate(TRepSeq, _get_contiguous_bufferI)
-- #define TRepSeq_get_contiguous_bufferI TRepSeq_get_contiguous_bufferI_c(TRepSeq)
--
-- #define TRepSeq_loan_discontiguous_c(TRepSeq) concatenate(TRepSeq, _loan_discontiguous)
-- #define TRepSeq_loan_discontiguous TRepSeq_loan_discontiguous_c(TRepSeq)
--
-- #define TRepSeq_from_array_c(TRepSeq) concatenate(TRepSeq, _from_array)
-- #define TRepSeq_from_array TRepSeq_from_array_c(TRepSeq)
--
-- #define TRepSeq_get_discontiguous_buffer_c(TRepSeq) concatenate(TRepSeq, _get_discontiguous_buffer)
-- #define TRepSeq_get_discontiguous_buffer TRepSeq_get_discontiguous_buffer_c(TRepSeq)
--
-- #define TRepDataReader_c(TRep) concatenate(TRep, DataReader)
-- #define TRepDataReader TRepDataReader_c(TRep)
--
-- #define TRepDataReader_narrow_c(TRep) concatenate(TRep, DataReader_narrow)
-- #define TRepDataReader_narrow TRepDataReader_narrow_c(TRep)
--
-- #define TReqTRepRequester_create_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _create)
-- #define TReqTRepRequester_create TReqTRepRequester_create_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_create_w_params_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _create_w_params)
-- #define TReqTRepRequester_create_w_params TReqTRepRequester_create_w_params_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_send_request_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _send_request)
-- #define TReqTRepRequester_send_request TReqTRepRequester_send_request_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_send_request_w_params_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _send_request_w_params)
-- #define TReqTRepRequester_send_request_w_params TReqTRepRequester_send_request_w_params_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_receive_reply_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _receive_reply)
-- #define TReqTRepRequester_receive_reply TReqTRepRequester_receive_reply_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_receive_replies_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _receive_replies)
-- #define TReqTRepRequester_receive_replies TReqTRepRequester_receive_replies_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_take_reply_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _take_reply)
-- #define TReqTRepRequester_take_reply TReqTRepRequester_take_reply_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_take_replies_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _take_replies)
-- #define TReqTRepRequester_take_replies TReqTRepRequester_take_replies_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_take_reply_for_related_request_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _take_reply_for_related_request)
-- #define TReqTRepRequester_take_reply_for_related_request TReqTRepRequester_take_reply_for_related_request_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_take_replies_for_related_request_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _take_replies_for_related_request)
-- #define TReqTRepRequester_take_replies_for_related_request TReqTRepRequester_take_replies_for_related_request_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_read_reply_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _read_reply)
-- #define TReqTRepRequester_read_reply TReqTRepRequester_read_reply_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_read_replies_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _read_replies)
-- #define TReqTRepRequester_read_replies TReqTRepRequester_read_replies_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_read_reply_for_related_request_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _read_reply_for_related_request)
-- #define TReqTRepRequester_read_reply_for_related_request TReqTRepRequester_read_reply_for_related_request_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_read_replies_for_related_request_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _read_replies_for_related_request)
-- #define TReqTRepRequester_read_replies_for_related_request TReqTRepRequester_read_replies_for_related_request_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_get_request_datawriter_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _get_request_datawriter)
-- #define TReqTRepRequester_get_request_datawriter TReqTRepRequester_get_request_datawriter_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_get_reply_datareader_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _get_reply_datareader)
-- #define TReqTRepRequester_get_reply_datareader TReqTRepRequester_get_reply_datareader_c(TReqTRepRequester_name)
--
-- #define TRepDataReader_return_loan_c(TRepDataReader) concatenate(TRepDataReader, _return_loan)
-- #define TRepDataReader_return_loan TRepDataReader_return_loan_c(TRepDataReader)
--
-- #define TReqTRepRequester_return_loan_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _return_loan)
-- #define TReqTRepRequester_return_loan TReqTRepRequester_return_loan_c(TReqTRepRequester_name)
--
-- #define TReqTRepRequester_loan_or_copy_samplesI_c(TReqTRepRequester_name) concatenate(TReqTRepRequester_name, _loan_or_copy_samplesI)
-- #define TReqTRepRequester_loan_or_copy_samplesI TReqTRepRequester_loan_or_copy_samplesI_c(TReqTRepRequester_name)
--
-- TReqTRepRequester* TReqTRepRequester_create(
-- DDS_DomainParticipant * participant,
-- const char* service_name)
-- {
-- /* call create_w_params to reduce code */
-- TReqTRepRequester* requester = NULL;
--
-- RTI_Connext_RequesterParams params = RTI_Connext_RequesterParams_INITIALIZER;
--
-- params.participant = participant;
-- params.service_name = (char*)service_name;
--
-- requester = TReqTRepRequester_create_w_params(¶ms);
-- if(requester == NULL) {
-- DDSLog_exception(&RTI_LOG_CREATION_FAILURE_s,
-- "requester with params");
-- return NULL;
-- }
--
-- return requester;
-- }
--
-- TReqTRepRequester* TReqTRepRequester_create_w_params(
-- const RTI_Connext_RequesterParams* params)
-- {
-- TReqTRepRequester* requester = NULL;
--
-- if(params == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "params");
-- return NULL;
-- }
--
-- RTIOsapiHeap_allocateStructure(&requester, TReqTRepRequester);
-- if(requester == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "allocate structure");
-- goto finish;
-- }
--
-- requester->parent._impl = RTI_Connext_RequesterUntypedImpl_create(
-- params,
-- &TReqTypeSupport_register_type,
-- TReqTypeSupport_get_type_name(),
-- &TRepTypeSupport_register_type,
-- TRepTypeSupport_get_type_name(),
-- sizeof(TRep));
--
-- if(requester->parent._impl == NULL) {
-- DDSLog_exception(&RTI_LOG_CREATION_FAILURE_s,
-- "RequesterUntypedImpl");
-- goto finish;
-- }
--
-- return requester;
--
-- finish:
-- if(requester != NULL) {
-- RTI_Connext_Requester_delete(&requester->parent);
-- }
-- return NULL;
--
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_send_request_w_params(
-- TReqTRepRequester* self,
-- const TReq* request,
-- struct DDS_WriteParams_t* request_info)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(request == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "request");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(request_info == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "request_info");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- request_info->replace_auto = DDS_BOOLEAN_TRUE;
-- retCode = RTI_Connext_EntityUntypedImpl_send_sample(
-- self->parent._impl, (void *)request, request_info);
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "send_request");
-- }
-- return retCode;
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_send_request(
-- TReqTRepRequester* self,
-- const TReq* request)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- struct DDS_WriteParams_t wp = DDS_WRITEPARAMS_DEFAULT;
-- retCode = TReqTRepRequester_send_request_w_params(self, request, &wp);
--
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "send request");
-- }
-- return retCode;
-- }
--
--
-- DDS_ReturnCode_t TReqTRepRequester_loan_or_copy_samplesI(
-- TReqTRepRequester* self,
-- DDS_ReturnCode_t inRetCode,
-- struct TRepSeq* replies,
-- DDS_Boolean isLoan,
-- void **dataPtrArray,
-- int dataCount,
-- struct DDS_SampleInfoSeq* info_seq)
-- {
-- DDS_ReturnCode_t result = inRetCode;
--
-- if (inRetCode == DDS_RETCODE_NO_DATA) {
-- TRepSeq_set_length(replies, 0);
-- goto done;
-- }
--
-- if (inRetCode != DDS_RETCODE_OK) {
-- goto done;
-- }
--
-- if (isLoan) {
-- /* loan buffer to sequence */
-- if (!TRepSeq_loan_discontiguous(replies,
-- (TRep **)dataPtrArray, dataCount,
-- dataCount)) {
-- /* this should never happend */
-- result = DDS_RETCODE_ERROR;
-- /* since we failed to loan data to data seq, but data is already
-- taken, we will need to return it still.
-- Note that data will be lost in this case */
-- RTI_Connext_EntityUntypedImpl_return_loan(
-- self->parent._impl, dataPtrArray, info_seq);
-- }
-- } else {
-- /* data is already copied to dataSeqContiguousBuffer */
-- if (!TRepSeq_set_length(replies, dataCount)) {
-- /* this should never happnen */
-- result = DDS_RETCODE_ERROR;
-- }
-- }
--
-- done:
--
-- return result;
-- }
--
--
-- DDS_ReturnCode_t TReqTRepRequester_take_reply_for_related_request(
-- TReqTRepRequester* self,
-- TRep* reply,
-- struct DDS_SampleInfo* sample_info,
-- const struct DDS_SampleIdentity_t* related_request_info)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- struct DDS_SampleInfoSeq info_seq = DDS_SEQUENCE_INITIALIZER;
-- void ** data = NULL;
-- int count = 0;
-- DDS_Boolean isLoan = DDS_BOOLEAN_TRUE;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(reply == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "reply");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(sample_info == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "sample_info");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- sample_info->valid_data = DDS_BOOLEAN_FALSE;
--
-- retCode = RTI_Connext_RequesterUntypedImpl_get_reply_loaned(
-- self->parent._impl,
-- &data,
-- &count,
-- &isLoan,
-- NULL, /* buffer */
-- &info_seq,
-- (DDS_Long)0, /* data_seq_len */
-- (DDS_Long)0, /* data_seq_max_len */
-- DDS_BOOLEAN_TRUE, /* ownership */
-- 1,
-- related_request_info,
-- RTI_TRUE);
--
-- if (retCode != DDS_RETCODE_OK) {
-- if (retCode != DDS_RETCODE_NO_DATA ) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "get sample");
-- }
-- return retCode;
-- }
--
-- retCode = TRepTypeSupport_copy_data(reply, *((TRep**)data));
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "copy sample");
-- goto done;
-- }
--
-- if(DDS_SampleInfoSeq_get_length(&info_seq) != 0) {
-- /* TODO: implement copy function? */
-- *sample_info = DDS_SampleInfoSeq_get(&info_seq, 0);
-- }
--
-- done:
-- RTI_Connext_EntityUntypedImpl_return_loan(self->parent._impl, data, &info_seq);
-- return retCode;
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_take_reply(
-- TReqTRepRequester* self,
-- TRep* reply,
-- struct DDS_SampleInfo* sample_info)
-- {
-- return TReqTRepRequester_take_reply_for_related_request(
-- self, reply, sample_info, NULL);
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_take_replies_for_related_request(
-- TReqTRepRequester * self,
-- struct TRepSeq * replies,
-- struct DDS_SampleInfoSeq * info_seq,
-- DDS_Long max_reply_count,
-- const struct DDS_SampleIdentity_t* related_request_id)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
--
-- DDS_Long dataSeqLen = 0;
-- DDS_Long dataSeqMaxLen = 0;
-- DDS_Boolean dataSeqHasOwnership = DDS_BOOLEAN_FALSE;
-- DDS_Boolean isLoan = DDS_BOOLEAN_TRUE;
-- void **dataPtrArray = NULL;
-- int dataCount = 0;
-- TRep *dataSeqContiguousBuffer = NULL;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(replies == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "replies");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(info_seq == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "info_seq");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- /* --- get dataSeq information --- */
-- dataSeqLen = TRepSeq_get_length(replies);
-- dataSeqMaxLen = TRepSeq_get_maximum(replies);
-- dataSeqHasOwnership = TRepSeq_has_ownership(replies);
-- dataSeqContiguousBuffer = TRepSeq_get_contiguous_bufferI(replies);
--
-- retCode = RTI_Connext_RequesterUntypedImpl_get_reply_loaned(
-- self->parent._impl,
-- &dataPtrArray,
-- &dataCount,
-- &isLoan,
-- (void *) dataSeqContiguousBuffer,
-- info_seq,
-- dataSeqLen,
-- dataSeqMaxLen,
-- dataSeqHasOwnership,
-- max_reply_count,
-- related_request_id,
-- RTI_TRUE);
--
-- retCode = TReqTRepRequester_loan_or_copy_samplesI(
-- self, retCode, replies,
-- isLoan, dataPtrArray, dataCount, info_seq);
--
-- if(retCode != DDS_RETCODE_OK && retCode != DDS_RETCODE_NO_DATA) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "copy data");
-- }
--
-- return retCode;
--
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_take_replies(
-- TReqTRepRequester * self,
-- struct TRepSeq * replies,
-- struct DDS_SampleInfoSeq * info_seq,
-- DDS_Long max_reply_count)
-- {
-- return TReqTRepRequester_take_replies_for_related_request(
-- self, replies, info_seq, max_reply_count, NULL);
-- }
--
-- /* ------------------------------------------------------------------------- */
--
--
-- DDS_ReturnCode_t TReqTRepRequester_read_reply_for_related_request(
-- TReqTRepRequester* self,
-- TRep* reply,
-- struct DDS_SampleInfo* sample_info,
-- const struct DDS_SampleIdentity_t* related_request_info)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- struct DDS_SampleInfoSeq info_seq = DDS_SEQUENCE_INITIALIZER;
-- void ** data = NULL;
-- int count = 0;
-- DDS_Boolean isLoan = DDS_BOOLEAN_TRUE;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(reply == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "reply");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(sample_info == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "sample_info");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- sample_info->valid_data = DDS_BOOLEAN_FALSE;
--
-- retCode = RTI_Connext_RequesterUntypedImpl_get_reply_loaned(
-- self->parent._impl,
-- &data,
-- &count,
-- &isLoan,
-- NULL, /* buffer */
-- &info_seq,
-- (DDS_Long)0, /* data_seq_len */
-- (DDS_Long)0, /* data_seq_max_len */
-- DDS_BOOLEAN_TRUE, /* ownership */
-- 1,
-- related_request_info,
-- RTI_FALSE);
--
-- if (retCode != DDS_RETCODE_OK) {
-- if (retCode != DDS_RETCODE_NO_DATA ) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "get sample");
-- }
-- return retCode;
-- }
--
-- retCode = TRepTypeSupport_copy_data(reply, *((TRep**)data));
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "copy sample");
-- goto done;
-- }
--
-- if(DDS_SampleInfoSeq_get_length(&info_seq) != 0) {
-- /* TODO: implement copy function? */
-- *sample_info = DDS_SampleInfoSeq_get(&info_seq, 0);
-- }
--
-- done:
-- RTI_Connext_EntityUntypedImpl_return_loan(self->parent._impl, data, &info_seq);
-- return retCode;
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_read_reply(
-- TReqTRepRequester* self,
-- TRep* reply,
-- struct DDS_SampleInfo* sample_info)
-- {
-- return TReqTRepRequester_read_reply_for_related_request(
-- self, reply, sample_info, NULL);
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_read_replies_for_related_request(
-- TReqTRepRequester * self,
-- struct TRepSeq * replies,
-- struct DDS_SampleInfoSeq * info_seq,
-- DDS_Long max_reply_count,
-- const struct DDS_SampleIdentity_t* related_request_id)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
--
-- DDS_Long dataSeqLen = 0;
-- DDS_Long dataSeqMaxLen = 0;
-- DDS_Boolean dataSeqHasOwnership = DDS_BOOLEAN_FALSE;
-- DDS_Boolean isLoan = DDS_BOOLEAN_TRUE;
-- void **dataPtrArray = NULL;
-- int dataCount = 0;
-- TRep *dataSeqContiguousBuffer = NULL;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(replies == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "replies");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(info_seq == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "info_seq");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- /* --- get dataSeq information --- */
-- dataSeqLen = TRepSeq_get_length(replies);
-- dataSeqMaxLen = TRepSeq_get_maximum(replies);
-- dataSeqHasOwnership = TRepSeq_has_ownership(replies);
-- dataSeqContiguousBuffer = TRepSeq_get_contiguous_bufferI(replies);
--
-- retCode = RTI_Connext_RequesterUntypedImpl_get_reply_loaned(
-- self->parent._impl,
-- &dataPtrArray,
-- &dataCount,
-- &isLoan,
-- (void *) dataSeqContiguousBuffer,
-- info_seq,
-- dataSeqLen,
-- dataSeqMaxLen,
-- dataSeqHasOwnership,
-- max_reply_count,
-- related_request_id,
-- RTI_FALSE);
--
-- retCode = TReqTRepRequester_loan_or_copy_samplesI(
-- self, retCode, replies,
-- isLoan, dataPtrArray, dataCount, info_seq);
--
-- if(retCode != DDS_RETCODE_OK && retCode != DDS_RETCODE_NO_DATA) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "copy data");
-- }
--
-- return retCode;
--
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_read_replies(
-- TReqTRepRequester * self,
-- struct TRepSeq * replies,
-- struct DDS_SampleInfoSeq * info_seq,
-- DDS_Long max_reply_count)
-- {
-- return TReqTRepRequester_read_replies_for_related_request(
-- self, replies, info_seq, max_reply_count, NULL);
-- }
--
--
-- /* ------------------------------------------------------------------------- */
--
-- DDS_ReturnCode_t TReqTRepRequester_receive_reply(
-- TReqTRepRequester* self,
-- TRep* reply,
-- struct DDS_SampleInfo* sample_info,
-- const struct DDS_Duration_t * max_wait)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(reply == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "reply");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(sample_info == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "sample_info");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(max_wait == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "max_wait");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- sample_info->valid_data = DDS_BOOLEAN_FALSE;
--
-- retCode = RTI_Connext_Requester_wait_for_replies(
-- (RTI_Connext_Requester *) self, 1, max_wait);
-- if (retCode != DDS_RETCODE_OK) {
-- if (retCode != DDS_RETCODE_TIMEOUT) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "wait for replies");
-- }
-- return retCode;
-- }
--
-- retCode = TReqTRepRequester_take_reply(self, reply, sample_info);
-- if (retCode != DDS_RETCODE_OK) {
-- if (retCode != DDS_RETCODE_NO_DATA) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "get reply");
-- }
-- return retCode;
-- }
--
-- return DDS_RETCODE_OK;
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_receive_replies(
-- TReqTRepRequester * self,
-- struct TRepSeq * replies,
-- struct DDS_SampleInfoSeq * info_seq,
-- DDS_Long min_count,
-- DDS_Long max_count,
-- const struct DDS_Duration_t * max_wait)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(replies == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "replies");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(info_seq == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "info_seq");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(max_wait == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "max_wait");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- if (!RTI_Connext_EntityUntypedImpl_validate_receive_params(
-- self->parent._impl, RTI_FUNCTION_NAME, min_count, max_count, max_wait)) {
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
--
-- retCode = RTI_Connext_Requester_wait_for_replies(
-- (RTI_Connext_Requester *) self, min_count, max_wait);
-- if (retCode != DDS_RETCODE_OK) {
-- if (retCode != DDS_RETCODE_TIMEOUT) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "wait for replies");
-- }
-- return retCode;
-- }
--
-- retCode = TReqTRepRequester_take_replies(
-- self, replies, info_seq, max_count);
-- if (retCode != DDS_RETCODE_OK) {
-- if (retCode != DDS_RETCODE_NO_DATA) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "get replies");
-- }
-- return retCode;
-- }
--
-- return DDS_RETCODE_OK;
-- }
--
-- TReqDataWriter* TReqTRepRequester_get_request_datawriter(TReqTRepRequester* self)
-- {
--
-- DDS_DataWriter * internal_writer = NULL;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return NULL;
-- }
--
-- internal_writer = RTI_Connext_EntityUntypedImpl_get_datawriter(
-- self->parent._impl);
--
-- if(internal_writer == NULL) {
-- DDSLog_exception(&RTI_LOG_GET_FAILURE_s,
-- "request DataWriter");
-- return NULL;
-- }
--
-- return TReqDataWriter_narrow(internal_writer);
-- }
--
-- TRepDataReader * TReqTRepRequester_get_reply_datareader(TReqTRepRequester* self)
-- {
--
-- DDS_DataReader* internal_reader = NULL;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return NULL;
-- }
--
-- internal_reader = RTI_Connext_EntityUntypedImpl_get_datareader(
-- self->parent._impl);
--
-- if(internal_reader == NULL) {
-- DDSLog_exception(&RTI_LOG_GET_FAILURE_s,
-- "reply DataReader");
-- return NULL;
-- }
--
-- return TRepDataReader_narrow(internal_reader);
-- }
--
-- DDS_ReturnCode_t TReqTRepRequester_return_loan(
-- TReqTRepRequester* self,
-- struct TRepSeq *replies,
-- struct DDS_SampleInfoSeq *info_seq)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
-- TRepDataReader * reader = NULL;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(replies == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "replies");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
-- if(info_seq == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "info_seq");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- reader = TReqTRepRequester_get_reply_datareader(self);
-- if (reader == NULL) {
-- DDSLog_exception(&RTI_LOG_GET_FAILURE_s,
-- "reader to return loan");
-- return DDS_RETCODE_ERROR;
-- }
--
-- retCode = TRepDataReader_return_loan(reader, replies, info_seq);
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "return loan");
-- return retCode;
-- }
--
-- return retCode;
-- }
--
-- #undef TReqTypeSupport_get_type_name_c
-- #undef TReqTypeSupport_get_type_name
--
-- #undef TRepTypeSupport_get_type_name_c
-- #undef TRepTypeSupport_get_type_name
--
-- #endif
--
--
-- /* ----------------------------------------------------------------- */
-- /* End of $Id$ */
end DDS.Request_Reply.Connext_C_Requester.Generic_Requester;
|
charlie5/aIDE | Ada | 1,120 | ads | with
AdaM.Any,
Ada.Containers.Vectors,
Ada.Streams;
package AdaM.program_Library
is
type Item is new Any.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- Forge
--
function new_Subprogram return program_Library.view;
procedure free (Self : in out program_Library.view);
procedure destruct (Self : in out program_Library.item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
private
type Item is new Any.item with
record
null;
end record;
end AdaM.program_Library;
|
M1nified/Ada-Samples | Ada | 388 | adb | procedure Interval_proc is
procedure some_procedure is
begin
-- this cannot be empty
end;
Interval_Length : Time_Span := To_Time_Span(0.5);
Next_Call_Time : Time;
begin
Next_Call_Time := Clock;
loop
some_procedure;
Next_Call_Time := Next_Call_Time + Interval_Length;
delay until Next_Call_Time;
end loop;
end Interval_proc;
|
reznikmm/matreshka | Ada | 3,670 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis;
with Engines.Contexts;
with League.Strings;
package Properties.Definitions.Variant_Part is
function Assign
(Engine : access Engines.Contexts.Context;
Element : Asis.Association;
Name : Engines.Text_Property) return League.Strings.Universal_String;
end Properties.Definitions.Variant_Part;
|
reznikmm/matreshka | Ada | 4,576 | 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_Xhtml.About_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Xhtml_About_Attribute_Node is
begin
return Self : Xhtml_About_Attribute_Node do
Matreshka.ODF_Xhtml.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Xhtml_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Xhtml_About_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.About_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Xhtml_URI,
Matreshka.ODF_String_Constants.About_Attribute,
Xhtml_About_Attribute_Node'Tag);
end Matreshka.ODF_Xhtml.About_Attributes;
|
reznikmm/matreshka | Ada | 18,327 | 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_Named_Elements;
with AMF.UML.Activities;
with AMF.UML.Activity_Edges.Collections;
with AMF.UML.Activity_Groups.Collections;
with AMF.UML.Activity_Nodes;
with AMF.UML.Activity_Partitions.Collections;
with AMF.UML.Behaviors;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Interruptible_Activity_Regions;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces;
with AMF.UML.Object_Flows;
with AMF.UML.Packages.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Structured_Activity_Nodes;
with AMF.UML.Value_Specifications;
with AMF.Visitors;
package AMF.Internals.UML_Object_Flows is
type UML_Object_Flow_Proxy is
limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy
and AMF.UML.Object_Flows.UML_Object_Flow with null record;
overriding function Get_Is_Multicast
(Self : not null access constant UML_Object_Flow_Proxy)
return Boolean;
-- Getter of ObjectFlow::isMulticast.
--
-- Tells whether the objects in the flow are passed by multicasting.
overriding procedure Set_Is_Multicast
(Self : not null access UML_Object_Flow_Proxy;
To : Boolean);
-- Setter of ObjectFlow::isMulticast.
--
-- Tells whether the objects in the flow are passed by multicasting.
overriding function Get_Is_Multireceive
(Self : not null access constant UML_Object_Flow_Proxy)
return Boolean;
-- Getter of ObjectFlow::isMultireceive.
--
-- Tells whether the objects in the flow are gathered from respondents to
-- multicasting.
overriding procedure Set_Is_Multireceive
(Self : not null access UML_Object_Flow_Proxy;
To : Boolean);
-- Setter of ObjectFlow::isMultireceive.
--
-- Tells whether the objects in the flow are gathered from respondents to
-- multicasting.
overriding function Get_Selection
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access;
-- Getter of ObjectFlow::selection.
--
-- Selects tokens from a source object node.
overriding procedure Set_Selection
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access);
-- Setter of ObjectFlow::selection.
--
-- Selects tokens from a source object node.
overriding function Get_Transformation
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access;
-- Getter of ObjectFlow::transformation.
--
-- Changes or replaces data tokens flowing along edge.
overriding procedure Set_Transformation
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access);
-- Setter of ObjectFlow::transformation.
--
-- Changes or replaces data tokens flowing along edge.
overriding function Get_Activity
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Activities.UML_Activity_Access;
-- Getter of ActivityEdge::activity.
--
-- Activity containing the edge.
overriding procedure Set_Activity
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Activities.UML_Activity_Access);
-- Setter of ActivityEdge::activity.
--
-- Activity containing the edge.
overriding function Get_Guard
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access;
-- Getter of ActivityEdge::guard.
--
-- Specification evaluated at runtime to determine if the edge can be
-- traversed.
overriding procedure Set_Guard
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access);
-- Setter of ActivityEdge::guard.
--
-- Specification evaluated at runtime to determine if the edge can be
-- traversed.
overriding function Get_In_Group
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group;
-- Getter of ActivityEdge::inGroup.
--
-- Groups containing the edge.
overriding function Get_In_Partition
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition;
-- Getter of ActivityEdge::inPartition.
--
-- Partitions containing the edge.
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access;
-- Getter of ActivityEdge::inStructuredNode.
--
-- Structured activity node containing the edge.
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access);
-- Setter of ActivityEdge::inStructuredNode.
--
-- Structured activity node containing the edge.
overriding function Get_Interrupts
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_Access;
-- Getter of ActivityEdge::interrupts.
--
-- Region that the edge can interrupt.
overriding procedure Set_Interrupts
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_Access);
-- Setter of ActivityEdge::interrupts.
--
-- Region that the edge can interrupt.
overriding function Get_Redefined_Edge
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge;
-- Getter of ActivityEdge::redefinedEdge.
--
-- Inherited edges replaced by this edge in a specialization of the
-- activity.
overriding function Get_Source
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Activity_Nodes.UML_Activity_Node_Access;
-- Getter of ActivityEdge::source.
--
-- Node from which tokens are taken when they traverse the edge.
overriding procedure Set_Source
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Activity_Nodes.UML_Activity_Node_Access);
-- Setter of ActivityEdge::source.
--
-- Node from which tokens are taken when they traverse the edge.
overriding function Get_Target
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Activity_Nodes.UML_Activity_Node_Access;
-- Getter of ActivityEdge::target.
--
-- Node to which tokens are put when they traverse the edge.
overriding procedure Set_Target
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Activity_Nodes.UML_Activity_Node_Access);
-- Setter of ActivityEdge::target.
--
-- Node to which tokens are put when they traverse the edge.
overriding function Get_Weight
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access;
-- Getter of ActivityEdge::weight.
--
-- The minimum number of tokens that must traverse the edge at the same
-- time.
overriding procedure Set_Weight
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access);
-- Setter of ActivityEdge::weight.
--
-- The minimum number of tokens that must traverse the edge at the same
-- time.
overriding function Get_Is_Leaf
(Self : not null access constant UML_Object_Flow_Proxy)
return Boolean;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding procedure Set_Is_Leaf
(Self : not null access UML_Object_Flow_Proxy;
To : Boolean);
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding function Get_Redefined_Element
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Object_Flow_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Is_Consistent_With
(Self : not null access constant UML_Object_Flow_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two RedefinableElements
-- in a context in which redefinition is possible, whether redefinition
-- would be logically consistent. By default, this is false; this
-- operation must be overridden for subclasses of RedefinableElement to
-- define the consistency conditions.
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Object_Flow_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
overriding function All_Owning_Packages
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Object_Flow_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Object_Flow_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding procedure Enter_Element
(Self : not null access constant UML_Object_Flow_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Object_Flow_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Object_Flow_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Object_Flows;
|
osannolik/Ada_Drivers_Library | Ada | 46 | adb | package body STM32.Board is
end STM32.Board;
|
reznikmm/matreshka | Ada | 3,694 | 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_Print_Attributes is
pragma Preelaborate;
type ODF_Style_Print_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Print_Attribute_Access is
access all ODF_Style_Print_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Print_Attributes;
|
reznikmm/matreshka | Ada | 3,722 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body XML.Schema.Objects.Terms.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.XML_Schema.AST.Types.Term_Access) return XS_Term is
begin
return
(Ada.Finalization.Controlled with
Node => Matreshka.XML_Schema.AST.Object_Access (Node));
end Create;
end XML.Schema.Objects.Terms.Internals;
|
zhmu/ananas | Ada | 7,703 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . T H R E A D S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides facilities for creation or registration of foreign
-- threads for use as Ada tasks. In order to execute general Ada code, the
-- run-time system must know about all tasks. This package allows foreign
-- code, e.g. a C program, to create a thread that the Ada run-time knows
-- about, or to register the current thread.
-- For some implementations of GNAT Pro, the registration of foreign threads
-- is automatic. However, in such implementations, if the Ada program has no
-- tasks at all and no tasking constructs other than delay, then by default
-- the non-tasking version of the Ada run-time will be loaded. If foreign
-- threads are present, it is important to ensure that the tasking version
-- of the Ada run time is loaded. This may be achieved by adding "with
-- GNAT.Threads" to any unit in the partition.
with System;
with Ada.Task_Identification;
package GNAT.Threads is
type Void_Ptr is access all Integer;
function Create_Thread
(Code : System.Address; -- pointer
Parm : Void_Ptr; -- pointer
Size : Natural; -- int
Prio : Integer) -- int
return System.Address;
pragma Export (C, Create_Thread, "__gnat_create_thread");
-- Creates a thread with the given (Size) stack size in bytes, and
-- the given (Prio) priority. The task will execute a call to the
-- procedure whose address is given by Code. This procedure has
-- the prototype
--
-- void thread_code (void *id, void *parm);
--
-- where id is the id of the created task, and parm is the parameter
-- passed to Create_Thread. The called procedure is the body of the
-- code for the task, the task will be automatically terminated when
-- the procedure returns.
--
-- This function returns the Ada Id of the created task that can then be
-- used as a parameter to the procedures below.
--
-- C declaration:
--
-- extern void *__gnat_create_thread
-- (void (*code)(void *, void *), void *parm, int size, int prio);
function Register_Thread return System.Address;
pragma Export (C, Register_Thread, "__gnat_register_thread");
-- Create an Ada task Id for the current thread if needed.
-- If the thread could not be registered, System.Null_Address is returned.
--
-- This function returns the Ada Id of the current task that can then be
-- used as a parameter to the procedures below.
--
-- C declaration:
--
-- extern void *__gnat_register_thread ();
--
-- Here is a typical usage of the Register/Unregister_Thread procedures:
--
-- void thread_body ()
-- {
-- void *task_id = __gnat_register_thread ();
-- ... thread body ...
-- __gnat_unregister_thread ();
-- }
procedure Unregister_Thread;
pragma Export (C, Unregister_Thread, "__gnat_unregister_thread");
-- Unregister the current task from the GNAT run time and destroy the
-- memory allocated for its task id.
--
-- C declaration:
--
-- extern void __gnat_unregister_thread ();
procedure Unregister_Thread_Id (Thread : System.Address);
pragma Export (C, Unregister_Thread_Id, "__gnat_unregister_thread_id");
-- Unregister the task associated with Thread from the GNAT run time and
-- destroy the memory allocated for its task id.
-- If no task id is associated with Thread, do nothing.
--
-- C declaration:
--
-- extern void __gnat_unregister_thread_id (pthread_t *thread);
procedure Destroy_Thread (Id : System.Address);
pragma Export (C, Destroy_Thread, "__gnat_destroy_thread");
-- This procedure may be used to prematurely abort the created thread.
-- The value Id is the value that was passed to the thread code procedure
-- at activation time.
--
-- C declaration:
--
-- extern void __gnat_destroy_thread (void *id);
procedure Get_Thread (Id : System.Address; Thread : System.Address);
pragma Export (C, Get_Thread, "__gnat_get_thread");
procedure Get_Thread
(Id : Ada.Task_Identification.Task_Id; Thread : System.Address);
-- This procedure is used to retrieve the thread id of a given task.
-- The value Id is the value that was passed to the thread code procedure
-- at activation time or a Task_Id.
-- Thread is a pointer to a thread id that will be updated by this
-- procedure.
--
-- C declaration:
--
-- extern void __gnat_get_thread (void *id, pthread_t *thread);
function To_Task_Id
(Id : System.Address)
return Ada.Task_Identification.Task_Id;
-- Ada interface only.
-- Given a low level Id, as returned by Create_Thread, return a Task_Id,
-- so that operations in Ada.Task_Identification can be used.
function Make_Independent return Boolean;
-- If a procedure loads a shared library containing tasks, and that
-- procedure is considered to be a master by the compiler (because it
-- contains tasks or class-wide objects that might contain tasks),
-- then the tasks in the shared library need to call Make_Independent
-- because otherwise they will depend on the procedure that loaded the
-- shared library.
--
-- See System.Tasking.Utilities.Make_Independent in s-tasuti.ads for
-- further documentation.
end GNAT.Threads;
|
tum-ei-rcs/StratoX | Ada | 994 | ads | -- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Software Configuration
--
-- Authors: Martin Becker ([email protected])
with STM32.Timers;
with STm32.Device;
-- @summary
-- Target-specific types for the hardware timers in Adaracer V1.
package HIL.Devices.Timers with SPARK_Mode is
subtype HIL_Timer is STM32.Timers.Timer;
subtype HIL_Timer_Channel is STM32.Timers.Timer_Channel;
-- the buzzer is routed to Timer 2 channel 1 (STM32.Device.PA15)
Timer_Buzzer_Port : STM32.Timers.Timer renames STM32.Device.Timer_2; -- Buuzer port
Timerchannel_Buzzer_Port : STM32.Timers.Timer_Channel renames STM32.Timers.Channel_1;
-- alternatively, we can use FMU AUX5 at the Servo pins (Timer 4 channel 2):
Timer_Buzzer_Aux : STM32.Timers.Timer renames STM32.Device.Timer_4;
Timerchannel_Buzzer_Aux : STM32.Timers.Timer_Channel renames STM32.Timers.Channel_2;
end HIL.Devices.Timers;
|
ytomino/gnat4drake | Ada | 1,334 | adb | with C.signal;
package body System.Interrupt_Management.Operations is
use type C.signed_int;
procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask) is
begin
Set_Interrupt_Mask (Mask => Mask, OMask => null);
end Set_Interrupt_Mask;
procedure Set_Interrupt_Mask (
Mask : access Interrupt_Mask;
OMask : access Interrupt_Mask)
is
errno : C.signed_int;
begin
errno := C.signal.sigprocmask (C.signal.SIG_SETMASK, Mask, OMask);
if errno /= 0 then
raise Program_Error;
end if;
end Set_Interrupt_Mask;
procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask) is
begin
Set_Interrupt_Mask (Mask => null, OMask => Mask);
end Get_Interrupt_Mask;
procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask) is
Dummy : C.signed_int;
begin
Dummy := C.signal.sigfillset (Mask);
end Fill_Interrupt_Mask;
procedure Add_To_Interrupt_Mask (
Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID)
is
Dummy : C.signed_int;
begin
Dummy := C.signal.sigaddset (Mask, Interrupt);
end Add_To_Interrupt_Mask;
procedure Copy_Interrupt_Mask (
X : out Interrupt_Mask;
Y : Interrupt_Mask) is
begin
X := Y;
end Copy_Interrupt_Mask;
end System.Interrupt_Management.Operations;
|
reznikmm/matreshka | Ada | 3,961 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Dots2_Attributes;
package Matreshka.ODF_Draw.Dots2_Attributes is
type Draw_Dots2_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Dots2_Attributes.ODF_Draw_Dots2_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Dots2_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Dots2_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Dots2_Attributes;
|
annexi-strayline/ASAP-Unicode | Ada | 6,650 | ads | ------------------------------------------------------------------------------
-- --
-- Unicode Utilities --
-- --
-- Unicode Character Database (UCD) Facilities --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Streams;
private with Ada.Characters.Conversions;
private with Ada.Strings.Wide_Wide_Unbounded;
private with Ada.Containers.Vectors;
package Unicode.UCD is
Bad_Data: exception;
type UCD_Entry is tagged private with Preelaborable_Initialization;
function Next_Entry
(Stream: not null access Ada.Streams.Root_Stream_Type'Class)
return UCD_Entry;
-- Parse from the beginning of a line in a UCD file, returning the result.
--
-- This should never fail when used correctly with a properly formatted
-- file. Therefore a parsing error is considered fatal for a given stream.
-- Once a Bad_Data exception is raised, it should be expected that
-- subsequent calls to Next_Extry will also fail.
--
-- Next_Entry is strict in parsing and makes no assuptions.
function First_Codepoint (E: UCD_Entry) return Wide_Wide_Character;
function Last_Codepoint (E: UCD_Entry) return Wide_Wide_Character;
-- Returns the first and last codepoint values for the entry.
function Property_Count (E: UCD_Entry) return Natural;
-- Returns the number of properties contained in the entry
function Property (E: UCD_Entry; Index: Positive) return String;
function Property (E: UCD_Entry; Index: Positive) return Wide_Wide_String;
-- Returns the value of the Property at the given index.
-- Raises CONSTRAINT_ERROR if the property index does not exist, or if
-- the property cannot be represented in a String
function Comment (E: UCD_Entry) return String;
function Comment (E: UCD_Entry) return Wide_Wide_String;
-- Returns the value of the comment (if any) at the end of the entry
-- (not including the initial '#')
private
package WWU renames Ada.Strings.Wide_Wide_Unbounded;
use type WWU.Unbounded_Wide_Wide_String;
subtype Unbounded_Wide_Wide_String is WWU.Unbounded_Wide_Wide_String;
package Property_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Unbounded_Wide_Wide_String);
use type Property_Vectors.Vector;
subtype Property_Vector is Property_Vectors.Vector;
type UCD_Entry is tagged
record
First, Last: Wide_Wide_Character;
Properties : Property_Vector;
Comment : Unbounded_Wide_Wide_String;
end record;
function First_Codepoint (E: UCD_Entry) return Wide_Wide_Character
is (E.First);
function Last_Codepoint (E: UCD_Entry) return Wide_Wide_Character
is (E.Last);
function Property_Count (E: UCD_Entry) return Natural
is (Natural (E.Properties.Length));
function Property (E: UCD_Entry; Index: Positive) return Wide_Wide_String
is (WWU.To_Wide_Wide_String (E.Properties(Index)));
function Property (E: UCD_Entry; Index: Positive) return String
is (Ada.Characters.Conversions.To_String
(Wide_Wide_String'(E.Property(Index))));
function Comment (E: UCD_Entry) return Wide_Wide_String
is (WWU.To_Wide_Wide_String (E.Comment));
function Comment (E: UCD_Entry) return String
is (Ada.Characters.Conversions.To_String
(WWU.To_Wide_Wide_String (E.Comment)));
end Unicode.UCD;
|
zhmu/ananas | Ada | 245 | ads | with Opt91_Pkg; use Opt91_Pkg;
package Opt91 is
type True_Relation_Rec is null record;
function Custom_Image (Self : True_Relation_Rec) return String;
package True_Relation is new Pure_Relation (Ty => True_Relation_Rec);
end Opt91;
|
clairvoyant/anagram | Ada | 3,612 | ads | package Ag.Goto_Table is
type Small_Integer is range -32_000 .. 32_000;
type Goto_Entry is record
Nonterm : Small_Integer;
Newstate : Small_Integer;
end record;
--pragma suppress(index_check);
subtype Row is Integer range -1 .. Integer'Last;
type Goto_Parse_Table is array (Row range <>) of Goto_Entry;
Goto_Matrix : constant Goto_Parse_Table :=
((-1,-1) -- Dummy Entry.
-- State 0
,(-13, 13),(-12, 10),(-11, 9),(-10, 8)
,(-9, 7),(-8, 6),(-7, 5),(-6, 4)
,(-5, 3),(-4, 2),(-3, 1),(-2, 20)
-- State 1
,(-13, 13),(-12, 10),(-11, 9),(-10, 8)
,(-9, 7),(-8, 6),(-7, 5),(-6, 4)
,(-5, 3),(-4, 21)
-- State 2
-- State 3
-- State 4
-- State 5
-- State 6
-- State 7
-- State 8
-- State 9
-- State 10
-- State 11
,(-13, 22)
-- State 12
,(-13, 23)
-- State 13
-- State 14
-- State 15
-- State 16
-- State 17
,(-13, 28)
-- State 18
-- State 19
-- State 20
-- State 21
-- State 22
-- State 23
-- State 24
,(-19, 39),(-18, 38),(-17, 37)
,(-16, 34),(-15, 35),(-13, 40)
-- State 25
,(-23, 43)
,(-20, 45),(-13, 44)
-- State 26
,(-23, 46),(-21, 47)
,(-13, 44)
-- State 27
,(-23, 48),(-22, 49),(-13, 44)
-- State 28
,(-14, 51)
-- State 29
,(-23, 52),(-13, 44)
-- State 30
-- State 31
-- State 32
,(-14, 53)
-- State 33
-- State 34
-- State 35
-- State 36
,(-13, 56)
-- State 37
,(-19, 39),(-18, 57),(-13, 40)
-- State 38
-- State 39
-- State 40
-- State 41
,(-19, 39),(-18, 38),(-17, 37),(-16, 34)
,(-15, 59),(-13, 40)
-- State 42
,(-19, 39),(-18, 38)
,(-17, 37),(-16, 34),(-15, 60),(-13, 40)
-- State 43
-- State 44
-- State 45
-- State 46
-- State 47
-- State 48
-- State 49
-- State 50
-- State 51
,(-13, 65)
-- State 52
-- State 53
,(-13, 67)
-- State 54
-- State 55
,(-19, 39),(-18, 38)
,(-17, 37),(-16, 68),(-13, 40)
-- State 56
-- State 57
-- State 58
,(-13, 70)
-- State 59
-- State 60
-- State 61
,(-24, 74),(-13, 73)
-- State 62
,(-13, 75)
-- State 63
,(-24, 76)
,(-13, 73)
-- State 64
,(-24, 77),(-13, 73)
-- State 65
-- State 66
-- State 67
-- State 68
-- State 69
,(-19, 39)
,(-18, 38),(-17, 81),(-13, 40)
-- State 70
-- State 71
-- State 72
-- State 73
-- State 74
-- State 75
-- State 76
-- State 77
-- State 78
-- State 79
,(-25, 87)
-- State 80
-- State 81
,(-19, 39),(-18, 57),(-13, 40)
-- State 82
-- State 83
,(-23, 88)
,(-13, 44)
-- State 84
,(-23, 89),(-13, 44)
-- State 85
,(-23, 90)
,(-13, 44)
-- State 86
-- State 87
-- State 88
-- State 89
-- State 90
-- State 91
-- State 92
-- State 93
-- State 94
);
-- The offset vector
GOTO_OFFSET : constant array (0.. 94) of Integer :=
( 0,
12, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 23, 24, 24, 24, 24, 24, 25, 25, 25,
25, 25, 25, 25, 31, 34, 37, 40, 41, 43,
43, 43, 44, 44, 44, 44, 45, 48, 48, 48,
48, 54, 60, 60, 60, 60, 60, 60, 60, 60,
60, 61, 61, 62, 62, 67, 67, 67, 68, 68,
68, 70, 71, 73, 75, 75, 75, 75, 75, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 80,
80, 83, 83, 85, 87, 89, 89, 89, 89, 89,
89, 89, 89, 89);
subtype Rule is Natural;
subtype Nonterminal is Integer;
Rule_Length : constant array (Rule range 0 .. 40) of Natural := ( 2,
1, 1, 2, 1, 1, 1, 1, 1,
1, 1, 1, 3, 6, 3, 4, 1,
3, 4, 1, 1, 2, 1, 4, 1,
3, 3, 3, 3, 3, 6, 6, 6,
1, 7, 1, 5, 1, 3, 1, 1);
Get_LHS_Rule : constant array (Rule range 0 .. 40) of Nonterminal := (-1,
-2,-3,-3,-4,-4,-4,-4,-4,
-4,-4,-4,-5,-5,-6,-7,-15,
-15,-16,-16,-17,-17,-18,-18,-19,
-19,-19,-8,-9,-10,-20,-21,-22,
-24,-12,-25,-11,-23,-23,-13,-14);
end Ag.Goto_Table;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.